Basic Knowledge: Literals

Literals are the conclusion of terms and atoms. They have to start with a lower-case letter!


In the Prolog definition and consequently also in AgentSpeak(L++) all literals and → atoms begin with a lower-case letter but otherwise may also contain upper-case letters, slashes and minuses.

Note: Depending on the context in which literals are used, i.e. as belief, the slash / has a special semantic meaning, requiring additional adaptation to work as intended. See → beliefs for details.

Additionally literals enrich the expressibility of agent knowledge with negations, functors and value lists. They may also contain raw terms which define a wrapper around any native Java object type.

~(value(5), time(“12:00”))group/subgroup/any-namenegationfunctorvalues

For clarification see the following examples:


We would like to define that the sun is shining

sun( shining() )
The word sun and the word shining are atoms, the whole structure sun(shining()) is named literal.

Another example is a time definition:

We would like to say it is currently 2 o’clock post meridiem (pm)

time( current( hour(2), minute(0), period( pm() ) ) )
You can see, that a literal can store a list of other literals or values inside the brackets.

Based on the first example a negation is also possible:

We would like to say it is currently not raining

The tilde ~ in front of an atom defines the strong negation

A more practical example:

Consider the following Java excerpt to encode the states of a traffic light:

String  light = "green";
int     phase_duration = 60;
String  phase_program = "morning";
boolean applies_to_vehicles = true;
boolean applies_to_pedestrians = false;

Transformed in a meaningful way into literals:

light( green )
phase( duration(60), program(morning) )
appliesTo( vehicles )
~appliesTo( pedestrians )