Reynolds Parametricity Patricia Johann Appalachian State University - - PowerPoint PPT Presentation

reynolds parametricity
SMART_READER_LITE
LIVE PREVIEW

Reynolds Parametricity Patricia Johann Appalachian State University - - PowerPoint PPT Presentation

Reynolds Parametricity Patricia Johann Appalachian State University cs.appstate.edu/ johannp Based on joint work with Neil Ghani, Fredrik Nordvall Forsberg, Federico Orsanigo, and Tim Revell OPLSS 2016 Course Outline Topic:


slide-1
SLIDE 1

Reynolds’ Parametricity

Patricia Johann Appalachian State University

cs.appstate.edu/

∼johannp

Based on joint work with Neil Ghani, Fredrik Nordvall Forsberg, Federico Orsanigo, and Tim Revell

OPLSS 2016

slide-2
SLIDE 2

Course Outline

Topic: Reynolds’ theory of parametric polymorphism for System F Goals: - extract the fibrational essence of Reynolds’ theory

  • generalize Reynolds’ construction to very general models
  • Lecture 1: Reynolds’ theory of parametricity for System F
  • Lecture 2: Introduction to fibrations
  • Lecture 3: A bifibrational view of parametricity
  • Lecture 4: Bifibrational parametric models for System F
slide-3
SLIDE 3

Course Outline

Topic: Reynolds’ theory of parametric polymorphism for System F Goals: - extract the fibrational essence of Reynolds’ theory

  • generalize Reynolds’ construction to very general models
  • Lecture 1: Reynolds’ theory of parametricity for System F
  • Lecture 2: Introduction to fibrations
  • Lecture 3: A bifibrational view of parametricity
  • Lecture 4: Bifibrational parametric models for System F
slide-4
SLIDE 4

Parametric Polymorphic Functions

  • Intuitively, parametric polymorphism captures uniform behavior of

functions across all type instantiations

slide-5
SLIDE 5

Parametric Polymorphic Functions

  • Intuitively, parametric polymorphism captures uniform behavior of

functions across all type instantiations

  • Distinct from ad hoc polymorphism (e.g., Haskell type classes)
slide-6
SLIDE 6

Parametric Polymorphic Functions

  • Intuitively, parametric polymorphism captures uniform behavior of

functions across all type instantiations

  • Distinct from ad hoc polymorphism (e.g., Haskell type classes)
  • Uniformity of parametric polymorphic functions means that they

– must be given by a single algorithm that works across all types

slide-7
SLIDE 7

Parametric Polymorphic Functions

  • Intuitively, parametric polymorphism captures uniform behavior of

functions across all type instantiations

  • Distinct from ad hoc polymorphism (e.g., Haskell type classes)
  • Uniformity of parametric polymorphic functions means that they

– must be given by a single algorithm that works across all types – cannot make use of any type-specific operations (e.g., +, ¬)

slide-8
SLIDE 8

Parametric Polymorphic Functions

  • Intuitively, parametric polymorphism captures uniform behavior of

functions across all type instantiations

  • Distinct from ad hoc polymorphism (e.g., Haskell type classes)
  • Uniformity of parametric polymorphic functions means that they

– must be given by a single algorithm that works across all types – cannot make use of any type-specific operations (e.g., +, ¬) – must map related inputs to related outputs

slide-9
SLIDE 9

Syntax and Semantics

  • Syntax: The ∀ type constructor
slide-10
SLIDE 10

Syntax and Semantics

  • Syntax: The ∀ type constructor
  • Semantics: If f : ∀α.τ, then f maps related values to related values

(and similarly for f : τ1 → τ2)

slide-11
SLIDE 11

Syntax and Semantics

  • Syntax: The ∀ type constructor
  • Semantics: If f : ∀α.τ, then f maps related values to related values

(and similarly for f : τ1 → τ2)

  • This semantic “relatedness” requirement ensures that models of para-

metric polymorphism do not contain ad hoc functions

slide-12
SLIDE 12

Syntax and Semantics

  • Syntax: The ∀ type constructor
  • Semantics: If f : ∀α.τ, then f maps related values to related values

(and similarly for f : τ1 → τ2)

  • This semantic “relatedness” requirement ensures that models of para-

metric polymorphism do not contain ad hoc functions

  • That is, it ensures that ∀ really does mean a uniform “for all”!
slide-13
SLIDE 13

Reynolds’ Programme

  • Paper: Types, abstraction, and parametric polymorphism (1983)
slide-14
SLIDE 14

Reynolds’ Programme

  • Paper: Types, abstraction, and parametric polymorphism (1983)
  • Construct: A set-theoretic model of parametric polymorphism for Sys-

tem F by giving, compositionally:

slide-15
SLIDE 15

Reynolds’ Programme

  • Paper: Types, abstraction, and parametric polymorphism (1983)
  • Construct: A set-theoretic model of parametric polymorphism for Sys-

tem F by giving, compositionally: – a set interpretation for every type

slide-16
SLIDE 16

Reynolds’ Programme

  • Paper: Types, abstraction, and parametric polymorphism (1983)
  • Construct: A set-theoretic model of parametric polymorphism for Sys-

tem F by giving, compositionally: – a set interpretation for every type – a relational interpretation for every type

slide-17
SLIDE 17

Reynolds’ Programme

  • Paper: Types, abstraction, and parametric polymorphism (1983)
  • Construct: A set-theoretic model of parametric polymorphism for Sys-

tem F by giving, compositionally: – a set interpretation for every type – a relational interpretation for every type – a set interpretation for every term

slide-18
SLIDE 18

Reynolds’ Programme

  • Paper: Types, abstraction, and parametric polymorphism (1983)
  • Construct: A set-theoretic model of parametric polymorphism for Sys-

tem F by giving, compositionally: – a set interpretation for every type – a relational interpretation for every type – a set interpretation for every term

  • Prove: An Abstraction Theorem
slide-19
SLIDE 19

Reynolds’ Programme

  • Paper: Types, abstraction, and parametric polymorphism (1983)
  • Construct: A set-theoretic model of parametric polymorphism for Sys-

tem F by giving, compositionally: – a set interpretation for every type – a relational interpretation for every type – a set interpretation for every term

  • Prove: An Abstraction Theorem

– Intuitively, if the arguments to a function are related at the rela- tional interpretations of their types, then applying the function to them yields results that are related at the relational interpretation

  • f the function’s return type
slide-20
SLIDE 20

A Caveat and Its Correction

  • However...
slide-21
SLIDE 21

A Caveat and Its Correction

  • However...

... Reynolds discovered that his own construction was flawed!

slide-22
SLIDE 22

A Caveat and Its Correction

  • However...

... Reynolds discovered that his own construction was flawed!

  • Reynolds showed that no set-theoretic model of parametric polymor-

phism for System F can exist in classical set theory

slide-23
SLIDE 23

A Caveat and Its Correction

  • However...

... Reynolds discovered that his own construction was flawed!

  • Reynolds showed that no set-theoretic model of parametric polymor-

phism for System F can exist in classical set theory

  • The next year, Andrew Pitts showed that such models do exist... provided

we work in a constructive set theory

slide-24
SLIDE 24

A Caveat and Its Correction

  • However...

... Reynolds discovered that his own construction was flawed!

  • Reynolds showed that no set-theoretic model of parametric polymor-

phism for System F can exist in classical set theory

  • The next year, Andrew Pitts showed that such models do exist... provided

we work in a constructive set theory

  • Subsequently, a number of models of parametric polymorphism for

System F have been constructed

slide-25
SLIDE 25

A Caveat and Its Correction

  • However...

... Reynolds discovered that his own construction was flawed!

  • Reynolds showed that no set-theoretic model of parametric polymor-

phism for System F can exist in classical set theory

  • The next year, Andrew Pitts showed that such models do exist... provided

we work in a constructive set theory

  • Subsequently, a number of models of parametric polymorphism for

System F have been constructed

  • We’ll see one such model, based on bifibrations
slide-26
SLIDE 26

A Caveat and Its Correction

  • However...

... Reynolds discovered that his own construction was flawed!

  • Reynolds showed that no set-theoretic model of parametric polymor-

phism for System F can exist in classical set theory

  • The next year, Andrew Pitts showed that such models do exist... provided

we work in a constructive set theory

  • Subsequently, a number of models of parametric polymorphism for

System F have been constructed

  • We’ll see one such model, based on bifibrations
  • This model inhabits a “sweet spot” between

– having the simplicity of functorial models, and

slide-27
SLIDE 27

A Caveat and Its Correction

  • However...

... Reynolds discovered that his own construction was flawed!

  • Reynolds showed that no set-theoretic model of parametric polymor-

phism for System F can exist in classical set theory

  • The next year, Andrew Pitts showed that such models do exist... provided

we work in a constructive set theory

  • Subsequently, a number of models of parametric polymorphism for

System F have been constructed

  • We’ll see one such model, based on bifibrations
  • This model inhabits a “sweet spot” between

– having the simplicity of functorial models, and – having enough structure to derive consequences of parametricity that serve as gold standard properties for “good” models

slide-28
SLIDE 28

Type Contexts and Judgements

  • A type context ∆ is a list of type variables α1, ..., αn
slide-29
SLIDE 29

Type Contexts and Judgements

  • A type context ∆ is a list of type variables α1, ..., αn
  • A type judgement ∆ ⊢ τ has

– ∆ a type context – τ a type

slide-30
SLIDE 30

Type Contexts and Judgements

  • A type context ∆ is a list of type variables α1, ..., αn
  • A type judgement ∆ ⊢ τ has

– ∆ a type context – τ a type

  • Type judgements are defined inductively:

αi ∈ ∆ ∆ ⊢ αi ∆ ⊢ τ1 ∆ ⊢ τ2 ∆ ⊢ τ1 → τ2 ∆, α ⊢ τ ∆ ⊢ ∀α.τ

slide-31
SLIDE 31

Type Contexts and Judgements

  • A type context ∆ is a list of type variables α1, ..., αn
  • A type judgement ∆ ⊢ τ has

– ∆ a type context – τ a type

  • Type judgements are defined inductively:

αi ∈ ∆ ∆ ⊢ αi ∆ ⊢ τ1 ∆ ⊢ τ2 ∆ ⊢ τ1 → τ2 ∆, α ⊢ τ ∆ ⊢ ∀α.τ

  • We consider α-convertible types equivalent
slide-32
SLIDE 32

Term Contexts and Judgements - Part I

  • A term context ∆ ⊢ Γ has

– ∆ a type context – x1, ..., xm term variables – Γ of the form x1 : τ1, ..., xm : τm – ∆ ⊢ τi for each i ∈ {1, ..., m}

slide-33
SLIDE 33

Term Contexts and Judgements - Part I

  • A term context ∆ ⊢ Γ has

– ∆ a type context – x1, ..., xm term variables – Γ of the form x1 : τ1, ..., xm : τm – ∆ ⊢ τi for each i ∈ {1, ..., m}

  • A term judgement ∆; Γ ⊢ t : τ has

– ∆ a type context – ∆ ⊢ Γ a term context – ∆ ⊢ τ a type judgement – t a term

slide-34
SLIDE 34

Term Contexts and Judgements - Part II

  • Term judgements are defined inductively:

∆ ⊢ τi xi : τi ∈ Γ ∆; Γ ⊢ xi : τi ∆; Γ, x : τ1 ⊢ t : τ2 ∆; Γ ⊢ λx.t : τ1 → τ2 ∆; Γ ⊢ t1 : τ1 ∆; Γ ⊢ t2 : τ1 → τ2 ∆; Γ ⊢ t2 t1 : τ2 ∆, α; Γ ⊢ t : τ ∆; Γ ⊢ Λα.t : ∀α.τ ∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1]

slide-35
SLIDE 35

Term Contexts and Judgements - Part II

  • Term judgements are defined inductively:

∆ ⊢ τi xi : τi ∈ Γ ∆; Γ ⊢ xi : τi ∆; Γ, x : τ1 ⊢ t : τ2 ∆; Γ ⊢ λx.t : τ1 → τ2 ∆; Γ ⊢ t1 : τ1 ∆; Γ ⊢ t2 : τ1 → τ2 ∆; Γ ⊢ t2 t1 : τ2 ∆, α; Γ ⊢ t : τ ∆; Γ ⊢ Λα.t : ∀α.τ ∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1]

  • Type abstraction requires that α does not appear (free) in Γ
slide-36
SLIDE 36

Term Contexts and Judgements - Part II

  • Term judgements are defined inductively:

∆ ⊢ τi xi : τi ∈ Γ ∆; Γ ⊢ xi : τi ∆; Γ, x : τ1 ⊢ t : τ2 ∆; Γ ⊢ λx.t : τ1 → τ2 ∆; Γ ⊢ t1 : τ1 ∆; Γ ⊢ t2 : τ1 → τ2 ∆; Γ ⊢ t2 t1 : τ2 ∆, α; Γ ⊢ t : τ ∆; Γ ⊢ Λα.t : ∀α.τ ∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1]

  • Type abstraction requires that α does not appear (free) in Γ
  • τ2[α → τ1], t[α → τ1], and t[x → y] denote (capture-free) substitution
slide-37
SLIDE 37

Conversion Rules - Part I

∆; Γ ⊢ λx. t = λy. t[x → y] : τ1 → τ2 (αλ) ∆; Γ ⊢ Λα1. t = Λα2. t[α1 → α2] : ∀α1.τ (αΛ) ∆; Γ ⊢ (λx. t) s = t[x → s] : τ2 (βλ) ∆; Γ ⊢ (Λα. t)τ1 = t : τ2[α → τ1] (βΛ) x / ∈ F V (t) ∆; Γ ⊢ t = λx. t x : τ1 → τ2 (ηλ) α / ∈ F T V (t) ∆; Γ ⊢ t = Λα. t α : ∀α.τ (ηΛ) ∆; Γ, x : τ1 ⊢ t1 = t2 : τ2 ∆; Γ ⊢ λx. t1 = λx. t2 : τ1 → τ2 (ξλ) ∆, α; Γ ⊢ t1 = t2 : τ ∆; Γ ⊢ Λα. t1 = Λα. t2 : ∀α.τ (ξΛ)

slide-38
SLIDE 38

Conversion Rules - Part II

∆; Γ ⊢ t1 = t2 : τ1 → τ2 ∆; Γ ⊢ s1 = s2 : τ1 ∆; Γ ⊢ t1 s1 = t2 s2 : τ2 (congλ) ∆; Γ ⊢ t1 = t2 : ∀α.τ2 ∆; Γ ⊢ t1 τ1 = t2 τ1 : τ2[α → τ1] (congΛ) ∆; Γ ⊢ t = t : τ (refl) ∆; Γ ⊢ s = t : τ ∆; Γ ⊢ t = s : τ (sym) ∆; Γ ⊢ t = s : τ Γ; ∆ ⊢ s = u : τ ∆; Γ ⊢ t = u : τ (trans)

slide-39
SLIDE 39

Reynolds’ Semantics of Types - The Set Up

  • Reynolds defines two “parallel” semantics for System F types ∆ ⊢ τ
slide-40
SLIDE 40

Reynolds’ Semantics of Types - The Set Up

  • Reynolds defines two “parallel” semantics for System F types ∆ ⊢ τ

– an object semantics [ [∆ ⊢ τ] ]o : Set|∆| → Set

slide-41
SLIDE 41

Reynolds’ Semantics of Types - The Set Up

  • Reynolds defines two “parallel” semantics for System F types ∆ ⊢ τ

– an object semantics [ [∆ ⊢ τ] ]o : Set|∆| → Set – a relational semantics [ [∆ ⊢ τ] ]r : Rel|∆| → Rel

slide-42
SLIDE 42

Reynolds’ Semantics of Types - The Set Up

  • Reynolds defines two “parallel” semantics for System F types ∆ ⊢ τ

– an object semantics [ [∆ ⊢ τ] ]o : Set|∆| → Set – a relational semantics [ [∆ ⊢ τ] ]r : Rel|∆| → Rel

  • Write

– S : Set if S is a set – R : Rel if R is a relation – R : Rel(X, Y ) if R is a relation on sets X and Y (i.e., R ⊆ X × Y )

slide-43
SLIDE 43

Reynolds’ Semantics of Types - The Set Up

  • Reynolds defines two “parallel” semantics for System F types ∆ ⊢ τ

– an object semantics [ [∆ ⊢ τ] ]o : Set|∆| → Set – a relational semantics [ [∆ ⊢ τ] ]r : Rel|∆| → Rel

  • Write

– S : Set if S is a set – R : Rel if R is a relation – R : Rel(X, Y ) if R is a relation on sets X and Y (i.e., R ⊆ X × Y )

  • Let

– X be a |∆|-tuple of sets – R be a |∆|-tuple of relations – Ri : Rel(Xi, Yi) for i = 1, ..., |∆| – Eq X = {(x, x) | x ∈ X}

slide-44
SLIDE 44

Reynolds’ Semantics of Types

  • Type variables: [

[∆ ⊢ αi] ]oX = Xi and [ [∆ ⊢ αi] ]rR = Ri

slide-45
SLIDE 45

Reynolds’ Semantics of Types

  • Type variables: [

[∆ ⊢ αi] ]oX = Xi and [ [∆ ⊢ αi] ]rR = Ri

  • Arrow types:

− [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX

slide-46
SLIDE 46

Reynolds’ Semantics of Types

  • Type variables: [

[∆ ⊢ αi] ]oX = Xi and [ [∆ ⊢ αi] ]rR = Ri

  • Arrow types:

− [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX − [ [∆ ⊢ τ1 → τ2] ]rR = {(f, g) | (a, b) ∈ [ [∆ ⊢ τ1] ]rR ⇒ (f a, g b) ∈ [ [∆ ⊢ τ2] ]rR}

slide-47
SLIDE 47

Reynolds’ Semantics of Types

  • Type variables: [

[∆ ⊢ αi] ]oX = Xi and [ [∆ ⊢ αi] ]rR = Ri

  • Arrow types:

− [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX − [ [∆ ⊢ τ1 → τ2] ]rR = {(f, g) | (a, b) ∈ [ [∆ ⊢ τ1] ]rR ⇒ (f a, g b) ∈ [ [∆ ⊢ τ2] ]rR} Here, f ∈ [ [∆ ⊢ τ1 → τ2] ]oX and g ∈ [ [∆ ⊢ τ1 → τ2] ]oY

slide-48
SLIDE 48

Reynolds’ Semantics of Types

  • Type variables: [

[∆ ⊢ αi] ]oX = Xi and [ [∆ ⊢ αi] ]rR = Ri

  • Arrow types:

− [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX − [ [∆ ⊢ τ1 → τ2] ]rR = {(f, g) | (a, b) ∈ [ [∆ ⊢ τ1] ]rR ⇒ (f a, g b) ∈ [ [∆ ⊢ τ2] ]rR} Here, f ∈ [ [∆ ⊢ τ1 → τ2] ]oX and g ∈ [ [∆ ⊢ τ1 → τ2] ]oY

  • Forall types:

− [ [∆ ⊢ ∀α.τ] ]oX = {f :

  • S:Set

[ [∆, α ⊢ τ] ]o(X, S) | ∀R′ : Rel(X′, Y ′) .(fX′, fY ′) ∈ [ [∆, α ⊢ τ] ]r(Eq X, R′)}

slide-49
SLIDE 49

Reynolds’ Semantics of Types

  • Type variables: [

[∆ ⊢ αi] ]oX = Xi and [ [∆ ⊢ αi] ]rR = Ri

  • Arrow types:

− [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX − [ [∆ ⊢ τ1 → τ2] ]rR = {(f, g) | (a, b) ∈ [ [∆ ⊢ τ1] ]rR ⇒ (f a, g b) ∈ [ [∆ ⊢ τ2] ]rR} Here, f ∈ [ [∆ ⊢ τ1 → τ2] ]oX and g ∈ [ [∆ ⊢ τ1 → τ2] ]oY

  • Forall types:

− [ [∆ ⊢ ∀α.τ] ]oX = {f :

  • S:Set

[ [∆, α ⊢ τ] ]o(X, S) | ∀R′ : Rel(X′, Y ′) .(fX′, fY ′) ∈ [ [∆, α ⊢ τ] ]r(Eq X, R′)} − [ [∆ ⊢ ∀α.τ] ]rR = {(f, g) | ∀R′ : Rel(X′, Y ′) . (fX′, gY ′) ∈ [ [∆, α ⊢ τ] ]r(R, R′)}

slide-50
SLIDE 50

Reynolds’ Semantics of Types

  • Type variables: [

[∆ ⊢ αi] ]oX = Xi and [ [∆ ⊢ αi] ]rR = Ri

  • Arrow types:

− [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX − [ [∆ ⊢ τ1 → τ2] ]rR = {(f, g) | (a, b) ∈ [ [∆ ⊢ τ1] ]rR ⇒ (f a, g b) ∈ [ [∆ ⊢ τ2] ]rR} Here, f ∈ [ [∆ ⊢ τ1 → τ2] ]oX and g ∈ [ [∆ ⊢ τ1 → τ2] ]oY

  • Forall types:

− [ [∆ ⊢ ∀α.τ] ]oX = {f :

  • S:Set

[ [∆, α ⊢ τ] ]o(X, S) | ∀R′ : Rel(X′, Y ′) .(fX′, fY ′) ∈ [ [∆, α ⊢ τ] ]r(Eq X, R′)} − [ [∆ ⊢ ∀α.τ] ]rR = {(f, g) | ∀R′ : Rel(X′, Y ′) . (fX′, gY ′) ∈ [ [∆, α ⊢ τ] ]r(R, R′)} Here, f ∈ [ [∆ ⊢ ∀α.τ] ]oX and g ∈ [ [∆ ⊢ ∀α.τ] ]oY

slide-51
SLIDE 51

Some Observations

  • By construction, relational interpretations of functions (on types and
  • n terms) map related inputs to related outputs
slide-52
SLIDE 52

Some Observations

  • By construction, relational interpretations of functions (on types and
  • n terms) map related inputs to related outputs
  • If R : Rel(X, Y ) then [

[∆ ⊢ τ] ]rR : Rel([ [∆ ⊢ τ] ]oX, [ [∆ ⊢ τ] ]oY )

slide-53
SLIDE 53

Some Observations

  • By construction, relational interpretations of functions (on types and
  • n terms) map related inputs to related outputs
  • If R : Rel(X, Y ) then [

[∆ ⊢ τ] ]rR : Rel([ [∆ ⊢ τ] ]oX, [ [∆ ⊢ τ] ]oY )

  • The two interpretations of terms get progressively more intertwined:
slide-54
SLIDE 54

Some Observations

  • By construction, relational interpretations of functions (on types and
  • n terms) map related inputs to related outputs
  • If R : Rel(X, Y ) then [

[∆ ⊢ τ] ]rR : Rel([ [∆ ⊢ τ] ]oX, [ [∆ ⊢ τ] ]oY )

  • The two interpretations of terms get progressively more intertwined:

– The object and relational interpretations of type variables are inde- pendent of one another

slide-55
SLIDE 55

Some Observations

  • By construction, relational interpretations of functions (on types and
  • n terms) map related inputs to related outputs
  • If R : Rel(X, Y ) then [

[∆ ⊢ τ] ]rR : Rel([ [∆ ⊢ τ] ]oX, [ [∆ ⊢ τ] ]oY )

  • The two interpretations of terms get progressively more intertwined:

– The object and relational interpretations of type variables are inde- pendent of one another – The object interpretation of an arrow type does not depend on its relational interpretation, but the relational interpretation of an arrow type does depend on its object interpretation

slide-56
SLIDE 56

Some Observations

  • By construction, relational interpretations of functions (on types and
  • n terms) map related inputs to related outputs
  • If R : Rel(X, Y ) then [

[∆ ⊢ τ] ]rR : Rel([ [∆ ⊢ τ] ]oX, [ [∆ ⊢ τ] ]oY )

  • The two interpretations of terms get progressively more intertwined:

– The object and relational interpretations of type variables are inde- pendent of one another – The object interpretation of an arrow type does not depend on its relational interpretation, but the relational interpretation of an arrow type does depend on its object interpretation – The object and relational interpretations of forall types depend crucially on one another

slide-57
SLIDE 57

Some Observations

  • By construction, relational interpretations of functions (on types and
  • n terms) map related inputs to related outputs
  • If R : Rel(X, Y ) then [

[∆ ⊢ τ] ]rR : Rel([ [∆ ⊢ τ] ]oX, [ [∆ ⊢ τ] ]oY )

  • The two interpretations of terms get progressively more intertwined:

– The object and relational interpretations of type variables are inde- pendent of one another – The object interpretation of an arrow type does not depend on its relational interpretation, but the relational interpretation of an arrow type does depend on its object interpretation – The object and relational interpretations of forall types depend crucially on one another

  • So we do not really have two semantics, but rather a single intercon-

nected semantics!

slide-58
SLIDE 58

Identity Extension Lemma

  • Key for many applications of parametricity
slide-59
SLIDE 59

Identity Extension Lemma

  • Key for many applications of parametricity
  • Intuitively, relational interpretations of types preserve equality
slide-60
SLIDE 60

Identity Extension Lemma

  • Key for many applications of parametricity
  • Intuitively, relational interpretations of types preserve equality
  • Theorem (Identity Extension Lemma) For all ∆ ⊢ τ,

[ [∆ ⊢ τ] ]r (Eq X1, ..., Eq X|∆|) = Eq ([ [∆ ⊢ τ] ]o(X1, ..., X|∆|))

slide-61
SLIDE 61

Reynolds’ Semantics of Terms - The Set Up

  • Object and relational interpretations of term contexts

Γ = x1 : τ1, . . . , xm : τm are given by [ [∆ ⊢ Γ] ]o = [ [∆ ⊢ τ1] ]o × · · · × [ [∆ ⊢ τm] ]o and [ [∆ ⊢ Γ] ]r = [ [∆ ⊢ τ1] ]r × · · · × [ [∆ ⊢ τm] ]r

slide-62
SLIDE 62

Reynolds’ Semantics of Terms - The Set Up

  • Object and relational interpretations of term contexts

Γ = x1 : τ1, . . . , xm : τm are given by [ [∆ ⊢ Γ] ]o = [ [∆ ⊢ τ1] ]o × · · · × [ [∆ ⊢ τm] ]o and [ [∆ ⊢ Γ] ]r = [ [∆ ⊢ τ1] ]r × · · · × [ [∆ ⊢ τm] ]r

  • An object interpretation of each term is a family of functions

[ [∆; Γ ⊢ t : τ] ]oX : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ] ]oX parameterized over a set environment X

slide-63
SLIDE 63

Reynolds’ Semantics of Terms - The Set Up

  • Object and relational interpretations of term contexts

Γ = x1 : τ1, . . . , xm : τm are given by [ [∆ ⊢ Γ] ]o = [ [∆ ⊢ τ1] ]o × · · · × [ [∆ ⊢ τm] ]o and [ [∆ ⊢ Γ] ]r = [ [∆ ⊢ τ1] ]r × · · · × [ [∆ ⊢ τm] ]r

  • An object interpretation of each term is a family of functions

[ [∆; Γ ⊢ t : τ] ]oX : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ] ]oX parameterized over a set environment X

  • We’ll sanity-check the definitions as we go along
slide-64
SLIDE 64

Reynolds’ Semantics of Terms - variables

  • If

∆; Γ ⊢ xi : τi then [ [∆; Γ ⊢ xi : τi] ]o X A = Ai

slide-65
SLIDE 65

Reynolds’ Semantics of Terms - variables

  • If

∆; Γ ⊢ xi : τi then [ [∆; Γ ⊢ xi : τi] ]o X A = Ai

  • This is sensible because we want

[ [∆; Γ ⊢ xi : τi] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ τi] ]o X

slide-66
SLIDE 66

Reynolds’ Semantics of Terms - variables

  • If

∆; Γ ⊢ xi : τi then [ [∆; Γ ⊢ xi : τi] ]o X A = Ai

  • This is sensible because we want

[ [∆; Γ ⊢ xi : τi] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ τi] ]o X and because if A : [ [∆ ⊢ Γ] ]o X, then Ai : [ [∆ ⊢ τi] ]oX

slide-67
SLIDE 67

Reynolds’ Semantics of Terms - term abstractions

  • If

∆; Γ, x : τ1 ⊢ t : τ2 ∆; Γ ⊢ λx.t : τ1 → τ2 then [ [∆; Γ ⊢ λx.t : τ1 → τ2] ]o X A A = [ [∆; Γ, x : τ1 ⊢ t : τ2] ]o X (A, A)

slide-68
SLIDE 68

Reynolds’ Semantics of Terms - term abstractions

  • If

∆; Γ, x : τ1 ⊢ t : τ2 ∆; Γ ⊢ λx.t : τ1 → τ2 then [ [∆; Γ ⊢ λx.t : τ1 → τ2] ]o X A A = [ [∆; Γ, x : τ1 ⊢ t : τ2] ]o X (A, A)

  • This is sensible because we want

[ [∆; Γ ⊢ λx.t : τ1 → τ2] ]o X : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX

slide-69
SLIDE 69

Reynolds’ Semantics of Terms - term abstractions

  • If

∆; Γ, x : τ1 ⊢ t : τ2 ∆; Γ ⊢ λx.t : τ1 → τ2 then [ [∆; Γ ⊢ λx.t : τ1 → τ2] ]o X A A = [ [∆; Γ, x : τ1 ⊢ t : τ2] ]o X (A, A)

  • This is sensible because we want

[ [∆; Γ ⊢ λx.t : τ1 → τ2] ]o X : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ1 → τ2] ]oX = [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX and because the IH gives [ [∆; Γ, x : τ1 ⊢ t : τ2] ]oX : [ [∆ ⊢ Γ] ]oX × [ [∆ ⊢ τ1] ]oX → [ [∆ ⊢ τ2] ]oX

slide-70
SLIDE 70

Reynolds’ Semantics of Terms - term applications

  • If

∆; Γ ⊢ t1 : τ1 ∆; Γ ⊢ t2 : τ1 → τ2 ∆; Γ ⊢ t2 t1 : τ2 then [ [∆; Γ ⊢ t2 t1 : τ2] ]o X A = [ [∆; Γ ⊢ t2 : τ1 → τ2] ]o X A ([ [∆; Γ ⊢ t1 : τ1] ]o X A)

slide-71
SLIDE 71

Reynolds’ Semantics of Terms - term applications

  • If

∆; Γ ⊢ t1 : τ1 ∆; Γ ⊢ t2 : τ1 → τ2 ∆; Γ ⊢ t2 t1 : τ2 then [ [∆; Γ ⊢ t2 t1 : τ2] ]o X A = [ [∆; Γ ⊢ t2 : τ1 → τ2] ]o X A ([ [∆; Γ ⊢ t1 : τ1] ]o X A)

  • This is sensible because we want

[ [∆; Γ ⊢ t2 t1 : τ2] ]o X : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ2] ]oX

slide-72
SLIDE 72

Reynolds’ Semantics of Terms - term applications

  • If

∆; Γ ⊢ t1 : τ1 ∆; Γ ⊢ t2 : τ1 → τ2 ∆; Γ ⊢ t2 t1 : τ2 then [ [∆; Γ ⊢ t2 t1 : τ2] ]o X A = [ [∆; Γ ⊢ t2 : τ1 → τ2] ]o X A ([ [∆; Γ ⊢ t1 : τ1] ]o X A)

  • This is sensible because we want

[ [∆; Γ ⊢ t2 t1 : τ2] ]o X : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ2] ]oX and because the IH gives [ [∆; Γ ⊢ t2 : τ1 → τ2] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ τ1 → τ2] ]o X = [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ1] ]o X → [ [∆ ⊢ τ2] ]o X

slide-73
SLIDE 73

Reynolds’ Semantics of Terms - term applications

  • If

∆; Γ ⊢ t1 : τ1 ∆; Γ ⊢ t2 : τ1 → τ2 ∆; Γ ⊢ t2 t1 : τ2 then [ [∆; Γ ⊢ t2 t1 : τ2] ]o X A = [ [∆; Γ ⊢ t2 : τ1 → τ2] ]o X A ([ [∆; Γ ⊢ t1 : τ1] ]o X A)

  • This is sensible because we want

[ [∆; Γ ⊢ t2 t1 : τ2] ]o X : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ2] ]oX and because the IH gives [ [∆; Γ ⊢ t2 : τ1 → τ2] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ τ1 → τ2] ]o X = [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ1] ]o X → [ [∆ ⊢ τ2] ]o X and [ [∆; Γ ⊢ t1 : τ1] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ τ1] ]oX

slide-74
SLIDE 74

Taking Stock

  • So far, term interpretations are all in the required sets
slide-75
SLIDE 75

Taking Stock

  • So far, term interpretations are all in the required sets
  • But when Reynolds interpreted type abstractions and applications
slide-76
SLIDE 76

Taking Stock

  • So far, term interpretations are all in the required sets
  • But when Reynolds interpreted type abstractions and applications

... and tried to show that term interpretations are in the required sets

slide-77
SLIDE 77

Taking Stock

  • So far, term interpretations are all in the required sets
  • But when Reynolds interpreted type abstractions and applications

... and tried to show that term interpretations are in the required sets ... he ran into problems

slide-78
SLIDE 78

Reynolds’ Semantics of Terms - type abstractions

  • If

∆, α; Γ ⊢ t : τ ∆; Γ ⊢ Λα.t : ∀α.τ then [ [∆; Γ ⊢ Λα.t : ∀α.τ] ]o X A = ΠS:Set[ [∆, α; Γ ⊢ t : τ] ]o (X, S) A

slide-79
SLIDE 79

Reynolds’ Semantics of Terms - type abstractions

  • If

∆, α; Γ ⊢ t : τ ∆; Γ ⊢ Λα.t : ∀α.τ then [ [∆; Γ ⊢ Λα.t : ∀α.τ] ]o X A = ΠS:Set[ [∆, α; Γ ⊢ t : τ] ]o (X, S) A

  • This is sensible because we want

[ [∆; Γ ⊢ Λα.t : ∀α.τ] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ ∀α.τ] ]o X = [ [∆ ⊢ Γ] ]o X → {f : ΠS:Set[ [∆, α ⊢ τ] ]o(X, S) | ...}

slide-80
SLIDE 80

Reynolds’ Semantics of Terms - type abstractions

  • If

∆, α; Γ ⊢ t : τ ∆; Γ ⊢ Λα.t : ∀α.τ then [ [∆; Γ ⊢ Λα.t : ∀α.τ] ]o X A = ΠS:Set[ [∆, α; Γ ⊢ t : τ] ]o (X, S) A

  • This is sensible because we want

[ [∆; Γ ⊢ Λα.t : ∀α.τ] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ ∀α.τ] ]o X = [ [∆ ⊢ Γ] ]o X → {f : ΠS:Set[ [∆, α ⊢ τ] ]o(X, S) | ...} and because α not free in Γ implies [ [∆, α; Γ ⊢ t : τ] ]o (X, S) : [ [∆, α ⊢ Γ] ]o (X, S) → [ [∆, α ⊢ τ] ]o (X, S) = [ [∆ ⊢ Γ] ]o X → [ [∆, α ⊢ τ] ]o (X, S)

slide-81
SLIDE 81

Reynolds’ Semantics of Terms - type abstractions

  • If

∆, α; Γ ⊢ t : τ ∆; Γ ⊢ Λα.t : ∀α.τ then [ [∆; Γ ⊢ Λα.t : ∀α.τ] ]o X A = ΠS:Set[ [∆, α; Γ ⊢ t : τ] ]o (X, S) A

  • This is sensible because we want

[ [∆; Γ ⊢ Λα.t : ∀α.τ] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ ∀α.τ] ]o X = [ [∆ ⊢ Γ] ]o X → {f : ΠS:Set[ [∆, α ⊢ τ] ]o(X, S) | ...} and because α not free in Γ implies [ [∆, α; Γ ⊢ t : τ] ]o (X, S) : [ [∆, α ⊢ Γ] ]o (X, S) → [ [∆, α ⊢ τ] ]o (X, S) = [ [∆ ⊢ Γ] ]o X → [ [∆, α ⊢ τ] ]o (X, S)

  • But now we’d have to check that the condition after the vertical bar

in the set interpretation of a ∀-type holds...

slide-82
SLIDE 82

Reynolds’ Semantics of Terms - type applications

  • If

∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1] then [ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]o X A = [ [∆; Γ ⊢ t : ∀α.τ2] ]o X A ([ [∆ ⊢ τ1] ]o X)

slide-83
SLIDE 83

Reynolds’ Semantics of Terms - type applications

  • If

∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1] then [ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]o X A = [ [∆; Γ ⊢ t : ∀α.τ2] ]o X A ([ [∆ ⊢ τ1] ]o X)

  • This is sensible because we want

[ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]oX : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ2[α → τ1]] ]oX

slide-84
SLIDE 84

Reynolds’ Semantics of Terms - type applications

  • If

∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1] then [ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]o X A = [ [∆; Γ ⊢ t : ∀α.τ2] ]o X A ([ [∆ ⊢ τ1] ]o X)

  • This is sensible because we want

[ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]oX : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ2[α → τ1]] ]oX and because [ [∆; Γ ⊢ t : ∀α.τ2] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ ∀α.τ2] ]o X = [ [∆ ⊢ Γ] ]o X → {f : ΠS:Set[ [∆, α ⊢ τ2] ]o(X, S)|...}

slide-85
SLIDE 85

Reynolds’ Semantics of Terms - type applications

  • If

∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1] then [ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]o X A = [ [∆; Γ ⊢ t : ∀α.τ2] ]o X A ([ [∆ ⊢ τ1] ]o X)

  • This is sensible because we want

[ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]oX : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ2[α → τ1]] ]oX and because [ [∆; Γ ⊢ t : ∀α.τ2] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ ∀α.τ2] ]o X = [ [∆ ⊢ Γ] ]o X → {f : ΠS:Set[ [∆, α ⊢ τ2] ]o(X, S)|...}

  • To type-check this, we’d need to show

[ [∆; Γ ⊢ t : ∀α.τ2] ]o X A ([ [∆ ⊢ τ1] ]o X) : [ [∆ ⊢ τ2[α → τ1]] ]o X

slide-86
SLIDE 86

Reynolds’ Semantics of Terms - type applications

  • If

∆; Γ ⊢ t : ∀α.τ2 ∆ ⊢ τ1 ∆; Γ ⊢ t τ1 : τ2[α → τ1] then [ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]o X A = [ [∆; Γ ⊢ t : ∀α.τ2] ]o X A ([ [∆ ⊢ τ1] ]o X)

  • This is sensible because we want

[ [∆; Γ ⊢ t τ1 : τ2[α → τ1]] ]oX : [ [∆ ⊢ Γ] ]oX → [ [∆ ⊢ τ2[α → τ1]] ]oX and because [ [∆; Γ ⊢ t : ∀α.τ2] ]o X : [ [∆ ⊢ Γ] ]o X → [ [∆ ⊢ ∀α.τ2] ]o X = [ [∆ ⊢ Γ] ]o X → {f : ΠS:Set[ [∆, α ⊢ τ2] ]o (X, S)|...}

  • To type-check this, we’d need to show

[ [∆; Γ ⊢ t : ∀α.τ2] ]o X A ([ [∆ ⊢ τ1] ]o X) : [ [∆ ⊢ τ2[α → τ1]] ]o X

  • But this assumes the interpretation of type abstractions is sensible...
slide-87
SLIDE 87

What About Type Abstractions and Applications?

  • Due to size considerations, Reynolds cannot interpret ∀α.τ as a set of

the form ΠS∈SetS for the usual set-theoretic product

slide-88
SLIDE 88

What About Type Abstractions and Applications?

  • Due to size considerations, Reynolds cannot interpret ∀α.τ as a set of

the form ΠS∈SetS for the usual set-theoretic product – α would have to range over all sets interpreting types... including the set interpreting ∀α.τ!

slide-89
SLIDE 89

What About Type Abstractions and Applications?

  • Due to size considerations, Reynolds cannot interpret ∀α.τ as a set of

the form ΠS∈SetS for the usual set-theoretic product – α would have to range over all sets interpreting types... including the set interpreting ∀α.τ! – This is impossible!

slide-90
SLIDE 90

What About Type Abstractions and Applications?

  • Due to size considerations, Reynolds cannot interpret ∀α.τ as a set of

the form ΠS∈SetS for the usual set-theoretic product – α would have to range over all sets interpreting types... including the set interpreting ∀α.τ! – This is impossible!

  • Idea: Maybe a weaker notion of “large” product can interpret ∀α.τ

while still preserving the usual binary product and function space?

slide-91
SLIDE 91

What About Type Abstractions and Applications?

  • Due to size considerations, Reynolds cannot interpret ∀α.τ as a set of

the form ΠS∈SetS for the usual set-theoretic product – α would have to range over all sets interpreting types... including the set interpreting ∀α.τ! – This is impossible!

  • Idea: Maybe a weaker notion of “large” product can interpret ∀α.τ

while still preserving the usual binary product and function space?

  • In order to exclude ad hoc polymorphic functions from his model,

Reynolds restricts it by imposing a so-called parametricity property

slide-92
SLIDE 92

What About Type Abstractions and Applications?

  • Due to size considerations, Reynolds cannot interpret ∀α.τ as a set of

the form ΠS∈SetS for the usual set-theoretic product – α would have to range over all sets interpreting types... including the set interpreting ∀α.τ! – This is impossible!

  • Idea: Maybe a weaker notion of “large” product can interpret ∀α.τ

while still preserving the usual binary product and function space?

  • In order to exclude ad hoc polymorphic functions from his model,

Reynolds restricts it by imposing a so-called parametricity property

  • This leads to the interpretations we have seen
slide-93
SLIDE 93

What About Type Abstractions and Applications?

  • Due to size considerations, Reynolds cannot interpret ∀α.τ as a set of

the form ΠS∈SetS for the usual set-theoretic product – α would have to range over all sets interpreting types... including the set interpreting ∀α.τ! – This is impossible!

  • Idea: Maybe a weaker notion of “large” product can interpret ∀α.τ

while still preserving the usual binary product and function space?

  • In order to exclude ad hoc polymorphic functions from his model,

Reynolds restricts it by imposing a so-called parametricity property

  • This leads to the interpretations we have seen
  • Conjecturing that these definitions give a sensible model, Reynolds

proves his Abstraction Theorem

slide-94
SLIDE 94

Problems in Parametricity Paradise

  • The next year Reynolds discovered that there can be no set model of

System F in which – × is interpreted as the usual binary product – → is the interpreted as the usual function space – ∀α.τ is interpreted as a possibly restricted “large” product

slide-95
SLIDE 95

Problems in Parametricity Paradise

  • The next year Reynolds discovered that there can be no set model of

System F in which – × is interpreted as the usual binary product – → is the interpreted as the usual function space – ∀α.τ is interpreted as a possibly restricted “large” product

  • This is the case no matter what notion of “parametric” is used to

restrict “large” products to exclude ad hoc functions!

slide-96
SLIDE 96

Problems in Parametricity Paradise

  • The next year Reynolds discovered that there can be no set model of

System F in which – × is interpreted as the usual binary product – → is the interpreted as the usual function space – ∀α.τ is interpreted as a possibly restricted “large” product

  • This is the case no matter what notion of “parametric” is used to

restrict “large” products to exclude ad hoc functions!

  • Reynolds proved this working in a classical set theory
slide-97
SLIDE 97

Problems in Parametricity Paradise

  • The next year Reynolds discovered that there can be no set model of

System F in which – × is interpreted as the usual binary product – → is the interpreted as the usual function space – ∀α.τ is interpreted as a possibly restricted “large” product

  • This is the case no matter what notion of “parametric” is used to

restrict “large” products to exclude ad hoc functions!

  • Reynolds proved this working in a classical set theory
  • In 1987, Andrew Pitts showed that set models of System F do exist in

constructive set theories

slide-98
SLIDE 98

Problems in Parametricity Paradise

  • The next year Reynolds discovered that there can be no set model of

System F in which – × is interpreted as the usual binary product – → is the interpreted as the usual function space – ∀α.τ is interpreted as a possibly restricted “large” product

  • This is the case no matter what notion of “parametric” is used to

restrict “large” products to exclude ad hoc functions!

  • Reynolds proved this working in a classical set theory
  • In 1987, Andrew Pitts showed that set models of System F do exist in

constructive set theories

  • We won’t look at constructive set models of System F in this course
slide-99
SLIDE 99

Problems in Parametricity Paradise

  • The next year Reynolds discovered that there can be no set model of

System F in which – × is interpreted as the usual binary product – → is the interpreted as the usual function space – ∀α.τ is interpreted as a possibly restricted “large” product

  • This is the case no matter what notion of “parametric” is used to

restrict “large” products to exclude ad hoc functions!

  • Reynolds proved this working in a classical set theory
  • In 1987, Andrew Pitts showed that set models of System F do exist in

constructive set theories

  • We won’t look at constructive set models of System F in this course
  • Instead, we’ll just draw inspiration from Reynolds’ ideas
slide-100
SLIDE 100

The Abstraction Theorem

  • Formalizes uniformity of parametric polymorphism
slide-101
SLIDE 101

The Abstraction Theorem

  • Formalizes uniformity of parametric polymorphism
  • Intuitively, every (interpretation of every) term is related to itself by

the relational interpretation of its type

slide-102
SLIDE 102

The Abstraction Theorem

  • Formalizes uniformity of parametric polymorphism
  • Intuitively, every (interpretation of every) term is related to itself by

the relational interpretation of its type

  • Theorem (Abstraction Theorem) Let X, Y : Set|∆|, R : Rel|∆|(X, Y ),

A ∈ [ [∆ ⊢ Γ] ]oX, and B ∈ [ [∆ ⊢ Γ] ]oY . For all ∆; Γ ⊢ t : τ, if (A, B) ∈ [ [∆ ⊢ Γ] ]rR then ([ [∆; Γ ⊢ t : τ] ]o X A, [ [∆; Γ ⊢ t : τ] ]o Y B) ∈ [ [∆ ⊢ τ] ]rR

slide-103
SLIDE 103

The Abstraction Theorem

  • Formalizes uniformity of parametric polymorphism
  • Intuitively, every (interpretation of every) term is related to itself by

the relational interpretation of its type

  • Theorem (Abstraction Theorem) Let X, Y : Set|∆|, R : Rel|∆|(X, Y ),

A ∈ [ [∆ ⊢ Γ] ]oX, and B ∈ [ [∆ ⊢ Γ] ]oY . For all ∆; Γ ⊢ t : τ, if (A, B) ∈ [ [∆ ⊢ Γ] ]rR then ([ [∆; Γ ⊢ t : τ] ]o X A, [ [∆; Γ ⊢ t : τ] ]o Y B) ∈ [ [∆ ⊢ τ] ]rR

  • This doesn’t make complete sense because of missing interpretations...
slide-104
SLIDE 104

The Abstraction Theorem

  • Formalizes uniformity of parametric polymorphism
  • Intuitively, every (interpretation of every) term is related to itself by

the relational interpretation of its type

  • Theorem (Abstraction Theorem) Let X, Y : Set|∆|, R : Rel|∆|(X, Y ),

A ∈ [ [∆ ⊢ Γ] ]oX, and B ∈ [ [∆ ⊢ Γ] ]oY . For all ∆; Γ ⊢ t : τ, if (A, B) ∈ [ [∆ ⊢ Γ] ]rR then ([ [∆; Γ ⊢ t : τ] ]o X A, [ [∆; Γ ⊢ t : τ] ]o Y B) ∈ [ [∆ ⊢ τ] ]rR

  • This doesn’t make complete sense because of missing interpretations...
  • ... but a model of System F in which the Abstraction Theorem and

Identity Extension Lemma hold is what Reynolds was aiming for

slide-105
SLIDE 105

Coming Up

  • Introduction to (bi)fibrations
slide-106
SLIDE 106

Coming Up

  • Introduction to (bi)fibrations
  • View Reynolds’ construction and results through the lens of the rela-

tions (bi)fibration on Set

slide-107
SLIDE 107

Coming Up

  • Introduction to (bi)fibrations
  • View Reynolds’ construction and results through the lens of the rela-

tions (bi)fibration on Set

  • Generalize Reynolds’ constructions to (bi)fibrational models of Sys-

tem F for which we can prove (fibrational versions of) the IEL and Abstraction Theorem

slide-108
SLIDE 108

Coming Up

  • Introduction to (bi)fibrations
  • View Reynolds’ construction and results through the lens of the rela-

tions (bi)fibration on Set

  • Generalize Reynolds’ constructions to (bi)fibrational models of Sys-

tem F for which we can prove (fibrational versions of) the IEL and Abstraction Theorem

  • Reynolds’ construction is (ignoring size issues) such a model
slide-109
SLIDE 109

References

  • Types, abstraction, and parametric polymorphism. J. Reynolds. In-

formation Processing, 1983.

  • Polymorphism is not set-theoretic. J. Reynolds. Semantics of Data

Types, 1984.

  • Polymorphism is set-theoretic, constructively. A. Pitts. CTCS’84.