Facts are clauses that unconditional hold; they are rules with a head, but no rule body. In facts, all arguments must be constant terms.
In the example,
.decl A(x:number, y:number) // declaration of relation A
A(1,2). // facts of relation A
A(2,3).
.output A
the relation A
has two facts: A(1,2).
and A(2,3)
. Note that facts can also be
loaded with the input directive.
Syntax
In the following, we define facts more formally using syntax diagrams and EBNF. The syntax diagrams were produced with Bottlecaps.
A qualified name is a sequence of identifiers separated by .
to disambiguate relations that are instantiated by components.
qualified_name ::= IDENT ( '.' IDENT )*
Atom
An atom is a relation name followed by its arguments. The arguments must be constants. Nullary relations have no arguments.
atom ::= qualified_name '(' ( argument ( ',' argument )* )? ')'
Fact
A fact is an atom followed by a dot.
fact ::= atom '.'