LAB 01-Introduction To Prolog-Slides
LAB 01-Introduction To Prolog-Slides
Data Objects
variables constants
numbers atoms
parent(jane,alan).
Predicate name Arguments
head body
• Rule 2:
– predecessor(X,Z):- parent(X,Y),predecessor(Y,Z)
– Example:
? parent(tom, bob).
Is tom parent of bob ?
– Example:
? parent( tom, X).
Find X such that tom is parent of X.
• Example:
– ?date(D,M,2007)=date(10,jan,Y)
• D=10
• M=jan
• Y=2007