170 likes | 327 Views
Chapter 4 Predicate Logics. 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)
E N D
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 Chapter 4
Representing Instance and Isa Figure 5.3 page 138. : representing class membership Chapter 4
Computable functions and predicate The End Figure 5.4 page 142. :a set of facts about Marcus Chapter 4
Computable functions and predicate Figure 5.5 page 143. : Prove Marcus is dead Chapter 4
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 Chapter 4
EX05EX05 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). predicates type(symbol, symbol) is_a(symbol, symbol) lives(symbol, symbol) can_swim(symbol) goal can_swim(What) , write("A ", What, " can swim."). Chapter 4
Z X Y predecessor 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). Chapter 4
A B C E D predecessor parent parent parent parent Chapter 4
A B C E D predecessor predecessor(X,Z) :- parent(X,Y), parent(Y,Z). predecessor(X,Z) :- parent(X,Y1), parent(Y1,Y2), parent(Y2,Z). parent parent predecessor(X,Z) :- parent(X,Y1), parent(Y1,Y2), parent(Y2,Y3), parent(Y3,Z). parent parent Chapter 4
ann bob pam jim john joe jack Parent1.Pro • 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), 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). Chapter 4
A B C E D predecessor 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. parent parent parent parent Chapter 4
Parent2.Pro • 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). Chapter 4
ISA Relationship 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 Chapter 4
isa1.Pro • 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). Chapter 4
bear.Pro • 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) No solution Chapter 4
One that would have the fruit must climb the tree