Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 4 Predicate Logics

Similar presentations


Presentation on theme: "Chapter 4 Predicate Logics"— Presentation transcript:

1 Chapter 4 Predicate Logics

2 Representing simple facts in logic
The End It is raining. RAINING If it is raining then it is not sunny. RAINING  ~ SUNNY All men are motal. MORTALMAN man(mortal) X : man(X)  mortal(X) 1. Change sentences 1–8 on page 134 to predicate logic. 2. prove ~loyalto(Marcus,Caesar) on page 136 Fig. 5.2 AI & ES Chapter 4

3 Representing Instance and Isa
Figure 5.3 page 138. : representing class membership AI & ES Chapter 4

4 Computable functions and predicate
The End Figure 5.4 page 142. :a set of facts about Marcus AI & ES Chapter 4

5 Computable functions and predicate
Figure 5.5 page 143. : Prove Marcus is dead AI & ES Chapter 4

6 Propositional Logic Given Axioms Converted to Clause Form P P
(P Q) R ~P v ~Q v R (S v T)  Q ~S v Q ~T v Q T T AI & ES Chapter 4

7 EX05EX05 can_swim can_swim(What) , predicates type(symbol, symbol)
is_a(symbol, symbol) lives(symbol, symbol) can_swim(symbol) goal can_swim(What) , write("A ", What, " can swim."). clauses type(ungulate, animal). type(fish, animal). is_a(zebra, ungulate). is_a(herring, fish). is_a(shark, fish). lives(zebra, on_land). lives(frog, on_land). lives(frog, in_water). lives(shark, in_water). can_swim(Y) :- type(X, animal) , is_a(Y, X) , lives(Y, in_water). AI & ES Chapter 4

8 predecessor Z X Y parent parent sister For any X and Y,
X is a sister of Y if Both X and Y have the same parent, and X is a female. Sister(X,Y) :- parent(Z,X), parent(Z,Y), female(X). AI & ES Chapter 4

9 predecessor A B C D E parent parent parent parent 344-471 AI & ES
Chapter 4

10 predecessor A B C D E predecessor(X,Z) :- parent(X,Y), parent(Y,Z).
parent(Y1,Y2), parent(Y2,Z). parent B parent C predecessor(X,Z) :- parent(X,Y1), parent(Y1,Y2), parent(Y2,Y3), parent(Y3,Z). parent D parent E AI & ES Chapter 4

11 Parent1.Pro parent(jim,joe). 344-471 AI & ES Chapter 4 predicates
parent(symbol,symbol) predecessor(symbol,symbol) clauses parent(pam,bob). parent(tom,bob). parent(bob,ann). parent(ann,jim). parent(jim,joe). parent(joe,john). parent(john,jack). parent(tom,liz). pam bob ann jim joe john jack predecessor(X,Z) :- parent(X,Z). predecessor(X,Z) :- parent(X,Y), parent(Y,Z). predecessor(X,Z) :- parent(X,Y1),parent(Y1,Y2),parent(Y2,Z). predecessor(X,Z) :- parent(X,Y1),parent(Y1,Y2),parent(Y2,Y3) parent(Y3,Z). AI & ES Chapter 4

12 predecessor A B C D E For all X and Z,
X is a predecessor of Z if there is a Y such that 1. X is a parent of Y and 2. Y is a predecessor of Z. A parent B parent C parent D parent E AI & ES Chapter 4

13 Parent2.Pro parent(jim,joe). predecessor(X,Z) :- parent(X,Z).
predicates parent(symbol,symbol) predecessor(symbol,symbol) clauses parent(pam,bob). parent(tom,bob). parent(bob,ann). parent(ann,jim). parent(jim,joe). parent(joe,john). parent(john,jack). parent(tom,liz). predecessor(X,Z) :- parent(X,Z). predecessor(X,Z) :- parent(X,Y), predecessor(Y,Z). AI & ES Chapter 4

14 ISA Relationship isa isa isa isa isa isa isa isa isa isa isa
Animal kingdom Plant kingdom isa isa isa Animal Human plant isa isa isa isa Dog Cat Suwit Sunee Flower isa isa isa isa Toop Mew Rose Carnation AI & ES Chapter 4

15 isa1.Pro 344-471 AI & ES Chapter 4 is(X,Z) :- isa(X,Z).
predicates isa(symbol,symbol) is(symbol,symbol) clauses isa(human,animal_kingdom). isa(plant,plant_kingdon). isa(flower,plant). isa(rose,flower). isa(carnation,flower). isa(suwit,human). isa(sunee,human). isa(dog,animal). isa(animal,animal_kingdom). isa(cat,animal). isa(toop,dog). isa(mew,cat). isa(white,cat). is(X,Z) :- isa(X,Z). is(X,Z) :- isa(X,Y), is(Y,Z). AI & ES Chapter 4

16 bear.Pro ?black(X),big(X) ?brown(X),big(X) ?big(X),black(X)
predicates big(symbol) small(symbol) brown(symbol) black(symbol) gray(symbol) dark(symbol) clauses big(bear). big(elephant). small(cat). brown(bear). black(cat). gray(elephant). dark(Z) :- black(Z). dark(Z) :- brown(Z). ?black(X),big(X) ?brown(X),big(X) ?big(X),black(X) ?black(X), big(X) No solution ?brown(X),big(X) X=bear ?big(X),black(X) AI & ES Chapter 4

17 One that would have the fruit
must climb the tree


Download ppt "Chapter 4 Predicate Logics"

Similar presentations


Ads by Google