Your SlideShare is downloading. ×
0
Proof Summit 2011                   Coq                          @tmiya                     September 25,2011@tmiya : Coq ...
@tmiya_    SIer               2007    LL Spirit       Coq                 • Coq                 •           Haskell       ...
Coq               User Contribution@tmiya : Coq      ,                3
— @kinaba   d. y. d.@tmiya : Coq   ,                          4
(regular expression)                             ∅                                                      "a"     "b"     .....
”Derivatives of Regular Expressions”, Janusz Brzozowski, Journal      of the ACM 1964.      R(s) :         s             R...
R        ν(R)                       ∂a R                    ∅        false                         ∅                      ...
(1/4)                    30      Inductive RegExp : Set :=    (*                   *)      | Empty : RegExp     (*      *)...
(2/4)      Fixpoint nu(re:RegExp):bool :=      match re with      | Empty => false      | Eps => true      | Char c => fal...
(3/4)      Fixpoint derive(a:ascii)(re:RegExp):RegExp :=      match re with      | Empty => Empty      | Eps => Empty     ...
(4/4)      Fixpoint matches (re:RegExp)(s:string) : bool :=      match s with      | EmptyString => nu re      | String a ...
KleeneKleene      ”A Completeness Theorem for Kleene Algebras and the Algebra of      Regular Events,” D. Kozen (1994)    ...
Kleene          (1/3)               Brzozowski                                          Kleene                            ...
Kleene          (2/3)                                               Coq                 •                                 ...
Kleene          (3/3)                                     + +rr ∗ = r ∗               +   +r ∗ r   =   r∗               • ...
User ContributionCoq User Contribution      INRIA    The Coq User’s Contributions        1. Makefile               • Make ...
Brzozowski                    (   )                                       Kleene               Coq               INRIA    ...
Upcoming SlideShare
Loading in...5
×

Proofsummit2011a

1,038

Published on

Talk at Proof Summit 2011 on 2011/09/25

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

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

No notes for slide

Transcript of "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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×