



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lecture note from cs221: computational complexity course by prof. Salil vadhan. The lecture focuses on counting problems, their formalization, and their relationship with decision problems. Various counting problems, such as #sat, network reliability, and ai uncertainty, and explains how they can be formalized as #p problems. It also introduces the concept of #p-completeness and provides examples of #p-complete counting problems, including #3sat, #3dnf, and #mon. The lecture concludes with the discussion of the permanent of a matrix and its connection to counting perfect matchings in a graph.
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




CS221: Computational Complexity Prof. Salil Vadhan
11/20 Scribe: Saurabh Sanghvi
1 What is counting? Who cares? 1
2 Formalizing the notion 2
3 Relating counting problems 2
We have already discussed several types of “problems”–whether languages, functions, search prob- lems, or optimization problems. One theoretically and practically interesting type of problem since unmentioned is that of counting. For instance, we might ask:
Why might we care about these sorts of problems?
Pr[s and t remain connected] = # subgraphs of^ G^ with path fom^ s^ to^ t 2 |E|
(A subgraph of G is the graph defined by a subset of the graph’s edges (and same vertex set)). Thus, counting can help determine whether a given network is reliable.
Pr[ϕ(x 1 ,... , xn)] =
2 n (The case of arbitrary pi’s amounts to a weighted counting problem.)
In order to talk about counting formally, we need to be precise about what we mean by the concept. In this course we will deal with only one counting class: #P:
Definition 1 f : Σ∗^ → N is in #P iff ∃ NP relation R (i.e. polynomially balanced and polynomi- ally decidable) such that for all x, f (x) = #{y : (x, y) ∈ R}.
That is, the function basically counts the number of NP witnesses for the given input x. An example of this is
R = {((G = (V, E), s, t), S) : S ⊆ E subgraph such that s and t are connected in S}.
This is the network reliability problem seen before.
Note: An equivalent way to formalize #P is that it is the set of functions f such that f (x) = # accepting computations of a nondeterministic polynomial time TM on x.
A reasonable question to ask at this point is the following: which functions in #P are in (F)P = { functions computable in polynomial time}? That the question might be resolvable any time soon is quickly put down by the following observation:
Observation 2 L ∈ NP iff ∃f ∈ #P such that x ∈ L ⇔ f (x) 6 = 0 (where f is not necessarily unique).
It follows immediately that counting is harder than decision. Indeed, if R defines an NP-complete language L, then the counting problem defined by R is NP-hard. As a result, counting is really most interesting when the language in question is easy, but the corresponding counting problem is hard. We’ll see a couple examples of this shortly.
There are two types of reductions one might try to use when considering counting problems:
Proof: Once again, membership in #P is trivial in the same way as before. We will show #SAT ∈ FP#MON^ (note that the fact that #SAT is #P-complete follows trivially from the #P-completeness of #3SAT). Given ϕ(x 1 ,... , xn), map it to ψ as follows:
ϕ(x 1 ,... , xn) 7 → ψ(x 1 ,... , xn, y 1 ,... , yn) = ϕ where ¬xi replaced by yi.
This gives
#ϕ(x) = #
ψ(x, y) ∧
( (^) n ∧
i=
(xi ∨ yi)
∨^ n
i=
(xi ∧ yi)
= # [α(x, y) ∧ ¬β(x, y] , where α, β are monotone formulae (2) = #α − #(α ∧ β) (3)
For (1), basically just note the satisfying assignments of ϕ are the “same” as assignments satisfying ψ such that either xi or yi is true, and it is not the case that both are true, for all i (since this simulates yi = ¬xi).
For (2), just let α(x, y) , ψ(x, y) ∧
∧n i=
(xi ∨ yi) and β(x, y) ,
∨n i=
(xi ∧ yi).
For (3), a simple Venn diagram makes this pretty clear: in words, if an assignment satisfies α, but does not satisfy α ∧ β, it must not satisfy β, so it satisfies α ∧ ¬β. Conversely, if something satisfies α ∧ ¬β, it must satisfy α, and it can’t satisfy β, so it can’t satisfy α ∧ β.
An important problem in mathematics studied since the 1800’s is that of the permanent. It turns out that the problem of calculating it is #P-complete, which has interesting implications for the class #P, given the algebraic structure of the permanent.
Definition 7 The permanent of an n × n matrix A is Perm(A) ,
π
A 1 π(1)A 2 π(2)... Anπ(n), where the sum is over all permutations π : [n] → [n].
This definition bears striking similarities to that of the determinant–indeed, the determinant differs only in multiplying each term of the sum by the sign of the permutation π. Computing the determinant is easy—it can be done in polynomial time using Gaussian elimination. Thus, it is quite surprising that computing the permanent, which seems all the simpler without the complexity of the signs, is in fact hard.
As of now it is not clear why we would talk about computing the permanent as a counting problem. To change this, assume that A has 0/1 entries. Now we can think of A as the adjacency matrix of a bipartite graph G. Thus, G would look like the following:
1 2 3 4
n
n
(where we put an edge between i and j iff Aij = 1)
We first need the following definition:
Definition 8 A perfect matching in a graph is a subset of edges such that each vertex touches exactly one edge. (In particular, in a bipartite graph, the edges give a one-to-one correspondence between left and right vertices.)
Now, we may assert a connection between counting and the permanent:
Proposition 9 Perm(A) = # perfect matchings in G.
To prove the proposition, one would first show the following lemma:
A term in Perm(A) is nonzero ⇔ {(i, π(i))} is a “perfect matching” in G
From here, the result follows, because a term in the permanent is nonzero iff all the terms Aiπ(i) = 1, which corresponds exactly to a perfect matching in G, since this means that there are edges from each left vertex to some right vertex (π is a bijection). So the number of nonzero terms equal the number of perfect matchings, but the number of nonzero terms is simply the permanent, since each nonzero term is 1.
This proposition thus shows why computing the permanent can be seen as a counting problem. As indicated before, however, we know much more than just this:
Theorem 10 (Valiant) : The problem of computing the permanent of 0 / 1 matrices is #P- complete.
We won’t prove this theorem in class, but it’s in Papadimitriou (Ch. 18).It’s worth noting that the decision problem corresponding to the permanent—that of finding a perfect matching—is in P. This is shown in AM 107 (via alternating paths) and CS 226r (via max flow).