Prolog/Glossary
From Wikibooks, the open-content textbooks collection
This is (or will be) a glossary of common Prolog terms.
Argument
Arity: The number of arguments that a predicate take. 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.
Functor
Goal: See query.
Ground Term: A Term which has no logic variables in it.
Predicate: A set of clauses or a relation.
Query
Relation: Synonym for Predicate.
Recursion/Recursive
Rule: See clause.
Term: Every object in Prolog is a term, that includes variables, compounds, numbers, source code.
Unification
Singleton Variable: If a variable is named only once in a clause, usually it is replace with _.