You are on page 1of 49

Normal Forms Propositional resolution

Logic and Discrete Mathematics

Section 3.6
Normal forms
Propositional resolution

Slides version: January 2015


Normal Forms Propositional resolution

Disjunctive and conjunctive normal forms:


basic definitions
1. A literal is a prop. constant or variable or its negation.
2. An elementary disjunction (resp., elementary conjunction)
is a disjunction (resp., conjunction) of one or more literals.
Examples:
p, ¬q, p ∨ ¬q, p ∨ ¬p ∨ q ∨ ¬r are elementary disjunctions;
Normal Forms Propositional resolution

Disjunctive and conjunctive normal forms:


basic definitions
1. A literal is a prop. constant or variable or its negation.
2. An elementary disjunction (resp., elementary conjunction)
is a disjunction (resp., conjunction) of one or more literals.
Examples:
p, ¬q, p ∨ ¬q, p ∨ ¬p ∨ q ∨ ¬r are elementary disjunctions;
p, ¬q, ¬p ∧ q, ¬p ∧ q ∧ ¬r ∧ ¬p are elementary
conjunctions.
Normal Forms Propositional resolution

Disjunctive and conjunctive normal forms:


basic definitions
1. A literal is a prop. constant or variable or its negation.
2. An elementary disjunction (resp., elementary conjunction)
is a disjunction (resp., conjunction) of one or more literals.
Examples:
p, ¬q, p ∨ ¬q, p ∨ ¬p ∨ q ∨ ¬r are elementary disjunctions;
p, ¬q, ¬p ∧ q, ¬p ∧ q ∧ ¬r ∧ ¬p are elementary
conjunctions.
3. A disjunctive normal form (DNF) is a disjunction of
elementary conjunctions. Examples:
p, ¬q, p ∧ ¬q, p ∨ ¬q, (p ∧ ¬p) ∨ ¬q,
(r ∧ q ∧ ¬p) ∨ (¬q ∧ p) ∨ (¬r ∧ p).
Normal Forms Propositional resolution

Disjunctive and conjunctive normal forms:


basic definitions
1. A literal is a prop. constant or variable or its negation.
2. An elementary disjunction (resp., elementary conjunction)
is a disjunction (resp., conjunction) of one or more literals.
Examples:
p, ¬q, p ∨ ¬q, p ∨ ¬p ∨ q ∨ ¬r are elementary disjunctions;
p, ¬q, ¬p ∧ q, ¬p ∧ q ∧ ¬r ∧ ¬p are elementary
conjunctions.
3. A disjunctive normal form (DNF) is a disjunction of
elementary conjunctions. Examples:
p, ¬q, p ∧ ¬q, p ∨ ¬q, (p ∧ ¬p) ∨ ¬q,
(r ∧ q ∧ ¬p) ∨ (¬q ∧ p) ∨ (¬r ∧ p).
4. A conjunctive normal form (CNF) is a conjunction of
elementary disjunctions. Examples:
p, ¬q, p ∧ ¬q, p ∨ ¬q, p ∧ (¬p ∨ ¬q),
(r ∨ q ∨ ¬r ) ∧ ¬q ∧ (¬p ∨ r ).
Normal Forms Propositional resolution

Algorithm for equivalent transformation to CNF/DNF


Theorem: Every propositional formula is equivalent to a
disjunctive normal form and to a conjunctive normal form.
Normal Forms Propositional resolution

Algorithm for equivalent transformation to CNF/DNF


Theorem: Every propositional formula is equivalent to a
disjunctive normal form and to a conjunctive normal form.
Algorithm transforming a formula into a DNF, respectively CNF:
Normal Forms Propositional resolution

Algorithm for equivalent transformation to CNF/DNF


Theorem: Every propositional formula is equivalent to a
disjunctive normal form and to a conjunctive normal form.
Algorithm transforming a formula into a DNF, respectively CNF:
1. Eliminate all occurrences of ↔ and → using the
equivalences
A ↔ B ≡ (A → B) ∧ (B → A)
and A → B ≡ ¬A ∨ B.
Normal Forms Propositional resolution

Algorithm for equivalent transformation to CNF/DNF


Theorem: Every propositional formula is equivalent to a
disjunctive normal form and to a conjunctive normal form.
Algorithm transforming a formula into a DNF, respectively CNF:
1. Eliminate all occurrences of ↔ and → using the
equivalences
A ↔ B ≡ (A → B) ∧ (B → A)
and A → B ≡ ¬A ∨ B.
2. Transform to negation normal form by using the relevant
equivalences.
Normal Forms Propositional resolution

Algorithm for equivalent transformation to CNF/DNF


Theorem: Every propositional formula is equivalent to a
disjunctive normal form and to a conjunctive normal form.
Algorithm transforming a formula into a DNF, respectively CNF:
1. Eliminate all occurrences of ↔ and → using the
equivalences
A ↔ B ≡ (A → B) ∧ (B → A)
and A → B ≡ ¬A ∨ B.
2. Transform to negation normal form by using the relevant
equivalences.
3. For a DNF: distribute conjunctions over disjunctions using
p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r ).
Normal Forms Propositional resolution

Algorithm for equivalent transformation to CNF/DNF


Theorem: Every propositional formula is equivalent to a
disjunctive normal form and to a conjunctive normal form.
Algorithm transforming a formula into a DNF, respectively CNF:
1. Eliminate all occurrences of ↔ and → using the
equivalences
A ↔ B ≡ (A → B) ∧ (B → A)
and A → B ≡ ¬A ∨ B.
2. Transform to negation normal form by using the relevant
equivalences.
3. For a DNF: distribute conjunctions over disjunctions using
p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r ).
4. For a CNF: distribute disjunctions over conjunctions using
p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r ).
Normal Forms Propositional resolution

Some useful simplifications

Throughout this process the formulae can be simplified by


using commutativity, associativity, and idempotency of ∨ and,
as well as:
I p ∨ ¬p ≡ >; p ∧ ¬p ≡ ⊥;
I p ∧ > ≡ p; p ∧ ⊥ ≡ ⊥;
I p ∨ > ≡ >; p ∨ ⊥ ≡ p.
Normal Forms Propositional resolution

Transformation to DNF and CNF: example

(p ∧ ¬r ) → (p ↔ ¬q)
Normal Forms Propositional resolution

Transformation to DNF and CNF: example done


(p ∧ ¬r ) → (p ↔ ¬q)
≡ (p ∧ ¬r ) → ((p → ¬q) ∧ (¬q → p)) (eliminating ↔)
≡ ¬(p ∧ ¬r ) ∨ ((¬p ∨ ¬q) ∧ (¬¬q ∨ p)) (eliminating →)
≡ (¬p ∨ ¬¬r ) ∨ ((¬p ∨ ¬q) ∧ (q ∨ p)) (driving ¬ inside)
≡ ¬p ∨ r ∨ ((¬p ∨ ¬q) ∧ (q ∨ p))
For a DNF we further distribute ∧ over ∨ and simplify:
≡ ¬p ∨ r ∨ (((¬p ∨ ¬q) ∧ q) ∨ ((¬p ∨ ¬q) ∧ p))
≡ ¬p ∨ r ∨ ((¬p ∧ q) ∨ (¬q ∧ q)) ∨ ((¬p ∧ p) ∨ (¬q ∧ p))
≡ ¬p ∨ r ∨ ((¬p ∧ q) ∨ ⊥) ∨ (⊥ ∨ (¬q ∧ p))
≡ ¬p ∨ r ∨ (¬p ∧ q) ∨ (¬q ∧ p).
For a CNF we distribute ∨ over ∧ and simplify:
≡ (¬p ∨ r ∨ ¬p ∨ ¬q) ∧ (¬p ∨ r ∨ q ∨ p)
≡ (¬p ∨ r ∨ ¬q) ∧ (> ∨ r ∨ q) ≡ (¬p ∨ r ∨ ¬q) ∧ >
≡ ¬p ∨ r ∨ ¬q. (Note that this is a DNF, too.)
Normal Forms Propositional resolution

Another method for computing DNF

The second method constructs the normal forms directly from


the truth-table of the given formula. We shall outline it for a DNF.
The formula p ↔ ¬q has truth table:

p q p ↔ ¬q
T T F
T F T
F T T
F F F

The corresponding DNF is (p ∧ ¬q) ∨ (¬p ∧ q).


Normal Forms Propositional resolution

The rule of Propositional Resolution

A ∨ C, B ∨ ¬C
,
A∨B
where A, B, C are any propositional formulae.
Normal Forms Propositional resolution

The rule of Propositional Resolution

A ∨ C, B ∨ ¬C
,
A∨B
where A, B, C are any propositional formulae.
The formula C is called a resolvent of A ∨ C and B ∨ ¬C.
We write C = Res(A ∨ C, B ∨ ¬C).
Normal Forms Propositional resolution

Clausal normal forms


• A clause is essentially an elementary disjunction
l1 ∨ . . . ∨ ln ,
but written as a (possibly empty) set of literals {l1 , . . . , ln }.
Normal Forms Propositional resolution

Clausal normal forms


• A clause is essentially an elementary disjunction
l1 ∨ . . . ∨ ln ,
but written as a (possibly empty) set of literals {l1 , . . . , ln }.
• The empty clause {} is a clause containing no literals.
Normal Forms Propositional resolution

Clausal normal forms


• A clause is essentially an elementary disjunction
l1 ∨ . . . ∨ ln ,
but written as a (possibly empty) set of literals {l1 , . . . , ln }.
• The empty clause {} is a clause containing no literals.
• A unit clause is a clause containing only one literal.
Normal Forms Propositional resolution

Clausal normal forms


• A clause is essentially an elementary disjunction
l1 ∨ . . . ∨ ln ,
but written as a (possibly empty) set of literals {l1 , . . . , ln }.
• The empty clause {} is a clause containing no literals.
• A unit clause is a clause containing only one literal.
• A clausal form is a (possibly empty) set of clauses, written
as a list: C1 . . . Ck . It represents the conjunction of these
clauses.
Normal Forms Propositional resolution

Clausal normal forms


• A clause is essentially an elementary disjunction
l1 ∨ . . . ∨ ln ,
but written as a (possibly empty) set of literals {l1 , . . . , ln }.
• The empty clause {} is a clause containing no literals.
• A unit clause is a clause containing only one literal.
• A clausal form is a (possibly empty) set of clauses, written
as a list: C1 . . . Ck . It represents the conjunction of these
clauses.
Thus, every CNF can be re-written in a clausal form, so every
propositional formula is equivalent to one in a clausal form.
Normal Forms Propositional resolution

Clausal normal forms


• A clause is essentially an elementary disjunction
l1 ∨ . . . ∨ ln ,
but written as a (possibly empty) set of literals {l1 , . . . , ln }.
• The empty clause {} is a clause containing no literals.
• A unit clause is a clause containing only one literal.
• A clausal form is a (possibly empty) set of clauses, written
as a list: C1 . . . Ck . It represents the conjunction of these
clauses.
Thus, every CNF can be re-written in a clausal form, so every
propositional formula is equivalent to one in a clausal form.
E XAMPLE: the clausal form of the CNF-formula
(p ∨ ¬q ∨ ¬r ) ∧ ¬p ∧ (¬q ∨ r ) is {p, ¬q, ¬r }{¬p}{¬q, r }.
Normal Forms Propositional resolution

Clausal normal forms


• A clause is essentially an elementary disjunction
l1 ∨ . . . ∨ ln ,
but written as a (possibly empty) set of literals {l1 , . . . , ln }.
• The empty clause {} is a clause containing no literals.
• A unit clause is a clause containing only one literal.
• A clausal form is a (possibly empty) set of clauses, written
as a list: C1 . . . Ck . It represents the conjunction of these
clauses.
Thus, every CNF can be re-written in a clausal form, so every
propositional formula is equivalent to one in a clausal form.
E XAMPLE: the clausal form of the CNF-formula
(p ∨ ¬q ∨ ¬r ) ∧ ¬p ∧ (¬q ∨ r ) is {p, ¬q, ¬r }{¬p}{¬q, r }.
Note that the empty clause {} is not satisfiable (being an empty
disjunction), while the empty set of clauses ∅ is satisfied by any
truth assignment (being an empty conjunction).
Normal Forms Propositional resolution

Clausal Propositional Resolution rule


The Propositional Resolution rule can be rewritten for clauses:

{A1 , . . . , C, . . . , Am } {B1 , . . . , ¬C, . . . , Bn }


CL − RES .
{A1 , . . . , Am , B1 , . . . , Bn }
Normal Forms Propositional resolution

Clausal Propositional Resolution rule


The Propositional Resolution rule can be rewritten for clauses:

{A1 , . . . , C, . . . , Am } {B1 , . . . , ¬C, . . . , Bn }


CL − RES .
{A1 , . . . , Am , B1 , . . . , Bn }
The clause {A1 , . . . , Am , B1 , . . . , Bn } is called a resolvent of the
clauses {A1 , . . . , C, . . . , Am } and {B1 , . . . , ¬C, . . . , Bn }.
Normal Forms Propositional resolution

Clausal Propositional Resolution rule


The Propositional Resolution rule can be rewritten for clauses:

{A1 , . . . , C, . . . , Am } {B1 , . . . , ¬C, . . . , Bn }


CL − RES .
{A1 , . . . , Am , B1 , . . . , Bn }
The clause {A1 , . . . , Am , B1 , . . . , Bn } is called a resolvent of the
clauses {A1 , . . . , C, . . . , Am } and {B1 , . . . , ¬C, . . . , Bn }.
Example

{p, q, ¬r } {¬q, ¬r }
,
{p, ¬r , ¬r }
Normal Forms Propositional resolution

Clausal Propositional Resolution rule


The Propositional Resolution rule can be rewritten for clauses:

{A1 , . . . , C, . . . , Am } {B1 , . . . , ¬C, . . . , Bn }


CL − RES .
{A1 , . . . , Am , B1 , . . . , Bn }
The clause {A1 , . . . , Am , B1 , . . . , Bn } is called a resolvent of the
clauses {A1 , . . . , C, . . . , Am } and {B1 , . . . , ¬C, . . . , Bn }.
Example

{p, q, ¬r } {¬q, ¬r }
,
{p, ¬r , ¬r }
{¬p, q, ¬r } {r }
,
{¬p, q}
Normal Forms Propositional resolution

Clausal Propositional Resolution rule


The Propositional Resolution rule can be rewritten for clauses:

{A1 , . . . , C, . . . , Am } {B1 , . . . , ¬C, . . . , Bn }


CL − RES .
{A1 , . . . , Am , B1 , . . . , Bn }
The clause {A1 , . . . , Am , B1 , . . . , Bn } is called a resolvent of the
clauses {A1 , . . . , C, . . . , Am } and {B1 , . . . , ¬C, . . . , Bn }.
Example

{p, q, ¬r } {¬q, ¬r }
,
{p, ¬r , ¬r }
{¬p, q, ¬r } {r }
,
{¬p, q}
{¬p} {p}
.
{}
Normal Forms Propositional resolution

Some remarks
Note that two clauses can have more than one resolvent, e.g.:
{p, ¬q}{¬p, q} {p, ¬q}{¬p, q}
, .
{p, ¬p} {¬q, q}
Normal Forms Propositional resolution

Some remarks
Note that two clauses can have more than one resolvent, e.g.:
{p, ¬q}{¬p, q} {p, ¬q}{¬p, q}
, .
{p, ¬p} {¬q, q}
However, it is wrong to apply the Propositional Resolution rule
for both pairs of complementary literals simultaneously and
obtain
{p, ¬q}{¬p, q}
.
{}
Normal Forms Propositional resolution

Some remarks
Note that two clauses can have more than one resolvent, e.g.:
{p, ¬q}{¬p, q} {p, ¬q}{¬p, q}
, .
{p, ¬p} {¬q, q}
However, it is wrong to apply the Propositional Resolution rule
for both pairs of complementary literals simultaneously and
obtain
{p, ¬q}{¬p, q}
.
{}
Sometimes, the resolvent can (and should) be simplified, by
removing duplicated literals on the fly:

{A1 , . . . , C, C, . . . , Am } ⇒ {A1 , . . . , C, . . . , Am }.
Normal Forms Propositional resolution

Some remarks
Note that two clauses can have more than one resolvent, e.g.:
{p, ¬q}{¬p, q} {p, ¬q}{¬p, q}
, .
{p, ¬p} {¬q, q}
However, it is wrong to apply the Propositional Resolution rule
for both pairs of complementary literals simultaneously and
obtain
{p, ¬q}{¬p, q}
.
{}
Sometimes, the resolvent can (and should) be simplified, by
removing duplicated literals on the fly:

{A1 , . . . , C, C, . . . , Am } ⇒ {A1 , . . . , C, . . . , Am }.
For instance:
{p, ¬q, ¬r }{q, ¬r } {p, ¬q, ¬r }{q, ¬r }
instead of
{p, ¬r } {p, ¬r , ¬r }
Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
First, transform p → q, q → r , ¬(p → r ) to clausal form:
Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
First, transform p → q, q → r , ¬(p → r ) to clausal form:

C1 = {¬p, q}, C2 = {¬q, r }, C3 = {p}, C4 = {¬r }.


Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
First, transform p → q, q → r , ¬(p → r ) to clausal form:

C1 = {¬p, q}, C2 = {¬q, r }, C3 = {p}, C4 = {¬r }.

Now, applying Propositional Resolution successively:


Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
First, transform p → q, q → r , ¬(p → r ) to clausal form:

C1 = {¬p, q}, C2 = {¬q, r }, C3 = {p}, C4 = {¬r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
First, transform p → q, q → r , ¬(p → r ) to clausal form:

C1 = {¬p, q}, C2 = {¬q, r }, C3 = {p}, C4 = {¬r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
C6 = Res(C2 , C5 ) = {r };
Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
First, transform p → q, q → r , ¬(p → r ) to clausal form:

C1 = {¬p, q}, C2 = {¬q, r }, C3 = {p}, C4 = {¬r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
C6 = Res(C2 , C5 ) = {r };
C7 = Res(C4 , C6 ) = {}.
Normal Forms Propositional resolution

Propositional resolution derivation: Example 1

Check whether p → q, q → r |= p → r .
First, transform p → q, q → r , ¬(p → r ) to clausal form:

C1 = {¬p, q}, C2 = {¬q, r }, C3 = {p}, C4 = {¬r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
C6 = Res(C2 , C5 ) = {r };
C7 = Res(C4 , C6 ) = {}.
The derivation of the empty clause completes the proof.
Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


First, transform (¬p → q), ¬r , ¬(p ∨ (¬q ∧ ¬r )) to clausal form:
Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


First, transform (¬p → q), ¬r , ¬(p ∨ (¬q ∧ ¬r )) to clausal form:

C1 = {p, q}, C2 = {¬r }, C3 = {¬p}, C4 = {q, r }.


Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


First, transform (¬p → q), ¬r , ¬(p ∨ (¬q ∧ ¬r )) to clausal form:

C1 = {p, q}, C2 = {¬r }, C3 = {¬p}, C4 = {q, r }.

Now, applying Propositional Resolution successively:


Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


First, transform (¬p → q), ¬r , ¬(p ∨ (¬q ∧ ¬r )) to clausal form:

C1 = {p, q}, C2 = {¬r }, C3 = {¬p}, C4 = {q, r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


First, transform (¬p → q), ¬r , ¬(p ∨ (¬q ∧ ¬r )) to clausal form:

C1 = {p, q}, C2 = {¬r }, C3 = {¬p}, C4 = {q, r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
C6 = Res(C2 , C4 ) = {q};
Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


First, transform (¬p → q), ¬r , ¬(p ∨ (¬q ∧ ¬r )) to clausal form:

C1 = {p, q}, C2 = {¬r }, C3 = {¬p}, C4 = {q, r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
C6 = Res(C2 , C4 ) = {q};
No new applications of the Propositional Resolution rule are
possible anymore, hence the empty clause is not derivable.
Normal Forms Propositional resolution

Propositional resolution derivation: Example 2

Check whether (¬p → q), ¬r  p ∨ (¬q ∧ ¬r ).


First, transform (¬p → q), ¬r , ¬(p ∨ (¬q ∧ ¬r )) to clausal form:

C1 = {p, q}, C2 = {¬r }, C3 = {¬p}, C4 = {q, r }.

Now, applying Propositional Resolution successively:


C5 = Res(C1 , C3 ) = {q};
C6 = Res(C2 , C4 ) = {q};
No new applications of the Propositional Resolution rule are
possible anymore, hence the empty clause is not derivable.
Therefore, (¬p → q), ¬r 6 p ∨ (¬q ∧ ¬r ).

You might also like