Dependent types I › Exercises [01E7]
- August 11, 2025
- Jon Sterling
Exercise. Dependent types I › Rules of inference › Structural rules › Rule golf [01D7]
- August 11, 2025
- Jon Sterling
Imagine that we had omitted the transitivity and symmetry rules for judgemental equality. Devise a single rule that handles both transitivity and symmetry simultaneously.
Exercise. Dependent types I › The unit type › Extensionality [01DN]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule is equivalent to the following extensionality rule that equates any two elements:
\frac {u,v:\mathsf {unit}}{u\equiv v:\mathsf {unit}}Exercise. Dependent types I › The empty type › Dependent elimination [01DC]
- August 11, 2025
- Jon Sterling
We can also consider a dependent elimination rule for the empty type, where we allow C to depend on an element of the empty type; show that the following can be derived from the simple elimination rule, filling in the question marks:
\frac { x:\mathsf {empty}\vdash C[x]~\mathit {type} \quad u:\mathsf {empty} }{ ???:C[u] }Exercise. Dependent types I › The product of a family of types › Extensionality [01DJ]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule for the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} is equivalent to the following extensionality rule:
\frac { u,v:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} \quad x:A\vdash ux\equiv vx:B[x] }{ u\equiv v:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} }Exercise. Dependent types I › The sum of a family of types › Extensionality [01E6]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule for the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} is equivalent to the following extensionality rule:
\frac { u,v:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} \quad u.1\equiv v.1:A \quad u.2\equiv v.2:B[u.1] }{ u\equiv v:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }Exercise. Dependent types I › Identification types › Unicity of self-identifications [01EQ]
- August 11, 2025
- Jon Sterling
Using the elimination rule above, try to construct elements of the following types:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Au)}} p=_{u=_Au}\mathsf {refl}_u {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p,q:u=_Av)}} p=_{u=_Av}qWhat goes wrong? What do you think this implies about the notion of “sameness” that we get from identification types?
Exercise. Dependent types I › Identification types › Unbiased elimination rule (extremely hard!) [01EE]
- August 11, 2025
- Jon Sterling
Prove that the elimination and computation rules for the identification type are equivalent to the following “unbiased” ones that do not fix u outside of the family C:
\frac { w:u=_A v\quad x:A,y:A,z:x=_Ay\vdash C[x,y,z]~\mathit {type}\quad x:A\vdash c[x]:C[x,x,\mathsf {refl}_u] \quad }{ \mathsf {J}'_{x,y,z\mathpunct {.}C[x,y,z]}(w; x\mathpunct {.} c[x]) : C[u,v,w] } \frac { u:A\quad x:A,y:A,z:x=_Ay\vdash C[x,y,z]~\mathit {type}\quad x:A\vdash c[x]:C[x,x,\mathsf {refl}_x] \quad }{ \mathsf {J}'_{x,y,z\mathpunct {.}C[x,y,z]}(\mathsf {refl}_u; x\mathpunct {.}{c[x]}) \equiv c[u] :C[u,u,\mathsf {refl}_u] }Explicitly, you are being asked to use \mathsf {J} to define \mathsf {J}' and vice versa. This exercise is extremely difficult, so don’t waste too much time on it.