This is page

Printer Opaque this

Counting Complexity

Lance Fortnow

ABSTRACT Traditionally computational complexity theorists have lo oked

at NP problems like threecoloring to determine whether some solution ex

ists In counting complexity we ask how many solutions exist This pap er

surveys the vast area of counting complexity concentrating on a few of the

most imp ortant results in the area

Intro duction

In Valiant Vala dened the P as a function

class computing the numb er of accepting paths of a nondeterministic Turing

machine Valiant used this class to capture the complexity of the p ermanent

function

Counting complexity has since played an imp ortant role in computational

complexity theory and theoretical The techniques used

in counting complexity have signicant applications in circuit complexity

and the series of recent results on interactive pro of systems

In the rst Complexity Theory Retrospective Schoning Sch gave us

a taste of the p ower of counting Schonings survey lo oked at counting

as a technique in complexity theory We instead will lo ok at counting as a

goal and study the techniques mostly algebraic that help us understand

the computational complexity of counting

In this short survey we cannot hop e to cover adequately the wealth of

research in counting complexity We fo cus on describing the basics the two

imp ortant counting function classes P and GapP and several imp ortant

language classes dened in terms of these functions We will describ e the

basic relationships and closure prop erties among these classes

We fo cus in detail on p erhaps the two most imp ortant results in count

ing complexity To das To d result showing that one can reduce any

language in the p olynomialtime hierarchy to a P function and Beigel

Reingold and Spielmans BRS theorem that PP is closed under union

1

Department of Computer Science E th St

Chicago IL Email fortnowcsuchicagoedu Supp orted in part by NSF

grant CCR

Lance Fortnow

We prove To das Theorem in three stages First we give a new alge

braic pro of of an imp ortant lemma by Valiant and Vazirani VV that

randomly reduces a P function to its sign We apply this lemma dur

ing the pro of of a result of To da and Ogihara TO that shows that the

p olynomialtime hierarchy is in some sense probabilistically low for GapP

functions We then use this result with a variant of To das original pro of

to show how to reduce the p olynomialtime hierarchy deterministically to

a single GapP question

This survey should give the reader a taste of the p ower of counting func

tions We hop e that the reader will take the concepts herein and learn more

ab out counting complexity and apply the techniques not only to counting

complexity but also to other areas in computational complexity theory and

theoretical computer science

Preliminaries

We assume that the reader has familiarity with the basic notions of Turing

machines nondeterminism and basic complexity classes such as P and NP

The reader can nd these notions in a basic undergraduate textb o ok such

as that of Hop croft and Ullman HU

Fix f g We consider strings over b oth as concatenations of

characters and as representations of integers We dene the onetoone cor

resp ondence as follows

The string represents zero

The string x represents the p ositive integer whose binary description

is x

The string x represents the negative integer whose absolute value

has binary description x

Note that for a numb er y the length of the representation of y jy j is roughly

the logarithm of the absolute value of y

We order strings lexicographically ie x y if jxj jy j or jxj jy j and

x precedes y in dictionary order Note that we may have x y as strings

but x y as integers

Let hx x i for k b e a standard tuple function ie oneto

k

one easily computable and invertible in arguments When we write a

function as f x x this should b e interpreted as f hx x i

k k

Let M b e a nondeterministic Turing machine that runs in time b ounded

j

by some p olynomial n for inputs of length n Since most of the denitions

in this pap er are based on this typ e of machine we give such machines

the name NP machines However we will usually b e interested more in the

Counting Complexity

numb er of accepting and p ossibly rejecting paths of M rather than whether

the machine accepts

M represent the NP machine that simulates M but reverses M s Let

decision to accept and reject In other words the accepting paths of M x

are the rejecting paths of M x and vice versa

Let M x b e the numb er of accepting paths of M We then have that

M x is the numb er of rejecting paths We also dene the Gap of M

by M x M x M x

j

jxj

M x and M x all are b ounded by Note that M x

Let FP represent the class of p olynomialtime computable functions

We will also consider oracle Turing machines An oracle Turing machine

M using oracle A may write a string y on a sp ecial oracle tap e and then

enter a sp ecial query state M will then enter a yes state if y is in A

and a no state if y is not in A

A

We dene the relativized class NP as the set of languages that are

accepted by p olynomialtime nondeterministic Turing machines with access

C A

to oracle A For a class C we dene NP as the union of all NP for A

Ak

in C We use the notation NP to mean that the NP machine can make

only at most k queries to the oracle A on any computation path We can

dene relativized versions of other complexity classes in a similar manner

When we relativize PSPACE computation we only allow the PSPACE

machine to write questions on the oracle tap e whose lengths are b ounded

by a p olynomial

We can use oracle Turing machines to dene other complexity classes

p p p

such as the p olynomialtime hierarchy MS We dene and

i i i

inductively as follows

p p p

P

p

p

i

NP

i

p p

co

i i

p

p

i

P

i

The sup erscript p distinguishes the p olynomialtime hierarchy used in

complexity theory from the arithmetic hierarchy from recursion theory

see Rog

We dene the p olynomialtime hierarchy PH as the union of these

classes

p p p

PSPACE PH

i i i

i i i

p p

We say that the p olynomialtime hierarchy is innite if for

i i

all i Otherwise we say that the hierarchy is nite or that it col lapses

Complexity theorists generally b elieve that the hierarchy is innite

Lance Fortnow

Counting Functions

In this section we will discuss the p ower of counting functions We will

examine two p owerful function classes in particular P and GapP

The classes P read SharpP or Numb erP and GapP are derived

directly from lo oking at the numb er of accepting paths or the gap b etween

accepting and rejecting paths resp ectively

Denition The class P consists of the functions f such that

there exists an NP machine M such that for al x f x

M x

The class GapP consists of the functions f such that there exists an

NP machine M such that for al l x f x M x

First note that P and GapP functions cannot take on values to o large

Lemma If f x is a P or GapP function then there exists a poly

pjxj

nomial pn such that the absolute value of f x is bounded by for

every x

Pro of Either f x M x or M x for some NP machine M Let

pn b ound the running time of M on strings of length n Note that M x

pjxj

can have at most computation paths The numb ers of accepting and

rejecting paths of M x are b ounded by the numb er of computation paths

Lemma follows 2

Note that P functions cannot take on negative values though GapP

functions can In fact GapP functions are closed under negation

Lemma If f is a GapP function then f is also a GapP function

Pro of Let M b e an NP machine such that f M Then f M

2

How ab out the relationship b etween P and GapP and the p olynomial

time computable functions FP First we show that every P function is

also a GapP function

Lemma For every NP machine M there is an NP machine N such

that N M

Pro of Given an input x the machine N guesses a path p of M x If

p is accepting N accepts Otherwise N branches once accepting on one

branch and rejecting on the other We have for all x

N x N x N x

M x N x

M x M x M x

M x

fullling the conclusion of Lemma 2

Counting Complexity

Note that a P function can take on only nonnegative values so this

class cannot capture all of the FP functions However it do es capture

those FP functions that only take on nonnegative values The class GapP

encompasses all the FP functions without restriction

Theorem If an FP function f always takes on nonnegative values

then f is in P Every FP function f is in GapP

Pro of Let f b e an FP function Create an NP machine M that on

input x guesses jf xj computation paths and accepts on these paths if and

only if f x Note that M x f x for all x and M x f x

when f x 2

It is p ossible that FP captures all the P or GapP functions or that P

captures all the GapP functions that take on only nonnegative values but

these prop ositions seem unlikely However from the following lemma we

will see that P and GapP have essentially the same computational p ower

Lemma For al l functions f the fol lowing are equivalent

f GapP

f is the dierence of two P functions

f is the dierence of a P function and an FP function

f is the dierence of an FP function and a P function

P

Corollary GapP FP

Pro of Follows from the third characterization of GapP in Lemma 2

Pro of of Lemma

For any M we have

M M M

by denition so GapP is the dierence of two P functions

Let f and g b e P functions We can assume that f M and

q n

g N where M and N are NP machines and N has computation

paths for some p olynomial q just pad N with extra rejecting paths so that

all paths have length q n Let M b e the machine that rst branches once

then simulates M on one branch and N on the other We have for any x

f x g x M x N x

q jxj

M x N x

q jxj

M x

Therefore f g is the dierence of a P and an FP function

Let f b e a P function and let g FP Let M b e the NP machine

such that f M Let N b e such that for all x N x resembles

M x padded with g x rejecting paths We then have N f g

Lance Fortnow

This follows since we now have and the GapP functions

are closed under negation 2

The comp osition of two FP functions remains an FP function However

it seems unlikely that the comp osition of two P functions is a P or even

a GapP function We can however combine P and GapP functions with

FP functions

Lemma Let f be an FP function and g a P or GapP function Then

g f x is a P or GapP function respectively

Pro of Let M b e an NP machine that denes a P function g Dene

N to b e an NP machine that on input x simulates M f x Then N x

is exactly g f x The pro of for GapP functions is identical 2

Algebraic Properties of Counting Functions

The vast p ower of P and GapP functions arises from their closure under

algebraic op erations like exp onential summation and p olynomial pro ducts

Lemma Let f be a P function and q a polynomial Then the fol

lowing are also P functions

P

f x y and

jy jq jxj

Q

f x y

y q jxj

Pro of Fix an NP machine M such that f x y M x y

Dene an NP machine N that on input x guesses a string y of length

b ounded by q jxj and then simulates M x y

Notice that if one simulates two nondeterministic machines and

cepts if b oth accept then the numb er of accepting paths of the new

machine will b e exactly the pro duct of the numb ers of accepting paths

of the original two machines To prove part we generalize this idea

Dene an NP machine N that on input x simulates the following

FOR y from to q jxj

Simulate M x y

If M x y rejects then REJECT

ACCEPT

In each case N x will have the appropriate numb er of accepting compu

tations 2

Lemma Let f be a GapP function and q a polynomial Then the

fol lowing are GapP functions

Counting Complexity

P

f x y and

jy jq jxj

Q

f x y

y q jxj

Pro of Fix an NP machine M such that f x y M x y

Same as in the pro of of Lemma

Q

f x y Dene an NP machine N that on in Let g x

y q jxj

put x guesses in sequence computation paths of M on the inputs

hx i hx i hx i and so on through hx q jxj i N accepts if an

even numb er of these paths are rejecting and N rejects if an o dd

numb er of these paths are rejecting The machine N is an NP ma

chine The fact that g N can b e shown by induction on the value

n q jxj as follows For n we have N x f x g x

b ecause N x b ehaves just as M x do es If n assume that

the inductive hyp othesis is true for n and let N b e a machine

that acts the same as N except that N guesses paths of M only

0

N x on inputs hx i hx n i For convenience let a

N

0

N x a M x n and M x n By the induc r

M M N

tive hyp othesis we have

g x N xf x n

N xM x n

0 0

a r r a

M M N N

0 0 0 0

a r r r a a r a

M M N M N M N N

Now N x accepts whenever it guesses an even numb er of rejecting

paths This happ ens either when there are an even numb er of

jections through hx n i and the last path is accepting or when

there are an o dd numb er of rejections through hx n i and the

last path is rejecting Thus by the denition of N the total numb er

0 0

r Likewise a r of sequences accepted by N x is exactly a

M M N N

0 0

the total numb er of sequences rejected by N x is a r r a

N M N M

Therefore g x N x 2

With the closure prop erties of Lemma and one would exp ect a

close connection b etween P and GapP functions and lowdegree p olyno

mials Babai and Fortnow BF show that in fact P and GapP functions

can b e expressed as p olynomials built in a simple way

A retarded arithmetic program with binary substitutions RAB will b e

a sequence p g of instructions such that for every k one of the

following holds

p is one of the constant p olynomials or

k

p x for some i k

k i

Lance Fortnow

p x for some i k

k i

p p p for some i j k

k i j

p p p for some i j such that i j k retarded multiplication

k i j

p p x or p x for some i j k binary substitu

k j i j i

tion Here p x refers to the p olynomial obtained from p by

j i j

replacing the variable x by the value

i

We call a RAB uniform if there exists a p olynomialtime function that on

n

input outputs the rst n instructions

Theorem BF FFK For every function f the fol lowing are

equivalent

f GapP

There exists a uniform RAB and a polynomial q n such that p has

q n

x x as free variables and such that for every string x f g

n

f x p x

q n

A Randomized sign Function

Valiant and Vazirani VV show how to randomly isolate one assign

ment from a satisfying assignment In the context of counting functions

their construction in some sense allows us to apply a randomized sign

function to P functions

Lemma ValiantVazirani Let f be a P function There exist a

P function g and polynomials q and t such that

q n

If f x then g x r for al l r

If f x then

Pr g x r

q (n)

tn

r

In order to prove Lemma Valiant and Vazirani VV and Mul

muley Vazirani and Vazirani MVV use probabilistic techniques We

give a new pro of based on the algebraic techniques of Buhrman and Fort

now BF These techniques are related to the designs of Nisan Nis

and Nisan and Wigderson NW

Pro of Let M b e an NP machine such that f x M x Fix x and

supp ose f x Let b e the length of a binary enco ding of a computation

path of M x Let S b e the set of accepting computation paths of M x

enco ded as strings of length and let d jS j f x M x

Counting Complexity

m m

Pick m such that d d Let F GF the nite eld of

m

elements

We will enco de the computation paths as p olynomials over F We then

consider pairs a b F and show that for a sizable fraction of them there

will b e exactly one p olynomial p representing an accepting path of M such

that pa b Lemma will follow by cho osing m a and b at random

For a string y y y in S consider the following degree p olynomial

over F

X

i

y X p X

i y

i

Fix a y in S An element a of F will b e called y go o d if for all z y in

S p a p a Since p and p can agree on at most elements of F

y z y z

there are at least jF j d y go o d elements in F

Consider the set A dened as the set of pairs a p a for all y go o d

y y

a Note that for two dierent y and z in S A A Let A A

y z y S y

Note that jAj djF j d

Now we can dene the P function g by dening the corresp onding NP

machine N The machine N on input hx r i do es the following

Use r as an enco ding of an integer m b etween and and elements



m

a and b in GF

Guess a string y of length and accept if b oth a p a b in the

y



m

eld GF and b y enco des an accepting computation of M x

Shoup Sho shows how to nd an irreducible p olynomial over GF

of degree m in p olynomial time One can use this irreducible p olynomial



m

to do eld op erations in GF in p olynomial time

If f x then g x r for all r since N x r will never accept

If f x note that d so m log d l With probability

we have m m

Assume that m was chosen to b e m Note that if a b is in A then

N x r has exactly one accepting computation and thus g x r as

desired

We have that the size of A is at least djF j d dd d d

We also have that the size of F is at most d

Thus if we cho ose a b at random in F we have at least a

chance of b eing in A

Fix x The probability of cho osing r at random such that m m and

a b in A is at least

Thus the probability that N x r has exactly one accepting computation

and g x r is at least Since is b ounded by a p olynomial

in jxj we have fullled condition of Lemma 2

While the tn term in Lemma do es not seem like a large probabil

ity one can take many samples of g and have an extremely high likeliho o d

of having one of them take on a value of one

Lance Fortnow

Corollary Let f be a P function and q a polynomial There exist

a P function g and polynomials p and t such that

If f x then g x i r for al l i such that i tn and

pn

r

If f x then

q n

Pr i i tn such that g x i r

p(n)

r

It do es not seem likely that a variant of Lemma or Corollary

holds for GapP functions

Counting Functions and the PolynomialTime Hierarchy

To da and Ogihara TO show that the p olynomialtime hierarchy do es

not add any p ower to GapP functions in a probabilistic sense

PH

Theorem Let f be in GapP and let p be a polynomial Then there

exist a twoargument function g in GapP and a polynomial q such that for

al l x

pn

Pr g x r f x

q (n)

r

In order to prove this theorem we use the following lemma proven later

in this section

NP

Lemma Let f be in P and p be a polynomial There exist a

twoargument function g in GapP and a polynomial q such that for al l x

pn

Pr g x r f x

q (n)

r

Pro of of Theorem By induction we will show that Theorem

p

p

0

k

holds for all f in GapP The base case k is trivial since GapP

P

GapP GapP

p

k +1

Assume that the inductive hyp othesis holds for k Let f b e in GapP

A

p

NP

and x a p olynomial p Let A b e a set We have f in GapP

k

A

NP

By the fact that Lemma relativizes there exist f and f in P

such that f f f Since the pro of of Lemma also relativizes let

A

g x r and g x r in GapP b e the functions fullling the conclusion

of Lemma with p olynomial p for f x and f x resp ectively

Apply the inductive hyp othesis to the functions g x r and g x r

to get g hx r i r and g hx r i r in GapP fullling the conclusion

of Theorem for p olynomial p

Counting Complexity

We now combine g and g to get the nal g that fullls Theorem

for f Dene g by

g x r r g hx r i r g hx r i r

Fix an input x The following events o ccur each with probability at least

pn

when r and r are chosen at random

g x r f x

g x r f x

g hx r i r g x r

g hx r i r g x r

pn

Thus with probability at least we have

f x f x f x g hx r i r g hx r i r g x r r

fullling the inductive hyp othesis for k 2

We will need the following lemma for the pro of of Lemma

NP

Lemma For every f in P there is a language A in coNP and a

polynomial r such that

r n

f x jjy hx y i Ajj

SAT

Pro of Let M b e the NP machine such that f M Fix an input

x Let y represent the following tuple

hp s s i

q

SAT

where p represents a computation path of M x q is the numb er of

oracle queries made on computation path p and s is either or a b o olean

i

assignment

Dene A as the set of tuples hx y i such that p is an accepting path of

M x and if is the ith query made by M x on computation path p either

is not in SAT and s or

i

is in SAT and s is the lexicographically least satisfying assignment

i

to

For each input x there is exactly one y with hx y i in A for each accepting

SAT

computation of M x The set A is in coNP since in we need only

check that s is an assignment to and that no s s are assignments to

i i

2

Lance Fortnow

NP

Pro of of Lemma Let f b e a function in P and let A and

r n b e as derived from Lemma

Fix a p olynomial p By Corollary there is a P function f i w x y

and a p olynomial q where i ranges from to q n and w ranges over

strings of length q n such that

If hx y i is not in A then f i w x y and

if hx y i is in A then

r npn

Pri f i w x y

w

Dene the GapP function f by

q n

Y

f i w x y f w x y

i

Note that if x y is not in A then for all w f w x y If on the

r npn

other hand x y is in A then with probability at least

f w x y

P

Finally we dene the GapP function g x w f w x y The prob

y

r npn

ability that g x w f x is at most times the numb er of y s

r n pn

for a total probability b ounded by 2

Counting Classes

We can use counting functions to dene language classes in a natural way

We can then use the closure prop erties of P and GapP functions describ ed

in Section to help us understand the complexity of these language classes

Classifying Counting Classes

Let L b e a language in NP accepted by an NP machine M If we lo ok at

the P function f x M x note that f x exactly when x is in

L

This works b oth ways Supp ose that we have a P function f dened

by an NP machine M If we lo ok at the set of strings x such that f x

this is exactly the NP set accepted by M

Thus we have the following characterization of the class NP using P

functions

Classication The class NP consists of those languages L such that

for some P function f and al l x in

If x is in L then f x

Counting Complexity

If x is not in L then f x

In fact many classes have natural and simple characterizations using

P and GapP functions Often these new characterizations allow us to use

the closure prop erties discussed in Section to prove results ab out these

classes We use the term counting classes to refer to complexity classes

with simple characterizations using P or GapP functions

The class UP Unique P consists of those NP languages accepted by

NP machines that never have more than one accepting path In terms of

P functions

Classication The class UP consists of those languages L such that

for some P function f and al l x in

If x is in L then f x

If x is not in L then f x

Gill Gil dened the class PP Probabilistic Polynomial Time as

the set of languages L with probabilistic p olynomialtime Turing machines

M where x is in L if the probability of M x accepting is greater than

onehalf If one considers M as a nondeterministic machine this means

that the accepting paths outnumb er the rejecting paths In terms of GapP

functions

Classication The class PP consists of those languages L such that

for some GapP function f and al l x in

If x is in L then f x

If x is not in L then f x

As complexity theorists discovered these simple characterizations several

other classes were dened using P and GapP functions

Classication The class SPP consists of those languages L such that

for some GapP function f and al l x in

If x is in L then f x

If x is not in L then f x

Classication The class C P consists of those languages L such that

for some GapP function f and al l x in

If x is in L then f x

If x is not in L then f x

Classication The class P consists of those languages L such that

for some P function f and al l x in

Lance Fortnow

If x is in L then f x is odd

If x is not in L then f x is even

Classication The class Mo d P consists of those languages L such

k

that for some P function f and al l x in

If x is in L then f x mo d k

If x is not in L then f x mo d k

Note that P is just Mo d P Fenner Fortnow and Kurtz FFK show

that we can replace P with GapP in Classications P and

Mo d P

k

We can sometimes simplify some of these characterizations using some

of the closure prop erties discussed in Section For example if f is a GapP

function then the GapP function f x exactly when f x This

allows us to have a new characterization of C P

Classication The class C P consists of those languages L such that

for some GapP function f and al l x in

If x is in L then f x

If x is not in L then f x

If a class C has a characterization using counting functions then coC also

has a characterization using counting functions where we reverse the im

plicants For example

Classication The class coC P consists of those languages L such

that for some GapP function f and al l x in

If x is in L then f x

If x is not in L then f x

From Classications and we get

Corollary coC P PP

Also since every P function is a GapP function we have

Corollary

NP coC P

UP SPP

For a GapP function f the GapP function f x has the same sign as

f x for p ositive and negative f x and takes on the value for f x

Thus we have a subtle but imp ortant variation of Classication

Counting Complexity

Classication The class PP consists of those languages L such that

for some GapP function f and al l x in

If x is in L then f x

If x is not in L then f x

From Classication and the fact that GapP functions are closed under

negation we have the following

Corollary

PP is closed under

C P PP

We can also use these classications to show a relationship b etween PP

P and GapP

PP GapP

Theorem P P

Pro of We only need to show that every GapP function g is computable

PP

in FP Consider the language

L fhx k i j g x k g

If we consider the GapP function f x k g x k we have that L PP

by Classication One can then use binary search using L as an oracle

to nd the value of g x 2

In one sense PP languages consider the highorder bit of a GapP func

tion and P languages consider the loworder bit Green Kobler Regan

Schwentick and Toran GKR lo oked at the class of languages that

consider the middle bit

jxj

eth bit of Consider the function Midd le that on input x returns the d

the string x Rememb er that we also consider integers as strings as dened

in Section We can then dene the class MP using our usual classication

Classication The class MP consists of those languages L such that

for some GapP function f and al l x in

If x is in L then Middlex

If x is not in L then Middlex

Note Green et al dene the class MP using an equivalent denition

that employs P functions and a p olynomialtime computable p ointer to

the particular bit in question By appropriately padding the P function

one can use the middle bit to determine any other single bit Also one can

easily convert a GapP function to a P function without mo difying the

middle bit

P

We have that MP contains P and PP We also have MP P As

we will see in Corollary MP actually contains the entire p olynomial

time hierarchy

Lance Fortnow

Counting Operators

p

Given a set A and a p olynomial p we can dene the function as follows

A

p

pjxj

x jfy j hx y i Agj

A

Varying the complexity of A allows us to dene other complexity classes

We use this idea to dene counting op erators

An op erator maps one complexity class to another For example we

dene the class C as follows

Denition C consists of the set of functions f such that for some

p

A C and some polynomial p we have for al l x f x x

A

We can dene the op erator Gap C as the dierence b etween two C

functions Note that P P and Gap P GapP

We can also use counting op erators to generate language classes as well

as function classes by generalizing the classications in Section

Classication The class P C consists of those languages L such that

for some Gap C function f and al l x in

If x is in L then f x

If x is not in L then f x

In fact one can generalize all of the classications in Section in a

similar way For further details and a history of counting op erators see the

survey by Hemaspaandra and Vollmer HV

The PolynomialTime Hierarchy

We can combine the results in Sections and to help us understand the

relationship b etween counting classes and the p olynomialtime hierarchy

We will now complete the pro of of the following b eautiful result of

Seinosuke To da To d

Theorem

GapP

PH P

By Corollary and Theorem we immediately get the following

corollaries

Corollary

P

PH P

PP

PH P

Counting Complexity

First we prove some lemmas relating the p olynomialtime hierarchy to

counting op erators on counting classes

Lemma

PH P PP

PH P P

PH P C P

Pro of We will prove only the second item of Lemma The other

two have similar pro ofs

Fix a language L in PH Consider the characteristic function that

L

takes on the value one for x L and zero otherwise

PH

Since GapP we can apply Theorem to get a GapP function

L

g such that

Pr g x r x

L

q (n)

r

and thus for every x

If x L then

q n q n

jfr j g x r gj jfr j g x r gj

If x L then

q n q n

jfr j g x r gj jfr j g x r gj

Consider the set A consisting of hx r i such that g x r is o dd Since

g x r is in GapP we have A in P Let f b e the GapP function dened

p p

by x x We have that L is in P P by Classication 2

A

A

A couple of notes ab out Lemma

One can replace P with BP in each item of Lemma where

BP represents a b ounded error version of P We refer the interested

reader to the pap er of To da and Ogihara TO for more details

The statement PH P SPP do es not follow directly using the

techniques of the pro of of Lemma Though for most r g x r

f g there may b e some r where g x r takes on other values

Pro of of Theorem Fix L in PH By Lemma we have L

in P P In other words there exist a GapP function g and a p olynomial

q such that x is in L if and only if

q n q n

jfr j g x r mo d gj jfr j g x r mo d gj

Let R and R represent these two sets resp ectively

While this function g do es not directly lead to a pro of of Theorem

we can use g to create a new GapP function g with more useful prop erties

Lance Fortnow

Lemma For every polynomial p there exists a GapP function g such

that for al l x and r

pn

If g x r mo d then gx r mo d and

pn

if g x r mo d then gx r mo d

First we show how to use Lemma to nish the pro of of Theorem

Let pn q n and let g b e the result of applying Lemma to g

Consider the GapP function h dened by

X

gx r hx

q (n)

r

Note that

X

pn pn

gx r mo d hx mo d

q (n)

r

X X

pn pn

gx r mo d gx r mo d

r R r R

1 0

X X

pn pn

g x r mo d g x r mo d

r R r R

1 0

pn

jR j mo d

jR j

q n pn

since jR j

pn q n

We have that x is in L if and only if hx mo d We can

thus determine whether x is in L by a single query to the GapP function

h 2

We do not need the entire value of hx We have that x is in L if and

only if the q nth bit from the right of hx is one Thus we get the following

corollary ab out the surprising p ower of MP

Corollary PH P P MP

Pro of of Lemma Consider the inno cuous lo oking p olynomial

f m m m This p olynomial has the following easily veriable

prop erties for every p ositive integer m and i

i i

If m mo d then f m mo d

i i

If m mo d then f m mo d

k

Consider f the function f iterated k times We have

k

k

If m mo d then f m mo d

k

k

If m mo d then f m mo d

Counting Complexity

dlog pne

2

Dene gx r f g x r By the prop erty of f g fullls the

conditions required by Lemma

k

We need to argue that g is a GapP function Note that f m is a

k dlog pne

2

p olynomial in m of degree The degree of f is b ounded by

log pn log pn log log pn log

2 2 2 2 2

pn pn still

a p olynomial in n Thus by appropriately applying Lemma we have

that g is a GapP function 2

Note To da To d proved a version of Lemma using a dierent

f We nd it simpler to use the function f given by Yao Yao See

Beigel and Tarui BT for an indepth lo ok at these mo dulusamplifying

p olynomials

Closure Properties of PP

In his original pap er on probabilistic complexity classes Gill Gil showed

that PP is closed under complement Corollary Gill left op en the

question as to whether PP is closed under union Note that by DeMorgans

Law since PP is closed under complement closure under union and closure

under intersection are equivalent questions

This question remained op en for many years until Beigel Reingold and

Spielman BRS showed that in fact the class PP is closed under union

and thus intersection In this section we will present the basic idea of that

pro of

Beigel Reingold and Spielman extending work of Newman New

develop ed some rational functions that closely approximated the sign func

tion A rational function is a quotient of two p olynomials

Let m b e an even p ositive integer Based on similar p olynomials due to

Beigel Reingold and Spielman we dene

m

Y

i

P z z z

m

i

m m

2 2

P z A P z

m m m

m m

2 2

B P z P z

m m m

A

m

S

m

B

m

Lemma BRS

m m

If z then S

m

m m

If z then S

m

Note that if f is a GapP function and m is a p olynomial in jxj with even

co ecients we have that A f and B f are also GapP computable

m m

functions This follows from the closure prop erties in Section

Lance Fortnow

We now use Lemma to show the following main result from the

pap er of Beigel Reingold and Spielman BRS

Theorem The class PP is closed under union

Pro of Fix two languages D and E in PP We will show that D E is

also in PP

Let f and f b e the functions given by Classication for D and

D E

E resp ectively By Lemma let m mjxj b e a p olynomial with even

m

co ecients such that b ounds the maximum absolute value of f x and

D

f x Dene A x A f x Similarly dene B S A B and

E D m D D D E E

S Note that A B A and B are GapP functions

E D D E E

Let H S S By Lemma we have

D E

Lemma

If x D and x E then H x

m

If x D and x E then H x

m

If x D and x E then H x

If x D and x E then H x

Thus we have that x D E if and only if H x

We would b e nished if H were a GapP function but unfortunately it

may even take on nonintegral values We do have

A A B A B B B A

E D E E D D E D

H

B B B B

D E D E

Note that for nonzero integers p and q we have pq if and only if pq

Thus we dene

H A B A B B B B B

D E E D D E D E

We have that

H is a GapP function

For all x H x if and only if H x

x D E if and only if H x

we have D E PP 2 Finally applying Classication to H

Beigel Reingold and Spielman BRS also showed several stronger clo

sure prop erties Fortnow and Reingold FR extend the work of Beigel

Reingold and Spielman to show that PP is closed under truthtable reduc

tion and in fact constantround truthtable reductions However showing

that PP is closed under Turing reductions would require some nonrelativiz

ing pro of techniques see Section

Counting Complexity

Relativization

The results in this pap er show that one complexity class contains another

or that some complexity classes have certain closure prop erties One would

also hop e to see separation results like a pro of showing for example that

PP P

The current to ols in computational complexity theory do not allow us to

achieve this goal In fact it could b e that P PSPACE Such a circum

stance would make most of the results in this pap er quite trivial and would

collapse all the counting classes in Section While we do not b elieve that

P PSPACE we cannot rule out this p ossibility with known techniques

Recall the denitions of oracle Turing machines and relativized complex

ity classes dened in Section Besides using oracles to dene complexity

classes we can also use oracles to help us understand what complexity

problems may require new techniques

Consider a relativized version of Theorem

A

Theorem For al l oracles A the class PP is closed under union

Pro of Fix an oracle A If we analyze the pro of of Theorem allowing

all Turing machines to have access to A as an oracle the pro of go es through

without additional change 2

In fact all of the pro ofs in this survey have this relativization prop erty

Supp ose that we had a hyp othesis like P NP If we can create a relativized

A A

world an oracle A where P NP then to prove P NP would

require techniques that do not relativize of which we know few If we also

B B

could create an oracle B such that P NP then in fact we could

not even settle the P NP question in either direction using relativizable

techniques In fact Baker Gill and Solovay BGS have created such

oracles to draw these conclusions

Most pro ofs in complexity theory relativize For more details on the role

of relativization see For

Consider the PSPACEcomplete language TQBF Note that

TQBF

PSPACE PSPACE

By setting A TQBF we have

A A

Theorem There exists an oracle A such that P PSPACE

Thus no relativizable pro of exists that separates P from PSPACE

If P PSPACE then all of the counting classes are equal to P and all

are closed under full Turing reductions Thus any pro of that two count

ing classes dier or some counting class is not closed under some simple

reduction would require nonrelativizing techniques

Thus the only theorems that we can prove with current techniques will

collapse classes and show closure prop erties However we can also use rel

ativization to show the limits of this pro cess

Lance Fortnow

Beigel Bei has develop ed one of the more useful oracles p ertaining to

counting complexity

A

NP

Theorem There exists an oracle A such that P is not contained

A

in PP

This oracle implies some imp ortant corollaries ab out the limits of rela

tivizable techniques in counting complexity some of which are listed b elow

These corollaries were known prior to Beigels construction but Beigels

work unied these results

Corollary There exists a relativized world where

PP is not closed under Turing reductions

PP does not contain the polynomialtime hierarchy

PP does not contain MP

Pro of

If PP is closed under Turing reductions for all relativized worlds then

NP PP

P P PP contradicting Theorem

NP

Immediate since P PH

Immediate since PH MP 2

Yaos Yao Has original oracle Y giving a relativized world where

Y Y

PH PSPACE

actually shows that

Y Y

P PH

Oracles also help us examine the relationships b etween NP P C P

and PP

Theorem Tor Bei There exists an oracle A such that

A A

P PP

A A A A

NP P thus PP P

A A A A

NP C P thus PP C P

It app ears hard to guess at the p ower of SPP In one sense b ecause of

its restrictive denition it seems as though it should not have much p ower

However the pro of of Lemma seems to indicate that SPPlike b ehavior

may have tremendous p ower Dierent oracles bring out this division

Theorem There exist oracles A and B such that

Counting Complexity

A

The polynomialtime hierarchy is innite relative to A and P

A

SPP

B

The polynomialtime hierarchy is innite relative to B and SPP

B

strictly contains PH

One nagging relativization question remains op en

Op en Question Does there exist an oracle A such that

A

P A

P PSPACE

In fact even the following weaker question remains op en

Op en Question Does there exist an oracle A such that

A

P A

PP PSPACE

Other Work

Such a short survey cannot p ossibly do justice to the large and vibrant

area of counting complexity Instead of taking on the nearimp ossible task

of surveying the entire area this pap er has concentrated on lo oking at a

few results in depth to give the reader some avor of the imp ortance of

counting complexity In this section we would like to describ e briey some

other work in the area and some of the applications to other areas

Circuits

The techniques from counting complexity have played an imp ortant role

in helping us understand the p ower of b oundeddepth circuits For a back

ground in circuit complexity we recommend the survey of Boppana and

Sipser BS

A PP question measures whether a certain numb er of computation paths

accept One can draw an analogy to threshold gates in a circuit that de

termine whether some numb er of inputs are true Many of the techniques

describ ed in this survey have direct applications to circuit complexity par

ticularly in showing how to use threshold gates to simulate certain AND OR

circuits and also to use some numb er of threshold gates to simulate many

of them

For example Allender All Beigel Reingold and Spielman BRS

and Tarui Tar show how to use Theorem to simulate b ounded

depth AND OR circuits by small depth circuits with a single threshold

gate on top

Lance Fortnow

One can similarly draw an analogy b etween Mo d P computations and

k

the class ACC of b ounded depth circuits with Mo d gates for some xed

k

k Results of Yao Yao Beigel and Tarui BT and Green Kobler

Regan Schwentick and Toran GKR show how to simulate any ACC

circuit by a depth circuit with a symmetric gate on top Allender and

Gore AG use these characterizations to separate uniform ACC from

the counting class PP Barrington Bar gives a nice survey of these

techniques and results

Lowness

Complexity theorists often ask ab out the lowness of a class ie the amount

of information absorb ed by a complexity class Formally for a class C we

dene LowC by

L

LowC fL j C C g

Note that lowness dep ends not only on the memb ership of a class C but may

also dep end on the denition of C as well as the oracle access mechanism

Some results on lowness

Theorem

LowNP NP coNP

LowGapP LowSPP SPP FFK

LowMo d P Mo d P for prime k PZ BG Her

k k

LowMP contains PH and Mo d P for al l k GKR

k

LowPSPACE PSPACE

A nice characterization of LowPP remains an interesting op en question

Characterizing Specic Problems

As mentioned in the intro duction Valiant Vala dened the class P

sp ecically to capture the complexity of the p ermanent function A p erma

nent of a matrix is similar to the determinant except that all of the terms

are added instead of subtracting alternating terms While the determinant

is easy to compute using Gaussian elimination computing the p ermanent

Permanent

is Pcomplete ie P FP

In a later pap er Valiant Valb showed the Pcompleteness of sev

eral other combinatorial problems Most counting versions of NPcomplete

problems are Pcomplete as are also some counting versions of p olynomial

time computable problems like counting the numb er of simple paths or

p erfect matchings in a graph

Counting Complexity

Kobler Schoning and J Toran KST used counting complexity to

classify the graph isomorphism and automorphism problem They show

that SPP contains graph automorphism and LowPP contains graph iso

morphism

Interactive Proof Systems

Interactive pro of systems develop ed by Babai Bab BM and Gold

wasser Micali and Racko GMR give a probabilistic generalization of

nondeterminism In order to show a proto col for the coNP languages Lund

Fortnow Karlo and Nisan LFKN created an interactive pro of system

for the Pcomplete p ermanent function To this day the only known pro

to cols for coNP require counting complexity

The Lund Fortnow Karlo and Nisan proto col forms the core of much

of the subsequent work in interactive pro of systems that led to exciting

applications in program checking and hardness results for approximation

algorithms

Counting in Space Classes

Instead of using nondeterministic p olynomialtime Turing machines one

can also consider counting the accepting computations of nondeterministic

logarithmicspace b ounded machines One can then dene various classes

at this level such as L GapL PL and L One can show that the de

terminant function is complete for L much the way that the p ermanent

function is complete for P AO

Many of the results mentioned in this survey such as Theorem

carry over to the logspace world

Other Research

We still have not mentioned many other active areas of research in counting

complexity A small sampling includes the following

A counting hierarchy exists that is analogous to the p olynomialtime

hierarchy Wag

A general denition of counting classes FFK

The complexity of approximating counting functions JVV

Showing that closure prop erties of counting classes and functions im

ply various unknown collapses of other classes OH

Generalizations of counting to other functions on the accept and re

ject paths of nondeterministic machines HLS

Lance Fortnow

Recent work in quantum complexity seems to deal with counting

complexity except that counting is done in quite a dierent way See

the survey by Berthiaume Ber in this volume

Counting complexity has played an imp ortant role in theoretical com

puter science in the past two decades We exp ect that the results and

techniques we learned from this study will play a signicant role in future

research

Acknow ledgments Thanks to Steve Homer for his careful reading of this

pap er Thanks also to Fred Green for his help on the relationship b etween

counting complexity and circuit complexity

References

AG E Allender and V Gore A uniform circuit lower b ound for the p er

manent SIAM Journal on Computing

All E Allender A note on the p ower of threshold circuits In Proceedings

of the th IEEE Symposium on Foundations of Computer Science

pages IEEE New York

AO E Allender and M Ogihara Relationships among PL L and the

determinant In Proceedings of the th IEEE Structure in Complexity

Theory Conference pages IEEE New York

Bab L Babai Trading group theory for randomness In Proceedings of the

th ACM Symposium on the Theory of Computing pages

ACM New York

Bar D Barrington Quasip olynomial size circuit classes In Proceedings

of the th IEEE Structure in Complexity Theory Conference pages

IEEE New York

Bei R Beigel Relativized counting classes relations among thresh

olds parity and mo ds Journal of Computer and System Sciences

Bei R Beigel Perceptrons PP and the p olynomial hierarchy Computa

tional Complexity

Ber A Berthiaume Quantum computation In Complexity Theory Retro

spective II L Hemaspaandra and A Selman eds chapter this

volume

BF L Babai and L Fortnow Arithmetization A new metho d in struc

tural complexity theory Computational Complexity

BF H Buhrman and L Fortnow Distinguishing complexity and symme

try of information Technical Rep ort TR University of Chicago

Department of Computer Science

BG R Beigel and J Gill Counting classes Thresholds parity mo ds and

fewness Theoretical Computer Science

BGS T Baker J Gill and R Solovay Relativizations of the P NP

question SIAM Journal on Computing

Counting Complexity

BM L Babai and S Moran ArthurMerlin games a randomized pro of

system and a hierarchy of complexity classes Journal of Computer

and System Sciences

BRS R Beigel N Reingold and D Spielman The p erceptron strikes back

In Proceedings of the th IEEE Structure in Complexity Theory Con

ference pages IEEE New York

BRS R Beigel N Reingold and D Spielman PP is closed under inter

section Journal of Computer and System Sciences

BS R Boppana and M Sipser The complexity of nite functions In

J van Leeuwen editor Handbook of Theoretical Computer Science

chapter pages NorthHolland Amsterdam

BT R Beigel and J Tarui On ACC Computational Complexity

FFK S Fenner L Fortnow and S Kurtz Gapdenable counting classes

Journal of Computer and System Sciences

For L Fortnow The role of relativization in complexity theory Bul letin of

the European Association for Theoretical Computer Science

February

FR L Fortnow and N Reingold PP is closed under truthtable reduc

tions Information and Computation

Gil J Gill Computational complexity of probabilistic complexity classes

SIAM Journal on Computing

+

GKR F Green J Kobler K Regan T Schwentick and J Toran The

p ower of the middle bit of a P function Journal of Computer and

System Sciences

GMR S Goldwasser S Micali and C Racko The knowledge complexity

of interactive pro ofsystems SIAM Journal on Computing

Has J Hastad Almost optimal lower b ounds for small depth circuits

In S Micali editor Randomness and Computation volume of Ad

vances in Computing Research pages JAI Press Greenwich

Her U Hertrampf Relations among MOD classes Theoretical Computer

Science

+

HLS U Hertrampf C Lautemann T Schwentick H Vollmer and

K Wagner On the p ower of p olynomial time bitreductions In Pro

ceedings of the th IEEE Structure in Complexity Theory Conference

pages IEEE New York

HU JE Hop croft and JD Ullman Introduction to Automata Theory

Languages and Computation AddisonWesley Reading Mass

HV L Hemaspaandra and H Vollmer The satanic notations Counting

classes b eyond P and other denitional adventures SIGACT News

JVV M Jerrum L Valiant and V Vazirani Random generation of combi

natorial structures from a uniform distribution Theoretical Computer

Science

KST J Kobler U Schoning and J Toran Graph isomorphism is low for

PP Computational Complexity

Lance Fortnow

LFKN C Lund L Fortnow H Karlo and N Nisan Algebraic metho ds for

interactive pro of systems Journal of the ACM

MS A Meyer and L Sto ckmeyer The equivalence problem for regular

expressions with squaring requires exp onential space In Proceedings

of the th IEEE Symposium on Switching and Automata Theory

pages IEEE New York

MVV K Mulmuley U Vazirani and V Vazirani Matching is as easy as

matrix inversion Combinatorica

New D Newman Rational approximations to jxj Michigan Mathematics

Journal

Nis N Nisan Pseudorandom bits for constantdepth circuits Combina

torica

NW N Nisan and A Wigderson Hardness vs randomness Journal of

Computer and System Sciences

OH M Ogiwara and L Hemachandra A complexity theory of feasible

closure prop erties In Proceedings of the th IEEE Structure in Com

plexity Theory Conference pages IEEE New York

PZ C Papadimitriou and S Zachos Two remarks on the p ower of count

ing In Proceedings of the th GI Conference on Theoretical Computer

Science pages Volume Lecture Notes in Computer Sci

ence Springer Berlin

Rog H Rogers Theory of Recursive Functions and Eective Computabil

ity MIT Press Cambridge

Sch U Schoning The p ower of counting In A Selman editor Complexity

Theory Retrospective pages Springer New York

Sho V Shoup New algorithms for nding irreducible p olynomials over

nite elds Mathematics of Computation

0

Tar J Tarui Probabilistic p olynomials AC functions and the p oly

nomialtime hierarchy Theoretical Computer Science

TO S To da and M Ogiwara Counting classes are at least as hard as the

p olynomialtime hierarchy SIAM Journal on Computing

To d S To da PP is as hard as the p olynomialtime hierarchy SIAM Jour

nal on Computing

Tor J Toran Structural prop erties of the counting hierarchies PhD the

sis Facultat dInformatica UPC Barcelona January

Vala L Valiant The complexity of computing the p ermanent Theoretical

Computer Science

Valb L Valiant The complexity of reliability and enumeration problems

SIAM Journal on Computing

VV L Valiant and V Vazirani NP is as easy as detecting unique solu

tions Theoretical Computer Science

Wag K Wagner The complexity of combinatorial problems with succinct

input representation Acta Informatica

Yao A Yao Separating the p olynomialtime hierarchy by oracles In Pro

ceedings of the th IEEE Symposium on Foundations of Computer

Science pages IEEE New York

Counting Complexity

Yao A Yao On ACC and threshold circuits In Proceedings of the st

IEEE Symposium on Foundations of Computer Science pages

IEEE New York