Abstract
We present a construction which, under suitable assumptions, takes a model of Moggi’s computational λ-calculus with sum types, effect operations and primitives, and yields a model that is adequate and fully abstract. The construction, which uses the theory of fibrations, categorical glueing, ⊤⊤-lifting, and ⊤⊤-closure, takes inspiration from O’Hearn & Riecke’s fully abstract model for PCF. Our construction can be applied in the category of sets and functions, as well as the category of diffeological spaces and smooth maps and the category of quasi-Borel spaces, which have been studied as semantics for differentiable and probabilistic programming.
Highlights
Two programs are contextually equivalent if they evaluate to the same result in all program contexts
(1) An analysis of the relationship between logical relations, semantic-interpretation preserving functors, and definability. This includes a characterisation of the definable morphisms in an arbitrary model of λ+c, which builds on the work of Katsumata [2008, 2013] (Sec. 5). (2) The introduction of an abstract, fibrational notion of concreteness, which serves to ‘cut down’ a function space to just those morphisms preserving suitable properties (Sec. 6). (3) A conceptual, category-theoretic framework for constructing fully abstract models independently of the choice of monadic effect, base types, and primitives (Thm. 10.2)
We assume a language given by choosing a signature S of base types, primitives and effectful operations, together with a semantic model consisting of a cartesian closed category M, a monad T, and a semantic interpretation of the base types and constants
Summary
Two programs are contextually equivalent if they evaluate to the same result (with the same effect) in all program contexts. This natural notion of equality makes precise the intuitive ‘sameness’ a programmer is generally interested in, for example for optimization or compilation. Adequacy and full abstraction roughly correspond to soundness and completeness in logic: in an adequate and fully abstract model, denotational equality completely characterises contextual equivalence. By constructing fully abstract models, one reduces contextual equivalence to denotational equality. In this paper we construct fully abstract models for a wide class of languages with effects encoded by monads (à la Moggi [1989, 1991]), including set-theoretic state (Sec. 9), measure-theoretic probabilistic programming (Sec. 11.1) and state in differentiable neural network programming (Sec. 11.2). Our construction is inspired by that of O’Hearn and Riecke [1995], so we call it the OHR construction
Published Version (Free)
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have