CS182 Intelligent Machines: Reasoning, Actions and Plans

Preview:

DESCRIPTION

CS182 Intelligent Machines: Reasoning, Actions and Plans. Section 5. Propositional Logic: Conversion to CNF (1). CNF (Conjunctive Normal Form): A conjunction of clauses, where a clause is a disjunction of literals (A∨ B∨C) ∧(D∨E) ∧… ∧(X∨Y) ∧Z Convert the following sentence into CNF: - PowerPoint PPT Presentation

Citation preview

CS182 Intelligent Machines: Reasoning, Actions and Plans

Section 5

Propositional Logic: Conversion to CNF (1)

• CNF (Conjunctive Normal Form): A conjunction of clauses, where a clause is a disjunction of literals

(A B C) (D E) … (X Y) Z∨ ∨ ∧ ∨ ∧ ∧ ∨ ∧

• Convert the following sentence into CNF:(X Y) (Z ¬(¬X (Z Y)))C∧ ∧ ∨ ∨ ∧

Propositional Logic: Conversion to CNF (2)

• Rules you might want to use:- De Morgan: “Pushing” negation into parentheses

¬(A B)=¬A ¬B∧ ∨¬(A B)=¬A ¬B∨ ∧

- Distributivity:A (B C)=(A B) (A C)∧ ∨ ∧ ∨ ∧A (B C)=(A B) (A C)∨ ∧ ∨ ∧ ∨

- Implication elimination: Get around the “”AB = ¬A B∨

Propositional Logic: Conversion to CNF (3)

(X Y∧ )∧(Z ¬∨ (¬X (Z Y)∨ ∧ ))C= ¬((X Y∧ )∧(Z ¬∨ (¬X (Z Y)∨ ∧ )))C [Implication elimination]= (¬(X Y∧ ) ¬∨ (Z ¬∨ (¬X (Z Y)∨ ∧ ))) C ∨ [De Morgan]= ((¬X ¬Y∨ )∨¬(Z ¬∨ (¬X (Z Y)∨ ∧ ))) C ∨ [De Morgan]= ((¬X ¬Y∨ )∨(¬Z∧(¬X∨(Z Y)∧ ))) C ∨ [De Morgan]= ((¬X ¬Y∨ )∨(¬Z ∧ ((¬X Z∨ ) (¬X Y)∧ ∨ ))) C ∨ [Distributivity]= ((¬X ¬Y ¬Z∨ ∨ )∧(¬X ¬Y ¬X Z∨ ∨ ∨ ) (¬X ¬Y ¬X Y)∧ ∨ ∨ ∨ )∨C [Distributivity]= (¬X ¬Y ¬Z C∨ ∨ ∨ )∧(¬X ¬Y ¬X Z C∨ ∨ ∨ ∨ ) (¬X ¬Y ¬X Y C) ∧ ∨ ∨ ∨ ∨[Distributivity]

First-order Logic: Representing Facts(1)

Are the following representations correct?• No man is both a butcher and a vegetarian.

- What this really means?Anything in this world is a male butcher who is not a vegetarian.

- What is the correct representation? [ ]

First-order Logic: Representing Facts(2)

• The only vegetarian butchers are woman [ ]

- What this really means?Anything in the world is a female vegetarian butcher.

- What is the correct representation? [ ]

First-order Logic: Representing Facts(3)

How to represent the following facts?• All men who are not butchers like some

vegetarian. [) ()]

• No man likes any woman who is a vegetarian butcher.

]

First Order Logic: Functions (1)Representing facts in Map Coloring problems– Predicates?

• Country(x), Borders(x,y)– Functions?

• Map-Color(x) US is colored blue, and borders with Canada. Represent these facts and what they imply about Canada’s color:• Country(Canada)• Country(US)• Borders(US, Canada)• Map-Color(US) = Blue• (Country(Canada) Country(US) Borders(US, Canada) ∧ ∧ ∧ Map-Color(US)= Blue) ¬(Map-Color(Canada)=Blue)⇒

First Order Logic: Functions (2)

• No two adjacent countries have the same map color– Which of the following is correct?

∀x, y Country(x) Country(y) Borders(x, y) ¬(Map-Color(x) = Map-Color(y))∧ ∧ ∧This means that all things in the world are countries that border each other and have different colors!

∀x, y (Country(x) Country(y) Borders(x, y)) Map-Color(x = y)∧ ∧ ⇒This is not valid since Map-Color(x=y) is syntactically wrong.

First Order Logic: Functions (3) ∀x, y (Country(x) Country(y) Borders(x, y)) ∧ ∧ ⇒¬(Map-Color(x) = Map-Color(y)).Yay!

∀x, y ¬Country(x) ¬Country(y) ¬Borders(x, y)∨ ∨ ∨¬(Map-Color(x) = Map-Color(y)).Yay! (equivalent to above)

¬ x y (Country(x) Country(y) Borders(x, y) (Map-Color(x) = ∃ ∃ ∧ ∧ ∧Map-Color(y))).Yay! (equivalent to above)

Predicates or Functions?• A person born in the UK, each of whose parents is a UK citizen or a UK resident,

is a UK citizen by birth. ∀x Person(x) Born(x,UK) ( y Parent(y, x) ∧ ∧ ∀ ⇒(( r Citizen(y,UK,r)) Resident(y,UK))) Citizen(x,UK,Birth). ∃ ∨ ⇒

∀x Person(x) Born(x,UK) (Citizen(Father(x),UK,) ∃ ∃ ∧ ∧ ∨Resident(Father(x),UK)) ) (Citizen(Mother(x),UK,) ∧ ∨Resident(Mother(x),UK)) Citizen(x,UK,Birth). ⇒

• A person born outside the UK, one of whose parents is a UK citizen by birth, is a UK citizen by descent.

∀x Person(x) Born(x,UK) ( y Parent(y, x) Citizen(y,UK,Birth)) ∧ ∧ ∃ ∧ ⇒Citizen(x,UK,Descent).

∀x Person(x) Born(x,UK) (Citizen(Father(x),UK,Birth) ∧ ∧ ∨Citizen(Mother(x),UK,Birth)) Citizen(x,UK,Descent).⇒

Representing Facts in FOL – Hard Mode (1)

For each of the following sentences, first define the predicates and functions required, then write the sentence:

• There is an agent who sells policies only to people who are not insured. ∃x Agent(x) y, z (Policy(y) Sells(x, y, z)) (Person(z)∧∀ ∧ ⇒ ∧ Insured(z))

• There is a barber who shaves all men in town who do not shave themselves.

∃x y Barber(x) Man(y) Shaves(y, y) Shaves(x, y)∀ ∧ ∧ ⇒

Representing Facts in FOL – Hard Mode (2)

• TFs can be clear to some of the students all of the time, and they can be clear to all of the students some of the time, but they can't be clear to all of the students all of the time.

∀ x TF(x) ⇒( y t Student(y) Clear(x, y, t)) ∃ ∀ ∧ ∧( t y Student(y) Clear (x, y, t)) ∃ ∀ ⇒ ∧( t y Student (y) Clear(x, y, t))∀ ∀ ⇒

Bonus: Monty Python Logic

• http://www.youtube.com/watch?v=GpMjakNhZTc

Recommended