Congruence Closure of Compressed Terms in Polynomial Time

  • Manfred Schmidt-Schauss
  • David Sabel
  • Altug Anis
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6989)


The word-problem for a finite set of equational axioms between ground terms is the question whether for terms s,t the equation s = t is a consequence. We consider this problem under grammar based compression of terms, in particular compression with singleton tree grammars (STGs) and with directed acyclic graphs (DAGs) as a special case. We show that given a DAG-compressed ground and reduced term rewriting system T, the T-normal form of an STG-compressed term s can be computed in polynomial time, and hence the T-word problem can be solved in polynomial time. This implies that the word problem of STG-compressed terms w.r.t. a set of DAG-compressed ground equations can be decided in polynomial time. If the ground term rewriting system (gTRS) T is STG-compressed, we show NP-hardness of T-normal-form computation. For compressed, reduced gTRSs we show a PSPACE upper bound on the complexity of the normal form computation of STG-compressed terms. Also special cases are considered and a prototypical implementation is presented.


Term rewriting grammar based compression singleton tree grammars congruence closure 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    The Haskell Programming Language (2011),
  2. 2.
    Adams, S.: Efficient sets - a balancing act. J. Funct. Program. 3(4), 553–561 (1993)CrossRefGoogle Scholar
  3. 3.
    Baader, F., Nipkow, T.: Term Rewriting and All That. Cambridge University Press, New York (1998)CrossRefzbMATHGoogle Scholar
  4. 4.
    Busatto, G., Lohrey, M., Maneth, S.: Efficient memory representation of XML documents. In: Bierman, G., Koch, C. (eds.) DBPL 2005. LNCS, vol. 3774, pp. 199–216. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  5. 5.
    Busatto, G., Lohrey, M., Maneth, S.: Efficient memory representation of XML document trees. Inf. Syst. 33(4-5), 456–474 (2008)CrossRefzbMATHGoogle Scholar
  6. 6.
    Comon, H., Dauchet, M., Gilleron, R., Jacquemard, F., Lugiez, D., Tison, S., Tommasi, M.: Tree automata techniques and applications (1997), (release October 2002)
  7. 7.
    Downey, P.J., Sethi, R., Tarjan, R.E.: Variations on the common subexpression problem. J. ACM 27, 758–771 (1980)CrossRefzbMATHMathSciNetGoogle Scholar
  8. 8.
    Gallier, J.H., Narendran, P., Plaisted, D.A., Raatz, S., Snyder, W.: An algorithm for finding canonical sets of ground rewrite rules in polynomial time. J. ACM 40(1), 1–16 (1993)CrossRefzbMATHMathSciNetGoogle Scholar
  9. 9.
    Garey, M.R., Johnson, D.S.: Computers and Intractability: A guide to the theory of NP-completeness. W.H. Freeman and Co., San Francisco (1979)zbMATHGoogle Scholar
  10. 10.
    Gascón, A., Godoy, G., Schmidt-Schauß, M.: Context matching for compressed terms. In: 23rd LICS, pp. 93–102. IEEE Computer Society, Los Alamitos (2008)Google Scholar
  11. 11.
    Gascón, A., Godoy, G., Schmidt-Schauß, M.: Unification and matching on compressed terms (2010),
  12. 12.
    Gascón, A., Maneth, S., Ramos, L.: First-Order Unification on Compressed Terms. In: Schmidt-Schauß, M. (ed.) 22nd RTA. LIPIcs, vol. 10, pp. 51–60 (2011)Google Scholar
  13. 13.
    Kozen, D.: Complexity of finitely presented algebras. In: 9th STOC, pp. 164–177. ACM, New York (1977)Google Scholar
  14. 14.
    Levy, J., Schmidt-Schauß, M., Villaret, M.: Bounded second-order unification is NP-complete. In: Pfenning, F. (ed.) RTA 2006. LNCS, vol. 4098, pp. 400–414. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  15. 15.
    Levy, J., Schmidt-Schauß, M., Villaret, M.: Stratified context unification is NP-complete. In: Furbach, U., Shankar, N. (eds.) IJCAR 2006. LNCS (LNAI), vol. 4130, pp. 82–96. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  16. 16.
    Levy, J., Schmidt-Schauß, M., Villaret, M.: On the complexity of bounded second-order unification and stratified context unification (2011) (to appear in Logic J. of the IGPL),
  17. 17.
    Lifshits, Y.: Processing compressed texts: A tractability border. In: Ma, B., Zhang, K. (eds.) CPM 2007. LNCS, vol. 4580, pp. 228–240. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  18. 18.
    Lohrey, M.: Word problems and membership problems on compressed words. SIAM J. Comput. 35(5), 1210–1240 (2006)CrossRefzbMATHMathSciNetGoogle Scholar
  19. 19.
    Lohrey, M., Maneth, S., Schmidt-Schauß, M.: Parameter reduction in grammar-compressed trees. In: de Alfaro, L. (ed.) FOSSACS 2009. LNCS, vol. 5504, pp. 212–226. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  20. 20.
    Nelson, G., Oppen, D.C.: Fast decision procedures based on congruence closure. J. ACM 27(2), 356–364 (1980)CrossRefzbMATHMathSciNetGoogle Scholar
  21. 21.
    Nieuwenhuis, R., Oliveras, A., Tinelli, C.: Solving SAT and SAT Modulo Theories: From an abstract Davis–Putnam–Logemann–Loveland procedure to DPLL(t). J. ACM 53(6), 937–977 (2006)CrossRefzbMATHMathSciNetGoogle Scholar
  22. 22.
    Plandowski, W.: Testing equivalence of morphisms in context-free languages. In: van Leeuwen, J. (ed.) ESA 1994. LNCS, vol. 855, pp. 460–470. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  23. 23.
    Plandowski, W., Rytter, W.: Complexity of language recognition problems for compressed words. In: Karhumäki, J., Maurer, H.A., Paun, G., Rozenberg, G. (eds.) Jewels are Forever, pp. 262–272. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  24. 24.
    Schmidt-Schauß, M.: Polynomial equality testing for terms with shared substructures. Frank report 21, Institut für Informatik. FB Informatik und Mathematik. J. W. Goethe-Universität Frankfurt am Main (2005)Google Scholar
  25. 25.
    Schmidt-Schauß, M.: Pattern matching of compressed terms and contexts and polynomial rewriting. Frank report 43, Institut für Informatik. Goethe-Universität Frankfurt am Main (2011)Google Scholar
  26. 26.
    Shostak, R.E.: An algorithm for reasoning about equality. Commun. ACM 21(7), 583–585 (1978)CrossRefzbMATHMathSciNetGoogle Scholar
  27. 27.
    Snyder, W.: Efficient ground completion: An o(n log n) algorithm for generating reduced sets of ground rewrite rules equivalent to a set of ground equations e. In: Dershowitz, N. (ed.) RTA 1989. LNCS, vol. 355, pp. 419–433. Springer, Heidelberg (1989)CrossRefGoogle Scholar
  28. 28.
    Snyder, W.: A fast algorithm for generating reduced ground rewriting systems from a set of ground equations. J. Symb. Comput. 15(4), 415–450 (1993)CrossRefzbMATHMathSciNetGoogle Scholar
  29. 29.
    Ziv, J., Lempel, A.: A universal algorithm for sequential data compression. IEEE Trans. Inform. Theory 23(3), 337–343 (1977)CrossRefzbMATHMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Manfred Schmidt-Schauss
    • 1
  • David Sabel
    • 1
  • Altug Anis
    • 1
  1. 1.Dept. Informatik und Mathematik, Inst. InformatikGoethe-UniversityFrankfurtGermany

Personalised recommendations