11.14. Reduction of SAT to 3-SAT (optional) (WORK IN PROGRESS)¶
11.14.1. Reduction of SAT to 3-SAT¶
The following slideshow shows that an instance of Formula Satisfiability problem can be reduced to an instance of 3 CNF Satisfiability problem in polynomial time.
1 / 53
Settings
Reduction of SAT to 3-SAT
<<<>>>
Reduction of SAT to 3-SAT
This slideshow presents how to reduce a Formula Satisfiability problem to an 3 CNF Satisfiability problem in polynomial time
There can be only four cases for a clause in a SAT formula : C1 . C2 . ⋯ . Cn
Let Ci denote a random clause in a SAT formula where i can range from 1 to n
1. It contains three literals. For example : (x1+¯x2+x3)
No reduction needed for this case.
2. It contains only one literal. For example : (x1)
3. It contains two literals. For example : (x1+¯x2)
4. It contains more than three literals. For example : (x1+¯x2+x3 + ⋯ +xk) where k>3
Let Ci denote a random clause in a SAT formula where i can range from 1 to n
1. It contains three literals. For example : (x1+¯x2+x3)
No reduction needed for this case.
2. It contains only one literal. For example : (x1)
3. It contains two literals. For example : (x1+¯x2)
4. It contains more than three literals. For example : (x1+¯x2+x3 + ⋯ +xk) where k>3
Any of the above type of clause (C) can be replaced by a conjunction of clauses (Z) such that
1. All clauses in Z contain exactly 3 literals.
2. C is satisfiable if and only if Z is satisfiable. that is C⟺Z
1. All clauses in Z contain exactly 3 literals.
2. C is satisfiable if and only if Z is satisfiable. that is C⟺Z
Let Ci = li where li is a literal.
Introduce 2 new variables yi,1 and yi,2.
Replace Ci by conjunction of clauses Zi where
Zi=
(li+yi,1+yi,2)⋅
(li+¯yi,1+yi,2)⋅
(li+yi,1+¯yi,2)⋅
(li+¯yi,1+¯yi,2)
I
II
III
IV
Truth Table :
- li
- yi,1
- yi,2
- I
- II
- III
- IV
- Zi
- T
- T
- T
- T
- T
- T
- T
- T
- T
- T
- F
- T
- T
- T
- T
- T
- T
- F
- T
- T
- T
- T
- T
- T
- T
- F
- F
- T
- T
- T
- T
- T
- F
- T
- T
- T
- T
- T
- F
- F
- F
- T
- F
- T
- F
- T
- T
- F
- F
- F
- T
- T
- T
- F
- T
- F
- F
- F
- F
- F
- T
- T
- T
- F
When Ci (i.e. li) is True, Zi is true.
When Ci (i.e. li) is False, Zi is false.
Hence Ci can be reduced to Zi where each clause in Zi contains exactly 3 literals and Ci⟺Zi.
Let Ci = ( li,1 + li,2 ) where li,1 and li,2 are literals.
Introduce a new variable yi
Replace Ci by conjunction of clauses Zi where
Zi=
(li,1+li,2+yi)⋅
(li,1+li,2+¯yi)
I
II
Truth Table :
- li,1
- li,2
- yi
- Ci
- I
- II
- Zi
- T
- T
- T
- T
- T
- T
- T
- T
- T
- F
- T
- T
- T
- T
- T
- F
- T
- T
- T
- T
- T
- T
- F
- F
- T
- T
- T
- T
- F
- T
- T
- T
- T
- T
- T
- F
- T
- F
- T
- T
- T
- T
- F
- F
- T
- F
- T
- F
- F
- F
- F
- F
- F
- F
- T
- F
When Ci is true, Zi is true.
When Ci is false, Zi is false.
Hence Ci can be reduced to Zi where each clause in Zi contains exactly 3 literals and Ci⟺Zi.
Let Ci = (li,1+li,2+li,3+⋯+li,k) where k>3.
Introduce (k−3) new variables : y1,y2,⋯,yk−3
Replace Ci with a sequence of clauses Zi where
Zi=(li,1+li,2+y1)⋅(¯y1+li,3+y2)⋯(¯yj−2+li,j+yj−1)⋯(¯yk−4+li,k−2+yk−3)⋅(¯yk−3+li,k−1+li,k)
Zi=(li,1+li,2+y1)⋅(¯y1+li,3+y2)⋯(¯yj−2+li,j+yj−1)⋯(¯yk−4+li,k−2+yk−3)⋅(¯yk−3+li,k−1+li,k)
To prove:
a. When Ci is satisfiable,Zi is satisfiable
b. When Ci is not satisfiable, Zi is not satisfiable
a. When Ci is satisfiable,Zi is satisfiable
b. When Ci is not satisfiable, Zi is not satisfiable
Ci = (li,1+li,2+li,3+⋯+li,k) where k>3.
Zi=
(
li,1+li,2
+
y1
)⋅(
¯y1
+
li,3
+
y2
)⋯(
¯yj−3
+
li,j−1
+
yj−2
)⋅(
¯yj−2
+
li,j
+
yj−1
)⋅(
¯yj−1
+
li,j+1
+
yj
)⋯(
¯yk−4
+
li,k−2
+
yk−3
)
(
¯yk−3
+
li,k−1+lk
)
When Ci is satisfiable atleast one literal in li,1...li,k is True.
If any of li,1 or li,2 is True, set all the additional variables y1,y2⋯yk−3 to False.
The first term of all the clauses in Zi other than the first has a literal ¯yn which evaluates to True
Zi has a satisfying assignment
If any of li,k−1 or li,k is True, set all the additional variables y1,y2⋯yk−3 to True.
The third term of all the clauses in Zi other than the last has a literal yn which evaluates to True
If li,j (where j∉{1,2,k−1,k}) is True, set y1⋯yj−2 to True and yj−1⋯yk−3 to False.
Let us call the clause in Zi containing li,j in as C'
--------------------
C′
The third term of all the clauses in Zi left to C′ has a literal yn (where n∈{1..j−2}) which evaluates to True
The first term of all the clauses in Zi right to C′ has a literal ¯yn (where n∈{j−1..k−3}) which evaluates to True
Zi has a satisfying assignment
Hence when Ci is satisfiable, Zi is satisfiable.
When Ci is not satisfiable NO literal in { li,1⋯li,k } is True.
For Zi to be satisfiable, all its clauses must evaluate to True
For the first clause to be True, y1=True
Now for the second clause to be True, y2=True
Similarly for the third clause to be True, y3=True
y3=True⇒y4=True⋯⇒yj−2=True⇒yj−1=True⇒yj=True⋯⇒yk−4=True⇒yk−3=True
The last clause evaluates to False. Hence Zi is NOT SATISFIABLE
Hence we proved:
a. When Ci is satisfiable, Zi is satisfiable
b. When Ci is not satisfiable, Zi is not satisfiable
a. When Ci is satisfiable, Zi is satisfiable
b. When Ci is not satisfiable, Zi is not satisfiable
Hence any clause in a SAT expression can be replaced by a conjunction of clauses which contains 3 literals each.
So, a SAT problem can be reduced to an instance of 3-SAT in polynomial time.
So, a SAT problem can be reduced to an instance of 3-SAT in polynomial time.
This reduction can help in providing an NP Completeness proof for 3-SAT.