Complexity of Two-Variable Logic on Finite Trees

  • Saguy Benaim
  • Michael Benedikt
  • Witold Charatonik
  • Emanuel Kieroński
  • Rastislav Lenhardt
  • Filip Mazowiecki
  • James Worrell
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7966)


Verification of properties expressed in the two-variable fragment of first-order logic FO2 has been investigated in a number of contexts. The satisfiability problem for FO2 over arbitrary structures is known to be NEXPTIME-complete, with satisfiable formulas having exponential-sized models. Over words, where FO2 is known to have the same expressiveness as unary temporal logic, satisfiability is again NEXPTIME-complete. Over finite labelled ordered trees FO2 has the same expressiveness as navigational XPath, a popular query language for XML documents. Prior work on XPath and FO2 gives a 2EXPTIME bound for satisfiability of FO2 over trees. This work contains a comprehensive analysis of the complexity of FO2 on trees, and on the size and depth of models. We show that the exact complexity varies according to the vocabulary used, the presence or absence of a schema, and the encoding of labels on trees. We also look at a natural restriction of FO2, its guarded version, GF2. Our results depend on an analysis of types in models of FO2 formulas, including techniques for controlling the number of distinct subtrees, the depth, and the size of a witness to satisfiability for FO2 sentences over finite trees.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [AvBN98]
    Andréka, H., van Benthem, J., Németi, I.: Modal languages and bounded fragments of predicate logic. J. Phil. Logic 27, 217–274 (1998)zbMATHCrossRefGoogle Scholar
  2. [BBLW13]
    Benaim, S., Benedikt, M., Lenhardt, R., Worrell, J.: Controlling the depth, size, and number of subtrees in two variable logic over trees. CoRR abs/1304.6925 (2013)Google Scholar
  3. [BFG08]
    Benedikt, M., Fan, W., Geerts, F.: XPath satisfiability in the presence of DTDs. J. ACM 55(2), 8:1–8:79 (2008)MathSciNetCrossRefGoogle Scholar
  4. [BK08]
    Benedikt, M., Koch, C.: XPath Leashed. ACM Comput. Surv. 41(1), 3:1–3:54 (2008)CrossRefGoogle Scholar
  5. [BLW12]
    Benedikt, M., Lenhardt, R., Worrell, J.: Verification of two-variable logic revisited. In: QEST, pp. 114–123. IEEE (2012)Google Scholar
  6. [BMSS09]
    Bojańczyk, M., Muscholl, A., Schwentick, T., Segoufin, L.: Two-variable logic on data trees and XML reasoning. J. ACM 56(3) (2009)Google Scholar
  7. [CKM13]
    Charatonik, W., Kieroński, E., Mazowiecki, F.: Satisfiability of the two-variable fragment of first-order logic over trees. CoRR abs/1304.7204 (2013)Google Scholar
  8. [CW13]
    Charatonik, W., Witkowski, P.: Two-variable logic with counting and trees. In: LICS. IEEE (to appear, 2013)Google Scholar
  9. [EVW02]
    Etessami, K., Vardi, M.Y., Wilke, T.: First-order logic with two variables and unary temporal logic. Inf. Comput. 179(2), 279–295 (2002)MathSciNetzbMATHCrossRefGoogle Scholar
  10. [Fig12]
    Figueira, D.: Satisfiability for two-variable logic with two successor relations on finite linear orders. CoRR abs/1204.2495 (2012)Google Scholar
  11. [GKV97]
    Grädel, E., Kolaitis, P.G., Vardi, M.Y.: On the decision problem for two-variable first-order logic. Bull. Symb. Logic 3(1), 53–69 (1997)zbMATHCrossRefGoogle Scholar
  12. [Kie02]
    Kieroński, E.: EXPSPACE-complete variant of guarded fragment with transitivity. In: Alt, H., Ferreira, A. (eds.) STACS 2002. LNCS, vol. 2285, pp. 608–619. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  13. [Kie05]
    Kieroński, E.: Results on the guarded fragment with equivalence or transitive relations. In: Ong, L. (ed.) CSL 2005. LNCS, vol. 3634, pp. 309–324. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  14. [Mar04]
    Marx, M.: XPath with conditional axis relations. In: Bertino, E., Christodoulakis, S., Plexousakis, D., Christophides, V., Koubarakis, M., Böhm, K. (eds.) EDBT 2004. LNCS, vol. 2992, pp. 477–494. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  15. [MdR04]
    Marxand, M., de Rijke, M.: Semantic characterization of navigational XPath. In: TDM. CTIT Workshop Proceedings Series, pp. 73–79 (2004)Google Scholar
  16. [ST13]
    Szwast, W., Tendera, L.: FO2 with one transitive relation is decidable. In: STACS. LIPIcs, vol. 20, pp. 317–328, Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2013)Google Scholar
  17. [Sto74]
    Stockmeyer, L.J.: The Complexity of Decision Problems in Automata Theory and Logic. PhD thesis, Massachusetts Institute of Technology (1974)Google Scholar
  18. [Tho97]
    Thomas, W.: Languages, automata, and logic. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages. Springer (1997)Google Scholar
  19. [Wei11]
    Weis, P.: Expressiveness and Succinctness of First-Order Logic on Finite Words. PhD thesis, University of Massachusetts (2011)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Saguy Benaim
    • 1
  • Michael Benedikt
    • 1
  • Witold Charatonik
    • 2
  • Emanuel Kieroński
    • 2
  • Rastislav Lenhardt
    • 1
  • Filip Mazowiecki
    • 3
  • James Worrell
    • 1
  1. 1.University of OxfordUK
  2. 2.University of WrocławPoland
  3. 3.University of WarsawPoland

Personalised recommendations