The Cook-Levin Theorem
Nabil Mustafa
Computational Complexity
1 / 147
Finding a NP hard problem
NP hard problem
3-CNF is NP hard. It is also NP complete.
2 / 147
Each boolean function can be ‘simulated’ by a CNF formula
3 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
4 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
5 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
6 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
Make a clause Cxi for each possible 2l values of u s.t.
7 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
Make a clause Cxi for each possible 2l values of u s.t.
I
If u = xi , Cxi = 0 and Cxj = 1 for all other j 6= i.
8 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
Make a clause Cxi for each possible 2l values of u s.t.
I
If u = xi , Cxi = 0 and Cxj = 1 for all other j 6= i.
Then φ(u) = Cx1 ∧ Cx2 ∧ . . . ∧ Cx2l
9 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
Make a clause Cxi for each possible 2l values of u s.t.
I
If u = xi , Cxi = 0 and Cxj = 1 for all other j 6= i.
Then φ(u) = Cx1 ∧ Cx2 ∧ . . . ∧ Cx2l
Is this the required clause?
10 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
Make a clause Cxi for each possible 2l values of u s.t.
I
If u = xi , Cxi = 0 and Cxj = 1 for all other j 6= i.
Then φ(u) = Cx1 ∧ Cx2 ∧ . . . ∧ Cx2l
Is this the required clause?
Fix:
11 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
Make a clause Cxi for each possible 2l values of u s.t.
I
If u = xi , Cxi = 0 and Cxj = 1 for all other j 6= i.
Then φ(u) = Cx1 ∧ Cx2 ∧ . . . ∧ Cx2l
Is this the required clause?
Fix: Drop clauses Cxi from above where f (xi ) = 1
12 / 147
Each boolean function can be ‘simulated’ by a CNF formula
Since languages are boolean functions, each language can be reduced
to CNF formula
Claim
For every f : {0, 1}l → {0, 1}, there is a l -variable CNF formula φ of size
l 2l s.t. φ(u) = f (u)
Proof.
Say u = x = (1, 1, . . . , 0, 1)
Make a clause Cxi for each possible 2l values of u s.t.
I
If u = xi , Cxi = 0 and Cxj = 1 for all other j 6= i.
Then φ(u) = Cx1 ∧ Cx2 ∧ . . . ∧ Cx2l
Is this the required clause?
Fix: Drop clauses Cxi from above where f (xi ) = 1
Size: l variables, 2l maximum clauses, l vars in each clause
13 / 147
Example of mapping of boolean function to CNF
Assume an arbitrary boolean function of 3 variables
14 / 147
Example of mapping of boolean function to CNF
Assume an arbitrary boolean function of 3 variables
Input
x0
x1
x2
x3
x4
x5
x6
x7
a1
0
0
0
0
1
1
1
1
a2
0
0
1
1
0
0
1
1
a3
0
1
0
1
0
1
0
1
f (a1 , a2 , a3 )
1
1
0
0
1
0
0
1
15 / 147
Example of mapping of boolean function to CNF
Assume an arbitrary boolean function of 3 variables
Input
x0
x1
x2
x3
x4
x5
x6
x7
a1
0
0
0
0
1
1
1
1
a2
0
0
1
1
0
0
1
1
a3
0
1
0
1
0
1
0
1
f (a1 , a2 , a3 )
1
1
0
0
1
0
0
1
We can drop all the clauses whose results are 1
16 / 147
Example of mapping of boolean function to CNF
Assume an arbitrary boolean function of 3 variables
Input
x0
x1
x2
x3
x4
x5
x6
x7
a1
0
0
0
0
1
1
1
1
a2
0
0
1
1
0
0
1
1
a3
0
1
0
1
0
1
0
1
f (a1 , a2 , a3 )
1
1
0
0
1
0
0
1
We can drop all the clauses whose results are 1
Make 4 clauses: Cx2 ∧ Cx3 ∧ Cx5 ∧ Cx6
17 / 147
Example of mapping of boolean function to CNF
Input
x2
x3
x5
x6
a1
0
0
1
1
a2
1
1
0
1
a3
0
1
1
0
f (a1 , a2 , a3 )
0
0
0
0
18 / 147
Example of mapping of boolean function to CNF
Input
x2
x3
x5
x6
a1
0
0
1
1
a2
1
1
0
1
a3
0
1
1
0
f (a1 , a2 , a3 )
0
0
0
0
Cx2 : (a1 ∨ a2 ∨ a3 )
19 / 147
Example of mapping of boolean function to CNF
Input
x2
x3
x5
x6
a1
0
0
1
1
a2
1
1
0
1
a3
0
1
1
0
f (a1 , a2 , a3 )
0
0
0
0
Cx2 : (a1 ∨ a2 ∨ a3 )
Cx3 : (a1 ∨ a2 ∨ a3 )
20 / 147
Example of mapping of boolean function to CNF
Input
x2
x3
x5
x6
a1
0
0
1
1
a2
1
1
0
1
a3
0
1
1
0
f (a1 , a2 , a3 )
0
0
0
0
Cx2 : (a1 ∨ a2 ∨ a3 )
Cx3 : (a1 ∨ a2 ∨ a3 )
Cx5 : (a1 ∨ a2 ∨ a3 )
21 / 147
Example of mapping of boolean function to CNF
Input
x2
x3
x5
x6
a1
0
0
1
1
a2
1
1
0
1
a3
0
1
1
0
f (a1 , a2 , a3 )
0
0
0
0
Cx2 : (a1 ∨ a2 ∨ a3 )
Cx3 : (a1 ∨ a2 ∨ a3 )
Cx5 : (a1 ∨ a2 ∨ a3 )
Cx6 : (a1 ∨ a2 ∨ a3 )
22 / 147
Example of mapping of boolean function to CNF
Input
x2
x3
x5
x6
a1
0
0
1
1
a2
1
1
0
1
a3
0
1
1
0
f (a1 , a2 , a3 )
0
0
0
0
Cx2 : (a1 ∨ a2 ∨ a3 )
Cx3 : (a1 ∨ a2 ∨ a3 )
Cx5 : (a1 ∨ a2 ∨ a3 )
Cx6 : (a1 ∨ a2 ∨ a3 )
(a1 ∨ a2 ∨ a3 ) ∧ (a1 ∨ a2 ∨ a3 ) ∧ (a1 ∨ a2 ∨ a3 ) ∧ (a1 ∨ a2 ∨ a3 )
23 / 147
Example of mapping of boolean function to CNF
Try u = {0, 0, 1}. Claim: our formula evaluates to 1.
24 / 147
Example of mapping of boolean function to CNF
Try u = {0, 0, 1}. Claim: our formula evaluates to 1.
Clause
Cx2
Cx3
Cx5
Cx6
a1 = 0
a1
a1
a1
a1
a2 = 0
a2
a2
a2
a2
a3 = 1
a3
a3
a3
a3
Output
1
1
1
1
25 / 147
Example of mapping of boolean function to CNF
Try u = {0, 0, 1}. Claim: our formula evaluates to 1.
Clause
Cx2
Cx3
Cx5
Cx6
a1 = 0
a1
a1
a1
a1
a2 = 0
a2
a2
a2
a2
a3 = 1
a3
a3
a3
a3
Output
1
1
1
1
Try u = {1, 0, 1}. Claim: our formula evaluates to 0.
26 / 147
Example of mapping of boolean function to CNF
Try u = {0, 0, 1}. Claim: our formula evaluates to 1.
Clause
Cx2
Cx3
Cx5
Cx6
a1 = 0
a1
a1
a1
a1
a2 = 0
a2
a2
a2
a2
a3 = 1
a3
a3
a3
a3
Output
1
1
1
1
Try u = {1, 0, 1}. Claim: our formula evaluates to 0.
Clause
Cx2
Cx3
Cx5
Cx6
a1 = 1
a1
a1
a1
a1
a2 = 0
a2
a2
a2
a2
a3 = 1
a3
a3
a3
a3
Output
1
1
0
1
27 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
28 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
29 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
I
l -variable function can be reduced to SAT of size O(l 2l )
30 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
I
I
l -variable function can be reduced to SAT of size O(l 2l )
Not poly-time! Doesn’t work, but suggests an improvement
31 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
I
I
l -variable function can be reduced to SAT of size O(l 2l )
Not poly-time! Doesn’t work, but suggests an improvement
Idea: Concerned with only those functions that can be computed by a
poly-time NTM
32 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
I
I
l -variable function can be reduced to SAT of size O(l 2l )
Not poly-time! Doesn’t work, but suggests an improvement
Idea: Concerned with only those functions that can be computed by a
poly-time NTM
Idea: Encode the step-by-step workings of a NTM by SAT
33 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
I
I
l -variable function can be reduced to SAT of size O(l 2l )
Not poly-time! Doesn’t work, but suggests an improvement
Idea: Concerned with only those functions that can be computed by a
poly-time NTM
Idea: Encode the step-by-step workings of a NTM by SAT
SAT of polynomial size, since by definition, NTM takes polynomial
time
34 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
I
I
l -variable function can be reduced to SAT of size O(l 2l )
Not poly-time! Doesn’t work, but suggests an improvement
Idea: Concerned with only those functions that can be computed by a
poly-time NTM
Idea: Encode the step-by-step workings of a NTM by SAT
SAT of polynomial size, since by definition, NTM takes polynomial
time
I
The space a NTM uses is always less than the time it takes.
35 / 147
A first attempt
Claim
Any NP complete problem is poly-time reducible to CNF SAT
Proof idea:
A language in NP Lf : computing a boolean function f
I
I
l -variable function can be reduced to SAT of size O(l 2l )
Not poly-time! Doesn’t work, but suggests an improvement
Idea: Concerned with only those functions that can be computed by a
poly-time NTM
Idea: Encode the step-by-step workings of a NTM by SAT
SAT of polynomial size, since by definition, NTM takes polynomial
time
I
I
The space a NTM uses is always less than the time it takes.
Locality of computation
36 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
37 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
Group variables x1 , . . . , xn into t batches
38 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
39 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
40 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
41 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
I
First find a set of assignment for variables in G1
42 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
I
I
First find a set of assignment for variables in G1
Based on the variables in G1 , find assignments in G2
43 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
I
I
I
First find a set of assignment for variables in G1
Based on the variables in G1 , find assignments in G2
Based on the variables in G2 &G1 , find assignments in G3
44 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
I
I
I
I
First find a set of assignment for variables in G1
Based on the variables in G1 , find assignments in G2
Based on the variables in G2 &G1 , find assignments in G3
And so on.
45 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
I
I
I
I
First find a set of assignment for variables in G1
Based on the variables in G1 , find assignments in G2
Based on the variables in G2 &G1 , find assignments in G3
And so on.
Its trivial observation, so what’s the point?
46 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
I
I
I
I
First find a set of assignment for variables in G1
Based on the variables in G1 , find assignments in G2
Based on the variables in G2 &G1 , find assignments in G3
And so on.
Its trivial observation, so what’s the point?
Each step of NTM will be captured by a poly-sized set of variable Gi
47 / 147
Why the connection to satisfiability
Think of CNF satisfiability of formula φ(x1 , . . . , xn ) as follows:
I
I
Group variables x1 , . . . , xn into t batches
Say G1 , . . . , Gt
Goal: find an assignment for which φ = 1
Think of this assignment process in stages:
I
I
I
I
First find a set of assignment for variables in G1
Based on the variables in G1 , find assignments in G2
Based on the variables in G2 &G1 , find assignments in G3
And so on.
Its trivial observation, so what’s the point?
Each step of NTM will be captured by a poly-sized set of variable Gi
Polynomial number of steps =⇒ total poly-sized set of variables
48 / 147
A configuration of a NTM at time t, denoted Ct , is:
49 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
The set of symbols on the work tape at time t
50 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
51 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
52 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
53 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
54 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Computation: At each step, use rule to get a new config:
ri
ri
ri
rij
1
2
3
C0 −→
C1 −→
C2 −→
C3 −→ Cj
55 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Computation: At each step, use rule to get a new config:
ri
ri
ri
rij
1
2
3
C0 −→
C1 −→
C2 −→
C3 −→ Cj
At each time step t, use boolean variables to store:
56 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Computation: At each step, use rule to get a new config:
ri
ri
ri
rij
1
2
3
C0 −→
C1 −→
C2 −→
C3 −→ Cj
At each time step t, use boolean variables to store:
I
set of symbols on work-tape at time t
57 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Computation: At each step, use rule to get a new config:
ri
ri
ri
rij
1
2
3
C0 −→
C1 −→
C2 −→
C3 −→ Cj
At each time step t, use boolean variables to store:
I
I
set of symbols on work-tape at time t
the state qt , the rule applied rit , position of tape head
58 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Computation: At each step, use rule to get a new config:
ri
ri
ri
rij
1
2
3
C0 −→
C1 −→
C2 −→
C3 −→ Cj
At each time step t, use boolean variables to store:
I
I
set of symbols on work-tape at time t
the state qt , the rule applied rit , position of tape head
Fundamental idea: Boolean operations enforce consistency
59 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Computation: At each step, use rule to get a new config:
ri
ri
ri
rij
1
2
3
C0 −→
C1 −→
C2 −→
C3 −→ Cj
At each time step t, use boolean variables to store:
I
I
set of symbols on work-tape at time t
the state qt , the rule applied rit , position of tape head
Fundamental idea: Boolean operations enforce consistency
I
the variables of G1 are set by the input
60 / 147
A configuration of a NTM at time t, denoted Ct , is:
I
I
I
The set of symbols on the work tape at time t
The state of NTM at time t
Position of tape-head at time t
Initial configuration C0 : input string on work tape, start state
Assume the transition rules are r1 , . . . , rz , where
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Computation: At each step, use rule to get a new config:
ri
ri
ri
rij
1
2
3
C0 −→
C1 −→
C2 −→
C3 −→ Cj
At each time step t, use boolean variables to store:
I
I
set of symbols on work-tape at time t
the state qt , the rule applied rit , position of tape head
Fundamental idea: Boolean operations enforce consistency
I
I
the variables of G1 are set by the input
G2 values can be gotten by applying a rule properly to G1
61 / 147
Specifics of the transition function
At each time-step t, a variable specifies the rule used
62 / 147
Specifics of the transition function
At each time-step t, a variable specifies the rule used
Assume applied rule variable set to rit : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
63 / 147
Specifics of the transition function
At each time-step t, a variable specifies the rule used
Assume applied rule variable set to rit : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Then how do the other variables have to be set to ensure consistency?
64 / 147
Specifics of the transition function
At each time-step t, a variable specifies the rule used
Assume applied rule variable set to rit : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Then how do the other variables have to be set to ensure consistency?
Assume tape-head at position k at time t
65 / 147
Specifics of the transition function
At each time-step t, a variable specifies the rule used
Assume applied rule variable set to rit : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Then how do the other variables have to be set to ensure consistency?
Assume tape-head at position k at time t
T ime = t n
x
y
σi
b
j
3
qj
66 / 147
Specifics of the transition function
At each time-step t, a variable specifies the rule used
Assume applied rule variable set to rit : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Then how do the other variables have to be set to ensure consistency?
Assume tape-head at position k at time t
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
67 / 147
Specifics of the transition function
At each time-step t, a variable specifies the rule used
Assume applied rule variable set to rit : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
Then how do the other variables have to be set to ensure consistency?
Assume tape-head at position k at time t
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
68 / 147
Consistency of computation
To ensure consistency, once the rule variable and the tape-head position is
set, then
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
69 / 147
Consistency of computation
To ensure consistency, once the rule variable and the tape-head position is
set, then
symbol at position k should be σi at time t
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
70 / 147
Consistency of computation
To ensure consistency, once the rule variable and the tape-head position is
set, then
symbol at position k should be σi 0 at time t + 1
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
71 / 147
Consistency of computation
To ensure consistency, once the rule variable and the tape-head position is
set, then
symbol at position k 0 6= k should be same at t and t + 1
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
72 / 147
Consistency of computation
To ensure consistency, once the rule variable and the tape-head position is
set, then
tape-head should be at position k − 1 at time t + 1
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
73 / 147
Consistency of computation
To ensure consistency, once the rule variable and the tape-head position is
set, then
state at time t should be qj
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
74 / 147
Consistency of computation
To ensure consistency, once the rule variable and the tape-head position is
set, then
state at time t + 1 should be qj 0
T ime = t
n
x
y
σi
b
j
3
qj
rit : (σi, qj ) =⇒ (σi0 , qj 0 , L)
T ime = t + 1 n
x
y
σi0 b
j
3
qj 0
75 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
76 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
77 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
78 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
79 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
Constraint: for each t, exactly one Rti should be 1
80 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
Constraint: for each t, exactly one Rti should be 1
At least one is set to 1:
81 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
Constraint: for each t, exactly one Rti should be 1
At least one is set to 1: (Rt1 ∨ . . . ∨ Rtz )
82 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
Constraint: for each t, exactly one Rti should be 1
At least one is set to 1: (Rt1 ∨ . . . ∨ Rtz )
At most one is set:
83 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
Constraint: for each t, exactly one Rti should be 1
At least one is set to 1: (Rt1 ∨ . . . ∨ Rtz )
At most one is set:
^
(Rti =⇒ Rtj )
i,j
84 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
Constraint: for each t, exactly one Rti should be 1
At least one is set to 1: (Rt1 ∨ . . . ∨ Rtz )
At most one is set:
^
^
or equivalently,
(Rti ∨ Rtj )
(Rti =⇒ Rtj )
i,j
i,j
85 / 147
Making variables
Rt ∈ {r1 , . . . , rz }: the rule which is applied at time-step t
Technical difficulty: allowed only boolean variables
Solution: use z variables to represent characteristic vector
Rt1 , . . . , Rtz : Rti = 1 if rule ri used at time t, 0 otherwise.
Constraint: for each t, exactly one Rti should be 1
At least one is set to 1: (Rt1 ∨ . . . ∨ Rtz )
At most one is set:
^
^
or equivalently,
(Rti ∨ Rtj )
(Rti =⇒ Rtj )
i,j
i,j
Final rule constraints for each time t :
(Rt1 ∨ . . . ∨ Rtz )
∧
^
Rti =⇒ Rtj
i,j
86 / 147
Making variables
Ss,t : 1 if the tape-head is at position s at time t
87 / 147
Making variables
Ss,t : 1 if the tape-head is at position s at time t
I
For each t, exactly one Ss,t is to be set to 1
88 / 147
Making variables
Ss,t : 1 if the tape-head is at position s at time t
I
For each t, exactly one Ss,t is to be set to 1
Qi,t : 1 if the NTM state at time t is qi
89 / 147
Making variables
Ss,t : 1 if the tape-head is at position s at time t
I
For each t, exactly one Ss,t is to be set to 1
Qi,t : 1 if the NTM state at time t is qi
I
For each t, exactly one Qi,t is to be set to 1
90 / 147
Making variables
Ss,t : 1 if the tape-head is at position s at time t
I
For each t, exactly one Ss,t is to be set to 1
Qi,t : 1 if the NTM state at time t is qi
I
For each t, exactly one Qi,t is to be set to 1
i : 1 if the symbol at position s at time t is σ
Ps,t
i
91 / 147
Making variables
Ss,t : 1 if the tape-head is at position s at time t
I
For each t, exactly one Ss,t is to be set to 1
Qi,t : 1 if the NTM state at time t is qi
I
For each t, exactly one Qi,t is to be set to 1
i : 1 if the symbol at position s at time t is σ
Ps,t
i
I
i
For each t and each s, exactly one Ps,t
is to be set to 1
92 / 147
The initial configuration C0
The input x is on the first n cells of the tape
93 / 147
The initial configuration C0
The input x is on the first n cells of the tape
^ x
^
^
0
Pi,1i
Pi,1
1≤i≤n
n+1≤i≤t ∗
94 / 147
The initial configuration C0
The input x is on the first n cells of the tape
^ x
^
^
0
Pi,1i
Pi,1
1≤i≤n
n+1≤i≤t ∗
Tape-head is at position 1
95 / 147
The initial configuration C0
The input x is on the first n cells of the tape
^ x
^
^
0
Pi,1i
Pi,1
n+1≤i≤t ∗
1≤i≤n
Tape-head is at position 1
S1,1
The NTM state is q0
96 / 147
The initial configuration C0
The input x is on the first n cells of the tape
^ x
^
^
0
Pi,1i
Pi,1
n+1≤i≤t ∗
1≤i≤n
Tape-head is at position 1
S1,1
The NTM state is q0
Q0,1
97 / 147
The initial configuration C0
The input x is on the first n cells of the tape
^ x
^
^
0
Pi,1i
Pi,1
n+1≤i≤t ∗
1≤i≤n
Tape-head is at position 1
S1,1
The NTM state is q0
Q0,1
Final constraints:
Q0,1
∧
S1,1
∧
^
1≤i≤n
xi
Pi,1
∧
^
0
Pi,1
n+1≤i≤t ∗
98 / 147
Adding rule consistency constraints
We have the first group of variables set up to capture C0
99 / 147
Adding rule consistency constraints
We have the first group of variables set up to capture C0
Added constraints to ensure consistency of boolean variables
100 / 147
Adding rule consistency constraints
We have the first group of variables set up to capture C0
Added constraints to ensure consistency of boolean variables
Now remaining thing: if some rule ru picked at first time-step
101 / 147
Adding rule consistency constraints
We have the first group of variables set up to capture C0
Added constraints to ensure consistency of boolean variables
Now remaining thing: if some rule ru picked at first time-step
I
Assume that ru : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
102 / 147
Adding rule consistency constraints
We have the first group of variables set up to capture C0
Added constraints to ensure consistency of boolean variables
Now remaining thing: if some rule ru picked at first time-step
I
I
Assume that ru : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
It should be possible to apply rule ru to configuration C0
103 / 147
Adding rule consistency constraints
We have the first group of variables set up to capture C0
Added constraints to ensure consistency of boolean variables
Now remaining thing: if some rule ru picked at first time-step
I
I
I
Assume that ru : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
It should be possible to apply rule ru to configuration C0
The configuration C1 is completely determined by ru and C0
104 / 147
Adding rule consistency constraints
We have the first group of variables set up to capture C0
Added constraints to ensure consistency of boolean variables
Now remaining thing: if some rule ru picked at first time-step
I
I
I
Assume that ru : (σi , qj ) =⇒ (σi 0 , qj 0 , L)
It should be possible to apply rule ru to configuration C0
The configuration C1 is completely determined by ru and C0
Recall the rule-consistency constraints:
I
I
I
I
I
I
symbol at position k should be σi at time t
symbol at position k should be σi 0 at time t + 1
symbol at position k 0 6= k should be same at t and t + 1
tape-head should be at position k − 1 at time t + 1
state at time t should be qj
state at time t + 1 should be qj 0
105 / 147
For each rule ru and each time t
Let
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L) then
Ss,t
^
Rtu =⇒
106 / 147
For each rule ru and each time t
Let
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L) then
Ss,t
^
Rtu =⇒
symbol at position s should be σi at time t
107 / 147
For each rule ru and each time t
Let
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L) then
Ss,t
^
Rtu =⇒
symbol at position s should be σi at time t
i
Ps,t
symbol at position s should be σi 0 at time t + 1
108 / 147
For each rule ru and each time t
Let
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L) then
Ss,t
^
Rtu =⇒
symbol at position s should be σi at time t
i
Ps,t
symbol at position s should be σi 0 at time t + 1
0
i
Ps,t+1
symbol at position s 0 6= k should be same at t and t + 1
109 / 147
For each rule ru and each time t
Let
ru = (σi , qj ) =⇒ (σi 0 , qj 0 , L) then
Ss,t
^
Rtu =⇒
symbol at position s should be σi at time t
i
Ps,t
symbol at position s should be σi 0 at time t + 1
0
i
Ps,t+1
symbol at position s 0 6= k should be same at t and t + 1
^
Psi 0 ,t+1 = Psi 0 ,t
i,s 0 6=s
110 / 147
For each rule ru and each time t
tape-head should be at position s − 1 at time t + 1
111 / 147
For each rule ru and each time t
tape-head should be at position s − 1 at time t + 1
Ss−1,t+1
state at time t should be qj
112 / 147
For each rule ru and each time t
tape-head should be at position s − 1 at time t + 1
Ss−1,t+1
state at time t should be qj
Qj,t
state at time t + 1 should be qj 0
113 / 147
For each rule ru and each time t
tape-head should be at position s − 1 at time t + 1
Ss−1,t+1
state at time t should be qj
Qj,t
state at time t + 1 should be qj 0
Qj 0 ,t+1
Final constraint:
114 / 147
For each rule ru and each time t
tape-head should be at position s − 1 at time t + 1
Ss−1,t+1
state at time t should be qj
Qj,t
state at time t + 1 should be qj 0
Qj 0 ,t+1
Final constraint:
0
i
i
Ss,t ∧Rtu =⇒ Ps,t
∧Ps,t+1
∧
^
Psi 0 ,t+1 = Psi 0 ,t ∧Ss−1,t+1 ∧Qqj ,t ∧Qqj 0 ,t+1
i,s 0 6=s
115 / 147
Finally
So far, encoded computation of NTM by a static formula!
116 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
117 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
118 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
NTM reaches the accept state Q1,t for some t
119 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
NTM reaches the accept state Q1,t for some t
(Q1,0 ∨ Q1,1 ∨ Q1,2 ∨ Q1,3 ∨ . . . ∨ Q1,t ∗ )
120 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
NTM reaches the accept state Q1,t for some t
(Q1,0 ∨ Q1,1 ∨ Q1,2 ∨ Q1,3 ∨ . . . ∨ Q1,t ∗ )
The formula has total size function of
121 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
NTM reaches the accept state Q1,t for some t
(Q1,0 ∨ Q1,1 ∨ Q1,2 ∨ Q1,3 ∨ . . . ∨ Q1,t ∗ )
The formula has total size function of
I
input x of length n
122 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
NTM reaches the accept state Q1,t for some t
(Q1,0 ∨ Q1,1 ∨ Q1,2 ∨ Q1,3 ∨ . . . ∨ Q1,t ∗ )
The formula has total size function of
I
I
input x of length n
length of tape at each step: polynomial f (n)
123 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
NTM reaches the accept state Q1,t for some t
(Q1,0 ∨ Q1,1 ∨ Q1,2 ∨ Q1,3 ∨ . . . ∨ Q1,t ∗ )
The formula has total size function of
I
I
I
input x of length n
length of tape at each step: polynomial f (n)
number of NTM steps: polynomial f (n)
124 / 147
Finally
So far, encoded computation of NTM by a static formula!
I
formula is satisfiable =⇒ NTM following a valid computation path
But the goal is for formula to be satisfiable if NTM accepts
NTM reaches the accept state Q1,t for some t
(Q1,0 ∨ Q1,1 ∨ Q1,2 ∨ Q1,3 ∨ . . . ∨ Q1,t ∗ )
The formula has total size function of
I
I
I
input x of length n
length of tape at each step: polynomial f (n)
number of NTM steps: polynomial f (n)
If NTM accepts ⇐⇒ formula satisfiable
125 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
126 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
127 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
128 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
Let C = (v 1 ∨ v2 ∨ v 3 ∨ v4 ) be any clause. Then
129 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
Let C = (v 1 ∨ v2 ∨ v 3 ∨ v4 ) be any clause. Then
(v 1 ∨ v2 ∨ v 3 ∨ v4 ) ≡ (v 1 ∨ v2 ∨ z) ∧ (z = v 3 ∨ v4 )
130 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
Let C = (v 1 ∨ v2 ∨ v 3 ∨ v4 ) be any clause. Then
(v 1 ∨ v2 ∨ v 3 ∨ v4 ) ≡ (v 1 ∨ v2 ∨ z) ∧ (z = v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v 3 ∨ v4 )
131 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
Let C = (v 1 ∨ v2 ∨ v 3 ∨ v4 ) be any clause. Then
(v 1 ∨ v2 ∨ v 3 ∨ v4 ) ≡ (v 1 ∨ v2 ∨ z) ∧ (z = v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ (v3 ∧ v 4 ))
132 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
Let C = (v 1 ∨ v2 ∨ v 3 ∨ v4 ) be any clause. Then
(v 1 ∨ v2 ∨ v 3 ∨ v4 ) ≡ (v 1 ∨ v2 ∨ z) ∧ (z = v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ (v3 ∧ v 4 ))
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v3 ) ∧ (z ∨ v 4 )
133 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
Let C = (v 1 ∨ v2 ∨ v 3 ∨ v4 ) be any clause. Then
(v 1 ∨ v2 ∨ v 3 ∨ v4 ) ≡ (v 1 ∨ v2 ∨ z) ∧ (z = v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ (v3 ∧ v 4 ))
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v3 ) ∧ (z ∨ v 4 )
Repeat k − 2 times for a clause with k literals.
134 / 147
Claim
CNF satisfiability can be reduced to 3-CNF satisfiability
Proof.
Let φ be a formula with clauses C1 ∧ . . . ∧ Cm
We will convert each clause Ci to a bunch of 3-CNF clauses
Let C = (v 1 ∨ v2 ∨ v 3 ∨ v4 ) be any clause. Then
(v 1 ∨ v2 ∨ v 3 ∨ v4 ) ≡ (v 1 ∨ v2 ∨ z) ∧ (z = v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v 3 ∨ v4 )
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ (v3 ∧ v 4 ))
≡ (v 1 ∨ v2 ∨ z) ∧ (z ∨ v 3 ∨ v4 ) ∧ (z ∨ v3 ) ∧ (z ∨ v 4 )
Repeat k − 2 times for a clause with k literals.
Total number of 3-CNF clauses: O(m · 4k).
135 / 147
Example of CNF to 3-CNF
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ), C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ), C3 = (v 1 ∨ v 2 ∨ v4 )
136 / 147
Example of CNF to 3-CNF
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ), C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ), C3 = (v 1 ∨ v 2 ∨ v4 )
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ) ≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z = v4 ∨ v5 )
137 / 147
Example of CNF to 3-CNF
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ), C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ), C3 = (v 1 ∨ v 2 ∨ v4 )
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ) ≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z = v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ v4 ∨ v5 )
138 / 147
Example of CNF to 3-CNF
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ), C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ), C3 = (v 1 ∨ v 2 ∨ v4 )
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ) ≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z = v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ y ) ∧ (y = v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ (v 4 ∧ v 5 ))
139 / 147
Example of CNF to 3-CNF
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ), C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ), C3 = (v 1 ∨ v 2 ∨ v4 )
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ) ≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z = v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ y ) ∧ (y = v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ (v 4 ∧ v 5 ))
≡ (v 1 ∨ v2 ∨ y ) ∧ (y ∨ v 3 ∨ z) ∧ (y ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 )
∧(z ∨ v 4 ) ∧ (z ∨ v 5 )
140 / 147
Example of CNF to 3-CNF
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ), C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ), C3 = (v 1 ∨ v 2 ∨ v4 )
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ) ≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z = v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ y ) ∧ (y = v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ (v 4 ∧ v 5 ))
≡ (v 1 ∨ v2 ∨ y ) ∧ (y ∨ v 3 ∨ z) ∧ (y ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 )
∧(z ∨ v 4 ) ∧ (z ∨ v 5 )
≡ (v 1 ∨ v2 ∨ y ) ∧ (y ∨ v 3 ∨ z) ∧ (y ∨ (v3 ∧ z)) ∧ (z ∨ v4 ∨ v5 )
∧(z ∨ v 4 ) ∧ (z ∨ v 5 )
141 / 147
Example of CNF to 3-CNF
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ), C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ), C3 = (v 1 ∨ v 2 ∨ v4 )
C1 = (v 1 ∨ v2 ∨ v 3 ∨ v4 ∨ v5 ) ≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z = v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ v4 ∨ v5 )
≡ (v 1 ∨ v2 ∨ y ) ∧ (y = v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 ) ∧ (z ∨ (v 4 ∧ v 5 ))
≡ (v 1 ∨ v2 ∨ y ) ∧ (y ∨ v 3 ∨ z) ∧ (y ∨ v 3 ∨ z) ∧ (z ∨ v4 ∨ v5 )
∧(z ∨ v 4 ) ∧ (z ∨ v 5 )
≡ (v 1 ∨ v2 ∨ y ) ∧ (y ∨ v 3 ∨ z) ∧ (y ∨ (v3 ∧ z)) ∧ (z ∨ v4 ∨ v5 )
∧(z ∨ v 4 ) ∧ (z ∨ v 5 )
≡ (v 1 ∨ v2 ∨ y ) ∧ (y ∨ v 3 ∨ z) ∧ (y ∨ v3 ) ∧ (y ∨ z)
∧(z ∨ v4 ∨ v5 ) ∧ (z ∨ v 4 ) ∧ (z ∨ v 5 )
142 / 147
Example of CNF to 3-CNF
C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ) ≡ (v 1 ∨ v 2 ∨ z) ∧ (z = v3 ∨ v4 )
143 / 147
Example of CNF to 3-CNF
C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ) ≡ (v 1 ∨ v 2 ∨ z) ∧ (z = v3 ∨ v4 )
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ v3 ∨ v4 )
144 / 147
Example of CNF to 3-CNF
C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ) ≡ (v 1 ∨ v 2 ∨ z) ∧ (z = v3 ∨ v4 )
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ v3 ∨ v4 )
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ (v 3 ∧ v 4 ))
145 / 147
Example of CNF to 3-CNF
C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ) ≡ (v 1 ∨ v 2 ∨ z) ∧ (z = v3 ∨ v4 )
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ v3 ∨ v4 )
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ (v 3 ∧ v 4 ))
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ v 3 ) ∧ (z ∨ v 4 )
146 / 147
Example of CNF to 3-CNF
C2 = (v 1 ∨ v 2 ∨ v3 ∨ v4 ) ≡ (v 1 ∨ v 2 ∨ z) ∧ (z = v3 ∨ v4 )
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ v3 ∨ v4 )
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ (v 3 ∧ v 4 ))
≡ (v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ v 3 ) ∧ (z ∨ v 4 )
Final reduction of C1 ∧ C2 ∧ C3 :
((v 1 ∨ v2 V
∨ y ) ∧ (y ∨ v 3 ∨ z) ∧ (y ∨ v3 ) ∧ (y ∨ z) ∧ (z ∨ v4 ∨ vV
5 ) ∧ (z ∨ v 4 ) ∧
(z ∨ v 5 )) ((v 1 ∨ v 2 ∨ z) ∧ (z ∨ v3 ∨ v4 ) ∧ (z ∨ v 3 ) ∧ (z ∨ v 4 )) (v 1 ∨ v 2 ∨ v4 )
147 / 147
© Copyright 2026 Paperzz