Abstract
Compositions of tree-walking tree transducers form a hierarchy with respect to the number of transducers in the composition. As main technical result it is proved that any such composition can be realized as a linear-bounded composition, which means that the sizes of the intermediate results can be chosen to be at most linear in the size of the output tree. This has consequences for the expressiveness and complexity of the translations in the hierarchy. First, if the computed translation is a function of linear size increase, i.e., the size of the output tree is at most linear in the size of the input tree, then it can be realized by just one, deterministic, tree-walking tree transducer. For compositions of deterministic transducers it is decidable whether or not the translation is of linear size increase. Second, every composition of deterministic transducers can be computed in deterministic linear time on a RAM and in deterministic linear space on a Turing machine, measured in the sum of the sizes of the input and output tree. Similarly, every composition of nondeterministic transducers can be computed in simultaneous polynomial time and linear space on a nondeterministic Turing machine. Their output tree languages are deterministic context-sensitive, i.e., can be recognized in deterministic linear space on a Turing machine. The membership problem for compositions of nondeterministic translations is nondeterministic polynomial time and deterministic linear space. All the above results also hold for compositions of macro tree transducers. The membership problem for the composition of a nondeterministic and a deterministic tree-walking tree translation (for a nondeterministic IO macro tree translation) is log-space reducible to a context-free language, whereas the membership problem for the composition of a deterministic and a nondeterministic tree-walking tree translation (for a nondeterministic OI macro tree translation) is possibly NP-complete.
Similar content being viewed by others
Notes
The name “tree-walking tree transducer” was introduced in [26]. The adjective “tree-walking” stands for the fact that the transducer walks on the input tree (just as the tree-walking automaton of [2]). The tt is the generalization to trees of the two-way finite-state string transducer, which walks on its input string in both directions and produces the output string one-way from left to right. Note that “tree-walking” and “two-way” alliterate.
That is as opposed to a “backward deterministic” context-free grammar in which distinct rules have distinct right-hand sides, see, e.g., [26]. A forward deterministic context-free grammar that generates a string is also called a “straight-line” context-free grammar.
The tt M is circular if there exist \(t\in T_\varSigma \), \(u\in \mathcal{N}(t)\), \(q\in Q\), and \(s\in T_\varDelta ({\text {Con}}(t))\) such that \(\langle q,u \rangle \Rightarrow ^*_{M,t} s\) and \(\langle q,u \rangle \) occurs in s. Thus, M is noncircular if and only if \(G_{M,t}\) is nonrecursive for every \(t\in T_\varSigma \), which implies that \(L(G_{M,t})\) is finite. Note that a total deterministic tt is noncircular if and only if for every \(t\in T_\varSigma \), \(u\in \mathcal{N}(t)\), and \(q\in Q\) there exists \(s\in T_\varDelta \) such that \(\langle q,u \rangle \Rightarrow ^*_{M,t} s\). It can be shown that for every finitary tt there is an equivalent noncircular tt, but that will not be needed in this paper.
In [28], \({\textsf {dTT}} \) and \({\textsf {dTT}} ^\ell \) are denoted by \({\textsf {dTT}} ^{{{\textsc {mso}}}}\) and \({\textsf {dTT}} \), respectively.
We note that an alternative proof is by Lemma 26 (in Sect. 6) and [34, Theorem 7.4] (see also [65, Section 5]). For the reader familiar with mso translations, see [14], we note that it is proved in [29, Section 4] that \({\textsf {dTT}} ^{\mathrm {s}}_\mathrm {rel}\) is the class of mso (tree) relabelings, and that REGT, which is the class of mso definable tree languages, is closed under inverse mso (tree) transductions by [14, Corollary 7.12].
To be precise, the regular sub-test \(T({\text {mark}}(T^\bullet _\varSigma ))\).
For the definition of \(\alpha (u)\) see Sect. 3.
Recall from Sect. 2 that the rank of a node is the rank of its label, i.e., the number of its children.
To be precise, \(|t|\le (2\cdot |t|_0-1)+|t|_1\) where \(|t|_0\) and \(|t|_1\) are the number of leaves and monadic nodes of t, respectively.
There are several such computations, but they all have the same unique derivation tree in \(L(G^\mathrm {der}_{M,t})\). The definition of productivity clearly does not depend on the particular choice of the derivation.
We do not know whether Theorem 44 holds for nondeterministic tt’s, i.e., whether it is decidable for a composition of nondeterministic tt’s whether or not it realizes a translation in \({\textsf {LSIF}} \).
A “visible” pebble can be observed by the transducer during its entire life time (as usual for pebbles), whereas an “invisible” pebble p cannot be observed during the life time of a pebble \(p'\) of which the life time is nested within the one of p; thus, such a pebble \(p'\) “hides” the pebble p.
Note that there is a straightforward one-to-one correspondence between the leftmost derivations of G and \(G'\), and between their derivation trees. Since G is \(\varepsilon \)-free, the derivation trees have the same height.
Note that a node of t has the same label and child number in t and \(\#(t,s)\), except when it has child number 1 in \(\#(t,s)\) in which case it has child number 0 or 1 in t, depending on whether or not its parent in \(\#(t,s)\) has label \(\#\).
The path language of a tree \(s\in T_\varOmega \) consists of all strings in \(\varOmega ^*\) that are obtained by walking along a path from the root of s to one of its leaves, writing down the labels of the nodes of that path from left to right.
In fact, \(\mathrm{enc}_\varSigma \) can even be computed without pushdown: for every forest \(f\in F_\varSigma \), \(\mathrm{enc}_\varSigma (f)\) can be obtained from f by removing all left-brackets, changing each right-bracket into e, and adding one e at the end.
It can be shown that the nondeterministic version of Lemma 73 also holds, but we will not do that here.
References
Aho, A.V.: Indexed grammars—an extension of context-free grammars. J. ACM 15, 647–671 (1968)
Aho, A.V., Ullman, J.D.: Translations on a context-free grammar. Inf. Control 19, 439–475 (1971)
Asveld, P.R.J.: Time and space complexity of inside-out macro languages. Int. J. Comput. Math. 10, 3–14 (1981)
Baker, B.S.: Generalized syntax-directed translation, tree transducers, and linear space. SIAM J. Comput. 7, 376–391 (1978)
Bartha, M.: An algebraic definition of attributed transformations. Acta Cybern. 5, 409–421 (1982)
Bloem, R., Engelfriet, J.: Monadic second order logic and node relations on graphs and trees. In: Mycielski, J., Rozenberg, G., Salomaa, A. (eds.) Structures in Logic and Computer Science. Lecture Notes in Computer Science, vol. 1261, pp. 144–161. Springer, Berlin. A corrected version is available at https://www.researchgate.net/publication/221350026 (1997)
Bloem, R., Engelfriet, J.: A comparison of tree translations defined by monadic second order logic and by attribute grammars. J. Comput. Syst. Sci. 61, 1–50 (2000)
Bogaert, B., Tison, S.: Equality and disequality constraints on direct subterms in tree automata. In: Finkel, A., Jantzen, M. (eds.) Proceedings of STACS’92. Lecture Notes in Computer Science, vol. 577, pp. 161–171. Springer, Berlin (1992)
Bojańczyk, M., Colcombet, T.: Tree-walking automata do not recognize all regular languages. SIAM J. Comput. 38, 658–701 (2008)
Chandra, A.K., Kozen, D.C., Stockmeyer, L.J.: Alternation. J. ACM 28, 114–133 (1981)
Comon, H. et al.: Tree Automata Techniques and Applications. http://tata.gforge.inria.fr/. Accessed 15 Mar 2019
Cook, S.A.: Characterizations of pushdown machines in terms of time-bounded computers. J. ACM 18, 4–18 (1971)
Courcelle, B.: Monadic second-order definable graph translations: a survey. Theor. Comput. Sci. 126, 53–75 (1994)
Courcelle, B., Engelfriet, J.: Graph Structure and Monadic Second-Order Logic. Cambridge University Press, Cambridge (2012)
Courcelle, B., Franchi-Zannettacci, P.: Attribute grammars and recursive program schemes I, II. Theor. Comput. Sci. 17(163–191), 235–257 (1982)
Damm, W.: The IO- and OI-hierarchies. Theor. Comput. Sci. 20, 95–207 (1982)
Deransart, P., Jourdan, M., Lorho, B.: Attribute Grammars—Definitions, Systems and Bibliography. Lecture Notes in Computer Science, vol. 323. Springer, Berlin (1988)
Doner, J.: Tree acceptors and some of their applications. J. Comput. Syst. Sci. 4, 406–451 (1970)
Engelfriet, J.: Tree automata and tree grammars. DAIMI FN-10 Lecture Notes, Aarhus University. A slightly revised version is available at arXiv:1510.02036 (1975)
Engelfriet, J.: Top-down tree transducers with regular look-ahead. Math. Syst. Theory 10, 289–303 (1977)
Engelfriet, J.: On tree transducers for partial functions. Inf. Process. Lett. 7, 170–172 (1978)
Engelfriet, J.: Some open questions and recent results on tree transducers and tree languages. In: Book, R.V. (ed.) Formal Language Theory—Perspectives and Open Problems, pp. 241–286. Academic Press, London (1980)
Engelfriet, J.: Attribute grammars: attribute evaluation methods. In: Lorho, B. (ed.) Methods and Tools for Compiler Construction, pp. 103–138. Cambridge University Press, Cambridge (1984)
Engelfriet, J.: Context-free grammars with storage. Technical Report 86-11, University of Leiden. A slightly revised version is available at arXiv:1408.0683 (1986)
Engelfriet, J.: The complexity of languages generated by attribute grammars. SIAM J. Comput. 15, 70–86 (1986)
Engelfriet, J.: The time complexity of typechecking tree-walking tree transducers. Acta Inform. 46, 139–154 (2009)
Engelfriet, J., Filé, G.: The formal power of one-visit attribute grammars. Acta Inform. 16, 275–302 (1981)
Engelfriet, J., Hoogeboom, H.J., Samwel, B.: XML navigation and transformation by tree-walking automata and transducers with visible and invisible pebbles. Technical Report. arXiv:1809.05730 (2018)
Engelfriet, J., Maneth, S.: Macro tree transducers, attribute grammars, and MSO definable tree translations. Inf. Comput. 154, 34–91 (1999)
Engelfriet, J., Maneth, S.: Output string languages of compositions of deterministic macro tree transducers. J. Comput. Syst. Sci. 64, 350–395 (2002)
Engelfriet, J., Maneth, S.: A comparison of pebble tree transducers with macro tree transducers. Acta Inform. 39, 613–698 (2003)
Engelfriet, J., Maneth, S.: Macro tree translations of linear size increase are MSO definable. SIAM J. Comput. 32, 950–1006 (2003)
Engelfriet, J., Schmidt, E.M.: IO and OI, Part II. J. Comput. Syst. Sci. 16, 67–99 (1978)
Engelfriet, J., Vogler, H.: Macro tree transducers. J. Comput. Syst. Sci. 31, 71–146 (1985)
Engelfriet, J., Vogler, H.: High level tree transducers and iterated pushdown tree transducers. Acta Inform. 26, 131–192 (1988)
Ésik, Z.: Decidability results concerning tree transducers I. Acta Cybern. 5, 1–20 (1980)
Fischer, M.J.: Grammars with Macro-Like Productions. Ph.D. thesis, Harvard University (1968)
Fülöp, Z.: On attributed tree transducers. Acta Cybern. 5, 261–279 (1981)
Fülöp, Z., Vogler, H.: Syntax-Directed Semantics—Formal Models Based on Tree Transducers. Springer, Berlin (1998)
Ganzinger, H.: Increasing modularity and language-independency in automatically generated compilers. Sci. Comput. Program. 3, 223–278 (1983)
Ganzinger, H., Giegerich, R.: Attribute coupled grammars. In: Proceedings of SIGPLAN’84. SIGPLAN Notices, vol. 19, pp. 157–170 (1984)
Garey, M.R., Johnson, D.S.: Computers and Intractability—A Guide to the Theory of NP-Completeness. W. H. Freeman and Co, New York (1979)
Gécseg, F., Steinby, M.: Tree Automata. Akadémiai Kiadó, Budapest (1984). A re-edition is available at arXiv:1509.06233
Gécseg, F., Steinby, M.: Tree languages. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, vol. 3 (Chapter 1). Springer, Berlin (1997)
Giegerich, R.: Composition and evaluation of attribute coupled grammars. Acta Inform. 25, 355–423 (1988)
Harrison, M.A.: Introduction to Formal Language Theory. Addison-Wesley, Boston (1978)
Hosoya, H.: Foundations of XML Processing—The Tree-Automata Approach. Cambridge University Press, Cambridge (2011)
Inaba, K.: Complexity and Expressiveness of Models of XML Transformations. Ph.D. thesis, The University of Tokyo. http://www.kmonos.net/pub/files/phd.pdf (2009). Accessed 15 Mar 2019
Inaba, K., Hosoya, H.: Multi-return macro tree transducers. In: Proceedings of PLAN-X 2008. http://www.kmonos.net/pub/files/mrmtt08.pdf (2008)
Inaba, K., Hosoya, H., Maneth, S.: Multi-return macro tree transducers. In: Ibarra, O.H., Ravikumar, B. (eds.) Proceedings of CIAA’08. Lecture Notes in Computer Science, vol. 5148, pp. 102–111. Springer, Berlin (2008)
Inaba, K., Maneth, S.: The complexity of tree transducer output languages. In: Hariharan, R., Mukund, M., Vinay, V. (eds) Proceedings of FSTTCS’08, pp. 244–255. http://drops.dagstuhl.de/opus/volltexte/2008/1757 (2008). Accessed 15 Mar 2019
Inaba, K., Maneth S.: The complexity of translation membership for macro tree transducers. In: Proceedings of PLAN-X’09. arXiv:0910.2315 (2009)
Knuth, D.E.: Semantics of context-free languages. Math. Syst. Theory 2, 127–145 (1968)
Kobayashi, N., Inaba, K., Tsukada, T.: Unsafe order-2 tree languages are context-sensitive. In: Muscholl, A. (ed.) Proceedings of FOSSACS’14. Lecture Notes in Computer Science, vol. 8412, pp. 149–163. Springer, Berlin (2014)
Kühnemann, A.: Berechnungsstärken von Teilklassen primitiv-rekursiver Programmschemata. Ph.D. thesis, Technical University of Dresden, Shaker Verlag (1997)
Kühnemann, A.: Benefits of tree transducers for optimizing functional programs. In: Arvind, V., Ramanujam, R. (eds) Proceedings of FSTTCS’98. Lecture Notes in Computer Science, vol. 1530, pp. 146–158. Springer, Berlin (1998)
Lewis, P.M., Stearns, R.E., Hartmanis, J.: Memory bounds for the recognition of context-free and context-sensitive languages. In: Proceedings of 6th Annual IEEE Symposium on Switching Circuit Theory and Logical Design, pp. 191–212 (1965)
Maneth, S.: The complexity of compositions of deterministic tree transducers. In: Agrawal, M., Seth, A. (eds) Proceedings of FSTTCS’02. Lecture Notes in Computer Science, vol. 2556, pp. 265–276. Springer, Berlin (2002)
Maneth, S.: The macro tree transducer hierarchy collapses for functions of linear size increase. In: Pandya, P.K., Radhakrishnan, J. (eds) Proceedings of FSTTCS’03. Lecture Notes in Computer Science, vol. 2914, pp. 326–337. Springer, Berlin (2003)
Maneth, S.: A survey on decidable equivalence problems for tree transducers. Int. J. Found. Comput. Sci. 26, 1069–1100 (2015)
Maneth, S., Berlea, A., Perst, T., Seidl, H.: XML type checking with macro tree transducers. In: Proceedings of PODS’05, pp. 283–294. ACM Press (2005). Technical Report TUM-I0407 of the Technische Universität München (2004) is available at https://www.researchgate.net/publication/221559877
Maneth, S., Friese, S., Seidl, H.: Type checking of tree walking transducers. In: D’Souza, D., Shankar, P. (eds.) Modern Applications of Automata Theory. IISc Research Monographs Series 2, pp. 325–372. World Scientific, Singapore (2012)
Milo, T., Suciu, D., Vianu, D.: Typechecking for XML transformers. J. Comput. Syst. Sci. 66, 66–97 (2003)
Papadimitriou, C.H.: Computational Complexity. Addison-Wesley, Boston (1994)
Perst, T., Seidl, H.: Macro forest transducers. Inf. Process. Lett. 89, 141–149 (2004)
Rounds, W.C.: Mappings and grammars on trees. Math. Syst. Theory 4, 257–287 (1970)
Rounds, W.C.: Complexity of recognition in intermediate-level languages. In: Proceedings of 14th Annual Symposium on Switching and Automata Theory, pp. 145–158 (1973)
Ruzzo, W.L.: Tree-size bounded alternation. J. Comput. Syst. Sci. 21, 218–235 (1980)
Schwentick, T.: Automata for XML—a survey. J. Comput. Syst. Sci. 73, 289–315 (2007)
Slutzki, G.: Alternating tree automata. Theor. Comput. Sci. 41, 305–318 (1985)
Sudborough, I.H.: On the tape complexity of deterministic context-free languages. J. ACM 25, 405–414 (1978)
Thatcher, J.W.: Generalized\(^2\) sequential machine maps. J. Comput. Syst. Sci. 4, 339–367 (1970)
Thatcher, J.W., Wright, J.B.: Generalized finite automata theory with an application to a decision problem of second-order logic. Mathematical Systems Theory 2, 57–81 (1968)
Van Leeuwen, J.: The membership question for ETOL-languages is polynomially complete. Information Processing Letters 3, 138–143 (1975)
Vogler, H.: The OI-hierarchy is closed under control. Information and Computation 78, 187–204 (1988)
Acknowledgements
We are grateful to the reviewers for their constructive comments.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Engelfriet, J., Inaba, K. & Maneth, S. Linear-bounded composition of tree-walking tree transducers: linear size increase and complexity. Acta Informatica 58, 95–152 (2021). https://doi.org/10.1007/s00236-019-00360-8
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00236-019-00360-8