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: 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
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
Where Were We? • Last time we recalled Reynolds’ standard relational parametricity
Where Were We? • Last time we recalled Reynolds’ standard relational parametricity • This is the main inspiration for the bifibrational model of parametricity for System F we will develop
Where Were We? • Last time we recalled Reynolds’ standard relational parametricity • This is the main inspiration for the bifibrational model of parametricity for System F we will develop • View Reynolds’ construction and results through the lens of the rela- tions (bi)fibration on Set
Where Were We? • Last time we recalled Reynolds’ standard relational parametricity • This is the main inspiration for the bifibrational model of parametricity for System F we will develop • View Reynolds’ construction and results through the lens of the rela- tions (bi)fibration on Set • Generalize Reynolds’ constructions to bifibrational models of System F for which we can prove (bifibrational versions of) the IEL and Ab- straction Theorem
Where Were We? • Last time we recalled Reynolds’ standard relational parametricity • This is the main inspiration for the bifibrational model of parametricity for System F we will develop • View Reynolds’ construction and results through the lens of the rela- tions (bi)fibration on Set • Generalize Reynolds’ constructions to bifibrational models of System F for which we can prove (bifibrational versions of) the IEL and Ab- straction Theorem • Reynolds’ construction is (ignoring size issues) such a model
Motivation: Indexed Families of Sets • A fibration captures a family ( E B ) B ∈B of categories E B indexed over objects of a(nother) category B
Motivation: Indexed Families of Sets • A fibration captures a family ( E B ) B ∈B of categories E B indexed over objects of a(nother) category B • A fibration is a functor U : E → B – B is the base category of U – E is the total category of U
Motivation: Indexed Families of Sets • A fibration captures a family ( E B ) B ∈B of categories E B indexed over objects of a(nother) category B • A fibration is a functor U : E → B – B is the base category of U – E is the total category of U Intuitively, E = � B ∈B E B
Motivation: Indexed Families of Sets • A fibration captures a family ( E B ) B ∈B of categories E B indexed over objects of a(nother) category B • A fibration is a functor U : E → B – B is the base category of U – E is the total category of U Intuitively, E = � B ∈B E B • U must have some additional properties for describing indexing
Motivation: Indexed Families of Sets • A fibration captures a family ( E B ) B ∈B of categories E B indexed over objects of a(nother) category B • A fibration is a functor U : E → B – B is the base category of U – E is the total category of U Intuitively, E = � B ∈B E B • U must have some additional properties for describing indexing • We are interested in indexing because Reynolds’ interpretations are type-indexed
Display Maps • Simple case: Indexing for sets – B is a set I of indices, – E is X = � i ∈ I X i , where ( X i ) i ∈ I is a (wlog, disjoint) family of sets – U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ X i
Display Maps • Simple case: Indexing for sets – B is a set I of indices, – E is X = � i ∈ I X i , where ( X i ) i ∈ I is a (wlog, disjoint) family of sets – U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ X i • U is called the display map for ( X i ) i ∈ I
� Display Maps • Simple case: Indexing for sets – B is a set I of indices, – E is X = � i ∈ I X i , where ( X i ) i ∈ I is a (wlog, disjoint) family of sets – U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ X i • U is called the display map for ( X i ) i ∈ I • It is customary to draw it vertically, like this: X U I
� Display Maps • Simple case: Indexing for sets – B is a set I of indices, – E is X = � i ∈ I X i , where ( X i ) i ∈ I is a (wlog, disjoint) family of sets – U : X → I maps each x ∈ X to the index i ∈ I such that x ∈ X i • U is called the display map for ( X i ) i ∈ I • It is customary to draw it vertically, like this: X U I • The set X i = U − 1 ( i ) = { x ∈ X | Ux = i } is called the fibre of X over i
Categories from Indexed Families - Example I • The slice category Set /I
Categories from Indexed Families - Example I • The slice category Set /I – An object in Set /I is a function U : X → I in Set
� � � Categories from Indexed Families - Example I • The slice category Set /I – 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 ′ g X ′ X U ′ U I
� � � Categories from Indexed Families - Example I • The slice category Set /I – 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 ′ g X ′ X U ′ U I • We can view g as a family of functions ( g i ) i ∈ I , where g i : X ′ i → X i
� � � Categories from Indexed Families - Example I • The slice category Set /I – 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 ′ g X ′ X U ′ U I • We can view g as a family of functions ( g i ) i ∈ I , where g i : X ′ i → X i • Identities and composition are inherited from Set
Categories from Indexed Families - Example II • The arrow category Set →
Categories from Indexed Families - Example II • The arrow category Set → – An object of Set → is a function U : X → I in Set for some index set I
� � � Categories from Indexed Families - Example II • The arrow category Set → – 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 ′ g Y X U ′ U f � I J
� � � Categories from Indexed Families - Example II • The arrow category Set → – 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 ′ g Y X U ′ U f � I J • We can view g as a family of functions ( g j ) j ∈ J , where g j : Y j → X f ( j ) (since g ( y ) ∈ U − 1 ( f ( j )) for any y ∈ Y j = U ′− 1 ( j ) )
� � � Categories from Indexed Families - Example II • The arrow category Set → – 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 ′ g Y X U ′ U f � I J • We can view g as a family of functions ( g j ) j ∈ J , where g j : Y j → X f ( j ) (since g ( y ) ∈ U − 1 ( f ( j )) for any y ∈ Y j = U ′− 1 ( j ) ) • Identities and composition are componentwise inherited from Set .
� � � Categories from Indexed Families - Example II • The arrow category Set → – 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 ′ g Y X U ′ U f � I J • We can view g as a family of functions ( g j ) j ∈ J , where g j : Y j → X f ( j ) (since g ( y ) ∈ U − 1 ( f ( j )) for any y ∈ Y j = U ′− 1 ( j ) ) • Identities and composition are componentwise inherited from Set . • Set → induces a codomain functor cod : Set → → Set mapping U : X → I to I and ( g, f ) to f
Substitution • Consider U : X → I for X = ( X i ) i ∈ I for some index set I
Substitution • Consider U : X → I for X = ( X i ) i ∈ I for some index set I • Substitution along f : J → I turns the family ( X i ) i ∈ I into a family ( Y j ) j ∈ J such that Y j = X f ( j )
Recommend
More recommend