# Satisfiability Problem

The satisfiability Problem is a widely studied problem in complexity theory. It serves as a base for polynomial time reduction.

## Satisfiability (SAT) Problem

- Boolean formula f(a
_{1}, a_{2}, …a_{n}) is satisfiable if there is a way to assign values to a variable of the formula such that the function evaluates to*true*. If this is the case, the function is.*satisfiable* - On the other hand, if no such assignment is possible, the function is
*unsatisfiable*. - The expression (A ^ ¬B) is satisfiable for A = 1 and B = 0, but the expression (A ^ ¬A) is unsatisfiable.
- No known algorithm exists that solves the problem efficiently.

### Example: f(x, y, z) = (x ∨ (y **∧** z) ) **∧** (x **∧** z)

X | y | z | x ∨ (y ∧ z) | x ∧ z | f(x, y, z) |

0 | 0 | 0 | 0 | 0 | 0 |

0 | 0 | 1 | 0 | 0 | 0 |

0 | 1 | 0 | 0 | 0 | 0 |

0 | 1 | 1 | 1 | 0 | 0 |

1 | 0 | 0 | 1 | 0 | 0 |

1 | 0 | 1 | 1 | 1 | 1 |

1 | 1 | 0 | 1 | 0 | 0 |

1 | 1 | 1 | 1 | 1 | 1 |

- The function is true for the combinations (x = 1, y = 0, z = 1) and (x = y = z = 1), hence it is satisfiable.
- Given the input sequence, it can be verified in linear time. But with n input n variables, there exist 2
^{n}instances. Testing each of them takes O(n.2^{n}) time, which speaks SAT ∈ NP.

## Circuit Satisfiability (CIRCUIT-SAT) Problem

A combinational circuit is a collection of AND, OR and NOT gates.

Circuit satisfiability problemis to determine, given the combinational circuit, is it satisfiable?

- Given the assignment of the Boolean value for the input variable of the circuit, we can trace the output by assigning 0/1 to each input.
- If the final value of the circuit results in 1, the algorithm outputs “yes”, otherwise algorithm outputs “no”.
- This checking is done in polynomial time, more formally in the linear order of circuit size.

- If the circuit has k inputs, 2
^{k}different assignments are possible. If the size of the circuit is polynomial in k, each assignment leads to a super-polynomial time algorithm. - This proves that the polynomial time algorithm does not exist for circuit satisfiability problems and hence it is in NP.

## 3SAT Problem

3SAT problemis the problem of determining the satisfiability of a formula in conjunctive normal form (CNF) where each clause is limited to at most three literals. It is also known as3CNFSATor3-Satisfiabilityproblem

- 3SAT is a special case of SAT problems discussed earlier. 3SAT is an NP-complete problem.
- To show that 3SAT is NP-complete, we shall prove that any of the SAT instances can be reduced to an instance of 3SAT. By this we mean, we have to show how to convert the clauses which do not contain three literals into the one which does.
- Let us start with the clauses having 2 literals (x
_{1}, x_{2}). We can introduce the new dummy literal u such that (x_{1}, x_{2}) is equivalent to (x_{1}, x_{2}, u) (x_{1}, x_{2}, u’). - If clause has only one literal (x), we can recursively introduce literals u
_{1}and u_{2}such that (x) corresponds to (x, u_{1}, u_{2}), (x, u_{1}, u_{2}‘), (x, u_{1}‘, u_{2}), (x, u_{1}‘, u_{2}‘).

If the clause has more than three literals (x_{1}, x_{2}, x_{3}, …, x_{n}), we can rewrite it as follows :

(x_{1}, x_{2}, u_{1}), (x_{3}, u_{1}‘, u_{2}), (x_{4}, u_{2}‘, u_{3}), … , (x_{n – 2}, u_{n-4}‘,u_{n – 3}), (x_{n – 1}, x_{n}, )

- One of the x
_{i}must be true for the original clause to be true. To make a new arrangement equivalent to this, we shall set all u_{i}true till x_{i}encounters in the new arrangement. - It can be seen that, if the original clause is satisfiable then its equivalent 3SAT representation is satisfiable too.
- Now, let us consider the countercase. For the original clause to be not satisfiable, all x
_{i}must be false. To prove this, we will start with the counter-argument that some of them will be true in 3SAT representation. - Assume that the last clause is true in 3SAT representation. As x
_{n – 1}and x_{n}are false, u_{n – 3}must be false for (x_{n – 1}, x_{n}, u_{n-3}‘) clause to be true. - For the second last clause to be true, u
_{n – 4}must be false, as x_{n – 2}and x_{n –3}are already false. - This procedure will ensure that when we reach the first clause, all u
_{i}must be false, and none of the x_{i}is true either. And hence it is proved that if the original clause is not satisfiable, then its equivalent 3SAT representation is also not satisfiable. - This transformation is polynomial time transformation, this SAT ≤
_{p}3SAT, and hence 3SAT is an NP-complete problem. - The 3-SAT problem can be generalized to the k-SAT problem. The k-SAT problem with k ≥ 3 is harder than 3-SAT and simpler than SAT problem and hence, k-SAT is also NP-complete.