Abstract
The notion of a backreference in practical regular expressions is formalised giving rise to a novel notion of a regular expression with variables. So far the state-of-the-art in formal languages theory of practical regular expressions with backreferences was represented by an operational matching semantics of trees of valid matches. Since explicit tree data structures are required only in procedural languages where functional list combinators are not available, this provides an opportunity for functional programming to step in with a computationally and proof-theoretically more tangible definition of backreferences and their matching semantics. An operational notion of (NP-complete) exhaustive pattern matching is provided that relies on a fundamental construction of partial derivatives of regular expressions. Matching is proved sound and complete.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Aho, A.V.: Algorithms for finding patterns in strings. In: van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, vol. A: Algorithms and Complexity, pp. 255–300. The MIT Press (1990)
Almeida, J.B., Moreira, N., Pereira, D., de Sousa, S.M.: Partial derivative automata formalized in Coq. In: Domaratzki, M., Salomaa, K. (eds.) CIAA 2010. LNCS, vol. 6482, pp. 59–68. Springer, Heidelberg (2011)
Antimirov, V.M.: Partial derivatives of regular expressions and finite automaton constructions. Theor. Comput. Sci. 155(2), 291–319 (1996)
Bird, R., Wadler, P.: Introduction to Functional Programming. Prentice Hall (1988)
Campeanu, C., Salomaa, K., Yu, S.: A formal study of practical regular expressions. International Journal of Foundations of Computer Science 14, 1007–1018 (2003)
Carle, B., Narendran, P.: On extended regular expressions. In: Dediu, A.H., Ionescu, A.M., Martín-Vide, C. (eds.) LATA 2009. LNCS, vol. 5457, pp. 279–289. Springer, Heidelberg (2009)
Castiglione, G., Restivo, A., Salemi, S.: Patterns in words and languages. Discrete Appl. Math. 144(3), 237–246 (2004)
Champarnaud, J.-M., Ziadi, D.: Canonical derivatives, partial derivatives and finite automaton constructions. Theor. Comput. Sci. 289(1), 137–163 (2002)
Gonthier, G., Mahboubi, A., Tassi, E.: A Small Scale Reflection Extension for the Coq system. Research Report RR-6455, INRIA (2011)
Komendantsky, V.: Formal proofs of the prebase theorem of Mirkin (2011), Coq script available at, http://www.cs.st-andrews.ac.uk/~vk/doc/prebase.v
Komendantsky, V.: Coq and Haskell sources of the decision procedure for regular expression matching with variables (2012), https://bitbucket.org/vkomenda/vmatch
Komendantsky, V.: Reflexive toolbox for regular expression matching: Verification of functional programs in Coq+Ssreflect. In: The 6th ACM SIGPLAN Workshop Programming Languages meet Program Verification, PLPV 2012, Philadelphia, USA (January 24, 2012), For contributed proofs, see [10]
Kozen, D.: A completeness theorem for Kleene algebras and the algebra of regular events. Infor. and Comput. 110(2), 366–390 (1994)
Kuklewicz, C.: The regex-posix package (2012), http://hackage.haskell.org/package/regex-posix/
Laurikari, V.: NFAs with tagged transitions, their conversion to deterministic automata and application to regular expressions. In: SPIRE 2000, pp. 181–187 (2000)
Lu, K.Z.M., Sulzmann, M.: A library implementation of XHaskell (2010), http://code.google.com/p/xhaskell-library
Lu, K.Z.M., Sulzmann, M.: The regex-pderiv package (2012), http://hackage.haskell.org/package/regex-pderiv
McIlroy, M.D.: Enumerating the strings of regular languages. Journal of Functional Programming 14, 503–518 (2004)
Mirkin, B.G.: New algorithm for construction of base in the language of regular expressions. Tekhnicheskaya Kibernetika 5, 113–119 (1966); English translation in Engineering Cybernetics (5), 110-116 (September-October 1966)
Reidenbach, D., Schmid, M.L.: A polynomial time match test for large classes of extended regular expressions. In: Domaratzki, M., Salomaa, K. (eds.) CIAA 2010. LNCS, vol. 6482, pp. 241–250. Springer, Heidelberg (2011)
Sulzmann, M., Lu, K.Z.M.: XHaskell – adding regular expression type to Haskell. In: Chitil, O., Horváth, Z., Zsók, V. (eds.) IFL 2007. LNCS, vol. 5083, pp. 75–92. Springer, Heidelberg (2008)
Yu, S.: Regular languages. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, vol. 1, Word, language, grammar, pp. 41–110. Springer (1997)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Komendantsky, V. (2013). Matching Problem for Regular Expressions with Variables. In: Loidl, HW., Peña, R. (eds) Trends in Functional Programming. TFP 2012. Lecture Notes in Computer Science, vol 7829. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-40447-4_10
Download citation
DOI: https://doi.org/10.1007/978-3-642-40447-4_10
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-40446-7
Online ISBN: 978-3-642-40447-4
eBook Packages: Computer ScienceComputer Science (R0)