Proving Properties of Programs with Mechanized Logic
1 When and Where
We meet Monday, Wednesday, Friday from 11am to 11:50am in Tech LG72. The Schedule (that will be revised as we go) provides more details for each meeting.
Use Piazza for discussion about the class (signup link); grades and assignment submission are in Canvas.
Attendance in class is mandatory and will be checked. Your attendance will affect your final grade. If you do not come, it is not possible to earn an A in this class.
You are expected to check piazza at least once per day during the week.
2 What
In this class we will explore properties that programs can have, first focusing on stating them in a precise and checkable way. As we start, we will be limited to testing only a subset of the possible inputs.
As the quarter progresses, we will explore how to prove programs correct using Agda, guaranteeing the properties for all possible inputs. We will be using Aaron Stump’s Book, Verified Functional Programming in Agda. Access the link while on campus to download a PDF free of charge.
3 How
You will be expected to solve smaller homework assignments that test your understanding of the concepts and then complete two larger homework assignments, one where you demonstrate your ability to use random testing (closer to the start of the quarter) and one where you demonstrate your ability to state and prove a property of a (small) program (at the end of the quarter). The final assignment will be due during the last week of class.
Racket: It is easy to install, follow the instructions on the website.
Agda:
Agda is less easy to install. I had success using the Haskell Platform and installing Agda via slack (a haskell package manager); I’ve also had success using the brew-based instructions on the Agda website. In case you run into trouble, we’ve built a virtual machine with Agda 2.6.1 already installed that you should be able to use via VirtualBox, or possibly other virtual machine software. To login, use the userid ial and with the password ial.
Under macOS, the Terminal app seems to capture important keystrokes without passing them on to the running process (notably c-. and c-,). To avoid this program, use the Emacs GUI App instead.
Note that the VM has Agda 2.6.1 and my machine has Agda 2.6.3 installed; hopefully both versions will be fine with all the code we’ll use this quarter but if you notice a discrepancy, please let me know (I am able to use both versions.)
Iowa Agda Library: this is also already installed on the VM.
We may add one more software package here to be used near the end of the quarter. It will be announced in class.
4 Grades
The homework assignments with numbers in their names are worth 20% of your final grade. They are designed for you to practice what you are learning in class.
Your attendance is worth another 10% of your grade. You will get one point for each time you attend class and will receive full credit if you attend 28 of the 30 classes.
The remainder of your grade is split equally between the two homework assignments with letters in their names (Homework A and Homework B). These are more mini-projects where you demonstrate you’ve mastered that part of the material. These are more in depth than the numbered homework but are still doable in a week.
5 Academic Integrity
All work turned in must name everyone that contributed in any way to the work.
Hew to the Provost’s Eight Cardinal Rules of Academic Integrity.
6 Schedule (that will be revised as we go)
When |
| What |
| Homework |
| ||||
Week 1 | ||||
Wed 9/20 |
| 1: Introduction & our First Properties |
| |
Fri 9/22 |
| 2: Contracts |
| |
| ||||
Week 2 | ||||
Mon 9/25 |
| 3: Contracts, cotd |
| |
Wed 9/27 |
| 4: Property-based Testing |
| |
Fri 9/29 |
| 5: Shrinking |
| |
| ||||
Week 3 | ||||
Mon 10/2 |
| 6: Randomized Test-Driven Development |
| |
Wed 10/4 |
| 7: Introduction to Agda |
| |
Fri 10/6 |
| 8: Constructive Proof |
| |
| ||||
Week 4 | ||||
Mon 10/9 |
| 9: Booleans |
| |
Wed 10/11 |
| 10: Natural Numbers |
| |
Fri 10/13 |
| 11: Natural Numbers, cotd |
| |
| ||||
Week 5 | ||||
Mon 10/16 |
| 12: Lists |
| |
Wed 10/18 |
| 13: Lists with Lengths |
| |
Fri 10/20 |
| 14: Evidence |
| |
| ||||
Week 6 | ||||
Mon 10/23 |
| 15: Braun Trees: External Verification |
| |
Wed 10/25 |
| 16: Braun Trees: Internal Verification |
| |
Fri 10/27 |
| 17: Binary Tree Insertion |
| |
| ||||
Week 7 | ||||
Mon 10/30 |
| 18: Termination |
| |
Wed 11/1 |
| 19: Termination, cotd |
| |
Fri 11/3 |
| 20: Arithmetic Expressions, an Evaluator, and a Compiler |
| |
| ||||
Week 8 | ||||
Mon 11/6 |
| 21: The Arithmetic Expression Compiler is Correct |
| |
Wed 11/8 |
| 22: Macros: the expander, syntax objects, & modules |
| |
Fri 11/10 |
| 23: Macros: nuts & bolts, i |
| |
| ||||
Week 9 | ||||
Mon 11/13 |
| 24: Macros: nuts & bolts, ii |
| |
Wed 11/15 |
| 25: Introduction to Prolog |
| |
Fri 11/17 |
| 26: Implementing Prolog, using macros |
| |
| ||||
Week 10 | ||||
Mon 11/20 |
| 27: Implementing Prolog, using macros |
| |
| ||||
Week 11 | ||||
Mon 11/27 |
| 28: Karp 1127-slides.pdf |
| |
Wed 11/29 |
| 29: Karp 1129-slides.pdf 3sat.rkt iset.rkt 3sat-to-iset.rkt |
| |
Fri 12/1 |
| 30: Karp |
|