Complexity 25-1 Complexity Andrei Bulatov Counting Problems
Complexity 25-2 Graph Reliability How reliable is our network?
Complexity 25-3 Instance: A graph G and two its vertices s and t Objective: How many subgraphs of G contains a path from s to t ? Graph Reliability Counting Problems Instance: A formula in CNF Objective: How many satisfying assignments does have? #SAT
Complexity 25-4 Perfect Matching Definition Given a bipartite graph G with bipartition a perfect matching of G is a collection of n edges such that, for any edges from the collection
Complexity 25-5 Instance: A bipartite graph G Objective: How many perfect matchings does G have? #Matching
Complexity 25-6 Matching and Adjacency Matrix Note that a perfect matching of G is a collection of entries of A(G) such that it contains exactly n entries all of the entries are 1 no two entries are in the same row no two entries are in the same column
Complexity 25-7 Therefore Definition Permanent of an n n matrix A is the sum #Matching = Permanent
Complexity 25-8 Definition A decider machine V is called a verifier for a language L if L w V accepts “ w;c ” for some string c NP is the class of languages that have a polynomial time verifier Definition A decider machine V is called a verifier for a language L if L w V accepts “ w;c ” for some string c NP is the class of languages that have a polynomial time verifier 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
Complexity 25-9 Definition NP is the class of languages L that can be represented as for a certain polynomially balanced polynomial time decidable relation U Definition NP is the class of languages L that can be represented as for a certain polynomially balanced polynomial time decidable relation U 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 Every problem from NP has a corresponding counting problem!
Complexity Examples #SAT #Reachability Graph Reliability #Matching Instance: A graph G Objective: How many Hamilton paths does G have? #Hamilton Path #Primes ? (formula; satisfying assignment) (graph+ s + t ; path from s to t )
Complexity Parsimonious Reduction We need a notion of reduction that “preserves the number of solutions” 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
Complexity #P-Completeness Theorem #SAT is #P-complete 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 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 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 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 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 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+1 different vectors such that any solution can be represented in the form
Complexity This “basis of solutions” can be found in polynomial time (using Gaussian elimination) and the number of solutions is