ComputabilityandComplexity 36-1 ComputabilityandComplexity 36-2

TheClass#P

Apolynomiallybalanced,polynomialtimedecidablebinaryrelationis abinaryrelation Uon Σ*suchthat (a)thereisapolynomialtimedeciderfor U #P-Completeness (b)ifthen(u,v)∈ | v |≤forsomepolynomialp(| n |) p

Definition Let Ubeacertainpolynomiallybalancedpolynomialtimedecidable relation.Thecountingproblemassociatedwith Uisthefollowing: Given u,howmany varetheresuchthat (u,v)∈U?

#P istheclassofcountingproblemsassociatedwithacertain polynomiallybalancedpolynomialtimedecidablerelations ComputabilityandComplexity AndreiBulatov

ComputabilityandComplexity 36-3 ComputabilityandComplexity 36-4

#P-Completeness #SAT

#SAT Definition Apolynomialtimefunction fissaidtobeaparsimonious ofacountingproblem Atoacountingproblem B, Instance:Aformula ΦinCNF ≤ ∈Σ denoted,ifforallinstancesA p B ofx * A, xand f(x) havethesameanswer Objective:Howmanysatisfyingassignmentsdoes Φhave?

Definition Alanguage Lissaidtobe #P -completeif,foranycounting problem Acorrespondingtoapolynomiallybalanced Theorem#SATis#P-complete polynomialtimedecidablerelation, ≤ A p L

ComputabilityandComplexity 36-5 ComputabilityandComplexity 36-6

Proof Reduction

Takeacountingproblem Afrom #P . WhenprovingCook’stheoremwe,givenanon-deterministic NT andaninput wfor NT ,builtaCNFsuchthatΦ Thereisapolynomiallybalancedpolynomialtimedecidablerelation U NT ,w everysatisfyingassignmentofencoΦ desanacceptingcomputation correspondingto A NT ,w of NT ontheinput w. Thatisthereexistapolynomial p(n)andaTuringmachine Tsuchthat • Tdecides U(onaninput (w,c))inatime p(| w|+| c|) Thedeciderfor UisadeterministicTuringmachine,thatisaparticular caseofnon-deterministicmachines •if (w,c)∈Uthen |c|≤p(| w|) Φ Considertheformula T (, w,c) Weneedtodo: Φ Since Tisdeterministic,hasatmostonesT (, w,c) atisfyingassignment Φ Givenastring wgenerate(inpolynomialtime)aformulaw such that Φ thenumberofsatisfyingassignmentstow = thenumberof csuchthat (w,c)∈U

1 ComputabilityandComplexity 36-7

Thefactthattheinputfor Tis (w,c )isencodedasfollows = = Φ Letandw w1w2 Kwn c c1c2thencontainstheKcp(n) T (, w,c) clauses wi ∧ ci ∧ Pi 1, ∧ Pi 1, 1≤i≤n n+1≤i≤ p(n)

x whereistrueifandonlyifatthetimePi 1, 1thetapecellnumber i contains x

wi ∧ ci Φ Φ ∧ Pi 1, ∧ Pi 1, ReplacewithinwhichT (, w,c) T ,w 1≤i≤n n+1≤i≤ p(n) wi isreplacedwith ∧ Pi 1, 1≤i≤n

0 0 K 0 TheneveryassignmenttoPn+ 1,1 , Pn+ 1,2 , ,correspondtoauniquepairPp(n), 1 (w,c )whichmayormaynotbelongto U,andgivesrisetoauniquesatisfying Φ ∈ assignmenttoifandonlyifT ,w (w,c) U

2