1 When and Where
2 What
3 How
4 Grades
5 Academic Integrity
6 Schedule (that will be revised as we go)

Proving Properties of Programs with Mechanized Logic

Robby Findler, Shu-Hung You, Chenhao Zhang, and Peter Zhong

1 When and Where

We meet Monday, Wednesday, Friday from 11am to 11:50am in Annenberg G15. 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.

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 homeworks, 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.

You will need to use some specific software to solve homework assignments in this course:
  • 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 27 of the 29 classes the first 16 classes (you can also attend later lectures for credit; for details on how to claim credit for later lectures, see piazza).

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

Tue 3/28

 

1: Introduction & our First Properties

 

Wed 3/29

 

2: Contracts

 

Fri 3/31

 

3: Contracts, cotd

 

Assignment 1

 

Week 2

Mon 4/3

 

4: Proof of Insertion Sort: Sortedness, i [run-and-ind.pdf]

 

Wed 4/5

 

5: Proof of Insertion Sort: Sortedness, ii [sortedness.pdf]

 

Fri 4/7

 

6: Proof of Insertion Sort: Permutation

 

Assignment 2

 

Week 3

Mon 4/10

 

7: Property-based Testing

 

Wed 4/12

 

8: Property-based Testing, cotd

 

Fri 4/14

 

9: Introduction to Agda

 

Assignment A

 

Week 4

Mon 4/17

 

10: NP Reduction [Reduction_Mon_04_17_2023.pdf]

 

Wed 4/19

 

11: NP Reduction [0419-slides-and-code.zip]

 

Fri 4/21

 

12: NP Reduction [0423-slides-and-code.zip]

 

Assignment 3

 

Week 5

Mon 4/24

 

13: Constructive Proofs

 

Wed 4/26

 

14: Proofs with Booleans

 

Fri 4/28

 

15: Proofs with Naturals

 

Assignment 4

 

Week 6

Mon 5/1

 

16: More on Naturals

 

Wed 5/3

 

17: Lists

 

Fri 5/5

 

18: Lists with Lengths

 

Assignment 5

 

Week 7

Mon 5/8

 

19: Proofs in Data Structures

 

Wed 5/10

 

20: Evidence

 

Fri 5/12

 

21: External & Internal Verification

 

Assignment 6

 

Week 8

Mon 5/15

 

22: External & Internal Verification

 

Wed 5/17

 

23: Termination

 

Fri 5/19

 

24: Termination & Proofs

 

Assignment B

 

Week 9

Mon 5/22

 

25: Weakest Preconditions

 

Wed 5/24

 

26: Weakest Preconditions, cotd

 

Assignment 7A

Fri 5/26

 

27: Dafny

 

Assignment 7B

 

Week 10

Wed 5/31

 

28: Arithmetic Expressions, an Evaluator, and a Compiler

 

Fri 6/2

 

29: The Arithmetic Expression Compiler is Correct