List Objects with Algebraic Structure Marcelo Fiore and Philip - - PowerPoint PPT Presentation

list objects with algebraic structure
SMART_READER_LITE
LIVE PREVIEW

List Objects with Algebraic Structure Marcelo Fiore and Philip - - PowerPoint PPT Presentation

List Objects with Algebraic Structure Marcelo Fiore and Philip Saville University of Cambridge Computer Laboratory 6th September 2017 1 / 26 A unifying framework for many diverse examples of list objects with algebraic structure 2 / 26


slide-1
SLIDE 1

List Objects with Algebraic Structure

Marcelo Fiore and Philip Saville

University of Cambridge Computer Laboratory

6th September 2017

1 / 26

slide-2
SLIDE 2

A unifying framework for many diverse examples of list objects with algebraic structure

2 / 26

slide-3
SLIDE 3

Notions of natural number in Cpo

Flat natural numbers, µA.(1 + A): ⊥ 0 1 2 3 · · · Lazy natural numbers, µA.(1 + A)⊥: ⊥ s(⊥) 1 s2(⊥) · · · · · · Strict natural numbers, µA.A⊥: · · · 1 ⊥

3 / 26

slide-4
SLIDE 4

Notions of natural number in Cpo

Flat natural numbers, µA.(1 + A): ⊥ 0 1 2 3 · · · Lazy natural numbers, µA.(1 + A)⊥: ⊥ s(⊥) 1 s2(⊥) · · · · · · Strict natural numbers, µA.A⊥: · · · 1 ⊥ Our contribution: all these are natural numbers objects with algebraic structure.

3 / 26

slide-5
SLIDE 5

The monadic list transformer

4 / 26

slide-6
SLIDE 6

The monadic list transformer

We want to model effects as monads.

4 / 26

slide-7
SLIDE 7

The monadic list transformer

We want to model effects as monads. Problem: monads do not compose straightforwardly!

4 / 26

slide-8
SLIDE 8

The monadic list transformer

We want to model effects as monads. Problem: monads do not compose straightforwardly! Want to

4 / 26

slide-9
SLIDE 9

The monadic list transformer

We want to model effects as monads. Problem: monads do not compose straightforwardly! Want to

◮ Build new monads from old, while

4 / 26

slide-10
SLIDE 10

The monadic list transformer

We want to model effects as monads. Problem: monads do not compose straightforwardly! Want to

◮ Build new monads from old, while ◮ Lifting the operations from our old monad to the new one.

4 / 26

slide-11
SLIDE 11

The monadic list transformer

We want to model effects as monads. Problem: monads do not compose straightforwardly! Want to

◮ Build new monads from old, while ◮ Lifting the operations from our old monad to the new one.

Definition

The list transformer of Jaskelioff takes a monad T to the monad Lt(T)X := µA.T(1 + X × A).

4 / 26

slide-12
SLIDE 12

The monadic list transformer

We want to model effects as monads. Problem: monads do not compose straightforwardly! Want to

◮ Build new monads from old, while ◮ Lifting the operations from our old monad to the new one.

Definition

The list transformer of Jaskelioff takes a monad T to the monad Lt(T)X := µA.T(1 + X × A). Our contribution: universal description as a list object with algebraic structure.

4 / 26

slide-13
SLIDE 13

Abstract syntax with binding and metavariables (Fiore et al.)

To build the abstract syntax of a type system...

5 / 26

slide-14
SLIDE 14

Abstract syntax with binding and metavariables (Fiore et al.)

To build the abstract syntax of a type system... Without binding: freely generate the terms from the rules and basic terms. Constructors modelled as algebras.

5 / 26

slide-15
SLIDE 15

Abstract syntax with binding and metavariables (Fiore et al.)

To build the abstract syntax of a type system... Without binding: freely generate the terms from the rules and basic terms. Constructors modelled as algebras. With binding: freely generate the algebra with

5 / 26

slide-16
SLIDE 16

Abstract syntax with binding and metavariables (Fiore et al.)

To build the abstract syntax of a type system... Without binding: freely generate the terms from the rules and basic terms. Constructors modelled as algebras. With binding: freely generate the algebra with

◮ A monoid structure modelling binding,

5 / 26

slide-17
SLIDE 17

Abstract syntax with binding and metavariables (Fiore et al.)

To build the abstract syntax of a type system... Without binding: freely generate the terms from the rules and basic terms. Constructors modelled as algebras. With binding: freely generate the algebra with

◮ A monoid structure modelling binding, ◮ A compatibility law between binding and constructors, so that e.g. app(σ, τ)[x → ω] = app(σ[x → ω], τ[x → ω]).

5 / 26

slide-18
SLIDE 18

Abstract syntax with binding and metavariables (Fiore et al.)

To build the abstract syntax of a type system... Without binding: freely generate the terms from the rules and basic terms. Constructors modelled as algebras. With binding: freely generate the algebra with

◮ A monoid structure modelling binding, ◮ A compatibility law between binding and constructors, so that e.g. app(σ, τ)[x → ω] = app(σ[x → ω], τ[x → ω]).

Abstract syntax = free such structure = a list object with algebraic structure.

5 / 26

slide-19
SLIDE 19

A unifying framework for many diverse examples of list objects with algebraic structure

◮ Notions of natural numbers in domain theory, ◮ The monadic list transformer, ◮ Abstract syntax with binding and metavariables, ◮ Algebraic operations, ◮ Instances of the Haskell MonadPlus type class, ◮ Higher-dimensional algebra.

6 / 26

slide-20
SLIDE 20

This talk

7 / 26

slide-21
SLIDE 21

This talk

list objects

  • T-list objects

7 / 26

slide-22
SLIDE 22

This talk

list objects ◮ well-understood datatype

  • T-list objects

◮ extends datatype of lists

7 / 26

slide-23
SLIDE 23

This talk

list objects ◮ well-understood datatype ◮ are free monoids

  • T-list objects

◮ extends datatype of lists ◮ are free T-monoids

7 / 26

slide-24
SLIDE 24

This talk

list objects ◮ well-understood datatype ◮ are free monoids ◮ described by µA.(I + X ⊗ A).

  • T-list objects

◮ extends datatype of lists ◮ are free T-monoids ◮ described by µA.T(I + X ⊗ A).

7 / 26

slide-25
SLIDE 25

This talk

list objects ◮ well-understood datatype ◮ are free monoids ◮ described by µA.(I + X ⊗ A).

  • T-list objects

◮ extends datatype of lists ◮ are free T-monoids ◮ described by µA.T(I + X ⊗ A). Gives a concrete way to reason about free T-monoids.

7 / 26

slide-26
SLIDE 26

This talk

list objects ◮ well-understood datatype ◮ are free monoids ◮ described by µA.(I + X ⊗ A).

  • T-list objects

◮ extends datatype of lists ◮ are free T-monoids ◮ described by µA.T(I + X ⊗ A). Gives a concrete way to reason about free T-monoids. Gives an algebraic structure for T-list objects.

7 / 26

slide-27
SLIDE 27

Past work: list objects in CCCs (Joyal, Cockett)

A list object L(X) on X consists of

8 / 26

slide-28
SLIDE 28

Past work: list objects in CCCs (Joyal, Cockett)

A list object L(X) on X consists of 1 nil − → L(X)

8 / 26

slide-29
SLIDE 29

Past work: list objects in CCCs (Joyal, Cockett)

A list object L(X) on X consists of 1 nil − → L(X)

cons

← − − X × L(X)

8 / 26

slide-30
SLIDE 30

Past work: list objects in CCCs (Joyal, Cockett)

A list object L(X) on X consists of 1 nil − → L(X)

cons

← − − X × L(X) that is initial:

8 / 26

slide-31
SLIDE 31

Past work: list objects in CCCs (Joyal, Cockett)

A list object L(X) on X consists of 1 nil − → L(X)

cons

← − − X × L(X) that is initial: given any (1 n − → A

c

← − X × A), there exists a unique iterator 1 L(X) X × L(X) 1 A X × A

nil it(n,c) cons X×it(n,c) n c

8 / 26

slide-32
SLIDE 32

List objects in a monoidal category (C, ⊗, I)

9 / 26

slide-33
SLIDE 33

List objects in a monoidal category (C, ⊗, I)

A list object L(X) on X consists of I

nil

− → L(X)

cons

← − − X ⊗ L(X)

9 / 26

slide-34
SLIDE 34

List objects in a monoidal category (C, ⊗, I)

A list object L(X) on X consists of I

nil

− → L(X)

cons

← − − X ⊗ L(X) that is parametrised initial:

9 / 26

slide-35
SLIDE 35

List objects in a monoidal category (C, ⊗, I)

A list object L(X) on X consists of I

nil

− → L(X)

cons

← − − X ⊗ L(X) that is parametrised initial: given any (P

n

− → A

c

← − X ⊗ A), there exists a unique iterator I ⊗ P L(X) ⊗ P X ⊗ L(X) ⊗ P P A X ⊗ A

nil⊗P ∼ = it(n,c) cons⊗P X⊗it(n,c) n c

9 / 26

slide-36
SLIDE 36

List objects in a monoidal category (C, ⊗, I)

Remark

If each (−) ⊗ P has a right adjoint, parametrised initiality is equivalent to the non-parametrised version: I L(X) X ⊗ L(X) I AP X ⊗ AP

nil it(n,c) cons X⊗it(n,c) n c

10 / 26

slide-37
SLIDE 37

List objects in a monoidal category (C, ⊗, I)

Connection to past work

◮ Closely connected to Kelly’s notion of algebraically-free monoid in a monoidal category. ◮ The list object L(I) is precisely a left natural numbers object in the sense of Par´ e and Rom´

  • an. E.g. the flat natural numbers

µA.(1 + A) in Cpo.

10 / 26

slide-38
SLIDE 38

List objects are free monoids

11 / 26

slide-39
SLIDE 39

List objects are free monoids

Definition

A monoid in a monoidal category (C, ⊗, I) is an object (I

e

− → M

m

← − M ⊗ M) such that the multiplication m is associative and e is a neutral element for this multiplication.

11 / 26

slide-40
SLIDE 40

List objects are free monoids

Lemma

  • 1. Every list object L(X) is a monoid.

11 / 26

slide-41
SLIDE 41

List objects are free monoids

Lemma

  • 1. Every list object L(X) is a monoid.
  • 2. This monoid is the free monoid on X, with universal map

X

∼ =

− → X ⊗ I

X⊗nil

− − − → X ⊗ L(X) cons − − → L(X) taking x → (x, ∗) → (x, []) → x :: [] = [x].

11 / 26

slide-42
SLIDE 42

List objects are free monoids

Lemma

  • 1. Every list object L(X) is a monoid.
  • 2. This monoid is the free monoid on X, with universal map

X

∼ =

− → X ⊗ I

X⊗nil

− − − → X ⊗ L(X) cons − − → L(X) taking x → (x, ∗) → (x, []) → x :: [] = [x]. We can reason concretely about free monoids by reasoning about lists.

11 / 26

slide-43
SLIDE 43

List objects are initial algebras

12 / 26

slide-44
SLIDE 44

List objects are initial algebras

Definition

An algebra for a functor F : C → C is a pair (A, α : FA → A).

12 / 26

slide-45
SLIDE 45

List objects are initial algebras

Definition

An algebra for a functor F : C → C is a pair (A, α : FA → A).

Lemma

If (C, ⊗, I) is a monoidal category with finite coproducts (0, +) and ω-colimits, both preserved by all (−) ⊗ P for P ∈ C, then the initial algebra of the functor

  • I + X ⊗ (−)
  • is a list object on X.

12 / 26

slide-46
SLIDE 46

List objects are initial algebras

Definition

An algebra for a functor F : C → C is a pair (A, α : FA → A).

Lemma

If (C, ⊗, I) is a monoidal category with finite coproducts (0, +) and ω-colimits, both preserved by all (−) ⊗ P for P ∈ C, then the initial algebra of the functor

  • I + X ⊗ (−)
  • is a list object on X.

Remark

This result relies on a general theory of parametrised initial algebras.

12 / 26

slide-47
SLIDE 47

The story so far

13 / 26

slide-48
SLIDE 48

The story so far

list objects

13 / 26

slide-49
SLIDE 49

The story so far

list objects ◮ well-understood datatype

13 / 26

slide-50
SLIDE 50

The story so far

list objects ◮ well-understood datatype ◮ are free monoids

13 / 26

slide-51
SLIDE 51

The story so far

list objects ◮ well-understood datatype ◮ are free monoids ◮ described by µA.(I + X ⊗ A).

13 / 26

slide-52
SLIDE 52

Rest of this talk

list objects ◮ well-understood datatype ◮ are free monoids ◮ described by µA.(I + X ⊗ A).

  • T-list objects

(new work)

◮ extends datatype of lists ◮ are free T-monoids ◮ described by µA.T(I + X ⊗ A).

13 / 26

slide-53
SLIDE 53

Rest of this talk

list objects ◮ well-understood datatype ◮ are free monoids ◮ described by µA.(I + X ⊗ A).

  • T-list objects

(new work)

◮ extends datatype of lists ◮ are free T-monoids ◮ described by µA.T(I + X ⊗ A). ...and instantiate this for applications

13 / 26

slide-54
SLIDE 54

Compatible algebraic structure

14 / 26

slide-55
SLIDE 55

Compatible algebraic structure

Definition

A monad on a category C is a functor T : C → C equipped with a multiplication µ : T 2 → T and a unit η : IdC → T satisfying associativity and unit laws.

14 / 26

slide-56
SLIDE 56

Compatible algebraic structure

Definition

A monad on a category C is a functor T : C → C equipped with a multiplication µ : T 2 → T and a unit η : IdC → T satisfying associativity and unit laws.

Definition

An algebra for a monad (T, µ, η) is a pair (A, α : TA → A) satisfying unit and associativity laws.

14 / 26

slide-57
SLIDE 57

Compatible algebraic structure

Definition

A monad on a category C is a functor T : C → C equipped with a multiplication µ : T 2 → T and a unit η : IdC → T satisfying associativity and unit laws.

Definition

An algebra for a monad (T, µ, η) is a pair (A, α : TA → A) satisfying unit and associativity laws.

Definition

A strong monad T is a monad on a monoidal category (⊗, I) that is equipped with a natural transformation stA,B : T(A) ⊗ B → T(A ⊗ B) satisfying coherence laws.

14 / 26

slide-58
SLIDE 58

List objects with algebraic structure

15 / 26

slide-59
SLIDE 59

T-list objects

15 / 26

slide-60
SLIDE 60

T-list objects

Let (T, st) be a strong monad on a monoidal category (⊗, I). A T-list object M(X) on X consists of I M(X) X ⊗ M(X)

nil cons

15 / 26

slide-61
SLIDE 61

T-list objects

Let (T, st) be a strong monad on a monoidal category (⊗, I). A T-list object M(X) on X consists of T(M(X)) I M(X) X ⊗ M(X)

τ nil cons

15 / 26

slide-62
SLIDE 62

T-list objects

Let (T, st) be a strong monad on a monoidal category (⊗, I). A T-list object M(X) on X consists of T(M(X)) I M(X) X ⊗ M(X)

τ nil cons

such that for every structure TA P A X ⊗ A

α n c

15 / 26

slide-63
SLIDE 63

T-list objects

Let (T, st) be a strong monad on a monoidal category (⊗, I). A T-list object M(X) on X consists of T(M(X)) I M(X) X ⊗ M(X)

τ nil cons

such that for every structure TA P A X ⊗ A

α n c

there exists a unique mediating map it(n, c, α) : M(X) ⊗ P → A

15 / 26

slide-64
SLIDE 64

T-list objects

such that I ⊗ P M(X) ⊗ P X ⊗ M(X) ⊗ P P A X ⊗ A

nil⊗P

∼ = it(n,c,α)

cons⊗P

X⊗it(n,c,α) n c

and T

  • M(X)
  • ⊗ P

T(M(X) ⊗ P) TA M(X) ⊗ P A

τ⊗P

stM(X),P T(it(n,c,α))

α it(n,c,α)

16 / 26

slide-65
SLIDE 65

T-list objects

Remark

Every list object is a T-list object. If every (−) ⊗ P has a right adjoint, the iterator it(n, c, α) is a T-algebra homomorphism.

16 / 26

slide-66
SLIDE 66

Natural numbers in Cpo, revisited

Flat natural numbers, µA.(1 + A): ⊥ 0 1 2 3 · · · Lazy natural numbers, µA.(1 + A)⊥: ⊥ s(⊥) 1 s2(⊥) · · · · · · Strict natural numbers, µA.A⊥: · · · 1 ⊥

17 / 26

slide-67
SLIDE 67

Natural numbers in Cpo as T-list objects on the unit

Flat natural numbers, µA.(1 + A): ⊥ 0 1 2 3 · · · Lazy natural numbers, µA.(1 + A)⊥: ⊥ s(⊥) 1 s2(⊥) · · · · · · Strict natural numbers, µA.A⊥: · · · 1 ⊥

17 / 26

slide-68
SLIDE 68

Natural numbers in Cpo as T-list objects on the unit

Flat natural numbers, µA.(1 + A): ⊥ 0 1 2 3 · · · T-list object with (×, 1) structure and monad T = Id Lazy natural numbers, µA.(1 + A)⊥: ⊥ s(⊥) 1 s2(⊥) · · · · · · Strict natural numbers, µA.A⊥: · · · 1 ⊥

17 / 26

slide-69
SLIDE 69

Natural numbers in Cpo as T-list objects on the unit

Flat natural numbers, µA.(1 + A): ⊥ 0 1 2 3 · · · T-list object with (×, 1) structure and monad T = Id Lazy natural numbers, µA.(1 + A)⊥: ⊥ s(⊥) 1 s2(⊥) · · · · · · T-list object with (×, 1) structure and T := (−)⊥ the lifting monad Strict natural numbers, µA.A⊥: · · · 1 ⊥

17 / 26

slide-70
SLIDE 70

Natural numbers in Cpo as T-list objects on the unit

Flat natural numbers, µA.(1 + A): ⊥ 0 1 2 3 · · · T-list object with (×, 1) structure and monad T = Id Lazy natural numbers, µA.(1 + A)⊥: ⊥ s(⊥) 1 s2(⊥) · · · · · · T-list object with (×, 1) structure and T := (−)⊥ the lifting monad Strict natural numbers, µA.A⊥: · · · 1 ⊥ T-list object with (+, 0) structure and T := (−)⊥ the lifting monad

17 / 26

slide-71
SLIDE 71

Monoids with compatible algebraic structure

18 / 26

slide-72
SLIDE 72

T-monoids

18 / 26

slide-73
SLIDE 73

T-monoids

Let (T, st) be a strong monad on on a monoidal category (⊗, I). A T-monoid

  • EM-monoid (Pir´
  • g)
  • is a monoid

I M M ⊗ M

18 / 26

slide-74
SLIDE 74

T-monoids

Let (T, st) be a strong monad on on a monoidal category (⊗, I). A T-monoid

  • EM-monoid (Pir´
  • g)
  • is a monoid equipped with a

T-algebra TM I M M ⊗ M

τ

18 / 26

slide-75
SLIDE 75

T-monoids

Let (T, st) be a strong monad on on a monoidal category (⊗, I). A T-monoid

  • EM-monoid (Pir´
  • g)
  • is a monoid equipped with a

T-algebra TM I M M ⊗ M

τ

compatible in the sense that T(C) ⊗ C T(C ⊗ C) TC C ⊗ C C

stC,C c⊗C Tm c m

18 / 26

slide-76
SLIDE 76

T-monoids

Let (T, st) be a strong monad on on a monoidal category (⊗, I). A T-monoid

  • EM-monoid (Pir´
  • g)
  • is a monoid equipped with a

T-algebra TM I M M ⊗ M

τ

compatible in the sense that T(C) ⊗ C T(C ⊗ C) TC C ⊗ C C

stC,C c⊗C Tm c m

Remark

T-monoids generalise both monoids and T-algebras.

18 / 26

slide-77
SLIDE 77

T-monoids

Remark

In the context of abstract syntax, T is freely generated from some theory, and T-monoids are models of this theory.

19 / 26

slide-78
SLIDE 78

T-monoids

Remark

In the context of abstract syntax, T is freely generated from some theory, and T-monoids are models of this theory.

Lemma

For every monoid M the endofunctor T := M ⊗ (−) is a monad, and T-Mon(C) ≃

  • M/Mon(C)
  • .

19 / 26

slide-79
SLIDE 79

T-monoids

Remark

In the context of abstract syntax, T is freely generated from some theory, and T-monoids are models of this theory.

Lemma

For every monoid M the endofunctor T := M ⊗ (−) is a monad, and T-Mon(C) ≃

  • M/Mon(C)
  • .

Example

In particular, a T-monoid for the endofunctor T := S ⊗ (−) is precisely an algebraic operation with signature S in the sense of Jaskelioff, and can be identified with a map S

η

− → L(S) → M interpreting S inside M.

19 / 26

slide-80
SLIDE 80

T-monoids

Remark

In the context of abstract syntax, T is freely generated from some theory, and T-monoids are models of this theory.

Lemma

For every monoid M the endofunctor T := M ⊗ (−) is a monad, and T-Mon(C) ≃

  • M/Mon(C)
  • .

Example

Thinking of a Lawvere theory as a monoid LM in

  • SetF, y(1), •
  • , we

can identify Lawvere theories extending LM with T-monoids for T := M • (−).

19 / 26

slide-81
SLIDE 81

T-list objects are free T-monoids

20 / 26

slide-82
SLIDE 82

T-list objects are free T-monoids

For a strong monad (T, st) on a monoidal category (⊗, I),

20 / 26

slide-83
SLIDE 83

T-list objects are free T-monoids

For a strong monad (T, st) on a monoidal category (⊗, I),

Lemma

  • 1. Every T-list object M(X) is a T-monoid.

20 / 26

slide-84
SLIDE 84

T-list objects are free T-monoids

For a strong monad (T, st) on a monoidal category (⊗, I),

Lemma

  • 1. Every T-list object M(X) is a T-monoid.
  • 2. This T-monoid is the free T-monoid on X, with universal map

X

∼ =

− → X ⊗ I

X⊗nil

− − − → X ⊗ M(X) cons − − → M(X)

20 / 26

slide-85
SLIDE 85

T-list objects are free T-monoids

For a strong monad (T, st) on a monoidal category (⊗, I),

Lemma

  • 1. Every T-list object M(X) is a T-monoid.
  • 2. This T-monoid is the free T-monoid on X, with universal map

X

∼ =

− → X ⊗ I

X⊗nil

− − − → X ⊗ M(X) cons − − → M(X) We can reason concretely about free T-monoids by reasoning about T-lists.

20 / 26

slide-86
SLIDE 86

T-list objects are initial algebras

21 / 26

slide-87
SLIDE 87

T-list objects are initial algebras

For a strong monad (T, st) on a monoidal category (⊗, I),

Lemma

If every (−) ⊗ P preserves binary coproducts, and the initial algebra exists, then µA.T(I + X ⊗ A) is a T-list object on X.

21 / 26

slide-88
SLIDE 88

Theorem

Let T be a strong monad on a monoidal category (C, I, ⊗) with binary coproducts (+). If

  • 1. for every P ∈ C, the endofunctor (−) ⊗ P preserves binary

coproducts, and

  • 2. for every X ∈ C, the initial algebra of T(I + X ⊗ −) exists

Then C has all T-list objects and, thereby, the free T-monoid monad MT.

22 / 26

slide-89
SLIDE 89

Theorem

Let T be a strong monad on a monoidal category (C, I, ⊗) with binary coproducts (+). If

  • 1. for every P ∈ C, the endofunctor (−) ⊗ P preserves binary

coproducts, and

  • 2. for every X ∈ C, the initial algebra of T(I + X ⊗ −) exists

Then C has all T-list objects and, thereby, the free T-monoid monad MT.

Remark

Thinking in terms of T-list objects makes the proof straightforward!

22 / 26

slide-90
SLIDE 90

Technical contribution

23 / 26

slide-91
SLIDE 91

Technical contribution

µA.(I + X ⊗ A) list object free monoid

23 / 26

slide-92
SLIDE 92

Technical contribution

µA.(I + X ⊗ A) list object free monoid T-list object

23 / 26

slide-93
SLIDE 93

Technical contribution

µA.(I + X ⊗ A) list object free monoid T-list object free T-monoid

23 / 26

slide-94
SLIDE 94

Technical contribution

µA.(I + X ⊗ A) list object free monoid µA.T(I + X ⊗ A) T-list object free T-monoid

23 / 26

slide-95
SLIDE 95

Technical contribution

µA.(I + X ⊗ A) list object free monoid µA.T(I + X ⊗ A) T-list object free T-monoid Remark

A natural extension: algebraic structure encapsulated by Lawvere theories or operads. This gives rise to a notion of near-semiring category, which underlies many of the applications.

23 / 26

slide-96
SLIDE 96

Applications

24 / 26

slide-97
SLIDE 97

Applications

T-NNOs

In a a monoidal category (⊗, I): NNO = list object on I T-NNO = T-list object on I In Cpo: gives rise to the flat-, lazy- and strict natural numbers.

24 / 26

slide-98
SLIDE 98

Applications

Functional programming

◮ In the bicartesian closed setting: Jaskelioff’s monadic list transformer Lt(T)X := µA.T(1 + X × A) is just the free T-monoid monad.

24 / 26

slide-99
SLIDE 99

Applications

Functional programming

◮ In the bicartesian closed setting: Jaskelioff’s monadic list transformer Lt(T)X := µA.T(1 + X × A) is just the free T-monoid monad. ◮ In the category of endofunctors over a cartesian category: the MonadPlus type class Mp(F)X := µA.List(X + FA) of Rivas et al. is a List-list object.

24 / 26

slide-100
SLIDE 100

Applications

Functional programming

◮ In the bicartesian closed setting: Jaskelioff’s monadic list transformer Lt(T)X := µA.T(1 + X × A) is just the free T-monoid monad. ◮ In the category of endofunctors over a cartesian category: the MonadPlus type class Mp(F)X := µA.List(X + FA) of Rivas et al. is a List-list object. ◮ In the category of endofunctors over a cartesian category: the datatype Bun(F)X := µA.(1 + X × A + F(A) × A + A × A) is an instance of Spivey’s Bunch type class that is a T-list

  • bject for T the extension of the theory of monoids with a

unary operator.

24 / 26

slide-101
SLIDE 101

Applications

Functional programming

◮ In the bicartesian closed setting: Jaskelioff’s monadic list transformer Lt(T)X := µA.T(1 + X × A) is just the free T-monoid monad. ◮ In an nsr-category: the MonadPlus type class Mp(F)X := µA.List∗(X + F ⊗ A) is a List∗-list object. ◮ In an nsr-category: Bun(F)X := µA.

  • J + (I + X ⊗ A + A) ∗ A
  • is an instance of Spivey’s Bunch type class that is a T-list
  • bject for T the extension of the theory of monoids with a

unary operator.

24 / 26

slide-102
SLIDE 102

Applications

Abstract syntax and variable binding (Fiore et al.)

In the category of presheaves SetF with substitution tensor product (P • Q)(n) = m∈F (Pm) × (Qn)m

24 / 26

slide-103
SLIDE 103

Applications

Abstract syntax and variable binding (Fiore et al.)

In the category of presheaves SetF with substitution tensor product (P • Q)(n) = m∈F (Pm) × (Qn)m we get abstract syntax = free T-monoid on variables = µA.T(V + X • A)

24 / 26

slide-104
SLIDE 104

Applications

Abstract syntax and variable binding (Fiore et al.)

In the category of presheaves SetF with substitution tensor product (P • Q)(n) = m∈F (Pm) × (Qn)m we get abstract syntax = free T-monoid on variables = µA.T(V + X • A) abstract syntax is a list object with algebraic structure

24 / 26

slide-105
SLIDE 105

Applications

Abstract syntax and variable binding (Fiore et al.)

In the category of presheaves SetF with substitution tensor product (P • Q)(n) = m∈F (Pm) × (Qn)m we get abstract syntax = free T-monoid on variables = µA.T(V + X • A)

Remark

This relies on a slightly more general theory, in which the strength stX,I→P : T(X) ⊗ P → T(X ⊗ P) only acts on pointed objects.

24 / 26

slide-106
SLIDE 106

Applications

Higher-dimensional algebra

The web monoid in Szawiel and Zawadowski’s construction of

  • petopes is a T-list object in an nsr-category.

24 / 26

slide-107
SLIDE 107

Summary: List objects with algebraic structure

25 / 26

slide-108
SLIDE 108

Summary: List objects with algebraic structure

µA.(I + X ⊗ A) list object free monoid µA.T(I + X ⊗ A) T-list object free T-monoid

25 / 26

slide-109
SLIDE 109

Summary: List objects with algebraic structure

µA.(I + X ⊗ A) list object free monoid µA.T(I + X ⊗ A) T-list object free T-monoid

Framework unifying a wide range of examples.

25 / 26

slide-110
SLIDE 110

Summary: List objects with algebraic structure

µA.(I + X ⊗ A) list object free monoid µA.T(I + X ⊗ A) T-list object free T-monoid

Framework unifying a wide range of examples. Algebraic structure list-style datatype. Simpler proofs!

(e.g. abstract syntax, opetopes?)

25 / 26

slide-111
SLIDE 111

Summary: List objects with algebraic structure

µA.(I + X ⊗ A) list object free monoid µA.T(I + X ⊗ A) T-list object free T-monoid

Framework unifying a wide range of examples. Algebraic structure list-style datatype. Simpler proofs!

(e.g. abstract syntax, opetopes?)

Initial algebra definition universal property.

(e.g. monadic list transformer, MonadPlus)

25 / 26

slide-112
SLIDE 112

Summary: List objects with algebraic structure

µA.(I + X ⊗ A) list object free monoid µA.T(I + X ⊗ A) T-list object free T-monoid

Framework unifying a wide range of examples. Algebraic structure list-style datatype. Simpler proofs!

(e.g. abstract syntax, opetopes?)

Initial algebra definition universal property.

(e.g. monadic list transformer, MonadPlus)

A journal-length version is in preparation.

25 / 26