We are now going to do again the first TD, but in Agda this time, and showing that our language has the expected properties.
We consider the simple programming language presented in the course where an expression p
consists of either
b
: a booleann
: an integerp + q
: a sum of two expressionp < q
: a comparison of two expressionsif p then q else r
: a conditional branchingDefine a recursive type Prog
which implements programs.
Show that the relation \(<\) on natural numbers is decidable.
We recall that the rules for reduction of programs are
Define the reduction relation:
_⇒_ : Prog → Prog → Set
Define a type Type
of types for our language.
Define the typing relation for the language:
_∷_ : Prog → Type → Set ⊢
Show the subject reduction property: if a program \(p\) has type \(A\) and \(p\) reduces to \(p'\) then \(p'\) also has type \(A\).
Show the progress property: a typed program either is a value (a natural number or a boolean) or reduces.
Add products to the language.
Add a units to the language.
Add λ-abstractions to the language (this is hard!).