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.
For clarification see the following examples:
We would like to define that the sun is shiningThe word
sun( shining() )
sunand the word
shiningare atoms, the whole structure
sun(shining())is named literal.
We would like to say it is currently 2 o’clock post meridiem (pm)You can see, that a literal can store a list of other literals or values inside the brackets.
time( current( hour(2), minute(0), period( pm() ) ) )
Based on the first example a negation is also possible:
We would like to say it is currently not rainingThe 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 )