You are on page 1of 12

Counting Complexity Classes

Shripad Thite 
May 11, 1998

Abstra t
The ounting omplexity lasses are de ned in terms of the number of a epting
omputation paths of nondetereministi polynomial-time Turing ma hines. They are,
therefore, the ounting versions of de ision problems in NP. We review the properties
of well-known ounting lasses like #P, P, GapP, SPP et . We also give an overview
of the proof of Toda's theorem that relates the ounting lasses to the polynomial-time
hierar hy PH.

1 Introdu tion

The ounting omplexity lasses orrespond to ounting the number of solutions to de ision
problems in NP. The ounting version of a de ision problem requires as an answer some
fun tion of the number of solutions to that problem.
The ounting lasses are interesting also be ause they are also losely related to proba-
bilisti lasses like PP and BPP. A probabilisti ma hine a epts depending upon whether
the majority of its omputation paths a ept or not. This notion of omputation is weaker
than the ounting version whi h demands the exa t number of a epting paths.
 Departmentof Computer S ien e, University of Illinois at Urbana-Champaign, 1304 W. Spring eld
Ave., Urbana, IL 61801; Email: thiteuiu .edu.

1
1.1 Notation
If M is a nondeterministi polynomial-time Turing ma hine and x is a string, then #M (x)
denotes the number of omputation paths of the TM M on input x that end in a epting
states. The ma hine M is obtained from M by ex hanging a epting and reje ting states.
Therefore, #M (x) denotes the number of reje ting paths of M on input x.
The total number of omputation paths of M on input x is #M (x) + #M (x).
The di eren e between the number of a epting and reje ting paths, denoted by M (x),
is equal to #M (x) #M (x).
Unless spe i ed otherwise, a TM M is onsidered to be in \normal form", i.e. it has at
most two nondeterministi hoi es in ea h on guration and the length of ea h omputation
path is equal to a xed polynomial in the length of the input. Therefore, if M is in normal
form and its exe ution time is bounded by the polynomial p, then the total number of
omputation paths indu ed by an input string x is equal to 2 (j j).
p x

A Turing ma hine M with an ora le for the language A is denoted by M . A

2 Counting fun tions

2.1 #P
De nition 2.1 #P is the lass of fun tions f su h that there exists a nondeterministi
polynomial-time Turing ma hine M su h that 8x 2 ; f (x) = #M (x).
An example of a #P fun tion is #SAT whi h orresponds to the number of solutions
to the problem of satis ability of a Boolean formula in CNF. #SAT gives the number of
distin t assignments of truth values to the Boolean variables in the formula that ause the
formula to evaluate to true. Here, the underlying language SAT is NP- omplete.
Another example of a #P fun tion is the PERMANENT of an n  n integer matrix.
It was shown to be #P- omplete in [Val79℄. PERMANENT orresponds to omputing
the number of perfe t mat hings in a bipartite graph. The underlying de ision problem of
whether there exists a perfe t mat hing is known to be solvable in polynomial time.
2
2.1.1 Closure properties

1. Closure under addition


Let N1 and N2 be TMs that are witnesses to the fa t that f1 and f2 respe tively are
in #P.
We onstru t a TM N that works as follows:
(a) N nondeterministi ally hooses to simulate either N1 or N2.
(b) ) N a epts i either N1 or N2 would have a epted.
) f (x) = #N (x) = #N1 (x) + #N2 (x)

2. Closure under multipli ation


Let N1 and N2 be TMs as above. The TM N simulates both N1 and N2 simultaneously
and a epts i both would have a epted.

) f (x) = #N (x) = #N1 (x)  #N2 (x)

Closure of #P under multipli ation also follows from losure under addition sin e
multipli ation is equivalent to repeated addition.
The lass #P aptures only the non-negative integer fun tions sin e the number of
a epting paths of a TM annot take on negative values. Therefore, #P is not losed under
subtra tion.

2.2 GapP
De nition 2.2 GapP is the lass of fun tions f su h that there exists a nondeterministi
polynomial-time Turing ma hine M su h that 8x 2 ; f (x) = M (x).
Theorem 2.1
#P ( GapP
3
Let f 2 #P so that f (x) = #M (x). We de ne a TM N that on input x simulates the
ma hine M . N a epts if M a epts. On the other hand, if M reje ts, then N bran hes
into two on gurations. In one, N always a epts, while in the other, N always reje ts.

N (x) = #N (x) #N (x)


= (#M (x) + #M (x)) #M (x)
= #M (x)

The proper in lusion follows from the fa t that a GapP fun tion an take negative
values while a #P fun tion annot.
Theorem 2.2 GapP is losed under subtra tion. If f 2 GapP, then f 2 GapP.
The statement follows from the fa t that M (x) = M (x).
Theorem 2.3 GapP is exa tly the losure of #P under subtra tion.
If g 2 GapP, then there exists a nondeterministi polynomial-time Turing ma hine N
su h that g(x) = N (x) = #N (x) #N (x). There exists fun tions in #P orresponding
to #N (x) and #N (x). Therefore, g is the di eren e of two #P fun tions.
Let f1 and f2 be fun tions in #P su h that f1(x) = #M1(x) and f2(x) = #M2(x).
We onstru t ma hines N1 and N2 as in theorem 2.1 above su h that N1(x) = #M1(x)
and N2(x) = #M2(x). We also onstru t a TM N that nondeterministi ally de ides to
simulate either N1 or N2. Then, N (x) = #M1(x) #M2(x).

3 Counting lasses

A few of the omplexity lasses that are de ned in terms of ounting fun tions are de ned
below.

4
 De nition 3.1 NP an be de ned as the lass of languages L su h that there exists
a nondeterministi polynomial-time Turing ma hine M su h that

8x; x 2 L , #M (x) > 0

 De nition 3.2 UP is the lass of languages L su h that there exists a nondetermin-


isti polynomial-time Turing ma hine M su h that 8x
8
>
<1 if x 2 L
#M (x) = >
:0 if x 2= L

Clearly, UP  NP.
 De nition 3.3 ModkP is the lass of languages L su h that there exists a nondeter-
ministi polynomial-time Turing ma hine M su h that

8x; x 2 L , #M (x) 6 0 (mod k)

 De nition 3.4 P is the lass of languages L su h that there exists a nondetermin-


isti polynomial-time Turing ma hine M su h that

8x; x 2 L , #M (x)

is odd.
In other words, P = Mod2P
 De nition 3.5 FewP is the lass of languages L su h that there exists a nondeter-
ministi polynomial-time Turing ma hine M and a polynomial p su h that

8x; x 2 L , 0 < #M (x)  p(jxj)

5
Clearly, FewP  NP.
 De nition 3.6 SPP is the lass of all languages L su h that 9 a nondeterministi
polynomial-time Turing ma hine M su h that 8x,

x2L ) M (x) = 1
x 2= L ) M (x) = 0:

4 Probabilisti omplexity lasses

4.1 PP
PP is the lass of languages a epted by majority, i.e.a PP-ma hine a epts its input i
at least half of the omputation paths indu ed by the input are a epting. While a #P
fun tion omputes the number of solutions to a problem instan e, a PP-ma hine bases its
de ision upon only the most signi ant bit of this number.
De nition 4.1 PP is the lass of languages L su h that there exists a nondeterministi
polynomial-time Turing ma hine M and a fun tion f 2 FP su h that

8x; x 2 L , #M (x) > f (x) , M (x) > 0

4.2 BPP
BPP is the lass of languages a epted by probabilisti Turing ma hines that have proba-
bility of error bounded by some onstant.
De nition 4.2 BPP is the lass of languages L su h that there exists a nondeterministi
polynomial-time Turing ma hine M and a onstant > 0 su h that

8x; x 2 L , M (x) >

Clearly, BPP  PP.


6
5 Toda's theorem

De nition 5.1 Let C be a lass of languages. Then, the operators , BP and P applied
to the lass C result in new lasses de ned as follows:

1. A language L2   C i 9 A 2 C and a polynomial p su h that 8x 2 ; jxj = n,


x 2 L , kfw 2 f0; 1g ( ) : (x; w) 2 Agk is odd.
p n

2. A language L 2 BP  C i 9 A 2 C , a polynomial p and a onstant > 0 su h that


8x 2  ; jxj = n, Prob(fw 2 f0; 1g ( ) : (x; w) 2 A , x 2 Lg)  1 .
p n
2

3. A language L 2 P  C i 9 A 2 C and a polynomial p su h that 8x 2 ; jxj = n,


Prob(fw 2 f0; 1g ( ) : (x; w) 2 A , x 2 Lg) > 12 .
p n

The operators de ned above are generalizations of the well-known lasses PP, BPP
and P. Spe i ally, P  P = PP, BP  P = BPP and   P = P.
Theorem 5.1 PH  PPP

The above theorem follows from the following in lusions that are proved below:

PH  BP  P  P  P  P#P[1℄  PPP

Lemma 5.1 8k  1;  P
k
[   BP    
P
k
P
k 1

Lemma 5.2   BP  P  BP  P
Lemmas 5.1 and 5.2 an be proved essentially using the de nitions of the operators BP
and .
Lemma 5.3 BP  BP  P = BP  P
For a BP-ma hine, the probability of orre tness an be ampli ed by iterating the
probabilisti omputation. This probability ampli ation te hnique is dis ussed in more
detail in [S h89℄.
7
Theorem 5.2 PH  BP  P

We prove the theorem by indu tion on the levels of PH. Note that BP  P is losed
under omplement.

Base ase (k = 0) 0 = P  BP  P is obvious.


P

Indu tive hypothesis  1  BP  P. From the losure of BP  P under omplemen-


P
k

tation, we have  1  BP  P.
P
k

Indu tive step From lemma 5.1, we have   BP     1. From the indu tive
P
k
P
k

hypothesis,  1  BP  P. Therefore,   BP  BP  P. From lemma 5.2,  BP P 


P
k
P
k

BP P. Therefore,   BP  BP P. From lemma 5.3, we have BP  BP P = BP P.


P
k

Therefore,   BP  P, for all k.


P
k

[
) PH = Pk  BP  P
k0
Theorem 5.3 BP  P  P  P
This in lusion is obvious from the de nitions of the operators P and BP.
De nition 5.2 Let M be a nondeterministi polynomial-time Turing ma hine with input
alphabet . 8y 2  and 8i  0, we de ne a fun tion f :   N ! N as follows:

f (y; 0)
M = #M (y)
fM (y; i) = 3  (f (y; i 1))4 + 4  (f (y; i 1))3
M M

Lemma 5.4
8
>< 22  k1 1forsomek1 > 0
i
if #M (y )isodd
f (y; i) = > 2
M
: 2  k2forsomek2 > 0
i
if #M (y )iseven

8
The statement an be proved by indu tion on i.
Lemma 5.5

f (y; dlg q (n)e)


M  0 (mod 2 ( ))if #M (y)iseven
q n

 1 (mod 2 ( ))if #M (y)isodd


q n

Sin e 22d
lg q (n)e
= 2 ( )+ = 2 ( )  2 for some k  0, the result follows from lemma 5.4.
q n k q n k

Lemma 5.6 If M is a nondeterministi polynomial-time Turing ma hine whose exe ution


time is bounded by the polynomial t, then we an onstru t a nondeterministi polynomial-
time Turing ma hine Q and a onstant > 0 su h that 8y 2  and 8i  0,

#Q(y#1 ) = f (y; i)
i
M

and the omputations of Q are polynomially bounded.

The ma hine Q, on input y#1 simulates M re ursively a ording to the de nition of


i

f M (y; i) using a sta k for the re ursive alls.


Lemma 5.7 Let X be a language in P and let q be any polynomial. Then, 9 a nonde-
terministi polynomial-time Turing ma hine N su h that for every input y of length n,

#N (y) = 2 ( )  k 1 for some k  1


q n
if y 2 X; and
#N (y) = 2 ( )  k0 for some k0  0
q n
if y 2= X

on input y simulates the ma hine Q of lemma 5.6 on input y#1 . It is lear that N
N i

satis es the above onditions.


Theorem 5.4 P  P  P#P[1℄
Let L 2 P  P. From the de nition of the P operator, there exists a language X 2 P
and a polynomial p su h that 8x; jxj = n; kW k = kfw 2 f0; 1g ( ) : (x; w) 2 X , x 2
X
p n

9
Lgk 2(p n ) 1.
From lemma 5.7, we an onstru t a nondeterministi polynomial-time
Turing ma hine N with #N (y) as in the lemma.
Consider the nondeterministi polynomial-time Turing ma hine Z that on input x of
length n nondeterministi ally hooses a string y 2 f0; 1g ( ) and then simulates N on input
p n

(x; w). We an prove that #Z (x) = 2j( )j  k kW k = 2 + ( )  k kW k for some k.


x;w
X
n p n
X

Sin e kW k  2 ( ), kW k an be omputed simply by omplementing the last p(n) bits


X
p n
X

of #Z (x). Obviously, #Z () is a #P fun tion and the theorem follows.


Theorem 5.5 P#P[1℄  PPP

A fun tion in #P an be omputed in polynomial time using an ora le from PP by


using a binary sear h to determine all the bits of the #P fun tion one after the other.
Corollary 5.1 For ea h k  0, if PP  Pk , then PH ollapses to  P
k
.
Assume PP  Pk for some k  0. Sin e PP is losed under omplementation, PP 
Pk, and therefore, PP  Pk \ Pk. It is easy to prove that P \  Pk, as follows.
P
k
P
k

Obviously, P [  Pk. Negating the answers of the ora le, we obtain P [  Pk
P
k
P
k
P
k
P
k

using DeMorgan's law. Again, sin e  = o  , we obtain the above result. We therefore
P
k
P
k

have PPP  Pk and from the main theorem PH  PPP. Therefore, PH  Pk.

5.1 Signi an e of Toda's theorem


1. Toda's theorem is the latest result about in lusion of the ounting and probabilisti
lasses in the polynomial-time hierar hy. This in lusion seems unlikely unless PH
ollapses to a nite level.
2. Probabilisti omplexity lasses are losely related to #P. For instan e, the lass
PP is the lass of languages a epted by probabilisti TMs for whi h at least half
the omputation paths are a epting. This is equivalent to the question of whether
the most signi ant bit in the number of a epting omputation paths is 1. Toda's
theorem proves that PP is at least as hard as PH and likely to be harder unless
10
PH ollapses to a nite level. Thus, probabilisti omputation is likely to be more
powerful than nondeterministi polynomial-time omputation.
3. Another ounting lass that's also similarly related to #P is P. The lass P is the
lass of languages a epted by TMs for whi h the number of a epting omputation
paths is odd. This is equivalent to the question of whether the least signi ant bit
in the number of a epting omputation paths is 1. Theorem 5.2 in the above proof
shows that P is at least as hard as PH.
4. Another onsequen e of the theorem explored in [All89℄ is that every language re og-
nized by a onstant depth polynomial size ir uit an also be re ognized by a depth
three polylog size ir uit that uses MAJORITY gates only.

Referen es

[All89℄ Allender, E., \A note on the power of threshold ir uits", IEEE FOCS, pp. 580{
584, 1989.
[BBS86℄ Bal azar, J.L., Book, R.V., S honing, U., \The polynomial-time hierar hy and
sparse ora les", J. Asso . Comput. Ma h., 33, pp. 603{617, 1986.
[BG92℄ Beigel, R., Gill, J., \Counting lasses: thresholds, parity, mods, and fewnewss",
Theoret. Comput. S i., 103, pp. 3{23, 1992.

[FFK94℄ Fenner, S.A., Fortnow, L.J., Kurtz, S.A., \Gap-de nable ounting lasses", Jour-
nal of Computer and System S ien es, 48, pp. 116{148, 1994.

[HS97℄ Fortnow, L., \Counting Complexity", Hemaspaandra, L.A., Selman, A.L., (Eds.),
Complexity Theory Retrospe tive II, Springer-Verlag, pp. 81{107, 1997.

[S h89℄ S honing, U., \Probabilisti omplexity lasses and lowness", Journal of Computer
and System S ien es, 39, pp. 84{100, 1989.

11
[Toda89℄ Toda, S., \On the omputational power of PP and P", IEEE FOCS, pp. 514{
519, 1989.
[Toda91℄ Toda, S., \PP is as hard as the polynomial-time hierar hy", SIAM Journal on
Computing, 20(5), pp. 865{877, 1991.

[Val79℄ Valiant, L., \The omplexity of omputing the permanent", Theoret. Comput.
S i., 5, pp. 189{201, 1979.

12

You might also like