• Keine Ergebnisse gefunden

The SAT Problem and Selected Variants

3.3 Investigating the Algorithmic Use of Grid-Homogeneous Graphs

3.3.2 The SAT Problem and Selected Variants

Consider a setU ={x1, x2, . . . , xn} of nBoolean variables, i. e.,xi ∈ {False,True} for alli∈[n]. A Boolean formula over U is built from the variables inU, parenthesis, and the following operators, wherex andy denote Boolean variables:

conjunction ∧, that is,xyis true if xandy are both true,

disjunction ∨, that is,xy is true if at least one ofxandy is true, and

negation x, that is, ¯¯ xis true if xis false and vice versa.

A Boolean formula φoverU is said to be satisfiableif there is an assignment of TrueandFalseto the variables inU such thatφevaluates toTrue. For example,

φ1:= (x1x¯1x2x¯2)∧(¯x1x2x3)∧(¯x3)

is a Boolean formula over the set{x1, x2, x3}. When settingx1=True, x2=False, andx3=False, then

φ1 = (True∨False∨False∨True) ∧ (False∨False∨False) ∧ (True)

= True∧False∧True = False. Settingx1=True,x2=True, andx3=Falsegives

φ1 = (True∨False∨True∨False) ∧ (False∨True∨False) ∧ (True)

= True∧True∧True = True,

which shows that φ1 is satisfiable. The famous NP-completeSAT Problem is the following.

SAT Problem:

Input: a Boolean formulaφ.

Question: Isφsatisfiable?

Theorem 3.32 (Cook 1971, see Problem LO1 in [GJ79]).

The SAT Problem is NP-complete.

Aliteral is a variable or the negation of a variable. Aclauseis a disjunction of literals or a single literal.

A Boolean formula is said to be inconjunctive normal form if it is a conjunction of clauses. For example, the Boolean formula φ1 is in conjunctive normal form. It has three clauses, namely x1x¯1x2x¯2,

¯

x1x2x3, and ¯x3. Here, only Boolean formulas in conjunctive normal form are considered. Note that a Boolean formulaφin conjunctive normal form is completely described by its set of variablesU and its set of clausesC. Therefore, we slightly abuse notation and write φ= (U,C) in the following. A Boolean formulaφ= (U,C) in conjunctive normal form is a 3-SAT-formula if each clause inC uses at most three literals. The Boolean formulaφ1is not a 3-SAT formula as the first clause uses four literals. The Boolean formula

φ2:= (¯x1x2x3)∧(¯x1x¯3x4)∧(x1x2)∧(x2x¯3x¯4)

is a 3-SAT-formula. TheSAT Problem remains NP-complete when restricted to 3-SAT-formulas.

3-SAT Problem:

Input: a 3-SAT-formulaφ= (U,C).

Question: Isφsatisfiable?

Theorem 3.33 (Karp 1972, see Problem L02 in [GJ79]).

The 3-SAT Problem is NP-complete.

x1 x2 x3 x4

C1

C2

C3

C4

a)GraphGφ2.

C2

C4

x1 x2 x3

C1 C2 C3

b)GraphGφ4.

Figure 3.14:Examples of planar and non-planar 3-SAT formulas. Vertices representing variables are colored light blue, vertices representing clauses are colored dark blue.

Variables and negations of variables are calledpositive literalsandnegative literals, respectively. Similarly, a clause ispositiveif it only contains positive literals and it isnegative if it only contains negative literals.

A clause that is either positive or negative is called monotone and a Boolean formula in conjunctive normal form is calledmonotoneif each of its clauses is monotone. Neitherφ1norφ2is monotone, because they both contain the clause ¯x1x2x3, which is not monotone. The formula

φ3= (x1x2x3)∧(¯x2x¯3x¯4)∧(x3x4x5).

is an example of a monotone formula with two positive clauses and one negative clause. The SAT Problemand the3-SAT Problemboth remain NP-complete when restricted to monotone formulas.

Monotone SAT Problem:

Input: a SAT-formulaφin conjunctive normal form such thatφis monotone.

Question: Isφsatisfiable?

Monotone 3-SAT Problem:

Input: a monotone 3-SAT-formulaφ= (U,C).

Question: Isφsatisfiable?

Theorem 3.34 (Gold 1978 [Gol78], see Problem LO2 in [GJ79]).

The Monotone SAT Problemand the Monotone 3-SAT Problemare NP-complete.

Next, the concept of planarity is introduced. Letφ= (U,C) be a Boolean formula in conjunctive normal form. Consider the bipartite graphGφ on the color classesU andC, where two verticesx∈ U andC∈ C are adjacent if and only if the clauseC usesxor its negation ¯x. IfGφ is a planar graph, then φis called planar. Figure3.14a)shows thatφ2 is planar. Not every 3-SAT formula is planar, as for example the associated graph of

φ4= (¯x1x2x3)∧(x1x¯2x3)∧(x1x2x¯3)

is isomorphic to the complete bipartite graphK3,3, see Figure3.14b), andK3,3is known to be non-planar, see Corollary 4.2.11 in [Die12]. When the3-SAT Problemis restricted to planar formulas, it remains NP-complete.

x1 x2 x3 x4

C1= (¯x1x2x3) C2= (¯x1x¯3x4)

C3= (x1x2) C4= (x2¯x3x¯4)

Figure 3.15:A rectilinear representation ofφ2. Similarly to Figure3.14, rectangles representing variables are colored light blue and rectangles representing clauses are colored dark blue.

Planar 3-SAT Problem:

Input: a planar 3-SAT formulaφ= (U,C).

Question: Isφsatisfiable?

Theorem 3.35 (Lichtenstein 1982 [Lic82], or see Problem LO1 in [GJ79]).

The Planar 3-SAT Problem is NP-complete.

Consider a Boolean formulaφ= (U,C) in conjunctive normal form and a drawing, that representsφ, with the following properties: Each clause in C and each variable inU are represented by a rectangle, whose sides are horizontal and vertical lines. All rectangles corresponding to variables inU are drawn on a horizontal line. A rectangle corresponding to a variablex∈ U is joined to a rectangle corresponding to a clauseC∈ Cwith a vertical line segment if and only ifCuses the literalxor ¯x. None of these vertical line segments intersects a rectangle and only the rectangles corresponding toC andxare touched. A drawing with these properties is called a rectilinear representation ofφ. See also the example in Figure3.15.

In [KR92], Knuth and Raghunathan argue that it follows from the reduction in [Lic82] that every planar 3-SAT formula has a rectilinear representation, where planar is defined as in [Lic82]. Consider a Boolean formulaφ= (U,C) withU ={x1, x2, . . . , xn}and the graphGφas defined above. In [Lic82], the graphG0φthat is obtained fromGφ by adding the edges{xi, xi+1}for alli∈[n−1] and the edge{xn, x1} is considered, and the Boolean formula φis called planar if and only if G0φ is planar. Note that this definition is more restrictive than the one above. It is not hard to see that when the graphG0φ is planar, then there is a rectilinear representation ofφ.

Next, the properties of rectilinear representations and monotone formulas are combined. Consider a planar 3-SAT-formula φthat is monotone. A monotone rectilinear representation of φ is a rectilinear

x1 x2 x3 x4 x5

C1= (x1x2x3)

C2= (¯x2x¯3¯x4)

C3= (x3x4x5)

Figure 3.16:A monotone rectilinear representation ofφ3.

representation ofφsuch that all positive clauses are drawn above the variables and all negative clauses are drawn below the variables, where each variable and each clause were identified with the rectangle representing it. Figure3.16shows a monotone rectilinear representation ofφ3. Observe that not every planar and monotone Boolean formula automatically allows a monotone rectilinear representation, even if the more restricted version of planarity as in [Lic82] is required. For example,

φ5= (x1x2x3)∧(x2x3x4)∧(x3x4x5)

is monotone and planar, even when the edges{xi, xi+1}fori∈[4] and{x5, x1}are added. Note thatGφ3

andGφ5 are identical, but the requirements for a monotone rectilinear representation are different as the second clause ofφ3 is negative and the second clause ofφ5 is positive. So the second clause ofφ3andφ5

need to be drawn below and above the variables, respectively. It is not hard to see thatφ5 does not allow a monotone rectilinear representation. The3-SAT Problemremains NP-complete when restricted to instances allowing a monotone rectilinear representation.

Planar Monotone 3-SAT Problem:

Input: a monotone rectilinear representation of a 3-SAT formulaφ= (U,C).

Question: Isφsatisfiable?

Theorem 3.36 (de Berg and Khosravi 2010 [BK10]).

The Planar Monotone 3-SAT Problemis NP-complete.

In the remaining section, when a monotone rectilinear representation of a 3-SAT formula is considered, clauses and variables are identified with the rectangles representing them in the considered monotone rectilinear representation. The reductions in Section 3.3.3 and Section 3.3.4 are from the Planar Monotone 3-SAT Problem and use the following notation. Consider an instance of the Planar Monotone 3-SAT Problem, i. e., a monotone rectilinear representationRof a 3-SAT formulaφ= (U,C).

Forx∈ U, denote byL+(x) andL(x) the set of vertical lines inRthat joinxto a positive clause inC and a negative clause in C, respectively. Moreover, for eachx∈ U, define deg+(x) := |L+(x)| as well as deg(x) :=|L(x)|, i. e., the number of times that xappears as a positive and as a negative literal inφ, respectively. If there are two lines joining a variablexto a clauseC, i. e., the clauseC contains the variablextwice, thenC contributes 2 to deg+(x) or deg(x) depending on whetherC is a positive or a negative clause. Due to technical reasons, some further assumptions onφandRare needed and discussed now. First, one may assume that, for eachx∈ U, there is a clause in whichxappears as a positive literal and there is a clause in whichxappears as a negative literal, without loss of generality. Indeed, assume that there is a variablex∈ U such thatxappears only as a positive literal inφ. The case whenxappears only as a negative literal inφis analogous. Letφ0 be the formula obtained fromφby removing all clauses that contain x. It is easy to see that φ0 is satisfiable if and only if φ is satisfiable as every satisfying assignment ofφ0 can be extended to a satisfying assignment ofφby settingxtoTrue. Furthermore,φ0 is monotone and planar, and a monotone rectilinear representation ofφ0 can be easily obtained fromR. Second, one may assume that every clause inCcontains exactly three literals, as otherwise literals can be repeated. For example if there is a clauseC= (¯x) inC, it can be replaced byC0= (¯xx¯∨x) and¯ two extra vertical lines joiningxandC are added in R. So, one may also assume that, inR, each clause touches exactly three vertical lines that join the clause to variables. Third, one may assume that, inR, each variablex∈ U is split into a positive and a negative half, where the positive half is drawn on the left and the negative half is drawn on the right, such that all vertical lines inL+(x) touchxat the positive

C2= (x4x5x5)

C4= (¯x5x¯5¯x5)

x1 x2 x3 x4 x5

C1= (x1x2x5)

C2= (x4x5)

C3

C3= (¯x3x¯4) C4= (¯x2x¯3¯x4)

C5= (¯x1¯x2x¯4)

C6= (¯x5)

a)Drawing ofφ6.

x1 x¯1 x2 x¯2 x4 ¯x4 x5 x¯5

C1= (x1x2x5)

C2 C2= (x4x5x5)

C3= (¯x1x¯2x¯4) C4 C4= (¯x5¯x5x¯5)

b)Drawing ofφ006.

Figure 3.17:Modifications on the monotone rectilinear representation to satisfy the extra assumptions.

half and all vertical lines inL(x) touchxat the negative half. For an example, consider φ6:= (x1x2x5)∧(x4x5)∧(¯x3x¯4)∧(¯x2x¯3x¯4)∧(¯x1x¯2x¯4)∧(¯x5).

The Boolean formulaφ6 contains the variable x3 only as a negative literal, so the problem of deciding whether φ6is satisfiable can be simplified to deciding whether

φ06:= (x1x2x5)∧(x4x5)∧(¯x1x¯2x¯4)∧(¯x5)

is satisfiable. To meet the requirement that each clause contains exactly three literals, let φ006:= (x1x2x5)∧(x4x5x5)∧(¯x1x¯2x¯4)∧(¯x5∨¯x5x¯5),

which is satisfiable if and only if φ06is satisfiable. Figure3.17shows a monotone rectilinear representation ofφ6as well as a monotone rectilinear representation of φ006 that meets the extra requirement on dividing each variable into a positive and a negative half.