Linear-bounded composition of tree-walking tree transducers: linear size increase and complexity


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.

This is a preview of subscription content, log in to check access.

Access options

Buy single article

Instant unlimited access to the full article PDF.

US$ 39.95

Price includes VAT for USA

Subscribe to journal

Immediate online access to all issues from 2019. Subscription will auto renew annually.

US$ 99

This is the net price. Taxes to be calculated in checkout.


  1. 1.

    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.

  2. 2.

    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.

  3. 3.

    The ttM 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.

  4. 4.

    In [28], \({\textsf {dTT}} \) and \({\textsf {dTT}} ^\ell \) are denoted by \({\textsf {dTT}} ^{{{\textsc {mso}}}}\) and \({\textsf {dTT}} \), respectively.

  5. 5.

    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].

  6. 6.

    To be precise, the regular sub-test \(T({\text {mark}}(T^\bullet _\varSigma ))\).

  7. 7.

    For the definition of \(\alpha (u)\) see Sect. 3.

  8. 8.

    By mistake, [31, Theorem 35] is stated for \(n\ge 1\) only. It also holds for \(n=0\) by [31, Lemma 34 and Theorem 31].

  9. 9.

    Recall from Sect. 2 that the rank of a node is the rank of its label, i.e., the number of its children.

  10. 10.

    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.

  11. 11.

    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.

  12. 12.

    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}} \).

  13. 13.

    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.

  14. 14.

    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.

  15. 15.

    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 \(\#\).

  16. 16.

    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.

  17. 17.

    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.

  18. 18.

    It can be shown that the nondeterministic version of Lemma 73 also holds, but we will not do that here.


  1. 1.

    Aho, A.V.: Indexed grammars—an extension of context-free grammars. J. ACM 15, 647–671 (1968)

  2. 2.

    Aho, A.V., Ullman, J.D.: Translations on a context-free grammar. Inf. Control 19, 439–475 (1971)

  3. 3.

    Asveld, P.R.J.: Time and space complexity of inside-out macro languages. Int. J. Comput. Math. 10, 3–14 (1981)

  4. 4.

    Baker, B.S.: Generalized syntax-directed translation, tree transducers, and linear space. SIAM J. Comput. 7, 376–391 (1978)

  5. 5.

    Bartha, M.: An algebraic definition of attributed transformations. Acta Cybern. 5, 409–421 (1982)

  6. 6.

    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 (1997)

  7. 7.

    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)

  8. 8.

    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)

  9. 9.

    Bojańczyk, M., Colcombet, T.: Tree-walking automata do not recognize all regular languages. SIAM J. Comput. 38, 658–701 (2008)

  10. 10.

    Chandra, A.K., Kozen, D.C., Stockmeyer, L.J.: Alternation. J. ACM 28, 114–133 (1981)

  11. 11.

    Comon, H. et al.: Tree Automata Techniques and Applications. Accessed 15 Mar 2019

  12. 12.

    Cook, S.A.: Characterizations of pushdown machines in terms of time-bounded computers. J. ACM 18, 4–18 (1971)

  13. 13.

    Courcelle, B.: Monadic second-order definable graph translations: a survey. Theor. Comput. Sci. 126, 53–75 (1994)

  14. 14.

    Courcelle, B., Engelfriet, J.: Graph Structure and Monadic Second-Order Logic. Cambridge University Press, Cambridge (2012)

  15. 15.

    Courcelle, B., Franchi-Zannettacci, P.: Attribute grammars and recursive program schemes I, II. Theor. Comput. Sci. 17(163–191), 235–257 (1982)

  16. 16.

    Damm, W.: The IO- and OI-hierarchies. Theor. Comput. Sci. 20, 95–207 (1982)

  17. 17.

    Deransart, P., Jourdan, M., Lorho, B.: Attribute Grammars—Definitions, Systems and Bibliography. Lecture Notes in Computer Science, vol. 323. Springer, Berlin (1988)

  18. 18.

    Doner, J.: Tree acceptors and some of their applications. J. Comput. Syst. Sci. 4, 406–451 (1970)

  19. 19.

    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)

  20. 20.

    Engelfriet, J.: Top-down tree transducers with regular look-ahead. Math. Syst. Theory 10, 289–303 (1977)

  21. 21.

    Engelfriet, J.: On tree transducers for partial functions. Inf. Process. Lett. 7, 170–172 (1978)

  22. 22.

    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)

  23. 23.

    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)

  24. 24.

    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)

  25. 25.

    Engelfriet, J.: The complexity of languages generated by attribute grammars. SIAM J. Comput. 15, 70–86 (1986)

  26. 26.

    Engelfriet, J.: The time complexity of typechecking tree-walking tree transducers. Acta Inform. 46, 139–154 (2009)

  27. 27.

    Engelfriet, J., Filé, G.: The formal power of one-visit attribute grammars. Acta Inform. 16, 275–302 (1981)

  28. 28.

    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)

  29. 29.

    Engelfriet, J., Maneth, S.: Macro tree transducers, attribute grammars, and MSO definable tree translations. Inf. Comput. 154, 34–91 (1999)

  30. 30.

    Engelfriet, J., Maneth, S.: Output string languages of compositions of deterministic macro tree transducers. J. Comput. Syst. Sci. 64, 350–395 (2002)

  31. 31.

    Engelfriet, J., Maneth, S.: A comparison of pebble tree transducers with macro tree transducers. Acta Inform. 39, 613–698 (2003)

  32. 32.

    Engelfriet, J., Maneth, S.: Macro tree translations of linear size increase are MSO definable. SIAM J. Comput. 32, 950–1006 (2003)

  33. 33.

    Engelfriet, J., Schmidt, E.M.: IO and OI, Part II. J. Comput. Syst. Sci. 16, 67–99 (1978)

  34. 34.

    Engelfriet, J., Vogler, H.: Macro tree transducers. J. Comput. Syst. Sci. 31, 71–146 (1985)

  35. 35.

    Engelfriet, J., Vogler, H.: High level tree transducers and iterated pushdown tree transducers. Acta Inform. 26, 131–192 (1988)

  36. 36.

    Ésik, Z.: Decidability results concerning tree transducers I. Acta Cybern. 5, 1–20 (1980)

  37. 37.

    Fischer, M.J.: Grammars with Macro-Like Productions. Ph.D. thesis, Harvard University (1968)

  38. 38.

    Fülöp, Z.: On attributed tree transducers. Acta Cybern. 5, 261–279 (1981)

  39. 39.

    Fülöp, Z., Vogler, H.: Syntax-Directed Semantics—Formal Models Based on Tree Transducers. Springer, Berlin (1998)

  40. 40.

    Ganzinger, H.: Increasing modularity and language-independency in automatically generated compilers. Sci. Comput. Program. 3, 223–278 (1983)

  41. 41.

    Ganzinger, H., Giegerich, R.: Attribute coupled grammars. In: Proceedings of SIGPLAN’84. SIGPLAN Notices, vol. 19, pp. 157–170 (1984)

  42. 42.

    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)

  43. 43.

    Gécseg, F., Steinby, M.: Tree Automata. Akadémiai Kiadó, Budapest (1984). A re-edition is available at arXiv:1509.06233

  44. 44.

    Gécseg, F., Steinby, M.: Tree languages. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, vol. 3 (Chapter 1). Springer, Berlin (1997)

  45. 45.

    Giegerich, R.: Composition and evaluation of attribute coupled grammars. Acta Inform. 25, 355–423 (1988)

  46. 46.

    Harrison, M.A.: Introduction to Formal Language Theory. Addison-Wesley, Boston (1978)

  47. 47.

    Hosoya, H.: Foundations of XML Processing—The Tree-Automata Approach. Cambridge University Press, Cambridge (2011)

  48. 48.

    Inaba, K.: Complexity and Expressiveness of Models of XML Transformations. Ph.D. thesis, The University of Tokyo. (2009). Accessed 15 Mar 2019

  49. 49.

    Inaba, K., Hosoya, H.: Multi-return macro tree transducers. In: Proceedings of PLAN-X 2008. (2008)

  50. 50.

    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)

  51. 51.

    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. (2008). Accessed 15 Mar 2019

  52. 52.

    Inaba, K., Maneth S.: The complexity of translation membership for macro tree transducers. In: Proceedings of PLAN-X’09. arXiv:0910.2315 (2009)

  53. 53.

    Knuth, D.E.: Semantics of context-free languages. Math. Syst. Theory 2, 127–145 (1968)

  54. 54.

    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)

  55. 55.

    Kühnemann, A.: Berechnungsstärken von Teilklassen primitiv-rekursiver Programmschemata. Ph.D. thesis, Technical University of Dresden, Shaker Verlag (1997)

  56. 56.

    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)

  57. 57.

    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)

  58. 58.

    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)

  59. 59.

    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)

  60. 60.

    Maneth, S.: A survey on decidable equivalence problems for tree transducers. Int. J. Found. Comput. Sci. 26, 1069–1100 (2015)

  61. 61.

    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

  62. 62.

    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)

  63. 63.

    Milo, T., Suciu, D., Vianu, D.: Typechecking for XML transformers. J. Comput. Syst. Sci. 66, 66–97 (2003)

  64. 64.

    Papadimitriou, C.H.: Computational Complexity. Addison-Wesley, Boston (1994)

  65. 65.

    Perst, T., Seidl, H.: Macro forest transducers. Inf. Process. Lett. 89, 141–149 (2004)

  66. 66.

    Rounds, W.C.: Mappings and grammars on trees. Math. Syst. Theory 4, 257–287 (1970)

  67. 67.

    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)

  68. 68.

    Ruzzo, W.L.: Tree-size bounded alternation. J. Comput. Syst. Sci. 21, 218–235 (1980)

  69. 69.

    Schwentick, T.: Automata for XML—a survey. J. Comput. Syst. Sci. 73, 289–315 (2007)

  70. 70.

    Slutzki, G.: Alternating tree automata. Theor. Comput. Sci. 41, 305–318 (1985)

  71. 71.

    Sudborough, I.H.: On the tape complexity of deterministic context-free languages. J. ACM 25, 405–414 (1978)

  72. 72.

    Thatcher, J.W.: Generalized\(^2\) sequential machine maps. J. Comput. Syst. Sci. 4, 339–367 (1970)

  73. 73.

    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)

  74. 74.

    Van Leeuwen, J.: The membership question for ETOL-languages is polynomially complete. Information Processing Letters 3, 138–143 (1975)

  75. 75.

    Vogler, H.: The OI-hierarchy is closed under control. Information and Computation 78, 187–204 (1988)

Download references


We are grateful to the reviewers for their constructive comments.

Author information

Correspondence to Sebastian Maneth.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Engelfriet, J., Inaba, K. & Maneth, S. Linear-bounded composition of tree-walking tree transducers: linear size increase and complexity. Acta Informatica (2019).

Download citation