# An in-between "implicit" and "explicit" complexity: Automata

Clément Aubert

► To cite this version:

Clément Aubert. An in-between "implicit" and "explicit" complexity: Automata. DICE 2015 - Developments in Implicit Computational Complexity, Apr 2015, Londres, United Kingdom. hal-01111737v2

HAL Id: hal-01111737

https://hal.science/hal-01111737v2

Submitted on 29 May 2015

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# An in-between “implicit” and “explicit” complexity: Automata

CLÉMENT AUBERT

**ABSTRACT.** Implicit Computational Complexity (ICC) makes two aspects implicit, by manipulating programming languages rather than models of computation, and by internalizing the bounds rather than using external measure. We survey how automata theory contributed to complexity with a machine-dependant with implicit bounds model.

## INTRODUCTION

This survey justifies a fine-grained view on the definition of *what* Implicit Computational Complexity (ICC) wants to keep implicit:

<table><thead><tr><th></th><th>Machine-dependant</th><th>Machine-independent</th></tr></thead><tbody><tr><td>Explicit bounds</td><td>Turing machine,<br>Random access machine,<br>Counter machine, ...<br>Automaton,<br>Auxiliary pushdown machine [10],<br>Boolean circuit, ...</td><td>Bounded recursion on notation [9],<br>Bounded arithmetic [6],<br>Bounded linear logic [13], ...<br>Descriptive complexity [11],<br>Recursion on notation [5],<br>Tiered recurrence [19], ...</td></tr><tr><td>Implicit bounds</td><td></td><td></td></tr></tbody></table>

It is common to refer to the top-left as the *classical*, or *explicit*, approach to complexity. The three others techniques *keep something implicit*. The bottom-right way is considered as the *true* implicit complexity, the one that produces all the motivating perspectives: quasi-interpretations, non-size-increasing computation, soft lambda-calculus and linear logics, to name a few. But there might be hesitations when defining ICC, for neither the “machine-independent” neither the “without explicit bounds” slogans are precise enough.

The machine-dependant with implicit bounds variant will be our subject. It characterizes complexity classes by bounding the quality of the resources of a machine rather than its quantity. To our knowledge, automata are the most canonical model of this enterprise, which dates back to the 70’s: “we have attempted to characterize several tape and time complexity classes of Turing machines in terms of devices whose definitions involve only ways in which their infinite memory may be manipulated and no restrictions are imposed on the amount of memory that they use.” ([16, p. 88])

Date: February 4, 2015.

This work was partly supported by the ANR-10-BLAN-0213 Logoi, the ANR-14-CE25-0005 ELICA and the ANR-11-INSE-0007 REVER.
## AUTOMATA, CHARACTERIZATIONS AND SEPARATION RESULTS

**Definition 1.** For $k \ge 1$, $l \ge 0$, a 2-way non-deterministic finite automaton with $k$-heads and $l$ pushdown stacks (2NFA($k,l$)) is a tuple $M = \{S, i, F, A, B, \triangleright, \triangleleft, \Box, \sigma\}$ where:

* $S$ is the finite set of states, with $i \in S$ the initial state and $F \subseteq S$ the set of accepting states;

* $A$ is the input alphabet, $B$ is the stack alphabet;

* $\triangleright$ and $\triangleleft$ are the left and right endmarkers, $\triangleright, \triangleleft \notin A$;

* $\Box$ is the bottom symbol of the stack, $\Box \notin B$;

From now on, we let $A_{\triangleright}^n$ (resp. $B_{\triangleleft}^n$) be $A \cup \{\triangleright, \triangleleft\}$ (resp. $B \cup \{\Box\}$).

* $\sigma \subseteq (S \times (A_{\triangleright}^k)^l \times (B_{\triangleleft}^l)^l) \times (S \times \{-1, 0, +1\})^k \times \{\text{pop, peek, push}(b)\}^l$ is the transition relation, where $-1$ means to move the head one cell to the left, $0$ means to keep the head on the current cell and $+1$ means to move it one cell to the right. Regarding the pushdown stacks, pop means "erase the top symbol", peek "do nothing", and, for all $b \in B$, push is "write $b$ on top of the stack".

Given an input $n \in A^*$, the automata is initiated in state $i$, with $\triangleright n \triangleleft$ written on its only tape, all its heads at $\triangleright$ and all its stacks containing $\Box$. It makes (non-deterministic) transitions according to $\sigma$ and halt accepting as soon as it reaches a state belonging to $F$. We impose that the heads cannot move beyond the endmarkers and that the bottom stack symbol $\Box$ cannot be erased ("popped").

Finally, we denote with $2\text{NFA}(k, l)$ the class of languages recognized by the $2\text{NFA}(k, l)$ automaton. Moreover, we let $2\text{NFA}(*, l) = \cup_{k \ge 1} 2\text{NFA}(k, l)$.

**Theorem 1.** The following table gives the correspondence between automata and languages (or predicates):

<table><thead><tr><td>Automata</td><td>Language</td></tr></thead><tbody><tr><td>a) 2NFA(1, 2)</td><td>Computable</td></tr><tr><td>b) 2NFA(*, 1)</td><td>Polynomial time</td></tr><tr><td>c) 2NFA(*, 0)</td><td>Logarithmic space</td></tr><tr><td>d) 2NFA(1, 1)</td><td>Context-free</td></tr><tr><td>e) 2NFA(1, 0)</td><td>Regular</td></tr></tbody></table>

*Proof.* We just sketch them, and provide references for the most difficult one. We always suppose that $n$ is the input and $|n|$ its size.

a) $\subseteq$: Given a computable language, by the Church-Turing thesis, there exists a Turing machine $T$ that decides it. Using some classical theorem, we can always assume that $T$ has a single reading head and a single read-write tape. A $2\text{NFA}(1, 2)$ can simulate $T$ by simulating the movement of the read-only head with its head, and the content of the read-write tape with its two pushdown stacks. The first (resp. second) pushdown stack store the content on the left (resp. right) of the read-write head.

a) $\supseteq$: As $2\text{NFA}(1, 2)$ are restrictions of Turing Machines, their simulation is obvious.

b) $\subseteq$: This part amounts to designing an equivalent Turing machine whose movements of heads follow a regular pattern. That permits to seamlessly simulate the content of the read-write tape with a pushdown stack. A complete proof [10,
pp. 9–11] as well as a precise algorithm [27, pp. 238–240] can be found in the literature.

b) $\supseteq$: This way gave birth to memoization. In a nutshell, simulating a 2NFA$(\*,1)$ with a polynomial-time Turing machine cannot amount to simulate step-by-step the automaton. The reason is that for any automaton, one can design an automaton that recognizes the same language but runs exponentially slower [1, p. 197]. The technique invented by Alfred V. Aho et. al [1] and made popular by Stephen A. Cook consists in building a “memoization table” that allows the Turing machine to create shortcuts in the simulation of the automaton, decreasing drastically its computation time. It is a “clever evaluation strategy, applicable whenever the results of certain computations are needed more than once” [2, p. 348]. A nice explanation in the case of single head automata is in a recent and short article by R. Glück [14].

c) $\subseteq$: Let $T$ be a Turing machine deciding the predicate with $m \times \log(|n|)$ space. Remark that an integer represented by a binary string of length $p$ is no greater than $2^p$, which takes $2^p$ bits in unary. Then, a binary string of length $\log(|n|)$ cannot be greater than $|n|$. So the content of the read-write tape and the position of its head is encoded as distances between $▷$ and the read-only heads of the automata. That needs to compute simple operations (modulo, multiplication and remaining of a division) thanks to an extra head, but $m+3$ heads [25, pp. 191–192] are sufficient to perform this simulation. Simplest and the fastest simulations exists [27, pp. 223–225], but the overhead in terms of heads is more important.

c) $\supseteq$: The addresses of the heads on the input $n$ takes $\log(|n|)$ to be written, hence a log-space Turing machine can easily simulate a 2NFA$(\*,0)$.

d) and e): The proofs of those two fundamentals results are beyond the scope of this small survey. Their original proofs are respectively due to Chomsky [7, Theorem 1, p. 188] and Kleene [18, Theorem 6]. □

In the c) case, taking a deterministic automata 2DFA$(\*,0)$ yields a characterization of deterministic log-space predicate $\mathbf{L}$ (whereas we characterized here the non-deterministic case $\mathbf{NL}$). In the b) case, both deterministic and non-deterministic automata characterize deterministic polynomial time.

Automata can also be restricted to be 1-way (simply remove the $-1$ instruction from the transition relation). In the e) case of regular language (which are equal to linear space), we get in fact $\mathbf{1DFA}(1,0) = \mathbf{2DFA}(1,0) = \mathbf{1NFA}(1,0) = \mathbf{2DFA}(1,0)$.

**Theorem 2** (Other results of interest).

([15, p. 95])

$$1DFA(k, 0) \subseteq 2DFA(k, 0)$$

([15, p. 95])

$$1NFA(k, 0) \subseteq 2NFA(k, 0)$$

([28, p. 339])

$$1DFA(k, 0) \subseteq 1NFA(2, 0)$$

([8])

$$1DFA(k, 1) \subseteq 1NFA(k, 1)$$

([25, p. 190])

$$1NFA(k, 0) \subseteq 2DFA(k, 0)$$

([24, p. 214])

$$2NFA(k, 1) \subseteq 2DFA(4 \times k, 1)$$

([25, p. 189])

$$2NFA(k, 0) \subseteq 2NFA(2 \times k, 1)$$

([8]) $1DFA(k, 1) \subseteq 1NFA(k, 1)$

([23, pp. 75–76])

$$\mathbf{NL} = \mathbf{L}$$

iff

$$1NFA(2, 0) \subseteq 2DFA(k, 0)$$
**Theorem 3.** For $l < 2$, $k+1$ heads are strictly stronger than $k$ heads.

This results holds in all situations, whenever automata are 1- or 2-way, deterministic or not, with or without pushdown stacks.<fnref n="1" /> Even if some notes on the techniques and historic of those results exist [26, Chap. 4, Sect. 5.3, 22, pp. 67–68], no extensive survey was found, so the reader has to go for the original research papers [28, p. 338, 20, p. 106, 21, p. 383, 8, p. 179, 17, p. 35].

## CONCLUSION

Automata theory is a major subject of computer science, very active and providing all kind of extensions and restrictions to automata. It contributed to “implicit” complexity in the sense that no external bound or measure is needed to tame their computational power: by specifying their number of ways, heads and stacks, one knows *in advance* the computational power of the device.

Those “implicit characterizations” provided decisive hints and tools to design two (truly implicit) bounded programming languages [3, 4]. Numerous other inspiring results remain to be explored and should benefit to ICC.

We did not mentioned finite state transducer, which are functional finite automata, but they also provide nice characterizations of functional complexity and beautiful results (even recently [12], where the main theorem fits in the title). The status of the input is also of interest: automata can be feded with 1-way inputs, trees, etc. That makes the expressive power to be really parametric in the input *and* the machine

## REFERENCES

[1] A. V. Aho, J. E. Hopcroft, and J. D. Ullman. "Time and Tape Complexity of Pushdown Automaton Languages". In: *Inform. Control* 13.3 (1968), pp. 186–206. DOI: 10.1016/S0019-9958(68)91087-5.

[2] T. Amtoft and J. L. Träff. "Partial Memoization for Obtaining Linear Time Behavior of a 2DPDA". In: *Theoret. Comput. Sci.* 98.2 (1992), pp. 347–356. DOI: 10.1016/0304-3975(92)90008-4.

[3] C. Aubert, M. Bagnol, P. Pistone, and T. Seiller. "Logic Programming and Logarithmic Space". In: *APLAS*. Ed. by J. Garrigue. Vol. 8858. LNCS. Springer, 2014, pp. 39–57. DOI: 10.1007/978-3-319-12736-1_3.

[4] M. Bagnol. "On the Resolution Semiring". PhD thesis. Aix-Marseille Université – Institut de Mathématiques de Marseille, 2014.

[5] S. J. Bellantoni and S. A. Cook. "A New Recursion-Theoretic Characterization of the Polytime Functions (Extended Abstract)". In: *STOC*. Ed. by S. R. Kosaraju, M. Fellows, A. Wigderson, and J. A. Ellis. ACM, 1992, pp. 283–93. DOI: 10.1145/129712.129740.

[6] S. R. Buss. *Bounded Arithmetic*. Ed. by Bibliopolis. Vol. 3. Studies in Proof Theory. Lecture Notes. 1986.

[7] N. Chomsky. *Context-Free Grammars and Pushdown Storage*. Quarterly Progress Report 65. MIT RLE, Apr. 1962, pp. 187–194.

[8] M. Chrobak. "Hierarchies of One-Way Multihead Automata Languages". In: *Theoret. Comput. Sci.* 48.3 (1986), pp. 153–181. DOI: 10.1016/0304-3975(86)90093-9.

[9] A. Cobham. "The intrinsic computational difficulty of functions". In: *Logic, methodology and philosophy of science: Proceedings of the 1964 international congress held at the Hebrew university of Jerusalem, Israel, from August 26 to September 2, 1964*. Ed. by Y. Bar-Hillel. Studies in Logic and the foundations of mathematics. North-Holland Publishing Company, 1965, pp. 24–30.

<footnote n="1">¹To be fair, the author could not find a proof that this is the case for 1-way non-deterministic finite automata with one stack.</footnote>
[10] S. A. Cook. "Characterizations of Pushdown Machines in Terms of Time-Bounded Computers". In: *J. ACM* 18.1 (1971), pp. 4–18. DOI: 10.1145/321623.321625.

[11] R. Fagin. "Contributions to the Model Theory of Finite Structures". PhD thesis. University of California, Berkeley, 1973.

[12] E. Filiot, O. Gauwin, P.-A. Reynier, and F. Servais. "From Two-Way to One-Way Finite State Transducers". In: *LICS*. IEEE Computer Society, 2013, pp. 468–477. DOI: 10.1109/LICS.2013.53.

[13] J.-Y. Girard, A. Scedrov, and P. J. Scott. "Bounded linear logic: a modular approach to polynomial-time computability". In: *Theoret. Comput. Sci.* 97.1 (1992), pp. 1–66. DOI: 10.1016/0304-3975(92)90386-T.

[14] R. Glück. "Simulation of Two-Way Pushdown Automata Revisited". In: *Festschrift for Dave Schmidt*. Ed. by A. Banerjee, O. Danvy, K.-G. Doh, and J. Hatcliff. Vol. 129. EPTCS. 2013, pp. 250–258. DOI: 10.4204/EPTCS.129.15.

[15] M. Holzer, M. Kutrib, and A. Malcher. "Multi-Head Finite Automata: Characterizations, Concepts and Open Problems". In: *CSP*. Ed. by T. Neary, D. Woods, A. K. Seda, and N. Murphy. Vol. 1. EPTCS. 2008, pp. 93–107. DOI: 10.4204/EPTCS.1.9.

[16] O. H. Ibarra. "Characterizations of Some Tape and Time Complexity Classes of Turing Machines in Terms of Multihead and Auxiliary Stack Automata". In: *J. Comput. Syst. Sci.* 5.2 (1971), pp. 88–117. DOI: 10.1016/S0022-0000(71)80029-6.

[17] O. H. Ibarra. "On Two-way Multihead Automata". In: *J. Comput. Syst. Sci.* 7.1 (1973), pp. 28–36. DOI: 10.1016/S0022-0000(73)80048-0.

[18] S. C. Kleene. "Representation of events in nerve nets and finite automata". In: vol. 34. Annals of Mathematics Studies. Princeton, NJ, USA: Princeton University Press, 1956, pp. 3–42.

[19] D. Leivant. "Stratified Functional Programs and Computational Complexity". In: *POPL*. Ed. by M. S. Van Deusen and B. Lang. Charleston, South Carolina, USA: ACM Press, 1993, pp. 325–333. DOI: 10.1145/158511.158659.

[20] B. Monien. "Transformational Methods and their Application to Complexity Problems". In: *Acta Inform.* 6 (1976), pp. 95–108. DOI: 10.1007/BF00263746. See also [21].

[21] B. Monien. "Corrigenda: Transformational Methods and Their Application to Complexity Problems". In: *Acta Inform.* 8 (1977), pp. 383–384. DOI: 10.1007/BF00271346.

[22] B. Monien. "Two-Way Multihead Automata Over a One-Letter Alphabet". In: *Theor. Inform. Appl.* 14.1 (1980), pp. 67–82.

[23] I. H. Sudborough. "On Tape-Bounded Complexity Classes and Multi-Head Finite Automata". In: *SWAT (FOCS)*. IEEE Computer Society, 1973, pp. 138–144. DOI: 10.1109/SWAT.1973.20.

[24] I. H. Sudborough. "Separating Tape Bounded Auxiliary Pushdown Automata Classes". In: *STOC*. Ed. by J. E. Hopcroft, E. P. Friedman, and M. A. Harrison. ACM, 1977, pp. 208–217. DOI: 10.1145/800105.803410.

[25] I. H. Sudborough. "Some Remarks on Multihead Automata". In: *Theor. Inform. Appl.* 11.3 (1977), pp. 181–195.

[26] P. M. B. Vitányi and M. Li. "Kolmogorov complexity and its applications". In: *Handbook of Theoretical Computer Science. volume A: Algorithms and Complexity*. Ed. by J. Van Leeuwen. Elsevier, 1990, pp. 187–254.

[27] K. W. Wagner and G. Wechsung. *Computational Complexity*. Vol. 21. Mathematics and its Applications. Springer, 1986.

[28] A. C.-C. Yao and R. L. Rivest. "k+1 Heads Are Better Than k". In: *J. ACM* 25.2 (1978), pp. 337–340. DOI: 10.1145/322063.322076.

ACKNOWLEDGEMENTS

The author wish to thank, in no particular order, M. Bagnol, G. Bonfante, A. Durand, P. Jacobé de Naurois, U. dal Lago, P. Pistone, P.-A. Reynier, U. Schöpp, T. Seiller and the *TEX-LATEX Stack Exchange* community.

INRIA, UNIVERSITÉ PARIS-EST, LACL (EA 4219), UPEC, F-94010 CRÉTEIL, FRANCE
*E-mail address:* clement.aubert@lacl.fr
*URL:* https://lacl.fr/~caubert/