COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

23
COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS

Transcript of COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Page 1: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

COMPLEXITY THEORYCSci 5403

LECTURE XVI:COUNTING PROBLEMS

ANDRANDOMIZED REDUCTIONS

Page 2: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Definition. #P is the class of functions ƒ such thatthere exists a polytime TM M where

ƒ(x) = |{ y : M(x,y) accepts }|

Example. #SAT() = # satisfying assignments to .

Definition. ƒ is #P-hard iff #P µ FPƒ.

Definition. ƒ is #P-complete iff #P µ FPƒ and ƒ 2 #P.

Theorem. (Shocking!) #SAT is #P-complete.

Page 3: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Theorem. The following counting problems are parsimoniously equivalent:

#PERFECT BPMATCH:Given: bipartite graph G = (U,V,E) where E µ U £ VOutput: # of perfect matchings in G.#CYCLE COVER: Given: directed graph GOutput: the number of cycle covers in G.

MATRIX PERMANENT:Given: n£n 0-1 matrix AOutput: the permanent of A, i n ai,(i).

●● ● ●

Page 4: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Theorem. PERMANENT is #P-Complete.

Proof.

We show that #3SAT µ FP#CYCLE COVER.

The reduction has 3 gadget types: choice, clause, and XOR.

Page 5: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

CLAUSE GADGETS

For each clause (x Ç y Ç z) include the subgraph:

No cycle cover can include all three outer edges.

For each subset of the outer edges, exactly onecycle cover includes that subset.

x y

z

Page 6: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

CHOICE GADGETS

For each variable xi include the subgraph:

There are exactly two cycle covers, one per outeredge. They correspond to the choices of xi.

Page 7: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

XOR GADGETS

A clause gadget outer edge is connected to itschoice gadget outer edge by an XOR gadget:

An XOR gadget is a clever device that forcesany cycle cover to use exactly one of the edges.

If P NP, can we implement an XOR gadget?

Page 8: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

XOR GADGETS II

A clause gadget outer edge is connected to itschoice gadget outer edge by an XOR gadget:

multiplies the number of cycle covers usingexactly one of the edges by 4, and the numberusing both edges by M.

#SAT(ϕ) = #CYCLE-COVER(G) mod M / 4m

Page 9: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

WEIGHTED XOR GADGETS

For a weighted graph G and cycle cover C, the weight of C is the product of the edge weights.

⊕1 1’

2’ 2

1

2’

1’

2

a

b

d

c-1

-1 23

-1

Define #WCYCLE-COVER(G) = ∑C weight(C).

Page 10: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Removing negative weights:

Let m = # of XOR gadgets in the resulting graph.

Each satisfying assignment corresponds to 4m total weight, and there are ≤ 2m assignments.

So the total weight is ≤ 23m. Set M = 24m+1. Then 24m ≡ -1 (mod M).

Replace each -1 with 24m and take the result mod M.

= 3 × # clauses

Page 11: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Simulating weights:

2u v

3u v

24m

u v

u v

u v

…u v

4m

Page 12: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Recap: We showed how to transform a 3cnf φinto a graph G such that

#3SAT(φ) = (#CYCLE-COVER(G) mod 24m+1)/4m

Thus #3SAT FP∈ #CYCLE-COVER.

Since #3SAT is #P-Complete, so is #CYCLE-COVER.

Also #P-complete: PERMANENT, #PERFECT BPMATCH, #IMPERFECT BPMATCH, and #MONOTONE 2SAT

Page 13: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

TODA’S THEOREM

Theorem. PH P⊆ #P.

Proof Outline.

1. Define the class⊕P, prove the Valiant-Vazirani theorem: NP RP⊆ ⊕P.

2. Extend the proof idea to show that PH RP⊆ ⊕P.

3. Use a #P oracle to derandomize. (Not hard)

Page 14: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Two related problems, and a complexity class:

Definition. USAT is the promise problem given by:USATYES = { φ : !x . ∃ φ(x) = 1 }USATNO = { φ : x. ∀ φ(x) = 0 }

“There is exactly one x”

Definition. ©SAT = { Á | ©x Á(x) = 1 }

Definition. L 2 ©P iff 9 polytime NTM M such that x 2 L , ©y M(x,y) = 1.

Proposition. ©P P⊆ #P. Proposition. ©SAT is ©P-Complete.

Proposition. USATYES ⊂ ©SAT.

Page 15: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Theorem (Valiant-Vazirani). SAT RP∈ USAT.(Note we then have NP RP⊆ ⊕P.)

Proof.

We show how to transform a formula Á a à where:

Á 2 3SAT ) Pr[Ã 2 USAT] ¸ 1/8nÁ 3SAT ) Pr[Ã 2 USAT] = 0

Querying the USAT oracle on the resulting formula and returning its result gives the RP algorithm.

Given Á how do we construct Ã?

Page 16: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Lemma. Let H be a pairwise-independent family of hash functions h : {0,1}n → {0,1}k and S {0,1}⊆ n, with 2k-2 ≤ |S| ≤ 2k-1. Then

Prh H∈ [ !x S . h(x)=0∃ ∈ k] ≥ 1/8.

Proof. For any fixed x≠x’ S, we have: ∈Pr[h(x) = 0] = 1/2k and Pr[h(x)=0 h(x’)=0] = 1/2∧ 2k.

Thus Pr[ x≠x’. h(x)=0 h(x’)=0] ≤ |S|∃ ∧ 2/22k+1

And Pr[ x.h(x)=0] ≥ |S|/2∃ k - |S|2/22k+1

So Pr[ !x S . h(x)=0] ≥ |S|/2∃ ∈ k - |S|2/22k ≥ 1/8.

“h isolates x”

Page 17: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Lemma. Let x1≠x2 {0,1}∈ n, y1,y2 {0,1}∈ k and pickM ∈R {0,1}n×k, z∈R {0,1}k. Then

Pr[Mx1+z=y1 mod 2 Mx∧ 2+z=y2 mod 2] = 1/22k. Proof. Let x1 and x2 be different in row i. Then Pr[Mx1+z=y1 Mx∧ 2+z=y2] = Pr[Mi+z=y1’ z=y∧ 2’]=1/22k.

Lemma. Given M,z, there is a cnf ÂM,z(x,y) of size O(kn) that has one satisfying assignment for each x such Mx+z = 0 mod 2.

Proof. Convert a “tree of XORs” circuit to a CNF.

Page 18: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Returning to Valiant-Vazirani, the RP algorithm is:1.Pick k∈R {2,…,n+1}.2.Pick M,z ∈R {0,1}(n+1)×k.3.Accept iff Á Æ ÂM,z(x,y) USAT.∈

If Á is unsatisfiable, we never accept.

If Á is satisfiable, then let S = {x : Á(x)=1}; forsome k {2,…,n+1}, 2∈ k-2 ≤ |S| ≤ 2k-1. We pick thisk with probability 1/n.

If we pick the right k, we have probability at least 1/8 of picking M,z that isolate a satisfying x. Then Á Æ ÂM,z(x,y) has one satisfying assignment.

Page 19: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Theorem. PH RP⊆ ⊕P.

Proof.

Recall that QSATi = {Á | 9x18x2…Qixi.Á(x1,x2,…,xi) } is Σi complete. We will give a randomized algorithm to convert Á into a formula à such that

Á 2 QSATi ) Pr[Ã 2 ©SAT ] ¸ 1-δ Á QSAT∉ i ) Pr[Ã 2 ©SAT ] = 0

The algorithm works in i stages; each stage removes a quantifier correctly with probability at least 1-δ/i.

Page 20: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Suppose we are at stage j and have the formula

©z 9xj 8xj+1 ... Qixi Á.

This is wlog, since we can replace x.P(x) by ∀¬ x.¬P(x). We produce a formula ∃ Ã such that

©z,x8yj+19yj+2...Qiyi.Ã , ©z9xj8xj+1...Qixi.Á

Idea: the Valiant-Vazirani reduction takes sentence σ = 9x.Á(x) and outputs a sentence τ = ©x,y Ã(x,y) that is equivalent with probability at least 1/8n.

repeat m = 8n ln(2|z| × i/δ) times to get τ1…τm. Then

Pr[ k. τ∃ k(z) ⇔ σ(z)] ≥ 1 – δ/i2|z|.

Page 21: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Since for any z, Pr[(∨i τi(z)) ≠ σ(z)] ≤ δ/i2|z|, we havePr[⊕z(∨i τi(z)) ≠ ⊕zσ(z)] ≤ δ/i.

To finish the proof, we need to convert a sentence

⊕z(τ1(z) τ∨ 2(z) … τ∨ ∨ m(z))

where each τi has the form ⊕x χ(x) y.∧∀ Á(x,y,z) ,

to an equivalent prenex form, ⊕x,z y.∀ ϑ(x,y,z)

Since ⊕xχ(x) y.∧∀ Á(x,y,z) ≡ ⊕x y.∀ χ(x)∧Á(x,y,z),we only consider the form

⊕z ((⊕xα(z,x)) (∨ ⊕xβ(z,x))

Page 22: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

Lemma. For any formulae α(x),β(x), there exist formulae (α×β) and (α+β) such that

(⊕xα(x)) (∧ ⊕xβ(x)) ≡ ⊕x,y (α×β)(x,y) (⊕xα(x)) (∨ ⊕xβ(x)) ≡ ⊕x,y ((α+1)×(β+1)+1)(x,y)

For a partially quantified formula γ, let #γ be the number of assignments to free variables where γ=1.

Proof. Let (α×β)(x,y) = (α(x) β(y)), ∧(α+β)(x,y) = (y=0 α(x)) (y=1 β(x))∧ ∨ ∧

Then #(α×β) = #α #β and #(α+β) = #α + #β.⋅

Thus the final expression is ⊕z⊕(x₁…xm)((τ1+1)×(τ2+1)×…×(τm+1) + 1)(x1,…,xm)

Page 23: COMPLEXITY THEORY CSci 5403 LECTURE XVI: COUNTING PROBLEMS AND RANDOMIZED REDUCTIONS.

CS5403.info