Exact XML Type Checking in Polynomial Time

  • Sebastian Maneth
  • Thomas Perst
  • Helmut Seidl
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4353)


Stay macro tree transducers (smtts) are an expressive formalism for reasoning about XSLT-like document transformations. Here, we consider the exact type checking problem for smtts. While the problem is decidable, the involved technique of inverse type inference is known to have exponential worst-case complexity (already for top-down transformations without parameters). We present a new adaptive type checking algorithm based on forward type inference through exact characterizations of output languages. The new algorithm correctly type-checks all call-by-value smtts. Given that the output type is specified by a deterministic automaton, the algorithm is polynomial-time whenever the transducer uses only few parameters and visits every input node only constantly often. Our new approach can also be generalized from smtts to stay macro forest transducers which additionally support concatenation as built-in output operation.


Function Symbol Output Type Input Symbol Input Tree Tree Automaton 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Boag, S., Chamberlin, D., et al. (eds.): XQuery 1.0: An XML Query Language. World Wide Web Consortium Working Draft (2003), Available at:
  2. 2.
    Bojańczyk, M., Walukiewicz, I.: Unranked Tree Algebra. Technical report, University of Warsaw (2005)Google Scholar
  3. 3.
    Clark, J., Murata, M., et al.: RelaxNG Specification. OASIS, Available online:
  4. 4.
    Engelfriet, J.: Context-Free Graph Grammars. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, pp. 125–213. Springer, Berlin (1997)Google Scholar
  5. 5.
    Engelfriet, J., Maneth, S.: Macro Tree Transducers, Attribute Grammars, and MSO Definable Tree Translations. Inform. and Comput. 154(1), 34–91 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Engelfriet, J., Maneth, S.: A Comparison of Pebble Tree Transducers with Macro Tree Transducers. Acta Informatica 39, 613–698 (2003)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Engelfriet, J., Schmidt, E.M.: IO and OI (I&II). J. Comp. Syst. Sci. 15, 328–353 (1977), 16, 67–99 (1978)zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Engelfriet, J., Vogler, H.: Macro Tree Transducers. J. Comp. Syst. Sci. 31, 71–146 (1985)zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Fischer, M.J.: Grammars with Macro-like Productions. PhD thesis, Harvard University, Massachusetts (1968)Google Scholar
  10. 10.
    Frisch, A.: Regular Tree Language Recognition with Static Information. In: PLAN-X (2004)Google Scholar
  11. 11.
    Hosoya, H., Frisch, A., Castagna, G.: Parametric Polymorphism for XML. In: POPL, pp. 50–62. ACM Press, New York (2005)Google Scholar
  12. 12.
    Hosoya, H., Pierce, B.C.: Regular expression pattern matching for XML. Journal of Functional Programming 13(6), 961–1004 (2002)CrossRefMathSciNetGoogle Scholar
  13. 13.
    Hosoya, H., Pierce, B.C.: XDuce: A Statically Typed XML Processing Language. ACM Trans. Inter. Tech. 3(2), 117–148 (2003)CrossRefGoogle Scholar
  14. 14.
    Kirkegaard, C., Møller, A., Schwartzbach, M.I.: Static Analysis of XML Transformations in Java. IEEE Trans. Soft. Eng. 30, 181–192 (2004)CrossRefGoogle Scholar
  15. 15.
    Maneth, S., Berlea, A., Perst, T., Seidl, H.: XML Type Checking with Macro Tree Transducers. In: PODS, pp. 283–294. ACM Press, New York (2005)Google Scholar
  16. 16.
    Martens, W., Neven, F.: Frontiers of Tractability for Typechecking Simple XML Transformations. In: PODS, pp. 23–34. ACM Press, New York (2004)CrossRefGoogle Scholar
  17. 17.
    Martens, W., Neven, F.: On the complexity of typechecking top-down xml transformations. Theor. Comput. Sci. 336, 153–180 (2005)zbMATHCrossRefMathSciNetGoogle Scholar
  18. 18.
    Milo, T., Suciu, D., Vianu, V.: Typechecking for XML Transformers. J. Comp. Syst. Sci. 66, 66–97 (2003)zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    Møller, A., Olesen, M., Schwartzbach, M.: Static Validation of XSL Transformations. Technical Report RS-05-32, BRICS (October 2005)Google Scholar
  20. 20.
    Møller, A., Schwartzbach, M.I.: The Design Space of Type Checkers for XML Transformation Languages. In: ICDT, pp. 17–36. Springer, Heidelberg (2005)Google Scholar
  21. 21.
    Murata, M., Lee, D., Mani, M.: Taxonomy of XML Schema Languages using Formal Language Theory. In: Extreme Markup Languages (2000)Google Scholar
  22. 22.
    Neven, F.: Automata Theory for XML Researchers. SIGMOD Record 31(3), 39–46 (2002)CrossRefGoogle Scholar
  23. 23.
    Perst, T., Seidl, H.: Macro Forest Transducers. Inf. Proc. Letters 89, 141–149 (2004)zbMATHCrossRefMathSciNetGoogle Scholar
  24. 24.
    Rounds, W.C.: Mappings and Grammars on Trees. Math. Systems Theory 4, 257–287 (1970)zbMATHCrossRefMathSciNetGoogle Scholar
  25. 25.
    Schmidt, A., Waas, F., Kersten, M.L., Carey, M.J., Manolescu, I., Busse, R.: Xmark: A benchmark for XML data management. In: VLDB, pp. 974–985. Morgan Kaufmann, San Francisco (2002)Google Scholar
  26. 26.
    Seidl, H.: Haskell Overloading is DEXPTIME Complete. Inf. Proc. Letters 52, 57–60 (1994)zbMATHCrossRefMathSciNetGoogle Scholar
  27. 27.
    Seidl, H.: Least Solutions of Equations over \(\cal N\). In: ICALP, pp. 400–411. Springer, Heidelberg (1994)Google Scholar
  28. 28.
    W3C. Extensible Markup Language (XML) 1.0, 2nd edn. (October 6, 2000), Available online:

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Sebastian Maneth
    • 1
  • Thomas Perst
    • 2
  • Helmut Seidl
    • 2
  1. 1.National ICT Australia and School of Computer Science and Engineering, UNSWSydney Research LabSydneyAustralia
  2. 2.Technische Universität MünchenGarchingGermany

Personalised recommendations