Chapter 2 Slide, Data objects, Figure 2.1 Slide, Atoms Slide, Anonymous variables vi ch1.pl, and uncomment has_a_child with singleton variable ?- consult( 'ch1.pl'). vi ch1.pl, and uncomment has_a_child with anonymous variable ?- consult( 'ch1.pl'). Avoid singleton variables. Slide, Structures Slide, Name, Arity Slide, Terms Slide, Figure 2.3 Point Reveal: Segment Triangle Slide, Fiogure 2.4 Slide, Figure 2.5 Discuss representation Slide, Figure 2.6 Discuss representation Reveal (c) and (d) Slide, Figure 2.7 Demo the caption Slide, Figure 2.8 ch2.pl, scroll to Figure 2.8 ?- [ch2]. is a shortcut for consult Demo ?- vertical( seg( point( 1, 1), point( 1, 2))). ?- vertical( seg( point( 1, 1), point( 2, Y))). ?- horizontal( seg( point( 1, 1), point( 2, Y))). ?- vertical( seg(point (2,3)), P)). Slide, Matching Demo ?- a( b, c) = a( b, c). ?- a( B, c) = a( b, c). ?- a( b, c) = a( B, C). ?- a( B, c) = a( D, c). ?- a( B, C) = a( b, b). ?- a( b, c( d, e)) = a( F, G). ?- a( b, c( d( e, f), g( h))) = a( F, c( I, g( J))). ?- a( B, C, D) = a( E, f, G), a( B, C, D) = a( e, F, G). ?- date( D, M, 2001) = date( D1, may, Y1). ?- date( D, M, 2001) = date( D1, may, Y1), date( D, M, 2001) = date( 15, M, Y). Experiment ?- a = 5. ?- X = 5. ?- 5 = X. ?- X = Y, Y = a. etc. Slide, Definitions ; only used occasionally. Slide, Declarative meaning Note: the program is the database. The goal G is a query. Slide, Procedural meaning Analogous to knowing how to program with recursion and understanding its implementation on the run-time stack. Slides The bear, elephant, cat example is figure 2.10 in the book. Slide Pseudocode of unification algorithm Slides, Reordering clauses and goals