LPS implements the SLD with negation as failure (SLDNF) in addition to Horn clauses. Similar to first order logic and Prolog, the LPS language can be used to write and express logic programs. Logic program in LPS can be considered as the expression of an agent's beliefs.
A time-independent fact (i.e. not a fluent) can be defined on its own in a LPS program. For example, to indicate that curtains are flammable, you can write the fact as:
To express a clause in the form "
conclusion if conditions", you need to use the "
<-" if operator to separate the conclusion term (also known as the head of the clause) and conditions (also known as the body of the clause). For example to say that eliminating the fire is a way to deal with a fire occurring, you can write:
deal_with_fire(T1, T2) <- eliminate(T1, T2).
If there are more than one conjuncts in the "conditions", they need to be separated using the "," comma symbol. The comma symbol is also read as the logic ∧ "and" operator. The following example expresses the steps involving the activation of a personnel.
activate(P, T1, T4) <- moveOut(P, T1, T2), putOutFire(T2, T3), reportBack(P, T3, T4).
To express a constraint (or formally definite denial), you can leave the the condition term (i.e. the head) to be empty. For example, to express that it is not possible to dispose trash into a bin while the bin is locked:
<- dispose(_Trash, Bin), locked(Bin).
Facts and clauses need to be terminated by a period symbol "
." to indicate that the end of the fact/clause.