PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

17
PAI Recitation 3 – Logic Yuxin Chen 12-10-2012

Transcript of PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Page 1: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

PAI Recitation 3 – Logic

Yuxin Chen12-10-2012

Page 2: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Inference

• Truth tables• Modus ponens• Resolution• …

Page 3: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution

Transform KB into CNF

Page 4: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution: Example

H: Heads upT: Tails upIW: I winUL : You lose

Heads, I winTails, you loseEither heads or tailsI win or you loseI don’t win

H => IWT => ULH <=> ¬TIW <=> UL¬IW

Page 5: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution

• Why can’t we just use resolution to derive the sentence we are interested in (instead of adding its negation and derive false)?

Use resolution to derive from KB?

Page 6: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution

• Why can’t we just use modus ponens instead of resolution to derive the sentence we are interested in?

Modus ponens

Example: P implies Q; Not P implies Q. Show that Q is ture.

Page 7: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution

• Resolution is sound and complete• Recall:

Page 8: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

First order logic

• A superset of propositional logic• Don’t treat propositions as “atomic” entities. • Sentences refer to objects, their relationships,

and their properties.Types ExampleObjects Bob, October 12

Relations/predicates MotherOf, ColorOf

Functions IsMotherOf, IsBlue

Connectives ∧∨¬ ⇔⇒

Quantifiers Universal: x:(isMan(x)) isMortal(x)) ∀ ⇒Existential: y: ( isFather (y, Fred) ) ∃

Page 9: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Example: Convert to First-Order Logic

• ∀x isSibling (x, Bob) isKind(x)⇒• ∀x isSibling (x, Bob) isKind(x) ∧• ∃x At(x, ETH) isSmart(x) ⇒• ∃x At(x, ETH) isSmart(x)∧

Page 10: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Example: Convert to English

• There is only one correct answer (do not use !) ∃

• First cousin (child of your parent’s siblings) • All grad students watch the same TV shows• Any person can fool some of the people all of

the time, all of the people some of the time but not all of the people all of the time

Page 11: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Example: Convert to English and FOL

Page 12: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Example (Cont..)

• In the sentences below, a symbol is missing. What symbol is it most likely to be? – ∀x Something(x) ??? SomethingElse(x) – ∃x Something(x) ??? SomethingElse(x)

Page 13: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Example (Cont..)

• Is this correctly written? – Peter has at least two children. – ∃x,y ParentOf(Peter, x) ParentOf(Peter, y) ∧

Page 14: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution in FOL: Example

• Jack owns a dog. Every dog owner is an animal lover, and no animal lover kills an animal. Either Jack or Curiosity killed the cat, who is named Tuna.

• Did Curiosity kill the cat?

Page 15: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution in ROL: Conjunctive Normal Form

• Jack owns a dog.

• Every dog owner is an animal lover.

• No animal lover kills an animal.

• Either Jack or Curiosity killed the cat, who is named Tuna.

• Did Curiosity kill the cat?

Page 16: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Resolution in ROL

Page 17: PAI Recitation 3 – Logic Yuxin Chen 12-10-2012. Inference Truth tables Modus ponens Resolution …

Summary