Proof and Reliable Programming using Coq

This is a course in 8 modules of 3 hours each, with the following tentative plan

  1. Programming with simple types and recursive data-types
  2. Logical formulas and the proposition-as-type correspondence in practice
  3. Tactic-based theorem proving
  4. Advanced proof-by-induction guidelines
  5. Dependent types: beauty and horror
  6. Proof automation

Useful links:

A book : Mathematical Components,  introductory notes (coq in a hurry), an in-browser Coq instantiation, the Coq web site, the Coq installation page.

1. Programming with simple types and recursive data-types

In this lesson we learn the basics of pattern-matching and recursive programming in the Coq system, using first the list data structure and then the natural number data structure as examples.  This is also the occasion to teach about notations and implicit arguments.  These notes from another year cover the main part of this lesson. To test whether you understood this lesson, here are a few diagnostic questions and the corresponding answers.  Please contact the teacher if these diagnostic questions show there is still some misconceptions.

2. Logical formulas and the proposition-as-type correspondence in practice

In this lesson, we practice the syntax of a variety of logical connectives. These notes cover the main part of this lesson.  The table in this quick reference page summarizes the tactics that were taught.  Diagnostic questions, answers.

3. Reasoning by cases and by induction about programs and their behavior

In this lesson, we show how reasoning about programs can be organized.  These notes cover the main part of the lesson, diagnostic questions, answers.

4. Reasoning by induction, continued

In this less we continue the presentation of tactics that are useful to reason about programs. We work on a few exercises taken from the previous lesson’s notes. Homework is based on question 5(a) from these notes.

5. Advanced techniques for proof by induction: multi-step and induction loading.

In this lesson, we look at proofs by induction that require specific preparation and concentrate on the question of induction loading. Part of the lessons applied here can be taken from these notes, diagnostic questions, answers.

6. More data-types

In this lesson, we depart from just lists and natural numbers to see data-types that make more computations feasible. In particular, we observe binary numbers and various kinds of binary trees.  This course will follow these course notes.

7. Dependent types

In this lesson, we show that the logical language and the programming language are combined in a single programming language, where the expressive power is given by dependent types.  We show how recursive programming combines with dependent types to give a nice and powerful programming language.  This course follows these course notes, example file.