Dependent Type Theory Lecture 1 Nicola Gambino MGS - Leicester - - PowerPoint PPT Presentation

dependent type theory
SMART_READER_LITE
LIVE PREVIEW

Dependent Type Theory Lecture 1 Nicola Gambino MGS - Leicester - - PowerPoint PPT Presentation

Dependent Type Theory Lecture 1 Nicola Gambino MGS - Leicester 2009 Nicola Gambino Dependent Type Theory References B. Nordstm, K. Petersson, and J. M. Smith Martin-Lfs Type Theory Handbook of Logic in Computer Science, Vol. 5


slide-1
SLIDE 1

Dependent Type Theory

Lecture 1 Nicola Gambino MGS - Leicester 2009

Nicola Gambino Dependent Type Theory

slide-2
SLIDE 2

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

slide-3
SLIDE 3

Outline

1

Preliminaries

2

The dependent type theory ML

Nicola Gambino Dependent Type Theory

slide-4
SLIDE 4

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

slide-5
SLIDE 5

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

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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

slide-8
SLIDE 8

Outline

1

Preliminaries √

2

The dependent type theory ML

Nicola Gambino Dependent Type Theory

slide-9
SLIDE 9

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

slide-10
SLIDE 10

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

slide-11
SLIDE 11

Deduction rules for the type of natural numbers (I)

Formation rule: Nat ∈ Type Introduction rules: 0 ∈ Nat n ∈ Nat succ(n) ∈ Nat

Nicola Gambino Dependent Type Theory

slide-12
SLIDE 12

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

slide-13
SLIDE 13

Deduction rules for the unit type (I)

Formation rules: 1 ∈ Type Introduction rule: ∗ ∈ 1

Nicola Gambino Dependent Type Theory

slide-14
SLIDE 14

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

slide-15
SLIDE 15

Deduction rules for the empty type (I)

Formation rule: 0 ∈ Type Introduction rules:

Nicola Gambino Dependent Type Theory

slide-16
SLIDE 16

Deduction rules for the empty type (II)

Elimination rule: c ∈ 0 rec(c) ∈ C(c) Computation rules:

Nicola Gambino Dependent Type Theory

slide-17
SLIDE 17

Deduction rules for sum types (I)

Formation rules: A ∈ Type B ∈ Type A + B ∈ Type Introduction rules: a ∈ A inl(a) ∈ A + B b ∈ B inr(b) ∈ A + B

Nicola Gambino Dependent Type Theory

slide-18
SLIDE 18

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

slide-19
SLIDE 19

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

slide-20
SLIDE 20

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

slide-21
SLIDE 21

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

slide-22
SLIDE 22

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

slide-23
SLIDE 23

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

slide-24
SLIDE 24

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

slide-25
SLIDE 25

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