Characterizing Classes by Logics with Recursion∗

Anselm Haak1

1 Theoretische Informatik, Leibniz Universität Hannover, Appelstraße, D-30167, Germany, [email protected]

In this submission we introduce a certain recursion scheme into first-order logic variants of which allow us to capture a number of classes from circuit complexity, namely AC1, SAC1 and NC1 as well as their counting analogues. The advantage of our new approach is that it allows for a unified characterization of multiple important classes. The idea of descriptive complexity is to characterize complexity classes in a model- theoretic way in order to better understand their structure and use logical methods in order to get new insights about the considered classes. The starting point for this strand of research was Fagin’s theorem [3]. It tells us that the NP of problems decidable by non-deterministic polynomial-time Turing machines can be characterized as the class of problems definable in existential second order logic. Many characterizations followed, among them characterizations of the circuit complexity classes AC0, NC1 and TC0, see e.g. [1, 5]. Characterizations of uniform classes from circuit complexity are of special interest, because the definitions of these classes usually build upon two disconnected models: The uniformity condition is defined via some logic or using a machine model, while the main power of computation stems from the name-giving circuits. Model-theoretic characterizations allow to define these classes in purely logical terms. Another important kind of classes are so called counting classes. These are classes of functions from inputs to natural numbers that are usually defined by counting the number of some kind of witness for membership in a language. Of course, what kind of witness is considered depends on the specific class. For these kind of classes, only very few model- theoretic characterizations are known. The most prominent one is probably the general- ization of Fagin’s theorem, stating that #P = #FO: Counting the number of accepting paths of NP-machines can be characterized as counting the number of satisfying assign- ments to free relational variables in FO-formulae [6]. Besides that, we recently showed that Immermans result AC0 = FO [5] can also be generalized to the counting setting, showing #AC0 = #Win-FO [4]. Since the area of descriptive complexity for counting classes is not really well devel- oped, more characterizations of such classes are desirable. In this regard we want to focus on classes from circuit complexity and try to give characterizations of classes defined via Boolean circuits that also extend to the counting setting. Towards this goal, the best known characterizations of NC1 [1] does not seem to be helpful. On the other hand, we feel like the generalization of AC0 = FO to the whole AC-hierarchy using formulae of logarithmic length does seem a little unnatural. Instead, we sought inspiration from a result by Compton and Laflamme, characterizing NC1 by FO with a certain kind of linear recursion [2]. This approach does not seem to generalize to the classes SAC1 and AC1, though. Instead of focus- ing on transferring this kind of recursion to other classes, we define a new kind of recursion that more direcly captures the essence of uniform circuit classes with the counting setting in mind. Introducing this kind of recursion into first-order logic allows us to characterize NC1, SAC1 and AC1 in similar ways. Furthermore, the approach also works in the counting

∗ This submission is based on joint research with Arnaud Durand and Heribert Vollmer.

© Anselm Haak; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 Characterizing Circuit Complexity Classes by Logics with Recursion

setting. While the recursion scheme is more directly connected to the definition of uniform circuit complexity classes, the approach still bears the advantage of yielding descriptions of the classes in purely logical terms. We now want to briefly recall the definition of FO-uniform families of Boolean circuits. A is a directed acyclic graph. The nodes of this graph—also called gates—are marked with “∧”, “∨” or with an index of an input position. Also, one gate is marked as the output gate. To talk about these circuits in first-order logic, we use the vocabulary τcirc = 2 1 1 2 2 1 (E ,G∧,G∨, Input , negatedInput , output ). The meaning of the predicates E,G∧,G∨ and output is straightforward. Input(x, i) holds, if gate x is an input gate and associated with

the i-th input position. An FO-uniform circuit family is a family of circuits C = (Cn)n∈N for which there is an FO-interpretation (FO-query) I : STRUC[τstring] → STRUC[τcirc] such ∗ that for w ∈ {0, 1} : I(Aw) = C|w|. Here, τstring is the vocabulary of binary strings, Aw is the structure representing string w and C|w| is given as a τcirc-structure. The recursion scheme we introduce allows for the recursive definition of a predicate P . Syntactically, the constructions looks as follows: [P (x, y) ≡ Qz.(z < y/2 ∧ ψ(y, z))θ(x, y, P (x, z))]. The recursion runs over the parameter y. Q is a quantifier, which will either be ∃ or ∀ depending on the parity of y. The quantification of z is guarded by the formula z < y/2 ∧ ψ(y, z). This means that the value of the second input is at least halved in each step. If Q is an existential quantifier, the semantics is: P (x, y), if there is a z among those satisfying z < y/2∧ψ(y, z) such that θ(x, y, P (x, z)) holds. If Q is a universal quantifier, the semantics is: P (x, y), if for all z among those satisfying z < y ∧ ψ(y, z) also θ(x, y, P (x, z)) holds. We denote this kind of recursion by GRP(guarded recursive predicate definition). In this unrestricted way, the recursion branches polynomially. The depth of the recursion is bounded logarithmically due to the condition z < y/2. This intuatively suggests, that this kind of recursion captures the essence of AC1-computations. The definition can be altered by bounding the quantifier Q in the universal case or in both cases, resulting in characaterizations of SAC1 and NC1, respectively. This is done by changing the semantics e.g. in the universal case to: P (x, y), if for all z among the maximal two satisfying z < y/2∧ ψ(y, z) also θ(x, y, P (x, z)) holds. We call the restricted versions GRPsemi and GRPbounded, respectively. In order to capture said classes, we add the above kind of recursive definition in FO- formulae. We call the resulting logics FO(GRP), FO(GRPsemi) and FO(GRPbounded), - spectively. We define these logics as follows:

I Definition 1. FO(GRP) is first-order logic with occurrences of GRP. That is, it consists of all formulae of the form

[P1(x, y) ≡ Qz.(z < y/2 ∧ ψ1(y, z)) θ1(x, y, P (x, z))] ···

[Pk(x, y) ≡ Qz.(z < y/2 ∧ ψk(y, z)) θk(x, y, P (x, z))]

ϕ(P1,...,Pk), where the semantics of the recursive definitions is as described above. FO(GRPsemi) and FO(GRPbounded) are defined analogously. As usual, we also denote by FO(GRP) the class of languages that exactly consist of those words that are encodings of structures with a specific FO(GRP)-definable property. Since we only consider τstring-structures here, this can be stated as

L ∈ FO(GRP) ·⇐⇒ there is a formula ϕ ∈ FO(GRP) such that w ∈ ⇔ Aw  ϕ for all w Anselm Haak XX:3

We use FO(GRPsemi) and FO(GRPbounded) to denote classes of languages in the same way. This leads us to one of our main theorems.

I Theorem 2. (i) FO(GRP) = AC1 1 (ii) FO(GRPsemi) = SAC 1 (iii) FO(GRPbounded) = NC

We will sketch the proof for the unbounded version here.

Proof Sketch for Theorem 2.(i). ⊇: Let L ∈ AC1 via the FO-uniform AC1 circuit family

C = (Cn)n∈N. Let I = (ϕE, ϕG∧ , ϕG∨ , ϕInput, ϕnegatedInput, ϕoutput) be an FO-interpretation witnessing that C is FO-uniform. We can assume without loss of generality that within all Cn, all ∨-gates are even and all ∧-gates are odd. We can also assume that for all gates g1, g2 g1 in any Cn it holds that E(g1, g2) ⇒ g2 < 2 . Then we can express acceptance of an input by C with the FO(GRP)-formula

[P (y) ≡ Qz.(z < y/2 ∧ ϕE(y, z)) P (z) ∧ ¬ϕLiteral(z) ∨ ϕtrueLiteral(z)]

∃out ϕoutput(out) ∧ P (out) with ϕLiteral(x) ·= ∃i ϕInput(x, i) ∨ ϕnegatedInput(x, i) and ϕtrueLiteral ·= ∃i (ϕInput(x, i) ∧ S(i)) ∨ (ϕnegatedInput(x, i) ∧ ¬S(i)). The predicate P defined recursively gives us exactly the evaluation of the gates in the circuit. Thus, the formula ∃out ϕoutput(out)∧P (out) expresses that the output gate of the circuit evaluates to 1. ⊆: Let L ∈ FO(GRP) via the formula

[P (x, y) ≡ Qz.(z < y/2 ∧ ψ(y, z)) θ(x, y, P (x, z))] ϕ(P ).

For simplicity in this proof sketch, we assume that only one predicate P is defined recur- sively within the formula. Also, P does not occur inside any negation in θ or ϕ. Ignoring occurrences of P , ϕ is an FO-formula. Hence, we can build an FO-uniform AC0 circuit family evaluating ϕ except for these occurrences. In order to compute the predicate P , we proceed as follows: For all x, y, z build a circuit that computes θ(x, y, P (x, z)) from P (x, z). We can then for all x, y add a gate computing P (x, y) by making it an ∧- or an ∨-gate depending on the parity of y and connecting to it as inputs the gates computing θ(x, y, P (x, z)) for all z satisfying z < y/2 ∧ ψ(y, z). Now also connect for all x, y, z the gate computing P (x, z) as input to the circuit computing θ(x, y, P (x, z)). This gives us an AC1 circuit family computing for all x, y the value of P (x, y). The results can now be connected to the AC0 circuit family evaluating ϕ as needed. This 1 leads to an AC -circuit family evaluating the whole formula. J As already mentioned, this approach also works for the corresponding counting classes. The counting versions of classes from circuit complexity are defined via the concept of proof trees: For this, we first unfold the circuit into a tree. Then a proof tree is a minimal subtree witnessing that this unfolded ciruit evaluates to true. This means that a proof tree contains the output gate, for each contained ∨-gate exactly one child and for each contained ∧-gate all children, in such a way that all contained leaves evaluate to true. The counting classes are then defined as classes of functions mapping inputs to the number of proof trees of a circuit family. E.g., a function f is in #AC1 if there is an AC1 circuit family C such that for each input w, f(w) is the number of proof trees of C on input w. XX:4 Characterizing Circuit Complexity Classes by Logics with Recursion

On the other hand, logical counting classes can be defined as classes of functions counting the number of winning strategies similar of certain formulae, as it is done for #Win-FO. In the definition of said class, we use the game played over the quantifier prefix—the quantifier- free part is only evaluated to determine the winner of the game. In this case, this does not make much sense, because we need to count the number of strategies leading to a certain value of P . Since occurrences of P are operands of Boolean operators, we have to extend the model-checking game to the Boolean part and determine the winner after reaching atomic formulae. This leads to the following definition of the model-checking game for FO as a turn-based two-player game: The verifier plays against the falsifier. The verifier tries to show that the formula is true, while the falsifier tries to show that it is not. They play over the syntactic structure of the formula, starting with the outermost operator. Depending on which operator they encounter, one player has to make a choice. If the atom they reach in the end is true, the verifier wins and if it is not, the falsifier wins. The operators are handled as follows: ∃xψ: verifier chooses a value for x ∀xψ: falsifier chooses a value for x α ∨ β: verifier chooses whether to continue with α or β α ∧ β: falsifier chooses whether to continue with α or β ¬α: verifier and falsifier swap roles and continue on formula α For FO(GRP), we change this definition for occurrences of any recursively defined pred- icate P : When reaching this predicate as an atom, instead of directly checking its truth value, the game continues by unrolling the recursive definiton for P on the encountered inputs. We now define the corresponding counting class as the class of functions mapping inputs to the number of winning strategies of the verifier for a FO(GRP)-formula in the above model-checking game.

I Definition 3. #Win-FO(GRP) is the class of functions f for which there is an FO(GRP)- formula ϕ such that for all w ∈ {0, 1}∗:

f(w) = number of winning strategies of the verifier for Aw  ϕ.

#Win-FO(GRPsemi) and #Win-FO(GRPbounded) are defined analogously. This leads us to our second main theorem, which is:

I Theorem 4. (i) #Win-FO(GRP) = #AC1 1 (ii) #Win-FO(GRPsemi) = #SAC 1 (iii) #Win-FO(GRPbounded) = #NC We have characterized some of the most important circuit complexity classes and their counting counterparts in a unified fashion. Also, the characterizations are quite close to the characterization of AC0 as FO: Here, no recursive definition is allowed leaving only an FO-formula. This also extends to the counting setting. As further research, it might be interesting to compare logics characterizing TC0 with the new logic for NC1 and also to look for different characterizations of TC0. Another possibibility is to check whether the characterization of NC1 via a linear kind of recursion by Compton and Laflamme can be transferred to the counting setting. One can also try to generalize the ideas to arbitrary classes from the AC-, SAC- and NC-hierarchies. The problem is that in our characterization we can use the quite simple condition “z < y/2” in order to guarantee at most logarithmic depth. It seems plausible that no similarly simple condition works for powers of log(n). Still, a similar approach might be possible. Anselm Haak XX:5

References 1 David A. Mix Barrington, Neil Immerman, and Howard Straubing. On uniformity within nc1. Journal of Computer and System Sciences, 41(3):274 – 306, 1990. 2 Kevin J. Compton and Claude Laflamme. An algebra and a logic for nc1. Information and Computation, 87(1):241 – 263, 1990. 3 Ronald Fagin. Generalized first-order spectra and polynomial-time recognizable sets. In Richard Manning Karp, editor, Complexity of Computation, volume 7 of SIAM-AMS Pro- ceedings, pages 43–73, 1974. 4 Anselm Haak and Heribert Vollmer. A Model-Theoretic Characterization of Constant- Depth Arithmetic Circuits, pages 234–248. Springer Berlin Heidelberg, Berlin, Heidelberg, 2016. 5 Neil Immerman. Descriptive complexity. Graduate texts in computer science. Springer, 1999. 6 Sanjeev Saluja, K. V. Subrahmanyam, and Madhukar N. Thakur. Descriptive complexity of #P functions. Journal of Computer and System Sciences, 50(3):493–505, 1995.