skip to main content
research-article

Verified decision procedures for MSO on words based on derivatives of regular expressions

Published:25 September 2013Publication History
Skip Abstract Section

Abstract

Monadic second-order logic on finite words (MSO) is a decidable yet expressive logic into which many decision problems can be encoded. Since MSO formulas correspond to regular languages, equivalence of MSO formulas can be reduced to the equivalence of some regular structures (e.g. automata). This paper presents a verified functional decision procedure for MSO formulas that is not based on automata but on regular expressions. Functional languages are ideally suited for this task: regular expressions are data types and functions on them are defined by pattern matching and recursion and are verified by structural induction.

Decision procedures for regular expression equivalence have been formalized before, usually based on Brzozowski derivatives. Yet, for a straightforward embedding of MSO formulas into regular expressions an extension of regular expressions with a projection operation is required. We prove total correctness and completeness of an equivalence checker for regular expressions extended in that way. We also define a language-preserving translation of formulas into regular expressions with respect to two different semantics of MSO. Our results have been formalized and verified in the theorem prover Isabelle. Using Isabelle's code generation facility, this yields purely functional, formally verified programs that decide equivalence of MSO formulas.

References

  1. V. Antimirov. Partial derivatives of regular expressions and finite automaton constructions. Theor. Comput. Sci., 155(2):291--319, Mar. 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Asperti. A compact proof of decidability for regular expression equivalence. In L. Beringer and A. Felty, eds., Interactive Theorem Proving, ITP 2012, vol. 7406 of LNCS, pp. 283--298. Springer, 2012.Google ScholarGoogle ScholarCross RefCross Ref
  3. A. Ayari and D. Basin. Bounded model construction for monadic second-order logics. In E. A. Emerson and A. P. Sistla, eds., Proc. Int. Conf. Computer Aided Verification, CAV 2000, vol. 1855 of LNCS, pp. 99--112. Springer, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. C. Ballarin. Interpretation of locales in Isabelle: Theories and proof contexts. In J. M. Borwein and W. M. Farmer, eds., Mathematical Knowledge Management, MKM 2006, vol. 4108 of LNCS, pp. 31--43. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Basin and S. Friedrich. Combining WS1S and HOL. In D. Gabbay and M. de Rijke, eds., Frontiers of Combining Systems 2, vol. 7 of Studies in Logic and Computation, pp. 39--56. Research Studies Press/Wiley, 2000.Google ScholarGoogle Scholar
  6. S. Berghofer and M. Reiter. Formalizing the logic-automaton connection. In S. Berghofer, T. Nipkow, C. Urban, and M. Wenzel, eds., Theorem Proving in Higher Order Logics, TPHOLs 2009, vol. 5674 of LNCS, pp. 147--163. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. T. Braibant and D. Pous. An efficient Coq tactic for deciding Kleene algebras. In M. Kaufmann and L. Paulson, eds., Interactive Theorem Proving, ITP 2010, vol. 6172 of LNCS, pp. 163--178. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. A. Brzozowski. Derivatives of regular expressions. J. ACM, 11(4):481--494, Oct. 1964. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Caron, J.-M. Champarnaud, and L. Mignot. Partial derivatives of an extended regular expression. In A.-H. Dediu, S. Inenaga, and C. Martın-Vide, eds., Proc. Int. Conf. Language and Automata Theory and Applications, LATA 2011, vol. 6638 of LNCS, pp. 179--191. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. T. Coquand and V. Siles. A decision procedure for regular expression equivalence in type theory. In J.-P. Jouannaud and Z. Shao, eds., Proc. Int. Conf. Certified Programs and Proofs, CPP 2011, vol. 7086 of LNCS, pp. 119--134. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. N. A. Danielsson. Total parser combinators. In P. Hudak and S. Weirich, eds., Proc. Int. Conf. Functional Programming, ICFP 2010, pp. 285--296. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Elgaard, N. Klarlund, and A. Møller. MONA 1.x: new techniques for WS1S and WS2S. In A. J. Hu and M. Y. Vardi, eds., Proc. Int. Conf. Computer Aided Verification, CAV 1998, vol. 1427 of LNCS, pp. 516--520. Springer, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Fischer, F. Huch, and T. Wilke. A play on regular expressions: functional pearl. In P. Hudak and S. Weirich, eds., Proc. Int. Conf. Functional Programming, ICFP 2010, pp. 357--368. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. F. Haftmann, A. Krauss, O. Kuncar, and T. Nipkow. Data refinement in Isabelle/HOL. In S. Blazy, C. Paulin-Mohring, and D. Pichardie, eds., Interactive Theorem Proving, ITP 2013, vol. 7998 of LNCS, pp. 100--115. Springer, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. F. Haftmann and T. Nipkow. Code generation via higher-order rewrite systems. In M. Blume, N. Kobayashi, and G. Vidal, eds., Functional and Logic Programming, FLOPS 2010, vol. 6009 of LNCS, pp. 103--117. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. G. Henriksen, J. L. Jensen, M. E. Jørgensen, N. Klarlund, R. Paige, T. Rauhe, and A. Sandholm. MONA: Monadic second-order logic in practice. In E. Brinksma, R. Cleaveland, K. Larsen, T. Margaria, and B. Steffen, eds., Tools and Algorithms for the Construction and Analysis of Systems, TACAS 1995, vol. 1019 of LNCS, pp. 89--110. Springer, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. N. Klarlund. A theory of restrictions for logics and automata. In N. Halbwachs and D. Peled, eds., Proc. Int. Conf. Computer Aided Verification, CAV 1999, vol. 1633 of LNCS, pp. 406--417. Springer, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. A. Krauss and T. Nipkow. Proof pearl: Regular expression equivalence and relation algebra. J. Automated Reasoning, 49:95--106, 2012. published online March 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. M. Might, D. Darais, and D. Spiewak. Parsing with derivatives: A functional pearl. In M. M. T. Chakravarty, Z. Hu, and O. Danvy, eds., Proc. Int. Conf. Functional Programming, ICFP 2011, pp. 189--195. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. N. Moreira, D. Pereira, and S. M. de Sousa. Deciding regular expressions (in-)equivalence in Coq. In W. Kahl and T. Griffin, eds., Relational and Algebraic Methods in Computer Science, RAMiCS 2012, vol. 7560 of LNCS, pp. 98--113. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. T. Nipkow. Programming and proving in Isabelle/HOL. http://isabelle.in.tum.de/doc/prog-prove.pdf.Google ScholarGoogle Scholar
  22. T. Nipkow, L. Paulson, and M. Wenzel. Isabelle/HOL -- A Proof Assistant for Higher-Order Logic, vol. 2283 of LNCS. Springer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Owens, J. H. Reppy, and A. Turon. Regular-expression derivatives re-examined. J. Funct. Program., 19(2):173--190, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. Owre and H. Rueß. Integrating WS1S with PVS. In E. A. Emerson and A. P. Sistla, eds., Proc. Int. Conf. Computer Aided Verification, CAV 2000, vol. 1855 of LNCS, pp. 548--551. Springer, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. J. J. M. M. Rutten. Automata and coinduction (an exercise in coalgebra). In D. Sangiorgi and R. de Simone, eds., Proc. Int. Conf. Concurrency Theory, CONCUR 1998, vol. 1466 of LNCS, pp. 194--218. Springer, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. W. Thomas. Languages, automata, and logic. In G. Rozenberg and A. Salomaa, eds., Handbook of Formal Languages, pp. 389--455. Springer, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. D. Traytel and T. Nipkow. Formal development associated with this paper. http://www21.in.tum.de/ traytel/icfp13_mso.tar.gz.Google ScholarGoogle Scholar
  28. C. Wu, X. Zhang, and C. Urban. A formalisation of the Myhill--Nerode theorem based on regular expressions (Proof pearl). In M. Eekelen, H. Geuvers, J. Schmaltz, and F. Wiedijk, eds., Interactive Theorem Proving, ITP 2011, vol. 6898 of LNCS, pp. 341--356. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Verified decision procedures for MSO on words based on derivatives of regular expressions

                Recommendations

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in

                Full Access

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader
                About Cookies On This Site

                We use cookies to ensure that we give you the best experience on our website.

                Learn more

                Got it!