Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.44 KB

facts.md

File metadata and controls

53 lines (37 loc) · 1.44 KB
title permalink sidebar folder
Facts
/facts
docs_sidebar
docs

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.

Qualifier Name

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

atom ::= qualified_name '(' ( argument ( ',' argument )* )? ')'

Fact

A fact is an atom followed by a dot.

Fact

fact ::= atom '.'

{% include links.html %}