system f - chalmers · system f alexandre miquel pps & u. paris 7...
TRANSCRIPT
![Page 1: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/1.jpg)
System F
Alexandre Miquel � PPS & U. Paris 7
Types Summer School 2005
August 15�26 � Göteborg
![Page 2: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/2.jpg)
Introduction
System F : independently discovered by
Girard: System F (1970)Reynolds: The polymorphic λ-calculus (1974)
Quite di�erent motivations. . .
Girard: Interpretation of second-order logicReynolds: Functional programming
. . . connected by the Curry-Howard isomorphism
Signi�cant in�uence on the development of Type Theory
� Interpretation of higher-order logic [Girard, Martin-Löf]� Type:Type [Martin-Löf 1971]� Martin-Löf Type Theory [1972, 1984, 1990, ...]� The Calculus of Constructions [Coquand 1984]
![Page 3: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/3.jpg)
Introduction
System F : independently discovered by
Girard: System F (1970)Reynolds: The polymorphic λ-calculus (1974)
Quite di�erent motivations. . .
Girard: Interpretation of second-order logicReynolds: Functional programming
. . . connected by the Curry-Howard isomorphism
Signi�cant in�uence on the development of Type Theory
� Interpretation of higher-order logic [Girard, Martin-Löf]� Type:Type [Martin-Löf 1971]� Martin-Löf Type Theory [1972, 1984, 1990, ...]� The Calculus of Constructions [Coquand 1984]
![Page 4: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/4.jpg)
Introduction
System F : independently discovered by
Girard: System F (1970)
Reynolds: The polymorphic λ-calculus (1974)
Quite di�erent motivations. . .
Girard: Interpretation of second-order logicReynolds: Functional programming
. . . connected by the Curry-Howard isomorphism
Signi�cant in�uence on the development of Type Theory
� Interpretation of higher-order logic [Girard, Martin-Löf]� Type:Type [Martin-Löf 1971]� Martin-Löf Type Theory [1972, 1984, 1990, ...]� The Calculus of Constructions [Coquand 1984]
![Page 5: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/5.jpg)
Introduction
System F : independently discovered by
Girard: System F (1970)Reynolds: The polymorphic λ-calculus (1974)
Quite di�erent motivations. . .
Girard: Interpretation of second-order logicReynolds: Functional programming
. . . connected by the Curry-Howard isomorphism
Signi�cant in�uence on the development of Type Theory
� Interpretation of higher-order logic [Girard, Martin-Löf]� Type:Type [Martin-Löf 1971]� Martin-Löf Type Theory [1972, 1984, 1990, ...]� The Calculus of Constructions [Coquand 1984]
![Page 6: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/6.jpg)
Introduction
System F : independently discovered by
Girard: System F (1970)Reynolds: The polymorphic λ-calculus (1974)
Quite di�erent motivations. . .
Girard: Interpretation of second-order logicReynolds: Functional programming
. . . connected by the Curry-Howard isomorphism
Signi�cant in�uence on the development of Type Theory
� Interpretation of higher-order logic [Girard, Martin-Löf]� Type:Type [Martin-Löf 1971]� Martin-Löf Type Theory [1972, 1984, 1990, ...]� The Calculus of Constructions [Coquand 1984]
![Page 7: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/7.jpg)
Introduction
System F : independently discovered by
Girard: System F (1970)Reynolds: The polymorphic λ-calculus (1974)
Quite di�erent motivations. . .
Girard: Interpretation of second-order logicReynolds: Functional programming
. . . connected by the Curry-Howard isomorphism
Signi�cant in�uence on the development of Type Theory
� Interpretation of higher-order logic [Girard, Martin-Löf]� Type:Type [Martin-Löf 1971]� Martin-Löf Type Theory [1972, 1984, 1990, ...]� The Calculus of Constructions [Coquand 1984]
![Page 8: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/8.jpg)
Part I
System F: Church-style presentation
![Page 9: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/9.jpg)
System F syntax
De�nition
Types
Terms
A,B ::= α | A→ B | ∀α B
t, u ::= x| λx :A . t | tu (term abstr./app.)| Λα . t | tA (type abstr./app.)
NotationsSet of free (term) variables: FV (t)Set of free type variables: TV (t), TV (A)
Term substitution: u{x := t}Type substitution: u{α := A}, B{α := A}
Perform α-conversion to prevent captures of free (term/type) variables!
![Page 10: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/10.jpg)
System F syntax
De�nition
Types
Terms
A,B ::= α | A→ B | ∀α B
t, u ::= x| λx :A . t | tu (term abstr./app.)| Λα . t | tA (type abstr./app.)
NotationsSet of free (term) variables: FV (t)Set of free type variables: TV (t), TV (A)
Term substitution: u{x := t}Type substitution: u{α := A}, B{α := A}
Perform α-conversion to prevent captures of free (term/type) variables!
![Page 11: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/11.jpg)
System F typing rules
Contexts
Typing judgments
Γ ::= x1 : A1, . . . , xn : An
Γ ` t : A
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx :A . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ ` t : BΓ ` Λα . t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` tA : B{α := A}
Declaration of type variables is implicit (for each α ∈ TV (Γ))Type variables could be declared explicitly: α : ∗ (cf PTS)One rule for each syntactic construct ⇒ System is syntax-directed
![Page 12: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/12.jpg)
System F typing rules
Contexts
Typing judgments
Γ ::= x1 : A1, . . . , xn : An
Γ ` t : A
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx :A . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ ` t : BΓ ` Λα . t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` tA : B{α := A}
Declaration of type variables is implicit (for each α ∈ TV (Γ))Type variables could be declared explicitly: α : ∗ (cf PTS)One rule for each syntactic construct ⇒ System is syntax-directed
![Page 13: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/13.jpg)
System F typing rules
Contexts
Typing judgments
Γ ::= x1 : A1, . . . , xn : An
Γ ` t : A
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx :A . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ ` t : BΓ ` Λα . t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` tA : B{α := A}
Declaration of type variables is implicit (for each α ∈ TV (Γ))Type variables could be declared explicitly: α : ∗ (cf PTS)One rule for each syntactic construct ⇒ System is syntax-directed
![Page 14: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/14.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 15: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/15.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 16: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/16.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 17: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/17.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 18: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/18.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 19: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/19.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 20: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/20.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 21: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/21.jpg)
Example: the polymorphic identity
Set: id ≡ Λα . λx :α . x
One has:
id : ∀α (α → α)
idB : B → B for any type B
idB u : B for any term u : B
In particular, if we take B ≡ ∀α (α → α) and u ≡ id
id(∀α (α → α)
): ∀α (α → α) → ∀α (α → α)
id(∀α (α → α)
)id : ∀α (α → α)
⇒ Type system is impredicative (or cyclic)
![Page 22: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/22.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 23: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/23.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 24: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/24.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}
Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 25: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/25.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 26: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/26.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 27: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/27.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 28: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/28.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 29: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/29.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 30: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/30.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 31: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/31.jpg)
Properties
Substitutivity (for types/terms):
Γ ` u : B ⇒ Γ{α := A} ` u{α := A} : B{α := A}Γ, x : A ` u : B, Γ ` t : A ⇒ Γ ` u{x := t} : B
Uniqueness of type
Γ ` t : A, Γ ` t : A′ ⇒ A = A′ (α-conv.)
Decidability of type checking / type inference
1 Given Γ, t and A, decide whether Γ ` t : A is derivable
2 Given Γ and t, compute a type A such that Γ ` t : Aif such a type exists, or fail otherwise.
Both problems are decidable
![Page 32: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/32.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 33: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/33.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 34: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/34.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 35: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/35.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 36: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/36.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 37: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/37.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 38: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/38.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 39: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/39.jpg)
Reduction rules
Two kinds of redexes:
(λx :A . t)u � t{x := u} 1st kind redex
(Λα . t)A � t{α := A} 2nd kind redex
Other combinations of abstraction and application are meaningless (and rejected by typing)
De�nitions
One step β-reduction t � t ′ ≡contextual closure of both rules above
β-reduction t �∗ t ′ ≡re�exive-transitive closure of �
β-convertibility t ' t ′ ≡re�exive-symmetric-transitive closure of �
![Page 40: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/40.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 41: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/41.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 42: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/42.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u
� (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 43: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/43.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u
� u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 44: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/44.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 45: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/45.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 46: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/46.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 47: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/47.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´
�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }4 294 967 296 times
x) · · · )
![Page 48: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/48.jpg)
Examples
The polymorphic identity, again
id B u ≡ (Λα . λx : α . x) B u � (λx :B . x) u � u
id (∀α (α→α)) id (∀α (α→α)) · · · id (∀α (α→α)) idB u �∗ u
A little bit more complex example. . .
`Λα . λx : α . λf : α→α .
32 timesz }| {f (· · · (f x) · · · )
´`∀α (α→(α→α)→α)
´ `Λα . λx : α . λf : α→α . f x
´`λn :∀α (α→(α→α)→α) . Λα . λx : α . λf : α→α . nα (nα x f ) f
´�∗ Λα . λx : α . λf : α→α . (f · · · (f| {z }
4 294 967 296 timesx) · · · )
![Page 49: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/49.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : AProof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisableProof. Girard and Tait's method of reducibility candidates (postponed)
![Page 50: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/50.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : AProof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisableProof. Girard and Tait's method of reducibility candidates (postponed)
![Page 51: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/51.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : AProof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisableProof. Girard and Tait's method of reducibility candidates (postponed)
![Page 52: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/52.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : AProof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisableProof. Girard and Tait's method of reducibility candidates (postponed)
![Page 53: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/53.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : A
Proof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisableProof. Girard and Tait's method of reducibility candidates (postponed)
![Page 54: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/54.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : AProof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisableProof. Girard and Tait's method of reducibility candidates (postponed)
![Page 55: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/55.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : AProof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisable
Proof. Girard and Tait's method of reducibility candidates (postponed)
![Page 56: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/56.jpg)
Properties
Con�uence
t �∗ t1 ∧ t �∗ t2 ⇒ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)Proof. Roughly the same as for the untyped λ-calculus (adaptation is easy)
Church-Rosser
t1 ' t2 ⇔ ∃t ′ (t1 �∗ t ′ ∧ t2 �∗ t ′)
Subject-reduction
If Γ ` t : A and t �∗ t ′ then Γ ` t : AProof. By induction on the derivation of Γ ` t : A, with t � t′ (one step reduction)
Strong normalisation
All well-typed terms of system F are strongly normalisableProof. Girard and Tait's method of reducibility candidates (postponed)
![Page 57: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/57.jpg)
Part II
Encoding data types
![Page 58: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/58.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 59: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/59.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 60: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/60.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Bool
false ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 61: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/61.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 62: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/62.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 63: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/63.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 64: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/64.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 65: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/65.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 66: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/66.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1
ifA false then t1 else t2 �∗ t2
![Page 67: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/67.jpg)
Booleans (1/3)
Encoding of booleans
Bool ≡ ∀γ (γ → γ → γ)
true ≡ Λγ . λx , y : γ . x : Boolfalse ≡ Λγ . λx , y : γ . y : Bool
ifA u then t1 else t2 ≡ u A t1 t2
Correctness w.r.t. typing
Γ ` u : Bool Γ ` t1 : A Γ ` t2 : AΓ ` ifA u then t1 else t2 : A
Correctness w.r.t. reduction
ifA true then t1 else t2 �∗ t1ifA false then t1 else t2 �∗ t2
![Page 68: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/68.jpg)
Booleans (2/3)
Objection:
We can do the same in the untyped λ-calculus!
true ≡ λx , y . xfalse ≡ λx , y . y
if u then t1 else t2 ≡ u t1 t2
Same reductionrules as before
But nothing prevents the following computation:
if λx . x| {z }bad bool
then t1 else t2 ≡ (λx . x) t1 t2 � t1t2|{z}meaningless result
Question: Does the type discipline of system F avoid this?
![Page 69: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/69.jpg)
Booleans (2/3)
Objection: We can do the same in the untyped λ-calculus!
true ≡ λx , y . xfalse ≡ λx , y . y
if u then t1 else t2 ≡ u t1 t2
Same reductionrules as before
But nothing prevents the following computation:
if λx . x| {z }bad bool
then t1 else t2 ≡ (λx . x) t1 t2 � t1t2|{z}meaningless result
Question: Does the type discipline of system F avoid this?
![Page 70: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/70.jpg)
Booleans (2/3)
Objection: We can do the same in the untyped λ-calculus!
true ≡ λx , y . xfalse ≡ λx , y . y
if u then t1 else t2 ≡ u t1 t2
Same reductionrules as before
But nothing prevents the following computation:
if λx . x| {z }bad bool
then t1 else t2 ≡ (λx . x) t1 t2 � t1t2|{z}meaningless result
Question: Does the type discipline of system F avoid this?
![Page 71: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/71.jpg)
Booleans (2/3)
Objection: We can do the same in the untyped λ-calculus!
true ≡ λx , y . xfalse ≡ λx , y . y
if u then t1 else t2 ≡ u t1 t2
Same reductionrules as before
But nothing prevents the following computation:
if λx . x| {z }bad bool
then t1 else t2 ≡ (λx . x) t1 t2 � t1t2|{z}meaningless result
Question: Does the type discipline of system F avoid this?
![Page 72: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/72.jpg)
Booleans (2/3)
Objection: We can do the same in the untyped λ-calculus!
true ≡ λx , y . xfalse ≡ λx , y . y
if u then t1 else t2 ≡ u t1 t2
Same reductionrules as before
But nothing prevents the following computation:
if λx . x| {z }bad bool
then t1 else t2 ≡ (λx . x) t1 t2 � t1t2|{z}meaningless result
Question: Does the type discipline of system F avoid this?
![Page 73: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/73.jpg)
Booleans (2/3)
Objection: We can do the same in the untyped λ-calculus!
true ≡ λx , y . xfalse ≡ λx , y . y
if u then t1 else t2 ≡ u t1 t2
Same reductionrules as before
But nothing prevents the following computation:
if λx . x| {z }bad bool
then t1 else t2 ≡ (λx . x) t1 t2 � t1t2|{z}meaningless result
Question: Does the type discipline of system F avoid this?
![Page 74: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/74.jpg)
Booleans (3/3)
Principle (that should be satis�ed by any functional programming language)
When a program P of type A evaluates to a value v , then v hasone of the canonical forms expected by the type A.
In ML/Haskell, a value produced by a program of type Bool will always betrue or false (i.e. the canonical forms of type bool).
In system F : Subject-reduction ensures that the normal form of a term oftype Bool is a term of type Bool.
To conclude, it su�ces to check that in system F:
Lemma (Canonical forms of type bool)
The terms true ≡ Λγ . λx , y : γ . x and false ≡ Λγ . λx , y : γ . yare the only closed normal terms of type Bool ≡ ∀γ (γ→γ→γ)
Proof. Case analysis on the derivation.
![Page 75: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/75.jpg)
Booleans (3/3)
Principle (that should be satis�ed by any functional programming language)
When a program P of type A evaluates to a value v , then v hasone of the canonical forms expected by the type A.
In ML/Haskell, a value produced by a program of type Bool will always betrue or false (i.e. the canonical forms of type bool).
In system F : Subject-reduction ensures that the normal form of a term oftype Bool is a term of type Bool.
To conclude, it su�ces to check that in system F:
Lemma (Canonical forms of type bool)
The terms true ≡ Λγ . λx , y : γ . x and false ≡ Λγ . λx , y : γ . yare the only closed normal terms of type Bool ≡ ∀γ (γ→γ→γ)
Proof. Case analysis on the derivation.
![Page 76: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/76.jpg)
Booleans (3/3)
Principle (that should be satis�ed by any functional programming language)
When a program P of type A evaluates to a value v , then v hasone of the canonical forms expected by the type A.
In ML/Haskell, a value produced by a program of type Bool will always betrue or false (i.e. the canonical forms of type bool).
In system F : Subject-reduction ensures that the normal form of a term oftype Bool is a term of type Bool.
To conclude, it su�ces to check that in system F:
Lemma (Canonical forms of type bool)
The terms true ≡ Λγ . λx , y : γ . x and false ≡ Λγ . λx , y : γ . yare the only closed normal terms of type Bool ≡ ∀γ (γ→γ→γ)
Proof. Case analysis on the derivation.
![Page 77: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/77.jpg)
Booleans (3/3)
Principle (that should be satis�ed by any functional programming language)
When a program P of type A evaluates to a value v , then v hasone of the canonical forms expected by the type A.
In ML/Haskell, a value produced by a program of type Bool will always betrue or false (i.e. the canonical forms of type bool).
In system F : Subject-reduction ensures that the normal form of a term oftype Bool is a term of type Bool.
To conclude, it su�ces to check that in system F:
Lemma (Canonical forms of type bool)
The terms true ≡ Λγ . λx , y : γ . x and false ≡ Λγ . λx , y : γ . yare the only closed normal terms of type Bool ≡ ∀γ (γ→γ→γ)
Proof. Case analysis on the derivation.
![Page 78: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/78.jpg)
Booleans (3/3)
Principle (that should be satis�ed by any functional programming language)
When a program P of type A evaluates to a value v , then v hasone of the canonical forms expected by the type A.
In ML/Haskell, a value produced by a program of type Bool will always betrue or false (i.e. the canonical forms of type bool).
In system F : Subject-reduction ensures that the normal form of a term oftype Bool is a term of type Bool.
To conclude, it su�ces to check that in system F:
Lemma (Canonical forms of type bool)
The terms true ≡ Λγ . λx , y : γ . x and false ≡ Λγ . λx , y : γ . yare the only closed normal terms of type Bool ≡ ∀γ (γ→γ→γ)
Proof. Case analysis on the derivation.
![Page 79: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/79.jpg)
Booleans (3/3)
Principle (that should be satis�ed by any functional programming language)
When a program P of type A evaluates to a value v , then v hasone of the canonical forms expected by the type A.
In ML/Haskell, a value produced by a program of type Bool will always betrue or false (i.e. the canonical forms of type bool).
In system F : Subject-reduction ensures that the normal form of a term oftype Bool is a term of type Bool.
To conclude, it su�ces to check that in system F:
Lemma (Canonical forms of type bool)
The terms true ≡ Λγ . λx , y : γ . x and false ≡ Λγ . λx , y : γ . yare the only closed normal terms of type Bool ≡ ∀γ (γ→γ→γ)
Proof. Case analysis on the derivation.
![Page 80: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/80.jpg)
Booleans (3/3)
Principle (that should be satis�ed by any functional programming language)
When a program P of type A evaluates to a value v , then v hasone of the canonical forms expected by the type A.
In ML/Haskell, a value produced by a program of type Bool will always betrue or false (i.e. the canonical forms of type bool).
In system F : Subject-reduction ensures that the normal form of a term oftype Bool is a term of type Bool.
To conclude, it su�ces to check that in system F:
Lemma (Canonical forms of type bool)
The terms true ≡ Λγ . λx , y : γ . x and false ≡ Λγ . λx , y : γ . yare the only closed normal terms of type Bool ≡ ∀γ (γ→γ→γ)
Proof. Case analysis on the derivation.
![Page 81: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/81.jpg)
Cartesian product
Encoding of the cartesian product A× B
A× B ≡ ∀γ ((A→B→γ) → γ)
〈t1, t2〉 ≡ Λγ . λf :A→ B → γ . f t1 t2
fst ≡ λp :A× B . p A (λx :A . λy :B . x) : A× B → Asnd ≡ λp :A× B . p B (λx :A . λy :B . y) : A× B → B
Correctness w.r.t. typing and reduction
Γ ` t1 : A Γ ` t2 : BΓ ` 〈t1, t2〉 : A× B
fst 〈t1, t2〉 �∗ t1snd 〈t1, t2〉 �∗ t2
Lemma (Canonical forms of type A× B)
The closed normal terms of type A×B are of the form 〈t1, t2〉, where t1 and t2are closed normal terms of type A and B, respectively.
![Page 82: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/82.jpg)
Cartesian product
Encoding of the cartesian product A× B
A× B ≡ ∀γ ((A→B→γ) → γ)
〈t1, t2〉 ≡ Λγ . λf :A→ B → γ . f t1 t2
fst ≡ λp :A× B . p A (λx :A . λy :B . x) : A× B → Asnd ≡ λp :A× B . p B (λx :A . λy :B . y) : A× B → B
Correctness w.r.t. typing and reduction
Γ ` t1 : A Γ ` t2 : BΓ ` 〈t1, t2〉 : A× B
fst 〈t1, t2〉 �∗ t1snd 〈t1, t2〉 �∗ t2
Lemma (Canonical forms of type A× B)
The closed normal terms of type A×B are of the form 〈t1, t2〉, where t1 and t2are closed normal terms of type A and B, respectively.
![Page 83: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/83.jpg)
Cartesian product
Encoding of the cartesian product A× B
A× B ≡ ∀γ ((A→B→γ) → γ)
〈t1, t2〉 ≡ Λγ . λf :A→ B → γ . f t1 t2
fst ≡ λp :A× B . p A (λx :A . λy :B . x) : A× B → Asnd ≡ λp :A× B . p B (λx :A . λy :B . y) : A× B → B
Correctness w.r.t. typing and reduction
Γ ` t1 : A Γ ` t2 : BΓ ` 〈t1, t2〉 : A× B
fst 〈t1, t2〉 �∗ t1snd 〈t1, t2〉 �∗ t2
Lemma (Canonical forms of type A× B)
The closed normal terms of type A×B are of the form 〈t1, t2〉, where t1 and t2are closed normal terms of type A and B, respectively.
![Page 84: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/84.jpg)
Cartesian product
Encoding of the cartesian product A× B
A× B ≡ ∀γ ((A→B→γ) → γ)
〈t1, t2〉 ≡ Λγ . λf :A→ B → γ . f t1 t2
fst ≡ λp :A× B . p A (λx :A . λy :B . x) : A× B → Asnd ≡ λp :A× B . p B (λx :A . λy :B . y) : A× B → B
Correctness w.r.t. typing and reduction
Γ ` t1 : A Γ ` t2 : BΓ ` 〈t1, t2〉 : A× B
fst 〈t1, t2〉 �∗ t1snd 〈t1, t2〉 �∗ t2
Lemma (Canonical forms of type A× B)
The closed normal terms of type A×B are of the form 〈t1, t2〉, where t1 and t2are closed normal terms of type A and B, respectively.
![Page 85: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/85.jpg)
Disjoint union
Encoding of the disjoint union A + B
A + B ≡ ∀γ ((A→γ) → (B→γ) → γ)
inl(v) ≡ Λγ . λf :A→ γ . λg :B → γ . f v : A + B (with v : A)inr(v) ≡ Λγ . λf :A→ γ . λg :B → γ . g v : A + B (with v : B)
caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 ≡ u C (λx :A . t1) (λy :B . t2)
Correctness w.r.t. typing and reduction
Γ ` u : A + B Γ, x : A ` t1 : C Γ, y : B ` t2 : CΓ ` caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 : C
caseC inl(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t1{x := v}caseC inr(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t2{y := v}
+ Canonical forms of type A + B (works as expected)
![Page 86: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/86.jpg)
Disjoint union
Encoding of the disjoint union A + B
A + B ≡ ∀γ ((A→γ) → (B→γ) → γ)
inl(v) ≡ Λγ . λf :A→ γ . λg :B → γ . f v : A + B (with v : A)inr(v) ≡ Λγ . λf :A→ γ . λg :B → γ . g v : A + B (with v : B)
caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 ≡ u C (λx :A . t1) (λy :B . t2)
Correctness w.r.t. typing and reduction
Γ ` u : A + B Γ, x : A ` t1 : C Γ, y : B ` t2 : CΓ ` caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 : C
caseC inl(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t1{x := v}caseC inr(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t2{y := v}
+ Canonical forms of type A + B (works as expected)
![Page 87: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/87.jpg)
Disjoint union
Encoding of the disjoint union A + B
A + B ≡ ∀γ ((A→γ) → (B→γ) → γ)
inl(v) ≡ Λγ . λf :A→ γ . λg :B → γ . f v : A + B (with v : A)inr(v) ≡ Λγ . λf :A→ γ . λg :B → γ . g v : A + B (with v : B)
caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 ≡ u C (λx :A . t1) (λy :B . t2)
Correctness w.r.t. typing and reduction
Γ ` u : A + B Γ, x : A ` t1 : C Γ, y : B ` t2 : CΓ ` caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 : C
caseC inl(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t1{x := v}caseC inr(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t2{y := v}
+ Canonical forms of type A + B (works as expected)
![Page 88: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/88.jpg)
Disjoint union
Encoding of the disjoint union A + B
A + B ≡ ∀γ ((A→γ) → (B→γ) → γ)
inl(v) ≡ Λγ . λf :A→ γ . λg :B → γ . f v : A + B (with v : A)inr(v) ≡ Λγ . λf :A→ γ . λg :B → γ . g v : A + B (with v : B)
caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 ≡ u C (λx :A . t1) (λy :B . t2)
Correctness w.r.t. typing and reduction
Γ ` u : A + B Γ, x : A ` t1 : C Γ, y : B ` t2 : CΓ ` caseC u of inl(x) 7→ t1 | inr(y) 7→ t2 : C
caseC inl(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t1{x := v}caseC inr(v) of inl(x) 7→ t1 | inr(y) 7→ t2 �∗ t2{y := v}
+ Canonical forms of type A + B (works as expected)
![Page 89: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/89.jpg)
Finite types
Encoding of Finn (n ≥ 0)
Finn ≡ ∀γ (γ → · · · → γ︸ ︷︷ ︸n times
→ γ)
ei ≡ Λγ . λx1 : γ . . . λxn : γ . xi : Finn (1 ≤ i ≤ n)
Again, e1, . . . , en are the only closed normal terms of type Finn.
In particular:
Fin2 ≡ ∀γ (γ → γ → γ) ≡ Bool (type of booleans)
Fin1 ≡ ∀γ (γ → γ) ≡ Unit (unit data-type)
Fin0 ≡ ∀γ γ ≡ ⊥ (empty data-type)
(Notice that there is no closed normal term of type ⊥.)
![Page 90: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/90.jpg)
Finite types
Encoding of Finn (n ≥ 0)
Finn ≡ ∀γ (γ → · · · → γ︸ ︷︷ ︸n times
→ γ)
ei ≡ Λγ . λx1 : γ . . . λxn : γ . xi : Finn (1 ≤ i ≤ n)
Again, e1, . . . , en are the only closed normal terms of type Finn.
In particular:
Fin2 ≡ ∀γ (γ → γ → γ) ≡ Bool (type of booleans)
Fin1 ≡ ∀γ (γ → γ) ≡ Unit (unit data-type)
Fin0 ≡ ∀γ γ ≡ ⊥ (empty data-type)
(Notice that there is no closed normal term of type ⊥.)
![Page 91: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/91.jpg)
Finite types
Encoding of Finn (n ≥ 0)
Finn ≡ ∀γ (γ → · · · → γ︸ ︷︷ ︸n times
→ γ)
ei ≡ Λγ . λx1 : γ . . . λxn : γ . xi : Finn (1 ≤ i ≤ n)
Again, e1, . . . , en are the only closed normal terms of type Finn.
In particular:
Fin2 ≡ ∀γ (γ → γ → γ) ≡ Bool (type of booleans)
Fin1 ≡ ∀γ (γ → γ) ≡ Unit (unit data-type)
Fin0 ≡ ∀γ γ ≡ ⊥ (empty data-type)
(Notice that there is no closed normal term of type ⊥.)
![Page 92: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/92.jpg)
Finite types
Encoding of Finn (n ≥ 0)
Finn ≡ ∀γ (γ → · · · → γ︸ ︷︷ ︸n times
→ γ)
ei ≡ Λγ . λx1 : γ . . . λxn : γ . xi : Finn (1 ≤ i ≤ n)
Again, e1, . . . , en are the only closed normal terms of type Finn.
In particular:
Fin2 ≡ ∀γ (γ → γ → γ) ≡ Bool (type of booleans)
Fin1 ≡ ∀γ (γ → γ) ≡ Unit (unit data-type)
Fin0 ≡ ∀γ γ ≡ ⊥ (empty data-type)
(Notice that there is no closed normal term of type ⊥.)
![Page 93: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/93.jpg)
Finite types
Encoding of Finn (n ≥ 0)
Finn ≡ ∀γ (γ → · · · → γ︸ ︷︷ ︸n times
→ γ)
ei ≡ Λγ . λx1 : γ . . . λxn : γ . xi : Finn (1 ≤ i ≤ n)
Again, e1, . . . , en are the only closed normal terms of type Finn.
In particular:
Fin2 ≡ ∀γ (γ → γ → γ) ≡ Bool (type of booleans)
Fin1 ≡ ∀γ (γ → γ) ≡ Unit (unit data-type)
Fin0 ≡ ∀γ γ ≡ ⊥ (empty data-type)
(Notice that there is no closed normal term of type ⊥.)
![Page 94: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/94.jpg)
Finite types
Encoding of Finn (n ≥ 0)
Finn ≡ ∀γ (γ → · · · → γ︸ ︷︷ ︸n times
→ γ)
ei ≡ Λγ . λx1 : γ . . . λxn : γ . xi : Finn (1 ≤ i ≤ n)
Again, e1, . . . , en are the only closed normal terms of type Finn.
In particular:
Fin2 ≡ ∀γ (γ → γ → γ) ≡ Bool (type of booleans)
Fin1 ≡ ∀γ (γ → γ) ≡ Unit (unit data-type)
Fin0 ≡ ∀γ γ ≡ ⊥ (empty data-type)
(Notice that there is no closed normal term of type ⊥.)
![Page 95: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/95.jpg)
Finite types
Encoding of Finn (n ≥ 0)
Finn ≡ ∀γ (γ → · · · → γ︸ ︷︷ ︸n times
→ γ)
ei ≡ Λγ . λx1 : γ . . . λxn : γ . xi : Finn (1 ≤ i ≤ n)
Again, e1, . . . , en are the only closed normal terms of type Finn.
In particular:
Fin2 ≡ ∀γ (γ → γ → γ) ≡ Bool (type of booleans)
Fin1 ≡ ∀γ (γ → γ) ≡ Unit (unit data-type)
Fin0 ≡ ∀γ γ ≡ ⊥ (empty data-type)
(Notice that there is no closed normal term of type ⊥.)
![Page 96: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/96.jpg)
Natural numbers
Encoding of the type of Church numerals
Nat ≡ ∀γ (γ → (γ → γ) → γ)
0 ≡ Λγ . λx : γ . λf : γ→γ . x1 ≡ Λγ . λx : γ . λf : γ→γ . f x2 ≡ Λγ . λx : γ . λf : γ→γ . f (f x)
...n ≡ Λγ . λx : γ . λf : γ→γ . f (· · · (f︸ ︷︷ ︸
n times
x) · · · ) : Nat...
Lemma (Canonical forms of type Nat)
The terms 0, 1, 2, . . . are the only closed normal terms of type Nat.
![Page 97: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/97.jpg)
Natural numbers
Encoding of the type of Church numerals
Nat ≡ ∀γ (γ → (γ → γ) → γ)
0 ≡ Λγ . λx : γ . λf : γ→γ . x1 ≡ Λγ . λx : γ . λf : γ→γ . f x2 ≡ Λγ . λx : γ . λf : γ→γ . f (f x)
...n ≡ Λγ . λx : γ . λf : γ→γ . f (· · · (f︸ ︷︷ ︸
n times
x) · · · ) : Nat...
Lemma (Canonical forms of type Nat)
The terms 0, 1, 2, . . . are the only closed normal terms of type Nat.
![Page 98: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/98.jpg)
Natural numbers
Encoding of the type of Church numerals
Nat ≡ ∀γ (γ → (γ → γ) → γ)
0 ≡ Λγ . λx : γ . λf : γ→γ . x1 ≡ Λγ . λx : γ . λf : γ→γ . f x2 ≡ Λγ . λx : γ . λf : γ→γ . f (f x)
...n ≡ Λγ . λx : γ . λf : γ→γ . f (· · · (f︸ ︷︷ ︸
n times
x) · · · ) : Nat...
Lemma (Canonical forms of type Nat)
The terms 0, 1, 2, . . . are the only closed normal terms of type Nat.
![Page 99: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/99.jpg)
Natural numbers
Encoding of the type of Church numerals
Nat ≡ ∀γ (γ → (γ → γ) → γ)
0 ≡ Λγ . λx : γ . λf : γ→γ . x1 ≡ Λγ . λx : γ . λf : γ→γ . f x2 ≡ Λγ . λx : γ . λf : γ→γ . f (f x)
...n ≡ Λγ . λx : γ . λf : γ→γ . f (· · · (f︸ ︷︷ ︸
n times
x) · · · ) : Nat...
Lemma (Canonical forms of type Nat)
The terms 0, 1, 2, . . . are the only closed normal terms of type Nat.
![Page 100: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/100.jpg)
Computing with natural numbers (1/2)
Intuition: Church numeral n acts as an iterator:
n A f x �∗ f (· · · (f︸ ︷︷ ︸n
x) · · · ) (f : A→ A, x : A)
Successor
succ ≡ λn :Nat . Λγ . λx : γ . λf : γ→γ . f (n γ x f )
Addition
plus ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ .m γ (n γ x f ) fplus′ ≡ λn,m :Nat .m Nat n succ
Multiplication
mult ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ . n γ x (λy : γ .m γ y f )mult′ ≡ λn,m :Nat . n Nat 0 (plus m)
![Page 101: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/101.jpg)
Computing with natural numbers (1/2)
Intuition: Church numeral n acts as an iterator:
n A f x �∗ f (· · · (f︸ ︷︷ ︸n
x) · · · ) (f : A→ A, x : A)
Successor
succ ≡ λn :Nat . Λγ . λx : γ . λf : γ→γ . f (n γ x f )
Addition
plus ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ .m γ (n γ x f ) fplus′ ≡ λn,m :Nat .m Nat n succ
Multiplication
mult ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ . n γ x (λy : γ .m γ y f )mult′ ≡ λn,m :Nat . n Nat 0 (plus m)
![Page 102: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/102.jpg)
Computing with natural numbers (1/2)
Intuition: Church numeral n acts as an iterator:
n A f x �∗ f (· · · (f︸ ︷︷ ︸n
x) · · · ) (f : A→ A, x : A)
Successor
succ ≡ λn :Nat . Λγ . λx : γ . λf : γ→γ . f (n γ x f )
Addition
plus ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ .m γ (n γ x f ) fplus′ ≡ λn,m :Nat .m Nat n succ
Multiplication
mult ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ . n γ x (λy : γ .m γ y f )mult′ ≡ λn,m :Nat . n Nat 0 (plus m)
![Page 103: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/103.jpg)
Computing with natural numbers (1/2)
Intuition: Church numeral n acts as an iterator:
n A f x �∗ f (· · · (f︸ ︷︷ ︸n
x) · · · ) (f : A→ A, x : A)
Successor
succ ≡ λn :Nat . Λγ . λx : γ . λf : γ→γ . f (n γ x f )
Addition
plus ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ .m γ (n γ x f ) f
plus′ ≡ λn,m :Nat .m Nat n succ
Multiplication
mult ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ . n γ x (λy : γ .m γ y f )mult′ ≡ λn,m :Nat . n Nat 0 (plus m)
![Page 104: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/104.jpg)
Computing with natural numbers (1/2)
Intuition: Church numeral n acts as an iterator:
n A f x �∗ f (· · · (f︸ ︷︷ ︸n
x) · · · ) (f : A→ A, x : A)
Successor
succ ≡ λn :Nat . Λγ . λx : γ . λf : γ→γ . f (n γ x f )
Addition
plus ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ .m γ (n γ x f ) fplus′ ≡ λn,m :Nat .m Nat n succ
Multiplication
mult ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ . n γ x (λy : γ .m γ y f )mult′ ≡ λn,m :Nat . n Nat 0 (plus m)
![Page 105: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/105.jpg)
Computing with natural numbers (1/2)
Intuition: Church numeral n acts as an iterator:
n A f x �∗ f (· · · (f︸ ︷︷ ︸n
x) · · · ) (f : A→ A, x : A)
Successor
succ ≡ λn :Nat . Λγ . λx : γ . λf : γ→γ . f (n γ x f )
Addition
plus ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ .m γ (n γ x f ) fplus′ ≡ λn,m :Nat .m Nat n succ
Multiplication
mult ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ . n γ x (λy : γ .m γ y f )
mult′ ≡ λn,m :Nat . n Nat 0 (plus m)
![Page 106: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/106.jpg)
Computing with natural numbers (1/2)
Intuition: Church numeral n acts as an iterator:
n A f x �∗ f (· · · (f︸ ︷︷ ︸n
x) · · · ) (f : A→ A, x : A)
Successor
succ ≡ λn :Nat . Λγ . λx : γ . λf : γ→γ . f (n γ x f )
Addition
plus ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ .m γ (n γ x f ) fplus′ ≡ λn,m :Nat .m Nat n succ
Multiplication
mult ≡ λn,m :Nat . Λγ . λx : γ . λf : γ→γ . n γ x (λy : γ .m γ y f )mult′ ≡ λn,m :Nat . n Nat 0 (plus m)
![Page 107: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/107.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 108: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/108.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 109: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/109.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 110: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/110.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 111: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/111.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 112: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/112.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´
down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 113: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/113.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 114: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/114.jpg)
Computing with natural numbers (2/2)
Predecessor function pred : Nat→ Nat
pred 0 ' 0pred (n + 1) ' n
fst ≡ λp :Nat×Nat . p Nat (λx, y :Nat . x) : Nat×Nat→ Natsnd ≡ λp :Nat×Nat . p Nat (λx, y :Nat . y) : Nat×Nat→ Natstep ≡ λp :Nat×Nat . 〈snd p, succ (snd p)〉 : Nat×Nat→ Nat×Natpred ≡ λn :Nat . fst (n (Nat×Nat) 〈0, 0〉 step) : Nat→ Nat
Ackerman function ack : Nat→ Nat→ Nat
ack 0 m ' m + 1ack (n + 1) 0 ' ack n 1ack (n + 1) (m + 1) ' ack n
`ack (n + 1) m
´down ≡ λf : (Nat→Nat) . λp :Nat . p Nat (f 1) f : (Nat→Nat)→ (Nat→Nat)ack ≡ λn,m :Nat . n (Nat→Nat) succ down m : Nat→ Nat→ Nat
. SN theorem guarantees that all well-typed computations terminate
![Page 115: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/115.jpg)
Part III
System F: Curry-style presentation
![Page 116: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/116.jpg)
System F polymorphism
ML/Haskell polymorphism
TypesSchemes
A,B ::= α | A→ B | · · · (user datatypes)S ::= ∀~α B
The type scheme ∀α B is de�ned after its particular instances B{α:= A}⇒ Type system is predicative
System F polymorphism
Types A,B ::= α | A→ B | ∀α B
The type ∀α B and its instances B{α:=A} are de�ned simultaneously
∀α (α → α) and ∀α (α → α) → ∀α (α → α)
⇒ Type system is impredicative, or cyclic
![Page 117: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/117.jpg)
System F polymorphism
ML/Haskell polymorphism
TypesSchemes
A,B ::= α | A→ B | · · · (user datatypes)S ::= ∀~α B
The type scheme ∀α B is de�ned after its particular instances B{α:= A}
⇒ Type system is predicative
System F polymorphism
Types A,B ::= α | A→ B | ∀α B
The type ∀α B and its instances B{α:=A} are de�ned simultaneously
∀α (α → α) and ∀α (α → α) → ∀α (α → α)
⇒ Type system is impredicative, or cyclic
![Page 118: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/118.jpg)
System F polymorphism
ML/Haskell polymorphism
TypesSchemes
A,B ::= α | A→ B | · · · (user datatypes)S ::= ∀~α B
The type scheme ∀α B is de�ned after its particular instances B{α:= A}⇒ Type system is predicative
System F polymorphism
Types A,B ::= α | A→ B | ∀α B
The type ∀α B and its instances B{α:=A} are de�ned simultaneously
∀α (α → α) and ∀α (α → α) → ∀α (α → α)
⇒ Type system is impredicative, or cyclic
![Page 119: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/119.jpg)
System F polymorphism
ML/Haskell polymorphism
TypesSchemes
A,B ::= α | A→ B | · · · (user datatypes)S ::= ∀~α B
The type scheme ∀α B is de�ned after its particular instances B{α:= A}⇒ Type system is predicative
System F polymorphism
Types A,B ::= α | A→ B | ∀α B
The type ∀α B and its instances B{α:=A} are de�ned simultaneously
∀α (α → α) and ∀α (α → α) → ∀α (α → α)
⇒ Type system is impredicative, or cyclic
![Page 120: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/120.jpg)
System F polymorphism
ML/Haskell polymorphism
TypesSchemes
A,B ::= α | A→ B | · · · (user datatypes)S ::= ∀~α B
The type scheme ∀α B is de�ned after its particular instances B{α:= A}⇒ Type system is predicative
System F polymorphism
Types A,B ::= α | A→ B | ∀α B
The type ∀α B and its instances B{α:=A} are de�ned simultaneously
∀α (α → α) and ∀α (α → α) → ∀α (α → α)
⇒ Type system is impredicative, or cyclic
![Page 121: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/121.jpg)
System F polymorphism
ML/Haskell polymorphism
TypesSchemes
A,B ::= α | A→ B | · · · (user datatypes)S ::= ∀~α B
The type scheme ∀α B is de�ned after its particular instances B{α:= A}⇒ Type system is predicative
System F polymorphism
Types A,B ::= α | A→ B | ∀α B
The type ∀α B and its instances B{α:=A} are de�ned simultaneously
∀α (α → α) and ∀α (α → α) → ∀α (α → α)
⇒ Type system is impredicative, or cyclic
![Page 122: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/122.jpg)
Extracting pure λ-terms
In Church-style system F , polymorphism is explicit:
id ≡ Λα . λx :α . x and id Nat 2
Two kind of redexes (λx :A . t)u and (Λα . t)A
Idea: Remove type abstractions/applications/annotations
Erasing function t 7→ |t|
|x | = x|λx :A . t| = λx . |t| |Λα . t| = |t|
|tu| = |t||u| |tA| = |t|
Target language is pure λ-calculus
Second kind redexes are erased, �rst kind redexes are preserved
![Page 123: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/123.jpg)
Extracting pure λ-terms
In Church-style system F , polymorphism is explicit:
id ≡ Λα . λx :α . x and id Nat 2
Two kind of redexes (λx :A . t)u and (Λα . t)A
Idea: Remove type abstractions/applications/annotations
Erasing function t 7→ |t|
|x | = x|λx :A . t| = λx . |t| |Λα . t| = |t|
|tu| = |t||u| |tA| = |t|
Target language is pure λ-calculus
Second kind redexes are erased, �rst kind redexes are preserved
![Page 124: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/124.jpg)
Extracting pure λ-terms
In Church-style system F , polymorphism is explicit:
id ≡ Λα . λx :α . x and id Nat 2
Two kind of redexes (λx :A . t)u and (Λα . t)A
Idea: Remove type abstractions/applications/annotations
Erasing function t 7→ |t|
|x | = x|λx :A . t| = λx . |t| |Λα . t| = |t|
|tu| = |t||u| |tA| = |t|
Target language is pure λ-calculus
Second kind redexes are erased, �rst kind redexes are preserved
![Page 125: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/125.jpg)
Extracting pure λ-terms
In Church-style system F , polymorphism is explicit:
id ≡ Λα . λx :α . x and id Nat 2
Two kind of redexes (λx :A . t)u and (Λα . t)A
Idea: Remove type abstractions/applications/annotations
Erasing function t 7→ |t|
|x | = x|λx :A . t| = λx . |t| |Λα . t| = |t|
|tu| = |t||u| |tA| = |t|
Target language is pure λ-calculus
Second kind redexes are erased, �rst kind redexes are preserved
![Page 126: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/126.jpg)
Extracting pure λ-terms
In Church-style system F , polymorphism is explicit:
id ≡ Λα . λx :α . x and id Nat 2
Two kind of redexes (λx :A . t)u and (Λα . t)A
Idea: Remove type abstractions/applications/annotations
Erasing function t 7→ |t|
|x | = x|λx :A . t| = λx . |t| |Λα . t| = |t|
|tu| = |t||u| |tA| = |t|
Target language is pure λ-calculus
Second kind redexes are erased, �rst kind redexes are preserved
![Page 127: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/127.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:The whole syntaxThe judgementsThe typing rulesThe derivations
⇒ Induces a new formalism: Curry-style system F
![Page 128: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/128.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:The whole syntaxThe judgementsThe typing rulesThe derivations
⇒ Induces a new formalism: Curry-style system F
![Page 129: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/129.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:
The whole syntaxThe judgementsThe typing rulesThe derivations
⇒ Induces a new formalism: Curry-style system F
![Page 130: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/130.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:The whole syntax
The judgementsThe typing rulesThe derivations
⇒ Induces a new formalism: Curry-style system F
![Page 131: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/131.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:The whole syntaxThe judgements
The typing rulesThe derivations
⇒ Induces a new formalism: Curry-style system F
![Page 132: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/132.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:The whole syntaxThe judgementsThe typing rules
The derivations
⇒ Induces a new formalism: Curry-style system F
![Page 133: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/133.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:The whole syntaxThe judgementsThe typing rulesThe derivations
⇒ Induces a new formalism: Curry-style system F
![Page 134: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/134.jpg)
Extending the erasing function
Erased terms have a nice computational behaviour. . .Only one kind of redex, easy to execute (Krivine's machine)Irrelevant part of computation has been removedThe essence of computation has been preserved (to be justi�ed later)
. . . but what is their status w.r.t. typing?
The erasing function, de�ned on terms, can be extended to:The whole syntaxThe judgementsThe typing rulesThe derivations
⇒ Induces a new formalism: Curry-style system F
![Page 135: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/135.jpg)
Church-style system F
Church-style system FCurry-style system F [Leivant 83]
Types
Terms
Judgments
Reduction
A,B ::= α | A→ B | ∀α B
t, u ::=
x | λx . t | tu
x | λx :A . t | tu | Λα . t | tA
x | λx :A . t | tu | Λα . t | tA
Γ ::= [] | Γ, x :A
(λx . t)u � t{x := u}
(λx :A . t)u � t{x := u}
(λx :A . t)u � t{x := u}
(Λα . t)A � t{α := A}
(Λα . t)A � t{α := A}
Remarks:
Types (and contexts) are unchanged
Terms are now pure λ-terms
Only one kind of redex
![Page 136: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/136.jpg)
Church-style system F
Church-style system F
Curry-style system F [Leivant 83]
Types
Terms
Judgments
Reduction
A,B ::= α | A→ B | ∀α B
t, u ::=
x | λx . t | tux | λx :A . t | tu | Λα . t | tA
x | λx :A . t | tu | Λα . t | tA
Γ ::= [] | Γ, x :A
(λx . t)u � t{x := u}(λx :A . t)u � t{x := u}
(λx :A . t)u � t{x := u}
(Λα . t)A � t{α := A}
(Λα . t)A � t{α := A}
Remarks:
Types (and contexts) are unchanged
Terms are now pure λ-terms
Only one kind of redex
![Page 137: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/137.jpg)
Church-style system FChurch-style system F
Curry-style system F [Leivant 83]
Types
Terms
Judgments
Reduction
A,B ::= α | A→ B | ∀α B
t, u ::= x | λx . t | tu
x | λx :A . t | tu | Λα . t | tAx | λx :A . t | tu | Λα . t | tA
Γ ::= [] | Γ, x :A
(λx . t)u � t{x := u}
(λx :A . t)u � t{x := u}(λx :A . t)u � t{x := u}(Λα . t)A � t{α := A}(Λα . t)A � t{α := A}
Remarks:
Types (and contexts) are unchanged
Terms are now pure λ-terms
Only one kind of redex
![Page 138: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/138.jpg)
Church-style system FChurch-style system F
Curry-style system F [Leivant 83]
Types
Terms
Judgments
Reduction
A,B ::= α | A→ B | ∀α B
t, u ::= x | λx . t | tu
x | λx :A . t | tu | Λα . t | tAx | λx :A . t | tu | Λα . t | tA
Γ ::= [] | Γ, x :A
(λx . t)u � t{x := u}
(λx :A . t)u � t{x := u}(λx :A . t)u � t{x := u}(Λα . t)A � t{α := A}(Λα . t)A � t{α := A}
Remarks:
Types (and contexts) are unchanged
Terms are now pure λ-terms
Only one kind of redex
![Page 139: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/139.jpg)
Church-style system F: typing rules
Curry-style system F: typing rules
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx :A . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ ` t : BΓ ` Λα . t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` tA : B{α := A}
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ `
tt
: BΓ `
tt
: ∀α Bα/∈TV (Γ)
Γ `
tt
: ∀α BΓ `
tt
: B{α := A}
⇒ Rules are no more syntax directed
![Page 140: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/140.jpg)
Church-style system F: typing rules
Curry-style system F: typing rules
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx :A . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ ` t : BΓ ` Λα . t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` tA : B{α := A}
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ ` t
t
: BΓ ` t
t
: ∀α Bα/∈TV (Γ)
Γ ` t
t
: ∀α BΓ ` t
t
: B{α := A}
⇒ Rules are no more syntax directed
![Page 141: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/141.jpg)
Church-style system F: typing rules
Curry-style system F: typing rules
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx :A . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ ` t : BΓ ` Λα . t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` tA : B{α := A}
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx . t : A→ B
Γ ` t : A→ B Γ ` u : AΓ ` tu : B
Γ `
t
t : BΓ `
t
t : ∀α Bα/∈TV (Γ)
Γ `
t
t : ∀α BΓ `
t
t : B{α := A}
⇒ Rules are no more syntax directed
![Page 142: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/142.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 143: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/143.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 144: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/144.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 145: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/145.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that change
A term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 146: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/146.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x
: ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 147: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/147.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α)
: ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 148: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/148.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α
: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 149: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/149.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α)
: Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 150: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/150.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool
(`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 151: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/151.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 152: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/152.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 153: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/153.jpg)
Curry-style system F: properties
Things that do not change
Substitutivity + β-subject reduction
Strong normalisation (postponed)
Things that changeA term may have several types
∆ ≡ λx . x x : ∀α (α → α) → ∀α (α → α): ∀α α → ∀α α: ∀α α → ∀α (α → α): Bool→ Bool→ Bool (`or' function!)
No principal type (cf later)
Type checking/inference becomes undecidable [Wells 94]
![Page 154: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/154.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)
for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 155: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/155.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations
1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)
for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 156: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/156.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)
2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 157: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/157.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)
for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 158: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/158.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)
for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 159: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/159.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)
for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)
2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 160: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/160.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)
for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 161: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/161.jpg)
Erasing and typing
Equivalence between Church and Curry's presentations1 If Γ ` t0 : A (Church), then Γ ` |t0| : A (Curry)2 If Γ ` t : A (Curry), then Γ ` t0 : A (Church)
for some t0 s.t. |t0| = t
The erasing function maps:
Church's world Curry's world
1. derivations to derivations (isomorphism)2. valid judgements to valid judgements (surjective only)
� On valid judgements, erasing is not injective:
λf : (∀α (α→α)) . f (∀α (α→α))f : ∀α (α→α) → ∀α (α→α)λf : (∀α (α→α)) . Λα . f (α→ α)(f α) : ∀α (α→α) → ∀α (α→α)
λf . � : ∀α (α→α) → ∀α (α→α)
![Page 162: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/162.jpg)
Erasing and reduction
Second-kind redexes are erased, �rst-kind redexes are preserved
(Church) (Λα . λx : α . x)B y � (λx :B . x) y � y↓ Erasing
(Curry) (λx . x) y ≡ (λx . x) y � y
Fact 1 (Church to Curry):
If t0, t ′0 ∈ Church, then
t �n t ′ ⇒ |t0| �p |t ′0| (with p ≤ n)
Fact 2 (Curry to Church):
If t0 ∈ Church, t ′ ∈ Curry and t0 well-typed, then
|t0| �p t ′ ⇒ ∃t ′0 (|t ′0| = t ′ ∧ t0 �n t ′0) (with n ≥ p)
![Page 163: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/163.jpg)
Erasing and reduction
Second-kind redexes are erased, �rst-kind redexes are preserved
(Church) (Λα . λx : α . x)B y � (λx :B . x) y � y
↓ Erasing(Curry) (λx . x) y ≡ (λx . x) y � y
Fact 1 (Church to Curry):
If t0, t ′0 ∈ Church, then
t �n t ′ ⇒ |t0| �p |t ′0| (with p ≤ n)
Fact 2 (Curry to Church):
If t0 ∈ Church, t ′ ∈ Curry and t0 well-typed, then
|t0| �p t ′ ⇒ ∃t ′0 (|t ′0| = t ′ ∧ t0 �n t ′0) (with n ≥ p)
![Page 164: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/164.jpg)
Erasing and reduction
Second-kind redexes are erased, �rst-kind redexes are preserved
(Church) (Λα . λx : α . x)B y � (λx :B . x) y � y↓ Erasing
(Curry) (λx . x) y ≡ (λx . x) y � y
Fact 1 (Church to Curry):
If t0, t ′0 ∈ Church, then
t �n t ′ ⇒ |t0| �p |t ′0| (with p ≤ n)
Fact 2 (Curry to Church):
If t0 ∈ Church, t ′ ∈ Curry and t0 well-typed, then
|t0| �p t ′ ⇒ ∃t ′0 (|t ′0| = t ′ ∧ t0 �n t ′0) (with n ≥ p)
![Page 165: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/165.jpg)
Erasing and reduction
Second-kind redexes are erased, �rst-kind redexes are preserved
(Church) (Λα . λx : α . x)B y � (λx :B . x) y � y↓ Erasing
(Curry) (λx . x) y ≡ (λx . x) y � y
Fact 1 (Church to Curry):
If t0, t ′0 ∈ Church, then
t �n t ′ ⇒ |t0| �p |t ′0| (with p ≤ n)
Fact 2 (Curry to Church):
If t0 ∈ Church, t ′ ∈ Curry and t0 well-typed, then
|t0| �p t ′ ⇒ ∃t ′0 (|t ′0| = t ′ ∧ t0 �n t ′0) (with n ≥ p)
![Page 166: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/166.jpg)
Erasing and reduction
Second-kind redexes are erased, �rst-kind redexes are preserved
(Church) (Λα . λx : α . x)B y � (λx :B . x) y � y↓ Erasing
(Curry) (λx . x) y ≡ (λx . x) y � y
Fact 1 (Church to Curry):
If t0, t ′0 ∈ Church, then
t �n t ′ ⇒ |t0| �p |t ′0| (with p ≤ n)
Fact 2 (Curry to Church):
If t0 ∈ Church, t ′ ∈ Curry and t0 well-typed, then
|t0| �p t ′ ⇒ ∃t ′0 (|t ′0| = t ′ ∧ t0 �n t ′0) (with n ≥ p)
![Page 167: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/167.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):1 During the contraction of a 1st-kind redex, the number of
redexes of both kinds may increase2 During the contraction of a 2nd-kind redex
the number of 1st-kind redexes may increasethe number of 2nd-kind redexes does not increasethe number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 168: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/168.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):
1 During the contraction of a 1st-kind redex, the number ofredexes of both kinds may increase
2 During the contraction of a 2nd-kind redexthe number of 1st-kind redexes may increasethe number of 2nd-kind redexes does not increasethe number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 169: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/169.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):1 During the contraction of a 1st-kind redex, the number of
redexes of both kinds may increase
2 During the contraction of a 2nd-kind redexthe number of 1st-kind redexes may increasethe number of 2nd-kind redexes does not increasethe number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 170: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/170.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):1 During the contraction of a 1st-kind redex, the number of
redexes of both kinds may increase2 During the contraction of a 2nd-kind redex
the number of 1st-kind redexes may increasethe number of 2nd-kind redexes does not increasethe number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 171: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/171.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):1 During the contraction of a 1st-kind redex, the number of
redexes of both kinds may increase2 During the contraction of a 2nd-kind redex
the number of 1st-kind redexes may increase
the number of 2nd-kind redexes does not increasethe number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 172: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/172.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):1 During the contraction of a 1st-kind redex, the number of
redexes of both kinds may increase2 During the contraction of a 2nd-kind redex
the number of 1st-kind redexes may increasethe number of 2nd-kind redexes does not increase
the number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 173: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/173.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):1 During the contraction of a 1st-kind redex, the number of
redexes of both kinds may increase2 During the contraction of a 2nd-kind redex
the number of 1st-kind redexes may increasethe number of 2nd-kind redexes does not increasethe number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 174: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/174.jpg)
Normalisation equivalence
Fact 3 (Combinatorial argument):1 During the contraction of a 1st-kind redex, the number of
redexes of both kinds may increase2 During the contraction of a 2nd-kind redex
the number of 1st-kind redexes may increasethe number of 2nd-kind redexes does not increasethe number of type abstractions (Λα . t) decreases
Combining facts 1, 2 and 3, we easily prove:
Theorem (Normalisation equivalence):
The following statements are combinatorially equivalent:1 All typable terms of syst. F -Church are strongly normalisable2 All typable terms of syst. F -Curry are strongly normalisable
![Page 175: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/175.jpg)
Subtyping
In Curry-style system F , subtyping is introduced as a macro:
A ≤ B ≡ x : A ` x : B
Admissible rules
(Re�exivity, transitivity) A ≤ AA ≤ B B ≤ C
A ≤ C
(Polymorphism) ∀α B ≤ B{α := A}A ≤ B
A ≤ ∀α Bα/∈TV (A)
(Subsumption)Γ ` t : A A ≤ B
Γ ` t : B
![Page 176: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/176.jpg)
Subtyping
In Curry-style system F , subtyping is introduced as a macro:
A ≤ B ≡ x : A ` x : B
Admissible rules
(Re�exivity, transitivity) A ≤ AA ≤ B B ≤ C
A ≤ C
(Polymorphism) ∀α B ≤ B{α := A}A ≤ B
A ≤ ∀α Bα/∈TV (A)
(Subsumption)Γ ` t : A A ≤ B
Γ ` t : B
![Page 177: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/177.jpg)
Subtyping
In Curry-style system F , subtyping is introduced as a macro:
A ≤ B ≡ x : A ` x : B
Admissible rules
(Re�exivity, transitivity) A ≤ AA ≤ B B ≤ C
A ≤ C
(Polymorphism) ∀α B ≤ B{α := A}A ≤ B
A ≤ ∀α Bα/∈TV (A)
(Subsumption)Γ ` t : A A ≤ B
Γ ` t : B
![Page 178: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/178.jpg)
Subtyping
In Curry-style system F , subtyping is introduced as a macro:
A ≤ B ≡ x : A ` x : B
Admissible rules
(Re�exivity, transitivity) A ≤ AA ≤ B B ≤ C
A ≤ C
(Polymorphism) ∀α B ≤ B{α := A}A ≤ B
A ≤ ∀α Bα/∈TV (A)
(Subsumption)Γ ` t : A A ≤ B
Γ ` t : B
![Page 179: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/179.jpg)
Subtyping
In Curry-style system F , subtyping is introduced as a macro:
A ≤ B ≡ x : A ` x : B
Admissible rules
(Re�exivity, transitivity) A ≤ AA ≤ B B ≤ C
A ≤ C
(Polymorphism) ∀α B ≤ B{α := A}A ≤ B
A ≤ ∀α Bα/∈TV (A)
(Subsumption)Γ ` t : A A ≤ B
Γ ` t : B
![Page 180: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/180.jpg)
Subtyping
In Curry-style system F , subtyping is introduced as a macro:
A ≤ B ≡ x : A ` x : B
Admissible rules
(Re�exivity, transitivity) A ≤ AA ≤ B B ≤ C
A ≤ C
(Polymorphism) ∀α B ≤ B{α := A}A ≤ B
A ≤ ∀α Bα/∈TV (A)
(Subsumption)Γ ` t : A A ≤ B
Γ ` t : B
![Page 181: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/181.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:1 Curry-style system F does not enjoy η-subject reduction2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 182: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/182.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:1 Curry-style system F does not enjoy η-subject reduction2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 183: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/183.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:1 Curry-style system F does not enjoy η-subject reduction2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 184: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/184.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:1 Curry-style system F does not enjoy η-subject reduction2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 185: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/185.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:
1 Curry-style system F does not enjoy η-subject reduction2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 186: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/186.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:1 Curry-style system F does not enjoy η-subject reduction
2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 187: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/187.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:1 Curry-style system F does not enjoy η-subject reduction2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 188: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/188.jpg)
Problem with η-redexes in Curry-style system F
The (desired) subtyping rule for arrow-types
A ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′
is not admissible
In particular, we have: f : Nat→ ∀β β 6` f : ∀α α → Bool
but if we η-expand: f : Nat→ ∀β β ` λx . fx : ∀α α → Bool
This shows that:1 Curry-style system F does not enjoy η-subject reduction2 This problem is connected with subtyping in arrow-types
The well-typed term: λx . fx : (∀α α) → Bool (Curry-style)comes from the term λx : (∀α α) . f (x Nat) Bool| {z }
not an η-redex(Church-style)
![Page 189: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/189.jpg)
System Fη [Mitchell 88]
Extend Curry-style system F with a new rule
Γ ` λx . tx : AΓ ` t : A
x /∈FV (t)
to enforce η-subject reduction
Properties:
Substitutivity, βη-subject-reduction, strong normalisation
Subtyping ruleA ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′is now admissible
Expansion lemmaIf Γ ` t : A is derivable in Fη, then Γ ` t′ : A is derivable in system Ffor some η-expansion t′ of the term t.
![Page 190: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/190.jpg)
System Fη [Mitchell 88]
Extend Curry-style system F with a new rule
Γ ` λx . tx : AΓ ` t : A
x /∈FV (t)
to enforce η-subject reduction
Properties:
Substitutivity, βη-subject-reduction, strong normalisation
Subtyping ruleA ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′is now admissible
Expansion lemmaIf Γ ` t : A is derivable in Fη, then Γ ` t′ : A is derivable in system Ffor some η-expansion t′ of the term t.
![Page 191: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/191.jpg)
System Fη [Mitchell 88]
Extend Curry-style system F with a new rule
Γ ` λx . tx : AΓ ` t : A
x /∈FV (t)
to enforce η-subject reduction
Properties:
Substitutivity, βη-subject-reduction, strong normalisation
Subtyping ruleA ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′is now admissible
Expansion lemmaIf Γ ` t : A is derivable in Fη, then Γ ` t′ : A is derivable in system Ffor some η-expansion t′ of the term t.
![Page 192: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/192.jpg)
System Fη [Mitchell 88]
Extend Curry-style system F with a new rule
Γ ` λx . tx : AΓ ` t : A
x /∈FV (t)
to enforce η-subject reduction
Properties:
Substitutivity, βη-subject-reduction, strong normalisation
Subtyping ruleA ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′is now admissible
Expansion lemmaIf Γ ` t : A is derivable in Fη, then Γ ` t′ : A is derivable in system Ffor some η-expansion t′ of the term t.
![Page 193: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/193.jpg)
System Fη [Mitchell 88]
Extend Curry-style system F with a new rule
Γ ` λx . tx : AΓ ` t : A
x /∈FV (t)
to enforce η-subject reduction
Properties:
Substitutivity, βη-subject-reduction, strong normalisation
Subtyping ruleA ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′is now admissible
Expansion lemmaIf Γ ` t : A is derivable in Fη, then Γ ` t′ : A is derivable in system Ffor some η-expansion t′ of the term t.
![Page 194: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/194.jpg)
System Fη [Mitchell 88]
Extend Curry-style system F with a new rule
Γ ` λx . tx : AΓ ` t : A
x /∈FV (t)
to enforce η-subject reduction
Properties:
Substitutivity, βη-subject-reduction, strong normalisation
Subtyping ruleA ≤ A′ B ≤ B ′
A′ → B ≤ A→ B ′is now admissible
Expansion lemmaIf Γ ` t : A is derivable in Fη, then Γ ` t′ : A is derivable in system Ffor some η-expansion t′ of the term t.
![Page 195: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/195.jpg)
More subtyping
If we set
⊥ := ∀γ γA× B := ∀γ ((A→ B → γ) → γ)A + B := ∀γ ((A→ γ) → (B → γ) → γ)List(A) := ∀γ (γ → (A→ γ → γ) → γ)
then, in Fη, the following subtyping rules are admissible:
⊥ ≤ AA ≤ A′
List(A) ≤ List(A′)
A ≤ A′ B ≤ B ′
A× B ≤ A′ × B ′A ≤ A′ B ≤ B ′
A + B ≤ A′ + B ′
� But most typable terms have no principal type
![Page 196: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/196.jpg)
More subtyping
If we set
⊥ := ∀γ γA× B := ∀γ ((A→ B → γ) → γ)A + B := ∀γ ((A→ γ) → (B → γ) → γ)List(A) := ∀γ (γ → (A→ γ → γ) → γ)
then, in Fη, the following subtyping rules are admissible:
⊥ ≤ AA ≤ A′
List(A) ≤ List(A′)
A ≤ A′ B ≤ B ′
A× B ≤ A′ × B ′A ≤ A′ B ≤ B ′
A + B ≤ A′ + B ′
� But most typable terms have no principal type
![Page 197: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/197.jpg)
Adding intersection types
Extend system Fη with binary intersections
Types A,B ::= α | A→ B | ∀α B | A ∩ B
Γ ` t : A Γ ` t : BΓ ` t : A ∩ B
Γ ` t : A ∩ BΓ ` t : A
Γ ` t : A ∩ BΓ ` t : B
βη-subject reduction, strong normalisation, etc.
Subtyping rules
A ∩ B ≤ A A ∩ B ≤ BC ≤ A C ≤ B
C ≤ A ∩ B
All the strongly normalising terms are typable. . .. . . but nothing to do with ∀: already true in λ→∩
All typable terms have a principal typeλx : xx . : ∀α ∀β ((α→β) ∩ α → β)
![Page 198: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/198.jpg)
Adding intersection types
Extend system Fη with binary intersections
Types A,B ::= α | A→ B | ∀α B | A ∩ B
Γ ` t : A Γ ` t : BΓ ` t : A ∩ B
Γ ` t : A ∩ BΓ ` t : A
Γ ` t : A ∩ BΓ ` t : B
βη-subject reduction, strong normalisation, etc.
Subtyping rules
A ∩ B ≤ A A ∩ B ≤ BC ≤ A C ≤ B
C ≤ A ∩ B
All the strongly normalising terms are typable. . .. . . but nothing to do with ∀: already true in λ→∩
All typable terms have a principal typeλx : xx . : ∀α ∀β ((α→β) ∩ α → β)
![Page 199: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/199.jpg)
Adding intersection types
Extend system Fη with binary intersections
Types A,B ::= α | A→ B | ∀α B | A ∩ B
Γ ` t : A Γ ` t : BΓ ` t : A ∩ B
Γ ` t : A ∩ BΓ ` t : A
Γ ` t : A ∩ BΓ ` t : B
βη-subject reduction, strong normalisation, etc.
Subtyping rules
A ∩ B ≤ A A ∩ B ≤ BC ≤ A C ≤ B
C ≤ A ∩ B
All the strongly normalising terms are typable. . .. . . but nothing to do with ∀: already true in λ→∩
All typable terms have a principal typeλx : xx . : ∀α ∀β ((α→β) ∩ α → β)
![Page 200: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/200.jpg)
Adding intersection types
Extend system Fη with binary intersections
Types A,B ::= α | A→ B | ∀α B | A ∩ B
Γ ` t : A Γ ` t : BΓ ` t : A ∩ B
Γ ` t : A ∩ BΓ ` t : A
Γ ` t : A ∩ BΓ ` t : B
βη-subject reduction, strong normalisation, etc.
Subtyping rules
A ∩ B ≤ A A ∩ B ≤ BC ≤ A C ≤ B
C ≤ A ∩ B
All the strongly normalising terms are typable. . .. . . but nothing to do with ∀: already true in λ→∩
All typable terms have a principal typeλx : xx . : ∀α ∀β ((α→β) ∩ α → β)
![Page 201: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/201.jpg)
Adding intersection types
Extend system Fη with binary intersections
Types A,B ::= α | A→ B | ∀α B | A ∩ B
Γ ` t : A Γ ` t : BΓ ` t : A ∩ B
Γ ` t : A ∩ BΓ ` t : A
Γ ` t : A ∩ BΓ ` t : B
βη-subject reduction, strong normalisation, etc.
Subtyping rules
A ∩ B ≤ A A ∩ B ≤ BC ≤ A C ≤ B
C ≤ A ∩ B
All the strongly normalising terms are typable. . .
. . . but nothing to do with ∀: already true in λ→∩
All typable terms have a principal typeλx : xx . : ∀α ∀β ((α→β) ∩ α → β)
![Page 202: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/202.jpg)
Adding intersection types
Extend system Fη with binary intersections
Types A,B ::= α | A→ B | ∀α B | A ∩ B
Γ ` t : A Γ ` t : BΓ ` t : A ∩ B
Γ ` t : A ∩ BΓ ` t : A
Γ ` t : A ∩ BΓ ` t : B
βη-subject reduction, strong normalisation, etc.
Subtyping rules
A ∩ B ≤ A A ∩ B ≤ BC ≤ A C ≤ B
C ≤ A ∩ B
All the strongly normalising terms are typable. . .. . . but nothing to do with ∀: already true in λ→∩
All typable terms have a principal typeλx : xx . : ∀α ∀β ((α→β) ∩ α → β)
![Page 203: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/203.jpg)
Adding intersection types
Extend system Fη with binary intersections
Types A,B ::= α | A→ B | ∀α B | A ∩ B
Γ ` t : A Γ ` t : BΓ ` t : A ∩ B
Γ ` t : A ∩ BΓ ` t : A
Γ ` t : A ∩ BΓ ` t : B
βη-subject reduction, strong normalisation, etc.
Subtyping rules
A ∩ B ≤ A A ∩ B ≤ BC ≤ A C ≤ B
C ≤ A ∩ B
All the strongly normalising terms are typable. . .. . . but nothing to do with ∀: already true in λ→∩
All typable terms have a principal typeλx : xx . : ∀α ∀β ((α→β) ∩ α → β)
![Page 204: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/204.jpg)
Part IV
The Strong Normalisation Theorem
![Page 205: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/205.jpg)
The meaning of second-order quanti�cation (1/2)
Question: What is the meaning of ∀α (α → α) ?
First scenario: an in�nite Cartesian product (à la Martin-Löf)
∀α (α → α) ≈∏
α type(α → α)
≈ (⊥ → ⊥)× (Bool→ Bool)× (Nat→ Nat)× · · ·
Since all the types A→ A are inhabited:
1 The cartesian product ∀α (α→α) should be larger than all thetypes of the form A→ A
2 In particular, ∀α (α→α) should be larger than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . seems to be very confusing!
![Page 206: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/206.jpg)
The meaning of second-order quanti�cation (1/2)
Question: What is the meaning of ∀α (α → α) ?
First scenario: an in�nite Cartesian product (à la Martin-Löf)
∀α (α → α) ≈∏
α type(α → α)
≈ (⊥ → ⊥)× (Bool→ Bool)× (Nat→ Nat)× · · ·
Since all the types A→ A are inhabited:
1 The cartesian product ∀α (α→α) should be larger than all thetypes of the form A→ A
2 In particular, ∀α (α→α) should be larger than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . seems to be very confusing!
![Page 207: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/207.jpg)
The meaning of second-order quanti�cation (1/2)
Question: What is the meaning of ∀α (α → α) ?
First scenario: an in�nite Cartesian product (à la Martin-Löf)
∀α (α → α) ≈∏
α type(α → α)
≈ (⊥ → ⊥)× (Bool→ Bool)× (Nat→ Nat)× · · ·
Since all the types A→ A are inhabited:
1 The cartesian product ∀α (α→α) should be larger than all thetypes of the form A→ A
2 In particular, ∀α (α→α) should be larger than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . seems to be very confusing!
![Page 208: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/208.jpg)
The meaning of second-order quanti�cation (1/2)
Question: What is the meaning of ∀α (α → α) ?
First scenario: an in�nite Cartesian product (à la Martin-Löf)
∀α (α → α) ≈∏
α type(α → α)
≈ (⊥ → ⊥)× (Bool→ Bool)× (Nat→ Nat)× · · ·
Since all the types A→ A are inhabited:
1 The cartesian product ∀α (α→α) should be larger than all thetypes of the form A→ A
2 In particular, ∀α (α→α) should be larger than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . seems to be very confusing!
![Page 209: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/209.jpg)
The meaning of second-order quanti�cation (1/2)
Question: What is the meaning of ∀α (α → α) ?
First scenario: an in�nite Cartesian product (à la Martin-Löf)
∀α (α → α) ≈∏
α type(α → α)
≈ (⊥ → ⊥)× (Bool→ Bool)× (Nat→ Nat)× · · ·
Since all the types A→ A are inhabited:
1 The cartesian product ∀α (α→α) should be larger than all thetypes of the form A→ A
2 In particular, ∀α (α→α) should be larger than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . seems to be very confusing!
![Page 210: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/210.jpg)
The meaning of second-order quanti�cation (1/2)
Question: What is the meaning of ∀α (α → α) ?
First scenario: an in�nite Cartesian product (à la Martin-Löf)
∀α (α → α) ≈∏
α type(α → α)
≈ (⊥ → ⊥)× (Bool→ Bool)× (Nat→ Nat)× · · ·
Since all the types A→ A are inhabited:
1 The cartesian product ∀α (α→α) should be larger than all thetypes of the form A→ A
2 In particular, ∀α (α→α) should be larger than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . seems to be very confusing!
![Page 211: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/211.jpg)
The meaning of second-order quanti�cation (1/2)
Question: What is the meaning of ∀α (α → α) ?
First scenario: an in�nite Cartesian product (à la Martin-Löf)
∀α (α → α) ≈∏
α type(α → α)
≈ (⊥ → ⊥)× (Bool→ Bool)× (Nat→ Nat)× · · ·
Since all the types A→ A are inhabited:
1 The cartesian product ∀α (α→α) should be larger than all thetypes of the form A→ A
2 In particular, ∀α (α→α) should be larger than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . seems to be very confusing!
![Page 212: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/212.jpg)
The meaning of second-order quanti�cation (2/2)
Second scenario: In F -Curry, both rules ∀-intro and ∀-elim
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
suggest that ∀ is not a cartesian product, but an intersection
Taking back our example:1 The intersection ∀α (α→α) is smaller than all A→ A2 In particular, ∀α (α→α) is smaller than its own function
space ∀α (α→α) → ∀α (α→α) . . .
. . . our intuition feels much better!
⇒ We will prove strong normalisation for Curry-style system FRemember that SN(F -Church) ⇔ SN(F -Curry) (combinatorial equivalence)
![Page 213: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/213.jpg)
The meaning of second-order quanti�cation (2/2)
Second scenario: In F -Curry, both rules ∀-intro and ∀-elim
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
suggest that ∀ is not a cartesian product, but an intersection
Taking back our example:
1 The intersection ∀α (α→α) is smaller than all A→ A2 In particular, ∀α (α→α) is smaller than its own function
space ∀α (α→α) → ∀α (α→α) . . .
. . . our intuition feels much better!
⇒ We will prove strong normalisation for Curry-style system FRemember that SN(F -Church) ⇔ SN(F -Curry) (combinatorial equivalence)
![Page 214: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/214.jpg)
The meaning of second-order quanti�cation (2/2)
Second scenario: In F -Curry, both rules ∀-intro and ∀-elim
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
suggest that ∀ is not a cartesian product, but an intersection
Taking back our example:1 The intersection ∀α (α→α) is smaller than all A→ A
2 In particular, ∀α (α→α) is smaller than its own functionspace ∀α (α→α) → ∀α (α→α) . . .
. . . our intuition feels much better!
⇒ We will prove strong normalisation for Curry-style system FRemember that SN(F -Church) ⇔ SN(F -Curry) (combinatorial equivalence)
![Page 215: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/215.jpg)
The meaning of second-order quanti�cation (2/2)
Second scenario: In F -Curry, both rules ∀-intro and ∀-elim
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
suggest that ∀ is not a cartesian product, but an intersection
Taking back our example:1 The intersection ∀α (α→α) is smaller than all A→ A2 In particular, ∀α (α→α) is smaller than its own function
space ∀α (α→α) → ∀α (α→α) . . .
. . . our intuition feels much better!
⇒ We will prove strong normalisation for Curry-style system FRemember that SN(F -Church) ⇔ SN(F -Curry) (combinatorial equivalence)
![Page 216: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/216.jpg)
The meaning of second-order quanti�cation (2/2)
Second scenario: In F -Curry, both rules ∀-intro and ∀-elim
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
suggest that ∀ is not a cartesian product, but an intersection
Taking back our example:1 The intersection ∀α (α→α) is smaller than all A→ A2 In particular, ∀α (α→α) is smaller than its own function
space ∀α (α→α) → ∀α (α→α) . . .
. . . our intuition feels much better!
⇒ We will prove strong normalisation for Curry-style system FRemember that SN(F -Church) ⇔ SN(F -Curry) (combinatorial equivalence)
![Page 217: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/217.jpg)
The meaning of second-order quanti�cation (2/2)
Second scenario: In F -Curry, both rules ∀-intro and ∀-elim
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
suggest that ∀ is not a cartesian product, but an intersection
Taking back our example:1 The intersection ∀α (α→α) is smaller than all A→ A2 In particular, ∀α (α→α) is smaller than its own function
space ∀α (α→α) → ∀α (α→α) . . .
. . . our intuition feels much better!
⇒ We will prove strong normalisation for Curry-style system FRemember that SN(F -Church) ⇔ SN(F -Curry) (combinatorial equivalence)
![Page 218: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/218.jpg)
Strong normalisation: the di�culty
Try to prove thatΓ ` t : A ⇒ t is SN
by induction on the derivation of Γ ` t : A
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx . t : A→ B
Γ `
tt
: A→ B Γ `
uu
: AΓ `
ttuu
: B
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
All the cases successfully pass the test except applicationTwo terms t and u may be SN, whereas tu is not [Take t ≡ u ≡ λx . xx]
⇒ The induction hypothesis �t is SN� is too weak (in general)
![Page 219: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/219.jpg)
Strong normalisation: the di�culty
Try to prove thatΓ ` t : A ⇒ t is SN
by induction on the derivation of Γ ` t : A
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx . t : A→ B
Γ ` t
t
: A→ B Γ ` u
u
: AΓ ` t
t
u
u
: B
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
All the cases successfully pass the test except applicationTwo terms t and u may be SN, whereas tu is not [Take t ≡ u ≡ λx . xx]
⇒ The induction hypothesis �t is SN� is too weak (in general)
![Page 220: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/220.jpg)
Strong normalisation: the di�culty
Try to prove thatΓ ` t : A ⇒ t is SN
by induction on the derivation of Γ ` t : A
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx . t : A→ B
Γ `
t
t : A→ B Γ `
u
u : AΓ `
t
t
u
u : B
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
All the cases successfully pass the test except applicationTwo terms t and u may be SN, whereas tu is not [Take t ≡ u ≡ λx . xx]
⇒ The induction hypothesis �t is SN� is too weak (in general)
![Page 221: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/221.jpg)
Strong normalisation: the di�culty
Try to prove thatΓ ` t : A ⇒ t is SN
by induction on the derivation of Γ ` t : A
Γ ` x : A(x :A)∈Γ
Γ, x : A ` t : BΓ ` λx . t : A→ B
Γ `
t
t : A→ B Γ `
u
u : AΓ `
t
t
u
u : B
Γ ` t : BΓ ` t : ∀α B
α/∈TV (Γ)Γ ` t : ∀α B
Γ ` t : B{α := A}
All the cases successfully pass the test except applicationTwo terms t and u may be SN, whereas tu is not [Take t ≡ u ≡ λx . xx]
⇒ The induction hypothesis �t is SN� is too weak (in general)
![Page 222: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/222.jpg)
Reducibility candidates [Girard 1971]
To prove thatΓ ` t : A
A
⇒ t is SN ,
the induction hypothesis �t is SN� is too weak.
⇒ Should replace it by an invariant that depends on the type A
Intuition:
The more complex the type, the stronger its invariant,the smaller the set of terms that ful�ll this invariant
Invariants are represented by suitable sets of terms:
Reducibility candidates [Girard], or
Saturated sets [Tait]
![Page 223: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/223.jpg)
Reducibility candidates [Girard 1971]
To prove thatΓ ` t :
A
A ⇒ t is SN ,
the induction hypothesis �t is SN� is too weak.
⇒ Should replace it by an invariant that depends on the type A
Intuition:
The more complex the type, the stronger its invariant,the smaller the set of terms that ful�ll this invariant
Invariants are represented by suitable sets of terms:
Reducibility candidates [Girard], or
Saturated sets [Tait]
![Page 224: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/224.jpg)
Reducibility candidates [Girard 1971]
To prove thatΓ ` t :
A
A ⇒ t is SN ,
the induction hypothesis �t is SN� is too weak.
⇒ Should replace it by an invariant that depends on the type A
Intuition:
The more complex the type, the stronger its invariant,the smaller the set of terms that ful�ll this invariant
Invariants are represented by suitable sets of terms:
Reducibility candidates [Girard], or
Saturated sets [Tait]
![Page 225: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/225.jpg)
Reducibility candidates [Girard 1971]
To prove thatΓ ` t :
A
A ⇒ t is SN ,
the induction hypothesis �t is SN� is too weak.
⇒ Should replace it by an invariant that depends on the type A
Intuition:
The more complex the type, the stronger its invariant,the smaller the set of terms that ful�ll this invariant
Invariants are represented by suitable sets of terms:
Reducibility candidates [Girard], or
Saturated sets [Tait]
![Page 226: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/226.jpg)
Reducibility candidates [Girard 1971]
To prove thatΓ ` t :
A
A ⇒ t is SN ,
the induction hypothesis �t is SN� is too weak.
⇒ Should replace it by an invariant that depends on the type A
Intuition:
The more complex the type, the stronger its invariant,the smaller the set of terms that ful�ll this invariant
Invariants are represented by suitable sets of terms:
Reducibility candidates [Girard]
, or
Saturated sets [Tait]
![Page 227: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/227.jpg)
Reducibility candidates [Girard 1971]
To prove thatΓ ` t :
A
A ⇒ t is SN ,
the induction hypothesis �t is SN� is too weak.
⇒ Should replace it by an invariant that depends on the type A
Intuition:
The more complex the type, the stronger its invariant,the smaller the set of terms that ful�ll this invariant
Invariants are represented by suitable sets of terms:
Reducibility candidates [Girard], or
Saturated sets [Tait]
![Page 228: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/228.jpg)
Outline of the proof
1 De�ne a suitable notion of reducibility candidate= the sets of λ-terms that will interpret/represent types(Here, we use Tait's saturated sets)
2 Ensure that the notion of candidate captures the property ofstrong normalisation (which we want to prove)Each candidate should only contain strongly normalisable λ-terms as elements
3 Associate to each type A a reducibility candidate JAKType constructors `→' and `∀' have to be re�ected at the level of candidates
4 Check (by induction) that Γ ` t : A implies t ∈ JAKThis is actually a little bit more complex, since we must take care of the typing context
5 Conclude that any well-typed term t is SN by step 2.
![Page 229: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/229.jpg)
Outline of the proof
1 De�ne a suitable notion of reducibility candidate= the sets of λ-terms that will interpret/represent types(Here, we use Tait's saturated sets)
2 Ensure that the notion of candidate captures the property ofstrong normalisation (which we want to prove)Each candidate should only contain strongly normalisable λ-terms as elements
3 Associate to each type A a reducibility candidate JAKType constructors `→' and `∀' have to be re�ected at the level of candidates
4 Check (by induction) that Γ ` t : A implies t ∈ JAKThis is actually a little bit more complex, since we must take care of the typing context
5 Conclude that any well-typed term t is SN by step 2.
![Page 230: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/230.jpg)
Outline of the proof
1 De�ne a suitable notion of reducibility candidate= the sets of λ-terms that will interpret/represent types(Here, we use Tait's saturated sets)
2 Ensure that the notion of candidate captures the property ofstrong normalisation (which we want to prove)Each candidate should only contain strongly normalisable λ-terms as elements
3 Associate to each type A a reducibility candidate JAKType constructors `→' and `∀' have to be re�ected at the level of candidates
4 Check (by induction) that Γ ` t : A implies t ∈ JAKThis is actually a little bit more complex, since we must take care of the typing context
5 Conclude that any well-typed term t is SN by step 2.
![Page 231: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/231.jpg)
Outline of the proof
1 De�ne a suitable notion of reducibility candidate= the sets of λ-terms that will interpret/represent types(Here, we use Tait's saturated sets)
2 Ensure that the notion of candidate captures the property ofstrong normalisation (which we want to prove)Each candidate should only contain strongly normalisable λ-terms as elements
3 Associate to each type A a reducibility candidate JAKType constructors `→' and `∀' have to be re�ected at the level of candidates
4 Check (by induction) that Γ ` t : A implies t ∈ JAKThis is actually a little bit more complex, since we must take care of the typing context
5 Conclude that any well-typed term t is SN by step 2.
![Page 232: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/232.jpg)
Outline of the proof
1 De�ne a suitable notion of reducibility candidate= the sets of λ-terms that will interpret/represent types(Here, we use Tait's saturated sets)
2 Ensure that the notion of candidate captures the property ofstrong normalisation (which we want to prove)Each candidate should only contain strongly normalisable λ-terms as elements
3 Associate to each type A a reducibility candidate JAKType constructors `→' and `∀' have to be re�ected at the level of candidates
4 Check (by induction) that Γ ` t : A implies t ∈ JAKThis is actually a little bit more complex, since we must take care of the typing context
5 Conclude that any well-typed term t is SN by step 2.
![Page 233: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/233.jpg)
Preliminaries (1/2)
Notations:
Λ ≡ set of all untyped λ-terms (open & closed)SN ≡ set of all strongly normalisable untyped λ-termsVar ≡ set of all (term) variablesTVar ≡ set of all type variables
A reduct of a term t is a term t ′ such that t � t ′ (one step)The number of reducts of a given term is �nite and bounded by the number of redexes
A �nite reduction sequence of a term t is a �nite sequence(ti )i∈[0..n] such that t = t0 � t1 � · · · � tn−1 � tnIn�nite reduction sequences are de�ned similarly, by replacing [0..n] by N
Finite reduction sequences of a term t form a tree, called thereduction tree of t
![Page 234: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/234.jpg)
Preliminaries (1/2)
Notations:
Λ ≡ set of all untyped λ-terms (open & closed)SN ≡ set of all strongly normalisable untyped λ-termsVar ≡ set of all (term) variablesTVar ≡ set of all type variables
A reduct of a term t is a term t ′ such that t � t ′ (one step)The number of reducts of a given term is �nite and bounded by the number of redexes
A �nite reduction sequence of a term t is a �nite sequence(ti )i∈[0..n] such that t = t0 � t1 � · · · � tn−1 � tnIn�nite reduction sequences are de�ned similarly, by replacing [0..n] by N
Finite reduction sequences of a term t form a tree, called thereduction tree of t
![Page 235: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/235.jpg)
Preliminaries (1/2)
Notations:
Λ ≡ set of all untyped λ-terms (open & closed)SN ≡ set of all strongly normalisable untyped λ-termsVar ≡ set of all (term) variablesTVar ≡ set of all type variables
A reduct of a term t is a term t ′ such that t � t ′ (one step)The number of reducts of a given term is �nite and bounded by the number of redexes
A �nite reduction sequence of a term t is a �nite sequence(ti )i∈[0..n] such that t = t0 � t1 � · · · � tn−1 � tnIn�nite reduction sequences are de�ned similarly, by replacing [0..n] by N
Finite reduction sequences of a term t form a tree, called thereduction tree of t
![Page 236: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/236.jpg)
Preliminaries (1/2)
Notations:
Λ ≡ set of all untyped λ-terms (open & closed)SN ≡ set of all strongly normalisable untyped λ-termsVar ≡ set of all (term) variablesTVar ≡ set of all type variables
A reduct of a term t is a term t ′ such that t � t ′ (one step)The number of reducts of a given term is �nite and bounded by the number of redexes
A �nite reduction sequence of a term t is a �nite sequence(ti )i∈[0..n] such that t = t0 � t1 � · · · � tn−1 � tnIn�nite reduction sequences are de�ned similarly, by replacing [0..n] by N
Finite reduction sequences of a term t form a tree, called thereduction tree of t
![Page 237: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/237.jpg)
Preliminaries (1/2)
Notations:
Λ ≡ set of all untyped λ-terms (open & closed)SN ≡ set of all strongly normalisable untyped λ-termsVar ≡ set of all (term) variablesTVar ≡ set of all type variables
A reduct of a term t is a term t ′ such that t � t ′ (one step)The number of reducts of a given term is �nite and bounded by the number of redexes
A �nite reduction sequence of a term t is a �nite sequence(ti )i∈[0..n] such that t = t0 � t1 � · · · � tn−1 � tnIn�nite reduction sequences are de�ned similarly, by replacing [0..n] by N
Finite reduction sequences of a term t form a tree, called thereduction tree of t
![Page 238: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/238.jpg)
Preliminaries (2/2)
De�nition (Strongly normalisable terms)
A term t is strongly normalisable if all the reduction sequencesstarting from t are �nite
Proposition
The following assertions are equivalent:1 t is strongly normalisable2 All the reducts of t are strongly normalisable3 The reduction tree of t is �nite
![Page 239: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/239.jpg)
Preliminaries (2/2)
De�nition (Strongly normalisable terms)
A term t is strongly normalisable if all the reduction sequencesstarting from t are �nite
Proposition
The following assertions are equivalent:1 t is strongly normalisable2 All the reducts of t are strongly normalisable3 The reduction tree of t is �nite
![Page 240: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/240.jpg)
Preliminaries (2/2)
De�nition (Strongly normalisable terms)
A term t is strongly normalisable if all the reduction sequencesstarting from t are �nite
Proposition
The following assertions are equivalent:1 t is strongly normalisable2 All the reducts of t are strongly normalisable3 The reduction tree of t is �nite
![Page 241: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/241.jpg)
Saturated sets [Tait]
De�nition (Saturated set)
A set S ⊂ Λ is saturated if:
(SAT1) S ⊂ SN
(SAT2) x ∈ Var, ~v ∈ list(SN) ⇒ x~v ∈ S
(SAT3) t{x := u}~v ∈ S , u ∈ SN ⇒ (λx . t)u~v ∈ S
(SAT1) expresses the property we want to prove
Saturated sets contain all the variables (SAT2)Extra-arguments ~v ∈ list(SN) are here for technical reasons
Saturated sets are closed under head β-expansion (SAT3)Notice the condition u ∈ SN to avoid a clash with (SAT1) for K-redexes
The set of all saturated sets is written SAT [⊂ P(SN) ⊂ P(Λ)]
![Page 242: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/242.jpg)
Saturated sets [Tait]
De�nition (Saturated set)
A set S ⊂ Λ is saturated if:
(SAT1) S ⊂ SN
(SAT2) x ∈ Var, ~v ∈ list(SN) ⇒ x~v ∈ S
(SAT3) t{x := u}~v ∈ S , u ∈ SN ⇒ (λx . t)u~v ∈ S
(SAT1) expresses the property we want to prove
Saturated sets contain all the variables (SAT2)Extra-arguments ~v ∈ list(SN) are here for technical reasons
Saturated sets are closed under head β-expansion (SAT3)Notice the condition u ∈ SN to avoid a clash with (SAT1) for K-redexes
The set of all saturated sets is written SAT [⊂ P(SN) ⊂ P(Λ)]
![Page 243: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/243.jpg)
Saturated sets [Tait]
De�nition (Saturated set)
A set S ⊂ Λ is saturated if:
(SAT1) S ⊂ SN
(SAT2) x ∈ Var, ~v ∈ list(SN) ⇒ x~v ∈ S
(SAT3) t{x := u}~v ∈ S , u ∈ SN ⇒ (λx . t)u~v ∈ S
(SAT1) expresses the property we want to prove
Saturated sets contain all the variables (SAT2)Extra-arguments ~v ∈ list(SN) are here for technical reasons
Saturated sets are closed under head β-expansion (SAT3)Notice the condition u ∈ SN to avoid a clash with (SAT1) for K-redexes
The set of all saturated sets is written SAT [⊂ P(SN) ⊂ P(Λ)]
![Page 244: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/244.jpg)
Saturated sets [Tait]
De�nition (Saturated set)
A set S ⊂ Λ is saturated if:
(SAT1) S ⊂ SN
(SAT2) x ∈ Var, ~v ∈ list(SN) ⇒ x~v ∈ S
(SAT3) t{x := u}~v ∈ S , u ∈ SN ⇒ (λx . t)u~v ∈ S
(SAT1) expresses the property we want to prove
Saturated sets contain all the variables (SAT2)Extra-arguments ~v ∈ list(SN) are here for technical reasons
Saturated sets are closed under head β-expansion (SAT3)Notice the condition u ∈ SN to avoid a clash with (SAT1) for K-redexes
The set of all saturated sets is written SAT [⊂ P(SN) ⊂ P(Λ)]
![Page 245: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/245.jpg)
Saturated sets [Tait]
De�nition (Saturated set)
A set S ⊂ Λ is saturated if:
(SAT1) S ⊂ SN
(SAT2) x ∈ Var, ~v ∈ list(SN) ⇒ x~v ∈ S
(SAT3) t{x := u}~v ∈ S , u ∈ SN ⇒ (λx . t)u~v ∈ S
(SAT1) expresses the property we want to prove
Saturated sets contain all the variables (SAT2)Extra-arguments ~v ∈ list(SN) are here for technical reasons
Saturated sets are closed under head β-expansion (SAT3)Notice the condition u ∈ SN to avoid a clash with (SAT1) for K-redexes
The set of all saturated sets is written SAT [⊂ P(SN) ⊂ P(Λ)]
![Page 246: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/246.jpg)
Properties of saturated sets
Proposition (Lattice structure)
1 SN is a saturated set2 SAT is closed under arbitrary non-empty intersections/unions:
I 6= ∅, (Si )i∈I ∈ SATI ⇒“\i∈I
Si”,“[i∈I
Si”∈ SAT
(SAT, ⊂) is a complete distributive lattice, with> = SN and ⊥ = {t ∈ SN | t �∗ xu1 · · · un} (Neutral terms)
Realisability arrow: For all S ,T ⊂ Λ we set
S → T := {t ∈ Λ | ∀u ∈ S tu ∈ T}
Proposition (Closure under realisability arrow)
If S ,T ∈ SAT, then (S → T ) ∈ SAT
![Page 247: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/247.jpg)
Properties of saturated sets
Proposition (Lattice structure)1 SN is a saturated set
2 SAT is closed under arbitrary non-empty intersections/unions:
I 6= ∅, (Si )i∈I ∈ SATI ⇒“\i∈I
Si”,“[i∈I
Si”∈ SAT
(SAT, ⊂) is a complete distributive lattice, with> = SN and ⊥ = {t ∈ SN | t �∗ xu1 · · · un} (Neutral terms)
Realisability arrow: For all S ,T ⊂ Λ we set
S → T := {t ∈ Λ | ∀u ∈ S tu ∈ T}
Proposition (Closure under realisability arrow)
If S ,T ∈ SAT, then (S → T ) ∈ SAT
![Page 248: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/248.jpg)
Properties of saturated sets
Proposition (Lattice structure)1 SN is a saturated set2 SAT is closed under arbitrary non-empty intersections/unions:
I 6= ∅, (Si )i∈I ∈ SATI ⇒“\i∈I
Si”,“[i∈I
Si”∈ SAT
(SAT, ⊂) is a complete distributive lattice, with> = SN and ⊥ = {t ∈ SN | t �∗ xu1 · · · un} (Neutral terms)
Realisability arrow: For all S ,T ⊂ Λ we set
S → T := {t ∈ Λ | ∀u ∈ S tu ∈ T}
Proposition (Closure under realisability arrow)
If S ,T ∈ SAT, then (S → T ) ∈ SAT
![Page 249: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/249.jpg)
Properties of saturated sets
Proposition (Lattice structure)1 SN is a saturated set2 SAT is closed under arbitrary non-empty intersections/unions:
I 6= ∅, (Si )i∈I ∈ SATI ⇒“\i∈I
Si”,“[i∈I
Si”∈ SAT
(SAT, ⊂) is a complete distributive lattice, with> = SN and ⊥ = {t ∈ SN | t �∗ xu1 · · · un} (Neutral terms)
Realisability arrow: For all S ,T ⊂ Λ we set
S → T := {t ∈ Λ | ∀u ∈ S tu ∈ T}
Proposition (Closure under realisability arrow)
If S ,T ∈ SAT, then (S → T ) ∈ SAT
![Page 250: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/250.jpg)
Properties of saturated sets
Proposition (Lattice structure)1 SN is a saturated set2 SAT is closed under arbitrary non-empty intersections/unions:
I 6= ∅, (Si )i∈I ∈ SATI ⇒“\i∈I
Si”,“[i∈I
Si”∈ SAT
(SAT, ⊂) is a complete distributive lattice, with> = SN and ⊥ = {t ∈ SN | t �∗ xu1 · · · un} (Neutral terms)
Realisability arrow: For all S ,T ⊂ Λ we set
S → T := {t ∈ Λ | ∀u ∈ S tu ∈ T}
Proposition (Closure under realisability arrow)
If S ,T ∈ SAT, then (S → T ) ∈ SAT
![Page 251: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/251.jpg)
Properties of saturated sets
Proposition (Lattice structure)1 SN is a saturated set2 SAT is closed under arbitrary non-empty intersections/unions:
I 6= ∅, (Si )i∈I ∈ SATI ⇒“\i∈I
Si”,“[i∈I
Si”∈ SAT
(SAT, ⊂) is a complete distributive lattice, with> = SN and ⊥ = {t ∈ SN | t �∗ xu1 · · · un} (Neutral terms)
Realisability arrow: For all S ,T ⊂ Λ we set
S → T := {t ∈ Λ | ∀u ∈ S tu ∈ T}
Proposition (Closure under realisability arrow)
If S ,T ∈ SAT, then (S → T ) ∈ SAT
![Page 252: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/252.jpg)
Interpreting types (1/2)
Principle: Interpret syntactic types by saturated sets
Type arrow A→ B is interpreted by S → T (realisability arrow)
Type quanti�cation ∀α . . is interpreted by the intersection\
S∈SAT· · ·
Remark: this intersection is impredicative since S ranges over all saturated sets
Example: ∀α (α → α) should be interpreted by\
S∈SAT(S → S)
To interpret type variables, use type valations:
De�nition (Type valuations)
A type valuation is a function ρ : TVar→ SATThe set of type valuations is written TVal (= TVar → SAT)
![Page 253: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/253.jpg)
Interpreting types (1/2)
Principle: Interpret syntactic types by saturated sets
Type arrow A→ B is interpreted by S → T (realisability arrow)
Type quanti�cation ∀α . . is interpreted by the intersection\
S∈SAT· · ·
Remark: this intersection is impredicative since S ranges over all saturated sets
Example: ∀α (α → α) should be interpreted by\
S∈SAT(S → S)
To interpret type variables, use type valations:
De�nition (Type valuations)
A type valuation is a function ρ : TVar→ SATThe set of type valuations is written TVal (= TVar → SAT)
![Page 254: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/254.jpg)
Interpreting types (1/2)
Principle: Interpret syntactic types by saturated sets
Type arrow A→ B is interpreted by S → T (realisability arrow)
Type quanti�cation ∀α . . is interpreted by the intersection\
S∈SAT· · ·
Remark: this intersection is impredicative since S ranges over all saturated sets
Example: ∀α (α → α) should be interpreted by\
S∈SAT(S → S)
To interpret type variables, use type valations:
De�nition (Type valuations)
A type valuation is a function ρ : TVar→ SATThe set of type valuations is written TVal (= TVar → SAT)
![Page 255: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/255.jpg)
Interpreting types (1/2)
Principle: Interpret syntactic types by saturated sets
Type arrow A→ B is interpreted by S → T (realisability arrow)
Type quanti�cation ∀α . . is interpreted by the intersection\
S∈SAT· · ·
Remark: this intersection is impredicative since S ranges over all saturated sets
Example: ∀α (α → α) should be interpreted by\
S∈SAT(S → S)
To interpret type variables, use type valations:
De�nition (Type valuations)
A type valuation is a function ρ : TVar→ SATThe set of type valuations is written TVal (= TVar → SAT)
![Page 256: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/256.jpg)
Interpreting types (1/2)
Principle: Interpret syntactic types by saturated sets
Type arrow A→ B is interpreted by S → T (realisability arrow)
Type quanti�cation ∀α . . is interpreted by the intersection\
S∈SAT· · ·
Remark: this intersection is impredicative since S ranges over all saturated sets
Example: ∀α (α → α) should be interpreted by\
S∈SAT(S → S)
To interpret type variables, use type valations:
De�nition (Type valuations)
A type valuation is a function ρ : TVar→ SATThe set of type valuations is written TVal (= TVar → SAT)
![Page 257: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/257.jpg)
Interpreting types (1/2)
Principle: Interpret syntactic types by saturated sets
Type arrow A→ B is interpreted by S → T (realisability arrow)
Type quanti�cation ∀α . . is interpreted by the intersection\
S∈SAT· · ·
Remark: this intersection is impredicative since S ranges over all saturated sets
Example: ∀α (α → α) should be interpreted by\
S∈SAT(S → S)
To interpret type variables, use type valations:
De�nition (Type valuations)
A type valuation is a function ρ : TVar→ SATThe set of type valuations is written TVal (= TVar → SAT)
![Page 258: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/258.jpg)
Interpreting types (1/2)
Principle: Interpret syntactic types by saturated sets
Type arrow A→ B is interpreted by S → T (realisability arrow)
Type quanti�cation ∀α . . is interpreted by the intersection\
S∈SAT· · ·
Remark: this intersection is impredicative since S ranges over all saturated sets
Example: ∀α (α → α) should be interpreted by\
S∈SAT(S → S)
To interpret type variables, use type valations:
De�nition (Type valuations)
A type valuation is a function ρ : TVar→ SATThe set of type valuations is written TVal (= TVar → SAT)
![Page 259: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/259.jpg)
Interpreting types (2/2)
By induction on A, we de�ne a function JAK : TVal→ SAT
JA→ BKρ = JAKρ → JBKρ JαKρ = ρ(α)
J∀α BKρ =⋂
S∈SATJBKρ;α←S
Note: (ρ; α← S) is de�ned by(
(ρ; α←S)(α) = S(ρ; α←S)(β) = ρ(β) for all β 6= α
Problem: The implication
Γ ` t : A ⇒ t ∈ JAKρ
cannot be proved directly. (One has to take care of the context)
⇒ Strengthen induction hypothesis using substitutions
![Page 260: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/260.jpg)
Interpreting types (2/2)
By induction on A, we de�ne a function JAK : TVal→ SAT
JA→ BKρ = JAKρ → JBKρ JαKρ = ρ(α)
J∀α BKρ =⋂
S∈SATJBKρ;α←S
Note: (ρ; α← S) is de�ned by(
(ρ; α←S)(α) = S(ρ; α←S)(β) = ρ(β) for all β 6= α
Problem: The implication
Γ ` t : A ⇒ t ∈ JAKρ
cannot be proved directly. (One has to take care of the context)
⇒ Strengthen induction hypothesis using substitutions
![Page 261: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/261.jpg)
Interpreting types (2/2)
By induction on A, we de�ne a function JAK : TVal→ SAT
JA→ BKρ = JAKρ → JBKρ JαKρ = ρ(α)
J∀α BKρ =⋂
S∈SATJBKρ;α←S
Note: (ρ; α← S) is de�ned by(
(ρ; α←S)(α) = S(ρ; α←S)(β) = ρ(β) for all β 6= α
Problem: The implication
Γ ` t : A ⇒ t ∈ JAKρ
cannot be proved directly. (One has to take care of the context)
⇒ Strengthen induction hypothesis using substitutions
![Page 262: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/262.jpg)
Interpreting types (2/2)
By induction on A, we de�ne a function JAK : TVal→ SAT
JA→ BKρ = JAKρ → JBKρ JαKρ = ρ(α)
J∀α BKρ =⋂
S∈SATJBKρ;α←S
Note: (ρ; α← S) is de�ned by(
(ρ; α←S)(α) = S(ρ; α←S)(β) = ρ(β) for all β 6= α
Problem: The implication
Γ ` t : A ⇒ t ∈ JAKρ
cannot be proved directly. (One has to take care of the context)
⇒ Strengthen induction hypothesis using substitutions
![Page 263: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/263.jpg)
Substitutions
De�nition (Substitutions)
A substitution is a �nite list σ = [x1 := u1; . . . ; xn := un]where xi 6= xj (for i 6= j) and ui ∈ Λ
Application of a substitution σ to a term t is written t[σ]Exercise: De�ne it formally
De�nition (Interpretation of contexts)
For all Γ = x1 : A1; . . . ; xn : An and ρ ∈ TVal set:
JΓKρ ={σ = [x1 := u1; . . . ; xn := un]; ui ∈ JAiKρ (i = 1..n)
}Substitutions σ ∈ JΓKρ are said to be adapted to the context Γ (in the type valuation ρ)
![Page 264: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/264.jpg)
Substitutions
De�nition (Substitutions)
A substitution is a �nite list σ = [x1 := u1; . . . ; xn := un]where xi 6= xj (for i 6= j) and ui ∈ Λ
Application of a substitution σ to a term t is written t[σ]Exercise: De�ne it formally
De�nition (Interpretation of contexts)
For all Γ = x1 : A1; . . . ; xn : An and ρ ∈ TVal set:
JΓKρ ={σ = [x1 := u1; . . . ; xn := un]; ui ∈ JAiKρ (i = 1..n)
}Substitutions σ ∈ JΓKρ are said to be adapted to the context Γ (in the type valuation ρ)
![Page 265: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/265.jpg)
Substitutions
De�nition (Substitutions)
A substitution is a �nite list σ = [x1 := u1; . . . ; xn := un]where xi 6= xj (for i 6= j) and ui ∈ Λ
Application of a substitution σ to a term t is written t[σ]Exercise: De�ne it formally
De�nition (Interpretation of contexts)
For all Γ = x1 : A1; . . . ; xn : An and ρ ∈ TVal set:
JΓKρ ={σ = [x1 := u1; . . . ; xn := un]; ui ∈ JAiKρ (i = 1..n)
}Substitutions σ ∈ JΓKρ are said to be adapted to the context Γ (in the type valuation ρ)
![Page 266: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/266.jpg)
Substitutions
De�nition (Substitutions)
A substitution is a �nite list σ = [x1 := u1; . . . ; xn := un]where xi 6= xj (for i 6= j) and ui ∈ Λ
Application of a substitution σ to a term t is written t[σ]Exercise: De�ne it formally
De�nition (Interpretation of contexts)
For all Γ = x1 : A1; . . . ; xn : An and ρ ∈ TVal set:
JΓKρ ={σ = [x1 := u1; . . . ; xn := un]; ui ∈ JAiKρ (i = 1..n)
}Substitutions σ ∈ JΓKρ are said to be adapted to the context Γ (in the type valuation ρ)
![Page 267: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/267.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 268: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/268.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 269: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/269.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 270: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/270.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 271: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/271.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : B
Consider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 272: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/272.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 273: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/273.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2)
, hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 274: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/274.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 275: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/275.jpg)
The strong normalisation invariant
Lemma (Strong normalisation invariant)
If Γ ` t : A in Curry-style system F , then
∀ρ ∈ TVal ∀σ ∈ JΓKρ t[σ] ∈ JAKρ
Proof. By induction on the derivation of Γ ` t : A.Exercise: Write down the 5 cases completely
Theorem (Strong normalisation)
The typable terms of F -Curry are strongly normalisable
Proof. Assume x1 : A1; . . . ; xn : An ` t : BConsider an arbitrary type valuation ρ (for instance: ρ(α) = SN for all α)
We have: x1 ∈ JA1Kρ, x2 ∈ JA2Kρ, . . ., xn ∈ JAnKρ (SAT2), hence:
σ = [x1 := x1; . . . ; xn := xn] ∈ Jx1 : A1; . . . ; xn : AnKρ
From the lemma we get t = t[σ] ∈ JBKρ, hence t ∈ SN (SAT1)
Corollary (Church-style SN)
The typable terms of F -Church are strongly normalisable
![Page 276: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/276.jpg)
A remark on impredicativity
In the SN proof, interpretation of ∀ relies on the property:
If (Si )i∈I (I 6= ∅) is a family of saturated sets,then
⋂i∈I Si is a saturated set
in the special case where I = SAT (impredicative intersection)
In `classical' mathematics, this construction is legal
⇒ Standard set theories (Z, ZF, ZFC) are impredicative
In (Bishop, Martin-Löf's style) constructive mathematics, thisprinciple is rejected, mainly for philosophical reasons:
No convincing `constructive' explanationSuspicion about (this kind of) cyclicity
![Page 277: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/277.jpg)
A remark on impredicativity
In the SN proof, interpretation of ∀ relies on the property:
If (Si )i∈I (I 6= ∅) is a family of saturated sets,then
⋂i∈I Si is a saturated set
in the special case where I = SAT (impredicative intersection)
In `classical' mathematics, this construction is legal
⇒ Standard set theories (Z, ZF, ZFC) are impredicative
In (Bishop, Martin-Löf's style) constructive mathematics, thisprinciple is rejected, mainly for philosophical reasons:
No convincing `constructive' explanationSuspicion about (this kind of) cyclicity
![Page 278: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/278.jpg)
A remark on impredicativity
In the SN proof, interpretation of ∀ relies on the property:
If (Si )i∈I (I 6= ∅) is a family of saturated sets,then
⋂i∈I Si is a saturated set
in the special case where I = SAT (impredicative intersection)
In `classical' mathematics, this construction is legal
⇒ Standard set theories (Z, ZF, ZFC) are impredicative
In (Bishop, Martin-Löf's style) constructive mathematics, thisprinciple is rejected, mainly for philosophical reasons:
No convincing `constructive' explanationSuspicion about (this kind of) cyclicity
![Page 279: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/279.jpg)
A remark on impredicativity
In the SN proof, interpretation of ∀ relies on the property:
If (Si )i∈I (I 6= ∅) is a family of saturated sets,then
⋂i∈I Si is a saturated set
in the special case where I = SAT (impredicative intersection)
In `classical' mathematics, this construction is legal
⇒ Standard set theories (Z, ZF, ZFC) are impredicative
In (Bishop, Martin-Löf's style) constructive mathematics, thisprinciple is rejected, mainly for philosophical reasons:
No convincing `constructive' explanationSuspicion about (this kind of) cyclicity
![Page 280: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/280.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 281: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/281.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 282: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/282.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯
2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 283: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/283.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 284: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/284.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F
4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 285: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/285.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S
5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 286: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/286.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)
6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 287: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/287.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 288: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/288.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 289: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/289.jpg)
Impredicativity: An example (1/2)
Assume E is a vector space, S a set of vectors.How to de�ne the sub-vector space S ⊂ E generated by S in E ?
Standard `abstract' method:
1 Consider the set: S =˘F ; F is a sub-vector space of E and F ⊃ S
¯2 Fact: S is non empty, since E ∈ S
3 Take: S =T
F∈S F4 By de�nition, S is included in all the sub-spaces of E containing S5 But S is itself a sub-vector space of E containing S (so that S ∈ S)6 So that S is actually the smallest of all such spaces
This de�nition is impredicative (step 3) (but legal in `classical' mathematics)
The set S is de�ned from S, that already contains S as an element︸ ︷︷ ︸discovered a fortiori
![Page 290: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/290.jpg)
Impredicativity: An example (2/2)
But there are other ways of de�ning S ...
Standard `concrete' de�nition, by linear combinations:
Let S be the set of all vectors of the form v = α1 · v1 + · · ·+ αn · vn
where (vi ) ranges over all the �nite families of elements of S ,and (αi ) ranges over all the �nite families of scalars
Inductive de�nition:
Let S be the set inductively de�ned by:1 ~0 ∈ S ,2 If v ∈ S , then v ∈ S ,3 If v ∈ S and α is a scalar, then α · v ∈ S
4 If v1 ∈ S and v2 ∈ S , then v1 + v2 ∈ S .
⇒ Both de�nitions are predicative (and give the same object)
![Page 291: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/291.jpg)
Impredicativity: An example (2/2)
But there are other ways of de�ning S ...
Standard `concrete' de�nition, by linear combinations:
Let S be the set of all vectors of the form v = α1 · v1 + · · ·+ αn · vn
where (vi ) ranges over all the �nite families of elements of S ,and (αi ) ranges over all the �nite families of scalars
Inductive de�nition:
Let S be the set inductively de�ned by:1 ~0 ∈ S ,2 If v ∈ S , then v ∈ S ,3 If v ∈ S and α is a scalar, then α · v ∈ S
4 If v1 ∈ S and v2 ∈ S , then v1 + v2 ∈ S .
⇒ Both de�nitions are predicative (and give the same object)
![Page 292: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/292.jpg)
Impredicativity: An example (2/2)
But there are other ways of de�ning S ...
Standard `concrete' de�nition, by linear combinations:
Let S be the set of all vectors of the form v = α1 · v1 + · · ·+ αn · vn
where (vi ) ranges over all the �nite families of elements of S ,and (αi ) ranges over all the �nite families of scalars
Inductive de�nition:
Let S be the set inductively de�ned by:1 ~0 ∈ S ,2 If v ∈ S , then v ∈ S ,3 If v ∈ S and α is a scalar, then α · v ∈ S
4 If v1 ∈ S and v2 ∈ S , then v1 + v2 ∈ S .
⇒ Both de�nitions are predicative (and give the same object)
![Page 293: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/293.jpg)
Impredicativity: An example (2/2)
But there are other ways of de�ning S ...
Standard `concrete' de�nition, by linear combinations:
Let S be the set of all vectors of the form v = α1 · v1 + · · ·+ αn · vn
where (vi ) ranges over all the �nite families of elements of S ,and (αi ) ranges over all the �nite families of scalars
Inductive de�nition:
Let S be the set inductively de�ned by:1 ~0 ∈ S ,2 If v ∈ S , then v ∈ S ,3 If v ∈ S and α is a scalar, then α · v ∈ S
4 If v1 ∈ S and v2 ∈ S , then v1 + v2 ∈ S .
⇒ Both de�nitions are predicative (and give the same object)
![Page 294: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/294.jpg)
Impredicativity: An example (2/2)
But there are other ways of de�ning S ...
Standard `concrete' de�nition, by linear combinations:
Let S be the set of all vectors of the form v = α1 · v1 + · · ·+ αn · vn
where (vi ) ranges over all the �nite families of elements of S ,and (αi ) ranges over all the �nite families of scalars
Inductive de�nition:
Let S be the set inductively de�ned by:1 ~0 ∈ S ,2 If v ∈ S , then v ∈ S ,3 If v ∈ S and α is a scalar, then α · v ∈ S
4 If v1 ∈ S and v2 ∈ S , then v1 + v2 ∈ S .
⇒ Both de�nitions are predicative (and give the same object)
![Page 295: System F - Chalmers · System F Alexandre Miquel PPS & U. Paris 7 Alexandre.Miquel@pps.jussieu.fr ypTes Summer School 2005 August 15 26 Göteborg](https://reader030.vdocuments.site/reader030/viewer/2022040306/5eb853baafb9b560a53e3475/html5/thumbnails/295.jpg)
Impredicativity: An example (2/2)
But there are other ways of de�ning S ...
Standard `concrete' de�nition, by linear combinations:
Let S be the set of all vectors of the form v = α1 · v1 + · · ·+ αn · vn
where (vi ) ranges over all the �nite families of elements of S ,and (αi ) ranges over all the �nite families of scalars
Inductive de�nition:
Let S be the set inductively de�ned by:1 ~0 ∈ S ,2 If v ∈ S , then v ∈ S ,3 If v ∈ S and α is a scalar, then α · v ∈ S
4 If v1 ∈ S and v2 ∈ S , then v1 + v2 ∈ S .
⇒ Both de�nitions are predicative (and give the same object)