Cobases coalgebraically Clemens Kupke joint work in progress with - - PowerPoint PPT Presentation

cobases coalgebraically
SMART_READER_LITE
LIVE PREVIEW

Cobases coalgebraically Clemens Kupke joint work in progress with - - PowerPoint PPT Presentation

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Cobases coalgebraically Clemens Kupke joint work in progress with Jan Rutten Centrum voor Wiskunde en Informatica (CWI) C oinduction, I nteraction & C omposition


slide-1
SLIDE 1

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Cobases coalgebraically

Clemens Kupke joint work in progress with Jan Rutten

Centrum voor Wiskunde en Informatica (CWI)

Coinduction, Interaction & Composition 2007

slide-2
SLIDE 2

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Outline

  • 1. Hidden Algebra & Cobases
  • 2. Cobases coalgebraically
  • 3. Proof principle(s) & definition scheme(s) for streams

Motivation

  • final coalgebras have several “representations” - how can we

understand & use this phenomenon

  • definition schemes for stream & stream functions
slide-3
SLIDE 3

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Outline

  • 1. Hidden Algebra & Cobases
  • 2. Cobases coalgebraically
  • 3. Proof principle(s) & definition scheme(s) for streams

Motivation

  • final coalgebras have several “representations” - how can we

understand & use this phenomenon

  • definition schemes for stream & stream functions
slide-4
SLIDE 4

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden Algebra (simplified)

Hidden specification

A hidden specification is a tuple (Σ, E), where

  • 1. Σ is a many-sorted signature containing hidden and visible sorts,
  • 2. E is a set of equations.

(Σ, E)-algebra

A (Σ, E)-algebra is an algebra for the signature Σ that “behaviourally satisfies” the equations in E.

slide-5
SLIDE 5

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden Stream Algebra (I)

Hidden sort: Stream Visible sort: N head : Stream → N tail : Stream → Stream cons : N × Stream → Stream

  • dd

: Stream → Stream even : Stream → Stream           

  • perations (Σs)
slide-6
SLIDE 6

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden Stream Algebra (I)

head(cons(N, S)) = N tail(cons(N, S)) = S head(even(S)) = head(S) tail(even(S)) =

  • dd(tail(S))

head(odd(S)) = head(tail(S)) tail(odd(S)) = even(tail(tail(S))                        equations (Es) Models: (Σs, Es)-algebras

slide-7
SLIDE 7

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden Congruences for Streams

Definition:

A relation R ⊆ AStream × AStream is a hidden congruence if (σ, τ), (σ′, τ ′) ∈ R implies (i) head(σ) = head(τ), (ii) (tail(σ), tail(τ)) ∈ R, and (iii) for all n ∈ N, (cons(n, σ) = cons(n, τ)) ∈ R. (iv) (even(σ), even(τ)) ∈ R, (v) (odd(σ), odd(τ)) ∈ R,

In other words

If R is behaves as a congruence w.r.t. the operations in Σs.

slide-8
SLIDE 8

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Experiments

Definition

An experiment is a term t[• : Stream]

  • f (“visible”) sort N containing one occurrence of a “place-holder” of

type Stream.

Examples

head(•), head(tailn(•)), head(cons(n, •)) . . .

Non-example

tail(•) (“outcome not observable”)

slide-9
SLIDE 9

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Behavioural equivalence

Given a (Σs, Es)-algebra A.

Definition

We define a relation ≡ on A by putting σ ≡ τ :⇔ t[σ] = t[τ] for all experiments t[•]. If σ ≡ τ we say σ and τ are behaviourally equivalent.

Theorem (Ros ¸u)

Behavioural equivalence is the largest hidden congruence.

slide-10
SLIDE 10

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Coinduction Method

Suppose we want to show σ1 ≡ σ2. Then Step 1. Pick an “appropriate” binary relation R on terms of type Stream. Step 2. Prove that R is a hidden congruence. Step 3. Show that (σ1, σ2) ∈ R.

slide-11
SLIDE 11

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Issues

Redundancy

In order to prove that R is a hidden congruence for the stream specification, one has to show that it is a congruence w.r.t. all

  • perations.

Alternative representations

We can describe a stream not only using {head, tail} but, e.g. , also using {head, even, odd}.

slide-12
SLIDE 12

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Some Notation

Notation

For terms t, t′ ∈ TStream we write (Σs, Es) | = t = t′ if for all (Σs, Es)-algebras and all valuations θ : Var → A: θ(t) ≡ θ(t′).

slide-13
SLIDE 13

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Cobases (simplified)

Cobasis

A set of operations ∆ ⊆ Σs is called cobasis if for all t, t′ ∈ TStream (Σs, Es) | = δ(t) = δ(t′) for all “suitable” δ ∈ ∆ (Σs, Es) | = t = t′.

Intuition

The operations in ∆ are sufficient to observe all the relevant information about a given stream.

slide-14
SLIDE 14

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Examples

Cobases

  • Σs
  • {head, tail}
  • {head, even, odd}

Non-examples

  • {head, even}
  • {tail, odd}
slide-15
SLIDE 15

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden algebras as coalgebras

(simplified: for a moment we forget about even and odd) A given stream algebra A can be written as follows: A

h,t,λxλn.c(n,x)

N × A × AN

The final stream algebra: Nω

head,tail,λxλn.cons(n,x)

N × Nω × (Nω)N

In which sense final?

slide-16
SLIDE 16

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden algebras as coalgebras

(simplified: for a moment we forget about even and odd) A given stream algebra A can be written as follows: A

h,t,λxλn.c(n,x)

N × A × AN

The final stream algebra: Nω

head,tail,λxλn.cons(n,x)

N × Nω × (Nω)N

In which sense final?

slide-17
SLIDE 17

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden algebras as coalgebras

(simplified: for a moment we forget about even and odd) A given stream algebra A can be written as follows: A

h,t,λxλn.c(n,x)

N × A × AN

The final stream algebra: Nω

head,tail,λxλn.cons(n,x)

N × Nω × (Nω)N

In which sense final?

slide-18
SLIDE 18

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden algebras as coalgebras

(simplified: for a moment we forget about even and odd) A given stream algebra A can be written as follows: A

h,t,λxλn.c(n,x)

N × A × AN

The final stream algebra: Nω

head,tail,λxλn.cons(n,x)

N × Nω × (Nω)N

In which sense final?

slide-19
SLIDE 19

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Hidden algebras as coalgebras

(simplified: for a moment we forget about even and odd) A given stream algebra A can be written as follows: A

h,t,λxλn.c(n,x)

N × A × AN

The final stream algebra: Nω

head,tail,λxλn.cons(n,x)

N × Nω × (Nω)N

In which sense final?

slide-20
SLIDE 20

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

The final stream (co-)algebra

Let (Ω, H, T, C) be the final N × × ( )N-coalgebra. Furthermore put P := {t ∈ Ω | for all n ∈ N. H(C(n, t)) = n & T(C(n, t)) = t}. Let ✷P denote the largest subcoalgebra of (Ω, H, T, C) that is contained in P.

Proposition

(Nω, head, tail, cons) ∼ = ✷P.

Corollary

The coalgebra (Nω, head, tail, cons) is final among all N × × ( )N-coalgebras that satisfy the equations Es.

slide-21
SLIDE 21

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

From signature to functors

We do only an example:

Consider ∆ = {head, tail, cons}

head : Stream → N tail : Stream → Stream cons : Stream → (Stream)N

Functor G∆

G∆X := N × X × (X)N

slide-22
SLIDE 22

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

From signature to functors

We do only an example:

Consider ∆ = {head, tail, cons}

head : Stream → N tail : Stream → Stream cons : Stream → (Stream)N

Functor G∆

G∆X := N × X × (X)N

slide-23
SLIDE 23

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

A categorical property of cobases

Observation

∆ ⊆ Σs is a cobasis for (Σs, Es) iff Nω together with the operations in ∆ is (isomorphic to) a subcoalgebra of the final G∆-coalgebra.

Examples

  • The set {head, tail} is a cobasis:

(Nω, head, tail) is a final N × -coalgebra.

  • The set {head, even, odd} is a cobasis:

(Nω, head, even, odd) is isomorphic to a subcoalgebra of the final N × × -coalgebra.

slide-24
SLIDE 24

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Complete set of operations

Definition

Let X be a set. A collection of operations {fσ}σ∈Σ for some S-sorted signature Σ is called complete for X if the final map ϕ : X → ΩGΣ is injective: X

fσ:σ∈Σ

  • ∃!ϕ
  • ΩGΣ

ωΣ

  • GΣX

GΣϕ

  • GΣΩGΣ

Equivalently

. . . if (X, fσ : σ ∈ Σ) is isomorphic to a subcoalgbra of the final coalgebra.

slide-25
SLIDE 25

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

More abstractly: Complete coalgebra

Definition

Let X be a set and let G : Set → Set be a functor. Then α : X → GX is called complete for X if the final G-coalgebra map ϕ : X → ΩG satisfies ker(ϕ) ⊆ ∆X. X

α

  • ∃!ϕ
  • ΩG

ωΣ

  • GX

  • GΩG

Equivalently

. . . if (X, α) is isomorphic to a subcoalgbra of the final coalgebra.

slide-26
SLIDE 26

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Complete sets of operations

For streams

  • the examples from the beginning
  • the set {head, even′, odd′} where

even′(a0a1a2a3a4 . . .) = a2a4 . . . even′(a0a1a2a3a4 . . .) = a1a3 . . .

  • the set {head, tailN} where

tailN(a0a1a2 . . .) = (1 ∗ a1, 2 ∗ a2, 3 ∗ a3, . . .).

Other examples

  • bi-infinite streams: {head, ltail, rtail}
  • binary trees: {head, left, right}
slide-27
SLIDE 27

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Proofs & Definitions

Idea

Given a complete set of operations for a set X we obtain a proof principle and a definition principle for X.

For now

We focus on streams & stream functions and the complete set of

  • perations ∆ = {head, even, odd}.
slide-28
SLIDE 28

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Proof principle

We can use complete sets ∆ of operations, in order to prove things:

  • using ∆-coinduction:

head(σ) = head(τ), even(σ) = even(τ) and

  • dd(σ) = odd(τ) implies σ = τ (e.g. show

zip(even(σ), odd(σ)) = σ).

  • using ∆-bisimulations:

R is a ∆-bisimulation if for all (σ, τ) ∈ R we have head(σ) = head(τ), (even(σ), even(τ)) ∈ R and (odd(σ), odd(τ)) ∈ R.

slide-29
SLIDE 29

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Definition priniciple for {head, even, odd}

Definition

Let N2∗ := {t | t : 2∗ → N} be the set of infinite binary N-labelled trees.

{head, even, odd} is complete:

head,even,odd

  • ∃!j
  • N2∗

h,l,r

  • N × Nω × Nω
  • N × N2∗ × N2∗
slide-30
SLIDE 30

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

A universal property

P := {t ∈ N2∗ | h(t) = h(l(t))} ⊆ N2∗

Proposition

We have (Nω, head, even, odd) ∼ = ✷P.

Corollary

For any coalgebra (X, H, E, O) with H(x) = H(E(x)) for all x ∈ X there is a unique coalgebra morphism f : X → Nω from (X, H, E, O) to (Nω, head, even, odd).

slide-31
SLIDE 31

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Definition scheme (preparations)

We inductively define the set FT of flat equation terms and the set ET of equation terms: FT ∋ s ::= xi | E(xi) | O(xi) ET ∋ t ::= s ∈ FT | τ, τ ∈ Aω | f(t1, . . . , tr(f)).

slide-32
SLIDE 32

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Definition scheme

A well-formed sytem of behavioural differential equations E for a set

  • f function symbols Γ contains for every f ∈ Γ three equations

H(f(x1, . . . , xr(f))) := cf (H(x1), . . . , H(xr(f))) for some function c : Nr(f) → N E(f(x1, . . . , xr(f))) := tf

E(x1, . . . , xr(f))

O(f(x1, . . . , xr(f))) := tf

O(x1, . . . , xr(f))

where tf

E and tf O are equation terms with free variables contained in

{x1, . . . , xr(f)}. Furthermore we require that for all f ∈ Γ E ∪ {H(E(xi)) = H(xi) | xi ∈ X} ⊢ H(E(f(x1, . . . , xr(f)))) = H(f(x1, . . . , xr(f))).

slide-33
SLIDE 33

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Examples

Thue-Morse sequence (in 2ω)

TMn is the binary digit sum of n modulo 2 H(inv(x)) := 1 − H(x) H(TM) := E(inv(x)) := inv(E(x)) E(TM) := TM O(inv(x)) := inv(O(x)) O(TM) := inv(TM)

An example in Zω

H(alt(x)) := H(x) H(m(x)) := −H(x) E(alt(x)) := E(x) E(m(x)) := m(E(x)) O(alt(x)) := m(O(x)) O(m(x)) := m(O(x)) Hence alt(a0, a1, a2, a3, . . .) := a0, −a1, a2, −a3, . . ..

slide-34
SLIDE 34

Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions

Conclusions

Positive

  • coalgebraic understanding of (simple) cobases
  • proof principle & definition scheme that works also for

structures that cannot be modelled as (final) coalgebras

Many questions...

  • Find better & more examples.
  • Formulate the definition scheme as general as possible.
  • Exisiting work on Hidden Algebra/CoCasL