Characterizations and approximability of hard counting classes below #P
aa r X i v : . [ c s . CC ] M a y Characterizations and approximability of hardcounting classes below P Eleni Bakali, Aggeliki Chalki, and Aris Pagourtzis
School of Electrical and Computer Engineering,National Technical University of Athens, 15780 Athens, Greece [email protected], [email protected], [email protected]
Abstract.
An important objective of research in counting complexity isto understand which counting problems are approximable. In this quest,the complexity class
TotP , a hard subclass of P , is of key importance,as it contains self-reducible counting problems with easy decision version,thus eligible to be approximable. Indeed, most problems known so far toadmit an fpras fall into this class.An open question raised recently by the community of descriptive com-plexity is to find a logical characterization of TotP and of robust sub-classes of
TotP . In this work we define two subclasses of
TotP , in termsof descriptive complexity, both of which are robust in the sense that theyhave natural complete problems, which are defined in terms of satisfia-bility of Boolean formulae.We then explore the relationship between the class of approximablecounting problems and
TotP . We prove that
TotP * FPRAS if and onlyif NP = RP and FPRAS * TotP unless RP = P . To this end we introducetwo ancillary classes that can both be seen as counting versions of RP .We further show that FPRAS lies between one of these classes and acounting version of
BPP .Finally, we provide a complete picture of inclusions among all the classesdefined or discussed in this paper with respect to different conjecturesabout the NP vs. RP vs. P questions. The class P [23] is the class of functions that count the number of solutions toproblems in NP , e.g. is the function that on input a formula φ returns thenumber of satisfying assignments of φ. Equivalently, functions in P count ac-cepting paths of non-deterministic polynomial time Turing machines (NPTMs). NP -complete problems are hard to count, but it is not the case that problemsin P are easy to count as well. When we consider counting, non-trivial facts hold.First of all there exist P -complete problems, that have decision version in P , e.g. . Moreover, some of them can be approximated, e.g. the Permanent [13]and [14], while others cannot, e.g. [8]. The class of problems in P with decision version in P is called PE , and a subclass of PE is TotP ,which contains all self-reducible problems in PE [18]. Their significance will beapparent in what follows.ince many counting problems cannot be exactly computed in polynomialtime, the interest of the community has turned to the complexity of approxi-mating them. On one side, there is an enormous literature on approximationalgorithms and inapproximability results for individual problems in P [8, 10,13, 14, 23]. On the other hand, there have been attempts to classify countingproblems with respect to their approximability [2, 3, 9, 20]. Related work.
From a unifying point of view, the most important results re-garding approximability are the following. Every function in P either admitsan fpras, or does not admit any polynomial approximation ratio [21]; we willtherefore call the latter inapproximable . For self-reducible problems in P , fprasis equivalent to almost uniform sampling [21]. With respect to approximationpreserving reductions, there are three main classes of functions in P [9]: (a) theclass of functions that admit an fpras, (b) the class of functions that are interre-ducible with , and (c) the class RHΠ of problems that are interreduciblewith . Problems in the second class do not admit an fpras unless NP = RP ,while the approximability status of problems in the third class is unknown andthe conjecture is that they are neither interreducible with , nor they admitan fpras. We will denote FPRAS the class of P problems that admit an fpras.Several works have attempted to provide a structural characterization thatexactly captures FPRAS , in terms of path counting [4, 18], interval size func-tions [5], or descriptive complexity [3]. Since counting problems with NP -completedecision version are inapproximable unless NP = RP [9], those that admit fprasshould be found among those with easy decision version (i.e., in BPP or evenin P ). Even more specifically, in search of a logical characterization of a classthat exactly captures FPRAS , Arenas et al. [3] show that subclasses of
FPRAS are contained in
TotP , and they implicitly propose to study subclasses of
TotP with certain additional properties in order to come up with approximable prob-lems. Notably, most problems proven so far to admit an fpras belong to
TotP ,and several counting complexity classes proven to admit an fpras, namely Σ , RΣ [20], ΣQSO ( Σ ) , ΣQSO ( Σ [ FO ]) [3] and spanL [2], are subclasses of TotP .Counting problems in P have also been studied in terms of descriptivecomplexity [3, 6, 7, 9, 20]. Arenas et al. [3] raised the question of defining classesin terms of descriptive complexity that capture either TotP or robust subclassesof
TotP , as one of the most important open questions in the area. A robust classof counting problems needs either to have a natural complete problem or to beclosed under addition, multiplication and subtraction by one [3]. In particular,
TotP satisfies both of the above properties [3, 4].
Our contribution.
In the first part of the paper we focus on the exploration ofthe structure of P through descriptive complexity. In particular, we define twosubclasses of TotP , namely
ΣQSO ( Σ - ) and Π - , via logical char-acterizations; for both these classes we show robustness by providing naturalcomplete problems for them. Namely, we prove that the problem f computing the number of satisfying assignments to disjunctions of 2SAT for-mulae is complete for ΣQSO ( Σ - ) under parsimonious reductions. This re-veals that problems hard for ΣQSO ( Σ - ) under parsimonious reductionscannot admit an fpras unless NP = RP . We also prove that iscomplete for Π - under product reductions. Our result is the first com-pleteness result for under reductions stronger than Turing.Notably, the complexity of has been investigated in [12, 5]and it is still open whether it is complete for TotP , or for a subclass of
TotP under reductions for which the class is downwards closed. Although, Π - is not known to be downwards closed under product reductions, our result is astep towards understanding the exact complexity of . P BPP
PE FPRASTotP ? Fig. 1.
Relation of
FPRAS tocounting classes below P . In the second part of this paper we ex-amine the relationship between the class
TotP and
FPRAS . As we already mentioned, most(if not all) problems proven so far to admitfpras belong to
TotP , so we would like to ex-amine whether
FPRAS ⊆ TotP . Of course,problems in
FPRAS have decision version in
BPP [11], so if we assume P = BPP this isprobably not the case. Therefore, a more re-alistic goal is to determine assumptions underwhich the conjecture
FPRAS ⊆ TotP might betrue. The world so far is depicted in Figure 1,where
BPP denotes the class of problems in P with decision version in BPP .In this work we refine this picture by proving that (a)
FPRAS * TotP unless RP = P , which means that proving FPRAS ⊆ TotP would be at least as hard asproving RP = P , (b) TotP * FPRAS if and only if NP = RP , (c) FPRAS liesbetween two classes that can be seen as counting versions of RP and BPP , and(d)
FPRAS ′ , which is the subclass of FPRAS with zero error probability when thefunction value is zero, lies between two classes that we introduce here, that canboth be seen as counting versions of RP , and which surprisingly do not coincideunless RP = NP . Finally, we give a complete picture of inclusions among all theclasses defined or discussed in this paper with respect to different conjecturesabout the NP vs. RP vs. P questions. TotP
In this section we give the logical characterization of two robust subclasses of
TotP . Each one of them has a natural complete problem. Two kinds of reductionswill be used for the completeness results; parsimonious and product reductions.Note that both of them preserve approximations of multiplicative error [9, 20].
Definition 1.
Let f , g : Σ ∗ → N be two counting functions.(a) We say that there is a parsimonious (or Karp) reduction from f to g ,symb. f ≤ pm g , if there is a polynomial-time computable function h , such thatfor every x ∈ Σ ∗ it holds that f ( x ) = g ( h ( x )) .b) We say that there is a product reduction from f to g , symb. f ≤ pr g , ifthere are polynomial-time computable functions h , h such that for every x ∈ Σ ∗ it holds that f ( x ) = g ( h ( x )) · h ( x ) . The formal definitions of the classes P , FP , PE and TotP follow.
Definition 2. (a) [23] P is the class of functions f for which there exists apolynomial-time decidable binary relation R and a polynomial p such that for all x ∈ Σ ∗ , f ( x ) = (cid:12)(cid:12) { y ∈ { , } ∗ | | y | = p ( | x | ) and R ( x, y ) } (cid:12)(cid:12) .Equivalently, P = { acc M : Σ ∗ → N | M is an NPTM } .(b) FP is the class of functions in P that are computable in polynomialtime.(c) [18] PE = { f : Σ ∗ → N | f ∈ P and L f ∈ P } , where L f = { x ∈ Σ ∗ | f ( x ) > } is the decision version of the function f .(d) [18] TotP = { tot M : Σ ∗ → N | M is an NPTM } , where tot M ( x ) = allcomputation paths of M on input x ) − . ΣQSO ( Σ - ) In order to define the first class we make use of the framework of QuantitativeSecond-Order Logics (QSO) defined in [3].Given a relational vocabulary σ , the set of First-Order logic formulae over σ is given by the grammar: φ := x = y | R ( −→ x ) | ¬ φ | φ ∨ φ | ∃ xφ | ⊤ | ⊥ where x, y are first-order variables, R ∈ σ , −→ x is a tuple of first order variables, ⊤ represents a tautology, and ⊥ represents the negation of a tautology.We define a literal to be either of the form X ( −→ x ) or ¬ X ( −→ x ) , where X is asecond-order variable and −→ x is a tuple of first-order variables. A 2SAT clauseover σ is a formula of the form φ ∨ φ ∨ φ , where each of the φ i ’s, ≤ i ≤ ,can be either a literal or a first-order formula over σ . In addition, at least one ofthem is a first-order formula. The set of Σ -2SAT formulae over σ are given by: ψ := ∃−→ x ∀−→ y k ^ j =1 C j ( −→ x , −→ y ) where −→ x , −→ y are tuples of first-order variables, k ∈ N and C j are 2SAT clausesfor every ≤ j ≤ k .The set of ΣQSO ( Σ - ) formulae over σ is given by the following gram-mar: α := φ | s | ( α + α ) | Σx.α | ΣX.α where φ is a Σ -2SAT formula, s ∈ N , x is a first-order variable and X is asecond-order variable. The syntax of ΣQSO ( Σ - ) formulae includes thecounting operators of addition + , Σx , ΣX . Specifically, Σx , ΣX are calledfirst-order and second-order quantitative quantifiers respectively. [ φ ]]( A , v, V ) = ( , if A | = φ , otherwise [[ s ]]( A , v, V ) = s [[ α + α ]]( A , v, V ) = [[ α ]]( A , v, V ) + [[ α ]]( A , v, V )[[ Σx.α ]]( A , v, V ) = X a ∈ A [[ α ]]( A , v [ a/x ] , V )[[ ΣX.α ]]( A , v, V ) = X B ⊆ A arity ( X ) [[ α ]]( A , v, V [ B/X ]) Table 1.
The semantics of
ΣQSO ( Σ - ) formulae Let σ be a relational vocabulary, A a σ -structure with universe A , v a first-order assignment for A and V a second-order assignment for A . Then the evalu-ation of a ΣQSO ( Σ - ) formula α over ( A , V, v ) is defined as a function [[ α ]] that on input ( A , V, v ) returns a number in N . The function [[ α ]] is recursivelydefined in Table 1. A ΣQSO ( Σ - ) formula α is said to be a sentence if itdoes not have any free variable, that is, every variable in α is under the scopeof a usual quantifier ( ∃ , ∀ ) or a quantitative quantifier. It is important to noticethat if α is a ΣQSO ( Σ - ) sentence over a vocabulary σ , then for every σ -structure A , first-order assignments v , v for A and second-order assignments V , V for A , it holds that [[ α ]]( A , v , V ) = [[ α ]]( A , v , V ) . Thus, in such a casewe use the term [[ α ]]( A ) to denote [[ α ]]( A , v, V ) for some arbitrary first-orderassignment v and some arbitrary second-order assignment V for A .At this point it is clear that for any ΣQSO ( Σ - ) formula α , a function [[ α ]] is defined. In the rest of the paper we will use the same notation, namely ΣQSO ( Σ - ) , both for the set of formulae and the set of corresponding count-ing functions. The following inclusion holds between the class
RHΠ [9] and the class ΣQSO ( Σ - ) defined presently. Proposition 1.
RHΠ ⊆ ΣQSO ( Σ - ) Proof . A function f is in the class RHΠ if it can be expressed in the form f ( A ) = |{h−→ X , −→ x i : A | = ∀−→ y ψ ( −→ y , −→ x , −→ X ) }| , where ψ is an unquantified CNFformula in which each clause has at most one occurrence of an unnegated variablefrom −→ X , and at most one occurrence of a negated variable from −→ X . Alternatively,the function f can be expressed in the form [[ Σ −→ X .Σ −→ x . ∀−→ y ψ ( −→ y , −→ x , −→ X )]]( A ) . TheRestricted-Horn formula ψ is also a 2SAT formula.Therefore, f ∈ ΣQSO ( Σ - ) . (cid:3) The class
ΣQSO ( Σ - ) contains problems that are tractable, such as , which is known to be computable in polynomial time [10]. It also con-tains all the problems in RHΠ , such as , , [9]. Moreover, we will use the terms ‘(counting) problem’ and ‘(counting) function’ in-terchangeably throughout the paper. hese three problems are complete for
RHΠ under approximation preservingreductions and are not believed to have an fpras. At last, the problem [9],which is interriducible with under approximation preserving reductions,belongs to ΣQSO ( Σ - ) as well.We next show that a generalization of , which we will call ,is complete for ΣQSO ( Σ - ) under parsimonious reductions. Membership of in ΣQSO ( Σ - ) In propositional logic, a 2SAT formula is a conjunction of clauses that containat most two literals. Suppose we are given a propositional formula φ , which is adisjunction of 2SAT formulae, then on input φ equals the numberof satisfying assignments of φ .In this subsection we assume that 2SAT formulae consist of clauses whichcontain exactly two literals since we can rewrite a clause of the form l as l ∨ l ,for any literal l . Theorem 1. ∈ ΣQSO ( Σ - ) Proof . Consider the vocabulary σ = { C , C , C , C , D } where C i , ≤ i ≤ ,are ternary relations and D is a binary relation. This vocabulary can encode anyformula which is a disjunction of 2SAT formulae. More precisely, C ( c, x, y ) iffclause c is of the form x ∨ y , C ( c, x, y ) iff c is ¬ x ∨ y , C ( c, x, y ) iff c is x ∨ ¬ y , C ( c, x, y ) iff c is ¬ x ∨ ¬ y and D ( d, c ) iff clause c appears in the “disjunct” d .Let φ be an input to encoded by an ordered σ -structure A = h A, C , C , C , C , D i , where the universe A consists of elements representingvariables, clauses and “disjuncts”. Then, it holds that the number of satisfyingassignments of φ is equal to [[ ΣT.ψ ( T )]]( A ) , where ψ ( T ) := ∃ d ∀ c ∀ x ∀ y (cid:0) ( ¬ D ( d, c ) ∨ ¬ C ( c, x, y ) ∨ T ( x ) ∨ T ( y )) ∧ ( ¬ D ( d, c ) ∨ ¬ C ( c, x, y ) ∨ ¬ T ( x ) ∨ T ( y )) ∧ ( ¬ D ( d, c ) ∨ ¬ C ( c, x, y ) ∨ T ( x ) ∨ ¬ T ( y )) ∧ ( ¬ D ( d, c ) ∨ ¬ C ( c, x, y ) ∨ ¬ T ( x ) ∨ ¬ T ( y ) (cid:1) Thus,
Disj2Sat is defined by
ΣT.ψ ( T ) which is in ΣQSO ( Σ - ) . (cid:3) Hardness of
Suppose we have a formula α in ΣQSO ( Σ - ) and an input structure A overa vocabulary σ . We describe a polynomial-time reduction that given α and A ,it returns a propositional formula φ α A which is a disjunction of 2SAT formulaeand it holds that [[ α ]]( A ) = Disj2Sat ( φ α A ) . The reduction is a parsimoniousreduction, i.e. it preserves the values of the functions involved. Theorem 2. is hard for
ΣQSO ( Σ - ) under parsimonious re-ductions.roof . By Proposition 5.1 of [3], α can be written in the form m X i =1 Σ −→ X i .Σ −→ x . ∃−→ y ∀−→ z n ^ j =1 C ij ( −→ X i , −→ x , −→ y , −→ z ) , where each −→ X i is a sequence of second-order variables and each C ij is a 2SAT clause. Each term of the sum can bereplaced by Σ −→ X .Σ −→ x . ∃−→ y ∀−→ z n ^ j =1 C ij ( −→ X i , −→ x , −→ y , −→ z ) ∧ ^ X X i ∀−→ u X ( −→ u ) where −→ X isthe union of all −→ X i . Now we have expressed α in the following form m X i =1 Σ −→ X .Σ −→ x . ∃−→ y ∀−→ z n ^ j =1 φ ij ( −→ X , −→ x , −→ y , −→ z ) .The next step is to expand the first-order quantifiers and sum operators andreplace their variables with first-order constants from the universe A .In this way, we obtain α A := m X i =1 X −→ a ∈ A |−→ x | Σ −→ X . _ −→ b ∈ A |−→ y | n ^ i =1 ^ −→ c ∈ A |−→ z | φ ij ( −→ X , −→ a , −→ b , −→ c ) .Each first-order subformula of φ ij has no free-variables and is either satisfied ornot satisfied by A , so we can replace it by ⊤ or ⊥ respectively. Also, after group-ing the sums and the conjunctions, we get m ′ X i =1 Σ −→ X . n _ j =1 n ^ k =1 ψ ij,k ( −→ X ) . The formulae ψ ij,k ( −→ X ) are conjunctions of clauses that consist of ⊥ , ⊤ and at most two literalsof the form X t ( −→ a l ) or ¬ X t ( −→ a l ) for some second-order variable X t and sometuple of first-order constants −→ a l . We can eliminate the clauses that contain a ⊤ and remove ⊥ from the clauses that contain it. After this simplification, somecombinations of variable-constants may not appear in the remaining formula.For any such combination X ( −→ a ) , we add a clause ψ X, −→ a := X ( −→ a ) ∨ ¬ X ( −→ a ) ,since X ( −→ a ) can have any truth value.So, we have reformulated the above formula and we get m ′ X i =1 Σ −→ X . n _ j =1 n ′ ^ k =1 ψ ij,k ( −→ X ) .After replacing every appearance of X t ( −→ a l ) by a propositional variable x tl , thepart n _ j =1 n ′ ^ k =1 ψ ij,k ( −→ X ) becomes a disjunction of 2SAT formulae. Finally, we intro-duce m ′ new propositional variables x , ...x m ′ and define φ α A := m ′ _ i =1 n _ j =1 n ′ ^ k =1 ψ ij,k ∧ x i ^ l = i ¬ x l . The formula φ α A is a disjunction of 2SATformulae and the number of its satisfying assignments is equal to [[ α ]]( A ) . More-over, every transformation we made requires polynomial time in the size of theinput structure A . (cid:3) It is known that has no fpras unless NP = RP , since it is equiva-lent to counting all independent sets in a graph [9]. Thus, problems hard for QSO ( Σ - ) under parsimonious reductions also cannot admit an fpras un-less NP = RP . Inclusion of
ΣQSO ( Σ - ) in TotP
Several problems in
ΣQSO ( Σ - ) , like , , , and , are also in TotP . We next prove that this is not a coincidence.
Theorem 3.
ΣQSO ( Σ - ) ⊆ TotP
Proof . Since
TotP is exactly the Karp closure of self-reducible functions of PE [18], it suffices to show that the ΣQSO ( Σ - ) -complete problem Disj2Sat is such a function.First of all,
Disj2Sat belongs to P . Thus Disj2Sat ∈ PE .Secondly, every counting function associated with the problem of count-ing satisfying assignments for a propositional formula is self-reducible . So Disj2Sat has this property as well.Therefore, any
ΣQSO ( Σ - ) formula α defines a function [[ α ]] that be-longs to TotP . (cid:3) Corollary 1.
RHΠ ⊆ TotP Π - To define the second class Π - , we make use of the framework presentedin [20].We say that a counting problem B belongs to the class Π - if forany ordered structure A over a vocabulary σ , which is an input to B , it holdsthat B ( A ) = |{h X i : A | = ∀−→ y ∃−→ z ψ ( −→ y , −→ z , X ) }| . The formula ψ ( −→ y , −→ z , X ) isof the form φ ( −→ y , −→ z ) ∧ X ( −→ z ) , where φ is a first-order formula over σ and X is apositive appearance of a second-order variable. We call the formula ψ a variable,since it contains only one second-order variable. Moreover, we allow countingonly the assignments to the second-order variable X under which the structure A satisfies ∀−→ y ∃−→ z ψ ( −→ y , −→ z , X ) . Proposition 2. ∈ Π - , where is the problem of counting thevertex covers of all sizes in a graph. TotP contains all self-reducible problems in P , with decision version in P . Intu-itively, self-reducibility means that counting the number of solutions to an instanceof a problem, can be performed recursively by computing the number of solutions tosome other instances of the same problem. For example, is self-reducible: thenumber of satisfying assignments of a formula φ is equal to the sum of the numberof satisfying assignments of φ and φ , where φ i is φ with its first variable fixed to i . roof . An input graph G to can be encoded as a finite structure G usingthe vocabulary σ = { E, End } , where E is the edge relation and End is a binaryrelation. The universe is the set of all vertices and all edges.
End ( u, e ) iff vertex u is an endpoint of edge e . Then, Vc ( G ) = |{h V C i | G | = ∀ x ∃ y (cid:16) End ( y, x ) ∧ V C ( y ) }| . Therefore, Vc ∈ Π - . (cid:3) Completeness of
MonotoneSat for Π - Given a propositional formula φ in conjunctive normal form, where all theliterals are positive, MonotoneSat on input φ equals the number of satisfyingassignments of φ . Theorem 4.
MonotoneSat ∈ Π - Proof . Consider the vocabulary σ = { C } with the binary relation C ( c, x ) toindicate that the variable x appears in the clause c . Given a σ -structure A = h A, C i that encodes a formula φ , which is an input to MonotoneSat , it holdsthat
MonotoneSat ( φ ) = |{h T i : A | = ∀ c ∃ x (cid:0) C ( c, x ) ∧ T ( x ) (cid:1) }| .Therefore, MonotoneSat ∈ Π - . (cid:3) Theorem 5.
MonotoneSat is hard for Π - under product reduc-tions.Proof . We show that there is a polynomial-time product reduction from any B ∈ Π - to MonotoneSat . This means that there are polynomial-time computable functions g and h , such that for every σ -strucrure A that is aninput to B we have B ( A ) = MonotoneSat (cid:0) g ( A ) (cid:1) · h ( | A | ) .Suppose we have a problem B ∈ Π - and a σ -structure A . Then,there exists a formula ψ of the form ψ ( −→ y , −→ z , X ) = φ ( −→ y , −→ z ) ∧ X ( −→ z ) such that B ( A ) = |{h X i : A | = ∀−→ y ∃−→ z ψ ( −→ y , −→ z , X ) }| .The formula ∀−→ y ∃−→ z ψ ( −→ y , −→ z , X ) can be written in the form ^ −→ a ∈ A |−→ y | _ −→ b ∈ A |−→ z | φ ( −→ a , −→ b ) ∧ X ( −→ b ) . By substituting first-order subformulae by ⊤ or ⊥ and simplifying, we obtain χ ψ A := n ^ i =1 n _ j =1 X ( −→ b i,j ) , where each −→ b i,j is a tuple of first-order constants.To define χ ψ A , we have simplified the subformulae containing ⊥ and ⊤ . As aresult, there may be some combinations of the second-order variable X and first-order constants that do not appear in χ ψ A . Let n ( A ) be the number of thesecombinations. The last transformation consists of replacing every X ( −→ b i,j ) witha propositional variable x ij , so we get the output of the function g , which is g ( A ) := n ^ i =1 n _ j =1 x i,j . This formula has no negated variables, so it can be an inputto MonotoneSat . Finally, since the missing n ( A ) variables can have anytruth value, we have B ( A ) = MonotoneSat (cid:0) g ( A ) (cid:1) · n ( A ) . (cid:3) nclusion of Π - in TotP
Theorem 6. Π - ∈ TotP
Proof . It is easy to prove that
MonotoneSat ∈ TotP and that
TotP is closedunder product reductions. Thus, the above results imply that every countingproblem in Π - belongs to TotP . (cid:3) TotP vs.
FPRAS
In this section we study the relationship between the classes
TotP and
FPRAS .First of all we give some definitions and facts that will be needed.
Theorem 7. [18] (a) FP ⊆ TotP ⊆ PE ⊆ P . The inclusions are properunless P = NP .(b) TotP is the Karp closure of self-reducible PE functions. We consider
FPRAS to be the class of functions in P that admit fpras, andwe also introduce an ancillary class FPRAS ′ . Formally: Definition 3.
A function f belongs to FPRAS if f ∈ P and there exists arandomized algorithm that on input x ∈ Σ ∗ , ǫ > , δ > , returns a value d f ( x ) such that Pr[(1 − ǫ ) f ( x ) ≤ d f ( x ) ≤ (1 + ǫ ) f ( x )] ≥ − δ in time poly( | x | , ǫ − , log δ − ).We further say that a function f ∈ FPRAS belongs to
FPRAS ′ if whenever f ( x ) = 0 the returned value d f ( x ) equals with probability 1. We begin with the following observation. Theorem 8. P ⊆ FPRAS if and only if NP = RP .Proof . For the one direction we observe that if NP = RP then there are functionsin P , that are not in FPRAS . For example, belongs to P , and does notadmit an fpras unless NP = RP [8].The other direction derives from a Stockmeyer’s well known theorem [22].By Stockmeyer’s theorem there exists an fpras, with access to a Σ p oracle, forany problem in P . If NP = RP then Σ p = RP RP ⊆ BPP [24]. Finally it is easy tosee that an fpras with access to a
BPP oracle, can be replaced by another fpras,that simulates the oracle calls itself. (cid:3) The following theorem is probably well-known among counting complexity re-searchers. However, since we have not been able to find a proof in the literaturewe provide one here for the sake of completeness. orollary 2.
TotP ⊆ FPRAS if and only if
TotP ⊆ FPRAS ′ if and only if NP = RP .Proof . TotP ⊆ FPRAS iff NP = RP is an immediate corollary of the proof ofTheorem 8 along with the observations that ∈ TotP and
TotP ⊆ P .We prove that TotP ⊆ FPRAS iff TotP ⊆ FPRAS ′ . Suppose that TotP ⊆ FPRAS and let f be a function in TotP . Then f ∈ FPRAS . Now we can modifythe fpras for f so that it returns the correct value of f ( x ) with probability 1 if f ( x ) = 0 . We can do this since we can decide if f ( x ) = 0 in polynomial time.So, f ∈ FPRAS ′ .The other direction is trivial by the inclusion FPRAS ′ ⊆ FPRAS . (cid:3) Now we examine the opposite inclusion, i.e. whether
FPRAS is a subset of
TotP . To this end we introduce two classes that contain counting problems withdecision in RP .Recall that if a counting function f admits an fpras, then its decision version,i.e. deciding whether f ( x ) = 0 , is in BPP . In a similar way, if a counting functionbelongs to
FPRAS ′ , then its decision version is in RP . So we need to define thesubclass of P with decision in RP . Clearly, if for a problem Π in P the corre-sponding counting machine has an RP behavior (i.e., either a majority of pathsare accepting or all paths are rejecting) then the decision version is naturally in RP . However, this seems to be a quite restrictive requirement. Therefore we willexamine two subclasses of P .For that we need the following definition of the set of Turing Machines asso-ciated to problems in RP . Definition 4.
Let M be an NPTM. We denote by p M the polynomial such thaton inputs of size n , M makes p M ( n ) non-deterministic choices. MR = { M | M is an NPTM and for all x ∈ Σ ∗ either acc M ( x ) = 0 or acc M > · p M ( | x | ) } . Definition 5. RP = { f ∈ P | ∃ M ∈ MR ∀ x ∈ Σ ∗ : f ( x ) = acc M ( x ) } . Definition 6. RP = { f ∈ P | L f ∈ RP } . Note that RP , although restrictive, contains counting versions of someof the most representative problems in RP , for which no deterministic algo-rithms are known. For example consider the polynomial identity testing problem( Pit ): Given an arithmetic circuit of degree d that computes a polynomial ina field, determine whether the polynomial is not equal to the zero polynomial.A probabilistic solution to it is to evaluate it on a random point (from a suffi-ciently large subset S of the field). If the polynomial is zero then all points willbe evaluated to , else the probability of getting is at most d | S | . A counting Determining the computational complexity of polynomial identity testing is consid-ered one of the most important open problems in the mathematical field of AlgebraicComputing Complexity. nalogue of
Pit is to count the number of elements in S that evaluate to non-zero values; clearly this problem belongs to RP . Another problem in RP isto count the number of compositeness witnesses (as defined by the Miller-Rabinprimality test) on input an integer n > ; although in this case the decisionproblem is in P (a prime number has no such witnesses and this can be checkeddeterministically by AKS algorithm [1]), for a composite number n at least halfof the integers in Z n are Miller-Rabin witnesses, hence there exists a NPTM M ∈ MR that has as many accepting paths as the number of witnesses. RP contains natural counting problems as well. Two examples in RP are Exact Matchings and
Blue-Red Matchings , which are countingversions of
Exact Matching [19] and
Blue-Red Matching [17], respectively,both of which belong to RP (in fact in RNC ) as shown in [16, 17]; however, it isstill open so far whether they can be solved in polynomial time. Therefore it isalso open whether
Exact Matchings and
Blue-Red Matchings belongto
TotP .We will now focus on relationships among the aforementioned classes. Westart by presenting some unconditional inclusions and then we explore possibleinclusions under the condition that either NP = RP = P or NP = RP = P holds.The results are summarized in Figures 2 and 3. P BPP RP FPRAS
PE FPRAS ′ TotP RP FP Fig. 2.
Unconditionalinclusions. NP = RP = P P BPP RP PE FPRASFPRAS ′ TotP RP FP NP = RP = P P BPP PE = RP FPRASTotP FPRAS ′ RP FP Fig. 3.
Conditional inclusions. The following nota-tion is used: A → B denotes A ⊆ B , A ⊣ B denotes A B , and A B denotes A ( B . FP ⊆ RP ⊆ RP ⊆ P . Also TotP ⊆ PE ⊆ RP .roof . Let f ∈ FP . We will show that f ∈ RP . We will construct an NPTM M ∈ MR s.t. on input x , acc M ( x ) = f ( x ) . Let x ∈ Σ ∗ . We construct M thatcomputes f ( x ) and then it computes i ∈ N s.t. f ( x ) ∈ (2 i − , i ] . M makes i non-deterministic choices b , b , ..., b i . Each such b ∈ { , } i determines a path,in particular, b corresponds to the ( b + 1) -st path (since i is the first path). M returns yes iff b + 1 ≤ f ( x ) , so acc M = f ( x ) . Since f ( x ) > i − , M ∈ MR . The other inclusions are immediate by definitions. (cid:3)
Theorem 10. RP ⊆ FPRAS ′ ⊆ RP . Proof . For the first inclusion, let ǫ > , δ > . Let f ∈ RP . There existsan M f ∈ MR s.t. ∀ x , acc M f ( x ) = f ( x ) . Let q ( | x | ) be the number of non-deterministic choices of M f . Let p = f ( x )2 q ( | x | ) . We can compute an estimate ˆ p of p, by choosing m = poly ( ǫ − , log δ − ) paths uniformly at random. Then we cancompute d f ( x ) = ˆ p · q ( | x | ) .To proceed with the proof we need the following lemma. Lemma 1. (Unbiased estimator.) Let A ⊆ B be two finite sets, and let p = | A || B | .Suppose we take m samples from B uniformly at random, and let a be the numberof them that belong to A . Then ˆ p = am is an unbiased estimator of p , and itsuffices m = poly ( p − , ǫ − , log δ − ) in order to have Pr[(1 − ǫ ) p ≤ ˆ p ≤ (1 + ǫ ) p ] ≥ − δ. If f ( x ) = 0 , then p > , so by the unbiased estimator of lemma 1, d f ( x ) satisfies the definition of fpras. If f ( x ) = 0 then d f ( x ) = 0 , so the estimated valueis with probability 1.For the second inclusion, let f ∈ FPRAS ′ , we will show that the decisionversion of f , i.e. deciding if f ( x ) = 0 , is in RP . On input x we run the fpras for f with e.g. ǫ = δ = . We return yes iff d f ( x ) ≥ . By the definition of
FPRAS ′ , if f ( x ) = 0 then the fpras returns , so wereturn yes with probability . If f ( x ) ≥ , then d f ( x ) ≥ with probability atleast − δ , so we return yes with the same probability. (cid:3) Corollary 3. RP ⊆ FPRAS ′ ⊆ FPRAS ⊆ BPP . Corollary 4. If FPRAS ⊆ TotP then RP = P .Proof . If FPRAS ⊆ TotP , then RP ⊆ TotP , and then for all f ∈ RP , L f ∈ P . So if A ∈ RP via M ∈ MR then acc M ∈ RP , and thus A = L acc M ∈ P .Thus RP = P . (cid:3) Corollary 5. If RP = RP then NP = RP .Proof . If RP = RP then they are both equal to FPRAS ′ , thus TotP ⊆ FPRAS ′ ⊆ FPRAS . Therefore, NP = RP by Corollary 2. (cid:3) Theorems 9 and 10 together with Theorem 7 are summarised in Figure 2. .2 Conditional inclusions / Possible worlds
Now we will explore further relationships between the above mentioned classes,and we will present two possible worlds inside P , with respect to NP vs. RP vs. P . Theorem 11.
The inclusions depicted in Figure 3 hold under the correspondingassumptions on top of each subfigure.Proof . First note that intersections between any of the above classes are non-empty, because FP is a subclass of all of them. For the rest of the inclusions, wehave the following. – In the case of NP = RP = P . • By definitions, P ⊆ RP ⇔ NP = RP . Therefore, NP = RP ⇒ P RP . • By Theorem 7, the inclusions FP ⊆ TotP ⊆ PE ⊆ P are properunless P = NP . Therefore, NP = P ⇒ FP ( TotP ( PE ( P . • By Corollary 2,
TotP ⊆ FPRAS ⇒ NP = RP . Therefore, NP = RP ⇒ TotP FPRAS . • By Corollary 2,
TotP ⊆ FPRAS ′ ⇒ NP = RP . Therefore, NP = RP ⇒ TotP FPRAS ′ . • By Corollary 2 and Theorem 10, RP ⊆ FPRAS ⇒ TotP ⊆ FPRAS ⇒ NP = RP . Therefore, NP = RP ⇒ RP FPRAS . • By Theorem 10 and Corollary 2, RP ⊆ FPRAS ′ ⇒ TotP ⊆ FPRAS ′ ⇒ NP = RP . Therefore, NP = RP ⇒ RP FPRAS ′ . • By Corollary 5, RP = RP ⇒ NP = RP . Therefore, NP = RP ⇒ RP RP . • By Theorem 8, P ⊆ FPRAS ⇔ NP = RP . Therefore, NP = RP ⇒ P FPRAS . By Theorem 7 and Corollary 2, PE ⊆ FPRAS ⇒ TotP ⊆ FPRAS ⇒ NP = RP . Therefore, NP = RP ⇒ PE FPRAS . • By Theorem 10 and the previous result, PE ⊆ RP ⇒ PE ⊆ FPRAS ⇒ NP = RP . Therefore, NP = RP ⇒ PE RP . • By Theorem 7 and Corollary 2, PE ⊆ FPRAS ′ ⇒ TotP ⊆ FPRAS ′ ⇒ NP = RP . Therefore, NP = RP ⇒ PE FPRAS ′ . • By Corollary 2 and Theorem 10,
TotP ⊆ RP ⇒ TotP ⊆ FPRAS ⇒ NP = RP . Therefore, NP = RP ⇒ TotP RP . – In the case of NP = RP = P .In addition to all the above results we have the following ones. • By definitions, RP ⊆ PE ⇔ P = RP . Therefore, P = RP ⇒ RP PE . • As in the proof of Corollary 4 we can show that RP ⊆ PE ⇒ P = RP holds. Therefore, P = RP ⇒ RP PE . • By Theorem 10 and the previous result,
FPRAS ⊆ PE ⇒ RP ⊆ PE ⇒ P = RP . Therefore, P = RP ⇒ FPRAS PE . • Similarly,
FPRAS ′ ⊆ PE ⇒ RP ⊆ PE ⇒ P = RP . Therefore, P = RP ⇒ FPRAS ′ PE . • Similarly, RP ⊆ TotP ⇒ P = RP . Therefore, P = RP ⇒ RP TotP . • By Theorem 7 and the previous result, RP ⊆ FP ⇒ RP ⊆ TotP ⇒ P = RP . Therefore, P = RP ⇒ RP FP . • By Corollary 4,
FPRAS ⊆ TotP ⇒ P = RP . Therefore, P = RP ⇒ FPRAS TotP . • Similarly,
FPRAS ′ ⊆ TotP ⇒ P = RP . Therefore, P = RP ⇒ FPRAS ′ TotP . (cid:3) Conclusions and open questions P PE = RP TotP FPRAS RP ΣQSO ( Σ - ) Π - Fig. 4.
Inclusions and separations in thecase of NP = RP = P . Regarding the question of whether
FPRAS is a subset of
TotP , Corollary 4states that if it actually holds, thenproving it is at least as difficult asproving RP = P .A long-sought structural charac-terization for FPRAS might be ob-tained by exploring the fact that it liesbetween RP and BPP .Another open question is whether
FPRAS ′ is included in RP . It seemsthat both a negative and a positiveanswer are compatible with our twopossible worlds. P PE = RP FPRASTotPΣQSO ( Σ - HORN ) spanL RΣ ΣQSO ( Σ - ) ΣQSO ( Σ [ FO ]) FP Σ ΣQSO ( Σ ) Σ RHΠ Fig. 5.
Inclusions and separations in the case of NP = RP = P . By employing descriptive complexity methods we obtained two new robustsubclasses of
TotP ; the class
ΣQSO ( Σ - ) for which the counting problem Disj2Sat is complete under parsimonious reductions and the class Π - for which is complete under product reductions. We do notexpect ΣQSO ( Σ - ) to be a subclass of FPRAS , given that
Disj2Sat doesnot admit an fpras unless NP = RP .A similar fact holds for the second class Π - . Since there is no fprasfor if a variable can appear in clauses, unless NP = RP [15],we do not expect that Π - is a subclass of FPRAS .lthough proving complete for Π - under productreductions, allows a more precise classification of the problem within P , thequestion of [12] remains open, i.e. whether is complete forsome counting class under reductions under which the class is downwards closed.Finally, assuming NP = RP = P , which is the most widely believed con-jecture, the relationships among the classes studied in this paper are given inFigure 4.Relationships among TotP , FPRAS , and various classes defined through de-scriptive complexity, are shown in Figure 5.
References [1] Manindra Agrawal, Neeraj Kayal, and Nitin Saxena. PRIMES is in P.
Annals ofMathematics , 160 (2):781–793, 2004.[2] Marcelo Arenas, Luis Alberto Croquevielle, Rajesh Jayaram, and Cristian Riveros.Efficient logspace classes for enumeration, counting, and uniform generation.
CoRR , abs/1906.09226, 2019.[3] Marcelo Arenas, Martin Muñoz, and Cristian Riveros. Descriptive complexity forcounting complexity classes.
CoRR , abs/1805.02724, 2018.[4] Eleni Bakali, Aggeliki Chalki, Aris Pagourtzis, Petros Pantavos, and Stathis Za-chos. Completeness results for counting problems with easy decision. In
Algo-rithms and Complexity - CIAC 2017 , volume 10236 of
Lecture Notes in ComputerScience , pages 55–66, 2017.[5] Evangelos Bampas, Andreas-Nikolas Göbel, Aris Pagourtzis, and Aris Tentes. Onthe connection between interval size functions and path counting.
ComputationalComplexity , 26(2):421–467, 2017.[6] Andrei Bulatov, Victor Dalmau, and Marc Thurley. Descriptive complexity ofapproximate counting CSPs. In Simona Ronchi Della Rocca, editor,
ComputerScience Logic 2013 (CSL 2013) , volume 23 of
LIPIcs , pages 149–164, Dagstuhl,Germany, 2013. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.[7] Victor Dalmau. Linear Datalog and Bounded Path Duality of Relational Struc-tures.
Logical Methods in Computer Science , Volume 1, Issue 1, April 2005.[8] Martin Dyer, Alan Frieze, and Mark Jerrum. On counting independent sets insparse graphs.
SIAM Journal on Computing , 31(5):1527–1541, 2002.[9] Martin E. Dyer, Leslie Ann Goldberg, Catherine S. Greenhill, and Mark Jer-rum. The relative complexity of approximate counting problems.
Algorithmica ,38(3):471–500, 2004.[10] Andreas Galanis, Leslie Ann Goldberg, and Mark Jerrum. A complexity tri-chotomy for approximately counting list h-colorings.
ACM Trans. Comput. The-ory , 9(2), April 2017.[11] John. Gill. Computational complexity of probabilistic turing machines.
SIAMJournal on Computing , 6(4):675–695, 1977.[12] Lane A. Hemaspaandra, Christopher M. Homan, Sven. Kosub, and Klaus W.Wagner. The complexity of computing the size of an interval.
SIAM Journal onComputing , 36(5):1264–1300, 2007.[13] Mark Jerrum and Alistair Sinclair.
The Markov Chain Monte Carlo Method:An Approach to Approximate Counting and Integration , pages 482–520. PWSPublishing Co., USA, 1996.14] Richard M Karp, Michael Luby, and Neal Madras. Monte-carlo approximationalgorithms for enumeration problems.
Journal of Algorithms , 10(3):429–448, 1989.[15] Jingcheng Liu and Pinyan Lu. FPTAS for counting monotone CNF. In PiotrIndyk, editor,
Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposiumon Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015 ,pages 1531–1548. SIAM, 2015.[16] Ketan Mulmuley, Umesh V. Vazirani, and Vijay V. Vazirani. Matching is as easyas matrix inversion.
Combinatorica , 7(1):105–113, Mar 1987.[17] Christos Nomikos, Aris Pagourtzis, and Stathis Zachos. Randomized and ap-proximation algorithms for blue-red matching. In Luděk Kučera and AntonínKučera, editors,
Mathematical Foundations of Computer Science 2007 , pages 715–725, Berlin, Heidelberg, 2007. Springer Berlin Heidelberg.[18] Aris Pagourtzis and Stathis Zachos. The complexity of counting functions witheasy decision version. In Rastislav Kralovic and Pawel Urzyczyn, editors,
Mathe-matical Foundations of Computer Science 2006 , pages 741–752. Springer, 2006.[19] Christos H. Papadimitriou and Mihalis Yannakakis. The complexity of restrictedminimum spanning tree problems (extended abstract). In Hermann A. Maurer,editor,
Automata, Languages and Programming 1979 , pages 460–470. Springer,1979.[20] S. Saluja, K.V. Subrahmanyam, and M.N. Thakur. Descriptive complexity of
Journal of Computer and System Sciences , 50(3):493–505, 1995.[21] Alistair Sinclair and Mark Jerrum. Approximate counting, uniform generationand rapidly mixing markov chains.
Information and Computation , 82(1):93–133,1989.[22] Larry. Stockmeyer. On approximation algorithms for
SIAM Journal onComputing , 14(4):849–861, 1985.[23] L.G. Valiant. The complexity of computing the permanent.
Theoretical ComputerScience , 8(2):189–201, 1979.[24] Stathis Zachos. Probabilistic quantifiers and games.