1. The Method of Coalgebra Jan Rutten CWI Amsterdam & Radboud - - PowerPoint PPT Presentation

1 the method of coalgebra
SMART_READER_LITE
LIVE PREVIEW

1. The Method of Coalgebra Jan Rutten CWI Amsterdam & Radboud - - PowerPoint PPT Presentation

1. The Method of Coalgebra Jan Rutten CWI Amsterdam & Radboud University Nijmegen IMS, Singapore - 15 September 2016 Overview of Lecture one 1. Category theory (where coalgebra comes from) 2. Algebras and coalgebras 3. Induction and


slide-1
SLIDE 1
  • 1. The Method of Coalgebra

Jan Rutten

CWI Amsterdam & Radboud University Nijmegen

IMS, Singapore - 15 September 2016

slide-2
SLIDE 2

Overview of Lecture one

  • 1. Category theory (where coalgebra comes from)
  • 2. Algebras and coalgebras
  • 3. Induction and coinduction
  • 4. The method of coalgebra
  • 5. Discussion
slide-3
SLIDE 3
  • 1. Category theory

(where coalgebra comes from)

slide-4
SLIDE 4

Why categories?

From Samson Abramsky’s tutorial: Categories, why and how? (Dagstuhl, January 2015)

slide-5
SLIDE 5

Why categories?

For logicians: gives a syntax-independent view of the fundamental structures of logic, opens up new kinds of models and interpretations. For philosophers: a fresh approach to structuralist foundations

  • f mathematics and science; an alternative to the traditional

focus on set theory. For computer scientists: gives a precise handle on abstraction, representation-independence, genericity and more. Gives the fundamental mathematical structures underpinning programming concepts.

slide-6
SLIDE 6

Why categories?

For mathematicians: organizes your previous mathematical experience in a new and powerful way, reveals new connections and structure, allows you to “think bigger thoughts”. For physicists: new ways of formulating physical theories in a structural form. Recent applications to Quantum Information and Computation. For economists and game theorists: new tools, bringing complex phenomena into the scope of formalisation.

slide-7
SLIDE 7

Category Theory in Slogans

  • 1. Always ask: what are the types?
  • 2. Think in terms of arrows rather than elements.
  • 3. Ask what mathematical structures do, not what they are.
  • 4. Functoriality!
  • 5. Universality!
  • 6. Duality!

+ several others. All of the above are most relevant for coalgebra.

slide-8
SLIDE 8

Categories: basic definitions

A category C consists of

  • Objects A, B, C, . . .
  • Morphisms/arrows: for each pair of objects A, B, a set of

morphisms C(A, B) with domain A and codomain B

  • Composition of morphisms: g ◦ f:

A g ◦ f

  • f

B

g

C

  • Identity morphisms: A

1A

A

  • Axioms:

h ◦ (g ◦ f) = (h ◦ g) ◦ f f ◦ 1A = f = 1B ◦ f

slide-9
SLIDE 9

Categories: examples

  • Any kind of mathematical structure, together with structure

preserving functions, forms a category. E.g.

  • sets and functions
  • groups and group homomorphisms
  • monoids and monoid homomorphisms
  • vector spaces over a field k, and linear maps
  • topological spaces and continuous functions
  • partially ordered sets and monotone functions
  • Monoids are one-object categories
  • algebras, and algebra homomorphisms
  • coalgebras, and coalgebra homomorphisms
slide-10
SLIDE 10

Always ask: what are the types?

A f

B

g

C

For instance, for sets and functions: Not: let f be a function defined for any x by f(x) = . . . Rather: let f : X → Y be a function defined for any x ∈ X by f(x) = . . .

slide-11
SLIDE 11

Think in terms of arrows rather than elements

A function f : X → Y (between sets) is:

  • injective:

∀x, y ∈ X : f(x) = f(y) ⇒ x = y

  • surjective:

∀y ∈ Y ∃x ∈ X : f(x) = y

  • monic:

∀g, h : f ◦ g = f ◦ h ⇒ g = h A g

  • h

B

f

C

  • epic:

∀g, h : g ◦ f = h ◦ f ⇒ g = h A B h

  • g
  • C

f

slide-12
SLIDE 12

Think in terms of arrows rather than elements

A function f : X → Y (between sets) is:

  • injective:

∀x, y ∈ X : f(x) = f(y) ⇒ x = y

  • surjective:

∀y ∈ Y ∃x ∈ X : f(x) = y

  • monic:

∀g, h : f ◦ g = f ◦ h ⇒ g = h A g

  • h

B

f

C

  • epic:

∀g, h : g ◦ f = h ◦ f ⇒ g = h A B h

  • g
  • C

f

slide-13
SLIDE 13

Think in terms of arrows rather than elements

A function f : X → Y (between sets) is:

  • injective:

∀x, y ∈ X : f(x) = f(y) ⇒ x = y

  • surjective:

∀y ∈ Y ∃x ∈ X : f(x) = y

  • monic:

∀g, h : f ◦ g = f ◦ h ⇒ g = h A g

  • h

B

f

C

  • epic:

∀g, h : g ◦ f = h ◦ f ⇒ g = h A B h

  • g
  • C

f

slide-14
SLIDE 14

Think in terms of arrows rather than elements

Proposition

  • m is injective iff m is monic.
  • e is surjective iff e is epic.
slide-15
SLIDE 15

Ask what mathematical structures do, not what they are

Defining the Cartesian product . . .

  • with elements:

A × B = { a, b | a ∈ A, b ∈ B } where a, b = {{a, b}, b} This definition of the product is by no means canonical, does not seem to express any of its intrinsic properties, feels like coding.

slide-16
SLIDE 16

Ask what mathematical structures do, not what they are

Defining the Cartesian product . . .

  • with elements:

A × B = { a, b | a ∈ A, b ∈ B } where a, b = {{a, b}, b} This definition of the product is by no means canonical, does not seem to express any of its intrinsic properties, feels like coding.

slide-17
SLIDE 17

Ask what mathematical structures do, not what they are

Defining the Cartesian product . . .

  • with elements:

A × B = { a, b | a ∈ A, b ∈ B } where a, b = {{a, b}, b} This definition of the product is by no means canonical, does not seem to express any of its intrinsic properties, feels like coding.

slide-18
SLIDE 18

Ask what mathematical structures do, not what they are

Defining the Cartesian product . . .

  • with arrows (expressing a universal property):

∀C ∀f

  • ∀g
  • f, g

  • A

A × B π1

  • π2

B

This defines the behaviour of the product by specifying its interactions with other objects.

slide-19
SLIDE 19

Ask what mathematical structures do, not what they are

Defining the Cartesian product . . .

  • with arrows (expressing a universal property):

∀C ∀f

  • ∀g
  • f, g

  • A

A × B π1

  • π2

B

This defines the behaviour of the product by specifying its interactions with other objects.

slide-20
SLIDE 20

Ask what mathematical structures do, not what they are

Defining the Cartesian product . . .

  • with arrows (expressing a universal property):

∀C ∀f

  • ∀g
  • f, g

  • A

A × B π1

  • π2

B

This defines the behaviour of the product by specifying its interactions with other objects.

slide-21
SLIDE 21

Functoriality!

A functor F : C → D maps: (i) each object A in C to an object F(A) in D (ii) each arrow f : A → B in C to an arrow F(f) : F(A) → F(B) in D such that F(g ◦ f) = F(g) ◦ F(f) and F(idA) = idF(A) E.g., the powerset functor P : Set → Set maps sets X to P(X) = {V | V ⊆ X} and functions f : X → Y to P(f) : P(X) → P(Y) V → {f(v) | v ∈ V}

slide-22
SLIDE 22

Functoriality!

A functor F : C → D maps: (i) each object A in C to an object F(A) in D (ii) each arrow f : A → B in C to an arrow F(f) : F(A) → F(B) in D such that F(g ◦ f) = F(g) ◦ F(f) and F(idA) = idF(A) E.g., the powerset functor P : Set → Set maps sets X to P(X) = {V | V ⊆ X} and functions f : X → Y to P(f) : P(X) → P(Y) V → {f(v) | v ∈ V}

slide-23
SLIDE 23

Functoriality!

Is just natural since all we have are objects and arrows. Will be crucial for the definition of homomorphism between algebras and coalgebras.

slide-24
SLIDE 24

Functoriality!

Is just natural since all we have are objects and arrows. Will be crucial for the definition of homomorphism between algebras and coalgebras.

slide-25
SLIDE 25

Universality!

Ideally, definitions are phrased in terms of universal properties, which are typically formulated as: ∀ . . . ∃! . . . E.g., an object A in a category C is initial if: for any object B in C there exists a unique arrow from A to B: ∀ B A ∃!

  • Similarly, an object A is final if:

for any object B in C there exists a unique arrow from B to A: ∀ B ∃!

A

slide-26
SLIDE 26

Universality!

Ideally, definitions are phrased in terms of universal properties, which are typically formulated as: ∀ . . . ∃! . . . E.g., an object A in a category C is initial if: for any object B in C there exists a unique arrow from A to B: ∀ B A ∃!

  • Similarly, an object A is final if:

for any object B in C there exists a unique arrow from B to A: ∀ B ∃!

A

slide-27
SLIDE 27

Duality!

Informally, duality refers to the elementary process of “reversing the arrows” in a diagram. E.g., f is monic: ∀g, h : f ◦ g = f ◦ h ⇒ g = h A g

  • h

B

f

C

Reversing the arrows: ∀g, h : g ◦ f = h ◦ f ⇒ g = h A B h

  • g
  • C

f

  • That is, f is epic.
slide-28
SLIDE 28

Duality!

Informally, duality refers to the elementary process of “reversing the arrows” in a diagram. E.g., f is monic: ∀g, h : f ◦ g = f ◦ h ⇒ g = h A g

  • h

B

f

C

Reversing the arrows: ∀g, h : g ◦ f = h ◦ f ⇒ g = h A B h

  • g
  • C

f

  • That is, f is epic.
slide-29
SLIDE 29

Duality!

Informally, duality refers to the elementary process of “reversing the arrows” in a diagram. E.g., f is monic: ∀g, h : f ◦ g = f ◦ h ⇒ g = h A g

  • h

B

f

C

Reversing the arrows: ∀g, h : g ◦ f = h ◦ f ⇒ g = h A B h

  • g
  • C

f

  • That is, f is epic.
slide-30
SLIDE 30

Duality!

Informally, duality refers to the elementary process of “reversing the arrows” in a diagram. E.g., f is monic: ∀g, h : f ◦ g = f ◦ h ⇒ g = h A g

  • h

B

f

C

Reversing the arrows: ∀g, h : g ◦ f = h ◦ f ⇒ g = h A B h

  • g
  • C

f

  • That is, f is epic.
slide-31
SLIDE 31

Duality, formally

The opposite category Cop of a category C has:

  • the same objects as C
  • precisely one arrow f : B → A for every arrow f : A → B in C.

The principle of duality now says that we can dualize any statement about a category C by making the same statement about Cop. For instance, the notions of monic and epic are dual, since: Proposition: f is monic in C iff f is epic in Cop.

slide-32
SLIDE 32

Duality, formally

The opposite category Cop of a category C has:

  • the same objects as C
  • precisely one arrow f : B → A for every arrow f : A → B in C.

The principle of duality now says that we can dualize any statement about a category C by making the same statement about Cop. For instance, the notions of monic and epic are dual, since: Proposition: f is monic in C iff f is epic in Cop.

slide-33
SLIDE 33

Duality, formally

The opposite category Cop of a category C has:

  • the same objects as C
  • precisely one arrow f : B → A for every arrow f : A → B in C.

The principle of duality now says that we can dualize any statement about a category C by making the same statement about Cop. For instance, the notions of monic and epic are dual, since: Proposition: f is monic in C iff f is epic in Cop.

slide-34
SLIDE 34

Duality: products and coproducts

The product of A and B: ∀C f

  • g
  • f, g
  • A

A × B π1

  • π2

B

The coproduct of A and B: ∀C A κ1

  • f
  • A + B

[f, g]

  • B

κ2

  • g
  • Proposition:

O is product in C iff O is coproduct in Cop.

slide-35
SLIDE 35

Duality: products and coproducts

The product of A and B: ∀C f

  • g
  • f, g
  • A

A × B π1

  • π2

B

The coproduct of A and B: ∀C A κ1

  • f
  • A + B

[f, g]

  • B

κ2

  • g
  • Proposition:

O is product in C iff O is coproduct in Cop.

slide-36
SLIDE 36

Duality: products and coproducts

The product of A and B: ∀C f

  • g
  • f, g
  • A

A × B π1

  • π2

B

The coproduct of A and B: ∀C A κ1

  • f
  • A + B

[f, g]

  • B

κ2

  • g
  • Proposition:

O is product in C iff O is coproduct in Cop.

slide-37
SLIDE 37

Duality: products and coproducts

The product of A and B: ∀C f

  • g
  • f, g
  • A

A × B π1

  • π2

B

The coproduct of A and B: ∀C A κ1

  • f
  • A + B

[f, g]

  • B

κ2

  • g
  • Proposition:

O is product in C iff O is coproduct in Cop.

slide-38
SLIDE 38

Duality: initial and final objects

An object A in a category C is . . .

  • initial if for any object B there exists a unique arrow

A !

B

  • final if for any object B there exists a unique arrow

B !

A

Proposition: A is initial in C iff A is final in Cop.

slide-39
SLIDE 39

Duality: initial and final objects

An object A in a category C is . . .

  • initial if for any object B there exists a unique arrow

A !

B

  • final if for any object B there exists a unique arrow

B !

A

Proposition: A is initial in C iff A is final in Cop.

slide-40
SLIDE 40
  • 2. Algebras and Coalgebras
slide-41
SLIDE 41

Where coalgebra comes from

By duality. From algebra! Classically, algebras are sets with operations.

  • Ex. (N, 0, succ), with 0 ∈ N and succ : N → N.

Equivalently, 1 + N [zero, succ]

  • N

where 1 = {∗} and zero(∗) = 0.

slide-42
SLIDE 42

Where coalgebra comes from

By duality. From algebra! Classically, algebras are sets with operations.

  • Ex. (N, 0, succ), with 0 ∈ N and succ : N → N.

Equivalently, 1 + N [zero, succ]

  • N

where 1 = {∗} and zero(∗) = 0.

slide-43
SLIDE 43

Where coalgebra comes from

By duality. From algebra! Classically, algebras are sets with operations.

  • Ex. (N, 0, succ), with 0 ∈ N and succ : N → N.

Equivalently, 1 + N [zero, succ]

  • N

where 1 = {∗} and zero(∗) = 0.

slide-44
SLIDE 44

Algebra

Classically, algebras are sets with operations. Ex. Prog × Prog α

  • Prog

with α(P1, P2) = P1; P2.

slide-45
SLIDE 45

Algebra, categorically

For a functor F : C → C, an F-algebra is a pair (A, α) with F(X) α

  • X

We call F the type and α the structure map of (A, α). The structure map α tells us how the elements of A are constructed from other elements in A. E.g., a∗; b is constructed from the expressions a∗ and b by applying the operation of concatenation.

slide-46
SLIDE 46

Algebra, categorically

For a functor F : C → C, an F-algebra is a pair (A, α) with F(X) α

  • X

We call F the type and α the structure map of (A, α). The structure map α tells us how the elements of A are constructed from other elements in A. E.g., a∗; b is constructed from the expressions a∗ and b by applying the operation of concatenation.

slide-47
SLIDE 47

Algebra, categorically

For a functor F : C → C, an F-algebra is a pair (A, α) with F(X) α

  • X

We call F the type and α the structure map of (A, α). The structure map α tells us how the elements of A are constructed from other elements in A. E.g., a∗; b is constructed from the expressions a∗ and b by applying the operation of concatenation.

slide-48
SLIDE 48

Algebra homomorphisms

A homomorphism of F-algebras is an arrow f : A → B such that F(A) α

  • F(f)

F(B)

β

  • A

f

B

Note: functoriality! Homomorphisms are for algebras what functions are for sets: they allow us to express how algebras interact with other algebras.

slide-49
SLIDE 49

Algebra homomorphisms

A homomorphism of F-algebras is an arrow f : A → B such that F(A) α

  • F(f)

F(B)

β

  • A

f

B

Note: functoriality! Homomorphisms are for algebras what functions are for sets: they allow us to express how algebras interact with other algebras.

slide-50
SLIDE 50

Algebra homomorphisms

A homomorphism of F-algebras is an arrow f : A → B such that F(A) α

  • F(f)

F(B)

β

  • A

f

B

Note: functoriality! Homomorphisms are for algebras what functions are for sets: they allow us to express how algebras interact with other algebras.

slide-51
SLIDE 51

Coalgebra, dually

For a functor F : C → C, an F-coalgebra is a pair (A, α) with X α

  • F(X)

We call F the type and α the structure map of (A, α).

slide-52
SLIDE 52

Our favourite example: streams

Nω head, tail

  • N × Nω

where head(σ) = σ(0) tail(σ) = (σ(1), σ(2), σ(3), . . .) for any stream σ = (σ(0), σ(1), σ(2), . . .) ∈ Nω. Here the structure map tells us how streams are decomposed into a natural number and a stream.

slide-53
SLIDE 53

Our favourite example: streams

Nω head, tail

  • N × Nω

where head(σ) = σ(0) tail(σ) = (σ(1), σ(2), σ(3), . . .) for any stream σ = (σ(0), σ(1), σ(2), . . .) ∈ Nω. Here the structure map tells us how streams are decomposed into a natural number and a stream.

slide-54
SLIDE 54

Coalgebra homomorphisms

A homomorphism of F-coalgebras is an arrow f : A → B with A α

  • f

B

β

  • F(A)

F(f)

F(B)

Note: functoriality! Homomorphisms are for coalgebras what functions are for sets: they allow us to express the interaction between coalgebras.

slide-55
SLIDE 55

Coalgebra homomorphisms

A homomorphism of F-coalgebras is an arrow f : A → B with A α

  • f

B

β

  • F(A)

F(f)

F(B)

Note: functoriality! Homomorphisms are for coalgebras what functions are for sets: they allow us to express the interaction between coalgebras.

slide-56
SLIDE 56

Coalgebra homomorphisms

A homomorphism of F-coalgebras is an arrow f : A → B with A α

  • f

B

β

  • F(A)

F(f)

F(B)

Note: functoriality! Homomorphisms are for coalgebras what functions are for sets: they allow us to express the interaction between coalgebras.

slide-57
SLIDE 57

Example of a homomorphism

X

  • h

Y

  • A × X

id × h

A × Y

x0 a

x1

b

x2

a

x3

b

h

  • y0

a

y1

b

  • The homomorphism h identifies behaviourally equivalent states.
slide-58
SLIDE 58
  • 3. Induction and coinduction
  • initial algebra - final coalgebra
  • congruence - bisimulation
  • induction - coinduction
  • least fixed point - greatest fixed point
slide-59
SLIDE 59

Initial algebra

The natural numbers are an example of an initial algebra: 1 + N [zero, succ]

  • 1 + S

β ∀

  • N

∃ ! h

S

Inductive definitions are based on the (unique) existence of h. Inductive proofs are based on the uniqueness of h.

slide-60
SLIDE 60

Initial algebra

The natural numbers are an example of an initial algebra: 1 + N [zero, succ]

  • 1 + S

β ∀

  • N

∃ ! h

S

Inductive definitions are based on the (unique) existence of h. Inductive proofs are based on the uniqueness of h.

slide-61
SLIDE 61

Initial algebra

The natural numbers are an example of an initial algebra: 1 + N [zero, succ]

  • 1 + S

β ∀

  • N

∃ ! h

S

Inductive definitions are based on the (unique) existence of h. Inductive proofs are based on the uniqueness of h.

slide-62
SLIDE 62

Final coalgebra

Streams are an example of a final coalgebra: S β ∀

  • ∃ ! h

head, tail

  • N × S

N × Nω

(Note: instead of N, we could have taken any set.) Coinductive definitions are based on the existence of h. Coinductive proofs are based on the uniqueness of h.

slide-63
SLIDE 63

Final coalgebra

Streams are an example of a final coalgebra: S β ∀

  • ∃ ! h

head, tail

  • N × S

N × Nω

(Note: instead of N, we could have taken any set.) Coinductive definitions are based on the existence of h. Coinductive proofs are based on the uniqueness of h.

slide-64
SLIDE 64

Final coalgebra

Streams are an example of a final coalgebra: S β ∀

  • ∃ ! h

head, tail

  • N × S

N × Nω

(Note: instead of N, we could have taken any set.) Coinductive definitions are based on the existence of h. Coinductive proofs are based on the uniqueness of h.

slide-65
SLIDE 65

Algebra and induction

Induction = definition and proof principle for algebras.

  • Ex. mathematical induction: for all P ⊆ N,

( P(0) and (∀n : P(n) ⇒ P(succ(n))) ) ⇒ ∀n : P(n) (Other examples: transfinite, well-founded, tree, structural, etc.) We show that induction is a property of initial algebras.

slide-66
SLIDE 66

Algebra and induction

Induction = definition and proof principle for algebras.

  • Ex. mathematical induction: for all P ⊆ N,

( P(0) and (∀n : P(n) ⇒ P(succ(n))) ) ⇒ ∀n : P(n) (Other examples: transfinite, well-founded, tree, structural, etc.) We show that induction is a property of initial algebras.

slide-67
SLIDE 67

Algebra and induction

Induction = definition and proof principle for algebras.

  • Ex. mathematical induction: for all P ⊆ N,

( P(0) and (∀n : P(n) ⇒ P(succ(n))) ) ⇒ ∀n : P(n) (Other examples: transfinite, well-founded, tree, structural, etc.) We show that induction is a property of initial algebras.

slide-68
SLIDE 68

Algebra and induction

Induction = definition and proof principle for algebras.

  • Ex. mathematical induction: for all P ⊆ N,

( P(0) and (∀n : P(n) ⇒ P(succ(n))) ) ⇒ ∀n : P(n) (Other examples: transfinite, well-founded, tree, structural, etc.) We show that induction is a property of initial algebras.

slide-69
SLIDE 69

Algebras and congruences (ex. natural numbers)

We call R ⊆ N × N a congruence if (i) (0, 0) ∈ R and (ii) (n, m) ∈ R ⇒ (succ(n), succ(m)) ∈ R (Note: R is not required to be an equivalence relation.) Equivalently, R ⊆ N × N is a congruence if 1 + N [zero, succ]

  • 1 + R

γ ∃

  • 1 + N

[zero, succ]

  • N

R π1

  • π2

N

for some function γ : 1 + R → R.

slide-70
SLIDE 70

Algebras and congruences (ex. natural numbers)

We call R ⊆ N × N a congruence if (i) (0, 0) ∈ R and (ii) (n, m) ∈ R ⇒ (succ(n), succ(m)) ∈ R (Note: R is not required to be an equivalence relation.) Equivalently, R ⊆ N × N is a congruence if 1 + N [zero, succ]

  • 1 + R

γ ∃

  • 1 + N

[zero, succ]

  • N

R π1

  • π2

N

for some function γ : 1 + R → R.

slide-71
SLIDE 71

Initial algebras and congruences

Theorem: induction proof principle Every congruence R ⊆ N × N contains the diagonal: ∆ ⊆ R where ∆ = {(n, n) | n ∈ N}. Proof: Because (N, [zero, succ]) is an initial algebra, 1 + N [zero, succ]

  • 1 + R

γ ∃

  • 1 + N

[zero, succ]

  • N

!

R

π1

  • π2

N

!

  • we have π1◦! = id = π2◦!, which implies !(n) = (n, n), all n ∈ N.
slide-72
SLIDE 72

Initial algebras and congruences

Theorem: induction proof principle Every congruence R ⊆ N × N contains the diagonal: ∆ ⊆ R where ∆ = {(n, n) | n ∈ N}. Proof: Because (N, [zero, succ]) is an initial algebra, 1 + N [zero, succ]

  • 1 + R

γ ∃

  • 1 + N

[zero, succ]

  • N

!

R

π1

  • π2

N

!

  • we have π1◦! = id = π2◦!, which implies !(n) = (n, n), all n ∈ N.
slide-73
SLIDE 73

Initial algebras and induction

Theorem: The following are equivalent:

  • 1. For every congruence relation R ⊆ N × N,

∆ ⊆ R

  • 2. For every predicate P ⊆ N,

( P(0) and (∀n : P(n) ⇒ P(succ(n))) ) ⇒ ∀n : P(n) Proof: Exercise. In other words: two equivalent formulations of induction!

slide-74
SLIDE 74

Initial algebras and induction

Theorem: The following are equivalent:

  • 1. For every congruence relation R ⊆ N × N,

∆ ⊆ R

  • 2. For every predicate P ⊆ N,

( P(0) and (∀n : P(n) ⇒ P(succ(n))) ) ⇒ ∀n : P(n) Proof: Exercise. In other words: two equivalent formulations of induction!

slide-75
SLIDE 75

Initial algebras and induction

Theorem: The following are equivalent:

  • 1. For every congruence relation R ⊆ N × N,

∆ ⊆ R

  • 2. For every predicate P ⊆ N,

( P(0) and (∀n : P(n) ⇒ P(succ(n))) ) ⇒ ∀n : P(n) Proof: Exercise. In other words: two equivalent formulations of induction!

slide-76
SLIDE 76

Coalgebra and coinduction

Coinduction = definition and proof principle for coalgebras. Coinduction is dual to induction, in a very precise way. Categorically, coinduction is a property of final coalgebras. Algorithmically, coinduction generalises Robin Milner’s bisimulation proof method.

slide-77
SLIDE 77

Coalgebra and coinduction

Coinduction = definition and proof principle for coalgebras. Coinduction is dual to induction, in a very precise way. Categorically, coinduction is a property of final coalgebras. Algorithmically, coinduction generalises Robin Milner’s bisimulation proof method.

slide-78
SLIDE 78

Coalgebra and coinduction

Coinduction = definition and proof principle for coalgebras. Coinduction is dual to induction, in a very precise way. Categorically, coinduction is a property of final coalgebras. Algorithmically, coinduction generalises Robin Milner’s bisimulation proof method.

slide-79
SLIDE 79

Coalgebra and coinduction

Coinduction = definition and proof principle for coalgebras. Coinduction is dual to induction, in a very precise way. Categorically, coinduction is a property of final coalgebras. Algorithmically, coinduction generalises Robin Milner’s bisimulation proof method.

slide-80
SLIDE 80

Coalgebras and bisimulations (ex. streams)

We call R ⊆ Nω × Nω a bisimulation if, for all (σ, τ) ∈ R, (i) head(σ) = head(τ) and (ii) (tail(σ), tail(τ)) ∈ R Equivalently, R ⊆ Nω × Nω is a bisimulation if Nω head, tail

  • R

γ ∃

  • π1
  • π2

head, tail

  • N × Nω

N × R

  • N × Nω

for some function γ : R → N × R.

slide-81
SLIDE 81

Coalgebras and bisimulations (ex. streams)

We call R ⊆ Nω × Nω a bisimulation if, for all (σ, τ) ∈ R, (i) head(σ) = head(τ) and (ii) (tail(σ), tail(τ)) ∈ R Equivalently, R ⊆ Nω × Nω is a bisimulation if Nω head, tail

  • R

γ ∃

  • π1
  • π2

head, tail

  • N × Nω

N × R

  • N × Nω

for some function γ : R → N × R.

slide-82
SLIDE 82

Final coalgebras and bisimulations

Theorem: coinduction proof principle Every bisimulation R ⊆ Nω × Nω is contained in the diagonal: R ⊆ ∆ where ∆ = {(σ, σ) | σ ∈ Nω}. Proof: Because (Nω, head, tail) is a final coalgebra, Nω head, tail

  • R

γ ∃

  • π1
  • π2

head, tail

  • N × Nω

N × R

  • N × Nω

we have π1 = π2, which implies σ = τ, for all (σ, τ) ∈ Nω.

slide-83
SLIDE 83

Final coalgebras and bisimulations

Theorem: coinduction proof principle Every bisimulation R ⊆ Nω × Nω is contained in the diagonal: R ⊆ ∆ where ∆ = {(σ, σ) | σ ∈ Nω}. Proof: Because (Nω, head, tail) is a final coalgebra, Nω head, tail

  • R

γ ∃

  • π1
  • π2

head, tail

  • N × Nω

N × R

  • N × Nω

we have π1 = π2, which implies σ = τ, for all (σ, τ) ∈ Nω.

slide-84
SLIDE 84

Congruences and bisimulations: dual?

R ⊆ N × N is a congruence if 1 + N [zero, succ]

  • 1 + R

γ ∃

  • 1 + N

[zero, succ]

  • N

R π1

  • π2

N

R ⊆ Nω × Nω is a bisimulation if Nω head, tail

  • R

γ ∃

  • π1
  • π2

head, tail

  • N × Nω

N × R

  • N × Nω
slide-85
SLIDE 85

Congruences and bisimulations

R ⊆ S × T is an F-congruence if F(S) α

  • F(R)

γ ∃

  • F(T)

β

  • S

R π1

  • π2

T

R ⊆ S × T is an F-bisimulation if S α

  • R

γ ∃

  • π1
  • π2

T

β

  • F(S)

F(R)

  • F(T)
slide-86
SLIDE 86

Induction and coinduction

For every congruence relation R ⊆ N × N, ∆ ⊆ R For every bisimulation relation R ⊆ Nω × Nω, R ⊆ ∆

slide-87
SLIDE 87

Induction and coinduction

For every congruence relation R on an initial algebra: ∆ ⊆ R For every bisimulation relation R on a final coalgebra: R ⊆ ∆

slide-88
SLIDE 88

An aside: fixed points

Let (P, ≤) be a preorder and f : P → P a monotone map. Classically, least fixed point induction is: ∀p ∈ P : f(p) ≤ p ⇒ µf ≤ p Classically, greatest fixed point coinduction is: ∀p ∈ P : p ≤ f(p) ⇒ p ≤ νf

slide-89
SLIDE 89

An aside: fixed points

Let (P, ≤) be a preorder and f : P → P a monotone map. Classically, least fixed point induction is: ∀p ∈ P : f(p) ≤ p ⇒ µf ≤ p Classically, greatest fixed point coinduction is: ∀p ∈ P : p ≤ f(p) ⇒ p ≤ νf

slide-90
SLIDE 90

An aside: fixed points

Let (P, ≤) be a preorder and f : P → P a monotone map. Classically, least fixed point induction is: ∀p ∈ P : f(p) ≤ p ⇒ µf ≤ p Classically, greatest fixed point coinduction is: ∀p ∈ P : p ≤ f(p) ⇒ p ≤ νf

slide-91
SLIDE 91

An aside: fixed points

Any preorder (P, ≤) is a category, with arrows: p → q ≡ p ≤ q Any monotone map is a functor: p → q → f(p) → f(q) Lfp induction and gfp coinduction become: f(µf)

  • f(p)
  • µf

p

p

  • νf
  • f(p)

f(νf)

slide-92
SLIDE 92

An aside: fixed points

Any preorder (P, ≤) is a category, with arrows: p → q ≡ p ≤ q Any monotone map is a functor: p → q → f(p) → f(q) Lfp induction and gfp coinduction become: f(µf)

  • f(p)
  • µf

p

p

  • νf
  • f(p)

f(νf)

slide-93
SLIDE 93

An aside: fixed points

Any preorder (P, ≤) is a category, with arrows: p → q ≡ p ≤ q Any monotone map is a functor: p → q → f(p) → f(q) Lfp induction and gfp coinduction become: f(µf)

  • f(p)
  • µf

p

p

  • νf
  • f(p)

f(νf)

slide-94
SLIDE 94

Fixed point (co)induction = initiality and finality

f(µf)

  • f(p)
  • µf

p

p

  • νf
  • f(p)

f(νf)

F(A)

  • F(S)
  • A

∃ !

S

S

  • ∃ !

Z

  • F(S)

F(Z)

slide-95
SLIDE 95

Fixed point (co)induction = initiality and finality

f(µf)

  • f(p)
  • µf

p

p

  • νf
  • f(p)

f(νf)

F(A)

  • F(S)
  • A

∃ !

S

S

  • ∃ !

Z

  • F(S)

F(Z)

slide-96
SLIDE 96
  • 4. The method of coalgebra
slide-97
SLIDE 97

Summarizing the coalgebraic method

  • The study of any class of coalgebras begins with

the definition of its type, that is, a functor F : C → C. Often, C = Set.

  • The approach, which is essentially categorical, will be to

describe what coalgebras do, rather than to specify what they are.

  • The basis of the local behaviour of each coalgebra (S, α)

is its structure map α : S → F(S), which defines its local dynamics and outputs.

slide-98
SLIDE 98

Summarizing the coalgebraic method

  • The global behaviour of a coalgebra (S, α) is then given

by its interaction with other coalgebras, that is, by homomorphisms between (S, α) and other coalgebras.

  • The unique homomorphism into the final F-coalgebra

assigns to every state a canonical representation of its global behaviour.

  • Homomorphisms are structure preserving functions.

Similarly, bisimulations are structure preserving relations. They are used in the formulation of the coinduction proof principle.

slide-99
SLIDE 99

Examples of coalgebraic types

S α

  • S

β

  • S

γ

  • A

S SA S α

  • S

β

  • S

γ

  • S

δ

  • S

A × S 2 × SA A + S

slide-100
SLIDE 100

Where coalgebra is used

  • logic, set theory
  • automata
  • control theory
  • combinatorics
  • data types
  • dynamical systems
  • games
slide-101
SLIDE 101

Where coalgebra is used

  • economy
  • ecology
  • Kabbalah
  • Physarum Polycephalum Syllogistic L-Systems and

Judaic Roots of Unconventional Computing, by A.

  • Schumann. Studies in Logic, Grammar and Rhetoric, 2016.
  • Abstract:

We show that in Kabbalah, the esoteric teaching of Judaism, there were developed ideas of unconventional automata in which ...

  • and more ...
slide-102
SLIDE 102
  • 5. Discussion
  • Relatively new way of thinking – give it time
  • Extensive example: streams (Lecture two)
  • Recent developments: obtaining the best of two worlds

by combining algebra and coalgebra

  • Cf. CALCO
  • bisimulation up-to (cf. PhD thesis Jurriaan Rot)
  • Cf. Hacking nondeterminism with induction and coinduction

Bonchi and Pous, Comm. ACM Vol. 58(2), 2015