Dependent Type Theory Lecture 1
Nicola Gambino
MGS - Leicester 2009
Nicola Gambino Dependent Type Theory References
B. Nordstöm, K. Petersson, and J. M. Smith Martin-Löf’s Type Theory Handbook of Logic in Computer Science, Vol. 5 Oxford University Press, 2001.
B. Nordström, K. Petersson, and J. M. Smith Programming in Martin-Löf’s Type Theory Oxford University Press, 1990.
Nicola Gambino Dependent Type Theory Outline
1 Preliminaries
2 The dependent type theory ML
Nicola Gambino Dependent Type Theory Categorical judgements
There are four forms of categorical judgements:
A ∈ Type A = B ∈ Type a ∈ A a = b ∈ A
These express, respectively, that: A is a type A and B are definitionally equal types a is an element of A a and b are definitionally equal elements of A.
Nicola Gambino Dependent Type Theory Hypothetical judgements (I)
There are four forms of hypothetical judgements:
(Γ) A ∈ Type (Γ) A = B ∈ Type (Γ) a ∈ A (Γ) a = b ∈ A.
Here Γ is a context of variable declarations of the form (Γ) = x0 ∈ A0, x1 ∈ A1(x0),..., xn ∈ An(x0,..., xn−1) .
Nicola Gambino Dependent Type Theory Hypothetical judgements (II)
For the context Γ to be well-formed we need to know that the judgements
A0 ∈ Type
(x0 ∈ A0) A1(x0) ∈ Type . . x0 ∈ A0,..., xn−1 ∈ An−1(x0,..., xn−2) An(x0,..., xn−1) ∈ Type
are derivable.
Nicola Gambino Dependent Type Theory Deduction rules
Deduction rules have the form
(Γ1) J1 ··· (Γn) Jn (Γ) J
We often omit contexts that are common to premisses and conclusion.
Nicola Gambino Dependent Type Theory Outline
√ 1 Preliminaries
2 The dependent type theory ML
Nicola Gambino Dependent Type Theory The dependent type theory ML (I)
Two groups of rules:
General deduction rules, e.g.
(Γ) A ∈ Type (Γ, x ∈ A) x ∈ A
Deduction rules for the following forms of type:
0 , 1 , Nat , A + B ,
IdA(a, b) , (Σx ∈ A)B(x) , (Πx ∈ A)B(x) .
Nicola Gambino Dependent Type Theory The dependent type theory ML (II)
For each form of type, we give four groups of deduction rules:
Formation rules Introduction rules Elimination rules Computation rules
Nicola Gambino Dependent Type Theory Deduction rules for the type of natural numbers (I)
Formation rule:
Nat ∈ Type
Introduction rules:
n ∈ Nat 0 ∈ Nat succ(n) ∈ Nat
Nicola Gambino Dependent Type Theory Deduction rules for the type of natural numbers (II)
Elimination rule:
c ∈ Nat d ∈ C(0)(x ∈ Nat, y ∈ C(x)) e(x, y) ∈ C(succ(x)) natrec(c, d, e) ∈ C(c)
Computation rules:
d ∈ C(0)(x ∈ Nat, y ∈ C(x)) e(x, y) ∈ C(succ(x)) natrec(0, d, e) = d ∈ C(0)
n ∈ Nat d ∈ C(0)(x ∈ Nat, y ∈ C(x)) e(x, y) ∈ C(succ(x)) natrec(succ(n), d, e) = e(n, natrec(n, d, e)) ∈ C(succ(n))
Nicola Gambino Dependent Type Theory Deduction rules for the unit type (I)
Formation rules:
1 ∈ Type
Introduction rule:
∗ ∈ 1
Nicola Gambino Dependent Type Theory Deduction rules for the unit type (II)
Elimination rule:
c ∈ 1 d ∈ C(∗) rec(c, d) ∈ C(c)
Computation rule:
d ∈ C(∗) rec(∗, d) = d ∈ C(∗)
Nicola Gambino Dependent Type Theory Deduction rules for the empty type (I)
Formation rule:
0 ∈ Type
Introduction rules:
Nicola Gambino Dependent Type Theory Deduction rules for the empty type (II)
Elimination rule:
c ∈ 0 rec(c) ∈ C(c) Computation rules:
Nicola Gambino Dependent Type Theory Deduction rules for sum types (I)
Formation rules:
A ∈ Type B ∈ Type A + B ∈ Type
Introduction rules:
a ∈ A b ∈ B inl(a) ∈ A + B inr(b) ∈ A + B
Nicola Gambino Dependent Type Theory Deduction rules for sum types (II)
Elimination rule: c ∈ A + B (x ∈ A) d(x) ∈ C(inl(x)) (y ∈ B) e(y) ∈ C(inr(y)) case(c, d, e) ∈ C(c)
Computation rules:
a ∈ A (x ∈ A) d(x) ∈ C(inl(x)) (y ∈ B) e(y) ∈ C(inr(y)) case(inl(a), d, e) = d(a) ∈ C(inl(a))
b ∈ B (x ∈ A) d(x) ∈ C(inl(x)) (y ∈ B) e(y) ∈ C(inr(y)) case(inr(b), d, e) = e(b) ∈ C(inr(b))
Nicola Gambino Dependent Type Theory Deduction rules for identity types (I)
Formation rule:
A ∈ Type a ∈ A b ∈ A
IdA(a, b) ∈ Type
Introduction rule:
a ∈ A
r(a) ∈ IdA(a, a)
Nicola Gambino Dependent Type Theory Deduction rules for identity types (II)
Elimination rule:
p ∈ IdA(a, b)(x ∈ A) d(x) ∈ C(x, x, r(x)) J(a, b, p, d) ∈ C(a, b, p)
Computation rule:
a ∈ A (x ∈ A) d(x) ∈ C(x, x, r(x)) J(a, a, r(a), d) = d(a) ∈ C(a, a, r(a))
Nicola Gambino Dependent Type Theory Deduction rules for Σ-types (I)
Formation rule:
(x ∈ A) B(x) ∈ Type (Σx ∈ A)B(x) ∈ Type
Introduction rule:
a ∈ A b ∈ B(a) pair(a, b) ∈ (Σx ∈ A)B(x)
Nicola Gambino Dependent Type Theory Deduction rules for Σ-types (II)
Elimination rule:
c ∈ (Σx ∈ A)B(x)(x ∈ A, y ∈ B(x)) d(x, y) ∈ C(pair(x, y)) split(c, d) ∈ C(c)
Computation rule:
a ∈ A b ∈ B(a)(x ∈ A, y ∈ B(x)) d(x, y) ∈ C(pair(x, y)) split(pair(a, b), d) = d(a, b) ∈ C(pair(a, b))
Nicola Gambino Dependent Type Theory Deduction rules for Π-types (I)
Formation rule:
(x ∈ A) B(x) ∈ Type (Πx ∈ A)B(x) ∈ Type
Introduction rule:
(x ∈ A) b(x) ∈ B(x) (λx ∈ A)b(x) ∈ (Πx ∈ A)B(x)
Nicola Gambino Dependent Type Theory Deduction rules for Π-types (II)
Elimination rule:
b ∈ (Πx ∈ A)B(x) ∈ Type a ∈ A app(b, a) ∈ B(a)
Computation rule:
(x ∈ A) b(x) ∈ B(x) a ∈ A app((λx ∈ A)b(x), a) = b(a) ∈ B(a)
Nicola Gambino Dependent Type Theory Remarks
We used ‘Type’ for what is called ‘Set’ in the Handbook paper. We did not use explicitly any logical framework.
Nicola Gambino Dependent Type Theory