Mathematical Logic
Lecture 4: Normal forms
Ashutosh Gupta
TIFR, India
Compile date: 2015-08-19
1
Where are we and where are we going?
We have seen
I
propositional logic syntax and semantics
I
truth tables as methods for deciding SAT
I
some common equivalences
We will learn
I Various normal forms
I
I
I
I
NNF
CNF
DNF
k-SAT
2
Topic 4.1
Normal forms
3
Some terminology
I
Propositional variables are also referred as atoms
4
Some terminology
I
Propositional variables are also referred as atoms
I
A literal is either an atom or its negation
4
Some terminology
I
Propositional variables are also referred as atoms
I
A literal is either an atom or its negation
I
A clause is a disjunction of literals.
4
Some terminology
I
Propositional variables are also referred as atoms
I
A literal is either an atom or its negation
I
A clause is a disjunction of literals.
Since ∨ is associative, commutative and absorbs multiple occurrences, a
clause may be referred as a set of literals
4
Negation normal form(NNF)
Definition 4.1
A formula is in NNF if ¬ appears only in front of the propositional variables.
5
Negation normal form(NNF)
Definition 4.1
A formula is in NNF if ¬ appears only in front of the propositional variables.
Theorem 4.1
For every formula F there is another formula F 0 in NNF s.t. F ≡ F 0 .
Proof.
Recall from the tautologies that we can always push negation inside the
operators.
5
Negation normal form(NNF)
Definition 4.1
A formula is in NNF if ¬ appears only in front of the propositional variables.
Theorem 4.1
For every formula F there is another formula F 0 in NNF s.t. F ≡ F 0 .
Proof.
Recall from the tautologies that we can always push negation inside the
operators.
I
Often we assume that the formulas are in negation normal form.
I
However, there are negations hidden inside ⊕, ⇒, and ⇔. In practice,
these symbols are also expected to be removed while producing NNF
5
Negation normal form(NNF)
Definition 4.1
A formula is in NNF if ¬ appears only in front of the propositional variables.
Theorem 4.1
For every formula F there is another formula F 0 in NNF s.t. F ≡ F 0 .
Proof.
Recall from the tautologies that we can always push negation inside the
operators.
I
Often we assume that the formulas are in negation normal form.
I
However, there are negations hidden inside ⊕, ⇒, and ⇔. In practice,
these symbols are also expected to be removed while producing NNF
Exercise 4.1
a. Write an efficient algorithm to covert a propositional formula to NNF?
b. Are there any added difficulties if the formula is given as a DAG not as a
tree?
5
Example :NNF
Example 4.1
Consider ¬(((p ∨ ¬s) ⊕ r ) ⇒ q)
6
Example :NNF
Example 4.1
Consider ¬(((p ∨ ¬s) ⊕ r ) ⇒ q)
≡ ¬q ⇒ ¬((p ∨ ¬s) ⊕ r )
6
Example :NNF
Example 4.1
Consider ¬(((p ∨ ¬s) ⊕ r ) ⇒ q)
≡ ¬q ⇒ ¬((p ∨ ¬s) ⊕ r )
≡ ¬q ⇒ ¬(p ∨ ¬s) ⊕ r
6
Example :NNF
Example 4.1
Consider ¬(((p ∨ ¬s) ⊕ r ) ⇒ q)
≡ ¬q ⇒ ¬((p ∨ ¬s) ⊕ r )
≡ ¬q ⇒ ¬(p ∨ ¬s) ⊕ r
≡ ¬q ⇒ (¬p ∧ ¬¬s) ⊕ r
6
Example :NNF
Example 4.1
Consider ¬(((p ∨ ¬s) ⊕ r ) ⇒ q)
≡ ¬q ⇒ ¬((p ∨ ¬s) ⊕ r )
≡ ¬q ⇒ ¬(p ∨ ¬s) ⊕ r
≡ ¬q ⇒ (¬p ∧ ¬¬s) ⊕ r
≡ ¬q ⇒ (¬p ∧ s) ⊕ r
6
Example :NNF
Example 4.1
Consider ¬(((p ∨ ¬s) ⊕ r ) ⇒ q)
≡ ¬q ⇒ ¬((p ∨ ¬s) ⊕ r )
≡ ¬q ⇒ ¬(p ∨ ¬s) ⊕ r
≡ ¬q ⇒ (¬p ∧ ¬¬s) ⊕ r
≡ ¬q ⇒ (¬p ∧ s) ⊕ r
Exercise 4.2
Convert the following formulas into NNF
I
¬(p ⇒ q)
I
¬(¬((s ⇒ ¬(p ⇔ q))) ⊕ (¬q ∨ r ))
6
Conjunctive normal form(CNF)
Definition 4.2
A formula is in CNF if it is a conjunction of clauses.
7
Conjunctive normal form(CNF)
Definition 4.2
A formula is in CNF if it is a conjunction of clauses.
Since ∧ is associative, commutative and absorbs multiple occurrences, a CNF
formula may be referred as a set of clauses
7
Conjunctive normal form(CNF)
Definition 4.2
A formula is in CNF if it is a conjunction of clauses.
Since ∧ is associative, commutative and absorbs multiple occurrences, a CNF
formula may be referred as a set of clauses
Theorem 4.2
For every formula F there is another formula F 0 in CNF s.t. F ≡ F 0 .
7
Conjunctive normal form(CNF)
Definition 4.2
A formula is in CNF if it is a conjunction of clauses.
Since ∧ is associative, commutative and absorbs multiple occurrences, a CNF
formula may be referred as a set of clauses
Theorem 4.2
For every formula F there is another formula F 0 in CNF s.t. F ≡ F 0 .
Proof.
Let us suppose we have removed ⊕, ⇒, ⇔ using equivalences presented so
far and converted the formula in NNF. Since ∨ distributes over ∧, we can
always push ∨ inside ∧. Eventually, we will obtain a formula that is CNF.
7
Conjunctive normal form(CNF)
Definition 4.2
A formula is in CNF if it is a conjunction of clauses.
Since ∧ is associative, commutative and absorbs multiple occurrences, a CNF
formula may be referred as a set of clauses
Theorem 4.2
For every formula F there is another formula F 0 in CNF s.t. F ≡ F 0 .
Proof.
Let us suppose we have removed ⊕, ⇒, ⇔ using equivalences presented so
far and converted the formula in NNF. Since ∨ distributes over ∧, we can
always push ∨ inside ∧. Eventually, we will obtain a formula that is CNF.
Exercise 4.3
Write a formal grammar for CNF
7
Conjunctive normal form(CNF)
Definition 4.2
A formula is in CNF if it is a conjunction of clauses.
Since ∧ is associative, commutative and absorbs multiple occurrences, a CNF
formula may be referred as a set of clauses
Theorem 4.2
For every formula F there is another formula F 0 in CNF s.t. F ≡ F 0 .
Proof.
Let us suppose we have removed ⊕, ⇒, ⇔ using equivalences presented so
far and converted the formula in NNF. Since ∨ distributes over ∧, we can
always push ∨ inside ∧. Eventually, we will obtain a formula that is CNF.
After the push formula size grows!
Why should this procedure terminate?
Exercise 4.3
Write a formal grammar for CNF
7
CNF conversion terminates
Theorem 4.3
The procedure of converting a formula in CNF terminates.
8
CNF conversion terminates
Theorem 4.3
The procedure of converting a formula in CNF terminates.
Proof.
For a formula F let ν(F ) := maximum height of nested ∧s
8
CNF conversion terminates
Theorem 4.3
The procedure of converting a formula in CNF terminates.
Proof.
For a formula F let ν(F ) := maximum height of nested ∧s
Consider a formula F (G ) such that
G=
ni
m ^
_
Gij
i=0 j=0
8
CNF conversion terminates
Theorem 4.3
The procedure of converting a formula in CNF terminates.
Proof.
For a formula F let ν(F ) := maximum height of nested ∧s
Consider a formula F (G ) such that
G=
ni
m ^
_
Gij
i=0 j=0
After the push we obtain F (G 0 ), where
G0 =
n1
^
j1 =0
...
nm _
m
^
Giji
jm =0 i=0
ν(
| {z }
)<ν(G )
8
CNF conversion terminates
Theorem 4.3
The procedure of converting a formula in CNF terminates.
Proof.
For a formula F let ν(F ) := maximum height of nested ∧s
Consider a formula F (G ) such that
G=
ni
m ^
_
Gij
i=0 j=0
After the push we obtain F (G 0 ), where
G0 =
n1
^
j1 =0
...
nm _
m
^
Giji
jm =0 i=0
ν(
| {z }
)<ν(G )
The finitely many substituted ∨-formulas with have lower ν values.
Due to Köing lemma, the procedure terminates.
8
CNF examples
Example 4.2
Consider (p ⇒ (¬q ∧ r )) ∧ (p ⇒ ¬q)
9
CNF examples
Example 4.2
Consider (p ⇒ (¬q ∧ r )) ∧ (p ⇒ ¬q)
≡ (¬p ∨ (¬q ∧ r )) ∧ (¬p ∨ ¬q)
9
CNF examples
Example 4.2
Consider (p ⇒ (¬q ∧ r )) ∧ (p ⇒ ¬q)
≡ (¬p ∨ (¬q ∧ r )) ∧ (¬p ∨ ¬q)
≡ ((¬p ∨ ¬q) ∧ (¬p ∨ r )) ∧ (¬p ∨ ¬q)
9
CNF examples
Example 4.2
Consider (p ⇒ (¬q ∧ r )) ∧ (p ⇒ ¬q)
≡ (¬p ∨ (¬q ∧ r )) ∧ (¬p ∨ ¬q)
≡ ((¬p ∨ ¬q) ∧ (¬p ∨ r )) ∧ (¬p ∨ ¬q)
≡ (¬p ∨ ¬q) ∧ (¬p ∨ r ) ∧ (¬p ∨ ¬q)
9
CNF examples
Example 4.2
Consider (p ⇒ (¬q ∧ r )) ∧ (p ⇒ ¬q)
≡ (¬p ∨ (¬q ∧ r )) ∧ (¬p ∨ ¬q)
≡ ((¬p ∨ ¬q) ∧ (¬p ∨ r )) ∧ (¬p ∨ ¬q)
≡ (¬p ∨ ¬q) ∧ (¬p ∨ r ) ∧ (¬p ∨ ¬q)
Exercise 4.4
Convert the following formulas into CNF
1. ¬((p ⇒ q) ⇒ ((q ⇒ r ) ⇒ (p ⇒ r )))
2. (p ⇒ (¬q ⇒ r )) ∧ (p ⇒ ¬q) ⇒ (p ⇒ r )
9
Conjunctive normal form(CNF) (2)
I
A unit clause contains only one single literal.
I
A binary clause contains two literals.
I
A ternary clause contains three literals.
I
We naturally extend definition of the clauses to empty set of literals. We
refer to ⊥ as empty clause.
10
Conjunctive normal form(CNF) (2)
I
A unit clause contains only one single literal.
I
A binary clause contains two literals.
I
A ternary clause contains three literals.
I
We naturally extend definition of the clauses to empty set of literals. We
refer to ⊥ as empty clause.
Example 4.3
I
(p ∧ q ∧ ¬r ) has three unit clauses
10
Conjunctive normal form(CNF) (2)
I
A unit clause contains only one single literal.
I
A binary clause contains two literals.
I
A ternary clause contains three literals.
I
We naturally extend definition of the clauses to empty set of literals. We
refer to ⊥ as empty clause.
Example 4.3
I
(p ∧ q ∧ ¬r ) has three unit clauses
I
(p ∨ ¬q ∨ ¬s) ∧ (p ∨ q) ∧ ¬r has a ternary, a binary and a unit clause
10
Conjunctive normal form(CNF) (2)
I
A unit clause contains only one single literal.
I
A binary clause contains two literals.
I
A ternary clause contains three literals.
I
We naturally extend definition of the clauses to empty set of literals. We
refer to ⊥ as empty clause.
Example 4.3
I
(p ∧ q ∧ ¬r ) has three unit clauses
I
(p ∨ ¬q ∨ ¬s) ∧ (p ∨ q) ∧ ¬r has a ternary, a binary and a unit clause
Exercise 4.5
a. Show F 0 obtained from the procedure may be exponentially larger than F
b. Give a linear time algorithm to prove validity of a CNF formula
10
Tseitin’s encoding
We can translate every formula into CNF without exponential explosion using
Tseitin’s encoding by introducing fresh variables.
11
Tseitin’s encoding
We can translate every formula into CNF without exponential explosion using
Tseitin’s encoding by introducing fresh variables.
1. Assume input formula F is NNF without ⊕, ⇒, and ⇔.
11
Tseitin’s encoding
We can translate every formula into CNF without exponential explosion using
Tseitin’s encoding by introducing fresh variables.
1. Assume input formula F is NNF without ⊕, ⇒, and ⇔.
2. find a G1 ∧ · · · ∧ Gn that is below a ∨ in F (G1 ∧ · · · ∧ Gn )
3. F (G1 ∧ · · · ∧ Gn ) := F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ), where p is a
fresh variable
4. goto 2
11
Tseitin’s encoding
We can translate every formula into CNF without exponential explosion using
Tseitin’s encoding by introducing fresh variables.
1. Assume input formula F is NNF without ⊕, ⇒, and ⇔.
2. find a G1 ∧ · · · ∧ Gn that is below a ∨ in F (G1 ∧ · · · ∧ Gn )
3. F (G1 ∧ · · · ∧ Gn ) := F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ), where p is a
fresh variable
4. goto 2
Exercise 4.6
Convert the following formulas into CNF using Tseitin’s encoding
1. (p ⇒ (¬q ∧ r )) ∧ (p ⇒ ¬q)
2. (p ⇒ q) ∨ (q ⇒ ¬r ) ∨ (r ⇒ q) ⇒ ¬(¬(q ⇒ p) ⇒ (q ⇔ r ))
11
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
12
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
I
Therefore, m |= G1 ∧ · · · ∧ Gn .
12
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
I
Therefore, m |= G1 ∧ · · · ∧ Gn .
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ).
12
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
I
Therefore, m |= G1 ∧ · · · ∧ Gn .
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ).
Case m(p) = 0:
12
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
I
Therefore, m |= G1 ∧ · · · ∧ Gn .
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ).
Case m(p) = 0:
I
Since F (G1 ∧ · · · ∧ Gn ) is in NNF, p occurs only positively in F .
12
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
I
Therefore, m |= G1 ∧ · · · ∧ Gn .
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ).
Case m(p) = 0:
I
Since F (G1 ∧ · · · ∧ Gn ) is in NNF, p occurs only positively in F .
I
Therefore, m[p 7→ 1] |= F (p)(why?).
12
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
I
Therefore, m |= G1 ∧ · · · ∧ Gn .
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ).
Case m(p) = 0:
I
Since F (G1 ∧ · · · ∧ Gn ) is in NNF, p occurs only positively in F .
I
Therefore, m[p 7→ 1] |= F (p)(why?).
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ) if m |= G1 ∧ · · · ∧ Gn or not.
12
Tseitin’ encoding preserves satisfiability
Theorem 4.4
if m |= F (p) ∧ (¬p ∨ G1 ) ∧ · · · ∧ (¬p ∨ Gn ) then m |= F (G1 ∧ · · · ∧ Gn )
Proof.
Case m(p) = 1:
I
Therefore, m |= Gi for all i ∈ 1..n.
I
Therefore, m |= G1 ∧ · · · ∧ Gn .
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ).
Case m(p) = 0:
I
Since F (G1 ∧ · · · ∧ Gn ) is in NNF, p occurs only positively in F .
I
Therefore, m[p 7→ 1] |= F (p)(why?).
I
Therefore, m |= F (G1 ∧ · · · ∧ Gn ) if m |= G1 ∧ · · · ∧ Gn or not.
Exercise 4.7
a. Show if 6|= F (p) ∧ (¬p ∨ G1 ) ∧ .. ∧ (¬p ∨ Gn ) then 6|= F (G1 ∧ .. ∧ Gn )
b. Modify the encoding such that it works without assumptions at step 1
Hint: look into a sat solver frontend limboole and look for function tseitin $wget http://fmv.jku.at/limboole/limboole1.1.tar.gz
12
Disjunctive normal form(DNF)
Definition 4.3
A formula is in DNF if it is a disjunction of conjunctions of literals.
13
Disjunctive normal form(DNF)
Definition 4.3
A formula is in DNF if it is a disjunction of conjunctions of literals.
Theorem 4.5
For every formula F there is another formula F 0 in DNF s.t. F ≡ F 0 .
Proof.
Proof is similar to CNF.
13
Disjunctive normal form(DNF)
Definition 4.3
A formula is in DNF if it is a disjunction of conjunctions of literals.
Theorem 4.5
For every formula F there is another formula F 0 in DNF s.t. F ≡ F 0 .
Proof.
Proof is similar to CNF.
Exercise 4.8
a. Give the formal grammar of DNF
b. Give a linear time algorithm to prove satisfiability of a DNF formula
13
k-sat
Definition 4.4
A k-sat formula is a CNF formula and has at most k literals in each of its
clauses
Example 4.4
I
(p ∧ q ∧ ¬r ) is 1-SAT
14
k-sat
Definition 4.4
A k-sat formula is a CNF formula and has at most k literals in each of its
clauses
Example 4.4
I
(p ∧ q ∧ ¬r ) is 1-SAT
I
(p ∨ ¬p) ∧ (p ∨ q) is 2-SAT
I
(p ∨ ¬q ∨ ¬s) ∧ (p ∨ q) ∧ ¬r is 3-SAT
14
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
15
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
Let x2 , . . . , xk−2 some variables that do not appear in F .
Let G 0 be the following set of clauses
(`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
15
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
Let x2 , . . . , xk−2 some variables that do not appear in F .
Let G 0 be the following set of clauses
(`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
We show G is sat iff G 0 is sat.
15
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
Let x2 , . . . , xk−2 some variables that do not appear in F .
Let G 0 be the following set of clauses
(`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
We show G is sat iff G 0 is sat.
Assume m |= G 0 :
15
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
Let x2 , . . . , xk−2 some variables that do not appear in F .
Let G 0 be the following set of clauses
(`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
We show G is sat iff G 0 is sat.
Assume m |= G 0 :
Assume for each i < 1..k m(`i ) = 0.
15
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
Let x2 , . . . , xk−2 some variables that do not appear in F .
Let G 0 be the following set of clauses
(`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
We show G is sat iff G 0 is sat.
Assume m |= G 0 :
Assume for each i < 1..k m(`i ) = 0. Due to the first clause m(x2 ) = 1 and
due to ith clause m(xi ) = 1 then m(xi+1 ) = 1. By induction, m(xk−2 ) = 1.
15
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
Let x2 , . . . , xk−2 some variables that do not appear in F .
Let G 0 be the following set of clauses
(`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
We show G is sat iff G 0 is sat.
Assume m |= G 0 :
Assume for each i < 1..k m(`i ) = 0. Due to the first clause m(x2 ) = 1 and
due to ith clause m(xi ) = 1 then m(xi+1 ) = 1. By induction, m(xk−2 ) = 1.
Due to the last clause of G 0 , m(xk−2 ) = 0. Contradiction.
15
3-SAT satisfiablity
Theorem 4.6
For each k-SAT formula F there is a 3-SAT formula F 0 with linear blow up
such that F is sat iff F 0 is sat.
Proof.
Consider F a k-SAT formula with k ≥ 4.
Consider a clause G = (`1 ∨ · · · ∨ `k ) in F , where `i are literals.
Let x2 , . . . , xk−2 some variables that do not appear in F .
Let G 0 be the following set of clauses
(`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
We show G is sat iff G 0 is sat.
Assume m |= G 0 :
Assume for each i < 1..k m(`i ) = 0. Due to the first clause m(x2 ) = 1 and
due to ith clause m(xi ) = 1 then m(xi+1 ) = 1. By induction, m(xk−2 ) = 1.
Due to the last clause of G 0 , m(xk−2 ) = 0. Contradiction.
Therefore, exists i ∈ 1..k m(`i ) = 1. Therefore m |= G .
15
3-SAT satisfiability(cont.)
Proof(contd. from last slide).
Recall
G 0 = (`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
16
3-SAT satisfiability(cont.)
Proof(contd. from last slide).
Recall
G 0 = (`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
Assume m |= G :
There is a m(`i ) = 1.
16
3-SAT satisfiability(cont.)
Proof(contd. from last slide).
Recall
G 0 = (`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
Assume m |= G :
There is a m(`i ) = 1.
Let m0 = m[x2 7→ 1, .., xi−1 7→ 1, xi 7→ 0, . . . , xk−2 7→ 0]
Therefore, m0 |= G 0 (why?).
16
3-SAT satisfiability(cont.)
Proof(contd. from last slide).
Recall
G 0 = (`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
Assume m |= G :
There is a m(`i ) = 1.
Let m0 = m[x2 7→ 1, .., xi−1 7→ 1, xi 7→ 0, . . . , xk−2 7→ 0]
Therefore, m0 |= G 0 (why?).
G 0 contains 3(k − 2) literals.
In the worst case, the formula size will increase by 3.
16
3-SAT satisfiability(cont.)
Proof(contd. from last slide).
Recall
G 0 = (`1 ∨ `2 ∨ x2 ) ∧
^
(¬xi ∨ xi+1 ∨ `i+1 ) ∧ (¬xk−2 ∨ `k−1 ∨ `k ).
i∈2..k−2
Assume m |= G :
There is a m(`i ) = 1.
Let m0 = m[x2 7→ 1, .., xi−1 7→ 1, xi 7→ 0, . . . , xk−2 7→ 0]
Therefore, m0 |= G 0 (why?).
G 0 contains 3(k − 2) literals.
In the worst case, the formula size will increase by 3.
Exercise 4.9
a. Complete the above argument.
b. Show a 3-SAT formula cannot be converted into 2-SAT using Tseitin’s
encoding
16
End of Lecture 4
17
© Copyright 2026 Paperzz