0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Proofsummit2011a

1,018

Published on

Talk at Proof Summit 2011 on 2011/09/25

Talk at Proof Summit 2011 on 2011/09/25

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
1,018
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
10
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. Proof Summit 2011 Coq @tmiya September 25,2011@tmiya : Coq , 1
• 2. @tmiya_ SIer 2007 LL Spirit Coq &#x2022; Coq &#x2022; Haskell Scala 2009 Agda &#x2022; @yoshihiro503 bool Prop &#x2022; =&#x21D2; Coq 2010 2 @kencoba Formal Methods Forum &#x2022; &#x2022; ProofCafe : Coq@tmiya : Coq , 2
• 3. Coq User Contribution@tmiya : Coq , 3
• 4. &#x2014; @kinaba d. y. d.@tmiya : Coq , 4
• 5. (regular expression) &#x2205; "a" "b" ... L1 , L2 {xy |x &#x2208; L1 , y &#x2208; L2 } L1 , L2 L1 &#x222A; L2 L 0 &#x222A; {x|x &#x2208; L} &#x222A; {xx|x &#x2208; L} &#x222A; . . .@tmiya : Coq , 5
• 6. &#x201D;Derivatives of Regular Expressions&#x201D;, Janusz Brzozowski, Journal of the ACM 1964. R(s) : s R { &#x3BD;(R) (s = &#x201D;&#x201D;) R(s) = (&#x2202;a R)(s ) (s = a :: s ) &#x3BD;(R) = R &#x2202;a R = R a NFA R a &#x2202;a R &#x201D;Yacc is Dead&#x201D; (http://arxiv.org/abs/1010.5023) 2011 Brzozowski@tmiya : Coq , 6
• 7. R &#x3BD;(R) &#x2202;a R &#x2205; false &#x2205; true { &#x2205; (c = a) "c" false { &#x2205; (c = a) (&#x2202;a R)S (&#x3BD;(R) = false) RS &#x3BD;(R) &#x2227; &#x3BD;(S) (&#x2202;a R)S + (&#x2202;a S) (&#x3BD;(R) = true) R +S &#x3BD;(R) &#x2228; &#x3BD;(S) (&#x2202;a R) + (&#x2202;a S) R&#x2217; true (&#x2202;a R)R &#x2217; &#x21D2; d(fg ) = f (dg ) + (df )g@tmiya : Coq , 7
• 8. (1/4) 30 Inductive RegExp : Set := (* *) | Empty : RegExp (* *) | Eps : RegExp (* *) | Char : ascii -&gt; RegExp (* *) | Cat : RegExp -&gt; RegExp -&gt; RegExp (* *) | Or : RegExp -&gt; RegExp -&gt; RegExp (* *) | Star : RegExp -&gt; RegExp (* *) Notation "a ++ b" := (Cat a b). Notation "a || b" := (Or a b).@tmiya : Coq , 8
• 9. (2/4) Fixpoint nu(re:RegExp):bool := match re with | Empty =&gt; false | Eps =&gt; true | Char c =&gt; false | Cat r s =&gt; (nu r &amp;&amp; nu s)%bool | Or r s =&gt; (nu r || nu s)%bool | Star r =&gt; true end.@tmiya : Coq , 9
• 10. (3/4) Fixpoint derive(a:ascii)(re:RegExp):RegExp := match re with | Empty =&gt; Empty | Eps =&gt; Empty | Char c =&gt; match (ascii_dec c a) with | left _ =&gt; Eps | right _ =&gt; Empty end | Cat r s =&gt; match (nu r) with | true =&gt; ((derive a r) ++ s) || (derive a s) | false =&gt; (derive a r) ++ s end | Or r s =&gt; (derive a r) || (derive a s) | Star r =&gt; (derive a r) ++ (Star r) end. Notation "re / a" := (derive a re).@tmiya : Coq , 10
• 11. (4/4) Fixpoint matches (re:RegExp)(s:string) : bool := match s with | EmptyString =&gt; nu re | String a w =&gt; matches (re / a) w end. Notation "re ~= s" := (matches re s) (at level 60).@tmiya : Coq , 11
• 12. KleeneKleene &#x201D;A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events,&#x201D; D. Kozen (1994) &#x2205; 0 1 &#x2022; x + (y + z) = (x + y ) + z, x(yz) = (xy )z : &#x2022; x +y =y +z : &#x2022; x(y + z) = xy + xz, (x + y )z = xz + yz : &#x2022; x + 0 = 0 + x = x, 1x = x1 = x : &#x2022; x0 = 0x = 0 : x +x =x : Kleene-star (x &#x2264; y &#x21D4; x + y = y ) &#x2022; 1 + xx &#x2217; &#x2264; x &#x2217; , 1 + x &#x2217; x &#x2264; x &#x2217; &#x2022; x + yz &#x2264; z &#x21D2; y &#x2217; x &#x2264; z &#x2022; x + yz &#x2264; y &#x21D2; xy &#x2217; &#x2264; z Kleene : :@tmiya : Coq , 12
• 13. Kleene (1/3) Brzozowski Kleene Coq &#x2022; 1500 &#x2022; Setoid =&#x21D2; setoid_rewrite tactic &#x2022; Brzozowski Coq &#x2022; Kleene &#x2022; &#x201D;A tactic for deciding Kleene algebras&#x201D; &#x2022;@tmiya : Coq , 13
• 14. Kleene (2/3) Coq &#x2022; induction re. &#x2022; Or Cat, Star &#x2022; =&#x21D2; induction s. Lemma divide_Cat : forall s r&#x2019; r&#x2019;&#x2019;, (r&#x2019; ++ r&#x2019;&#x2019;) ~== s -&gt; {s&#x2019;:string &amp; {s&#x2019;&#x2019;:string | s = (s&#x2019; ++ s&#x2019;&#x2019;)%string / r&#x2019; ~== s&#x2019; / r&#x2019;&#x2019; ~== s&#x2019;&#x2019; }}.@tmiya : Coq , 14
• 15. Kleene (3/3) + +rr &#x2217; = r &#x2217; + +r &#x2217; r = r&#x2217; &#x2022; r&#x2217; r =&#x21D2; r &#x2217; Lemma Star_to_list : forall s r, (Star r) ~== s -&gt; {ss:list string | forallb (fun s =&gt; r ~= s) ss = true / concat_list_string ss = s / forallb (fun s =&gt; bneq_empty_string s) ss = true }. &#x2022; s &#x2022; refine (induction_ltof2 string str_length _ _). Setoid@tmiya : Coq , 15
• 16. User ContributionCoq User Contribution INRIA The Coq User&#x2019;s Contributions 1. Makefile &#x2022; Make -R . RegExp Char.v ... RegExp.v (Coqdoc ) &#x2022; \$ coq_makefile -f Make -o Makefile &#x2022; \$ make clean all all-gal.pdf html &#x2022; \$ tar -cf RegExp.tar Makefile *.v 2. tar upload 3. Coq user contributions submit &#x2022; Coq LGPL@tmiya : Coq , 16
• 17. Brzozowski ( ) Kleene Coq INRIA User contribution@tmiya : Coq , 17