cobases coalgebraically
play

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


  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) C oinduction, I nteraction & C omposition 2007

  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

  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

  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 .

  5. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Hidden Stream Algebra (I) Hidden sort: Stream Visible sort: N : Stream → N  head  : Stream → Stream  tail    : N × Stream → Stream operations ( Σ s ) cons : Stream → Stream odd     : Stream → Stream even 

  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 )  equations ( E s ) tail ( even ( S )) = odd ( tail ( S ))       head ( odd ( S )) = head ( tail ( S ))     tail ( odd ( S )) = even ( tail ( tail ( S ))  Models: (Σ s , E s ) -algebras

  7. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Hidden Congruences for Streams Definition: A relation R ⊆ A Stream × A Stream 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 .

  8. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Experiments Definition An experiment is a term t [ • : Stream ] of (“visible”) sort N containing one occurrence of a “place-holder” of type Stream . Examples head ( • ) , head ( tail n ( • )) , head ( cons ( n , • )) . . . Non-example tail ( • ) (“outcome not observable”)

  9. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Behavioural equivalence Given a (Σ s , E s ) -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.

  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 .

  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 operations. Alternative representations We can describe a stream not only using { head , tail } but, e.g. , also using { head , even , odd } .

  12. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Some Notation Notation For terms t , t ′ ∈ T Stream we write = t = t ′ (Σ s , E s ) | if for all (Σ s , E s ) -algebras and all valuations θ : Var → A : θ ( t ) ≡ θ ( t ′ ) .

  13. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Cobases (simplified) Cobasis A set of operations ∆ ⊆ Σ s is called cobasis if for all t , t ′ ∈ T Stream = δ ( t ) = δ ( t ′ ) for all “suitable” δ ∈ ∆ (Σ s , E s ) | = t = t ′ . (Σ s , E s ) | Intuition The operations in ∆ are sufficient to observe all the relevant information about a given stream.

  14. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions Examples Cobases • Σ s • { head , tail } • { head , even , odd } Non-examples • { head , even } • { tail , odd }

  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: � h , t ,λ x λ n . c ( n , x ) � � N × A × A N A The final stream algebra: � head , tail ,λ x λ n . cons ( n , x ) � � N × N ω × ( N ω ) N N ω In which sense final?

  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: � h , t ,λ x λ n . c ( n , x ) � � N × A × A N A The final stream algebra: � head , tail ,λ x λ n . cons ( n , x ) � � N × N ω × ( N ω ) N N ω In which sense final?

  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: � h , t ,λ x λ n . c ( n , x ) � � N × A × A N A The final stream algebra: � head , tail ,λ x λ n . cons ( n , x ) � � N × N ω × ( N ω ) N N ω In which sense final?

  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: � h , t ,λ x λ n . c ( n , x ) � � N × A × A N A The final stream algebra: � head , tail ,λ x λ n . cons ( n , x ) � � N × N ω × ( N ω ) N N ω In which sense final?

  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: � h , t ,λ x λ n . c ( n , x ) � � N × A × A N A The final stream algebra: � head , tail ,λ x λ n . cons ( n , x ) � � N × N ω × ( N ω ) N N ω In which sense final?

  20. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions The final stream (co-)algebra × ( ) N -coalgebra. Furthermore Let (Ω , � H , T , C � ) be the final N × 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 -coalgebras that satisfy the equations E s . N ×

  21. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions From signature to functors We do only an example: Consider ∆ = { head , tail , cons } : Stream → N head : Stream → Stream tail Stream → ( Stream ) N : cons Functor G ∆ G ∆ X := N × X × ( X ) N

  22. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions From signature to functors We do only an example: Consider ∆ = { head , tail , cons } : Stream → N head : Stream → Stream tail Stream → ( Stream ) N : cons Functor G ∆ G ∆ X := N × X × ( X ) N

  23. Hidden Algebra & Cobases Cobases coalgebraically Proofs & Definitions A categorical property of cobases Observation ∆ ⊆ Σ s is a cobasis for (Σ s , E s ) 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.

  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: ∃ ! ϕ Ω G Σ � � X � � � � � � � � � � � f σ : σ ∈ Σ � ω Σ G Σ Ω G Σ G Σ X � � � � � � � � � � � G Σ ϕ Equivalently . . . if ( X , � f σ : σ ∈ Σ � ) is isomorphic to a subcoalgbra of the final coalgebra.

More recommend