Enriched Lawvere Theories theories for Operational Semantics - - PowerPoint PPT Presentation

enriched lawvere theories
SMART_READER_LITE
LIVE PREVIEW

Enriched Lawvere Theories theories for Operational Semantics - - PowerPoint PPT Presentation

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction Enriched Lawvere Theories theories for Operational Semantics Lawvere theories enriched theories enrichment enriched categories enriched


slide-1
SLIDE 1

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Enriched Lawvere Theories for Operational Semantics

John C. Baez Christian Williams

University of California, Riverside

SYCO 4, May 22 2019

slide-2
SLIDE 2

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Introduction

How do we integrate syntax and semantics?

  • bject

type morphism term ∗ 2-morphism rewrite ∗

slide-3
SLIDE 3

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Operational semantics

algebraic theories : denotational semantics (ab)c = a(bc) enriched theories : operational semantics

slide-4
SLIDE 4

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Lawvere theories

Th(Mon) type M monoid

  • perations

m: M2 → M multiplication e : 1 → M identity equations

M3 M2 M2 M2 M M2 1 × M M M M × 1

slide-5
SLIDE 5

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Enriched theories

Th(PsMon) type M pseudomonoid

  • perations

⊗: M2 → M multiplication I: 1 → M identity rewrites

M3 M2 M2 M2 M M2 1 × M M M M × 1 ⇓ α ⇓ λ ρ ⇓

equations pentagon, triangle identities

slide-6
SLIDE 6

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Enriched categories

Let V be monoidal. A V-enriched category has hom-objects in V; composition and identity are morphisms in V, as are the components of a V-functor and a V-natural transformation: V-category C(a, b) ∈ V V-functor Fab : C(a, b) → D(F(a), F(b)) ∈ V V-transformation ϕa : 1V → D(F(a), G(a)) ∈ V. These form the 2-category VCat.

slide-7
SLIDE 7

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Our enriching category

Let V be a cartesian closed category: V(a × b, c) ∼ = V(a, [b, c]). Then V ∈ VCat. Let V ∈ CCCfc(1), meaning assume and choose: nV :=

  • n

1V. Let NV := {nV|n ∈ N} ⊂full V and AV := Nop

V

– our “arities”.

slide-8
SLIDE 8

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Enriched products

The V-product of (ai) ∈ C is an object

i ai ∈ C equipped

with a V-natural isomorphism C(−,

i ai) ∼

=

i C(−, ai).

A V-functor F : C → D preserves V-products if the “projections” induce a V-natural isomorphism: D(−, F(

i ai)) ∼

=

i D(−, F(ai)).

Let VCatfp be the 2-category of V-categories with finite V-products and V-functors preserving them.

slide-9
SLIDE 9

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Enriched Lawvere theories

Definition

A V-theory is a V-category T ∈ VCatfp whose objects are finite V-products of a distinguished object. A morphism of V-theories is a V-functor F : T → T′ ∈ VCatfp. These and V-natural transformations form the 2-category of V-theories, VLaw.

slide-10
SLIDE 10

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Enriched models

Definition

A context is a V-category C ∈ VCatfp. A model of T is a V-functor µ: T → C ∈ VCatfp. The category of models is Mod(T, C) := VCatfp(T, C).

slide-11
SLIDE 11

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Example: monoidal categories

Let V = Cat. Th(PsMon) type M pseudomonoid

  • perations

⊗: M2 → M multiplication I: 1 → M identity rewrites

M3 M2 M2 M2 M M2 1 × M M M M × 1 ⇓ α ⇓ λ ρ ⇓

equations pentagon, triangle identities

slide-12
SLIDE 12

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Example: cartesian object

Let V = Cat. Th(Cart) type X cartesian object

  • perations

m: X2 → X product e : 1 → X terminal element rewrites △: idX = ⇒ m ◦ ∆X unit of m ⊢ ∆X π: ∆X ◦ m = ⇒ idX2 counit of m ⊢ ∆X ⊤: idX = ⇒ e ◦ !X unit of e ⊢!X ǫ: !X ◦ e = ⇒ id1 counit of e ⊢!X equations triangle identities

slide-13
SLIDE 13

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Change of base

Let F : V → W preserve finite products, and C ∈ VCat. Then F induces a change of base: F∗(C)(a, b) := F(C(a, b)). This gives a 2-functor F∗ : VCat → WCat. Enrichment provides semantics, so change of base should preserve theories to be a change of semantics.

slide-14
SLIDE 14

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Preservation of theories

Theorem

Let F : V → W ∈ CCCfc(1). Then F is a change of semantics: F∗ preserves theories. For every V-theory τV : AV → T, τW := AW

− → F∗(AV)

F∗(τV)

− − − − → F∗(T) is a W-theory. F∗ preserves models. For every model µ: T → C, F∗(µ): F∗(T) → F∗(C) is a model of (F∗(T), τW).

slide-15
SLIDE 15

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Change of semantics

There is a “spectrum” of semantics: Gph ⊣ Cat ⊣ Pos ⊣ Set

FC UG FP UC FS UP

FC∗ maps small-step to big-step operational semantics. FP∗ maps big-step to full-step operational semantics. FS∗ maps full-step to denotational semantics.

slide-16
SLIDE 16

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

The theory of SKI

Th(SKI) type t terms S : 1 → t K : 1 → t I : 1 → t (− −): t2 → t rewrites σ: (((S a) b) c) ⇒ ((a c) (b c)) κ: ((K a) b) ⇒ a ι: (I a) ⇒ a

slide-17
SLIDE 17

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

A model of Th(SKI)

A Gph-product preserving Gph-functor µ: Th(SKI) → Gph yields a graph µ(t) of SKI-terms: 1 ∼ = µ(1) µ(t) µ(t2) ∼ = µ(t)2.

µ(S) µ((− −))

The rewrites are transferred by the enrichment of µ: µ1,t : Th(SKI)(1, t) → Gph(1, µ(t)).

slide-18
SLIDE 18

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

The free model of SKI

The syntax and semantics of the SKI combinator calculus are given by the free model µGph

SKI := Th(SKI)(1, −): Th(SKI) → Gph.

The graph µGph

SKI (t) is the transition system which represents

the small-step operational semantics of the SKI-calculus: (µ(a) → µ(b) ∈ µGph

SKI (t)) ⇐

⇒ (a ⇒ b ∈ Th(SKI)(1, t)).

slide-19
SLIDE 19

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Change of semantics

FC: Gph → Cat preserves products, hence gives a change of semantics from small-step to big-step operational semantics:

(((S K) (I K)) S) (((S K) K) S) ((K S) ((I K) S)) ((K S) (K S)) S.

σ ι σι ισ κσ κσι κισ σ ι κ κ

FP: Cat → Pos gives full-step (Hasse diagram), and FS: Pos → Set gives denotational semantics, collapsing the connected component to a point.

slide-20
SLIDE 20

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Conclusion

Enriched theories give a way to unify the structure and behavior of formal languages. Enriching in category-like structures reifies operational semantics by incorporating rewrites between terms. Cartesian functors between enriching categories induce change-of-semantics functors between categories of models.

slide-21
SLIDE 21

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

Acknowledgements

This paper builds on the ideas of Mike Stay and Greg Meredith presented in “Representing operational semantics with enriched Lawvere theories”. We gratefully acknowledge the support of Pyrofex Corporation, and we appreciate their letting us develop this work for the distributed computing system RChain.

slide-22
SLIDE 22

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

References I

  • F. W. Lawvere, Functorial semantics of algebraic theories,

reprinted in Repr. Theory Appl. Categ. 5 (2004), 1–121.

  • G. M. Kelly, Basic Concepts of Enriched Category Theory,

reprinted in Repr. Theory Appl. Categ. 10 (2005), 1–136.

  • G. D. Plotkin, A structural approach to operational

semantics, J. Log. Algebr Program. 60/61 (2004) 17–139.

  • M. Hyland and J. Power, Discrete Lawvere theories and

computational effects, in Theoretical Comp. Sci. 366 (2006), 144–162.

  • R. B. B. Lucyshyn-Wright, Enriched algebraic theories and

monads for a system of arities, Theory Appl. Categ. 31 (2016), 101–137.

slide-23
SLIDE 23

Enriched Lawvere Theories for Operational Semantics John C. Baez Christian Williams Introduction theories

Lawvere theories enriched theories

enrichment

enriched categories enriched products

enriched theories

V-theories examples

change of semantics

change of base preserving theories

applications

combinators change of base

Conclusion

References II

H.P. Barendregt, The Lambda Calculus, its syntax and semantics, in Studies in Logic and The Foundations of Mathematics, Elsevier, London, 1984.

  • R. Milner, Communicating and Mobile Systems: The Pi

Calculus, in Cambridge University Press, Cambridge, UK, 1999.

  • M. Stay and L. G. Meredith, Representing operational

semantics with enriched Lawvere theories.