Itegories J.R.B. Cockett Department of Computer Science University - - PowerPoint PPT Presentation

itegories
SMART_READER_LITE
LIVE PREVIEW

Itegories J.R.B. Cockett Department of Computer Science University - - PowerPoint PPT Presentation

Itegories Itegories J.R.B. Cockett Department of Computer Science University of Calgary Alberta, Canada robin@cpsc.ucalgary.ca (work with: Pieter Hofstra, Chad Nester) Aviero, June 2015 Itegories Introduction Restriction category Basics


slide-1
SLIDE 1

Itegories

Itegories

J.R.B. Cockett

Department of Computer Science University of Calgary Alberta, Canada robin@cpsc.ucalgary.ca (work with: Pieter Hofstra, Chad Nester)

Aviero, June 2015

slide-2
SLIDE 2

Itegories

Introduction Restriction category Basics Extensivity Independence Disjoins Constructions Itegories Basics Traces Cartesian itegories Computability Stack objects Abstract machine

slide-3
SLIDE 3

Itegories Introduction

WHAT IS THIS TALK ABOUT? Answer: a very elementary setting for describing sequential computation ... The semantics of flow diagrams ... (an old topic) (Dana Scott, Elgot, Steve Bloom, Ernie Manes, Bob Walters, ...)

slide-4
SLIDE 4

Itegories Introduction

To the memory of Bob Walters: He would not have described it this way nor necessarily would he have approved but an itegory is something he certainly thought about ...

slide-5
SLIDE 5

Itegories Introduction

What is an Itegory

An itegory is a disjoin restriction category .... with a Kleene wand. Idea: (a) Disjoint unions of (partial) maps: f ⊔ g (b) A Kleene wand f : A − → A g : A − → B f ⊥ g f ∗ | g : A − → B f ⊥ g means f is disjoint from g ... Kleene wand is a way of specifying a particle style trace. Begin with restriction categories ...

slide-6
SLIDE 6

Itegories Restriction category Basics

A restriction category is a category X equipped with a restriction: A

f

− − → B A − − →

f

A [R.1] f f = f [R.2] f g = g f [R.3] f g = f g [R.4] f g = fgf A map f is said to be total when f = 1.

Lemma

(i) f f = f (iv) f g = f g (ii) f is monic then f = 1 (v) f = f (iii) fg = f g (vi) f , g total implies fg total.

slide-7
SLIDE 7

Itegories Restriction category Basics

COMPLETENESS: Every restriction category is a full subcategory

  • f a real category of partial maps!

(A convenient algebraic framework for partial maps ...)

slide-8
SLIDE 8

Itegories Restriction category Basics

Partial products

A restriction category has a partial terminal object, 1, in case for each object A there is a total map !A : A − → 1 such that given any

  • ther map h : A −

→ 1 we have h = h!A. A restriction category has partial products in case for each pair of

  • bject A and B there is an object A × B and total maps

π0 : A × B − → A and π1 : A × B − → B such that given any pair of maps f : X − → A and g : X − → B there is a map f , g : X − → A × B with f , gπ0 = gf and f , gπ1 = f g. A X

f

⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧

g

❄ ❄ ❄ ❄ ❄ ❄ ❄

f ,g

A × B

π0

❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋

π1

①①①①①①①①①

B

slide-9
SLIDE 9

Itegories Restriction category Basics

Cartesian restriction categories

A restriction category which has partial products is a cartesian restriction category. (a.k.a. “P-category” developed by Robinson and Rossolini) Any Cartesian restriction category has a total category with real products and terminal object.

slide-10
SLIDE 10

Itegories Restriction category Basics

Examples of restriction categories

  • 1. The category of sets and partial maps Par(Set, monic).
  • 2. Any partial map category: a favourite is CRingop with

localizations L. Then Par(CRingop, L) is a restriction category (of use in algebraic geometry).

  • 3. The category of topological spaces with partial maps defined
  • n an open subset and a continuous map on that subset.
  • 4. The category sSLatop with stable maps (i.e. binary meet

preserving maps). The category of locales with stable maps (i.e. binary meet and join preserving maps).

  • 5. Partial recursive maps on the natural numbers.
  • 6. Given any partial algebraic theory T there is a classifying

cartesian restriction category C(T ) with a generic model of the partial algebraic theory. For example, there is a generic partial combinatory algebra which lives in its own environment and gives a generic version of computability.

slide-11
SLIDE 11

Itegories Restriction category Basics

Partial Combinator Algebras (PCAs)

With partial product one can express arbitrary partial algebras. Here is a Partial Combinatory Algebra (PCA):

  • : A × A −

→ A k, s : 1 − → A such that k = 11 and s = 11 A × A

π0

▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼

k×1×1

A × A × A

  • 2
  • A

(A × A) × A

θ×

  • s×1×1×1

A × A × A × A

  • 3
  • (A × A) × (A × A)

(•ו)•

A

(s × 1 × 1)•2 = 1 Remark: Given an (internal) PCA one can not only express all computations but also one has the usual undecidability results associated with computability.

slide-12
SLIDE 12

Itegories Restriction category Extensivity

Restriction zeros

A restriction category has a restriction zeros if for each pair of

  • bjects A and B there is a map 0 : A −

→ B such that

◮ f 0g = 0 ◮ 0 = 0

If a zero map splits then the category has a zero object. If a restriction category has restriction zeros then it is enriched

  • ver pointed sets.

Note that this category is also the category of sets and partial maps. Sets and partial maps have restriction zeros.

slide-13
SLIDE 13

Itegories Restriction category Extensivity

Coproducts and extensivity

An extensive restriction category has coproducts, restriction zeros, and a decision operator: f : X − → Y + Z f : X − → X + X [Dec.1] ∇f = f [Dec.2] (f + f )f = (σ0 + σ1)f d : X − → X + X is a decision in case d = d. Binary decisions imply n-ary decisions d : A − → A + ... + A (these satisfy ∇d = d and (d + ... + d)d = (σ1 + ... + σn)d). Extensivity implies unique decomposition as the coproduct is a pre-biproduct: f = ((σ(−1) σ0) + (σ(−1)

1

σ1)f = (σ(−1) + σ(−1)

1

)(f + f )f = ∇(σ(−1) f + σ(−1)

1

f )f = (σ(−1) f ⊔ σ(−1)

1

f )

slide-14
SLIDE 14

Itegories Restriction category Extensivity

Extensivity cont.

Why is extensivity important? Every map between coproducts an be written as a matrix .. X1 + ... + Xn − − − − − − − − − − − − − − − − →

A =   a11 ... a1n ... am1 ... amn  

Y1 + ... + Ym where the ith rows must be separated by a decision di such that aij = σjdi

slide-15
SLIDE 15

Itegories Restriction category Independence

Independence

An independence space (X, X) is a set with a set of finite subsets X ⊆ Pf (X) which are down-closed and contain all singletons. A morphism f : (X, X) − → (Y , Y) between independence spaces is a partial map f : X − → Y which, when restricted to any independent subset, becomes a partial isomorphism. Each X ′ ∈ X determines a restriction idempotent eX ′ : X − → X, we require that eX ′f is a partial isomorphism and (eX ′f )(−1) determines an independent subset of Y . independent subsets cannot be “squashed” by maps ... The category of independence spaces is an extensive restriction

  • category. It does not have partial products but it has various

tensors ....

slide-16
SLIDE 16

Itegories Restriction category Independence

Independence spaces

Have the following (non-symmetric) tensor product: (A, A) ⊳ (B, B) = (A × B, A ⊳ B) where X ∈ A ⊳ B if and only if {a|∃b.(a, b) ∈ X} ∈ A & Xa = {b|(a, b) ∈ X} ∈ B b11 . . . bm1 . . . b1n

  • · · ·

bmnm

  • a1

· · · am Every object has a naturally coassociative comultiplication ...

slide-17
SLIDE 17

Itegories Restriction category Independence

Enriching in Independence

Require that each X(A, B)∗ (remove zero) is an independence space and ( ) : X(A, B)∗ − → X(A, A)∗ and composition are independence space maps.

◮ Parallel arrows {f1, ..., fn} are independent if and only if

{f1, ..., fn} is.

◮ If {f1, ..., fn} are independent and fi ≤ f ′ i then {f ′ 1, ..., f ′ n} are

independent.

◮ f and g are independent then f g = 0.

Proof (of last) If {f , g} is independent then {(f , f ), (f , g), (g, f ), (g, g)} is independent in X(A, A) ⊳ X(A, A) but under composition f g = g f so these non-diagonal pairs are squashed under composition so cannot be defined. This means that these composites must be zero.

slide-18
SLIDE 18

Itegories Restriction category Independence

Examples of independences

◮ Given any restriction category X with a restriction zero

declare the independent sets on X(A, B)∗ (where we remove the zero) to be the singleton sets.

◮ Given any restriction category X with a restriction zero

declare the independent sets on X(A, B)∗ to consist of the finite sets X ′ ⊆ X(A, B)∗ such that for each distinct pair f , g ∈ X ′ we have f g = 0.

◮ (Separation) Given any extensive category X declare

{f1, ..., fn} ⊆ X(A, B)∗ independent in case there is a decision d : A − → A + ... + A such that fi ≤ σ(−1)

i

d. Does separation in extensive categories cover all examples? Answer: Yes

slide-19
SLIDE 19

Itegories Restriction category Disjoins

Disjoin restriction categories

A disjoin restriction category is independence enriched so that independent parallel maps have a join f ⊔ g satisfying;

◮ f ≤ f ⊔ g and g ≤ f ⊔ g ◮ Given f ≤ h and g ≤ h then f ⊔ g ≤ h. ◮ It is stable (f ⊔ g)h = (fh) ⊔ (gh)

(and universal k(f ⊔ g) = (kf ) ⊔ (kg)).

◮ {fij|i ∈ I, j ∈ Ji} indep. if and only if { j∈Ji fij|i ∈ I} is indep.

In a disjoin restriction category binary independence suffice: {f1, ..., fn} is independent iff fn−1 ⊥ fn fn−2 ⊥ fn−1 ⊔ fn ... f1 ⊥ f2 ⊔ ... ⊔ fn Extensive restriction cats are disjoin with respect to separation.

slide-20
SLIDE 20

Itegories Restriction category Disjoins

Constructions ...

There are a series of constructions: Independence restriction

dj

  • Disjoin restriction

Mat

  • dj∞

Infinitely disjoin restriction

Extensive restriction

slide-21
SLIDE 21

Itegories Restriction category Constructions

Constructions ...

Given any independence restriction category there is a universal disjoin restriction category into which it embeds η : X − → dj(X) dj(X) is defined as follows: Objects: The same as X, X ∈ X; Maps: A map is an independent subset F ⊆ X(X, Y )∗; Composition: FG = {fg|f ∈ F, g ∈ G}; Identities: 1X = {1X}; Restriction: F = {f |f ∈ F}; Disjointness: {Fi|i ∈ I} is independent if and only if

i Fi is

independent. Join: F ⊔ G = F ∪ G. The embedding preserves the independence structure ...

slide-22
SLIDE 22

Itegories Restriction category Constructions

Constructions ...

Given any disjoin restriction category there is a universal extensive restriction category into which it embeds η : X − → Mat(X) preserving the disjointness and independence properties: Objects: Maps A : IA − → obj(X) where I is a finite set. Maps: Matrices M : A − → B where M : IA × IB − → Map(X) with ∂0(M(i, j)) = A(i) and ∂1(M(i, j)) = B(j) and {M(i, j)|j ∈ IB} independent. Composition: MN(i, j) =

k M(i, k)N(k, j)

Identities: 1A : A − → A has 1A(i, i) = 1A(i) and 1A(i, i′) = 0

  • therwise.

Restriction: M(i, i) =

j M(i, j) and M(i.i′) = 0 otherwise.

Disjointness: M ⊥ M′ if and only if M(i, j) ⊥ M′(i, j). Join: (M ⊔ N)(i, j) = M(i, j) ⊔ N(i, j). Note Mat(Mat(X)) ≡ Mat(X) ...

slide-23
SLIDE 23

Itegories Restriction category Constructions

A final construction ...

An independence set is infinitely independent if all its finite subsets are independent. Given any disjoin restriction category there is a universal infinite disjoin restriction category into which it embeds η : X − → dj∞(X).

  • bjects: As for X.

Maps: F ⊆ X(A, B) closed to finite disjoins and down-closed. composition: FG =⇓ {

i,j figj|f ∈ F, g ∈ G} where we must add

disjoins and down-close the set of composites. Identity: 1A = {e|e ≤ 1A}. Restriction: F = {f |f ∈ F}. Disjointness: F ⊥ G if and only if for every f ∈ F and g ∈ G we have f ⊥ g. Join: The disjoin and down-closure of the union.

slide-24
SLIDE 24

Itegories Itegories Basics

Itegories

An itegory is a disjoint restriction category with a combinator, which we call the Kleene wand: A

f

− − → A A

g

− − → B f ⊥ g A − − − − →

f ∗ | g

B which satisfies (Conway equations): [W.1] When f ⊥ h then (gf ) ∗ | h = h ⊔ ((fg) ∗ | (hg))f ; [W.2] When f ⊥ g, g ⊥ h, and h ⊥ g then (f ⊔ g) ∗ | h = (f ∗ | g) ∗ | (f ∗ | h). The Kleene wand f ∗ | g means intuitively “iterate f until g can be applied.” i.e. repeat f until g do g. Note f and g must be disjoint, where f ⊥ g means {f , g} is independent, so that the decision to continue or finish in this iteration is unambiguous.

slide-25
SLIDE 25

Itegories Itegories Basics

Itegories

The Kleene wand is both a colax combinator and a lax

  • combinator. This means.

A

≥ a

  • f

A

a

  • A′

f ′

A′

A

≥ a

  • g

B

b

  • A′

g′

B′

f ⊥ g A

a

f ∗

| g B

b

  • A′

f ′∗

| g′

B′

where one can reverse the inequalities to get the colax form. With equalities this condition is often called uniformity. Uniformity and lax implies colax.

slide-26
SLIDE 26

Itegories Itegories Basics

Itegories

A full subcategory of an itegory is an itegory. If E is any set of idempotents then SplitE(X) is an itegory whenever X is.

◮ f ∗

| h = (f ∗ | h)f ⊔ h;

◮ 0 ∗

| g = g;

◮ f ∗

| h = h(f ∗ | h);

◮ If c ⊥ d then (bac ∗

| d)ba = (acb ∗ | db)a = cba ∗ | dba;

◮ (f ∗

| h)h = h;

◮ If h∗f = f and h∗ ⊥ h then f ∗

| h = h.

◮ f ∗

| 0 = 0;

◮ f ∗

| (hg) = (f ∗ | h)g;

◮ When g ⊥ g′ then f ∗

| g ⊥ f ∗ | g′ and f ∗ | (g ⊔ g′) = (f ∗ | g) ⊔ (f ∗ | g′);

◮ If f ≤ f ′ and g ≤ g′ then f ∗

| g ≤ f ′ ∗ | g′.

slide-27
SLIDE 27

Itegories Itegories Basics

Inductive itegories

A uniform wand combinator on a disjoint restriction category is an inductive Kleene wand in case it satisfies: [iW.1] (f ∗ | g)f ⊔ g ≤ f ∗ | g; [iW.2] xf ≤ x and hg ≤ x implies (f ∗ | g)h ≤ x; Proposition: A disjoin restriction category with an inductive Kleene wand is an itegory. Corollary: Every disjoin restriction category can be embedded into an itegory. Proof Infinitely complete the disjoin restriction category. Define f ∗ | g :=

  • i=0

gf i We must show {f ig|i ≤ n} is independent: note that g ⊥ fg and g ⊥ f (g ⊔ fg) = fg ⊔ f 2g, but then g ⊥ f (g ⊔ fg ⊔ f 2g ⊔ f 3g ⊔ ....

slide-28
SLIDE 28

Itegories Itegories Traces

Traces and itegories

We shall denote the trace of a map f = f00 f01 f10 f11

  • : A + X −

→ B + X Tr(f ) = f00 f01 f10 f11

  • : A −

→ B We may (inter)define: f ∗ | g := 1 g f

  • a

b c d

  • := a ⊔ (d ∗

| c)b

Theorem

A disjoint restriction category is an itegory if and only if Mat(X) is a (lax and colaxly) traced extensive category: the trace and Kleene wand are inter-related as above.

slide-29
SLIDE 29

Itegories Itegories Cartesian itegories

Distributive restriction catgeories

Proposition: A Cartesian restriction category with coproducts is extensive if and

  • nly it it has a restriction zero and the product distributes over the

coproduct (i.e. it is a distributive restriction category). A cartesian disjoin restriction category is a disjoint restriction category with partial products in which the product functors A × preserve disjunction and independence. Proposition: The extensive (matrix) completion of a cartesian disjoin restriction category has partial products and, thus, is a distributive restriction category.

slide-30
SLIDE 30

Itegories Itegories Cartesian itegories

Cartesian itegories

In a cartesian itegory is a cartesian disjoin restriction category in which one requires that the product functors preserve iteration: that (A × f ) ∗ | (A × g) = A × (f ∗ | g) This ensures that iteration in context behaves correctly. Claim that this now provides a basic semantics of flow diagrams ...

slide-31
SLIDE 31

Itegories Computability

Computabilty in cartesian itegories

We can work without loss in the extensive completion ... SO assume we are working in a distributive itegory ...

slide-32
SLIDE 32

Itegories Computability Stack objects

Stack objects

Our aim is to build a partial combinator algebra for this we need: A stack object is an object with maps: put = nl|cns : 1 + A × A − → A get : A − → 1 + A × A such that put get = 11+A×A. This does force put to be a total map but there is, importantly, no requirement that get need be total.

Lemma

The following are equivalent conditions for an object: (i) 1 ⊳ A, A + A ⊳ A and A × A ⊳ A; (ii) 1 + A ⊳ A and A × A ⊳ A; (iii) 1 + A × A ⊳ A (it is a stack object).

slide-33
SLIDE 33

Itegories Computability Abstract machine

Creating a PCA from an abstract machine

Code Value Stack Code Value Stack end x [] exit with x k x s end k0(x) s k0(x) y s end x s s x s end s0(x) s s0(x) y s end s1(x, y) s s1(x, y) z s x z cns(c0(y, z), s) end v cns(c0(y, z), s) y z cns(c1(v), s) end v′ cns(c1(v), s) v v′ s Combinator reduction A × A × A

(step exit)

− − − − − − − → A × A × A + A A × A × A − − − − − − − →

step ∗ | exit

A

  • = (step ∗

| exit)(1 × 1 × [])

slide-34
SLIDE 34

Itegories Computability Abstract machine

The identity for s is the only difficulty: ((s • x) • y) • z = s1(x, y) • z = step ∗ | exit(s1(x, y), z, []) = σ0(c, v, d) → step ∗ | exit(c, v, d) σ1(x) → x

  • step(s1(x, y), z, [])

= step ∗ | exit(x, z, cons(c1(y, z), [])) = step ∗ | exit(x • z, end, cons(c1(y, z), [])) = step ∗ | exit(y, z, cons(c0(x • z), [])) = step ∗ | exit(y • z, end, cons(c0(x • z), [])) = step ∗ | exit(y • z, x • z, []) = (y • z) • (x • z) Where we use repeatedly the identity: step ∗ | exit(x, y, S) = step ∗ | exit(x • y, end, S) which, unfortunately, for a general trace and stack object may not hold!

slide-35
SLIDE 35

Itegories Computability Abstract machine

For this identity we require that our stack object is appending that is has a map append : A × A − → A which satisfies A × A × A

cons×1

  • 1×append A × A

cons

  • A × A

append

A

1 × A

nil×1 π1

  • A × A

append

qqqqqqqqqqqq

A A × A

snoc×1

  • append

A

snoc

  • (1 + A × A) × A

  • A + A × A × A

snoc+1

  • 1 + A × A + A × A × A

σ0|(1×nil×1)σ1|σ1

  • 1 + A × A × A

1+1×append

1 + A × A

slide-36
SLIDE 36

Itegories Computability Abstract machine

EXIT!