A few bridges between operational and denotational semantics of programming languages

Similar documents
Universal Algebra for Termination of Higher-Order Rewriting. Makoto Hamana

From syntax to semantics of Dependent Type Theories - Formalized

The algebraicity of the lambda-calculus

Algebraic theories in the presence of binding operators, substitution, etc.

Operads. Spencer Liang. March 10, 2015

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

Mathematical Synthesis of Equational Deduction Systems. Marcelo Fiore. Computer Laboratory University of Cambridge

University of Oxford, Michaelis November 16, Categorical Semantics and Topos Theory Homotopy type theor

Logic for Computational Effects: work in progress

Inducing syntactic cut-elimination for indexed nested sequents

Logical connections in the many-sorted setting

Topos Theory. Lectures 17-20: The interpretation of logic in categories. Olivia Caramello. Topos Theory. Olivia Caramello.

On the Construction of Free Algebras for Equational Systems

A categorical model for a quantum circuit description language

Complete Partial Orders, PCF, and Control

Custom Hypergraph Categories via Generalized Relations

Bialgebraic Methods in Structural Operational Semantics

Streams and Coalgebra Lecture 2

Direct Limits. Mathematics 683, Fall 2013

Programming Languages in String Diagrams. [ four ] Local stores. Paul-André Melliès. Oregon Summer School in Programming Languages June 2011

Teooriaseminar. TTÜ Küberneetika Instituut. May 10, Categorical Models. for Two Intuitionistic Modal Logics. Wolfgang Jeltsch.

Categorical Equational Systems: Algebraic Models and Equational Reasoning

3. The Sheaf of Regular Functions

Semantics and syntax of higher inductive types

An introduction to process calculi: Calculus of Communicating Systems (CCS)

Higher Order Containers

1. The Method of Coalgebra

Syntactic Characterisations in Model Theory

Relational semantics for a fragment of linear logic

Lecture 1: Overview. January 24, 2018

Distributed transactions and reversibility

and this makes M into an R-module by (1.2). 2

Category Theory. Categories. Definition.

DEFINITIONS: OPERADS, ALGEBRAS AND MODULES. Let S be a symmetric monoidal category with product and unit object κ.

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19.

Coalgebraic Semantics of Modal Logics: an Overview

Lecture 3: Semantics of Propositional Logic

Categories and Functors (Lecture Notes for Midlands Graduate School, 2013) Uday S. Reddy The University of Birmingham

What are Iteration Theories?

Sémantique des jeux asynchrones et réécriture 2-dimensionnelle

INTRODUCTION TO CATEGORY THEORY FOR FUNCTIONAL PROGRAMMING

which is a group homomorphism, such that if W V U, then

Transformation of Corecursive Graphs

An introduction to Yoneda structures

A Weak Bisimulation for Weighted Automata

An adjoint construction for topological models of intuitionistic modal logic Extended abstract

Categories and Functors (Lecture Notes for Midlands Graduate School, 2012) Uday S. Reddy The University of Birmingham

A Graph Rewriting Calculus: Applications to Biology and Autonomous Systems

Quantum groupoids and logical dualities

1 Replete topoi. X = Shv proét (X) X is locally weakly contractible (next lecture) X is replete. D(X ) is left complete. K D(X ) we have R lim

Boolean Algebra and Propositional Logic

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

A fully abstract semantics for a nondeterministic functional language with monadic types

On a Monadic Encoding of Continuous Behaviour

Topology in Denotational Semantics

The equivalence axiom and univalent models of type theory.

Streams and Coalgebra Lecture 1

Second-Order Algebraic Theories

On a Categorical Framework for Coalgebraic Modal Logic

Composition and Decomposition of DPO Transformations with Borrowed Context

ABSTRACT DIFFERENTIAL GEOMETRY VIA SHEAF THEORY

Notes about Filters. Samuel Mimram. December 6, 2012

Display calculi in non-classical logics

Uniform Schemata for Proof Rules

6 Coalgebraic modalities via predicate liftings

Geometry of Interaction

Resource lambda-calculus: the differential viewpoint

A Differential Model Theory for Resource Lambda Calculi - Part I

Quantum Groups and Link Invariants

Business Process Management

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

Advances in the theory of fixed points in many-valued logics

Recent Developments in and Around Coaglgebraic Logics

Applications of 2-categorical algebra to the theory of operads. Mark Weber

Preliminaries. Chapter 3

Model theory, algebraic dynamics and local fields

Lecture 2: Syntax. January 24, 2018

via Topos Theory Olivia Caramello University of Cambridge The unification of Mathematics via Topos Theory Olivia Caramello

A Discrete Duality Between Nonmonotonic Consequence Relations and Convex Geometries

Algebraic Geometry

2 M. Hasegawa thus strengthens the claim that Girard translation is the canonical translation from intuitionistic logic to linear logic. This seems to

Connecting the categorical and the modal logic approaches to Quantum Mech

Models for Concurrency

Universal Algebra for Logics

Cartesian closed 2-categories and rewriting

The space of located subsets

five years later Olivia Caramello TACL 2015, 25 June 2015 Université Paris 7 The theory of topos-theoretic bridges, five years later Olivia Caramello

1 Notations and Statement of the Main Results

Partially commutative linear logic: sequent calculus and phase semantics

Locally cartesian closed categories

Directed Bigraphs: Theory and Applications

Definability in Boolean bunched logic

Equational Logic. Chapter Syntax Terms and Term Algebras

MATH 101B: ALGEBRA II PART A: HOMOLOGICAL ALGEBRA

Second-Order Equational Logic

Logic: The Big Picture

Bringing class diagrams to life

A Brief Introduction to Model Checking

Modal and temporal logic

Boolean Algebra and Propositional Logic

Transcription:

A few bridges between operational and denotational semantics of programming languages Soutenance d habilitation à diriger les recherches Tom Hirschowitz November 17, 2017 Hirschowitz Bridges between operational and denotational 1 / 60

Structure of the talk Trajectory. Bibliography (overview of contributions). Focus on one chapter of manuscript: shapely monads. Hirschowitz Bridges between operational and denotational 2 / 60

Outline 1 Trajectory 2 Bibliography (summary of contributions) 3 Motivation 4 Preliminaries 5 Operads 6 Graphical operads 7 Shapely monads Hirschowitz Bridges between operational and denotational 3 / 60

Early work PhD thesis on modular programming. Viewing programs as component assemblies. Further work on component-oriented programming. Modify modular structure at runtime. Goal Ensure safety! Hirschowitz Bridges between operational and denotational 4 / 60

Mathematical description of programming languages Basic method Structural operational semantics (SOS). Presenting execution of a programming language as an inductively generated, labelled, binary transition relation between programs. Example (Synchronisation in the π-calculus) P ā m P P Q τ P Q Q a(m) Q P sends message m on channel a, Q receives m on a = P Q does a silent transition to P Q. Hirschowitz Bridges between operational and denotational 5 / 60

Behavioural equivalences Important question in programming language research When are two given programs equivalent? Several answers: behavioural equivalences. Important reasoning tool Denotational semantics, a.k.a. models. In a sense close to model theory: interpret the syntax. E.g. (Scott), types as ordered sets, functions as monotone maps. Difficulty: no general notion of model! fairly standard for purely functional languages, for logical languages as well, hard work, e.g., for linear logic, currently debated for type theory, undefined in general. Hirschowitz Bridges between operational and denotational 6 / 60

Need of general results Mostly methods, little common theory. Especially in the interplay between SOS and variable binding. E.g., x.a(x) = y.a(y). So started looking around, learnt bits of proof theory, linear logic, and finally category theory. Hirschowitz Bridges between operational and denotational 7 / 60

Existing approaches I Syntactic frameworks for SOS 1. Description of inductive generation process: basic rules transition relation. General results under hypotheses, e.g., some behavioural equivalence (bisimilarity) is a congruence. No general notion of model. 1 GSOS, de Simone, tyft/tyxt, PANTH,... Hirschowitz Bridges between operational and denotational 8 / 60

Existing approaches II Outside SOS: graphical calculi. Programs are (kind of) graphs. Transitions given by local transformation rules. Examples: Petri nets (Petri, 1962). Proof nets (Girard, 1987), interaction nets (Lafont, 1990). To a certain extent, bigraphs (Jensen and Milner, 2004). Wire calculus (Sobociński, 2009). Description of (non-inductive) generation process. No general notion of model. E.g., took quite long to work out for proof nets a! a Bierman. On Intuitionistic Linear Logic. PhD thesis, Cambridge, 1993. Hirschowitz Bridges between operational and denotational 9 / 60

Existing approaches III Categorical frameworks (bialgebraic semantics (Fiore et al.), nominal logic (Pitts et al.),... ). Description of inductive generation process under hypotheses. General results (as before). Specification: automatic notion of model. Confession: haven t really managed to appropriate these. Long-term motivation Reconcile theory and practice on these matters. Hirschowitz Bridges between operational and denotational 10 / 60

Difficulty SOS is a wild territory. Strategy: approach SOS from tamer settings. Higher-order rewriting Models SOS Graphical calculi Hirschowitz Bridges between operational and denotational 11 / 60

Outline 1 Trajectory 2 Bibliography (summary of contributions) 3 Motivation 4 Preliminaries 5 Operads 6 Graphical operads 7 Shapely monads Hirschowitz Bridges between operational and denotational 12 / 60

Approaching SOS I: higher-order rewriting Higher-order rewriting Models SOS Graphical calculi Hirschowitz Bridges between operational and denotational 13 / 60

Approaching SOS I Higher-order rewriting (HOR): SOS for logic (vs. programming languages); main interest: determinism (vs. behavioural equivalences). HOR as a SOS fragment No labels. Transition relation is a congruence (transitions may occur anywhere in the program). Chapter 3, published in LMCS (2013) Syntactic frameworks HOR Description of inductive generation General notion of model Generated transition relation = initial model. Hirschowitz Bridges between operational and denotational 14 / 60

Approaching SOS II: from models Missing from syntactic frameworks and graphical calculi: general notions of models. Idea: start from existing notions of models (for instances of SOS); try to generalise them to fragments of SOS. Higher-order rewriting Models SOS Graphical calculi Hirschowitz Bridges between operational and denotational 15 / 60

Approaching SOS II Game semantics Interpret types as games and programs as innocent strategies. Chapter 5 (with Eberhart, Pous, Seiller) Recasting of innocence as a sheaf condition. New, analogous models for two concurrent languages (CCS and π). Abstract framework (playgrounds): SOS transition relation playground interpretation Covers the new models of CCS and π. innocent strategies. Conjecture: also covers more standard models, e.g., of PCF. Hirschowitz Bridges between operational and denotational 16 / 60

Approaching SOS III: graphical calculi Higher-order rewriting Models SOS Graphical calculi Chapter 4 (with Garner): today s focus! Definition of graphical calculus. Description of inductive generation process. General notion of model. Construction of initial model. Application to more standard mathematical structures: Operads as the models of an adequate graphical calculus. Hirschowitz Bridges between operational and denotational 17 / 60

Outline 1 Trajectory 2 Bibliography (summary of contributions) 3 Motivation 4 Preliminaries 5 Operads 6 Graphical operads 7 Shapely monads Hirschowitz Bridges between operational and denotational 18 / 60

Mathematical motivation Certain algebraic structures with obvious graphical intuition; tedious formal definition. E.g., operads, properads, polycategories, PROPs, and variants. Hirschowitz Bridges between operational and denotational 19 / 60

Computer science motivation Graphical calculi with obvious graphical intuition; tedious formal definition; involved or non-existent notion of model. E.g., interaction nets, proof nets, bigraphs. Hirschowitz Bridges between operational and denotational 20 / 60

Contributions (with Garner) Make graphical intuition rigorous thanks to presheaf theory. Alternative definition of maths: the algebraic structure in question comp. sci.: a notion of model for the graphical calculus in question. View old definition as economical characterisation: old definition new definition statement hard easy construction easy hard Hirschowitz Bridges between operational and denotational 21 / 60

Posing the problem categorically presheaves endofunctor B monad T T -algebras pictures algebraic structures Need to explain these terms, at least intuitively. Rightmost part: standard categorical approach to algebra. Just need to derive T from the pictures! Hirschowitz Bridges between operational and denotational 22 / 60

Outline 1 Trajectory 2 Bibliography (summary of contributions) 3 Motivation 4 Preliminaries 5 Operads 6 Graphical operads 7 Shapely monads Hirschowitz Bridges between operational and denotational 23 / 60

Categories Definition Objects, and morphisms between them. Example Objects Morphisms Set Sets Functions Mon Monoids Monoid homomorphisms Grp Groups Group homomorphisms... Hirschowitz Bridges between operational and denotational 24 / 60

Functors Definition Functor = morphism of categories. Example Set L U Mon Action on objects: L(X ) = n X n = sequences of elements of X, = free monoid on X. Multiplication: (x 1,..., x n ), (x n+1,..., x p ) (x 1,..., x p ). Action on morphisms: L(X f Y ): L(X ) L(Y ) (x 1,..., x n ) (f (x 1 ),..., f (x n )). Other example: U(M) = M, carrier of M. Hirschowitz Bridges between operational and denotational 25 / 60

Monads Definition Monad = endofunctor + structure. Example T Set L U Mon Composite T = U L. T (X ) = free monoid viewed as a set. T is a monad. Hirschowitz Bridges between operational and denotational 26 / 60

Crucial point I: algebraic structures = algebras for a monad T -algebra T -algebra = morphism T (X ) m X with easy conditions. Example: previous T T (X ) = free monoid viewed as a set. So m maps sequences (x 1,..., x n ) to elements. Thought of as multiplication. Example T -algebra: m : T (N) N (n 1,..., n p ) i n i. Hirschowitz Bridges between operational and denotational 27 / 60

Morphisms of algebras Morphisms of T -algebras T (X ) T (Y ) m X T (f ) f f (m(x 1,..., x n )) = m (f (x 1 ),..., f (x n )). m Morphism = structure-preserving map. Y Proposition (in the monoids example) T -algebras form a category T -Alg, equivalent to Mon. Moral (standard, but very important!) Algebraic structure (monoids) monad T. T describes free algebraic structures. Hirschowitz Bridges between operational and denotational 28 / 60

Other examples on sets Algebraic structure T (X ) Monoids n X n Commutative monoids n X n /S n Rings, modules, algebras,...... Complete semi-lattices P(X ) Non-example: fields, as there are no free fields over a set. Hirschowitz Bridges between operational and denotational 29 / 60

Outline 1 Trajectory 2 Bibliography (summary of contributions) 3 Motivation 4 Preliminaries 5 Operads 6 Graphical operads 7 Shapely monads Hirschowitz Bridges between operational and denotational 30 / 60

From pictures to presheaves Running example: (nonsymmetric, coloured) operads. Well-known case: T already known! Result specialises to: characterisation of T as a free shapely monad. family of presheaves endofunctor B monad T T -algebras pictures algebraic structures Hirschowitz Bridges between operational and denotational 31 / 60

From pictures to presheaves Running example: (nonsymmetric, coloured) operads. Well-known case: T already known! Result specialises to: characterisation of T as a free shapely monad. family of multigraphs endofunctor B monad T T -algebras pictures algebraic structures Hirschowitz Bridges between operational and denotational 31 / 60

Multigraphs Multigraph X graph whose edges may have several sources. Diagram X 0 X 1... X n... s n,1 t 1... s n,ntn t 0 s 1 1 X X : vertices; X n : edges with n sources; s n,i (e): ith source of n-ary e; t n (e): target of e. Hirschowitz Bridges between operational and denotational 32 / 60

Example multigraph d b c a x y e X = {a, b, c, d, e}, X 2 = {x, y}, X n = otherwise, t 2 (x) = x t = a (notation!), x s 1 = b, x s 2 = c, y t = c, y s 1 = d, y s 2 = e. Hirschowitz Bridges between operational and denotational 33 / 60

Category of multigraphs Morphism = map preserving target and sources. Proposition Multigraphs form a category MGph. Hirschowitz Bridges between operational and denotational 34 / 60

Intuitive definition A (nonsymmetric, coloured) operad (in sets) O is a multigraph O with plugging, e.g., for all x O 2 and y O 3 with y t = x s 1, one may form d e y f b x c a in O 4. Notation Denoted by x 2,3 1 y. Hirschowitz Bridges between operational and denotational 35 / 60

Intuitive definition (cont d) Plugging should satisfy obvious graphical axioms, e.g., z y y = z x x Hirschowitz Bridges between operational and denotational 36 / 60

Dreadful glimpses of standard definition Definition A (nonsymmetric, coloured) operad (in sets) is a multigraph O, together with for all m, n, i, x O m and y O n such that x s i = y t, an element x m,n i y O m+n 1 ; for all a O, an element id a O 1 ; satisfying axioms like (x m,n i y) m+n 1,p j z = for all x O m, y O n, z O p. { (x m,p j z) m+p 1,n i+p 1 y (if j < i) x m,n+p 1 i (y n,p j i+1 z) (if i j < i + n) Hirschowitz Bridges between operational and denotational 37 / 60

Outline 1 Trajectory 2 Bibliography (summary of contributions) 3 Motivation 4 Preliminaries 5 Operads 6 Graphical operads 7 Shapely monads Hirschowitz Bridges between operational and denotational 38 / 60

Endofunctors from multigraphs family of multigraphs endofunctor B monad T T -algebras pictures algebraic structures Hirschowitz Bridges between operational and denotational 39 / 60

Crucial point II: arguments for composition = multigraph morphisms Recall the picture for composition in O, on the right. View it as a multigraph, say X. (Morphisms X O) (choices of (x, y)): x O 2 and y O 3, such that x s 1 = y t. = potential arguments for 2,3 1 if it existed. Hirschowitz Bridges between operational and denotational 40 / 60

Arities Definition (Basic arities) X is the arity of 2,3 1. Obvious generalisation: X m,n i is the arity of m,n i. Similarly, arity of id: multigraph with just one vertex (wire). Hirschowitz Bridges between operational and denotational 41 / 60

Making sense of h X -algebras Recall our example multigraph X on the right. Consider the functor h X : MGph MGph defined by: h X (Y ) = Y, h X (Y ) 4 = MGph(X, Y ), the set of multigraph morphisms from X to Y, hx (Y ) n = for n 4. So h X (Y ) 4 = {(x, y ) Y 2 Y 3 x s 1 = y t}. An algebra h X (Y ) Y is determined by: a multigraph Y, plus a map h X (Y ) 4 Y 4, i.e., an interpretation of 2,3 1! Summary Multigraph X functor which specifies an operation of arity X. I.e., algebras have such an operation. d b e f y a x c Hirschowitz Bridges between operational and denotational 42 / 60

The monad from derived arities family of multigraphs endofunctor B monad T T -algebras pictures algebraic structures Hirschowitz Bridges between operational and denotational 43 / 60

Graphical definition of operads Need to define arities for all derived operations: Definition Let T n denote the class of planar trees with n leaves. Define T : MGph MGph by: T (Y ) = Y, T (Y ) n = X T n MGph(X, Y ), the set of multigraph morphisms from some n-ary tree X to Y. Lemma The functor T is a monad on MGph. Theorem Operads are equivalent to T -algebras. Hirschowitz Bridges between operational and denotational 44 / 60

Outline 1 Trajectory 2 Bibliography (summary of contributions) 3 Motivation 4 Preliminaries 5 Operads 6 Graphical operads 7 Shapely monads Hirschowitz Bridges between operational and denotational 45 / 60

Generating monads family of multigraphs endofunctor B monad T T -algebras pictures algebraic structures Goal: generate T automatically from basic arities. Compositions X n,m i. Identities Ia. Hirschowitz Bridges between operational and denotational 46 / 60

Signature for operads Definition Let B n denote the set of basic arities with n leaves. Define B : MGph MGph by: B(Y ) = Y, Intuition: filiform trees of depth 2. B(Y ) n = X B n MGph(X, Y ), the set of multigraph morphisms from some n-ary basic arity X to Y. Question: how to generate T from B? Hirschowitz Bridges between operational and denotational 47 / 60

Naive attempt Well-known correspondence Endofunctors on MGph M U Monads on MGph. Miss! M(B) = T. Hirschowitz Bridges between operational and denotational 48 / 60

Reason M(B)-algebras do not satisfy any of the axioms! z y y z x x Which monads do enforce them? Shapely ones! Hirschowitz Bridges between operational and denotational 49 / 60

Shapely monads Subcategory Framed(MGph) Cell(MGph) Analytic(MGph) Endo(MGph). Stable under composition. Has a terminal object, automatically a monad. Definition Shapely = subfunctor of in Framed(MGph). Graphical calculus = shapely monad. Intuition: at most one operation of each arity. Hirschowitz Bridges between operational and denotational 50 / 60

Generation result Theorem T = n (id B) n is the free shapely monad over B. B B denotes the image of B B: B B B B. Hirschowitz Bridges between operational and denotational 51 / 60

Illustration of B B B B B B Hirschowitz Bridges between operational and denotational 52 / 60

General result Consider any presheaf category with a subterminal object. At most one morphism from any object to. Consider -analytic functors, i.e., analytic functors with a map to. Suppose they are stable under composition. Example: framed endofunctors. Definition Shapely functor = subfunctor of. Theorem The free shapely monad on a shapely endofunctor B is n (id B) n. Hirschowitz Bridges between operational and denotational 53 / 60

Applications Characterisation of the monads for polycategories, properads, PROPs, etc, as free shapely monads. Definition of free shapely monads for interation nets and fragments of proof nets. Hirschowitz Bridges between operational and denotational 54 / 60

Conclusion Sketched several approaches to mathematising programming language research. Rather diverse contributions. Still lots of work to do to reconcile theory and practice! Hirschowitz Bridges between operational and denotational 55 / 60

Thanks! Hirschowitz Bridges between operational and denotational 56 / 60

Shapely functors: intuition Restrict to functors with at most one operation per arity. There should be one full such functor, with one operation for each possible arity. This functor should be a monad. Selecting basic arities picking a subfunctor B. Generating T n (id B) n, the smallest submonad of containing B. Hirschowitz Bridges between operational and denotational 57 / 60

Shapely functors: strategy Find a subcategory C of Endo(MGph) stable under composition and having a terminal object. I.e., such that C C,! morphism C. Indeed: automatically a monad via ; can then generate n Bn amongst subfunctors of. Hirschowitz Bridges between operational and denotational 58 / 60

Towards shapely functors I: analytic functors Subcategory Analytic(MGph) Endo(MGph) of functors s.t. T (Y ) n = MGph(A(x), Y )/G(x) x T (1) n where A(x) is the arity of x, G(x) S A(x) is a subgroup of the automorphism group of A(x). Generalisation of Joyal s analytic endofunctors on sets. Miss again! Does have a terminal object. Not stable under composition. Hirschowitz Bridges between operational and denotational 59 / 60

Towards shapely functors II: cellular functors Subcategory Cell(MGph) Analytic(MGph) Endo(MGph). Miss again! Stable under composition. No terminal object! Hirschowitz Bridges between operational and denotational 60 / 60