Skip to main content

Deciding Regular Expressions (In-)Equivalence in Coq

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7560))

Abstract

This work presents a mechanically verified implementation of an algorithm for deciding regular expression (in-)equivalence within the Coq proof assistant. This algorithm decides regular expression equivalence through an iterated process of testing the equivalence of their partial derivatives and also does not construct the underlying automata. Our implementation has a refutation step that improves the general efficiency of the decision procedure by enforcing the in-equivalence of regular expressions at early stages of computation. Recent theoretical and experimental research provide evidence that this method is, on average, more efficient than the classical methods based in automata. We present some performance tests and comparisons with similar approaches.

This work was partially funded by the European Regional Development Fund through the programme COMPETE and by the Portuguese Government through the FCT under the projects PEst-OE/EEI/UI0027/2011, PEst-C/MAT/UI0144/2011, and CANTE-PTDC/EIA-CCO/101904/2008.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Filliâtre, J.C.: Finite Automata Theory in Coq: A constructive proof of Kleene’s theorem. Research Report 97–04, LIP - ENS Lyon (February 1997)

    Google Scholar 

  2. Kleene, S.: In: Shannon, C., McCarthy, J. (eds.) Representation of Events in Nerve Nets and Finite Automata, pp. 3–42. Princeton University Press

    Google Scholar 

  3. Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development. Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. Springer (2004)

    Google Scholar 

  4. Höfner, P., Struth, G.: Automated Reasoning in Kleene Algebra. In: Pfenning, F. (ed.) CADE 2007. LNCS (LNAI), vol. 4603, pp. 279–294. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  5. McCune, W.: Prover9 and Mace4, http://www.cs.unm.edu/smccune/mace4 (access date: October 1, 2011)

  6. Moreira, N., Pereira, D.: KAT and PHL in Coq. CSIS 05 (02) (December 2008) ISSN: 1820-0214

    Google Scholar 

  7. Kozen, D.: Kleene algebra with tests. Transactions on Programming Languages and Systems 19(3), 427–443 (1997)

    Article  MATH  Google Scholar 

  8. Almeida, J.B., Moreira, N., Pereira, D., Melo de Sousa, S.: Partial Derivative Automata Formalized in Coq. In: Domaratzki, M., Salomaa, K. (eds.) CIAA 2010. LNCS, vol. 6482, pp. 59–68. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  9. Almeida, M., Moreira, N., Reis, R.: Antimirov and Mosses’s rewrite system revisited. Int. J. Found. Comput. Sci. 20(4), 669–684 (2009)

    Article  MATH  Google Scholar 

  10. Antimirov, V.M., Mosses, P.D.: Rewriting extended regular expressions. In: Rozenberg, G., Salomaa, A. (eds.) DLT, pp. 195–209. World Scientific (1994)

    Google Scholar 

  11. Hopcroft, J., Karp, R.M.: A linear algorithm for testing equivalence of finite automata. Technical Report TR 71-114, University of California, Berkeley, California (1971)

    Google Scholar 

  12. Almeida, M., Moreira, N., Reis, R.: Testing regular languages equivalence. JALC 15(1/2), 7–25 (2010)

    MATH  Google Scholar 

  13. Almeida, M.: Equivalence of regular languages: an algorithmic approach and complexity analysis. PhD thesis, FCUP (2011), http://www.dcc.fc.up.pt/~mfa/thesis.pdf

  14. Broda, S., Machiavelo, A., Moreira, N., Reis, R.: The Average Transition Complexity of Glushkov and Partial Derivative Automata. In: Mauri, G., Leporati, A. (eds.) DLT 2011. LNCS, vol. 6795, pp. 93–104. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  15. Braibant, T., Pous, D.: An Efficient Coq Tactic for Deciding Kleene Algebras. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172, pp. 163–178. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  16. Kozen, D.: A completeness theorem for Kleene algebras and the algebra of regular events. Infor. and Comput. 110(2), 366–390 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  17. Coquand, T., Siles, V.: A Decision Procedure for Regular Expression Equivalence in Type Theory. In: Jouannaud, J.-P., Shao, Z. (eds.) CPP 2011. LNCS, vol. 7086, pp. 119–134. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  18. Brzozowski, J.A.: Derivatives of regular expressions. JACM 11(4), 481–494 (1964)

    Article  MathSciNet  MATH  Google Scholar 

  19. Krauss, A., Nipkow, T.: Proof pearl: Regular expression equivalence and relation algebra. J. Autom. Reasoning 49(1), 95–106 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  20. Rutten, J.J.M.M.: Automata and Coinduction (An Exercise in Coalgebra). In: Sangiorgi, D., de Simone, R. (eds.) CONCUR 1998. LNCS, vol. 1466, pp. 194–218. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  21. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL. LNCS, vol. 2283. Springer, Heidelberg (2002)

    MATH  Google Scholar 

  22. Komendantsky, V.: Reflexive toolbox for regular expression matching: verification of functional programs in Coq+Ssreflect. In: Claessen, K., Swamy, N. (eds.) PLPV, pp. 61–70. ACM (2012)

    Google Scholar 

  23. Komendantsky, V.: Computable partial derivatives of regular expressions (2011), http://www.cs.st-andrews.ac.uk/~vk/papers.html (access date: July 1, 2011)

  24. Mirkin, B.: An algorithm for constructing a base in a language of regular expressions. Engineering Cybernetics 5, 110–116 (1966)

    Google Scholar 

  25. Asperti, A.: A Compact Proof of Decidability for Regular Expression Equivalence. In: Beringer, L., Felty, A. (eds.) ITP 2012. LNCS, vol. 7406, pp. 283–298. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  26. Moreira, N., Pereira, D., Melo de Sousa, S.: Deciding KAT terms equivalence in Coq. Technical Report DCC-2012-04, DCC-FC & LIACC, Universidade do Porto (2012)

    Google Scholar 

  27. Hopcroft, J., Motwani, R., Ullman, J.D.: Introduction to Automata Theory, Languages and Computation. Addison Wesley (2000)

    Google Scholar 

  28. Champarnaud, J.M., Ziadi, D.: From Mirkin’s prebases to Antimirov’s word partial derivatives. Fundam. Inform. 45(3), 195–205 (2001)

    MathSciNet  MATH  Google Scholar 

  29. Moreira, N., Pereira, D., Melo de Sousa, S.: Coq library: PDCoq (Version 1.1 2012), http://www.liacc.up.pt/~kat/pdcoq/

  30. Paulin-Mohring, C.: Inductive Definitions in the System Coq: Rules and Properties. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 328–345. Springer, Heidelberg (1993)

    Chapter  Google Scholar 

  31. The Coq Development Team: The Coq proof assistant, http://coq.inria.fr

  32. Lescuyer, S.: First-class containers in Coq. Studia Informatica Universalis 9, 87–127 (2011)

    Google Scholar 

  33. Barthe, G., Courtieu, P.: Efficient Reasoning about Executable Specifications in Coq. In: Carreño, V.A., Muñoz, C., Tahar, S. (eds.) TPHOLs 2002. LNCS, vol. 2410, pp. 31–46. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  34. Almeida, A., Almeida, M., Alves, J., Moreira, N., Reis, R.: FAdo and GUItar: Tools for Automata Manipulation and Visualization. In: Maneth, S. (ed.) CIAA 2009. LNCS, vol. 5642, pp. 65–74. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  35. Kozen, D.: On Hoare logic and Kleene algebra with tests. ACM Transactions on Computational Logic (TOCL) 1(1), 60–76 (2000)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Moreira, N., Pereira, D., Melo de Sousa, S. (2012). Deciding Regular Expressions (In-)Equivalence in Coq. In: Kahl, W., Griffin, T.G. (eds) Relational and Algebraic Methods in Computer Science. RAMICS 2012. Lecture Notes in Computer Science, vol 7560. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-33314-9_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-33314-9_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-33313-2

  • Online ISBN: 978-3-642-33314-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics