1. Empty and unit types
Dmytro Mitin
https://stepik.org/course/Introduction-to-programming-
with-dependent-types-in-Scala-2294/
March 2017
Dmytro Mitin Empty and unit types
3. Empty type
1 Type Formation
Γ ctx
Γ 0 : ∗
2 Constructor
3 Eliminator
Γ C : ∗
Γ, x : 0 abortC x : C
4 Computation rule (”β-reduction“)
5 Uniqueness principle (”η-conversion“)
Γ c : C
Γ, x : 0 abortC x ≡ c : C
Dmytro Mitin Empty and unit types
4. Unit type
1 Type Formation
Γ ctx
Γ 1 : ∗
2 Constructor
Γ ctx
Γ 1 : 1
3 Eliminator
Γ c : C
Γ, x : 1 case1(x)(c) : C
x match { case () => c }
Dmytro Mitin Empty and unit types
5. Unit type
4 Computation rule (”β-reduction“)
Γ c : C
Γ case1(1)(c) ≡ c : C
5 Uniqueness principle (”η-conversion“)
Γ C : ∗ Γ, x : 1 c : C
Γ, y : 1 case1(y)(c) [x ← 1] ≡ c[x ← y] : C
Dmytro Mitin Empty and unit types
6. Haskell, Scala and Java
Haskell
() :: ()
Scala
() : Unit Nothing null : Null
Java
void Void null
Dmytro Mitin Empty and unit types