a compact proof of decidability for regular expression
play

A compact proof of decidability for regular expression equivalence - PowerPoint PPT Presentation

A compact proof of decidability for regular expression equivalence A compact proof of decidability for regular expression equivalence ITP 2012 Princeton, USA Andrea Asperti Department of Computer Science University of Bologna 25/08/2011 A


  1. A compact proof of decidability for regular expression equivalence A compact proof of decidability for regular expression equivalence ITP 2012 Princeton, USA Andrea Asperti Department of Computer Science University of Bologna 25/08/2011

  2. A compact proof of decidability for regular expression equivalence Abstract We introduce the notion of pointed regular expression and use it to get 1 a compact formalization of the relation between regular expressions and deterministic finite automata 2 a formally verified, efficient algorithm for testing regular expression equivalence.

  3. A compact proof of decidability for regular expression equivalence Content 1 Many different techniques for building DFAs 2 Pointed Regular Expressions 3 Formal definition and semantics 4 ǫ -closure and moves 5 Discussion and Conclusions

  4. A compact proof of decidability for regular expression equivalence Content 1 Many different techniques for building DFAs 2 Pointed Regular Expressions 3 Formal definition and semantics 4 ǫ -closure and moves 5 Discussion and Conclusions

  5. A compact proof of decidability for regular expression equivalence Content 1 Many different techniques for building DFAs 2 Pointed Regular Expressions 3 Formal definition and semantics 4 ǫ -closure and moves 5 Discussion and Conclusions

  6. A compact proof of decidability for regular expression equivalence Content 1 Many different techniques for building DFAs 2 Pointed Regular Expressions 3 Formal definition and semantics 4 ǫ -closure and moves 5 Discussion and Conclusions

  7. A compact proof of decidability for regular expression equivalence Content 1 Many different techniques for building DFAs 2 Pointed Regular Expressions 3 Formal definition and semantics 4 ǫ -closure and moves 5 Discussion and Conclusions

  8. A compact proof of decidability for regular expression equivalence Many different techniques for building DFAs Thompson’s algorithm a ε ε ε ε ε ε ε

  9. A compact proof of decidability for regular expression equivalence Many different techniques for building DFAs Brzozowski’s derivatives ∂ a ( e ) ∂ a ( a ) = ǫ ∂ a ( b ) = ∅ ∂ a ( e 1 + e 2 ) = ∂ a ( e 1 ) + ∂ a ( e 2 ) � ∂ a ( e 1 ) e 2 + ∂ a ( e 2 ) if nullable e 1 ∂ a ( e 1 e 2 ) = ∂ a ( e 1 ) e 2 otherwise ∂ a ( e ∗ ) = ∂ a ( e ) e ∗

  10. A compact proof of decidability for regular expression equivalence Many different techniques for building DFAs McNaughton and Yamada’s algorithm f 1,2,3 5 f $ 1,2,3 4 5 5 5 f b 1,2,3 3 4 4 4 t followpos a 3 3 1,2 1,2 * a 1 1,2,3 3 f b 2 1,2,3 + 1,2 1,2 a 3 4 f f b 4 5 a b 1 1 2 2 $ 5 1 2

  11. A compact proof of decidability for regular expression equivalence Pointed Regular Expressions Pointed regular expressions Intuition: mark the positions inside the regular expression which have been reached after reading some prefix of the input string. These “pointed” expression are the states of the DFA.

  12. A compact proof of decidability for regular expression equivalence Pointed Regular Expressions Example: (a+b)*ab Initial position: * ( a + b ) a b

  13. A compact proof of decidability for regular expression equivalence Pointed Regular Expressions Example: (a+b)*ab Moves w.r.t. a and b : b * ( a + b ) a b a * ( a + b ) a b

  14. A compact proof of decidability for regular expression equivalence Pointed Regular Expressions Example: (a+b)*ab b * ( a + b ) a b b * a ( a + b ) a b b a * ( a + b ) a b a

  15. A compact proof of decidability for regular expression equivalence Pointed Regular Expressions Example: (ac+bc)* c �� �� (a c + b c) * c �� �� �� �� a|b a �� �� �� �� a|b|c (a c + b c) * ( a c + b c) * �� �� �� �� �� �� �� �� b a|b �� �� c (a c + b c) * �� �� �� ��

  16. A compact proof of decidability for regular expression equivalence Pointed Regular Expressions Example:(a+ ǫ )(b*a+b)b 1 * ( a + )( b a + b) b ε ● ● ● ● a b 2 3 * * ( a + )( b a + b) b ( a + )( b a + b) b ε ● ● ● ● ε ● ● ● a b b a 5 6 4 b a * * * ( a + )( b a + b) b ( a + )( b a + b) b ( a + )( b a + b) b ε ε ε ● ● ● ● ● ● a b b a 7 8 a 9 * a|b ( a + )( b a + b) b * ε ( a + )( b a + b) b ε ● ● * ( a + )( b a + b) b ε b a|b

  17. A compact proof of decidability for regular expression equivalence Pointed Regular Expressions Example:( ǫ + a + aa )( aaa ) ∗ ( + a + a a) ( a a a)* ε a ( + a + a a) ( a a a)* ε a ( + a + a a) ( a a a)* a ε

  18. A compact proof of decidability for regular expression equivalence Formal definition and semantics Formal definition Pointed item: ∅ , ǫ, a , • a , i 1 · i 2 , i 1 + i 2 , i ∗ Pointed rergular expression (pre): � i , b : Bool � b is true if there is a point at the end of the expression.

  19. A compact proof of decidability for regular expression equivalence Formal definition and semantics Semantics Intuition: Union of all languages starting at the given points. The carrier | i | of an item i is its underlying r.e. � ∅ � = ∅ � ǫ � = { ǫ } � a � = ∅ � • a � = { a } � i 1 + i 2 � = � i 1 � ∪ � i 2 � � i 1 · i 2 � = � i 1 � · � | i 2 | � ∪ � i 2 � � i ∗ � = � i � · ( � | i | � ) ∗ � � i , F � � = � i � � � i , T � � = � i � ∪ { ǫ }

  20. A compact proof of decidability for regular expression equivalence Formal definition and semantics An important remark For any i , ǫ �∈ � i � hence ǫ ∈ � � i , b � � ⇔ b = T

  21. A compact proof of decidability for regular expression equivalence ǫ -closure and moves ǫ -closure The • ( i ) operation propagates a point inside an item i . Remark • ( ) goes from items to pres. • ( ∅ ) = �∅ , F � where • ( ǫ ) = � ǫ, T � � i 1 , b 1 � ⊕ � i 2 , b 2 � = � i 1 + i 2 , b 1 ∨ b 2 � • ( a ) = �• a , F � and • ( • a ) = �• a , F � e 1 ⊲ i 2 = • ( i 1 + i 2 ) = • ( i 1 ) ⊕ • ( i 2 ) let � i 1 , b 1 � = e 1 in • ( i 1 · i 2 ) = • ( i 1 ) ⊲ i 2 if b 1 then let � i ′ 2 , b 2 � = • ( i 2 ) in � i 1 · i ′ 2 , b 2 � • ( i ∗ ) = � ( fst ( • ( i ))) ∗ , T � else � i 1 · i 2 , F �

  22. A compact proof of decidability for regular expression equivalence ǫ -closure and moves lifted constructions Similarly to ⊕ , we can lift concatenation and star from items to pres: e 1 ⊙ e 2 = let � i 2 , b 2 � = e 2 in let � i , b � = e 1 ⊲ i 2 in � i , b ∨ b 2 � e � = let � i , b � = e in if b then � ( fst ( • ( i ))) ∗ , T � else � i ∗ , F �

  23. A compact proof of decidability for regular expression equivalence ǫ -closure and moves Moves Lifted constructions permit to define moves in a very elegant way: move ( ∅ , a ) = � emptyset , F � move ( ǫ, a ) = � epsilon , F � move ( c , a ) = � c , F � move ( • c , a ) = � c , a == c � move ( i 1 + i 2 , a ) = move ( i 1 , a ) ⊕ move ( i 2 , a ) move ( i 1 · i 2 , a ) = move ( i 1 , a ) ⊙ move ( i 2 , a ) move ( i ∗ , a ) = move ( i , a ) �

  24. A compact proof of decidability for regular expression equivalence ǫ -closure and moves Main Results for all a and w a :: w ∈ � i � ⇔ w ∈ � move ( i , a ) � hence w ∈ � i � ⇔ ǫ ∈ � move ∗ ( i , w ) � = � i ′ , b � ⇔ b = T

  25. A compact proof of decidability for regular expression equivalence Discussion and Conclusions Related works (theory) The reference paper for pointed regular expressions is the following report: Asperti, Tassi and Sacerdoti Coen. Regular Expressions, au point . eprint arXiv:1010.2604, 2010. A similar notion has been independently introduced in Fischer, Huch and Wilke. A play on regular expressions: functional pearl. ICFP 2010, Baltimore, Maryland.

  26. A compact proof of decidability for regular expression equivalence Discussion and Conclusions Related works (formalization) system approach reference COQ Thompson’s Braibant and Pous algorithm An efficient coq tactic for deciding kleene algebras ITP 2010, LNCS 6172 COQ partial Almeida, Moreira, Pereira and de Sousa derivatives Partial Derivative Automata Formalized in Coq IAA 2010, LNCS 6482 Isabelle Brzozowski’s Krauss and Nipkow derivatives Regular Expression Equivalence and Relation Algebra JAR 2012 Isabelle partial Wu, Zhang, and Urban derivatives A formalisation of the myhill-nerode theorem based on regular expressions. ITP 2011, LNCS 6898 SSReflect Brzozowski’s Coquand and Siles derivatives A decision procedure for regular expression equivalence in type theory. CPP 2011, LNCS 7086

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend