Definite Clause Deduction

applet home
help contents
quickstart
general help
tutorials
 

 

Tutorial Five (Supplementary): Syntax

For the most part, the syntax that the applet uses is the syntax used by CIlog. However, it does not implement all of CIlog's built-in features and functionality. There are three components in the language: terms, atoms, and clauses.

Terms: A term is a variable, a constant, or a compound term. A variable is a sequence of alphanumeric characters that starts with an uppercase letter. The only exception is "_", which is a variable that can unify with anything. A constant is either a sequence of alphanumeric characters starting with a lowercase letter or an integer. Finally, a compound term has the form f(t1,...,tn), where f is a function symbol (a sequence of alphanumeric characters starting with a lowercase letter) and the ti are terms. However, arithmetic expressions are also considered to be compound terms. Some atoms require arithmetic expressions as arguments. The infix functions "+", "-", "*", and "mod" are implemented, with the usual interpretation.

Atoms: Atoms, also called goals, are almost identical in syntax to compound terms. They are of the form p(t1,...,tn), where p is a predicate symbol (a sequence of alphanumeric characters starting with a lowercase letter) and the ti are terms. It is also possible to have a goal with no terms and only a predicate symbol. As with compound terms, there are also (infix) built-in predicates:

An atom may also be negated: ~ g is true if g fails finitely. If g is an arithmetic expression that is not yet ground, for example, it does not fail in finitely many steps. The depth bound for negation as failure queries is the same as the depth bound for the search tree.

Clauses: Clauses, which are also called rules, are made up of two parts. The first part, the head, is simply a goal. Every clause must have a head, and must end with a period. The body of a clause is a conjunction of atoms g1 & ... & gn. Thus, the clause is either of the form h. or h <- b where h is the head of the clause and b is the body.