Professional Documents
Culture Documents
20 CNF
20 CNF
http://www.csc.liv.ac.uk/konev/COPM210/
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 1/2
Overview
Entailment, satisability, and validity. Conjunctive normal form. Satisability as a search problem.
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 2/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 3/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 4/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 5/2
Satisability Checking
Given a knowledge base KB and a property , check if (KB ) is satisable If not satisable, is implied by KB Otherwise, an interpretation of propositions would give us a countermodel
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 6/2
Countermodel (1)
To check if
(hot smoky re) (alarm_beeps smoky) |= (alarm_beeps switch_on_sprinklers) ?
(re switch_on_sprinklers)
we form
(hot smoky re) (alarm_beeps smoky) (re switch_on_sprinklers) (alarm_beeps switch_on_sprinklers)
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 7/2
Countermodel (2)
But
(hot smoky re) (alarm_beeps smoky) (re switch_on_sprinklers) (alarm_beeps switch_on_sprinklers)
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 8/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 9/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 9/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 9/2
T T T F
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 9/2
T T T F F T
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 9/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 9/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 9/2
Exercises
Complete the truth table for ((p q) (q p))
p T T F F q T F T F (p q) (q p) ((p q) (q p))
Show that the formula (p q) r is satisable. Find an interpretation which satises (p q) (r s). Show p p is unsatisable. Show p p is valid.
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 10/2
Efciency
A truth table contains 2n rows Its construction requires 2n steps. . . Can we do better than that? Not really: Theory says that this is a very hard problem In practice, not so bad But we have to transform (KB ) into a normal form
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 11/2
Equivalent Formulae
Two formulae A and B are equivalent, written A B iff A and B have the same truth values for every interpretation. Show
(p q) (p q).
Draw up a truth table for (p q) and (p q) and check their truth values are the same.
p T q T pq p p q
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 12/2
Equivalent Formulae
Two formulae A and B are equivalent, written A B iff A and B have the same truth values for every interpretation. Show
(p q) (p q).
Draw up a truth table for (p q) and (p q) and check their truth values are the same.
p T T F F
Boris Konev
q T F T F
pq T F T T
p p q F F T T T F T T
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 12/2
Equivalent Transformations I
Where A, B and C are propositions or propositional formulae and T and F are true and false respectively. Idempotent laws
AA A AA A
Associative laws
(A B) C A (B C) (A B) C A (B C)
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 13/2
Equivalent Transformations II
Commutative laws
AB BA AB BA
Distributive laws
A (B C) (A B) (A C) A (B C) (A B) (A C)
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 14/2
Complement laws
A A A A (A) T F
Boris Konev
F T A F T
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 15/2
Equivalent Transformations IV
de Morgans laws
(A B) A B (A B) A B
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 16/2
Example
Simplify the following expression.
(P Q) (P Q) (P Q) (P Q)
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 17/2
Example
Prove the following equivalence
((P Q) P ) F ((P Q) P ) ((P Q) P ) ((Q P ) P ) (Q (P P )) (Q T ) T F
given de Morgans laws Commutative laws Associative laws Complement laws Complement laws Complement laws
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 18/2
Exercise
Show (P Q) P Q
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 19/2
Normal Forms
It is often useful to transform formulae into normal forms. These are logically equivalent formulae but have syntactically different forms that may be more suitable for reasoning with. Recall two formulae A and B are equivalent, written A B if and only if the truth values for A and B are the same for each interpretation.
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 20/2
Final Formula (A B) (B A) A B A B A B A A B
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 21/2
Example
((p q) r) p ((p q) r) p ((p q) r) p ((p q) r) p ((p q) r) p ((p q) r) p ((p q) r) p
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 22/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 23/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 24/2
Example
Translate ((p q) r) p into CNF. We rst translate into NNF and obtain ((p q) r) p.
((p q) r) p ((p q) p) (r p) (p q p) (r p)
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 25/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 26/2
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 27/2
Summary
Validity, Satisability, and Entailment. Dened and examined equivalent formulae. Dened negation normal form and conjunctive normal form. Weve shown how to translate into these normal forms. In the next lecture we will use one of these normal forms as part of a proof method.
Boris Konev
COMP210: Articial Intelligence. Lecture 20. Towards efcient propositional reasoning p. 28/2