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.
- V. Antimirov. Partial derivatives of regular expressions and finite automaton constructions. Theor. Comput. Sci., 155(2):291--319, Mar. 1996. Google Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- J. A. Brzozowski. Derivatives of regular expressions. J. ACM, 11(4):481--494, Oct. 1964. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- T. Nipkow. Programming and proving in Isabelle/HOL. http://isabelle.in.tum.de/doc/prog-prove.pdf.Google Scholar
- T. Nipkow, L. Paulson, and M. Wenzel. Isabelle/HOL -- A Proof Assistant for Higher-Order Logic, vol. 2283 of LNCS. Springer, 2002. Google Scholar
Digital Library
- S. Owens, J. H. Reppy, and A. Turon. Regular-expression derivatives re-examined. J. Funct. Program., 19(2):173--190, 2009. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- W. Thomas. Languages, automata, and logic. In G. Rozenberg and A. Salomaa, eds., Handbook of Formal Languages, pp. 389--455. Springer, 1997. Google Scholar
Digital Library
- D. Traytel and T. Nipkow. Formal development associated with this paper. http://www21.in.tum.de/ traytel/icfp13_mso.tar.gz.Google Scholar
- 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 Scholar
Digital Library
Index Terms
Verified decision procedures for MSO on words based on derivatives of regular expressions
Recommendations
Verified decision procedures for MSO on words based on derivatives of regular expressions
ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programmingMonadic 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 ...
Regular Language Representations in the Constructive Type Theory of Coq
We explore the theory of regular language representations in the constructive type theory of Coq. We cover various forms of automata (deterministic, nondeterministic, one-way, two-way), regular expressions, and the logic WS1S. We give translations ...
Computation of regular expression derivatives
The conversion of regular expressions into finite state automata and finite state automata into regular expression is an important area of research in automata theory. The notion of derivatives of regular expressions has been introduced to make the ...







Comments