• 沒有找到結果。

An Algorithm for sat with Self-Reduction

N/A
N/A
Protected

Academic year: 2022

Share "An Algorithm for sat with Self-Reduction"

Copied!
63
0
0

加載中.... (立即查看全文)

全文

(1)

On P vs NP

(2)

Density

a

The density of language L ⊆ Σ is defined as densL(n) = |{x ∈ L : | x | ≤ n}|.

• If L = {0, 1}, then densL(n) = 2n+1 − 1.

• So the density function grows at most exponentially.

• For a unary language L ⊆ {0},

densL(n) ≤ n + 1.

– Because L ⊆ {ǫ, 0, 00, . . . ,

n

z }| {

00 · · · 0, . . .}.

(3)

Sparsity

• Sparse languages are languages with polynomially bounded density functions.

• Dense languages are languages with superpolynomial density functions.

(4)

Self-Reducibility for sat

• An algorithm exploits self-reducibility if it reduces the problem to the same problem with a smaller size.

• Let φ be a boolean expression in n variables x1, x2, . . . , xn.

• t ∈ {0, 1}j is a partial truth assignment for x1, x2, . . . , xj.

• φ[ t ] denotes the expression after substituting the truth values of t for x1, x2, . . . , x| t | in φ.

(5)

An Algorithm for sat with Self-Reduction

We call the algorithm below with empty t.

1: if | t | = n then

2: return φ[ t ];

3: else

4: return φ[ t0 ] ∨ φ[ t1 ];

5: end if

The above algorithm runs in exponential time, by visiting all the partial assignments (or nodes on a depth-n binary tree).

(6)

NP-Completeness and Density

a

Theorem 78 If a unary language U ⊆ {0} is NP-complete, then P = NP.

• Suppose there is a reduction R from sat to U .

• We shall use R to guide us in finding the truth

assignment that satisfies a given boolean expression φ with n variables if it is satisfiable.

• Specifically, we use R to prune the exponential-time exhaustive search on p. 611.

• The trick is to keep the already discovered results φ[ t ] in a table H.

(7)

1: if | t | = n then

2: return φ[ t ];

3: else

4: if (R(φ[ t ]), v) is in table H then

5: return v;

6: else

7: if φ[ t0 ] = “satisfiable” or φ[ t1 ] = “satisfiable” then

8: Insert (R(φ[ t ]), 1) into H;

9: return “satisfiable”;

10: else

11: Insert (R(φ[ t ]), 0) into H;

12: return “unsatisfiable”;

13: end if

14: end if

(8)

The Proof (continued)

• Since R is a reduction, R(φ[ t ]) = R(φ[ t ]) implies that φ[ t ] and φ[ t ] must be both satisfiable or unsatisfiable.

• R(φ[ t ]) has polynomial length ≤ p(n) because R runs in log space.

• As R maps to unary numbers, there are only polynomially many p(n) values of R(φ[ t ]).

• How many nodes of the complete binary tree (of invocations/truth assignments) need to be visited?

• If that number is a polynomial, the overall algorithm

(9)

The Proof (continued)

• A search of the table takes time O(p(n)) in the random access memory model.

• The running time is O(M p(n)), where M is the total number of invocations of the algorithm.

• The invocations of the algorithm form a binary tree of depth at most n.

(10)

The Proof (continued)

• There is a set T = {t1, t2, . . .} of invocations (partial truth assignments, i.e.) such that:

– |T | ≥ (M − 1)/(2n).

– All invocations in T are recursive (nonleaves).

– None of the elements of T is a prefix of another.

(11)

VWVWHS'HOHWH OHDYHV 0− 

QRQOHDYHVUHPDLQLQJ

QGVWHS6HOHFWDQ\

ERWWRPXQGHOHWHG LQYRFDWLRQWDQGDGG LWWR7

UGVWHS'HOHWHDOOWV DWPRVWQDQFHVWRUV SUHIL[HV IURP

IXUWKHUFRQVLGHUDWLRQ

(12)

The Proof (continued)

• All invocations t ∈ T have different R(φ[ t ]) values.

– None of s, t ∈ T is a prefix of another.

– The invocation of one started after the invocation of the other had terminated.

– If they had the same value, the one that was invoked second would have looked it up, and therefore would not be recursive, a contradiction.

• The existence of T implies that there are at least (M − 1)/(2n) different R(φ[ t ]) values in the table.

(13)

The Proof (concluded)

• We already know that there are at most p(n) such values.

• Hence (M − 1)/(2n) ≤ p(n).

• Thus M ≤ 2np(n) + 1.

• The running time is therefore O(M p(n)) = O(np2(n)).

• We comment that this theorem holds for any sparse language, not just unary ones.a

aMahaney (1980).

(14)

coNP-Completeness and Density

Theorem 79 (Fortung (1979)) If a unary language U ⊆ {0} is coNP-complete, then P = NP.

• Suppose there is a reduction R from sat complement to U .

• The rest of the proof is basically identical except that, now, we want to make sure a formula is unsatisfiable.

(15)

Oracles

a

• We will be considering TMs with access to a

“subroutine” or black box.

• This black box solves a language problem L (such as sat) in one step.

• By presenting an input x to the black box, in one step the black box returns “yes” or “no” depending on

whether x ∈ L.

• This black box is called aptly an oracle.

aTuring (1936).

(16)

Oracle Turing Machines

• A Turing machine M? with oracle is a multistring deterministic TM.

• It has a special string called the query string.

• It also has three special states:

– q? (the query state).

– qyes and qno (the answer states).

(17)

Oracle Turing Machines (concluded)

• Let A ⊆ Σ be a language.

• From q?, M? moves to either qyes or qno depending on whether the current query string is in A or not.

– This piece of information can be used by M?. – Think of A as a black box or a vendor-supplied

subroutine.

• M? is otherwise like an ordinary TM.

• MA(x) denotes the computation of M? with oracle A on input x.

(18)

Complexity Measures of Oracle TMs

• The time complexity for oracle TMs is like that for ordinary TMs.

• Nondeterministic oracle TMs are defined in the same way.

• Let C be a deterministic or nondeterministic time complexity class.

• Define CA to be the class of all languages decided (or accepted) by machines in C with access to oracle A.

(19)

An Example

• sat complement ∈ Psat.

– Reverse the answer of sat oracle A as our answer.

1: if φ ∈ A then

2: return “no”; {φ is satisfiable.}

3: else

4: return “yes”; {φ is not satisfiable.}

5: end if

• As sat complement is coNP-complete (p. 344), coNP ⊆ Psat.

(20)

The Turing Reduction

• Recall L1 is reducible to L2 if there is a logspace function R such that x ∈ L1 ⇔ R(x) ∈ L2 (p. 195).

– It is called logspace reduction, Karp reduction (p. 197), or many-one reduction.

• But the reduction in proving L ∈ CA is more general.

– An algorithm B for C with access to A exists.

– B can call A many times within the resource bound.

– We say L is Turing-reducible to A.

(21)

Two Types of Reductions

Lemma 80 If L1 is (logspace-) reducible to L2, then L1 is Turing-reducible to L2.

• Logspace reduction is more restrictive than Turing reduction.

• It is Turing reduction with only one query to L2.

• Note also that a language in L also belongs in P.

Corollary 81 If L is complete under logspace-reductions, then L is complete under Turing reductions.

(22)

Two Types of Reductions (continued)

• Turing reduction is more general than (p. 627)—and equally valid as—logspace reduction.

x R

R(x)

A? yes/no

A?

x B yes/no

• This is true even if B runs in logarithmic space and

(23)

Two Types of Reductions (continued)

• Turing reduction is more powerful than logspace reduction.

• For example, there are languages A and B such that A is Turing-reducible to B but not logspace-reducible to B.a

• However, for the class NP, no such separation has been proved.b

aLadner, Lynch, and Selman (1975).

bIf we assume NP does not have p-measure 0, then separation exists (Lutz and Mayordomo (1996)).

(24)

Two Types of Reductions (concluded)

• The Turing reduction is adaptive.

– Later queries may depend on prior queries.

• If we restrict the Turing reduction to ask all queries

before receiving any answers, the reduction is called the truth-table reduction.

• Separation results exist for the Turing and truth-table reductions given some conjectures.a

aHitchcock and Pavan (2006).

(25)

The Power of Turing Reduction

• sat complement is not likely to be reducible to sat.

– Otherwise, coNP = NP as sat complement is coNP-complete (p. 344).

• But sat complement is polynomial-time Turing-reducible to sat.

– sat complement ∈ Psat (p. 625).

– True even though the oracle sat is called only once!

– The algorithm on p. 625 is not a logspace reduction.

(26)

Computation That Counts

(27)

Counting Problems

• Counting problems are concerned with the number of solutions.

– #sat: the number of satisfying truth assignments to a boolean formula.

– #hamiltonian path: the number of Hamiltonian paths in a graph.

• They cannot be easier than their decision versions.

– The decision problem has a solution if and only if the solution count is larger than 0.

• But they can be harder than their decision versions.

(28)

Decision and Counting Problems

• FP is the set of polynomial-time computable functions f : {0, 1} → Z.

– GCD, LCM, matrix-matrix multiplication, etc.

• If #sat ∈ FP, then P = NP.

– Given boolean formula φ, calculate its number of satisfying truth assignments, k, in polynomial time.

– Declare “φ ∈ sat” if and only if k ≥ 1.

• The validity of the reverse direction is open.

(29)

A Counting Problem Harder than Its Decision Version

• Some counting problems are harder than their decision versions.

• cycle asks if a directed graph contains a cycle.

• #cycle counts the number of cycles in a directed graph.

• cycle is in P by a simple greedy algorithm.

• But #cycle is hard unless P = NP.

(30)

Counting Class #P

A function f is in #P (or f ∈ #P) if

• There exists a polynomial-time NTM M .

• M (x) has f (x) accepting paths for all inputs x.

• f (x) = number of accepting paths of M (x).

(31)

Some #P Problems

• f (φ) = number of satisfying truth assignments to φ.

– The desired NTM guesses a truth assignment T and accepts φ if and only if T |= φ.

– Hence f ∈ #P.

– f is also called #sat.

• #hamiltonian path.

• #3-coloring.

(32)

#P Completeness

• Function f is #P-complete if – f ∈ #P.

– #P ⊆ FPf.

∗ Every function in #P can be computed in

polynomial time with access to a black box or oracle for f .

– Of course, oracle f will be accessed only a polynomial number of times.

– #P is said to be polynomial-time

(33)

#sat Is #P-Complete

• First, it is in #P (p. 637).

• Let f ∈ #P compute the number of accepting paths of M .

• Cook’s theorem uses a parsimonious reduction from M on input x to an instance φ of sat (p. 247).

– Hence the number of accepting paths of M (x) equals the number of satisfying truth assignments to φ.

• Call the oracle #sat with φ to obtain the desired answer regarding f (x).

(34)

cycle cover

• A set of node-disjoint cycles that cover all nodes in a directed graph is called a cycle cover.

• There are 3 cycle covers (in red) above.

(35)

cycle cover and bipartite perfect matching

Proposition 82 cycle cover and bipartite perfect matching (p. 390) are parsimoniously reducible to each other.

• A polynomial-time algorithm creates a bipartite graph G from any directed graph G.

• Moreover, the number cycle covers for G equals the number of bipartite perfect matchings for G.

• And vice versa.

Corollary 83 cycle cover ∈ P .

(36)

Illustration of the Proof

u1

u2

u3

u4

u5

v1

v2

v3

v4

v5

w1

w4 w3

w2 w5

(37)

Permanent

• The permanent of an n × n integer matrix A is

perm(A) = X

π

Yn i=1

Ai,π(i).

– π ranges over all permutations of n elements.

• 0/1 permanent computes the permanent of a 0/1 (binary) matrix.

– The permanent of a binary matrix is at most n!.

• Simpler than determinant (5) on p. 392: no signs.

• But, surprisingly, much harder to compute than

(38)

Permanent and Counting Perfect Matchings

• bipartite perfect matching is related to determinant (p. 393).

• #bipartite perfect matching is related to permanent.

Proposition 84 0/1 permanent and bipartite perfect matching are parsimoniously reducible to each other.

(39)

The Proof

• Given a bipartite graph G, construct an n × n binary matrix A.

– The (i, j)th entry Aij is 1 if (i, j) ∈ E and 0 otherwise.

• Then perm(A) = number of perfect matchings in G.

(40)

Illustration of the Proof Based on p. 642 (Left)

A =









0 0 1 1 0

0 1 0 0 0

1 0 0 0 1

1 0 1 1 0

1 0 0 0 1









 .

• perm(A) = 4.

• The permutation corresponding to the perfect matching

(41)

Permanent and Counting Cycle Covers

Proposition 85 0/1 permanent and cycle cover are parsimoniously reducible to each other.

• Let A be the adjacency matrix of the graph on p. 642 (right).

• Then perm(A) = number of cycle covers.

(42)

Three Parsimoniously Equivalent Problems

From Propositions 82 (p. 641) and 84 (p. 644), we summarize:

Lemma 86 0/1 permanent, bipartite perfect matching, and cycle cover are parsimoniously equivalent.

We will show that the counting versions of all three problems are in fact #P-complete.

(43)

weighted cycle cover

• Consider a directed graph G with integer weights on the edges.

• The weight of a cycle cover is the product of its edge weights.

• The cycle count of G is sum of the weights of all cycle covers.

– Let A be G’s adjacency matrix but Aij = wi if the edge (i, j) has weight wi.

– Then perm(A) = G’s cycle count (same proof as Proposition 85 on p. 647).

(44)

An Example

a

4

4

4

2

3

4

4

4

2

3 4

4

4

2

3

There are 3 cycle covers, and the cycle count is

(4 · 1 · 1) · (1) + (1 · 1) · (2 · 3) + (4 · 2 · 1 · 1) = 18.

(45)

Three #P-Complete Counting Problems

Theorem 87 (Valiant (1979)) 0/1 permanent,

#bipartite perfect matching, and #cycle cover are

#P-complete.

• By Lemma 86 (p. 648), it suffices to prove that #cycle cover is #P-complete.

• #sat is #P-complete (p. 639).

• #3sat is #P-complete because it and #sat are parsimoniously equivalent (p. 256).

• We shall prove that #3sat is polynomial-time Turing-reducible to #cycle cover.

(46)

The Proof (continued)

• Let φ be the given 3sat formula.

– It contains n variables and m clauses (hence 3m literals).

– It has #φ satisfying truth assignments.

• First we construct a weighted directed graph H with cycle count

#H = 43m × #φ.

• Then we construct an unweighted directed graph G.

• We make sure #H (hence #φ) is polynomial-time

(47)

The Proof: the Clause Gadget (continued)

• Each clause is associated with a clause gadget.

a

b

c

• Each edge has weight 1 unless stated otherwise.

• Each bold edge corresponds to one literal in the clause.

• There are not parallel lines as bold edges are schematic

(48)

The Proof: the Clause Gadget (continued)

• Following a bold edge means making the literal false (0).

• A cycle cover cannot select all 3 bold edges.

– The interior node would be missing.

• Every proper nonempty subset of bold edges corresponds to a unique cycle cover of weight 1 (see next page).

(49)

The Proof: the Clause Gadget (continued)

7 possible cycle covers, one for each satisfying assignment:

(1) a = 0, b = 0, c = 1, (2) a = 0, b = 1, c = 0, etc.

(1) (2) (3) (4) (5) (6) (7)

(50)

The Proof: the XOR Gadget (continued)

- 1

- 1

- 1

2

3

u

v'

u'

v

(51)

The Proof: Properties of the XOR Gadget (continued)

• The XOR gadget schema:

+

u u'

v' v

• At most one of the 2 schematic edges will be included in a cycle cover.

• There will be 3m XOR gadgets, one for each literal.

(52)

The Proof: Properties of the XOR Gadget (continued)

Total weight of −1 − 2 + 6 − 3 = 0 for cycle covers not entering or leaving it.

- 1

u

v'

u'

v - 1

2

u

v'

u'

v

- 1

u u'

2

u u'

(53)

The Proof: Properties of the XOR Gadget (continued)

• Total weight of −1 + 1 − 6 + 2 + 3 + 1 = 0 for cycle covers entering at u and leaving at v.a

- 1

u

v'

u'

v

u

v'

u'

v

- 1

2 3

u

v'

u'

v

2

u

v'

u'

v 3

u

v'

u'

v

u

v'

u'

v

• Same for cycle covers entering at v and leaving at u.

aCorrected by Mr. Yu-Tshung Dai (B91201046) and Mr. Che-Wei

(54)

The Proof: Properties of the XOR Gadget (continued)

• Total weight of 1 + 2 + 2 − 1 + 1 − 1 = 4 for cycle covers entering at u and leaving at u.

- 1

u

v'

u'

v

u

v'

u'

v

- 1

u

v'

u'

v

2

u

v'

u'

v

- 1

u

v'

u'

v

- 1 - 1

- 1

2

u

v'

u'

v

(55)

The Proof: Summary (continued)

• Cycle covers not entering all of the XOR gadgets contribute 0 to the cycle count.

– Let x denote an XOR gadget not entered for a cycle cover c.

– Now, the said cycle covers’ total contribution is

= X

cycle cover c for H

weight(c)

= X

cycle cover c for H − x

weight(c) X

cycle cover c for x

weight(x)

= X

cycle cover c for H − x

weight(c) · 0

= 0.

(56)

The Proof: Summary (continued)

• Cycle covers entering any of the XOR gadgets and leaving illegally contribute 0 to the cycle count.

• For every XOR gadget entered and exited legally, the total weight of a cycle cover is multiplied by 4.

– With an XOR gadget x entered and exited legally fixed,

contributions of such cycle covers to the cycle count X

cycle cover c for H

weight(c)

= X

cycle cover c for H − x

weight(c) X

cycle cover c for x

weight(x)

(57)

The Proof: Summary (continued)

• Hereafter we consider only cycle covers which enter every XOR gadget and leaves it legally.

– Only these cycle covers contribute nonzero weights to the cycle count.

• They are said to respect the XOR gadgets.

(58)

The Proof: the Choice Gadget (continued)

• One choice gadget (a schema) for each variable.

x x

• It gives the truth assignment for the variable.

(59)

Schema for (w ∨ x ∨ ¯ y ) ∧ (¯ x ∨ ¯ y ∨ ¯ z )

w w x x y y z z

w

x

y x

y

z

+ + + + + +

(60)

Full Graph (w ∨ x ∨ ¯ y) ∧ (¯ x ∨ ¯ y ∨ ¯ z )

w w x x y y z z

w

x

y x

y z

(61)

The Proof: a Key Observation (continued)

Each satisfying truth assignment to φ corresponds to a schematic cycle cover that respects the XOR gadgets.

(62)

w = 1, x = 0, y = 0, z = 1 ⇔ One Cycle Cover

w w x x y y z z

w

x

y x

y

z

+ + + + + +

(63)

The Proof: a Key Corollary (continued)

• Recall that there are 3m XOR gadgets.

• Each satisfying truth assignment to φ contributes 43m to the cycle count #H.

• Hence

#H = 43m × #φ, as desired.

參考文獻

相關文件

method void setInt(int j) function char backSpace() function char doubleQuote() function char newLine() }. Class

An n×n square is called an m–binary latin square if each row and column of it filled with exactly m “1”s and (n–m) “0”s. We are going to study the following question: Find

We have derived Whitham equations to the SGN model and show that they are strictly hyperbolic for arbitrary wave amplitudes, i.e., the corresponding periodic wave trains

In particular, we present a linear-time algorithm for the k-tuple total domination problem for graphs in which each block is a clique, a cycle or a complete bipartite graph,

Then, it is easy to see that there are 9 problems for which the iterative numbers of the algorithm using ψ α,θ,p in the case of θ = 1 and p = 3 are less than the one of the

The case where all the ρ s are equal to identity shows that this is not true in general (in this case the irreducible representations are lines, and we have an infinity of ways

We will give a quasi-spectral characterization of a connected bipartite weighted 2-punctually distance-regular graph whose halved graphs are distance-regular.. In the case the

Theorem 5.6.1 The qd-algorithm converges for irreducible, symmetric positive definite tridiagonal matrices.. It is necessary to show that q i are in