Counting in Trees for Free

  • Helmut Seidl
  • Thomas Schwentick
  • Anca Muscholl
  • Peter Habermehl
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3142)


It is known that MSO logic for ordered unranked trees is undecidable if Presburger constraints are allowed at children of nodes. We show here that a decidable logic is obtained if we use a modal fixpoint logic instead. We present a characterization of this logic by means of deterministic Presburger tree automata and show how it can be used to express numerical document queries. Surprisingly, the complexity of satisfiability for the extended logic is asymptotically the same as for the original fixpoint logic. The non-emptiness for Presburger tree automata (PTA) is pspace-complete, which is moderate given that it is already pspace-hard to test whether the complement of a regular expression is non-empty. We also identify a subclass of PTAs with a tractable non-emptiness problem. Further, to decide whether a tree t satisfies a formula ϕ is polynomial in the size of ϕ and linear in the size of t.

A technical construction of independent interest is a linear time construction of a Presburger formula for the Parikh image of a regular language.


Regular Expression Regular Language Reachable State Tree Automaton Regular Tree Language 
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.
    Cardelli, L., Ghelli, G.: A Query Language Based on the Ambient Logic. In: Sands, D. (ed.) ESOP 2001. LNCS, vol. 2028, pp. 1–22. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  2. 2.
    Cardelli, L., Gordon, A.: Anytime, Anywhere: Modal Logics for Mobile Ambients. In: 27th ACM Conf. on Principles of Programming Languages (POPL), pp. 365–377 (2000)Google Scholar
  3. 3.
    Conforti, G., Ferrara, O., Ghelli, G.: TQL Algebra and its Implementation (Extended Abstract). In: IFIP Int. Conf. on Theoretical Computer Science (IFIP TCS), pp. 422–434 (2002)Google Scholar
  4. 4.
    Conforti, G., Ghelli, G., Albano, A., Colazzo, D., Manghi, P., Sartiani, C.: The Query Language TQL. In: 5th Int. Workshop on the Web and Databases, WebDB (2002)Google Scholar
  5. 5.
    Dal-Zilio, S., Lugiez, D., Meyssonnier, C.: A Logic you can Count on. In: 31st ACM Symp. on Principles of Programming Languages (POPL), pp. 135–146 (2004)Google Scholar
  6. 6.
    Fischer, M.J., Rabin, M.O.: Superexponential Complexity of Presburger Arithmetic. In: AMS Symp. on the Complexity of Computational Computational Processes, vol. 7, pp. 27–41 (1974)Google Scholar
  7. 7.
    Ginsburg, S., Spanier, E.H.: Semigroups, Presburger Formulas and Languages. Pacific Journal of Mathematics 16(2), 285–296 (1966)zbMATHMathSciNetGoogle Scholar
  8. 8.
    Gottlob, G., Koch, C.: Monadic Datalog and the Expressive Power of Languages forWeb Information Extraction. In: PODS, pp. 17–28 (2001)Google Scholar
  9. 9.
    Klaedtke, F., Ruess, H.: Parikh Automata and Monadic Second-Order Logics with Linear Cardinality Constraints. Technical Report 177, Institute of CS at Freiburg University (2002)Google Scholar
  10. 10.
    Kupferman, O., Sattler, U., Vardi, M.Y.: The Complexity of the Graded μ-Calculus. In: Voronkov, A. (ed.) CADE 2002. LNCS (LNAI), vol. 2392, pp. 423–437. Springer, Heidelberg (2002)Google Scholar
  11. 11.
    Lugiez, D., Dal Zilio, S.: XML Schema, Tree Logic and Sheaves Automata. In: Nieuwenhuis, R. (ed.) RTA 2003. LNCS, vol. 2706, pp. 246–263. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  12. 12.
    Martens, W., Neven, F.: Typechecking Top-down Uniform Unranked Tree Transducers. In: Calvanese, D., Lenzerini, M., Motwani, R. (eds.) ICDT 2003. LNCS, vol. 2572, pp. 64–78. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  13. 13.
    Neumann, A., Seidl, H.: Locating Matches of Tree Patterns in Forests. TR 98-08, Trier (1998)Google Scholar
  14. 14.
    Neven, F.: Automata, Logic, and XML. In: Bradfield, J.C. (ed.) CSL 2002 and EACSL 2002. LNCS, vol. 2471, pp. 2–26. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  15. 15.
    Neven, F., Schwentick, T.: Query Automata over Finite Trees. TCS 275(1-2), 633–674 (2002)zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Neven, F., Van den Bussche, J.: Expressiveness of Structured Document Query Languages Based on Attribute Grammars. Journal of the ACM 49(1), 56–100 (2002)CrossRefMathSciNetGoogle Scholar
  17. 17.
    Niehren, J., Podelski, A.: Feature Automata and Recognizable Sets of Feature Trees. In: Gaudel, M.-C., Jouannaud, J.-P. (eds.) CAAP 1993, FASE 1993, and TAPSOFT 1993. LNCS, vol. 668, pp. 356–375. Springer, Heidelberg (1993)Google Scholar
  18. 18.
    Papadimitriou, C.H.: On the Complexity of Integer Programming. J. ACM 28(4), 765–768 (1981)zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    Parikh, R.J.: On Context-free Languages. J. of the ACM 13(4), 570–581 (1966)zbMATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Presburger, M.: On the Completeness of a Certain System of Arithmetic of Whole Numbers in which Addition Occurs as the only Operation. Hist. Philos. Logic 12, 225–233 (1991); English translation of the original paper from 1929.zbMATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Seidl, H.: Haskell Overloading is DEXPTIME Complete. Inf. Proc. Lett (IPL) 54, 57–60 (1994)CrossRefMathSciNetGoogle Scholar
  22. 22.
    Seidl, H., Schwentick, T., Muscholl, A.: Numerical Document Queries. In: PODS, pp. 155–166 (2003)Google Scholar
  23. 23.
    Seidl, H., Neumann, A.: On Guarding Nested Fixpoints. In: Flum, J., Rodríguez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683, pp. 484–498. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  24. 24.
    Stockmeyer, L.J., Meyer, A.R.: Word problems requiring exponential time: Preliminary report. In: STOC, pp. 1–9 (1973)Google Scholar
  25. 25.
    Walukiewicz, I.: Pushdown Processes: Games and Model-Checking. Information and Computation 164(2), 234–263 (2001)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Helmut Seidl
    • 1
  • Thomas Schwentick
    • 2
  • Anca Muscholl
    • 3
  • Peter Habermehl
    • 3
  1. 1.TU München, I2 
  2. 2.FB Mathematik und InformatikPhilipps-Universität Marburg 
  3. 3.LIAFAUniversité Paris 7Paris

Personalised recommendations