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
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:
cs.appstate.edu/
∼johannp
OPLSS 2016
Topic: Reynolds’ theory of parametric polymorphism for System F Goals: - extract the fibrational essence of Reynolds’ theory
Topic: Reynolds’ theory of parametric polymorphism for System F Goals: - extract the fibrational essence of Reynolds’ theory
for System F we will develop
for System F we will develop
tions (bi)fibration on Set
for System F we will develop
tions (bi)fibration on Set
F for which we can prove (bifibrational versions of) the IEL and Ab- straction Theorem
for System F we will develop
tions (bi)fibration on Set
F for which we can prove (bifibrational versions of) the IEL and Ab- straction Theorem
– B is the base category of U – E is the total category of U
– B is the base category of U – E is the total category of U Intuitively, E =
B∈B EB
– B is the base category of U – E is the total category of U Intuitively, E =
B∈B EB
– B is the base category of U – E is the total category of U Intuitively, E =
B∈B EB
type-indexed
– B is a set I of indices, – E is X =
i∈I Xi, where (Xi)i∈I is a (wlog, disjoint) family of sets
– U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ Xi
– B is a set I of indices, – E is X =
i∈I Xi, where (Xi)i∈I is a (wlog, disjoint) family of sets
– U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ Xi
– B is a set I of indices, – E is X =
i∈I Xi, where (Xi)i∈I is a (wlog, disjoint) family of sets
– U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ Xi
X
U
– B is a set I of indices, – E is X =
i∈I Xi, where (Xi)i∈I is a (wlog, disjoint) family of sets
– U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ Xi
X
U
Xi = U −1(i) = {x ∈ X| Ux = i} is called the fibre of X over i
– An object in Set/I is a function U : X → I in Set
– An object in Set/I is a function U : X → I in Set – A morphism from U ′ : X′ → I and U : X → I in Set/I is a function g : X′ → X in Set such that U ◦ g = U ′ X′
g
U
– An object in Set/I is a function U : X → I in Set – A morphism from U ′ : X′ → I and U : X → I in Set/I is a function g : X′ → X in Set such that U ◦ g = U ′ X′
g
U
i → Xi
– An object in Set/I is a function U : X → I in Set – A morphism from U ′ : X′ → I and U : X → I in Set/I is a function g : X′ → X in Set such that U ◦ g = U ′ X′
g
U
i → Xi
– An object of Set→ is a function U : X → I in Set for some index set I
– An object of Set→ is a function U : X → I in Set for some index set I – A morphism from U ′ : Y → J to U : X → I in Set→ is a pair (g : Y → X, f : J → I) of functions in Set such that U ◦ g = f ◦ U ′ Y
g
U
f
I
– An object of Set→ is a function U : X → I in Set for some index set I – A morphism from U ′ : Y → J to U : X → I in Set→ is a pair (g : Y → X, f : J → I) of functions in Set such that U ◦ g = f ◦ U ′ Y
g
U
f
I
(since g(y) ∈ U −1(f(j)) for any y ∈ Yj = U ′−1(j) )
– An object of Set→ is a function U : X → I in Set for some index set I – A morphism from U ′ : Y → J to U : X → I in Set→ is a pair (g : Y → X, f : J → I) of functions in Set such that U ◦ g = f ◦ U ′ Y
g
U
f
I
(since g(y) ∈ U −1(f(j)) for any y ∈ Yj = U ′−1(j) )
– An object of Set→ is a function U : X → I in Set for some index set I – A morphism from U ′ : Y → J to U : X → I in Set→ is a pair (g : Y → X, f : J → I) of functions in Set such that U ◦ g = f ◦ U ′ Y
g
U
f
I
(since g(y) ∈ U −1(f(j)) for any y ∈ Yj = U ′−1(j) )
U : X → I to I and (g, f) to f
(Yj)j∈J such that Yj = Xf(j)
(Yj)j∈J such that Yj = Xf(j)
Y
g
U
f
I
(Yj)j∈J such that Yj = Xf(j)
Y
g
U
f
I
(Yj)j∈J such that Yj = Xf(j)
Y
g
U
f
I
Yj = U ′−1(j) = {x ∈ X | U(x) = f(j)} = U −1(f(j)) = Xf(j)
(Yj)j∈J such that Yj = Xf(j)
Y
g
U
f
I
Yj = U ′−1(j) = {x ∈ X | U(x) = f(j)} = U −1(f(j)) = Xf(j)
j∈{∗} Yj = Y∗ = Xi
j∈{∗} Yj = Y∗ = Xi
Yj = U ′−1(j) = {x ∈ X | U(x) = ∗} = U −1(∗) = X∗ = X
Yj = U ′−1(j) = {x ∈ X | U(x) = ∗} = U −1(∗) = X∗ = X
j∈J Yj = J × X (since the Yj are disjoint)
Y(i,j) = U ′−1(i, j) = {x ∈ X | U(x) = i} = U −1(i) = Xi
Y(i,j) = U ′−1(i, j) = {x ∈ X | U(x) = i} = U −1(i) = Xi
(i,j)∈I×J Y(i,j) = (i,j)∈I×J Xi = Xi × J
Y(i,j) = U ′−1(i, j) = {x ∈ X | U(x) = i} = U −1(i) = Xi
(i,j)∈I×J Y(i,j) = (i,j)∈I×J Xi = Xi × J
Y(i,j) = U ′−1(i, j) = {x ∈ X | U(x) = i} = U −1(i) = Xi
(i,j)∈I×J Y(i,j) = (i,j)∈I×J Xi = Xi × J
Yi = U ′−1(i) = {x ∈ X | U(x) = (i, i)} = U −1(i, i) = X(i,i)
Yi = U ′−1(i) = {x ∈ X | U(x) = (i, i)} = U −1(i, i) = X(i,i)
i∈I Yi = (i,i)∈I×I X(i,i)
Yi = U ′−1(i) = {x ∈ X | U(x) = (i, i)} = U −1(i, i) = X(i,i)
i∈I Yi = (i,i)∈I×I X(i,i)
(i,i′)∈I×I X(i,i′) to the diagonal i = i′
Yi = U ′−1(i) = {x ∈ X | U(x) = (i, i)} = U −1(i, i) = X(i,i)
i∈I Yi = (i,i)∈I×I X(i,i)
(i,i′)∈I×I X(i,i′) to the diagonal i = i′
Y
g
U
f
I
is a morphism from f ∗(U) to U in the arrow category Set→
Y
g
U
f
I
is a morphism from f ∗(U) to U in the arrow category Set→
– U ′′ : Z → K is any object in Set→ – (g′, f ′) : U ′′ → U is a morphism in Set→ – f ′ : K → I factors through f : J → I via v : K → J (i.e., f ′ = f ◦v) Z
g′
g
U
f ′
J
f
I
– U ′′ : Z → K is any object in Set→ – (g′, f ′) : U ′′ → U is a morphism in Set→ – f ′ : K → I factors through f : J → I via v : K → J (i.e., f ′ = f ◦v) then there exists a unique h : Z → Y in Set→ such that – cod(h, v) = v for cod : Set→ → Set – g ◦ h = g′ Z
g′
g
U
f ′
J
f
I
– U ′′ : Z → K is any object in Set→ – (g′, f ′) : U ′′ → U is a morphism in Set→ – f ′ : K → I factors through f : J → I via v : K → J (i.e., f ′ = f ◦v) then there exists a unique h : Z → Y in Set→ such that – cod(h, v) = v for cod : Set→ → Set – g ◦ h = g′ Z
g′
g
U
f ′
J
f
I
– U ′′ : Z → K is any object in Set→ – (g′, f ′) : U ′′ → U is a morphism in Set→ – f ′ : K → I factors through f : J → I via v : K → J (i.e., f ′ = f ◦v) then there exists a unique h : Z → Y in Set→ such that – cod(h, v) = v for cod : Set→ → Set – g ◦ h = g′ Z
g′
g
U
f ′
J
f
I
Set→ → Set a fibration
– Ug = f
– Ug = f – for every g′ : Q′ → P in E with Ug′ = f ◦ v for some v : UQ′ → X, there exists a unique h : Q′ → Q with Uh = v and g′ = g ◦ h
– Ug = f – for every g′ : Q′ → P in E with Ug′ = f ◦ v for some v : UQ′ → X, there exists a unique h : Q′ → Q with Uh = v and g′ = g ◦ h E
U
h
g
P
UQ′
v
X
f
Y
– Ug = f
– Ug = f – for every g′ : P → Q′ in E with Ug′ = v ◦ f for some v : Y → UQ′, there exists a unique h : Q → Q′ with Uh = v and g′ = h ◦ g
– Ug = f – for every g′ : P → Q′ in E with Ug′ = v ◦ f for some v : Y → UQ′, there exists a unique h : Q → Q′ with Uh = v and g′ = h ◦ g E
U
h
Q
g
P
P
g′
Q
h
v
B X
f
Y
X
Ug′
Y
v
P is the cartesian morphism over f with codomain P
P is the cartesian morphism over f with codomain P
§ is the opcartesian morphism over f with domain P
P is the cartesian morphism over f with codomain P
§ is the opcartesian morphism over f with domain P
P
P is the cartesian morphism over f with codomain P
§ is the opcartesian morphism over f with domain P
P
§
UP in B, there is a cartesian morphism f §
P : Q → P in E over f
UP in B, there is a cartesian morphism f §
P : Q → P in E over f
f : UP → Y in B, there is an opcartesian morphism f P
§ : P → Q in E
UP in B, there is a cartesian morphism f §
P : Q → P in E over f
f : UP → Y in B, there is an opcartesian morphism f P
§ : P → Q in E
UP in B, there is a cartesian morphism f §
P : Q → P in E over f
f : UP → Y in B, there is an opcartesian morphism f P
§ : P → Q in E
P in E is over its image UP and similarly for morphisms
UP in B, there is a cartesian morphism f §
P : Q → P in E over f
f : UP → Y in B, there is an opcartesian morphism f P
§ : P → Q in E
P in E is over its image UP and similarly for morphisms
UP in B, there is a cartesian morphism f §
P : Q → P in E over f
f : UP → Y in B, there is an opcartesian morphism f P
§ : P → Q in E
P in E is over its image UP and similarly for morphisms
dexing functor f ∗ : EY → EX along f mapping each k : P → P ′ in EY to the (unique) morphism f ∗k such that k ◦ f §
P = f § P ′ ◦ f ∗k
U E f ∗ B f X Y
dexing functor f ∗ : EY → EX along f mapping each k : P → P ′ in EY to the (unique) morphism f ∗k such that k ◦ f §
P = f § P ′ ◦ f ∗k
dexing functor Σf : EX → EY along f mapping each k : P → P ′ in EX to the (unique) morphism Σfk such that Σfk ◦ f P
§ = f P ′ §
U E f ∗ Σf B f X Y
U : E → B to |E|
U : E → B to |E|
U : E → B to |E|
U n(X1, ..., Xn) = (UX1, ..., UXn) and U n(f1, ..., fn) = (Uf1, ..., Ufn)
U : E → B to |E|
U n(X1, ..., Xn) = (UX1, ..., UXn) and U n(f1, ..., fn) = (Uf1, ..., Ufn)
called the discrete fibration for U
Fo : B′ → B and Fr : E′ → E such that
Fo : B′ → B and Fr : E′ → E such that – U ◦ Fr = Fo ◦ U ′ E′
Fr
U
Fo
B
Fo : B′ → B and Fr : E′ → E such that – U ◦ Fr = Fo ◦ U ′ E′
Fr
U
Fo
B
– cartesian morphisms are preserved, i.e., if f in E′ is cartesian over g in B′ then Frf in E is cartesian over Fog in B
transformations ηo : F ′
and ηr : F ′
r → Fr
transformations ηo : F ′
and ηr : F ′
r → Fr
such that U ◦ ηr = ηo ◦ U ′
transformations ηo : F ′
and ηr : F ′
r → Fr
such that U ◦ ηr = ηo ◦ U ′ F ′
rX U′
rf
U
rY ηrY
FrY
F ′
ηoUX
FoUf
ηoUY
FoUY
tions (bi)fibration on Set
tions (bi)fibration on Set
tem F for which we can prove (fibrational versions of) the IEL and Abstraction Theorem Reynolds’ construction is (ignoring size issues) an instance
tions (bi)fibration on Set
tem F for which we can prove (fibrational versions of) the IEL and Abstraction Theorem Reynolds’ construction is (ignoring size issues) an instance
N. Ghani, P. Johann, F. Nordvall Forsberg, F. Orsanigo, and T. Revell. MFPS’15.