Towards a Flowchart Diagrammatic Language for Monad-based Semantics

Similar documents
The Uniformity Principle on Traced Monoidal Categories

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

Finite Dimensional Hilbert Spaces are Complete for Dagger Compact Closed Categories (Extended Abstract)

Categories and Natural Transformations

A categorical view of computational effects

Parameterizations and Fixed-Point Operators on Control Categories

Logic for Computational Effects: work in progress

CATEGORIES. 1.1 Introduction

GENERALIZED ABSTRACT NONSENSE: CATEGORY THEORY AND ADJUNCTIONS

Diagrammatic Methods for the Specification and Verification of Quantum Algorithms

Semantics for algebraic operations

Abstract structure of unitary oracles for quantum algorithms

LIMITS AND COLIMITS. m : M X. in a category G of structured sets of some sort call them gadgets the image subset

Category Theory. Course by Dr. Arthur Hughes, Typset by Cathal Ormond

A categorical model for a quantum circuit description language

1 Categories, Functors, and Natural Transformations. Discrete categories. A category is discrete when every arrow is an identity.

Joseph Muscat Categories. 1 December 2012

M, N ::= x λp : A.M MN (M, N) () c A. x : b p x : b

Introduction to Categorical Quantum Mechanics. Chris Heunen and Jamie Vicary

Gabriel-Ulmer Duality and Lawvere Theories Enriched over a General Base

HSP SUBCATEGORIES OF EILENBERG-MOORE ALGEBRAS

Categorical quantum mechanics

Categories and Quantum Informatics: Monoidal categories

The algebraicity of the lambda-calculus

SEPARATED AND PROPER MORPHISMS

Elements of Category Theory

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

Grothendieck construction for bicategories

CS 361 Meeting 28 11/14/18

MADE-TO-ORDER WEAK FACTORIZATION SYSTEMS

What are Iteration Theories?

A [Monad-Based] Semantics for Hybrid Iteration

Span, Cospan, and Other Double Categories

On Categorical Models of Classical Logic and the Geometry of Interaction

arxiv: v1 [cs.lo] 4 Aug 2016

Representation Theory of Hopf Algebroids. Atsushi Yamaguchi

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

SEPARATED AND PROPER MORPHISMS

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

GENERAL ABSTRACT NONSENSE

Probabilistic Observations and Valuations (Extended Abstract) 1

Reconsidering MacLane. Peter M. Hines

VALUATIVE CRITERIA BRIAN OSSERMAN

Control Categories and Duality: on the Categorical Semantics of the Lambda-Mu Calculus

How to combine diagrammatic logics

Conservation of Information

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

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

Complete Partial Orders, PCF, and Control

(C) The rationals and the reals as linearly ordered sets. Contents. 1 The characterizing results

Control Categories and Duality: on the Categorical Semantics of the Lambda-Mu Calculus

On a Monadic Encoding of Continuous Behaviour

Tangent Categories. David M. Roberts, Urs Schreiber and Todd Trimble. September 5, 2007

Category Theory for Linear Logicians

Theories With Duality DRAFT VERSION ONLY

Notions of Computation Determine Monads

THE SNAIL LEMMA ENRICO M. VITALE

VALUATIVE CRITERIA FOR SEPARATED AND PROPER MORPHISMS

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

Descent on the étale site Wouter Zomervrucht, October 14, 2014

Math 216A. A gluing construction of Proj(S)

The Clifford algebra and the Chevalley map - a computational approach (detailed version 1 ) Darij Grinberg Version 0.6 (3 June 2016). Not proofread!

What are Iteration Theories?

Math 248B. Base change morphisms

1 No-Cloning In Categorical Quantum Mechanics

Categorical coherence in the untyped setting. Peter M. Hines

Monads and More: Part 4

Semantics for a Higher Order Functional Programming Language for Quantum Computation

Quantum groupoids and logical dualities

Towards a Formal Theory of Graded Monads

University of Cape Town

About Translations of Classical Logic into Polarized Linear Logic

Monads and More: Part 4

Towards a quantum calculus

NON-SYMMETRIC -AUTONOMOUS CATEGORIES

and one into the linear calculus, yielding a semantics in L. For we use a trivial mapping into the monadic calculus and Girard's translation into the

A quantum double construction in Rel

Note on models of polarised intuitionistic logic

CARTESIAN DIFFERENTIAL CATEGORIES

Monads Need Not Be Endofunctors

Example: When describing where a function is increasing, decreasing or constant we use the x- axis values.

Relative Hilbert-Post completeness for exceptions

MONADS ON DAGGER CATEGORIES

Functors for the Piagetian Robotics Paper

The Elements for Logic In Compositional Distributional Models of Meaning

Power-Set Functors and Saturated Trees

A Compositional Distributional Model of Meaning

Categories and Quantum Informatics

CATEGORY THEORY. Cats have been around for 70 years. Eilenberg + Mac Lane =. Cats are about building bridges between different parts of maths.

Mix Unitary Categories

MFPS LICS Special Session Honouring Dana Scott. Symmetric Scott. Andrew Pitts. Computer Laboratory MFPS/LICS /14

What s category theory, anyway? Dedicated to the memory of Dietmar Schumacher ( )

sset(x, Y ) n = sset(x [n], Y ).

Skew-closed objects, typings of linear lambda terms, and flows on trivalent graphs

arxiv: v1 [gr-qc] 29 Jul 2011

What is a categorical model for Linear Logic?

Modèles des langages de programmation Domaines, catégories, jeux. Programme de cette seconde séance:

2-DIMENSIONAL TOPOLOGICAL QUANTUM FIELD THEORIES AND FROBENIUS ALGEBRAS. Contents 1. The main theorem 1

A Graph Theoretic Perspective on CPM(Rel)

Category theory and set theory: algebraic set theory as an example of their interaction

Transcription:

Towards a Flowchart Diagrammatic Language or Monad-based Semantics Julian Jakob Friedrich-Alexander-Universität Erlangen-Nürnberg julian.jakob@au.de 21.06.2016

Introductory Examples 1 2 + 3 3 9 36 4 while do What is the most general ormalization or such diagrams?

Overview 1 Basic Deinitions 2 Traces, Fixpoints and Iteration 3 Algebraic Operations and Generic Eects

Diagrammatic Language edges: nodes: crossing: eedback node: strict node:

Deinition Deinition as in algebraic type theory: edges = base edge base edge parallel to edge nodes = base node crossing eedback node node sequential to base node strict nodes

Categories In short, a category C is given by: Collection o objects Ob(C) Collection o morphisms Hom(C) Two operations assigning to each morphism its source src( ) Ob(C) and its target tar( ) Ob(C), written : src( ) tar( ). There is an operation assigning to each pair o composable morphisms and g their composition which is a morphism denoted by g or just g and such that src(g ) = src( ) and tar(g ) = tar(g). There is also an operation assigning to each object A Ob(C) an identity morphism id A : A A. These operations are required to be unitary and associative.

Diagrams or Categories Object A: A Morphism : A B: Identity id A : A A: A A B Composition g : A C or : A B and g : B C: A B C g

Formal Descriptions Deinition (Selinger (2011), Signature) A simple categorical signature Σ consists o a set Σ 0 o object variables, a set Σ 1 o morphism variables, and a pair o unctions dom, cod : Σ 1 Σ 0. Object variables are usually written A,B,C,..., morphism variables are usually written,g,h,..., and we write : A B i dom( ) = A and cod( ) = B. Deinition (Selinger (2011), Interpretation) An interpretation i o a signature Σ a category C consists o a unction i 0 : Σ 0 Ob(C), and or any Σ 1 a morphism i 1 ( ) : i 0 (cod( )) i 0 (dom( )).

Coherence Deinition (Selinger (2011), Coherence) A graphical language is coherent, i it is sound and complete. It is sound, i all the axioms o the category are automatically satisied in the graphical language up to isomorphism o diagrams. It is complete i the ollowing condition is true: every equation that is true in the graphical language is a consequence o the axioms.

Soundness o the Diagrammatic Language or Categories Let Identity: A B A = B Right Identity: A B A = B Associativity: A B C D g h A B C D = g h

Monoidal Categories A monoidal category M has additional structure: A unctor : M M M called the tensor product. An object 1 Ob(M) called the unit object. A natural isomorphism a x,y,z : (x y) z x (y z) called the associator. A natural isomorphism λ x : 1 x x called the let unitor. A natural isomorphism ρ x : x 1 x called the right unitor.

Diagrammatic Language or Monoidal Categories Tensor product A B: A Tensor product g : A C B D: Unit object I : A C B g B D

Coherence or Monoidal Categories Theorem (Joyal/Street (1991), Coherence or Monoidal Categories) A well-ormed equation between morphism terms in the language o monoidal categories ollows rom the axioms o monoidal categories i and only i it holds, up to planar isotopy, in the graphical language.

Symmetry A symmetric monoidal category additionally is equipped with a natural isomorphism, called symmetry B x,y : x y y x Symmetry B A,B : A B B A

Coherence or Symmetric Monoidal Categories Theorem (Selinger (2011), Coherence or Symmetric Monoidal Categories) A well-ormed equation between morphisms in the language o symmetric monoidal categories ollows rom the axioms o symmetric monoidal categories i and only i it holds, up to isomorphism o diagrams, in the graphical language.

Traced Monoidal Categories Deinition (Traced Monoidal Categories) A symmetric monoidal category (C,, 1, b) (where b is the symmetry) is said to be traced i it is equipped with a natural amily o unctions TrA,B : C(A, B ) C(A, B) satisying ive axioms: it is natural in A and B (let/right tightening), and dinatural in (sliding) vanishing: Tr Y A,B ( ) = Tr A,B (Tr A Y,B ( ))( : A Y B Y ) superposing: TrC A,C B (id C ) = id C TrA,B ( )( : A B ) yanking: Tr, (b, ) = id

Axioms or Traced Categories Trace: Naturality (Let Tightening): h = h Naturality (Right Tightening): h = h

Axioms or Traced Categories Dinaturality (Sliding): h = h Vanishing(I): = I Vanishing ( ): =

Axioms or Traced Categories Superposing: = Yanking: =

Coherence or Traced Categories Theorem (Joyal/Street (1991), Coherence or Traced Monoidal Categories) A well-ormed equation between morphisms in the language o symmetric traced categories ollows rom the axioms o symmetric traced categories i and only i it holds in the graphical language up to isomorphism o diagrams.

Strictness Deinition (Hasegawa (2003), Strictness) Consider a traced monoidal category C with trace Tr. We say h : Y is strict in C (with respect to the trace Tr) i the ollowing condition holds: For any : A B and g : A Y B Y, (id B h) = g (id A g) : A B Y A B A Y id A h g B Y id B h implies TrA,B ( ) = Tr A,B Y (g) : A B.

Strictness Strictness: A B A Y h = Y h g B Y A B A B = g

Uniormity Deinition (Hasegawa (2003), Uniormity) Let C be a traced monoidal category with trace Tr, and S be a class o arrows o C. We say Tr is uniorm (or: Tr satisies the uniormity principle) or S i, or any h : Y o S, the condition o strictness holds.

Trace-Fixpoint Correspondence Theorem (Hasegawa (1997), Conway Operator Correspondence to Traces) For any category with inite products, to give a Conway operator is to give a trace (where inite products are taken as the monoidal structure). : A = Tr A, ( ) : A g : A B Tr A,B (g) = π B, (g (id A π B, )) : A B

Diagrammatic Language or Product Categories A inite product category can be described as a symmetric monoidal category, together with natural amilies o copy and erase maps, with a number o axioms (omitted here, see Selinger (2011)). A : A A A (copy) A A A! A : A 1 (erase) A

Some Axioms or the Graphical Language = = = =

Coherence or Traced Product Categories Theorem (Selinger (2011), Coherence or Traced Product Categories) A well-ormed equation between morphism terms in the language o traced product categories ollows rom the respective axioms i and only i it holds in the graphical language, up to isomorphism o diagrams, and the diagrammatic manipulations corresponding to the axioms.

Conway Operators Deinition (Simpson/Plotkin (2000), Conway Operator) A parameterized ixpoint operator on C is a amily o unctions ( ) : C(A, ) C(A, ) which is natural in A and satisies the ixpoint equation = id A, : A or : A. A Conway operator on C is a parameterized ixpoint operator ( ) which satisies dinaturality: ( st A,, g ) = id A, (g st A,Y, ) : A or : A Y and g : A Y diagonal property: ( (id A )) = ( ) : A or : A.

Uniormity or Conway Operators Deinition (Hasegawa (2003), Plotkin s Principle) Let ( ) be a parameterized ixpoint operator on a category with inite products. We say h : Y is strict (with respect to ( ) ) i the ollowing condition holds: For any : A and g : A Y Y,h = g (id A h) A A Y id A h implies g = h : A Y. g Y h

Dualities Products are dual to coproducts. Traced coproduct categories can be constructed in the same way as product categories, i.e. a symmetric monoidal category plus maps A : A + A A and! A : 0 A (given a coproduct structure). The axioms are dual to the axioms or traced product categories. The distinction does not matter or deinitions o Conway operators or similar notions.

Monads Deinition (Moggi (1991), Kleisli Triple) A Kleisli triple over a category C is a triple (T ; η; ), where T : Ob(C) Ob(C), η A : A TA or A Ob(C), : TA TB or : A TB and the ollowing equations hold: ηa = id TA (1) η A = or : A TB (2) g = (g ) or : A TB and g : B TC (3)

Elgot Monads Deinition (Complete Elgot Monad) A monad T over C is a complete Elgot monad i it possesses an operator, called iteration, sending any : T (Y + ) to : TY satisying the ollowing conditions: ixpoint: [η, ] = ; naturality: g = ([T (inl) g, η inr] ) or any g : Y TZ; codiagonal: (T ([id, inr]) g) = g or any g : T ((Y + ) + ); uniormity: h = T (id h) g h = g or any g : Z T (Y + Z) and h : Z

Elgot Monads Fixpoint: Y = Y Y Naturality: Y g Z = g Y Z

Elgot Monads Uniormity: Z h Y Z = g h Y Z Z h Y Z = g Y Z

Elgot Monads Codiagonal: g Y = g Y

Elgot Monads g Y = g Y = g Y = g Y

Elgot Monads g Y = g Y

Algebraic Operations Deinition (Algebraic Operation) Given a monad T on a symmetric monoidal category C, an algebraic operation α on T is a amily o maps (T ) v (T ) w, demanding that the exponentials (T ) v and (T ) w exist in C, such that ( ) id α = α Y ( ) id : T ( Y ) w T ( Y ) w. Further, the ollowing interaction between exponentials and the strength must commute: τ w (id α Y ) = α v τ v : TY T ( Y ) w, where τ z = curry(τ(id ev) assoc) : A TB z T (A B) z or any z, assoc being the obvious associativity o the tensor.

Algebraic Operations (T ) v α (T ) w ( ) id ( ) id (TY ) v TY v α Y id α Y (TY ) w TY w τ v τ w T ( Y ) v α v T ( Y ) w

Example: Nondeterminism To express nondeterminism we can use the powerset monad T = P. The algebraic operation is v : (T ) 2 T with v(u, v) = u v. This means, or two possible continuations both are possible or put dierently one is chosen nondeterministically.

Generic Eect Deinition (Generic Eect) Given an monad T, a generic eect is any Kleisli morphism : n Tm. Equivalently, i C = Sets, and n N, : n Tm is given by a tuple ( 1 Tm,..., n Tm).

Generic Eects or the Nondeterminism Monad In nondeterminism the generic eects are: stop : 1 T 0 toss : 1 T 2 Our monad is the powerset monad, so T 0 = P0 corresponds to the set with the single element being the empty set and T 2 = P2 is the powerset o the set {1, 2}, which is {, {1}, {2}, {1, 2}}.

Diagrammatic Representation or Generic Eects Example: Nondeterminism. From toss : 1 T 2, where T 2 = T (1 + 1), one can construct Toss : T ( + ) in the ollowing way id toss τ 1 T 2 T ( (1 + 1)) T dist T ( (1 + 1)) T ( + ) Toss: Toss

Duality Theorem (Duality) To construct an algebraic operation α x : (T ) v (T ) w rom a generic eect g : w Tv, there is the sequence id,id uncurry(α v curry(η snd)) w w w Tv with curry(η snd) w (Tv) v α v (Tv) w uncurried. To ind a term α x : (T ) v (T ) w given g : w Tv, we need to curry the ollowing: (T ) v id g w (T ) v τ Tv T ((T ) v ev v) T

Proo For the proo the ollowing equations have been veriied: α x = curry(ev τ(id g)) g = uncurry(α v curry(η snd)) id, id ( ) id curry(ev τ(id g)) = curry(ev τ(id g)) ( ) id τ w (id curry(ev τ(id g))) = curry(ev τ(id g))τ v

Reerences Peter Selinger (2011) A Survey o Graphical Languages or Monoidal Categories New Structures or Physics Lecture Notes in Physics Volume 813, pp 289-355. Springer Verlag. Andre Joyal, Ross Street (1991) The geometry o tensor calculus I Advances in Mathematics 88(1), pp 55-112. Masahito Hasegawa (2003) The Uniormity Principle on Traced Monoidal Categories Electronic Notes in Theoretical Computer Science Volume 69, pp 137-155. Masahito Hasegawa (1997) Recursion rom cyclic sharing: traced monoidal categories and models o cyclic lambda calculi Proc. Typed Lambda Calculi and Applications (TLCA?97) Springer Lecture Notes in Computer Science 1210, pp 196?213.. Eugenio Moggi (1991) Notions o Computation and Monads Inormation and Computation Volume 93, pp 55-92. Alex Simpson, Gordon Plotkin (2000) Complete axioms or categorical ixed-point operators Proc. 15th Logic in Computer Science LICS 2000, pp 30?41.

The End