14.13. Reduction of Circuit SAT to SAT¶
14.13.1. Reduction of Circuit SAT to SAT¶
The following slideshow shows that an instance of Circuit Satisfiability problem can be reduced to an instance of SAT problem in polynomial time.
1 / 40
Settings
Reduction of Circuit SAT to SAT
(x7+¯x1+¯x2+¯x4)⋅(¯x7+x1)⋅(¯x7+x2)⋅(¯x7+x4)
⋅
(x8+¯x5)⋅(x8+¯x6)⋅(¯x8+x5+x6)
⋅
(x9+¯x7)⋅(x9+¯x6)⋅(¯x9+x7+x6)
⋅
(x10+¯x7+¯x8+¯x9)⋅(¯x10+x7)⋅(¯x10+x8)⋅(¯x10+x9)
2. If the CNF formula is satisfiable
For the CNF formula to be satisfiable, all the clauses must be True.
Hence all the 'if and only if' formulae of the form iϕk will also need to be True.
This preserves the functionality of all corresponding gates in the circuit.
Also the output XO is True.
Hence the circuit is satisfiable.
<<<>>>
Reduction of Circuit SAT to SAT
This slideshow presents how to reduce an input instance to the Circuit-SAT problem to an equivalent instance to the SAT problem in polynomial time.
We start by giving some background.
We start by giving some background.
The reduction shown in this slideshow relies heavily on the following identity:
'If and only if' (denoted by ↔) is a boolean operator that follows the following truth table.
Let C = A ↔ B
'If and only if' (denoted by ↔) is a boolean operator that follows the following truth table.
Let C = A ↔ B
- A
- B
- C
- T
- T
- T
- T
- F
- F
- F
- T
- F
- F
- F
- T
A↔B is equivalent to (¯A+B)⋅(A+¯B)⋯⋯ Identity 1.
Check each line of the truth table to convince yourself that this is true.
Check each line of the truth table to convince yourself that this is true.
We will also use the following laws of boolean logic.
Distributive Law
A⋅(B+C)=A⋅B+A⋅C
A+B⋅C=(A+B)⋅(A+C)
DeMorgan's Law
¯A⋅B=¯A+¯B
¯A+B=¯A⋅¯B
Our reduction takes the following steps:
1. Assign a variable xi for each input signal of a circuit.
2. Assign a variable (say xo) for each output wire of a gate.
3. Set up an 'if and only if' formula for each gate.
(Recall from an earlier slide: 'If and only if' can be expressed as a conjuntion of clauses.)
Let ϕk be the formula for the kth gate.
4. Let xO be the final output wire of the circuit.
The CNF formula is xo,f⋅ϕ1⋅ϕ2⋯
1. Assign a variable xi for each input signal of a circuit.
2. Assign a variable (say xo) for each output wire of a gate.
3. Set up an 'if and only if' formula for each gate.
(Recall from an earlier slide: 'If and only if' can be expressed as a conjuntion of clauses.)
Let ϕk be the formula for the kth gate.
4. Let xO be the final output wire of the circuit.
The CNF formula is xo,f⋅ϕ1⋅ϕ2⋯
x1
x2
The reduced CNF formula: ϕ = (x2↔¯x1)
= (¯x2+¯x1)⋅(x2+¯¯x1) [Using Identity 1 (refer to slide 2)]
= (¯x1+¯x2)⋅(x1+x2) which is a conjunction of clauses.
Note: Since x2 is the output of NOT on x1, (x2↔¯x1) (i.e. ϕ) is always True.
A NOT gate can be reduced to a CNF formula in polynomial time
x1
x2
x3
The reduced CNF formula ϕ = (x3↔x1⋅x2)
= (x3+¯x1⋅x2)⋅(¯x3+x1⋅x2) [Using Identity 1]
= (x3+¯x1+¯x2)⋅(¯x3+x1⋅x2) [Using De Morgan's Law]
= (¯x1+¯x2+x3)⋅(¯x3+x1)⋅(¯x3+x2) [Using Distributive Law]
which is a conjunction of clauses.
which is a conjunction of clauses.
Note: Since x3 is the output of AND on x1 and x2, (x3↔x1⋅x2) (i.e. ϕ) is always True.
x1
x2
x3
x4
The reduced CNF formula ϕ = (x4↔x1⋅x2⋅x3)
= (x4+¯x1⋅x2⋅x3)⋅(¯x4+x1⋅x2⋅x3) [Using Identity 1]
= (x4+¯x1+¯x2+¯x3)⋅(¯x4+x1⋅x2⋅x3) [Using De Morgan's Law]
= (x4+¯x1+¯x2+¯x3)⋅(¯x4+x1)⋅(¯x4+x2)⋅(¯x4+x3) [Using Distributive Law]
which is a conjunction of clauses.
which is a conjunction of clauses.
Note: Since x4 is the output of AND on x1 x2 and x3, (x4↔x1⋅x2⋅x3) (i.e. ϕ) is always True.
An AND gate with any number of input wires can be reduced to a similar CNF formula
in polynomial time.
in polynomial time.
x1
x2
x3
The reduced CNF formula ϕ = (x3↔(x1+x2))
= (x3+(¯x1+x2))⋅(¯x3+(x1+x2)) [Using Identity 1]
= (x3+¯x1⋅¯x2)⋅(¯x3+x1+x2) [Using De Morgan's Law]
= (x3+¯x1)⋅(x3+¯x2)⋅(¯x3+x1+x2) [Using Distributive Law]
which is a conjunction of clauses.
which is a conjunction of clauses.
Note: Since x3 is the output of OR on x1 and x2, (x4↔(x1+x2)) (i.e. ϕ) is always True.
x1
x2
x3
x4
The reduced CNF formula ϕ = (x4↔(x1+x2+x3))
= (x4+(¯x1+x2+x3))⋅(¯x4+(x1+x2+x3)) [Using Identity 1]
= (x4+¯x1⋅¯x2⋅¯x3)⋅(¯x4+x1+x2+x3) [Using De Morgan's Law]
= (x4+¯x1)⋅(x4+¯x2)⋅(x4+¯x3)⋅(¯x4+x1+x2+x3) [Using Distributive Law]
which is a conjunction of clauses.
which is a conjunction of clauses.
Since x4 is the output of OR on x1 x2 and x3, (x4↔(x1+x2+x3)) (i.e. ϕ) is always True.
An OR gate with any number of input wires can be reduced to a similar CNF formula
in polynomial time
in polynomial time
As we saw, each gate in the circuit (with n gates) can be reduced to a CNF formula ϕ in polynomial time.
If xO is the variable corresponding to the final output of the circuit, and ϕk is the CNF formula for gate k,
the circuit can be reduced to the CNF formula :
xO⋅ϕ1⋅ϕ2⋯ϕn.
If xO is the variable corresponding to the final output of the circuit, and ϕk is the CNF formula for gate k,
the circuit can be reduced to the CNF formula :
xO⋅ϕ1⋅ϕ2⋯ϕn.
x1
x2
x3
A
B
C
D
E
F
G
x4
x5
x6
x7
x8
x9
x10
This circuit can be reduced to
x10
⋅
(x4↔¯x3)
⋅
(x5↔(x1+x2))
⋅
(x6↔¯x4)
⋅
(x7↔(x1.x2.x4))
⋅
(x8↔(x5+x6))
⋅
(x9↔(x7+x6))
⋅
(x10↔(x7.x8.x9))
=
x10
⋅
(¯x3+¯x4)⋅(x3+x4)
⋅
(x5+¯x1)⋅(x5+¯x2)⋅(¯x5+x1+x2)
⋅
(¯x4+¯x6)⋅(x4+x6)
⋅
(x7+¯x1+¯x2+¯x4)⋅(¯x7+x1)⋅(¯x7+x2)⋅(¯x7+x4)
⋅
(x8+¯x5)⋅(x8+¯x6)⋅(¯x8+x5+x6)
⋅
(x9+¯x7)⋅(x9+¯x6)⋅(¯x9+x7+x6)
⋅
(x10+¯x7+¯x8+¯x9)⋅(¯x10+x7)⋅(¯x10+x8)⋅(¯x10+x9)
Note: This CNF expression can be constructed in polynomial time.
The reduced CNF formula for a circuit with n gates is of the xo,f⋅ϕ1⋅ϕ2⋯ where ϕk is the CNF formula
corresponding to the kthgate.
1. If the circuit is satisfiable
The gates in a circuit perform a well defined function causing the ϕk formulae to be aways True.
Since the circuit is satisfiable, its final output XO evaluates to True.
Hence with all clauses satisfied, the reduced CNF formula also evaluates to True.
The CNF formula is satisfiable.
corresponding to the kthgate.
1. If the circuit is satisfiable
The gates in a circuit perform a well defined function causing the ϕk formulae to be aways True.
Since the circuit is satisfiable, its final output XO evaluates to True.
Hence with all clauses satisfied, the reduced CNF formula also evaluates to True.
The CNF formula is satisfiable.
2. If the CNF formula is satisfiable
For the CNF formula to be satisfiable, all the clauses must be True.
Hence all the 'if and only if' formulae of the form iϕk will also need to be True.
This preserves the functionality of all corresponding gates in the circuit.
Also the output XO is True.
Hence the circuit is satisfiable.
This reduction can help in providing an NP Completeness proof for SAT.