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 Preliminaries 1 The dependent type theory ML 2 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 � � (Γ) = x 0 ∈ A 0 , x 1 ∈ A 1 ( x 0 ) , . . . , x n ∈ A n ( x 0 , . . . , x n − 1 ) . Nicola Gambino Dependent Type Theory
Hypothetical judgements (II) For the context Γ to be well-formed we need to know that the judgements A 0 ∈ Type ( x 0 ∈ A 0 ) A 1 ( x 0 ) ∈ Type . . . � � x 0 ∈ A 0 , . . . , x n − 1 ∈ A n − 1 ( x 0 , . . . , x n − 2 ) A n ( x 0 , . . . , x n − 1 ) ∈ Type are derivable. Nicola Gambino Dependent Type Theory
Deduction rules Deduction rules have the form (Γ 1 ) J 1 (Γ n ) J n · · · (Γ) J We often omit contexts that are common to premisses and conclusion. Nicola Gambino Dependent Type Theory
Outline √ Preliminaries 1 The dependent type theory ML 2 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 , Id A ( 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 )) ( x ∈ A ) d ( x ) ∈ C ( inl ( x )) ( y ∈ B ) e ( y ) ∈ C ( inr ( y )) b ∈ B 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 Id A ( a , b ) ∈ Type Introduction rule: a ∈ A r ( a ) ∈ Id A ( a , a ) Nicola Gambino Dependent Type Theory
Deduction rules for identity types (II) Elimination rule: p ∈ Id A ( 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
Recommend
More recommend