Lectures on Agda

Peter Selinger
Dalhousie University

This is a course on Agda I gave at Dalhousie University in Winter 2021. Unlike most other such materials that I have seen, this course focuses on using Agda for mathematics, rather than program verification. I deliberately did not use the standard library, focusing instead of developing all concepts from scratch. Frank Fu was the teaching assistant for this course, and he developed many of the materials, including the installation instructions, homeworks, and projects.

This is a basic course. One important topic I did not cover is the use of setoids, i.e., sets equipped with an equivalence relation. One arguably needs this to do "real" mathematics in Agda, because sooner or later one will need to take a quotient of a set, which is basically impossible if one works with the native Agda equality. Many other topics were also not covered, such as proof irrelevance, coinduction, and more.

If a "+" sign appears after a lecture link below, you can click on it to see a list of Agda topics covered in the lecture, with links to the relevant Agda documentation.

Agda is named after a chicken, just like Coq. The picture above is of one of my chickens, Vanilla. Maybe one day I will name a proof assistant after her. Vanilla and some of her fellow chickens are also mentioned in the lectures on "records" below.

Installation instructions

1. Introduction

Agda files from class:

2. Sets vs. types, lambda calculus

Lecture notes:

3. Typing rules, Curry-Howard isomorphism

Lecture notes:

4. Inductive types

Lecture notes:

5. Agda basics

Agda files from class:

6. Inductive predicates

Agda files from class:

7. Logical connectives, part 1

Agda files from class:

8. Interlude: The Stone-Tarski interpretation of intuitionistic logic

Lecture notes:

9. Logical connectives, part 2

Agda files from class:

10. More Agda features

Agda files from class:

11. Tactics and decidability

Agda files from class:

12. Records and overloading

Agda files from class:

13. Universes

Agda files from class:

14. Application: Generators and relations for monoids

Lecture notes:

Agda files from class:

Exercises

This course had a number of problem sets, designed by Frank Fu and me. Some of them were called "homework", which the students were allowed to collaborate on, and others were called "projects", which the students had to do individually, like an exam.

If you are learning Agda, you might find these homeworks and projects fun. Each of them consists of one or more files with "holes" for you to fill in. In some of them, you also have to come up with your own definitions and/or lemmas. I will not post the solutions, and I ask that you do not publicly post the solutions either. But of course you can use Agda to check whether you did the problems correctly.