Title: Normal forms, resolution method Lesson 4
1Normal forms,resolution methodLesson 4
2Normal forms of PL formulas
- To each PL formula there is just one truth-value
function (truth table). - However, to each such truth-function there are
infinitely many, mutually equivalent, formulas. - Definition Formulas A, B are equivalent, denoted
A ? B, iff A and B have exactly the same models.
In other words, they express the same truth-value
function. - Thus A ? B iff A B a B A.
- Example p ? q ? ?p ? q ? ?(p ? ?q) ? (p ? q) ?
(p ? ?p) ? (p ? q) ? (p ? ?p) ? ... - Remark Do not confuse equivalence of formulas (A
? B) with a formula of the form (A ? B). - Here ? is a truth connective, whereas ? is a
metasymbol. - It holds that A ? B iff A ? B is a tautology.
- Example (p ? q) ? (p ? q) ? (q ? p) iff
- (p ? q) ? ((p ? q) ? (q ? p))
3Example
p q f(p,q)
1 1 1
1 0 0
0 1 0
0 0 1
There are infinitely many formulas corresponding to this function (p ? q) ? (p ? q) ? (q ? p) ?(?p ? q) ? (?q ? p) ? (p ? q) ? (?p ? ?q) ? .
4Normal forms in PL
- (p ? q) ? (p ? q) ? (q ? p) ?
- (?p ? q) ? (?q ? p) ?
- (p ? q) ? (?p ? ?q) ? .
- It is useful to find some normal forms of a
formula, that is to choose among those infinitely
many formulas some canonic ones. - The class of equivalent formulas is then
represented by these normal forms formulas. - In our example the formulas in bold (second and
third line) are in normal form.
5Some definitions
- Literal is an atomic formula or its negation
p, ?q, r, ... - Elementary conjunction (EC) is a conjunction of
literals p ? ?q, r ? ?r, ... - Elementary disjunction (ED) is a disjunction of
literals p ? ?q, r ? ?r, ... - Complete elementary conjunction (CEC) is an
elementary conjunction in which each
propositional symbol occurs just ones (either
without or with negation) p ? ?q, r ? ?r - Complete elementary disjunction (CED) is an
elementary conjunction in which each
propositional symbol occurs just ones (either
without or with negation) p ? ?q, r ? ?r -
6Some definitions
- Disjunctive normal form (DNF) of a formula F is a
formula F such that F ? F and F is a
disjunction of elementary conjunctions DNF(p
? p) (p ? p) ? (?p ? ?p), p ? ?p - Conjunctive normal form (CNF) of a formula F is a
formula F such that F ? F and F is a
conjunction of elementary disjunctions KNF(p ?
p) (?p ? p) ? (?p ? p) - Complete disjunctive normal form (CDNF) of a
formula F is a formula F such that F ? F and F
is a disjunction of complete elementary
conjunctions CDNF(p ? q) (p ? q) ? (?p ? ?q) - Complete conjunctive normal form (CCNF) of a
formula F is a formula F such that F ? F and F
is a conjunction of complete elementary
disjunctions CCNF(p ? q) (?p ? q) ? (?q ? p) - CDNF and CCNF are canonic (standard) forms of a
formula.
7Normal forms in PL
- How to find a canonical form of a formula?
- CDNF disjunction 1, if at least one CEC 1,
i.e. all its literals must be 1. - CCNF conjunction 0, if at least one CED 0,
i.e. all its literals must be 0. - Thus in order to find CDNF and CCNF we can use a
truth-table - CDNF look at the lines with value 1
- CCNF look at the lines with value 0
8CDNF, CCNF ? table
- Formula ?(p?q)
- CDNF p??q
- CCNF
- (?p??q) ? (p??q) ? (p?q)
p q ?(p?q) CEC CED
1 1 0 ?p??q
1 0 1 p??q
0 1 0 p??q
0 0 0 p?q
9CDNF, CCNF
- Method of equivalent transformations
- ??p ? q? ? ???p ? q? ? (p ? ?q) UDNF ? p ? (q
? ?q? ? ?q ? (p ? ?p? ? - ? ?p ? q? ? ?p ? ?q? ? ??p ? ?q? UKNF
- Remark Here we use PL tautologies as defined
above. - In the second line we apply the rule A ? F ? A
where F is a contradiction. - In the third line we apply distributive laws
- To each formula that is not a contradiction there
is a CDNF - To each formula that is not a tautology there is
a CCNF.
10Reverse task having CDNF, CCNF find a simpler
formula
- Let p, q, r be
- p You will manage to turn lead to gold
- q On April 1st your brother in law will become
an Attorney General - r The verdict will come after April 1st.
- An alchemist in prison obtained 5 messages
- First message p ? q ? r
- Second message p ? q ? ?r
- Third message ?p ? ?q ? r
- Fourth message ?p ? ?q ? ?r
- Fifth message At least one of the previous
messages is true. - Question Which piece of information did the
alchemist obtain? - Solution (p ? q ? r) ? (p ? q ? ?r) ? (?p ? ?q ?
r) ? (?p ? ?q ? ?r). Applying equivalent
transformations we simplify the formula - (p ? q ? r) ? (p ? q ? ?r) ? (?p ? ?q ? r) ? (?p
? ?q ? ?r) ? - (p ? q) ? (r ? ?r) ? (?p ? ?q) ? (r ? ?r) ? (p ?
q) ? (?p ? ?q) ? (p ? q) - Answer You will manage to turn lead to gold if
and only if on April 1st your brother in law
becomes an Attorney General.
11How many binary truth functions are there?
p q 0 1 2 3 4 5 6 7 8 9 A B C D E F
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
? ? ? ? ? ?
NOR
NAND
12Which is the minimal number of logical
connectives?
- Functionally complete systems
- 1. ?, ?, ?,
- 2. ?, ? or ?, ?,
- 3. ?, ?,
- ? or ?.
- Thus to express any truth-value function just one
connective is sufficient! - Either Scheffers NAND ? or Pierces NOR ?
13Functionally complete systems
- ?, ?, ? is sufficient due to the statement on
normal forms - Transformation to ?, ? or ?, ?A ? B ? ?(?A
? ?B),A ? B ? ?(?A ? ?B) - Transformation to ?, ? A ? B ? ?A ? B,A ? B
? ?(A ? ?B) - Transformation to ? or ?
- ?A ? A?A, A?B ? (A?B)?(A?B),
- ?A ? A?A, A?B ? (A?B)?(A?B).
14Semantic tableau a method to create CNF, DNF
- Disjunctive tableau a tree whose leaves are
conjunctions of literals - Conjunctive tableau a tree whose leaves are
disjunctions of literals - A (tautology) ? all the leaves of a
conjunctive tableau must be closed, i.e., contain
opposite literals p, ?p (p ? ?p) tautology - A (contradiction) ? all the leaves of a
disjunctive tableau must be closed, i.e., contain
opposite literals p, ?p (p ? ?p) contradiction
15Semantic tableau
- Execute negations move the negation inside to
particular atomic formulas - Transform formulas of an implicative or
equivalence form applying the laws - (p ? q) ? (?p ? q),
- (p ? q) ? (?p ? q) ? (?q ? p) ? (p ? q) ? (?p ?
?q) - Apply distributive laws in order to obtain a
tableau.
16Disjunctive normal form
- Create a disjunctive tableau
- branching ? disjunction
- comma ? conjunction
- Proof of a contradiction
- If all the branches are closed, i.e. contain a
pair of opposite literals like p, ?p, which means
p ? ?p, the proven formula is a contradiction.
17(?p ? q ? r) ? (s ? ?q) ? (t ? ?r) ? p ? ?s ? ?t
- ?p,(s ? ?q),(t ? ?r),p,?s,?t q,(s ? ?q),(t ?
?r),p,?s,?t - r,(s ? ?q),(t ? ?r),p,?s,?t
- q,s,(t ? ?r),p,?s,?t q,?q,(t ? ?r),p,?s,?t
-
- r,s,(t ? ?r),p,?s,?t r,?q,(t ? ?r),p,?s,?t
-
- r,?q,t,p,?s,?t r,?q,?r,p,?s,?t
-
18Conjunctive normal form (dual method)
- Create a conjunctive tableau
- branching ? conjunction
- comma ? disjunction
- Proof of a tautology
- If all the branches are closed, i.e. contain a
pair of opposite literals like p, ?p, which means
p ? ?p, the proven formula is a tautology.
19Proof of a tautology
- (p ? (q ? r)) ? (?s ? ?q) ? (t ? ?r) ? (p ? (s
? t)) - (p ? ?q ? ?r) ? (?s ? q) ? (?t ? r) ? ?p ? s ? t
- p, (?s ? q), (?t ? r), ?p, s, t
- ?q, (?s ? q), (?t ? r), ?p, s, t
- ?r, (?s ? q), (?t ? r), ?p, s, t
- 2.1 ?q, ?s, (?t ? r), ?p, s, t
- 2.2 ?q, q, (?t ? r), ?p, s, t
- 3.1 ?r, ?s, (?t ? r), ?p, s, t
- 3.2 ?r, q, (?t ? r), ?p, s, t
- 3.2.1 ?r, q, ?t, ?p, s, t
- 3.2.2 ?r, q, r, ?p, s, t
- All the branches are closed, the formula is a
tautology
20What is entailed by a formula?
- Using disjunctive tableau
- If the tableau is not closed, complete the all
the branches by a set of literals that close
them. - Negation of the completion formula is entailed.
- For instance, if we complete the branches by p,
?q, then we added the formula p??q hence the
formula ?p?q, i.e. p?q is entailed. - Dually we can use a conjunctive tableau.
21What is entailed by the formula G ?
- G (p ? (q ? r)) ? (?s ? ?q) ? (t ? ?r)
- Solution the disjunctive semantic tableau of G
is not closed (check) in all the leaves the
literals p, ?s, ?t are missing. - Thus the set p, ?s, ?t completes the tableau.
Hence the formula (G ? p ? ?s ? ?t) is a
contradiction. - For this reason G ? ?(p ? ?s ? ?t).
- Hence G ?(p ? ?s ? ?t),
- G (?p ? s ? t), G (p ? (s ? t))
22Complete normal forms
- Using the tableau method we can easily prove that
- A tautology does not have a complete conjunctive
normal form (CCNF) - A contradiction does not have a complete
disjunctive normal form (CDNF) - Tautology ? all the branches of the conjunctive
tableau are closed contain a pair (p, ?p), which
means p ? ?p, which is not allowed in the
complete form ? no CCNF. - Dually for a contradiction
23CDNF of tautologies
- T1 p ? ?p
- T2 (p ? q) ? (p ? ?q) ? (?p ? q) ? (?p ? ?q)
- T3 (p ? q ? r) ? (p ? q ? ?r) ? (p ? ?q ? r) ?
- (p ? ?q ? ?r) ? (?p ? q ? r) ? (?p ? q ? ?r) ?
- (?p ? ?q ? r) ? (?p ? ?q ? ?r)
- For each possible valuation at least one CEC
must be true.
24Rezolution method in PL
- Disadvantage of the semantic tableau method
- If we are proving that P1,...,Pn Z, it is
sufficient to prove (P1? ... ? Pn) ? Z, i.e.
that P1? ... ? Pn ? ?Z is a contradiction. - However, proof by semantic tableau - disjunctive
normal form. - Thus we must apply a lot of distributive
operations in order to transform the formula. - It is easier to prove directly that the formula
P1? ... ? Pn ? ?Z is a contradiction.
25Resolution rule
- Let l be a literal. Then the rule of resolution
is - (A ? l) ? (B ? ?l)
-
- (A ? B)
- The rule is truth preserving.
- Proof Let (A ? l) ? (B ? ?l) be true in a
valuation v. Then both the clauses (A ? l) and (B
? ?l) must be true. - Let v(l) 0. Then w(A) 1 hence w(A ? B) 1.
- Let v(l) 1. Then w(?l) 0 and w(B) 1, hence
w(A ? B) 1. - In both cases A ? B is true in a model v of (A ?
l) ? (B ? ?l).
26Clausal form
- Conjunctive normal form is called here a clausal
form. - Particular elementary disjunctions are clauses.
- Example Transformation into clausal form
- ?((p ? q) ? (r ? ?q) ? ?r) ? ?p ?
- ((p ? q) ? (r ? ?q) ? ?r) ? p ?
- (?p ? q) ? (r ? ?q) ? ?r ? p
- The formula consists of four clauses. Proof of
the contradiction - (?p ? q) ? (r ? ?q) ? (?p ? r) ? ?r ? ?p ? p
27Proofs by resolution method
- A is a contradiction apply the rule of
resolution until obtaining an empty clause - A is a tautology ?A is a contradiction
- Prove that the set of formulas A1,,An does not
have a model prove that the formula A1 ?... ? An
is a contradiction - Find the logical consequences of A1,,An
derive particular resolvent clauses - Proof of the validity A1,,An Z
- direct keep applying the rule of resolution on
A1,...,An till you obtain Z - indirect prove that (A1 ?...? An ? Z) is a
tautology by proving that (A1 ?...? An ? ?Z) is
a contradiction, that is the set A1,..., An,,?Z
does not have a model
28Examples
- Write down the clauses and derive resolvents till
you obtain an empty clause - (?q ? p) ? (p ? r) ? (q ? ?r) ? ?p
- q ? p
- p ? r
- ?q ? ?r
- ?p
- p ? ?r rezolution of 1, 3
- p rezolution of 2, 5
- contradiction 4, 6
- Question What is logically entailed by (?q ? p)
? (p ? r) ? (q ? ?r) ? - Answer Formula p
29Examples
- Direct proof of the validityp ? q ? r, ?s ? ?q,
t ? ?r p ? (s ? t) - ?p ? q ? r
- s ? ?q
- t ? ?r
- ?p ? s ? r rezolution 1, 2
- ?p ? s ? t rezolution 3, 4
- ?p ? s ? t ? p ? (s ? t) QED
30examples
- Indirect proof of the validityp ? q ? r, ?s ?
?q, t ? ?r p ? (s ? t) - ?p ? q ? r
- s ? ?q
- t ? ?r
- ?p ? s ? r rezolution 1, 2
- ?p ? s ? t rezolution 3, 4
- p negated
- ?s con-
- ?t clusion
- ?p ? s ? t, p, ?s, ?t s ? t, ?s, ?t t, ?t
31Summary
- Typical tasks
- Prove the validity of an argument
- What is logically entailed by given premises?
- Add missing premises so that an argument be valid
- Proof of a tautology, contradiction
- Find the models of a formula, of a set of
formulas - Methods
- Semantic tableaus
- Equivalent transformations
- Direct / indirect proofs
- Resolution method
32Proof of the tautology
- (p ? q) ? (?p ? r) ? (?q ? r)
- Table A
p q r (p ? q) (?p ? r) A (?q ? r) A ? (?q ? r)
1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1
1 0 1 0 1 0 1 1
1 0 0 0 1 0 0 1
0 1 1 1 1 1 1 1
0 1 0 1 0 0 1 1
0 0 1 1 1 1 1 1
0 0 0 1 0 0 0 1
33Indirect proof of the tautology
- (p ? q) ? (?p ? r) ? (?q ? r)
- A is a tautology, if and only if ?A is a
contradiction - Assume that ?A is not a contradiction, that it
has a model - Negation of implication ?(A ? B) ? (A ? ?B)
- (p ? q) ? (?p ? r) ? ?q ? ?r
- 1 1 1 0 1 0
q 0, r 0, hence p ? 0, ?p ? 0 - 0 0 0 0 p 0, ?p 0, tj.
- 1 p 1
- contradiction
- The negated formula does not have a model, hence
the original formula is a tautology.
34Proof by equivalent transformations
- Apply the laws
- (A ? B) ? (?A ? B) ? (?(A ? ?B))
- ?(A ? B) ? (?A ? ?B) de Morgan
- ?(A ? B) ? (?A ? ?B) de Morgan
- ?(A ? B) ? (A ? ?B)
- (A ? (B ? C)) ? ((A ? B) ? (A ? C)) distributive
laws - (A ? (B ? C)) ? ((A ? B) ? (A ? C))
- 1 ? A ? 1 1 ? tautology,
- 1 ? A ? A e.g. (p ? ?p)
- 0 ? A ? 0 0 ? contradiction
- 0 ? A ? A e.g. (p ? ?p)
35Proof by equivalent transformations
- (p ? q) ? (?p ? r) ? (?q ? r)
- (p ? q) ? (?p ? r) ? (?q ? r) ? ?(p ? q) ?
(?p ? r) ? (?q ? r) ? - (p ? ?q) ? (?p ? ?r) ? q ? r ?
- p ? (?p ? ?r) ? q ? r ? ?q ? (?p ? ?r) ? q ?
r ? - (p ? ?p ? q ? r) ? (p ? ?r ? q ? r) ? (?q ? ?p ?
q ? r) ? (?q ? ?r ? q ? r) - ? 1 ? 1 ? 1 ? 1 ? 1 tautology
- Remark we obtained the conjunctive normal form
36Proof by resolution
- (p ? q) ? (?p ? r) ? (?q ? r)
- The clausal form of the negated formula (indirect
proof) - (p ? q) ? (?p ? r) ? ?q ? ?r ? (?p ? q) ? (p ? r)
? ?q ? ?r - 1. ?p ? q
- 2. p ? r
- 3. ?q
- 4. ?r
- 5. q ? r rezolution 1, 2
- 6. r rezolution 3, 5
- 7. rezolution 4, 6
37Proof by semantic tableau
- (p ? q) ? (?p ? r) ? (?q ? r)
- Direct proof CNF (? branching, ? , all
branches closed p ? ?p) - (p ? ?q) ? (?p ? ?r) ? q ? r
- p, (?p ? ?r), q, r ?q, (?p ? ?r), q, r
-
- p, ?p, q, r p, ?r, q, r
-
38Proof by semantic tableau
- (p ? q) ? (?p ? r) ? (?q ? r)
- Indirect proof DNF of the negated formula
- (? branching, ? , all branches 0 p ? ?p)
- (?p ? q) ? (p ? r) ? ?q ? ?r
- ?p, (p ? r), ?q, ?r q, (p ? r), ?q, ?r
-
- ?p, p, ?q, ?r ?p, r, ?q, ?r
-
39Proof of the validity of an argument
- (p ? q) ? (?p ? r) ? (?q ? r) iff
- (p ? q) ? (?p ? r) (?q ? r) iff
- (p ? q), (?p ? r) (?q ? r)
- p The program functions well
- q The system is OK
- r It is necessary to call the trouble-shooter
- If the program functions well, the system is OK.
- If the program malfunctions, it is necessary to
call the trouble-shooter. - --------------------------------------------------
-------------------------- - If the system is not OK, it is necessary to call
the trouble-shooter.
40Proof of the validity of an argument
- (p ? q), (?p ? r) (?q ? r)
- Indirect proof
- (p ? q), (?p ? r), (?q ? ?r) is a contradictory
set - ?p ? q
- p ? r
- ?q
- ?r
- q ? r rezolution 1, 2
- r rezolution 3, 5
- rezolution 4, 6