## Relational parametricity for references and recursive types (2009)

Venue: | In Proceedings Fourth ACM Workshop on Types in Language Design and Implementation, TLDI’09 |

Citations: | 11 - 4 self |

### BibTeX

@INPROCEEDINGS{Birkedal09relationalparametricity,

author = {Lars Birkedal and Kristian Støvring and Jacob Thamsborg},

title = {Relational parametricity for references and recursive types},

booktitle = {In Proceedings Fourth ACM Workshop on Types in Language Design and Implementation, TLDI’09},

year = {2009}

}

### OpenURL

### Abstract

We present a possible world semantics for a call-by-value higherorder programming language with impredicative polymorphism, general references, and recursive types. The model is one of the first relationally parametric models of a programming language with all these features. To model impredicative polymorphism we define the semantics of types via parameterized (world-indexed) logical relations over a universal domain. It is well-known that it is non-trivial to show the existence of logical relations in the presence of recursive types. Here the problems are exacerbated because of general references. We explain what the problems are and present our solution, which makes use of a novel approach to modeling references. We prove that the resulting semantics is adequate with respect to a standard operational semantics and include simple examples of reasoning about contextual equivalence via parametricity.

### Citations

704 |
Types and Programming Languages
- Pierce
- 2002
(Show Context)
Citation Context ...ntactic store Π we write Ξ | ∆ | Γ ⊢ Π to denote that dom(∆) = dom(Π) and that for all l ∈ dom(∆) we have Ξ | ∆ | Γ ⊢ Π(l) : ∆(l). We have the following standard proposition (see Chapter 13 of Pierce =-=[27]-=-): Proposition 1 (Type Preservation). Assume Π, e ⇓ Π ′ , v. Suppose furthermore that we have ∅ | ∆ | ∅ ⊢ Π and ∅ | ∆ | ∅ ⊢ e : τ for some world ∆ and some type τ. Then there is ∆ ′ ⊒ ∆ such that ∅ | ... |

364 |
Types, abstraction and parametric polymorphism
- Reynolds
- 1983
(Show Context)
Citation Context ...tional Semantics, Possible World Semantics, Relational Parametricity, Impredicative Polymorphism, General References, Recursive Types 1. Introduction Relational parametricity was proposed by Reynolds =-=[34]-=- to reason about polymorphic programs, in particular, to show equivalence of polymorphic programs and to show representation independence for abstract data types. In this paper we provide one of the f... |

329 | Theorems for free
- Wadler
- 1989
(Show Context)
Citation Context ...ialized to control effects in [26]. Work in the latter category focuses on programming languages defined using an operational semantics, specifying evaluation order, etc., and was initiated by Wadler =-=[37]-=-. Relational parametricity is concerned with program equivalence which is here typically defined as contextual equivalence: two program expressions are equivalent if they have the same observable beha... |

135 | An indexed model of recursive types for foundational proof-carrying code
- Appel, McAllester
- 2001
(Show Context)
Citation Context ...lly give a formal proof showing that relations satisfying such conditions do not exist. Clearly, there are some relations between our semantic locations and step-indexed approaches to recursive types =-=[2, 5, 6]-=-; see Subsection 4.1 for comments on how one can attempt to make the connection formal. The second consequence of interpreting open types is also related to the use of world-indexed relations. It has ... |

124 | A logic for parametric polymorphism
- Plotkin, Abadi
- 1993
(Show Context)
Citation Context ...hism) [11]. 1.1 Background The theory of relational parametricity was originally proposed in the setting of the second-order lambda calculus. That setting is by now fairly well-understood, see, e.g., =-=[9, 33]-=-. But, of course, we would like to use relational parametricity for real programs with recursion and other effects. There has been a lot of research towards this goal — the efforts can be grouped roug... |

118 | Observable properties of higher order functions that dynamically create local names, or What’s new
- Pitts, Stark
- 1993
(Show Context)
Citation Context ...r a fee. TLDI’09, January 24, 2009, Savannah, Georgia,USA. Copyright c○ 2009 ACM 978-1-60558-420-1/09/01. . . $5.00 sible worlds which are used to capture dynamic allocation of references, much as in =-=[7, 11, 22, 31]-=-. It is well-known that it is nontrivial to show the existence of logical relations in the presence of recursive types [28]. Here the problems are exacerbated because of general references. We explain... |

99 | Relational properties of domains
- Pitts
- 1996
(Show Context)
Citation Context ... are used to capture dynamic allocation of references, much as in [7, 11, 22, 31]. It is well-known that it is nontrivial to show the existence of logical relations in the presence of recursive types =-=[28]-=-. Here the problems are exacerbated because of general references. We explain the problems and present our solution, which makes use of a novel approach to modeling references. In this paper we focus ... |

74 | Parametric polymorphism and operational equivalence - Pitts - 2000 |

72 | Step-indexed syntactic logical relations for recursive and quantified types
- Ahmed
- 2006
(Show Context)
Citation Context ... Relationally para-metric models have been developed for languages with recursion and inductive / coinductive types, see, e.g., [8, 16, 17, 29] and, recently, also for languages with recursive types =-=[2, 13, 23]-=-. In addition, a number of bisimulation-based methods for proving contextual equivalence have recently been proposed; the methods most relevant for the work in this paper cover a pure language with re... |

62 | A per model of polymorphism and recursive types
- Abadi, Plotkin
- 1990
(Show Context)
Citation Context ...s0, u0) ∈ S↓ × U↓. k(⌊s0[l ↦→ u0], λl⌋)(u, u ′ ) ∈ [[αn]]α1,...,αm(ν1, . . . , νm)(∆) ⇔ (u, u ′ [ ) ∈ νn λτ ∈ Typeα1,...,α .[[τ]]α1,...,αm(ν1, . . . , νm)(∆) ∪ {(⊥, ⊥)} n−1 ] \ {(⊥, ⊥)} (u, u ′ ) ∈ [=-=[1]-=-]Ξ(ν)(∆) ⇐⇒ u = u ′ = inunit(∗) (u, u ′ ) ∈ [[int]]Ξ(ν)(∆) ⇐⇒ ∃n ∈ Z. u = u ′ = inint(n) (u, u ′ ) ∈ [[τ ref]]Ξ(ν)(∆) ⇐⇒ [ ∃l ∈ dom(∆)∃n ∈ N. u = u ′ = λ n+1 l ∧ ∀[Ξ ′ |ν ′ |∆ ′ ] ⊒ [Ξ|ν|∆]. [[τ]]Ξ ′(... |

62 | State-dependent representation independence
- Ahmed, Dreyer, et al.
- 2009
(Show Context)
Citation Context ...ontextual equivalence of expressions in the language. Our model is based on logical relations over an untyped model of the language. The logical relations are parameterized over pos1 Independent work =-=[3]-=- by Ahmed, Dreyer and Rossberg came to our attention after writing this paper, cf. section 6; we know of no other models. Permission to make digital or hard copies of all or part of this work for pers... |

57 | Relational reasoning in a nominal semantics for storage
- Benton, Leperchley
- 2005
(Show Context)
Citation Context ...r a fee. TLDI’09, January 24, 2009, Savannah, Georgia,USA. Copyright c○ 2009 ACM 978-1-60558-420-1/09/01. . . $5.00 sible worlds which are used to capture dynamic allocation of references, much as in =-=[7, 11, 22, 31]-=-. It is well-known that it is nontrivial to show the existence of logical relations in the presence of recursive types [28]. Here the problems are exacerbated because of general references. We explain... |

48 |
Recursion over realizability structures
- Amadio
- 1991
(Show Context)
Citation Context ...evelopment we make use of admissible relations that satisfy a couple of additional conditions, uniformity and strictness. Uniformity is typical for interpretations of polymorphism and recursive types =-=[4]-=-; strictness is used to capture contextual equivalence (also used in [11]). Definition 11. Let UARel(U) be the set of binary relations on U that relate ⊥ to ⊥ and to nothing else, are closed under πn ... |

46 |
Small bisimulations for reasoning about higher-order imperative programs
- Koutavas, Wand
- 2006
(Show Context)
Citation Context ...been proposed; the methods most relevant for the work in this paper cover a pure language with recursive and existential types [36], untyped languages with general references and/or control operators =-=[18, 19, 35]-=-, and a pure language with parametric polymorphism and recursive types [20, 21]. The two categories of work are, of course, related: the type theories serve as metalanguages and can be used to give se... |

46 | A Bisimulation for Type Abstraction and Recursion
- Sumii, Pierce
- 2007
(Show Context)
Citation Context ...imulation-based methods for proving contextual equivalence have recently been proposed; the methods most relevant for the work in this paper cover a pure language with recursive and existential types =-=[36]-=-, untyped languages with general references and/or control operators [18, 19, 35], and a pure language with parametric polymorphism and recursive types [20, 21]. The two categories of work are, of cou... |

37 |
A very modal model of a modern, major, general type system
- Appel, Mellies, et al.
- 2007
(Show Context)
Citation Context ...lly give a formal proof showing that relations satisfying such conditions do not exist. Clearly, there are some relations between our semantic locations and step-indexed approaches to recursive types =-=[2, 5, 6]-=-; see Subsection 4.1 for comments on how one can attempt to make the connection formal. The second consequence of interpreting open types is also related to the use of world-indexed relations. It has ... |

35 | Operational properties of Lily, a polymorphic linear lambda calculus with recursion
- Bierman, Pitts, et al.
- 2000
(Show Context)
Citation Context ...elated to the research on reasoning methods for contextual equivalence. Relationally para-metric models have been developed for languages with recursion and inductive / coinductive types, see, e.g., =-=[8, 16, 17, 29]-=- and, recently, also for languages with recursive types [2, 13, 23]. In addition, a number of bisimulation-based methods for proving contextual equivalence have recently been proposed; the methods mos... |

31 |
Possible world semantics for general storage in call-by-value
- Levy
- 2002
(Show Context)
Citation Context ...r a fee. TLDI’09, January 24, 2009, Savannah, Georgia,USA. Copyright c○ 2009 ACM 978-1-60558-420-1/09/01. . . $5.00 sible worlds which are used to capture dynamic allocation of references, much as in =-=[7, 11, 22, 31]-=-. It is well-known that it is nontrivial to show the existence of logical relations in the presence of recursive types [28]. Here the problems are exacerbated because of general references. We explain... |

27 |
Syntactic logical relations for polymorphic and recursive types
- Crary, Harper
(Show Context)
Citation Context ... Relationally para-metric models have been developed for languages with recursion and inductive / coinductive types, see, e.g., [8, 16, 17, 29] and, recently, also for languages with recursive types =-=[2, 13, 23]-=-. In addition, a number of bisimulation-based methods for proving contextual equivalence have recently been proposed; the methods most relevant for the work in this paper cover a pure language with re... |

24 | Relational reasoning for recursive types and references
- Bohr, Birkedal
- 2006
(Show Context)
Citation Context |

22 |
Categorical models for Abadi-Plotkin’s Logic for Parametricity
- Birkedal, Møgelberg
- 2010
(Show Context)
Citation Context ...hism) [11]. 1.1 Background The theory of relational parametricity was originally proposed in the setting of the second-order lambda calculus. That setting is by now fairly well-understood, see, e.g., =-=[9, 33]-=-. But, of course, we would like to use relational parametricity for real programs with recursion and other effects. There has been a lot of research towards this goal — the efforts can be grouped roug... |

22 | Recursive polymorphic types and parametricity in an operational framework
- Melliès, Vouillon
- 2005
(Show Context)
Citation Context ... Relationally para-metric models have been developed for languages with recursion and inductive / coinductive types, see, e.g., [8, 16, 17, 29] and, recently, also for languages with recursive types =-=[2, 13, 23]-=-. In addition, a number of bisimulation-based methods for proving contextual equivalence have recently been proposed; the methods most relevant for the work in this paper cover a pure language with re... |

17 |
Bisimulations for Untyped Imperative Objects
- Koutavas, Wand
- 2006
(Show Context)
Citation Context ...been proposed; the methods most relevant for the work in this paper cover a pure language with recursive and existential types [36], untyped languages with general references and/or control operators =-=[18, 19, 35]-=-, and a pure language with parametric polymorphism and recursive types [20, 21]. The two categories of work are, of course, related: the type theories serve as metalanguages and can be used to give se... |

16 |
A complete, co-inductive syntactic theory of sequential control and state
- Støvring, Lassen
- 2007
(Show Context)
Citation Context ...been proposed; the methods most relevant for the work in this paper cover a pure language with recursive and existential types [36], untyped languages with general references and/or control operators =-=[18, 19, 35]-=-, and a pure language with parametric polymorphism and recursive types [20, 21]. The two categories of work are, of course, related: the type theories serve as metalanguages and can be used to give se... |

14 | The impact of seq on free theorems-based program transformations
- Johann, Voigtländer
- 2006
(Show Context)
Citation Context ...elated to the research on reasoning methods for contextual equivalence. Relationally para-metric models have been developed for languages with recursion and inductive / coinductive types, see, e.g., =-=[8, 16, 17, 29]-=- and, recently, also for languages with recursive types [2, 13, 23]. In addition, a number of bisimulation-based methods for proving contextual equivalence have recently been proposed; the methods mos... |

14 | Typed normal form bisimulation
- Lassen, Levy
- 2007
(Show Context)
Citation Context ...nguage with recursive and existential types [36], untyped languages with general references and/or control operators [18, 19, 35], and a pure language with parametric polymorphism and recursive types =-=[20, 21]-=-. The two categories of work are, of course, related: the type theories serve as metalanguages and can be used to give semantics to programming languages. This has, e.g., been done by Møgelberg [24], ... |

12 |
order type theory and recursion. Notes for a talk at the Scott Fest
- Second
- 1993
(Show Context)
Citation Context ... this goal — the efforts can be grouped roughly into two categories: equational type theories with effects and programming languages with effects. Work in the former category was initiated by Plotkin =-=[32]-=-, who suggested a second-order linear type theory with a polymorphic fixed-point combinator to combine polymorphism with recursion. That approach was further investigated in [10]. One of the remarkabl... |

10 | Relational parametricity and control
- Hasegawa
(Show Context)
Citation Context ...range of data types, including recursive types, with the desired universal properties following from parametricity. Hasegawa studied the combination of polymorphism and another effect, namely control =-=[15]-=-. Recently, this line of work was extended by Møgelberg and Simpson [25], who proposed a general polymorphic type theory for effects, as captured by computational monads. The general framework has bee... |

10 | Normal form bisimulation for parametric polymorphism
- Lassen, Levy
- 2008
(Show Context)
Citation Context ...nguage with recursive and existential types [36], untyped languages with general references and/or control operators [18, 19, 35], and a pure language with parametric polymorphism and recursive types =-=[20, 21]-=-. The two categories of work are, of course, related: the type theories serve as metalanguages and can be used to give semantics to programming languages. This has, e.g., been done by Møgelberg [24], ... |

10 |
Relational parametricity for computational effects
- Simpson
- 2006
(Show Context)
Citation Context ...al properties following from parametricity. Hasegawa studied the combination of polymorphism and another effect, namely control [15]. Recently, this line of work was extended by Møgelberg and Simpson =-=[25]-=-, who proposed a general polymorphic type theory for effects, as captured by computational monads. The general framework has been specialized to control effects in [26]. Work in the latter category fo... |

9 |
On the relations between monadic semantics
- Filinski
- 2007
(Show Context)
Citation Context ...phic types, cf., the definition of Φ in Figure 6, and means that we find the interpretation of all types by taking one fixed point of Φ, rather than via a nested sequence of fixed points as in, e.g., =-=[13, 14]-=-. This idea of using a function-space lattice was also used in the first author’s earlier work [11], albeit more implicitly. Proposition 10. Given Ξ | ∆ | Γ ⊢ e : τ with Ξ = α1, . . . , αm and Γ = x1 ... |

6 |
On proving the correctness of program transformations based on free theorems for higher-order polymorphic calculi
- Johann
- 2005
(Show Context)
Citation Context ...elated to the research on reasoning methods for contextual equivalence. Relationally para-metric models have been developed for languages with recursion and inductive / coinductive types, see, e.g., =-=[8, 16, 17, 29]-=- and, recently, also for languages with recursive types [2, 13, 23]. In addition, a number of bisimulation-based methods for proving contextual equivalence have recently been proposed; the methods mos... |

4 | Interpreting polymorphic FPC into domain theoretic models of parametric polymorphism
- Møgelberg
(Show Context)
Citation Context ...0, 21]. The two categories of work are, of course, related: the type theories serve as metalanguages and can be used to give semantics to programming languages. This has, e.g., been done by Møgelberg =-=[24]-=-, who showed how to give a parametric model of the programming language FPC extended with polymorphism (i.e., a language with recursion, recursive types and polymorphism). Using a model of the type th... |

3 | Relational Parametricity for Control Considered as a Computational Effect
- Møgelberg, Simpson
- 2007
(Show Context)
Citation Context ...tended by Møgelberg and Simpson [25], who proposed a general polymorphic type theory for effects, as captured by computational monads. The general framework has been specialized to control effects in =-=[26]-=-. Work in the latter category focuses on programming languages defined using an operational semantics, specifying evaluation order, etc., and was initiated by Wadler [37]. Relational parametricity is ... |

3 |
Advanced Topics in Types and Programming Languages, chapter Typed Operational Reasoning
- Pitts
- 2005
(Show Context)
Citation Context ...f the universal quantification over all contexts. Thus there has been an extensive research effort to find reasoning methods that are easier to use for establishing contextual equivalence (see, e.g., =-=[30]-=- for a fairly recent overview), and the work on parametricity for programming languages with effects has been closely related to the research on reasoning methods for contextual equivalence. Relationa... |

1 |
Relational parametricity for recursive types and references of closed types
- Bohr, Birkedal
- 2007
(Show Context)
Citation Context ...sent work with earlier work on reasoning about local state [11] — this allows for formal proofs that two implementations of an abstract type using local state in different ways are related. Indeed in =-=[12]-=-, the first author and Nina Bohr extended the techniques in [11] to a language with impredicative polymorphism and references to closed types (closed to avoid the technical challenges addressed in thi... |