Upcoming SlideShare
×

Proofsummit2011a

1,396 views
1,309 views

Published on

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,396
On SlideShare
0
From Embeds
0
Number of Embeds
49
Actions
Shares
0
10
0
Likes
0
Embeds 0
No embeds

No notes for slide

Proofsummit2011a

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