CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is...

50
CS151 Complexity Theory Lecture 12 May 6, 2015

Transcript of CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is...

Page 1: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

CS151Complexity Theory

Lecture 12

May 6, 2015

Page 2: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 2

QSAT is PSPACE-complete

Theorem: QSAT is PSPACE-complete.• Proof: 8x19x28x3 … Qxn φ(x1, x2, …, xn)?

– in PSPACE: 9x18x29x3 … Qxn φ(x1, x2, …, xn)?– “9x1”: for each x1, recursively solve

8x29x3 … Qxn φ(x1, x2, …, xn)?• if encounter “yes”, return “yes”

– “8x1”: for each x1, recursively solve 9x28x3 … Qxn φ(x1, x2, …, xn)?

• if encounter “no”, return “no”– base case: evaluating a 3-CNF expression– poly(n) recursion depth– poly(n) bits of state at each level

Page 3: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 3

QSAT is PSPACE-complete

– given TM M deciding L PSPACE; input x

– 2nk possible configurations– single START configuration– assume single ACCEPT configuration

– define:REACH(X, Y, i) configuration Y reachable from

configuration X in at most 2i steps.

Page 4: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 4

QSAT is PSPACE-complete

REACH(X, Y, i) configuration Y reachable from configuration X in at most 2i steps.

– Goal: produce 3-CNF φ(w1,w2,w3,…,wm) such that

9w18w2…Qwm φ(w1,…,wm)

REACH(START, ACCEPT, nk)

Page 5: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 5

QSAT is PSPACE-complete

– for i = 0, 1, … nk produce quantified Boolean expressions ψi(A, B, W)

9w18w2… ψi(A, B, W) REACH(A, B, i)

– convert ψnk to 3-CNF φ • add variables V

•9w18w2… 9V φ(A, B, W, V) REACH(A, B, nk)

– hardwire A = START, B = ACCEPT

9w18w2… 9V φ(W, V) x L

Page 6: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 6

QSAT is PSPACE-complete

– ψo(A, B) = true iff • A = B or • A yields B in one step of M

STEP STEP STEP STEP

config. A

config. B

Boolean expression of size O(nk)

Page 7: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 7

QSAT is PSPACE-complete

– Key observation #1: REACH(A, B, i+1)

9Z [REACH(A, Z, i) REACH(Z, B, i)]

– cannot define ψi+1(A, B) to be

9Z [ψi(A, Z) ψi(Z, B)] (why?)

Page 8: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 8

QSAT is PSPACE-complete

– Key idea #2: use quantifiers

– couldn’t do ψi+1(A, B) = 9Z [ψi(A, Z) ψi(Z, B)]

– define ψi+1(A, B) to be

9Z8X8Y [((X=AY=Z)(X=ZY=B)) ψi(X, Y)]– ψi(X, Y) is preceded by quantifiers

– move to front (they don’t involve X,Y,Z,A,B)

Page 9: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 9

QSAT is PSPACE-complete

ψo(A, B) = true iff A = B or A yields B in 1 step

ψi+1(A, B) =

9Z8X8Y[((X=AY=Z)(X=ZY=B)) ψi(X, Y)]

– |ψ0| = O(nk)– |ψi+1| = O(nk) + |ψi|

– total size of ψnk is O(nk)2 = poly(n)– logspace reduction

Page 10: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 10

PH collapse

Theorem: if Σi = Πi then for all j > i

Σj = Πj = Δj = Σi

“the polynomial hierarchy collapses

to the i-th level”

• Proof: – sufficient to show Σi = Σi+1

– then Σi+1= Σi = Πi = Πi+1; apply theorem again

P

NP coNP

Σ3 Π3

Δ3

PH

Σ2 Π2

Δ2

Page 11: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 11

PH collapse

– recall: L Σi+1 iff expressible as

L = { x | 9 y (x, y) R }

where R Πi

– since Πi = Σi, R expressible as

R = { (x,y) | 9 z ((x, y), z) R’ }

where R’ Πi-1

– together: L = { x | 9 (y, z) (x, (y, z)) R’}

– conclude L Σi

Page 12: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 12

Oracles vs. Algorithms

A point to ponder:

• given poly-time algorithm for SAT– can you solve MIN CIRCUIT efficiently?– what other problems? Entire complexity

classes?

• given SAT oracle– same input/output behavior– can you solve MIN CIRCUIT efficiently?

Page 13: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 13

Natural complete problems

• We now have versions of SAT complete for levels in PH, PSPACE

• Natural complete problems?– PSPACE: games

– PH: almost all natural problems lie in the second and third level

Page 14: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 14

Natural complete problems in PH

– MIN CIRCUIT• good candidate to be 2-complete, still open

– MIN DNF: given DNF φ, integer k; is there a DNF φ’ of size at most k computing same function φ does?

Theorem (U): MIN DNF is Σ2-complete.

Page 15: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 15

Natural complete problems in PSPACE

• General phenomenon: many 2-player games are PSPACE-complete.

– 2 players I, II– alternate pick-

ing edges– lose when no

unvisited choice

pasadena

athensauckland

san francisco

oakland

davis

• GEOGRAPHY = {(G, s) : G is a directed graph and player I can win from node s}

Page 16: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 16

Natural complete problems in PSPACE

Theorem: GEOGRAPHY is PSPACE-complete.

Proof:– in PSPACE

• easily expressed with alternating quantifiers

– PSPACE-hard• reduction from QSAT

Page 17: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 17

Natural complete problems in PSPACE

9x18x29x3…(x1x2x3)(x3x1)…(x1x2)

true false

true false

true false

x1

x2

x3

I

II

II

II

II

I

I

I

I

alternately pick truth assignment

pick a clause

I

II

I pick a true literal?

Page 18: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 18

Karp-Lipton

• we know that P = NP implies SAT has polynomial-size circuits.– (showing SAT does not have poly-size circuits

is one route to proving P ≠ NP)

• suppose SAT has poly-size circuits– any consequences?– might hope: SAT P/poly PH collapses to

P, same as if SAT P

Page 19: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 19

Karp-Lipton

Theorem (KL): if SAT has poly-size circuits then PH collapses to the second level.

• Proof: – suffices to show Π2 Σ2

– L Π2 implies L expressible as:

L = { x : 8y 9z (x, y, z) R}

with R P.

Page 20: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 20

Karp-Lipton

L = { x : 8y 9z (x, y, z) R}

– given (x, y), “9z (x, y, z) R?” is in NP– pretend C solves SAT, use self-reducibility– Claim: if SAT P/poly, then L =

{ x : 9C 8y

[use C repeatedly to find some z for which (x, y, z) R; accept iff

(x, y, z) R] }

poly time

Page 21: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 21

Karp-Lipton

L = { x : 8y 9z (x, y, z) R}

{x : 9C 8y [use C repeatedly to find some z for which (x,y,z) R; accept iff (x,y,z) R] }

– x L: • some C decides SAT 9C 8y […] accepts

– x L: •9y 8z (x, y, z) R 9C 8y […] rejects

Page 22: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 22

BPP PH

• Recall: don’t know BPP different from EXP

Theorem (S,L,GZ): BPP (Π2Σ2)

• don’t know Π2Σ2 different from EXP but believe much weaker

Page 23: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 23

BPP PH

• Proof: – BPP language L: p.p.t. TM M:

x L Pry[M(x,y) accepts] ≥ 2/3

x L Pry[M(x,y) rejects] ≥ 2/3

– strong error reduction: p.p.t. TM M’• use n random bits (|y’| = n)• # strings y’ for which M’(x, y’) incorrect is at

most 2n/3

• (can’t achieve with naïve amplification)

Page 24: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 24

BPP PH

• view y’ = (w, z), each of length n/2

• consider output of M’(x, (w, z)):

111 1

11

1 111 1 1

111 1

110 1

11

0 100 1 1

011 1

111 1

11

1 100 0 1

10 0

0 101 1

01

1 111 1 1

01 1

0

000 0

01

0 010 0 0

00 0

0001 0

00

0 000 0 0

01 00 00

0 000

0 000 0 0

00 0

0 000 0

01

0 010 0 0

00 0

0

w = 000…00 000…01 000…10 … 111…11

xL

xL

so many ones,

some disk is all ones

so few ones, not

enough for whole disk

Page 25: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 25

BPP PH

• proof (continued):– strong error reduction: # bad y’ < 2n/3 – y’ = (w, z) with |w| = |z| = n/2– Claim: L = {x : 9w 8z M’(x, (w, z)) = 1 }– xL: suppose 8w9z M’(x, (w, z)) = 0

• implies 2n/2 0’s; contradiction

– xL: suppose 9w8z M’(x, (w, z)) = 1• implies 2n/2 1’s; contradiction

Page 26: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 26

BPP PH

– given BPP language L: p.p.t. TM M:

x L Pry[M(x,y) accepts] ≥ 2/3

x L Pry[M(x,y) rejects] ≥ 2/3

– showed L = {x : 9w 8z M’(x, (w, z)) = 1}

– thus BPP Σ2

– BPP closed under complement BPP Π2

– conclude: BPP (Π2Σ2)

Page 27: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 27

New Topic

The complexity of

counting

Page 28: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 28

Counting problems

• So far, we have ignored function problems – given x, compute f(x)

• important class of function problems:

counting problems

– e.g. given 3-CNF φ how many satisfying assignments are there?

Page 29: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 29

Counting problems

• #P is the class of function problems expressible as:

input x f(x) = |{y : (x, y) R}|

where R P.

• compare to NP (decision problem)

input x f(x) = y : (x, y) R ?

where R P.

Page 30: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 30

Counting problems

• examples– #SAT: given 3-CNF φ how many satisfying

assignments are there?

– #CLIQUE: given (G, k) how many cliques of size at least k are there?

Page 31: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 31

Reductions

• Reduction from function problem f1 to function problem f2

– two efficiently computable functions Q, A

x(prob.

1)

y(prob.

2)

f2(y)f1(x)

Q

A

f2f1

Page 32: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 32

Reductions• problem f is #P-complete if

– f is in #P– every problem in #P

reduces to f

• “parsimonious reduction”: A is identity – many standard NP-completeness reductions

are parsimonious– therefore: if #SAT is #P-complete we get lots

of #P-complete problems

x(prob.

1)

y(prob.

2)

f2(y)f1(x)

Q

Af2f1

Page 33: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 33

#SAT

#SAT: given 3-CNF φ how many satisfying assignments are there?

Theorem: #SAT is #P-complete.

• Proof:– clearly in #P: (φ, A) R A satisfies φ– take any f #P defined by R P

Page 34: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 34

#SAT

– add new variables z, produce φ such that z φ(x, y, z) = 1 C(x, y) = 1

– for (x, y) such that C(x, y) = 1 this z is unique– hardwire x– # satisfying assignments = |{y : (x, y) R}|

…x… …y…

C

CVAL reduction for R

1 iff (x, y) R

f(x) =

|{y : (x, y) R}|

Page 35: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 35

Relationship to other classes

• To compare to classes of decision problems, usually consider

P#P

which is a decision class…• easy: NP, coNP P#P

• easy: P#P PSPACE

Toda’s Theorem (homework): PH P#P.

Page 36: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 36

Relationship to other classes

Question: is #P hard because it entails finding NP witnesses?

…or is counting difficult by itself?

Page 37: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 37

Bipartite Matchings

• Definition: – G = (U, V, E) bipartite graph with |U| = |V|– a perfect matching in G is a subset M E

that touches every node, and no two edges in M share an endpoint

Page 38: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 38

Bipartite Matchings

• Definition: – G = (U, V, E) bipartite graph with |U| = |V|– a perfect matching in G is a subset M E

that touches every node, and no two edges in M share an endpoint

Page 39: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 39

Bipartite Matchings

• #MATCHING: given a bipartite graph G = (U, V, E) how many perfect matchings does it have?

Theorem: #MATCHING is #P-complete.

• But… can find a perfect matching in polynomial time!– counting itself must be difficult

Page 40: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 40

Cycle Covers

• Claim: 1-1 correspondence between cycle covers in G’ and perfect matchings in G– #MATCHING and #CYCLE-COVER

parsimoniously reducible to each other

1 2 3 4 5

1 2 3 4 51

23

4

5G = (U, V, E) G’ = (V, E’)

Page 41: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 41

Cycle Covers

• cycle cover: collection of node-disjoint directed cycles that touch every node

• #CYCLE-COVER: given directed graph G = (V, E) how many cycle covers does it have?

Theorem: #CYCLE-COVER is #P-complete.– implies #MATCHING is #P-complete

Page 42: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 42

Cycle Cover is #P-complete

• variable gadget: every cycle cover includes left cycle or right cycle

xi xi•clause gadget: cycle cover cannot use all three outer edges

– and each of 7 ways to exclude at least one gives exactly 1 cover using those external edges

Page 43: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

Cycle Cover is #P-complete

May 6, 2015 43

Page 44: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

Cycle Cover is #P-complete

May 6, 2015 44

Page 45: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 45

Cycle Cover is #P-complete

• clause gadget corresponding to (ABC) has “xor” gadget between outer 3 edges and A, B, C

B BA

A

C C

xor gadget ensures that exactly one of two edges can be in cover

u v

u’v’xor

Page 46: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 46

Cycle Cover is #P-complete

• Proof outline (reduce from #SAT)

(x1x2x3)(x3x1) … (x3x2)

x1 x1 x2 x2 x3x3

. . . clause gadgets

variable gadgets

xor gadgets (exactly 1 of two edges is in cover)

N.B. must avoid reducing SAT to MATCHING!

Page 47: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 47

Cycle Cover is #P-complete

• Introduce edge weights– cycle cover weight is product of weights of its

edges

• “implement” xor gadget by– weight of cycle cover that “obeys” xor

multiplied by 4 (mod N)– weight of cycle cover that “violates” xor

multiplied by Nlarge integer

Page 48: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 48

Cycle Cover is #P-complete

• Weighted xor gadget:

– weight of cycle cover that “obeys” xor multiplied by 4 (mod N)

– weight of cycle cover that “violates” xor multiplied by N

u v

u’v’xor

u

v’

v

u’

N-1

N-1N-

1

23

(unlabeled weights are 1)

Page 49: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 49

Cycle Cover is #P-complete

• Simulating positive edge weights– need to handle 2, 3, 4, 5, …, N-1

3

2

2k

k times

Page 50: CS151 Complexity Theory Lecture 12 May 6, 2015. 2 QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,

May 6, 2015 50

Cycle Cover is #P-complete

(x1x2x3)(x3x1) … (x3x2)

– m = # xor gadgets; n = # variables; N > 4m2n

– # covers (mod N) = (4m)¢(#sat. assignments)

x1 x1 x2 x2 x3x3

. . . clause gadget

variable gadgets:

xor gadget (exactly 1 of two edges is in cover)