Top Banner
1 Chapter 4 Predicate Logics
17

1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic It is raining. RAINING If it is raining then it is not.

Dec 14, 2015

Download

Documents

Kennedy Avary
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

1

Chapter 4

Predicate Logics

Page 2: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 2

Representing simple facts in logic

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

Page 3: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 3

Representing Instance and Isa

Figure 5.3 page 138. : representing class membership

Page 4: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 4

Computable functions and predicate

Figure 5.4 page 142. :a set of facts about Marcus

Page 5: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 5

Computable functions and predicate

Figure 5.5 page 143. : Prove Marcus is dead

Page 6: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 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

Page 7: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 7

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).

EX05EX05 can_swim

Page 8: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 8

Z

X Y

parent parent

sister

For any X and Y,

X is a sister of Y if

1. Both X and Y have the same parent, and

2. X is a female.

Sister(X,Y) :- parent(Z,X), parent(Z,Y), female(X).

predecessor

Page 9: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 9

A

B

C

E

D

parent

parent

parent

parent

predecessor

Page 10: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 10

A

B

C

E

D

predecessor(X,Z) :-

parent(X,Y),

parent(Y,Z).

parent

parent

parent

parent

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).

predecessor

Page 11: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 11

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).

ann

bob

pam

jim

john

joe

jack

Parent1.Pro

Page 12: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 12

A

B

C

E

D

parent

parent

parent

parent

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.

predecessor

Page 13: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 13

predecessor(X,Z) :- parent(X,Z).

predecessor(X,Z) :- parent(X,Y), predecessor(Y,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).

Parent2.Pro

Page 14: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 14

Animal kingdom Plant kingdom

Animal Human

Dog Cat

Toop

Suwit

Mew

Sunee

plant

Flower

Rose Carnation

isa

isa

isa

isa isa

isaisa

isa

isa

isaisa

ISA Relationship

Page 15: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 15

is(X,Z) :- isa(X,Z).

is(X,Z) :- isa(X,Y), is(Y,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).

isa1.Pro

Page 16: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

344-471 AI & ES Chapter 4 16

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

bear.Pro

Page 17: 1 Chapter 4 Predicate Logics. 344-471 AI & ESChapter 4 2 Representing simple facts in logic  It is raining. RAINING  If it is raining then it is not.

17