From Wikibooks, open books for an open world
< Prolog
Jump to: navigation, search

This is (or will be) a glossary of common Prolog terms.


Arity: The number of arguments that a predicate takes. E.g. member(X,List) has arity 2. In documentation, the arity of a predicate is written as predicate/arity. E.g. member/2.

Backtracking: If a sub-goal fails, the built-in Prolog search mechanism will go back to the parent-goal. Any variables that were instantiated in the sub-goal will be un-instantiated. Prolog will then search for a new way of satisfying the sub-goal. This process is called backtracking.

Clause: A single clause of a relation, usually defined as Head :- Body, but see also Fact.

Fact: A Clause with no body, that is a Head on its own.


Goal: See query.

Ground Term: A Term which has no logic variables in it.

Predicate: A set of clauses or a relation.


Relation: Synonym for Predicate.


Rule: See clause.

Term: Every object in Prolog is a term, that includes variables, compounds, numbers, source code.


Singleton Variable: If a variable is named only once in a clause, usually it is replace with _.