\(%\usepackage{color}\) \(%\usepackage{tcolorbox}\) \(%\tcbuselibrary{skins}\) \(\usepackage{pifont}\) \(%\definecolor{aaltoblue}{RGB}{00,101,189} % 0065BD\) \(%\definecolor{aaltored}{RGB}{237,41,57} % ED2939\) \(\definecolor{MyBoxBackground}{rgb}{0.98,0.98,1.0}\) \(\definecolor{MyBoxBorder}{rgb}{0.90,0.90,1.0}\) \(%\definecolor{backgroundred}{rgb}{1.0,0.98,0.98}\) \(%\definecolor{shadowred}{rgb}{1.0,0.90,0.90}\) \(%\newcommand{\subheading}[1]{\textbf{\large\color{fakeaaltobluel}#1}}\) \(\newcommand{\subheading}[1]{\large{\usebeamercolor[fg]{frametitle}\sc #1}}\) \(\newcommand{\AAccess}[1]{{\footnotesize[\href{https://libproxy.aalto.fi/login?url=#1}{Aalto lib access}]}}\) \(%\newtcbox{\mybox}[1][red]{on line,arc=0pt,outer arc=0pt,colback=#1!10!white,colframe=#1!50!black,boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt,boxrule=0pt,bottomrule=1pt,toprule=1pt}\) \(%\newtcbox{\mybox}[1][MyBoxBackground]{on line,arc=0pt,outer arc=0pt,colback=#1!10!white,colframe=#1!50!black,boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt,boxrule=0pt,bottomrule=1pt,toprule=1pt}\) \(\newtcolorbox{MyBoxTitled}[1]{colback=MyBoxBackground!100!black,colframe=MyBoxBorder!100!black,boxsep=2pt,left=0pt,right=0pt,top=2pt,bottom=0pt,%enhanced,%\) \(coltitle=red!25!black,title=#1,boxrule=1pt}\) \(\newtcolorbox{MyBox}[1][]{colback=MyBoxBackground!100!black,colframe=MyBoxBorder!100!black,boxsep=0pt,left=2pt,right=0pt,top=0pt,bottom=0pt,%enhanced,%\) \(coltitle=red!25!black,boxrule=1pt,#1}\) \(\newenvironment{EqnBox}[1]{\begin{adjustbox}{valign=t}\begin{minipage}{#1}\begin{MyBox}[colback=italyGreen!10!white,colframe=italyGreen!100!black]}{\end{MyBox}\end{minipage}\end{adjustbox}}\) \(\newenvironment{topbox}[1]{\begin{adjustbox}{valign=t}\begin{minipage}{#1}}{\end{minipage}\end{adjustbox}}\) \(\newcommand{\Blue}[1]{{\color{finnishBlue}#1}}\) \(\newcommand{\Red}[1]{{\color{italyRed}#1}}\) \(\newcommand{\RRed}{\color{italyRed}}\) \(%\newcommand{\Emph}[1]{\emph{\color{aaltoblue}#1}}\) \(\newcommand{\Emph}[1]{\emph{\usebeamercolor[fg]{structure} #1}}\) \(%\newcommand{\Emp}{\usebeamercolor[fg]{structure}}\) \(\newcommand{\Emp}{\color{italyRed}}\) \(\newcommand{\TextDef}[1]{{\bf\usebeamercolor[fg]{structure} #1}}\) \(\newcommand{\todo}[1]{\textbf{\Red{\Pointer #1}}}\) \(\newcommand{\TODO}[1]{\todo{#1}}\) \(\newcommand{\Pointer}{\raisebox{-1ex}{\huge\ding{43}}\ }\) \(%\newcommand{\Follows}{\Pointer}\) \(\newcommand{\Follows}{\color{finnishBlue}\rightsquigarrow}\) \(\newcommand{\Property}{{\color{italyGreen}\bf Property}}\) \(%\) \(% Common math definitions\) \(%\) \(\newcommand{\Set}[1]{\{#1\}}\) \(\newcommand{\Setdef}[2]{\{{#1}\mid{#2}\}}\) \(\newcommand{\PSet}[1]{\mathcal{P}(#1)}\) \(\newcommand{\Pair}[2]{(#1,#2)}\) \(\newcommand{\Card}[1]{{\vert{#1}\vert}}\) \(\newcommand{\Tuple}[1]{(#1)}\) \(\newcommand{\Seq}[1]{[#1]}\) \(\newcommand{\bbZ}{\mathbb{Z}}\) \(\newcommand{\Ints}{\mathbb{Z}}\) \(\newcommand{\Reals}{\mathbb{R}}\) \(\newcommand{\bbQ}{\mathbb{Q}}\) \(\newcommand{\Rats}{\bbQ}\) \(\newcommand{\False}{\textsf{F}}\) \(\newcommand{\True}{\textsf{T}}\) \(\newcommand{\Implies}{\rightarrow}\) \(\newcommand{\Iff}{\leftrightarrow}\) \(%\newcommand{\Implies}{\Rightarrow}\) \(%\newcommand{\Iff}{\Leftrightarrow}\) \(\newcommand{\Xor}{\oplus}\) \(\newcommand{\Equiv}{\equiv}\) \(\newcommand{\Oh}[1]{O(#1)}\) \(%\newcommand{\Theta}[1]{\Theta(#1)}\) \(\newcommand{\PHP}[2]{\mathrm{php}_{#1,#2}}\) \(\newcommand{\PH}[2]{\mathit{x}_{#1,#2}}\) \(\newcommand{\NP}{\textbf{NP}}\) \(\newcommand{\coNP}{\textbf{co-NP}}\) \(\newcommand{\bnfdef}{\mathrel{\textup{::=}}}\) \(\newcommand{\bnfor}{\mathrel{\mid}}\)
\(\newcommand{\Asgn}{\leftarrow}\) \(\newcommand{\PseudoDPLL}{\mathop{\textrm{DPLL}}}\) \(\newcommand{\PseudoCDCL}{\mathop{\textrm{CDCL}}}\) \(\newcommand{\PseudoAsgn}{\mathrel{\leftarrow}}\) \(\newcommand{\PseudoUnsat}{\mathbf{unsat}}\) \(\newcommand{\PseudoSat}{\mathbf{sat}}\) \(\newcommand{\PseudoUP}{\mathop{\textit{unit-propagate}}}\) \(\newcommand{\PseudoAnalyze}{\mathop{\textit{analyze-conflict}}}\) \(%\newcommand{\Neg}[1]{\overline{#1}}\) \(\newcommand{\Neg}[1]{\neg #1}\) \(\newcommand{\Vars}{X}\) \(\newcommand{\VarsOf}[1]{\mathop{vars}(#1)}\) \(\newcommand{\TA}{\tau}\) \(\newcommand{\Undef}{\mathit{undef}}\) \(%\newcommand{\Form}{\phi}\) \(\newcommand{\Models}{\models}\) \(\newcommand{\Trail}{\pi}\) \(\newcommand{\Anno}[2]{#1^{#2}}\) \(\newcommand{\Lit}{l}\) \(\newcommand{\Reason}{r}\) \(\newcommand{\Dec}{\textsf{dec}}\) \(\newcommand{\IG}[1]{G_{#1}}\) \(\newcommand{\IGVerts}{V}\) \(\newcommand{\IGEdges}{E}\) \(\newcommand{\IGEdge}[2]{\Pair{#1}{#2}}\) \(\newcommand{\IGConflict}{\bot}\) \(\newcommand{\Cut}{W}\) \(\newcommand{\ResOp}[1]{\mathrel{\otimes_{#1}}}\) \(\newcommand{\Res}[3]{#1 \ResOp{#3} #2}\)

Preprocessing

Unit clause propagation is relatively efficient in pruning the search space and it can be implemented to work very efficiently by using proper data structures. Thus many SAT solvers use it, and only it, as the constraint propagation technique during the search. However, there are other techniques that could prune the search space in different ways but are considered to be too slow to be used in the inner loop of the search. One alternative for applying such techniques is to use them for preprocessing the formula before the search phase. That is, given a CNF fomula \(\phi\), they are applied to construct another formula \(\phi'\) such that

  • \(\phi\) is satisfiable if and only if \(\phi'\) is,

  • ​ from a model of \(\phi'\), it is possible to reconstruct a model for \(\phi\), and

  • \(\phi'\) is (hopefully) easier to solver that \(\phi\).

Thus they can be seen as transformations that preserves satisfiability and the process of SAT solving with preprocessing is as follows:

_images/preprocessing-narrow.png

In the CDCL approach, such techniques can also be used interleaved with the search after restarts — in this case, one speaks about “inprocessing”.

In the following, we give examples of some simple preprocessing techniques. Please see, for instance,

for other techniques used in modern SAT solvers.

Pure literal elimination

A literal \(l\) occurring in a CNF formula \(\phi\) is pure if the negated literal \(\Neg{l}\) does not occur in \(\phi\). If \(l\) is pure in \(\phi\), then it is quite easy to see that if \(\TA = \Set{\Neg{l},...}\) satisfies \(\phi\), then so does \(\TA' = (\TA \setminus \Set{\Neg{l}}) \cup \Set{l}\). Therefore, if \(l\) is pure in \(\phi\), one can simplify \(\phi\) by setting \(l\) to true and removing all the clauses in which \(l\) occurs. This is called a pure literal elimination step. The resulting formula is satisfiable if and only \(\phi\) is. Observe that removing clauses can make new pure literals. The pure literal elimination process repeats the pure literal elimination step until the formula no longer has any pure literals.

Example: Pure literal elimination

Consider the formula

\[\phi = (a \lor \Neg{c} \lor \Neg{d}) \land (\Neg{b} \lor c) \land (a \lor \Neg{b}) \land (\Neg{a} \lor b \lor c) \land (\Neg{a} \lor b).\]

The literal \(\Neg{d}\) is pure in \(\phi\). After removing all the clauses with it we get

\[\phi_1 = (\Neg{b} \lor c) \land (a \lor \Neg{b}) \land (\Neg{a} \lor b \lor c) \land (\Neg{a} \lor b).\]

Now the literal \(c\) is pure and we get the simplified formula

\[\phi_2 = (a \lor \Neg{b}) \land (\Neg{a} \lor b).\]

The truth assignment \(\TA_2 = \Set{a, b}\) satisfies the simplied formula \(\phi_2\). Inserting the removed pure literals, we get the truth assignment \(\TA = \Set{a, b, c, \Neg{d}}\) that satisfies the original formula \(\phi\).

Blocked clause elimination

Blocked clause elimination [Kullmann1999] is another method for removing “redundant” clauses in a satisfiability-preserving way. We say that a clause \(C\) in a CNF formula \(\phi\) is blocked if \(C\) contains a literal \(l\) such that, for all other clauses \(D\) in \(\phi\), it holds that if \(D\) contains \(\Neg{l}\), then \(D\) also contains another literal \(p\) such that \(C\) contains \(\Neg{p}\). In such a case, we say that \(l\) blocks \(C\) in \(\phi\), and \(l\) is a blocking literal of \(C\) in \(\phi\).

Theorem

If \(C\) is blocked in \(\phi\), then \(\phi\) is satisfiable if and only if \(\phi \setminus \Set{C}\) is satisfiable.

Proof: sketch

If a truth assignment \(\TA\) satisfies \(\phi\), then \(\TA\) also satisfies \(\phi \setminus \Set{C}\) because it satisfies all the clauses in \(\phi\) and thus in \(\phi \setminus \Set{C}\).

In the other direction, assume that an assignment \(\TA\) satisfies \(\phi \setminus \Set{C}\) but not \(\phi\). Thus \(\TA\) satisifes all the clauses in \(\phi\) except \(C\). Suppose that the blocking literal of \(C\) is \(l\). Thus \(\TA\) must evaluate \(l\) to false. Let \(\TA'\) be the assignment similar to \(\TA\) except that it evaluates \(l\) to true. Now \(\TA'\) satisfies \(\phi\). We can argue this as follow. Firstly, \(\TA'\) satisfies all the clauses in \(\phi\) that do not involve \(l\) or \(\Neg{l}\) because \(\TA\) does. Secondly, \(\TA'\) obviously satisfies all the clauses in \(\phi\) that contain the literal \(l\). Finally, \(\TA'\) satisfies all the clauses \(D\) in \(\phi\) that contain the literal \(\Neg{l}\) because \(\TA'\) evaluates all the other literals except \(l\) in \(C\) to false and \(D\) must contain the negation of one of these literals by the definition of blocked clauses.

Thus one may remove a blocked clause from \(\phi\) and preserve satisfiability. Observe that if a clause contains a pure literal \(l\), then the clause is blocked because no other clause contains the negated literal \(\Neg{l}\). Thus blocked clause elimination is stronger than pure literal elimination in the sense that it can remove all the clauses that pure literal elimination can and, in many cases, many others as well.

Example

Consider the CNF formula

\[\phi = (a \lor \Neg{b}) \land (\Neg{a} \lor b) \land (a \lor b \lor c) \land (\Neg{b} \lor \Neg{c})\]

Observe that the formula has no pure literals and thus pure literal elimination cannot remove any clauses from it. However:

  1. The clause \((a \lor \Neg{b})\) is blocked because for the literal \(a\) in it, only the clause \((\Neg{a} \lor b)\) contains \(\Neg{a}\), and \((\Neg{a} \lor b)\) contains the lietral \(b\) and \((a \lor \Neg{b})\) contains the literal \(\Neg{b}\). We can thus remove the clause \((a \lor \Neg{b})\) and get the formula

    \[\phi_1 = (\Neg{a} \lor b) \land (a \lor b \lor c) \land (\Neg{b} \lor \Neg{c})\]
  2. Now the clause \((a \lor b \lor c)\) is blocked because for the literal \(b\) in it, the clause \((\Neg{b} \lor \Neg{c})\) with \(\Neg{b}\) contains \(\Neg{c}\) and \((a \lor b \lor c)\) contains its negation \(c\). Removing this blocked clause gives the formula

    \[\phi_2 = (\Neg{a} \lor b) \land (\Neg{b} \lor \Neg{c})\]
  3. The clause \((\Neg{a} \lor b)\) is now blocked due to the (pure) literal \(\Neg{a}\) and we get the formula

    \[\phi_3 = (\Neg{b} \lor \Neg{c})\]
  4. Now \((\Neg{b} \lor \Neg{c})\) is blocked because of the (pure) literal \(\Neg{c}\) and, by removing it, we get the trivially satisfiable empty formula.

As the last formula is satisfiable, the original formula is satisfiable as well.

Let’s reconstruct a satisfying truth assignment for the original formula by using the construction described in the proof above. We start from the last formula and select an arbitrary satisfying truth assignment for it; however, we also assign arbitrary values for the variables that appear in the original formula as well. Suppose that we pick the truth assignment \(\TA_1 = \Set{\Neg{a},\Neg{b},\Neg{c}}\) assigning all the variables to false.

  1. The clause \((\Neg{b} \lor \Neg{c})\) was the last one that was removed, due to the blocking literal \(\Neg{c}\). The assignment \(\TA_3\) satisfies the clause \((\Neg{b} \lor \Neg{c})\) and thus the formula \(\phi_3 = (\Neg{b} \lor \Neg{c})\) as well.

  2. The clause \((\Neg{a} \lor b)\) was then the previous one removed, due to the blocking literal \(\Neg{a}\). The assignment \(\TA_2 = \TA_3\) satisties \((\Neg{a} \lor b)\) as well and thus also the formula \(\phi_2 = (\Neg{a} \lor b) \land (\Neg{b} \lor \Neg{c})\).

  3. The clause \((a \lor b \lor c)\) was removed due to the blocking literal \(b\). The assignment \(\TA_2\) does not satisfy the clause and thus we flip the value of the blocking literal \(b\) and obtain the assignment \(\TA_1 = \Set{\Neg{a},b,\Neg{c}}\). Now \(\TA_1\) satisfies not only the clause \((a \lor b \lor c)\) but also the clauses in the formula \(\phi_2\). Therefore, it satisfies the formula \(\phi_1 = (\Neg{a} \lor b) \land (a \lor b \lor c) \land (\Neg{b} \lor \Neg{c})\) as well.

  4. Finally, \(\TA_1 = \Set{\Neg{a},b,\Neg{c}}\) does not satisfy the first removed blocked clause \((a \lor \Neg{b})\). Thus we flip the value of the blocking literal \(a\) and get the assignment \(\TA = \Set{a,b,\Neg{c}}\). This assignment satisfies the clause and all the clauses in \(\phi_1\) and thus the original formula \(\phi\) as well.