# Complexity 25-1 Complexity Andrei Bulatov #P-Completeness.

## Presentation on theme: "Complexity 25-1 Complexity Andrei Bulatov #P-Completeness."— Presentation transcript:

Complexity 25-1 Complexity Andrei Bulatov #P-Completeness

Complexity 25-2 The Class #P A polynomially balanced, polynomial time decidable binary relation is a binary relation U on  * such that (a) there is a polynomial time decider for U (b) if then for some polynomial p Definition Let U be a certain polynomially balanced polynomial time decidable relation. The counting problem associated with U is the following: Given u, how many v are there such that (u,v)  U ? #P is the class of all counting problems associated with a certain polynomially balanced polynomial time decidable relations Definition Let U be a certain polynomially balanced polynomial time decidable relation. The counting problem associated with U is the following: Given u, how many v are there such that (u,v)  U ? #P is the class of all counting problems associated with a certain polynomially balanced polynomial time decidable relations

Complexity 25-3 #P-Completeness Definition A polynomial time function f is said to be a parsimonious reduction of a counting problem A to a counting problem B, denoted, if for all instances of A, x and f(x) have the same answer Definition A language L is said to be #P -complete if, for any counting problem A corresponding to a polynomially balanced polynomial time decidable relation, Definition A language L is said to be #P -complete if, for any counting problem A corresponding to a polynomially balanced polynomial time decidable relation,

Complexity 25-4 #SAT Instance: A formula  in CNF Objective: How many satisfying assignments does  have? #SAT Theorem #SAT is #P-complete

Complexity 25-5 Proof Take a counting problem A from #P. There is a polynomially balanced polynomial time decidable relation U corresponding to A That is there exist a polynomial p(n) and a Turing machine T such that T decides U (on an input (w,c) ) in a time p(|w|+|c|) if (w,c)  U then |c|  p(|w|) We need to do: Given a string w generate (in polynomial time) a formula such that the number of satisfying assignments to = the number of c such that (w,c)  U

Complexity 25-6 Reduction When proving Cook’s theorem we, given a non-deterministic Turing machine NT and an input w for NT, built a CNF such that every satisfying assignment of encodes an accepting computation of NT on the input w. The decider for U is a deterministic Turing machine, that is a particular case of non-deterministic machines Consider the formula Since T is deterministic, has at most one satisfying assignment

Complexity 25-7 The fact that the input for T is (w,c) is encoded as follows Let and then contains the clauses where is true if and only if at the time 1 the tape cell number i contains x Replace with in which is replaced with Then every assignment to correspond to a unique pair (w,c) which may or may not belong to U, and gives rise to a unique satisfying assignment to if and only if (w,c)  U

Complexity 25-8 More #P-complete Problems #3- SAT #Matching = Permanent # Hamilton Path Open Problem Is this true that if L is NP-complete then # L is #P-complete?

Complexity 25-9 Counting Problems Solvable in Poly-Time Instance: A system of linear equations modulo p ( p prime) Objective: How many solutions does it have? #System of Linear Equations Fact If a system of linear equations has n variables, then there are at most n different solutions such that any other solution can be represented in the form

Complexity 25-10 This “basis of solutions” can be found in polynomial time (using Gaussian elimination) and the number of solutions is