Hereafter, the number of logical variables is $N$, and the number of clauses is $M$. In the present
problem setup described above, $N=4$, $M=4$.
First, we prepare $3 \times M$ binary variables $q$ and map them to each literal that appears in each
clause. That is, $q_{i, j}$ corresponds to the $j$-th literal appearing in the $i$-th clause.
Here, the immediate idea is to map literals and binary variables to each other, but formulating in
this
way will eventually lead to the use of inequality
constraints, which require auxiliary variables. The use of auxiliary variables is not
necessarily a
bad thing. Still it is better not to use them if possible, so we will consider formulating the problem
differently.
Now, let us consider the following problem:
(Problem ☆) : For each clause of the 3-SAT problem, mark only one literal that appears in the clause
(see
the following logical formula). Can you do so so that a logical variable $x_i$ and its negation
$\bar{x_i}$ do not appear in the $M$ literals you have marked?
$$
\text{Marked example: }\:\:(\boxed{x_1} \lor \bar{x_2} \lor x_3) \land (\boxed{x_2} \lor \bar{x_3}
\lor
x_4) \land (\bar{x_1} \lor \bar{x_2} \lor \boxed{\bar{x_4}}) \land (\boxed{x_2} \lor x_3 \lor x_4)
$$
If we can solve this (problem ☆), then we can solve the 3-SAT problem as well because the solution to
the
3-SAT problem can be derived from the solution to (Problem ☆) as follows:
- Derivation of the 3-SAT problem.
For each of $i = 1, 2, \ldots, N$, find the literal marked in the solution of (Problem ☆) that is
$x_i$
or $\bar{x_i}$ (there may be more than one such literal but from the conditions of (Problem ☆),
$x_i$
and $\bar{x_i }$ are never marked at the same time). When $x_i$ is marked, $x_i = 1$, and when
$\bar{x_i
}$ is marked, $x_i = 0$. If no $x_i$ or $\bar{x_i}$ is marked, $x_i$ can be either $0$ or $1$.
It is easy to see that the logical variable $x$ determined in this way is a solution to the 3-SAT
problem.
Also, if there is a solution to the 3-SAT problem, we can construct a solution to (problem ☆) by
marking
one literal in each clause that is equal to $1$ in the solution. Thus, we know that it cannot happen
that
there is no solution to (problem ☆) even though there is a solution to the 3-SAT problem.
Therefore, we can solve (Problem ☆) instead of the 3-SAT problem.
Now let us formulate (Problem ☆). Let $3 \times M$ binary variables $q$ correspond to each literal,
and
let the binary variables indicate whether the corresponding literal is marked. If it is marked, it is
$1$;
if not, it is $0$.
For example, if the literal enclosed by the square in the following equation is marked, $q$ is as in
the
following table.
$$
(\boxed{x_1} \lor \bar{x_2} \lor x_3) \land (\boxed{x_2} \lor \bar{x_3} \lor x_4) \land (\bar{x_1}
\lor
\bar{x_2} \lor \boxed{\bar{x_4}}) \land (\boxed{x_2} \lor x_3 \lor x_4)
$$
$q_{i,j}$ |
1st literal |
2nd literal |
3rd literal |
1st clause |
1 |
0 |
0 |
2nd clause |
1 |
0 |
0 |
3rd clause |
0 |
0 |
1 |
4th clause |
1 |
0 |
0 |
Also, restoring the solution of the 3-SAT problem from this $q$ yields $x_1 = 1$, $x_2 = 1$, and $x_4
=
0$ (see above Derivation of the 3-SAT problem). The restoration method is, as
mentioned
above, $x_i = 1$ when $x_i$ is marked, $x_i = 0$ when $\bar{x_i}$ is marked, and $x_i$ can be either
$0$
or $1$ when neither $x_i$ nor $\bar{x_i}$ is marked (that is, $x _3$ can be either $0$ or $1$).