1 propositional logic first order logic based on russell and norvig slides

63
1 Propositional Logic First Order Logic Based on Russell and Norvig slides

Post on 21-Dec-2015

246 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

1

Propositional Logic First Order Logic

Based on Russell and Norvig slides

Page 2: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

2

Propositional Logic

Propositional logic is concerned with the truth or falsehood of statements (propositions) like:

the valve is closedfive plus four equals nineConnectives: and

or not implies equivalent

(X (Y Z)) ((X Y) (X Z))“X implies Y and Z is the same as X implies Y and X implies Z”

Page 3: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

3

Propositional Logic

• Propositional Logic is declarative, pieces of syntax correspond to facts

• Propositional Logic is compositional – Meaning of A B derived from meaning of A

and B

• Meaning in Propositional Logic is context-independent

• Propositional Logic has limited expressive power– Cannot say “Scottish men are careful with

money”

Page 4: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

4

Propositional logic

•Logical constants: true, false •Propositional symbols: P, Q, S, ... •Wrapping parentheses: ( … )•Sentences are combined by connectives: ...and ...or ...implies ..is equivalent ...not

Page 5: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

5

Propositional logic (PL)

• A simple language useful for showing key ideas and definitions

• User defines a set of propositional symbols, like P and Q. • User defines the semantics of each of these symbols, e.g.:

– P means "It is hot" – Q means "It is humid" – R means "It is raining"

• A sentence (aka formula, well-formed formula, wff) defined as: – A symbol – If S is a sentence, then ~S is a sentence (e.g., "not”)– If S is a sentence, then so is (S)– If S and T are sentences, then (S v T), (S ^ T), (S => T),

and (S <=> T) are sentences (e.g., "or," "and," "implies," and "if and only if”)

– A finite number of applications of the above

Page 6: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

6

Examples of PL sentences

• (P ^ Q) => R “If it is hot and humid, then it is raining”

•Q => P “If it is humid, then it is hot”

•Q “It is humid.”

Page 7: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

7

A BNF grammar of sentences in propositional logic

S := <Sentence> ;<Sentence> := <AtomicSentence> | <ComplexSentence> ;

<AtomicSentence> := "TRUE" | "FALSE" | "P" | "Q" | "S" ;<ComplexSentence> := "(" <Sentence> ")" | <Sentence> <Connective> <Sentence> |

"NOT" <Sentence> ;<Connective> := "NOT" | "AND" | "OR" | "IMPLIES" | "EQUIVALENT" ;

Page 8: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

8

Some terminology

• The meaning or semantics of a sentence determines its interpretation.

• Given the truth values of all of symbols in a sentence, it can be “evaluated” to determine its truth value (True or False).

• A model for a Knowledge Base (a set of sentences) is a “possible world” in which each sentence in the KB is True. – We say that the KB is satisfiable

• A valid sentence or tautology is a sentence that is True under all interpretations, no matter what the world is actually like or what the semantics is. Example?

• An inconsistent sentence or contradiction is a sentence that is False under all interpretations. The world is never like what it describes. Example?

• P entails Q, written P |= Q, means that whenever P is True, so is Q. In other words, all models of P are also models of Q.

Page 9: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

9

Truth tables

Page 10: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

10

Truth tables II

The five logical connectives:

A complex sentence:

Page 11: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

11

Models of complex sentences

Page 12: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

12

Inference rules

•Logical inference is used to create new sentences that logically follow from a given set of sentences (KB).

•An inference rule is sound if every sentence X produced by an inference rule operating on a KB logically follows from the KB. (That is, the inference rule does not create any contradictions)

•An inference rule is complete if it is able to produce every expression that logically follows from (is entailed by) the KB.

•Note the analogy to sound and complete search algorithms.

Page 13: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

13

Sound rules of inference

• Here are some examples of sound rules of inference. • Each can be shown to be sound using a truth table: A rule is

sound if its conclusion is true whenever the premise is true.

RULE PREMISE CONCLUSIONModus Ponens A, A => B BAnd Introduction A, B A ^ BAnd Elimination A ^ B ADouble Negation ~~A AUnit Resolution A v B, ~B AResolution A v B, ~B v C A v C

Page 14: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

14

Soundness of modus ponens

A B A → B OK?

True True True True False False False True True False False True

Page 15: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

15

Soundness of the resolution inference rule

Page 16: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

16

Proving things

• A proof is a sequence of sentences, where each sentence is either a premise or a sentence derived from earlier sentences in the proof by one of the rules of inference.

• The last sentence is the theorem (also called goal or query) that we want to prove.

• Example for the “weather problem” given above.

1 Hu Premise “It is humid”

2 Hu=>Ho Premise “If it is humid, it is hot”

3 Ho Modus Ponens(1,2) “It is hot”4 (Ho^Hu)=>R Premise “If it’s hot &

humid, it’s raining”5 Ho^Hu And Introduction(1,2) “It is hot and

humid”6 R Modus Ponens(4,5) “It is raining”

Page 17: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

17

Entailment and derivation

•Entailment: KB |= Q– Q is entailed by KB (a set of premises or

assumptions) if and only if there is no logically possible world in which Q is false while all the premises in KB are true.

– Or, stated positively, Q is entailed by KB if and only if the conclusion is true in every logically possible world in which all the premises in KB are true.

•Derivation: KB |- Q– We can derive Q from KB if there is a proof

consisting of a sequence of valid inference steps starting from the premises in KB and resulting in Q

Page 18: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

18

Two important properties for inference

Soundness: If KB |- Q then KB |= Q– If Q is derived from a set of sentences KB using a

given set of rules of inference, then Q is entailed by KB.

– Hence, inference produces only real entailments, or any sentence that follows deductively from the premises is valid.

Completeness: If KB |= Q then KB |- Q– If Q is entailed by a set of sentences KB, then Q can

be derived from KB using the rules of inference. – Hence, inference produces all entailments, or all valid

sentences can be proved from the premises.

Page 19: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

19

Complexity

•Theorem: Determining if a set of sentences in PL is satisfiable (i.e. has a model) in NP-complete (Cook, 1971)– Determining if a sentence is valid is co-NP-complete

– It is unlikely that we can find a polynomial algorithms for these problems

Page 20: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

20

Complexity

• A sentence in PL is called a Horn sentence if it is of the form

P1 P2 ... Pn Q

or equivalently ¬P1 ¬P2 ... ¬Pn Q

• Theorem: If φ is a conjunction of Horn sentences then determining if φ is satisfiable can be done in polynomial time

Page 21: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

21

Reasoning in PL

• A proof is a sequence of applications of inference rules– Finding proofs is exactly like finding

solutions in search problems– If we model the successor function to

generate all possible applications of inference rules, we can use any search algorithm• BFS, DFS, A*, etc.

– Forward or Backward Search

Page 22: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

22

Resolution

• Resolution yields a complete inference algorithm when coupled with any complete search algorithm– Unit Resolution

• One resolvent is a unit clause • A v B v C, ~B -> A v C

– Binary Resolution• One resolvent is a binary clause• A v B v C, D v ~B -> A v C v D

– Full Resolution• Resolvents of any arity• A v B v C, A v D v ~B -> ?

factoring

Page 23: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

23

Resolution

• It is easy to see that Resolution is sound– Consider two clauses l1 v … v lk and m1 v …

mn, where li and mj are complementary (i.e. li = ~mj)

– If li is true then mj is false and m1 v … v mj-1 v mj+1 v … v mn must be true

– If li is false then l1 v … v lj-1 v lj+1 v … v ln must be true• This is what resolution gives: l1 v … v lj-1 v lj+1 v …

v ln v m1 v … v mj-1 v mj+1 v … v mn

Page 24: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

24

Resolution

• Resolution is also refutation complete– It can always be used to either confirm

or refute a sentence• E.g. we can use it to answer the question of

whether A v B is true

– But it cannot be used to enumerate true sentences• E.g. if we know that A is true we cannot

automatically generate the consequence A v B

Page 25: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

25

A Resolution Algorithm

• Based on proof by contradiction– Prove KB |= a by showing KB ~a is

unsatisfiable• First the query is converted into CNF

(conjunctive normal form) • Then the resolution rule is applied to the

resulting clauses• New clauses are added to the set of clauses (if

not already there)• The process continues until either

– No new clauses can be added– The empty clause is derived (i.e. l ~l)

more on this later

Page 26: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

26

Propositional logic is a weak language

•Hard to identify “individuals.” E.g., Mary, 3 •Can’t directly talk about properties of individuals

or relations between individuals. E.g. “Bill is tall” •Generalizations, patterns, regularities can’t easily

be represented. E.g., all triangles have 3 sides •First-Order Logic (abbreviated FOL or FOPC) is

expressive enough to concisely represent this kind of situation.FOL adds relations, variables, and quantifiers, e.g.,•“Every elephant is gray”: x (elephant(x) → gray(x))•“There is a white alligator”: x (alligator(X) ^ white(X))

Page 27: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

27

Example

•Consider the problem of representing the following information: –Every person is mortal. –Confucius is a person. –Confucius is mortal.

•How can these sentences be represented so that we can infer the third sentence from the first two?

Page 28: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

28

Example II• In PL we have to create propositional symbols to

stand for all or part of each sentence. For example, we might do: P = “person”; Q = “mortal”; R = “Confucius”

•so the above 3 sentences are represented as: P => Q; R => P; R => Q

•Although the third sentence is entailed by the first two, we needed an explicit symbol, R, to represent an individual, Confucius, who is a member of the classes “person” and “mortal.”

• To represent other individuals we must introduce separate symbols for each one, with means for representing the fact that all individuals who are “people” are also "mortal.”

Page 29: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

29

Summary (so far)• The process of deriving new sentences from old one is

called inference. – Sound inference processes derives true conclusions

given true premises. – Complete inference processes derive all true

conclusions from a set of premises. • A valid sentence is true in all worlds under all

interpretations. • If an implication sentence can be shown to be valid, then -

given its premise - its consequent can be derived. • Different logics make different commitments about what

the world is made of and what kind of beliefs we can have regarding the facts. – Logics are useful for the commitments they do not make

because lack of commitment gives the knowledge base write more freedom.

Page 30: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

30

Summary (so far)

• Propositional logic commits only to the existence of facts that may or may not be the case in the world being represented. – It has a simple syntax and a simple

semantic. It suffices to illustrate the process of inference.

– Propositional logic was considered impractical for real-world problems, even if they are small.

• But recent (huge) advances in reasoning techniques have made people reconsider these

• It can now be used to model and reason with several real problems (SAT)

Page 31: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

31

First-order Logic

• Whereas Propositional Logic assumes the world contains facts, First-order Logic assumes the world contains:– Objects; people, houses, games,

wars, colours…– Relations; red, round, bogus, prime,

brother, bigger_than, part_of…– Functions; father_of, best_friend,

second_half_of, number_of_wheels…

Page 32: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

32

Aside: Logics in General

LanguageOntological Commitment

Epistemological Commitment

Proposotional Logic facts true/false/unknow nFirst-order Logic facts, objects, relations true/false/unknow n

Temporal Logicfacts, objects, relations, times true/false/unknow n

Probability Theory facts degree of belief [0, 1]Fuzzy Logic degrees of truth [0, 1] know n interval value

Page 33: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

33

Predicate Calculus

Two important extensions to Propositional Logic are:predicates and quantifiers

– Predicates are statements about objects by themselves or in relation to other objects. Some examples are:

less-than-zeroweighs-more-than

– The quantifiers then operate over the predicates. There are two quantifiers:

for all (the universal quantifier) there exists (the existential

quantifier)So with predicate calculus we can make statements like:

XYZ: Smaller(X,Y) Smaller(X,Z) Smaller(X,Z)

Page 34: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

34

Predicate Calculus (cont’d)

Predicate calculus is very general but not very powerful

Two useful additions are functions and the predicate equals

absolute-valuenumber-of-wheelscolour

Functions do not return true or false but return objects.

Page 35: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

35

First Order Logic

Two individuals are “equal” if and only if they are indistinguishable under all predicates and functions.

Predicate calculus with these additions is a variety of first order logic.

A logic is of first order if it permits quantification over individuals but not over predicates and functions. For example a statement like “all predicates have only one argument” cannot be expressed in first order logic.

The advantage of first order logic as a representational formalism lies in its formal structure. It is relatively easy to check for consistency and redundancy.

Page 36: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

36

First Order Logic

– Advantages stem from rigid mathematical basis for first order logic

– This rigidity gives rise to problems. The main problem with first order logic is that it is monotonic.

“If a sentence S is a logical consequence of a set of sentences A then S is still a logical consequence of any set of sentences that includes A. So if we think of A as embodying the set of beliefs we started with, the addition of new beliefs cannot lead to the logical repudiation of old consequences.”

So the set of theorems derivable from the premises is not reduced (increases monotonically) by the adding of new premises.

Page 37: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

37

Syntax of FOL: Basic Elements

• Constants: KingJohn, 2, TCD, …• Predicates: Brother, >, …• Functions: Sqrt, LeftLegOf,…• Variables: x, y, a, b,…• Connectives: , , , , • Equality: =• Quantifiers: ,

Page 38: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

38

FOL Example

SentencesBrother(KingJohn,

RichardTheLionHart)

> (Length (LeftLegOf(RichardThe…) (Length (LeftLegOf(KingJohn)

Sibling(KingJohn, Richard…) Sibling(Richard…, KingJohn)

Page 39: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

39

Quantifiers

• Universal Quantification x At(x, Aegean) Smart(x)

• “Everyone at Aegean is Smart” • Being at Aegean implies you are smart

x P is true in a model m iff P is true with x being each possible object in the model

• Roughly speaking, equivalent to the conjunction of instantiations of P

At(KingJohn,Aegean) Smart(KingJohn) At(Richard, Aegean) Smart(Richard) At(Robin, Aegean) Smart(Robin) ...

Page 40: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

40

A common mistake to avoid

• Typically, is the main connective with

• Common mistake: using as the main connective with :x At(x,Aegean) Smart(x)means “Everyone is at Aegean and

everyone is smart”

Page 41: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

41

Quantifiers

• Existential Quantification x At(x, Aegean) Smart(x)

• “Someone at Aegean is Smart” • There exists someone who is both at Aegean and Smart

x P is true in a model m iff P is true with x being some possible object in the model

• Roughly speaking, equivalent to the disjunction of instantiations of P

At(KingJohn,Aegean) Smart(KingJohn) At(Richard, Aegean) Smart(Richard) At(Robin, Aegean) Smart(Aegean) ...

Page 42: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

42

Another common mistake to avoid

• Typically, is the main connective with

• Common mistake: using as the main connective with :

x At(x,Aegean) Smart(x)is true if there is anyone who is not at Aegean!

Page 43: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

43

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)

– “There is a person who loves everyone in the world” y x 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)

Page 44: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

44

Equality

• term1 = term2 is true under a given interpretation if and only if term1 and term2 refer to the same object

• E.g., definition of Sibling in terms of Parent:x,y Sibling(x,y) [(x = y) m,f

(m = f) Parent(m,x) Parent(f,x) Parent(m,y) Parent(f,y)]

Page 45: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

45

Inference Rules in FOL

•In FOL there are three new inference rules

• Universal Elimination: For each sentence α, variable v, and ground term g

(v)α |= SUBST({v/g},α)

• E.g. From (x) Likes(x,Icecream), by doing the substitution {x/John} we can infer Likes(John,Icecream)

Page 46: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

46

Inference Rules in FOL

– Existential Elimination: For each sentence α, variable v, and new constant k

(v)α |= SUBST({v/k},α) • E.g. From ( x) Likes(x,Icecream), we can infer Likes(Somebody,Icecream), as long as Somebody is a new constant which has not been used before

Page 47: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

47

Inference Rules in FOL

– Existential Introduction: For each sentence α, variable v not appearing in α, and ground term g appearing in α

α |= (v) SUBST({g/v},α) • E.g. from Likes(John,Icecream), we can

infer ( x) Likes(John,x)

Page 48: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

48

Using FOL

The kinship domain:• Brothers are siblings

x,y Brother(x,y) Sibling(x,y)

• One's mother is one's female parentm,c Mother(c) = m (Female(m)

Parent(m,c))

• “Sibling” is symmetricx,y Sibling(x,y) Sibling(y,x)

Page 49: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

49

Knowledge engineering in FOL

1. Identify the task2. Assemble the relevant knowledge3. Decide on a vocabulary of predicates,

functions, and constants4. Encode general knowledge about the

domain5. Encode a description of the specific

problem instance6. Pose queries to the inference

procedure and get answers7. Debug the knowledge base

Page 50: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

50

The electronic circuits domain

One-bit full adder

Page 51: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

51

The electronic circuits domain

1. Identify the task– Does the circuit actually add properly?

(circuit verification)2. Assemble the relevant knowledge

– Composed of wires and gates; Types of gates (AND, OR, XOR, NOT)

– Irrelevant: size, shape, color, cost of gates3. Decide on a vocabulary

– Alternatives:Type(X1) = XORType(X1, XOR)XOR(X1)

Page 52: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

52

The electronic circuits domain

4. Encode general knowledge of the domain t1,t2 Connected(t1, t2) Signal(t1) =

Signal(t2) t Signal(t) = 1 Signal(t) = 0– 1 ≠ 0 t1,t2 Connected(t1, t2) Connected(t2, t1) g Type(g) = OR Signal(Out(1,g)) = 1 n

Signal(In(n,g)) = 1 g Type(g) = AND Signal(Out(1,g)) = 0

n Signal(In(n,g)) = 0 g Type(g) = XOR Signal(Out(1,g)) = 1

Signal(In(1,g)) ≠ Signal(In(2,g)) g Type(g) = NOT Signal(Out(1,g)) ≠

Signal(In(1,g))

Page 53: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

53

The electronic circuits domain

5. Encode the specific problem instanceType(X1) = XOR Type(X2) = XOR

Type(A1) = AND Type(A2) = AND

Type(O1) = OR

Connected(Out(1,X1),In(1,X2)) Connected(In(1,C1),In(1,X1))

Connected(Out(1,X1),In(2,A2)) Connected(In(1,C1),In(1,A1))

Connected(Out(1,A2),In(1,O1)) Connected(In(2,C1),In(2,X1))

Connected(Out(1,A1),In(2,O1)) Connected(In(2,C1),In(2,A1))

Connected(Out(1,X2),Out(1,C1)) Connected(In(3,C1),In(2,X2))

Connected(Out(1,O1),Out(2,C1)) Connected(In(3,C1),In(1,A2))

Page 54: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

54

The electronic circuits domain

6. Pose queries to the inference procedure

What are the possible sets of values of all the terminals for the adder circuit?

i1,i2,i3,o1,o2 Signal(In(1,C_1)) = i1 Signal(In(2,C1)) = i2 Signal(In(3,C1)) = i3 Signal(Out(1,C1)) = o1 Signal(Out(2,C1)) = o2

7. Debug the knowledge baseMay have omitted assertions like 1 ≠ 0

Page 55: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

55

Monotonicity of First Order Logic

Once you deduce something in first order logic you cannot get rid of it.

– Engine won’t start Wont-start(E)– petrol guage reads empty Reads-empty(PG)– petrol tank empty (inferred) Reads-empty(PG)

Empty(PT)– petrol guage faulty Faulty(PG)

Can be handled by qualification:Reads-empty(PG) Faulty(PG) Empty(PT)

Page 56: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

56

Example

•Suppose we have the following text:– The law says that it is a crime for an American

to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is an American.

• How can we use FOL to represent the knowledge in the text?

• How can we use the inference rules of FOL to infer that “West is a criminal” ?

Page 57: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

57

Representing Knowledge in FOL

• “it is a crime for an American to sell weapons to hostile nations”– ( x,y,z) American(x) Weapon(y) Nation(z) Hostile(z) Sells(x,z,y) Criminal(x)

• “Nono … has some missiles”– ( x) Owns(Nono,x) Missile(x)

• “all of its missiles were sold to it by Colonel West”– ( x) Owns(Nono,x) Missile(x) Sells(West,Nono,x)

Page 58: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

58

Representing Knowledge in FOL

• Missiles are weapons– ( x) Missile(x) Weapon(x)

• An enemy of America is a hostile nation– ( x) Enemy(x,America) Hostile(x)

• “West, who is an American”– American(West)

• “The country Nono”– Nation(Nono)

• “Nono, an enemy of America”– Enemy(Nono,America) , Nation(America)

Page 59: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

59

Proof

• From ( x) Owns(Nono,x) Missile(x) with existential elimination:– Owns(Nono,M1) Missile(M1)

• From Owns(Nono,M1) Missile(M1) with and-elimination:– Owns(Nono,M1) , Missile(M1)

• From ( x) Missile(x) Weapon(x) with universal elimination:– Missile(M1) Weapon(M1)

• From Missile(M1) , Missile(M1) Weapon(M1) with modus ponens:– Weapon(M1)

Page 60: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

60

Proof

• From ( x) Owns(Nono,x) Missile(x) Sells(West,Nono,x) with universal elimination:– Owns(Nono,M1) Missile(M1) Sells(West,Nono,M1)

• From Owns(Nono,M1) Missile(M1) , Owns(Nono,M1) Missile(M1) Sells(West,Nono,M1) with modus ponens:– Sells(West,Nono,M1)

• From ( x,y,z) American(x) Weapon(y) Nation(z) Hostile(z) Sells(x,z,y) Criminal(x) with universal elimination (3 times):– American(West) Weapon(M1) Nation(Nono) Hostile(Nono) Sells(Westr,Nono,M1) Criminal(West)

Page 61: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

61

Proof• From ( x) Enemy(x,America) Hostile(x) with

universal elimination:– Enemy(Nono,America) Hostile(Nono)

• From Enemy(Nono,America) , Enemy(Nono,America) Hostile(Nono) with modus ponens:– Hostile(Nono)

• From American(West) , Weapon(M1) , Nation(Nono) , Hostile(Nono) , Sells(West,Nono,M1) with and introduction:– American(West) Weapon(M1) Nation(Nono) Hostile(Nono) Sells(West,Nono,M1)

Page 62: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

62

Proof

• From American(West) Weapon(M1) Nation(Nono) Hostile(Nono) Sells(West,Nono,M1) , American(West) Weapon(M1) Nation(Nono) Hostile(Nono)

Sells(Westr,Nono,M1) Criminal(West)

with modus ponens:

– Criminal(West)

Page 63: 1 Propositional Logic First Order Logic Based on Russell and Norvig slides

63

Summary

• Propositional Logic– limited expressive power

• Add predicates and quantifiers• Add functions and equals• First Order Logic• Examples