functional programming functional programming and theorem
play

Functional Programming Functional Programming and Theorem Proving - PowerPoint PPT Presentation

Functional Programming Functional Programming and Theorem Proving and Theorem Proving for Undergraduates for Undergraduates A Progress Report A Progress Report Carl Carl Eastlund Eastlund and Matthias and Matthias Felleisen Felleisen


  1. Functional Programming Functional Programming and Theorem Proving and Theorem Proving for Undergraduates for Undergraduates A Progress Report A Progress Report Carl Carl Eastlund Eastlund and Matthias and Matthias Felleisen Felleisen Northeastern University Northeastern University Rex Page Rex Page University of Oklahoma University of Oklahoma Functional Programming and Theorem Proving for Undergraduates 1 1 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  2. History History � Before 2003 � Traditional SE at OU (2-course sequence, 4 th yr) � Process Design Testing/Validation 60% 20% 20% � � 2003-2005 � SE course using ACL2 (FDPE 2005 report) � Process Design Testing/Validation 30% 35% 35% � � Successful despite crude programming env � 2006 - present � SE course with Dracula/ACL2 environment � 1 st year course at NU using Dracula/ACL2 Functional Programming and Theorem Proving for Undergraduates 2 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  3. Mantra Mantra Engineering is the application of � Before 2003 principles of science and mathematics � Traditional SE at OU (2-course sequence, 4 th yr) � Process Design Testing/Validation to the design of useful things 60% 20% 20% � � 2003-2005 � SE course using ACL2 (FDPE 2005 report) � Process Design Testing/Validation 30% 35% 35% � � Successful despite crude programming env � 2006 - present � SE course with Dracula/ACL2 environment � 1 st year course at NU using Dracula/ACL2 Functional Programming and Theorem Proving for Undergraduates 3 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  4. ACL2 ;; sqr : Int -> Int (defun sqr (x) (* x x)) ;; All squares are nonnegative. (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) Functional Programming and Theorem Proving for Undergraduates 4 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  5. ACL2 Functional Programming & Theorem Proving for Undergrads - FDPE 2008 5 Rex Page / Carl Eastlund / Matthias Felleisen

  6. ACL2 Functional Programming & Theorem Proving for Undergrads - FDPE 2008 6 Rex Page / Carl Eastlund / Matthias Felleisen

  7. ACL2 Functional Programming & Theorem Proving for Undergrads - FDPE 2008 7 Rex Page / Carl Eastlund / Matthias Felleisen

  8. Dracula Functional Programming and Theorem Proving for Undergraduates 8 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  9. Dracula Functional Programming and Theorem Proving for Undergraduates 9 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  10. Dracula Functional Programming and Theorem Proving for Undergraduates 10 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  11. Dracula Functional Programming and Theorem Proving for Undergraduates 11 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  12. Dracula Functional Programming and Theorem Proving for Undergraduates 12 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  13. Dracula Functional Programming and Theorem Proving for Undergraduates 13 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  14. Dracula Functional Programming and Theorem Proving for Undergraduates 14 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  15. Dracula Functional Programming and Theorem Proving for Undergraduates 15 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  16. Dracula Functional Programming and Theorem Proving for Undergraduates 16 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  17. Dracula Functional Programming and Theorem Proving for Undergraduates 17 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  18. Dracula ;; sqr : Int -> Int (defun sqr (x) (* x x)) ;; All squares are nonnegative. (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) Functional Programming and Theorem Proving for Undergraduates 18 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  19. Dracula ;; sqr : Int -> Int (defun sqr (x) x) ;; All squares are nonnegative. (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) Functional Programming and Theorem Proving for Undergraduates 19 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  20. Dracula Functional Programming and Theorem Proving for Undergraduates 20 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  21. Program Design � How to Design Programs code: ;; sqr : Int -> Int (define (sqr x) (* x x)) ;; Unit tests: (check-expect (sqr 0) 0) (check-expect (sqr 2) 4) Functional Programming and Theorem Proving for Undergraduates 21 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  22. Program Design � Dracula code: Dracula code: ;; sqr : Int -> Int (defun sqr (x) (* x x)) ;; Unit tests: (check-expect (sqr 0) 0) (check-expect (sqr 2) 4) Functional Programming and Theorem Proving for Undergraduates 22 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  23. Unit Tests � Dracula code: Dracula code: ;; sqr : Int -> Int (defun sqr (x) (* x x)) ;; Unit tests: (==> assert-event) (check-expect (sqr 0) 0) (check-expect (sqr 2) 4) Functional Programming and Theorem Proving for Undergraduates 23 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  24. Unit Tests Functional Programming and Theorem Proving for Undergraduates 24 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  25. Unit Tests Functional Programming and Theorem Proving for Undergraduates 25 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  26. Beyond Unit Tests ;; sqr : Int -> Int (defun sqr (x) (+ x x)) ;; Unit tests: (check-expect (sqr 0) 0) (check-expect (sqr 2) 4) Functional Programming and Theorem Proving for Undergraduates 26 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  27. Beyond Unit Tests Functional Programming and Theorem Proving for Undergraduates 27 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  28. DoubleCheck ;; ACL2 theorem: (defthm name (implies (and precondition ... ) postcondition ))) ;; DoubleCheck property: (defproperty name ( x [:where precondition] [:value distribution] ... ) postcondition ) Functional Programming and Theorem Proving for Undergraduates 28 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  29. DoubleCheck ;; ACL2 theorem: (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) ;; DoubleCheck property: (defproperty sqr>=0 (x) (implies (integerp x) (>= (sqr x) 0))) Functional Programming and Theorem Proving for Undergraduates 29 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  30. DoubleCheck ;; ACL2 theorem: (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) ;; DoubleCheck property: (defproperty sqr>=0 (x :where (integerp x)) (>= (sqr x) 0)) Functional Programming and Theorem Proving for Undergraduates 30 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  31. DoubleCheck ;; ACL2 theorem: (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) ;; DoubleCheck property: (defproperty sqr>=0 (x :where (integerp x) :value (random-integer)) (>= (sqr x) 0)) Functional Programming and Theorem Proving for Undergraduates 31 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  32. DoubleCheck ;; Simple distributions: (random-string) (random-integer) ;; Parameterized distributions: (random-between low high ) (random-list-of dist [:size size] ) ;; Write new distributions: (defrandom name ( arg ... ) expr ) Functional Programming and Theorem Proving for Undergraduates 32 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  33. DoubleCheck ;; ACL2 theorem: (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) ;; DoubleCheck property:(==> defthm) (defproperty sqr>=0 (x :where (integerp x) :value (random-integer)) (>= (sqr x) 0)) Functional Programming and Theorem Proving for Undergraduates 33 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  34. DoubleCheck ;; ACL2 theorem: (defthm sqr>=0 (implies (integerp x) (>= (sqr x) 0))) ;; Ideal syntax (future work): (defproperty sqr>=0 (implies (integerp x) (>= (sqr x) 0))) Functional Programming and Theorem Proving for Undergraduates 34 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  35. DoubleCheck Functional Programming and Theorem Proving for Undergraduates 35 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  36. DoubleCheck Functional Programming and Theorem Proving for Undergraduates 36 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  37. DoubleCheck Functional Programming and Theorem Proving for Undergraduates 37 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  38. DoubleCheck ;; sqr : Int -> Int (defun sqr (x) (+ x x)) ;; Unit tests: (check-expect (sqr 0) 0) (check-expect (sqr 2) 4) (check-expect (sqr -30) 900) Functional Programming and Theorem Proving for Undergraduates 38 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  39. DoubleCheck ;; sqr : Int -> Int (defun sqr (x) (* x x)) ;; Unit tests: (check-expect (sqr 0) 0) (check-expect (sqr 2) 4) (check-expect (sqr -30) 900) Functional Programming and Theorem Proving for Undergraduates 39 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

  40. DoubleCheck Functional Programming and Theorem Proving for Undergraduates 40 FDPE 2008 - Rex Page / Carl Eastlund / Matthias Felleisen

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