011 Intro To Prolog
011 Intro To Prolog
Intro to Prolog
Topic & Structure of The Lesson
• Facts
• Rules
• Prolog
• Fact
• Rules
likes(john, mary).
tall(john).
tall(sue).
short(fred).
teaches(alison, artificialIntelligence).
• Rules:
likes(fred, X) :- tall(X).
examines(Person, Course) :- teaches(Person, Course).
– NOTE: Use of capitals (or words starting with capitals) for variables.
X = john ? ;
X = sue ? ;
no
parent(bob, ted).
parent(ted, kev).
parent(ted, betty).
parent(betty, meg).
?- parent(ted,betty).
?- parent(betty,ted).
?- parent(ted,X).
?- ancestor(ted,X).
Q&A
• Prolog