Soptq

Soptq

Probably a full-stack, mainly focusing on Distributed System / Consensus / Privacy-preserving Tech etc. Decentralization is a trend, privacy must be protected.
twitter
github
bilibili

Proof of 3-SAT NP-Completeness

To read this article, it is necessary to understand that the SAT problem is NP-complete, which is mainly proven by the Cook-Levin theorem. There are many excellent resources that have proven the NP-completeness of SAT, but I will omit them here, please refer to them yourself. If I have time in the future, I will add a proof of the SAT problem as I understand it.

The description of 3-SAT (3-CNF-SAT) is: Determine whether there exists a Boolean expression C=C1C2CnC = C_1 \cap C_2 \cap \cdots \cap C_n, where Ci=xaxbxcC_i = x_a \cup x_b \cup x_c, such that C=1C = 1. That is, determine whether there exists a Boolean expression C=(xa1xb1xc1)(xa2xb2xc2)(xanxbnxcn)C = (x_a^1 \cup x_b^1 \cup x_c^1)\cap (x_a^2 \cup x_b^2 \cup x_c^2)\cap \cdots\cap (x_a^n \cup x_b^n \cup x_c^n) that is true.

To prove the NP-completeness of 3-SAT, we need to 1) prove that it is an NP problem. 2) prove that it is NP-hard. 3-SAT is similar to the SAT problem, and when we obtain a set of solutions, we only need to substitute them into the Boolean expression to determine the correctness of the solution. So 3-SAT is obviously an NP problem. To prove its NP-hardness, we will reduce SAT to 3-SAT.

For each SAT problem, for example:

{C=C1C2CnCi=xaixbixmi\begin{cases} C = C_1 \cap C_2 \cap \cdots \cap C_n \\ C_i = x_a^i \cup x_b^i \cup \cdots \cup x_m^i \end{cases}

Each CiC_i consists of a certain number of variables. We will perform the following operations on each group of variables.

  • If Ci=1\lvert C_i \rvert = 1, that is, only one variable is involved in the composition of CiC_i, for example, Ci=xaiC_i = x_a^i. We transform it into Ci=xaixaixaiC_i = x_a^i \cup x_a^i \cup x_a^i.
  • If Ci=2\lvert C_i \rvert = 2, for example, Ci=xaixbiC_i = x_a^i \cup x_b^i. We transform it into Ci=xaixaixbiC_i = x_a^i \cup x_a^i \cup x_b^i.
  • If Ci=3\lvert C_i \rvert = 3, we keep it unchanged.
  • If Ci=4\lvert C_i \rvert = 4, for example, Ci=xaixbixcixdiC_i = x_a^i \cup x_b^i \cup x_c^i \cup x_d^i. We transform it into Ci=(xaixbiwi)C_i = (x_a^i \cup x_b^i \cup w^i) (wixcixdi)\cap ( \overline{w^i} \cup x_c^i \cup x_d^i). Where wiw^i is a new variable.
  • And so on.

The above operations can obviously be done in polynomial time. Therefore, given a SAT problem, we can convert it to a 3-SAT problem in polynomial time. And when SAT has a solution, 3-SAT must also have a solution; and when 3-SAT has a solution, since 3-SAT is a subclass of SAT, SAT also has a solution. Therefore, 3-SAT is NP-complete.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.