A Prolog program consists of predicate definitions. A predicate denotes a property or relationship between objects. Definitions consist of clauses. A clause has a head and a body (Rule) or just a head (Fact). A head consists of a predicate name and arguments.
How do you write a predicate in Prolog?
The above example regards as a predicate with no arguments, i.e., go/0. , and 1 clause respectively. The rules are defined by the final two clauses.
...
Predicates in Prolog
...
Predicates in Prolog
- parent(emma, robert).
- parent(A, B) :- father(A, B).
- parent(A, B) :- mother(A, B).
- father(kevin, mary).
- mother(anne, mary).
What is predicate logic in Prolog?
Prolog is a programming language based on predicate logic. ... In the process of proving the goal to be true, using substitution and the other rules of inference, Prolog substitutes values for the variables in the goal, thereby "computing" an answer.