mak making induction manif ing induction manifest in est
play

Mak Making Induction Manif ing Induction Manifest in est in - PowerPoint PPT Presentation

Mak Making Induction Manif ing Induction Manifest in est in Modular Modular ACL2 CL2 Carl Eastlund Matthias Felleisen cce@ccs.neu.edu matthias@ccs.neu.edu Northeastern University Boston, MA, USA 1 Pr Prog ogram V am Verif erifica


  1. Mak Making Induction Manif ing Induction Manifest in est in Modular Modular ACL2 CL2 Carl Eastlund Matthias Felleisen cce@ccs.neu.edu matthias@ccs.neu.edu Northeastern University Boston, MA, USA 1

  2. Pr Prog ogram V am Verif erifica ication in A tion in ACL2 CL2 2

  3. ↙ Program Model (C, VHDL) (ACL2) � � Formal Test Suite Verification 3

  4. (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (defthm insert-preserves-setp (implies (setp s) (setp (insert x s)))) 4

  5. Termination Argument (Trivial)? ! (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) ! Rewrite Rule. Validity? ! (defthm insert-preserves-setp (implies (setp s) (setp (insert x s)))) ! Rewrite Rule. 5

  6. (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (defthm join-preserves-setp (implies (and (true-listp l) (setp s)) (setp (join l s)))) 6

  7. Termination Argument? ! (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) ! Rewrite Rule + Induction Scheme. Validity by Induction? ! (defthm join-preserves-setp (implies (and (true-listp l) (setp s)) (setp (join l s)))) ! Rewrite Rule. 7

  8. (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (defthm insert-preserves-setp (implies (setp s) (setp (insert x s)))) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (defthm join-preserves-setp (implies (and (true-listp l) (setp s)) (setp (join l s)))) 8

  9. (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (defthm insert-preserves-setp (implies (setp s) (setp (insert x s)))) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (defthm join-preserves-setp (implies (and (true-listp l) (setp s)) (setp (join l s)))) 9

  10. ? (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (defthm join-preserves-setp (implies (and (true-listp l) (setp s)) (setp (join l s)))) 10

  11. ? ? ? (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (defthm join-preserves-setp (implies (and (true-listp l) (setp s)) (setp (join l s)))) 11

  12. Tak aking a Pr ing a Prog ogram Apar am Apart 12

  13. (interface Insert (sig setp (s)) (sig insert (x s)) (con insert-preserves-setp (implies (setp s) (setp (insert x s))))) (interface Join (extend Insert) (sig join (l s)) (con join-preserves-setp (implies (and (true-listp l) (setp s)) (setp (join l s))))) 13

  14. (module JoinMod (import Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) 14

  15. (module JoinMod (import Insert) ! Names + Rewrite Rules. Termination Argument? ! (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) ! Rewrite Rule + Induction Scheme. Validity by Induction? ! (export Join)) 15

  16. (interface BigStep (sig eval (e)) #|contracts|#) (interface SmallStep (sig step (e)) #|contracts|# (sig step-all (e)) #|contracts|#) (interface Equivalence (extend BigStep SmallStep) (con big-step=small-step (implies (expr-p e) (equal (eval e) (step-all e))))) 16

  17. (module SmallStepMod (defun step (e) ...) (defun step-all (e) (cond ((integerp e) e) ((calc-p e) (step-all (step e))))) (export SmallStep)) 17

  18. (module SmallStepMod (defun step (e) ...) Termination Argument? ! (defun step-all (e) (cond ((integerp e) e) ((calc-p e) (step-all (step e))))) ! Rewrite Rule + Induction Scheme. Validity by Induction? ! (export SmallStep)) 18

  19. (module EquivalenceMod (import BigStep SmallStep) (export Equivalence)) 19

  20. (module EquivalenceMod (import BigStep SmallStep) ! Names + Rewrite Rules. Validity by Induction? ! (export Equivalence)) 20

  21. (module EquivalenceMod (import BigStep SmallStep) ! Names + Rewrite Rules. Termination Argument? ! (defun recursion (e) (cond ((integerp e) nil) ((calc-p e) (recursion (step e))))) ! Rewrite Rule + Induction Scheme. Validity by Induction? ! (export Equivalence)) 21

  22. (interface BigStep (sig eval (e)) #|contracts|#) (interface SmallStep (sig step (e)) #|contracts|# (sig step-all (e)) #|contracts|# ) (interface Equivalence (extend BigStep SmallStep) (con big-step=small-step (implies (expr-p e) (equal (eval e) (step-all e))))) 22

  23. (interface BigStep (sig eval (e)) #|contracts|#) (interface SmallStep (sig step (e)) #|contracts|# (sig step-all (e)) #|contracts|# (fun recursion (e) (cond ((integerp e) nil) ((calc-p e) (recursion (step e)))))) (interface Equivalence (extend BigStep SmallStep) (con big-step=small-step (implies (expr-p e) (equal (eval e) (step-all e))))) 23

  24. (interface BigStep (sig eval (e)) #|contracts|#) (interface SmallStep (sig step (e)) #|contracts|# (fun step-all (e) (cond ((integerp e) e) ((calc-p e) (step-all (step e))))) ) (interface Equivalence (extend BigStep SmallStep) (con big-step=small-step (implies (expr-p e) (equal (eval e) (step-all e))))) 24

  25. (module SmallStepMod (defun step (e) ...) Validity and Termination Argument? ! (export SmallStep) ! Names, Rewrite Rules, and Induction Scheme. ) 25

  26. (module EquivalenceMod (import BigStep SmallStep) ! Names, Rewrite Rules, and Induction Scheme. Validity by Induction? ! (export Equivalence)) 26

  27. (defun D (x) d) (defthm E e) (defun F (y) f) (defthm G g) (defun H (z) h) (defthm I i) 27

  28. (defun D (x) d) (defthm E e) (defun F (y) f) (defthm G g) (defun H (z) h) (defthm I i) 28

  29. (interface A (defun D (x) d) (defthm E e)) (interface B (extend A) (defun F (y) f) (defthm G g)) (interface C (extend A B) (defun H (z) h) (defthm I i)) 29

  30. (interface A (fun D (x) d) (defthm E e)) (interface B (extend A) (fun F (y) f) (defthm G g)) (interface C (extend A B) (fun H (z) h) (defthm I i)) 30

  31. (interface A (fun D (x) d) (con E e)) (interface B (extend A) (fun F (y) f) (con G g)) (interface C (extend A B) (fun H (z) h) (con I i)) 31

  32. (interface A (fun D (x) d) (module M (con E e)) (export A)) (interface B (module N (extend A) (import A) (fun F (y) f) (export B)) (con G g)) (module O (interface C (import A B) (extend A B) (export C)) (fun H (z) h) (con I i)) 32

  33. Lemma Lemma Modular Modular ACL2 CL2 Optimiz Optimized ed 0.05s 0.05s 0.05s random/type 0.01s 142.88s 2.00s tick/type 0.01s 136.67s 2.28s tick/in-bounds 0.02s 320.84s 2.29s tick/uncrossed 33

  34. Putting a Pr Putting a Prog ogram Bac am Back Tog ogether ether 34

  35. (link InsertJoinMod (InsertMod JoinMod)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 35

  36. (module InsertJoinMod (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (export Insert) (import Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 36

  37. (module InsertJoinMod (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (export Insert) (import Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 37

  38. (module InsertJoinMod (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (export Insert) (import Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 38

  39. (module InsertJoinMod (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (export Insert) (import Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 39

  40. (module InsertJoinMod (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (export Insert) (import Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 40

  41. (module InsertJoinMod (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (export Insert) (import Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 41

  42. (module InsertJoinMod (defun setp (s) (no-duplicatesp-equal s)) (defun insert (x s) (add-to-set-eql x s)) (export Insert) (defun join (l s) (if (endp l) s (insert (car l) (join (cdr l) s)))) (export Join)) (invoke InsertJoinMod) (join (list 1 2 3) (list 2 3 4)) 42

  43. (module N (module M (import I) (export I)) (export J)) 43

  44. (module N (module M (link MN (export I)) + = (import I) (M N)) (export J)) 44

  45. (module N (module MN (module M (export I)) + = (import I) (export I) (export J)) (export J)) 45

  46. (module N (module MN (module M (export I)) + = (import I) (export I) (export J)) (export J)) I 46

  47. (module N (module MN (module M (export I)) + = (import I) (export I) (export J)) (export J)) I , I ⇒ J 47

  48. (module N (module MN (module M (export I)) + = (import I) (export I) (export J)) (export J)) I , I ⇒ J I � J � 48

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