Sie sind auf Seite 1von 34

Artificial Intelligence (Part 2b) Knowledge Representation and Search: PREDICATE CALCULUS

Basic concepts of logic


syntax: formal structure of sentences semantics: truth of sentences wrt models entailment: necessary truth of one sentence given another inference: deriving sentences from other sentences soundness: derivations produce only entailed sentences completeness: derivations can produce all entailed sentences

Recall: Propositional Logic

Predicate calculus

Predicate calculus is also known as First Order Logic (FOL) Predicate calculus includes:

All of propositional logic


Logical values true, false Variables x, y, a, b,... Connectives , , , ,

Constants Predicates Functions Quantifiers

KingJohn, 2, Villanova,... Brother, >,... Sqrt, MotherOf,... ,


4

Constants, functions, and predicates

A constant represents a thing--it has no truth value, and it does not occur bare in a logical expression

Examples: DavidMatuszek, 5, Earth, goodIdea

Given zero or more arguments, a function produces a constant as its value:

Examples: motherOf(DavidMatuszek), add(2, 2), thisPlanet()

A predicate is like a function, but produces a truth value

Examples: greatInstructor(DavidMatuszek), isPlanet(Earth), greater(3, add(2, 2))

First-Order Logic (FOL)

First-Order Logic (FOL)

First Order Predicate Logic


Includes 2 symbols:

Variable quantifiers

(existential) and (universal)

A quantifier followed by a variable and a sentence:


X likes(X,pizza) ; true for all X Y friends(Y,amir) ; true if there is atleast one

Universal Quantification

Universal quantification

The universal quantifier, , is read as for each or for every


Example: x, x2 0 (for all x, x2 is greater than or equal to zero) Typically, is the main connective with :

x, at(x,Villanova) smart(x) means Everyone at Villanova is smart

Common mistake: using as the main connective with :


x, at(x,Villanova) smart(x) means Everyone is at Villanova and everyone is smart

If there are no values satisfying the condition, the result is true

Example: x, isPersonFromMars(x) smart(x) is true


10

Example

Example

Existential Quantification

Existential quantification

The existential quantifier, , is read for some or there exists


Example: x, x2 < 0 (there exists an x such that x2 is less than zero) Typically, is the main connective with :

x, at(x,Villanova) smart(x) means There is someone who is at Villanova and is smart

Common mistake: using as the main connective with : x, at(x,Villanova) smart(x)


This is true if there is someone at Villanova who is smart... ...but it is also true if there is someone who is not at Villanova By the rules of material implication, the result of F T is T
14

Example

Example

Properties of Quantifiers

????

Properties of Quantifiers

Properties of quantifiers

x y is the same as y x x y is the same as y x x y is not the same as y x x y Loves(x,y)


y x Loves(x,y)

There is a person who loves everyone in the world More exactly: x y (person(x) person(y) Loves(x,y)) Everyone in the world is loved by at least one person

Quantifier duality: each can be expressed using the other x Likes(x,IceCream) x Likes(x,IceCream) x Likes(x,Broccoli) x Likes(x,Broccoli)
From aima.eecs.berkeley.edu/slides-ppt, chs 7-9

19

Quantifier Duality

Fun with Sentences

Proof methods

Proofs

Example Proof

cat cat

cat

cat cat
cat

Search with Primitive Inference Rules

Search with Primitive Inference Rules

Unification

The unification algorithm

The unification algorithm

Parentheses

Parentheses are often used with quantifiers Unfortunately, everyone uses them differently, so dont be upset at any usage you see Examples: (x) person(x) likes(x,iceCream) (x) (person(x) likes(x,iceCream)) (x) [ person(x) likes(x,iceCream) ] x, person(x) likes(x,iceCream) x (person(x) likes(x,iceCream)) I prefer parentheses that show the scope of the quantifier x (x > 0) x (x < 0)

30

More rules

Now there are numerous additional rules we can apply! Here are two exceptionally important rules:

x, p(x) x, p(x) If not every x satisfies p(x), then there exists a x that does not satisfy p(x) x, p(x) x, p(x) If there does not exist an x that satisfies p(x), then all x do not satisfy p(x)

In any case, the search space is just too large to be feasible This was the case until 1970, when J. Robinson discovered resolution
31

Interlude: Definitions

syntax: defines the formal structure of sentences semantics: determines the truth of sentences wrt (with respect to) models entailment: one statement entails another if the truth of the first means that the second must also be true inference: deriving sentences from other sentences soundness: derivations produce only entailed sentences completeness: derivations can produce all entailed sentences

32

Try thisrepresent in Predicate Logic

If it doesnt rain on Monday, Naim will go to the mountain All children are cute Nobody likes mouse

weather (rain, Monday) go(Naim,mountain) X (children(X) cute(X)) X likes(X,mouse)

Translate into Predicate Logic:


1. If it doesnt rain today, I will go to the class. 2. Putih is a siamese and a good cat. 3. All basketball players are tall. 4. Some people like reading. 5. I have a brother who is a teacher.

Das könnte Ihnen auch gefallen