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

  • Joost Engelfriet
  • Kazuhiro Inaba
  • Sebastian ManethEmail author
Original Article


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.



We are grateful to the reviewers for their constructive comments.


  1. 1.
    Aho, A.V.: Indexed grammars—an extension of context-free grammars. J. ACM 15, 647–671 (1968)MathSciNetzbMATHCrossRefGoogle Scholar
  2. 2.
    Aho, A.V., Ullman, J.D.: Translations on a context-free grammar. Inf. Control 19, 439–475 (1971)MathSciNetzbMATHCrossRefGoogle Scholar
  3. 3.
    Asveld, P.R.J.: Time and space complexity of inside-out macro languages. Int. J. Comput. Math. 10, 3–14 (1981)MathSciNetzbMATHCrossRefGoogle Scholar
  4. 4.
    Baker, B.S.: Generalized syntax-directed translation, tree transducers, and linear space. SIAM J. Comput. 7, 376–391 (1978)MathSciNetzbMATHCrossRefGoogle Scholar
  5. 5.
    Bartha, M.: An algebraic definition of attributed transformations. Acta Cybern. 5, 409–421 (1982)MathSciNetzbMATHGoogle Scholar
  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)Google Scholar
  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)zbMATHCrossRefGoogle Scholar
  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)CrossRefGoogle Scholar
  9. 9.
    Bojańczyk, M., Colcombet, T.: Tree-walking automata do not recognize all regular languages. SIAM J. Comput. 38, 658–701 (2008)MathSciNetzbMATHCrossRefGoogle Scholar
  10. 10.
    Chandra, A.K., Kozen, D.C., Stockmeyer, L.J.: Alternation. J. ACM 28, 114–133 (1981)MathSciNetzbMATHCrossRefGoogle Scholar
  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)MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Courcelle, B.: Monadic second-order definable graph translations: a survey. Theor. Comput. Sci. 126, 53–75 (1994)zbMATHCrossRefGoogle Scholar
  14. 14.
    Courcelle, B., Engelfriet, J.: Graph Structure and Monadic Second-Order Logic. Cambridge University Press, Cambridge (2012)zbMATHCrossRefGoogle Scholar
  15. 15.
    Courcelle, B., Franchi-Zannettacci, P.: Attribute grammars and recursive program schemes I, II. Theor. Comput. Sci. 17(163–191), 235–257 (1982)MathSciNetzbMATHCrossRefGoogle Scholar
  16. 16.
    Damm, W.: The IO- and OI-hierarchies. Theor. Comput. Sci. 20, 95–207 (1982)MathSciNetzbMATHCrossRefGoogle Scholar
  17. 17.
    Deransart, P., Jourdan, M., Lorho, B.: Attribute Grammars—Definitions, Systems and Bibliography. Lecture Notes in Computer Science, vol. 323. Springer, Berlin (1988)zbMATHGoogle Scholar
  18. 18.
    Doner, J.: Tree acceptors and some of their applications. J. Comput. Syst. Sci. 4, 406–451 (1970)MathSciNetzbMATHCrossRefGoogle Scholar
  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)MathSciNetzbMATHCrossRefGoogle Scholar
  21. 21.
    Engelfriet, J.: On tree transducers for partial functions. Inf. Process. Lett. 7, 170–172 (1978)MathSciNetzbMATHCrossRefGoogle Scholar
  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)CrossRefGoogle Scholar
  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)Google Scholar
  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)MathSciNetzbMATHCrossRefGoogle Scholar
  26. 26.
    Engelfriet, J.: The time complexity of typechecking tree-walking tree transducers. Acta Inform. 46, 139–154 (2009)MathSciNetzbMATHCrossRefGoogle Scholar
  27. 27.
    Engelfriet, J., Filé, G.: The formal power of one-visit attribute grammars. Acta Inform. 16, 275–302 (1981)MathSciNetzbMATHCrossRefGoogle Scholar
  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)MathSciNetzbMATHCrossRefGoogle Scholar
  30. 30.
    Engelfriet, J., Maneth, S.: Output string languages of compositions of deterministic macro tree transducers. J. Comput. Syst. Sci. 64, 350–395 (2002)MathSciNetzbMATHCrossRefGoogle Scholar
  31. 31.
    Engelfriet, J., Maneth, S.: A comparison of pebble tree transducers with macro tree transducers. Acta Inform. 39, 613–698 (2003)MathSciNetzbMATHCrossRefGoogle Scholar
  32. 32.
    Engelfriet, J., Maneth, S.: Macro tree translations of linear size increase are MSO definable. SIAM J. Comput. 32, 950–1006 (2003)MathSciNetzbMATHCrossRefGoogle Scholar
  33. 33.
    Engelfriet, J., Schmidt, E.M.: IO and OI, Part II. J. Comput. Syst. Sci. 16, 67–99 (1978)zbMATHCrossRefGoogle Scholar
  34. 34.
    Engelfriet, J., Vogler, H.: Macro tree transducers. J. Comput. Syst. Sci. 31, 71–146 (1985)MathSciNetzbMATHCrossRefGoogle Scholar
  35. 35.
    Engelfriet, J., Vogler, H.: High level tree transducers and iterated pushdown tree transducers. Acta Inform. 26, 131–192 (1988)MathSciNetzbMATHCrossRefGoogle Scholar
  36. 36.
    Ésik, Z.: Decidability results concerning tree transducers I. Acta Cybern. 5, 1–20 (1980)MathSciNetzbMATHGoogle Scholar
  37. 37.
    Fischer, M.J.: Grammars with Macro-Like Productions. Ph.D. thesis, Harvard University (1968)Google Scholar
  38. 38.
    Fülöp, Z.: On attributed tree transducers. Acta Cybern. 5, 261–279 (1981)MathSciNetzbMATHGoogle Scholar
  39. 39.
    Fülöp, Z., Vogler, H.: Syntax-Directed Semantics—Formal Models Based on Tree Transducers. Springer, Berlin (1998)zbMATHCrossRefGoogle Scholar
  40. 40.
    Ganzinger, H.: Increasing modularity and language-independency in automatically generated compilers. Sci. Comput. Program. 3, 223–278 (1983)MathSciNetzbMATHCrossRefGoogle Scholar
  41. 41.
    Ganzinger, H., Giegerich, R.: Attribute coupled grammars. In: Proceedings of SIGPLAN’84. SIGPLAN Notices, vol. 19, pp. 157–170 (1984)CrossRefGoogle Scholar
  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)zbMATHGoogle Scholar
  43. 43.
    Gécseg, F., Steinby, M.: Tree Automata. Akadémiai Kiadó, Budapest (1984). A re-edition is available at arXiv:1509.06233 zbMATHGoogle Scholar
  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)Google Scholar
  45. 45.
    Giegerich, R.: Composition and evaluation of attribute coupled grammars. Acta Inform. 25, 355–423 (1988)MathSciNetzbMATHCrossRefGoogle Scholar
  46. 46.
    Harrison, M.A.: Introduction to Formal Language Theory. Addison-Wesley, Boston (1978)zbMATHGoogle Scholar
  47. 47.
    Hosoya, H.: Foundations of XML Processing—The Tree-Automata Approach. Cambridge University Press, Cambridge (2011)zbMATHGoogle Scholar
  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)Google Scholar
  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)MathSciNetzbMATHCrossRefGoogle Scholar
  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)Google Scholar
  55. 55.
    Kühnemann, A.: Berechnungsstärken von Teilklassen primitiv-rekursiver Programmschemata. Ph.D. thesis, Technical University of Dresden, Shaker Verlag (1997)Google Scholar
  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)Google Scholar
  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)Google Scholar
  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)CrossRefGoogle Scholar
  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)Google Scholar
  60. 60.
    Maneth, S.: A survey on decidable equivalence problems for tree transducers. Int. J. Found. Comput. Sci. 26, 1069–1100 (2015)MathSciNetzbMATHCrossRefGoogle Scholar
  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)zbMATHCrossRefGoogle Scholar
  63. 63.
    Milo, T., Suciu, D., Vianu, D.: Typechecking for XML transformers. J. Comput. Syst. Sci. 66, 66–97 (2003)MathSciNetzbMATHCrossRefGoogle Scholar
  64. 64.
    Papadimitriou, C.H.: Computational Complexity. Addison-Wesley, Boston (1994)zbMATHGoogle Scholar
  65. 65.
    Perst, T., Seidl, H.: Macro forest transducers. Inf. Process. Lett. 89, 141–149 (2004)MathSciNetzbMATHCrossRefGoogle Scholar
  66. 66.
    Rounds, W.C.: Mappings and grammars on trees. Math. Syst. Theory 4, 257–287 (1970)MathSciNetzbMATHCrossRefGoogle Scholar
  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)Google Scholar
  68. 68.
    Ruzzo, W.L.: Tree-size bounded alternation. J. Comput. Syst. Sci. 21, 218–235 (1980)MathSciNetzbMATHCrossRefGoogle Scholar
  69. 69.
    Schwentick, T.: Automata for XML—a survey. J. Comput. Syst. Sci. 73, 289–315 (2007)MathSciNetzbMATHCrossRefGoogle Scholar
  70. 70.
    Slutzki, G.: Alternating tree automata. Theor. Comput. Sci. 41, 305–318 (1985)MathSciNetzbMATHCrossRefGoogle Scholar
  71. 71.
    Sudborough, I.H.: On the tape complexity of deterministic context-free languages. J. ACM 25, 405–414 (1978)MathSciNetzbMATHCrossRefGoogle Scholar
  72. 72.
    Thatcher, J.W.: Generalized\(^2\) sequential machine maps. J. Comput. Syst. Sci. 4, 339–367 (1970)MathSciNetzbMATHCrossRefGoogle Scholar
  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)MathSciNetzbMATHCrossRefGoogle Scholar
  74. 74.
    Van Leeuwen, J.: The membership question for ETOL-languages is polynomially complete. Information Processing Letters 3, 138–143 (1975)MathSciNetzbMATHCrossRefGoogle Scholar
  75. 75.
    Vogler, H.: The OI-hierarchy is closed under control. Information and Computation 78, 187–204 (1988)MathSciNetzbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag GmbH Germany, part of Springer Nature 2019

Authors and Affiliations

  • Joost Engelfriet
    • 1
  • Kazuhiro Inaba
    • 2
  • Sebastian Maneth
    • 3
    Email author
  1. 1.LIACSLeiden UniversityLeidenThe Netherlands
  2. 2.Google Japan G.K.TokyoJapan
  3. 3.Department of Mathematics and InformaticsUniversität BremenBremenGermany

Personalised recommendations