📥 Download raw

Let’s play Agda: running abstract mathematical proofs as programs

The purpose of this website is to help you learn Agda, the functional proof language. It was created for a 2025 course at the University of Padova.

Start here: Agda as a programming language

👋 Padova students: Transcripts and links accompanying our sessions

In a nutshell: Agda is a programming language…

For instance, an implementation of insertion sort might look like this:

sort : List ℕ → List ℕ
sort []       = []
sort (x ∷ xs) = insert x (sort xs)

And we can imagine functions with type signatures such as…

fibonacci : ℕ → ℕ                                   -- Fibonacci numbers
pi        : ℝ                                       -- arbitrary-precision constant
size      : {X : Set} → Tree X → ℕ                  -- size of binary tree
replicate : {X : Set} (len : ℕ) → X → Vector len X  -- vector of identical elements

…and simultaneously: a proof language…

In Agda, we prove a proposition by constructing a program which computes a suitable witness. This approach is the celebrated propositions as types philosophy:

grande-teorema   : 2 + 2 ≡ 4
binomial-theorem : (x : ℕ) (y : ℕ) → (x + y) ² ≡ x ² + 2 · x · y + y ²
sort-correct     : (xs : List ℕ) → IsSorted (sort xs)

For instance, there is a type of witnesses…

…helping us with…