Chapter 1 Slide, Intro Prolog. Slide, Using Prolog. Slide, Figure 1.1, facts. Draw Figure 1.1 on board for later reference. Write parent facts on board also for later reference. Slide, Demo: ?- consult( ‘ch1.pl’). ?- halt. % to quit Show ch1.pl Demo ?- parent( bob, pat). ?- parent( liz, pat). ?- parent( tom, ben). ?- parent( X, liz). ?- parent( bob, X). ?- parent( X, Y). ; % next solution a % all solutions Slide, Figure 1.2. Demo ?- parent( Y, jim), parent( X, Y). Slide, Demo Who are tom’s grandchildren? ?- parent( tom, X), parent( X, Y). , is conjunction Try reverse order, same result. Demo trace of ?- parent( tom, X), parent( X, Y). then work through the trace on the slides Commands are ?- trace. ?- notrace. Back to slide Do ann and pat have a common parent? ?- parent( X, ann), parent( X, pat). Slide, Bratko vs gprolog Slide, Defining relations by rules, Figure 1.3 Demo mother Demo grandparent Scroll ch1.pl Ask for definition of sister. Try without X \=Y to see what happens. Slide, Clause goal, head, body Slide, Recursive rules, Figure 1.5 Slide, Recursive rules, Figure 1.6 Slide, Recursive rules, Figure 1.7 Rule for ancestor Demo query ?- ancestor( tom, pat). Show the trace. Then work through the slide sequence. Slide, Figure 1.9 Compare with trace of ancestor( tom, pat).