CS 472: Provably Correct Programming

technical elective, 3 or 4 credits

Instructor: William Mansky

Overview

The purpose of this course is to learn how to use formal logic to precisely describe and reason about programs and their behavior. We will use interactive theorem proving tools to define programs and programming languages, specify their behavior, and prove that programs satisfy their specifications.

By the end of this class, you will know how to:

  • use the Coq proof assistant to write machine-checked proofs
  • precisely describe the desired behavior of a program, and prove that it has that behavior
  • mathematically guarantee that a program is free of bugs
  • determine whether a program with complicated pointer manipulation, fancy inter-thread synchronization, or other complicated features is written correctly

Prerequisites

The official prerequisite for this class is CS 301 or equivalent. I will assume familiarity with propositional logic and the basic concepts of mathematical proof, especially proof by induction. Functional programming experience (as in CS 341) or familiarity with programming language semantics (as in CS 476) is helpful but not required.

Welcome!

I’m glad you’re taking this course, and excited to explore proved-correct programming with you. That said, your wellbeing is more important to me than your coursework. I’ve tried to plan the course so that it’ll be fun, interesting, and not too much of a burden, but if there’s more I can do, please let me know. Likewise, if circumstances prevent you from completing an assignment or make it difficult for you to keep up with the course, let me know and we can figure something out. I’ve enabled anonymous posts on Piazza, so you can give feedback fully anonymously if you want to.

Communication

The class discussion board on Piazza is the best place to post questions about the course material, assignments, course policies, project, and anything else. If you see a question that you know the answer to, go ahead and answer it! You can ask and answer anonymously, and you can also use it to send messages to the instructor (I check it more often than email). There will be a small amount of extra credit available for being a good citizen on Piazza - asking questions, answering questions, and generally being helpful. (Remember that I can’t give you extra credit for fully anonymous posts!)

Evaluation

Grades are curved based on an aggregate course score. There are separate curves for graduate and undergraduate students. This means that the course score cut-offs for an A, B, C, etc. are not defined ahead of time: these will be set after the end of the course.

The course grade weighting is:

Task % of total grade
In-class exercises 25
Assignments 50
Project 25

Students taking the course for 4 credits will have extra problems to solve on most assignments.

Attendance and Participation

Class will meet two times per week. Most classes will have a lab portion in which you work through exercises and discuss problems, and participation in these labs (either live or online within the following week) is a component of your grade. This is an on-campus course, but classes will also be both livestreamed and recorded on Blackboard with Zoom. If you are not able to attend a class live, you can watch the recording and submit the exercise when you are able, no later than 1 week after the class. A small amount of extra credit will be available for active participation in class or on Piazza. Office hours will be held both in-person and online.

Textbook

The textbooks for the course are digital-only, and are freely available online. We will use Logical Foundations and Programming Language Foundations for the first half of the course, and assorted online reading material and exercises for the second half.

Assignments

Assignments for the course will ask you to solve exercises from the textbooks in Coq. Feel free to post questions on Piazza or come to office hours for help with homework. If you’re stuck on something for more than 15 minutes or so, take a break and ask a question! It’s easy to miss small things when writing proofs, and a bit of outside perspective often helps. Assignments will be submitted via Gradescope. We will work through example solutions in class, so please submit assignments on time, even if they’re not 100% complete.

Academic Integrity

You are encouraged to consult with your classmates on the assignments, but you should write your own code, and copying code/proofs from your classmates without citation is considered plagiarism. Given the question “how did you do X?”, a great response would be “I used function Y, with W as the second argument. I tried Z first, but it doesn’t work.” An inappropriate response would be “here is my code, look for yourself.” If you ask for help from sources outside the course, you must clearly state that you’re asking for help on homework for a class.

In keeping with academic and professional ethics, you must cite your sources in all submitted materials. List classmates you discussed your homework with and webpages from which you got inspiration or copied (short) code snippets. All students are expected to understand and be able to explain their submitted materials, and may be asked to do so at the instructor’s discretion. Plagiarism and cheating, as in copying the work of others, paying others to do your work, etc., is prohibited, is grounds for failing the course, and will be reported.

Assignments and ChatGPT

The code we write in this course will be in the Coq proof language. There is much less publicly available code in Coq than in most programming languages, and it has much stricter logic, so generative AI tools like ChatGPT generally don’t do well with it. If you use ChatGPT to help with assignments, 1) always cite it in the comments, and 2) make sure to run your proof scripts to make sure that they actually work, or you risk not receiving credit for the assignment.

Accessibility

UIC is committed to full inclusion and participation of people with disabilities in all aspects of university life. Students who face or anticipate disability-related barriers while at UIC should connect with the Disability Resource Center (DRC) at drc.uic.edu, drc@uic.edu, or at (312) 413-2183 to create a plan for reasonable accommodations. In order to receive accommodations, students must disclose disability to the DRC, complete an interactive registration process with the DRC, and provide their course instructor with a Letter of Accommodation (LOA). Course instructors in receipt of an LOA will work with the student and the DRC to implement approved accommodations.

Mental and Emotional Health

Your mental health and emotional wellness are at least as important as academic success. The UIC Counseling Center offers an array of services to provide additional support throughout your time at UIC, including workshops, peer support groups, counseling, self-help tools, and initial consultations to speak to a mental health counselor about your concerns. Please visit the Counseling Center website for more information (https://counseling.uic.edu/). Further, if you think emotional concerns may be impacting your academic success, please contact your faculty and academic advisers and we can try to make things more manageable.

Religious Holidays

The UIC Senate Policy on religious holidays is as follows:

“The faculty of the University of Illinois at Chicago shall make every effort to avoid scheduling examinations or requiring that student projects be turned in or completed on religious holidays. Students who wish to observe their religious holidays shall notify the faculty member by the tenth day of the semester of the date when they will be absent unless the religious holiday is observed on or before the tenth day of the semester. In such cases, the students shall notify the faculty member at least five days in advance of the date when he/she will be absent. The faculty member shall make every reasonable effort to honor the request, not penalize the student for missing the class, and if an examination or project is due during the absence, give the student an exam or assignment equivalent to the one completed by those students in attendance. If the student feels aggrieved, he/she may request remedy through the campus grievance procedure.”

Nondiscrimination

UIC is committed to the most fundamental principles of academic freedom, equality of opportunity, and human dignity involving students and employees. Freedom from discrimination is a foundation for all decision making at UIC. Students are encouraged to study the University’s Nondiscrimination Statement. Information on relevant policies and procedures is available on the University web pages of the Office of Access and Equality.

Classroom Conduct Policy

Please be prepared to act according to our classroom conduct policy:

  • Be present during class. Put away cell phones and remove yourself from other distractions.
  • Be respectful of the learning space and community. For example, avoid side conversations or unnecessary disruptions.
  • Use your classmates’ preferred names and gender pronouns.
  • Assume goodwill in all interactions, even in disagreement.
  • Facilitate dialogue and value the free and safe exchange of ideas.
  • Try not to make assumptions, have an open mind, seek to understand and not judge.