coinduction and declarative programming
play

Coinduction and Declarative Programming Horst Reichel December 2012 - PowerPoint PPT Presentation

Coinduction and Declarative Programming Horst Reichel December 2012 Structure of the lecture: Structure of the lecture: What is the meaning of coinduction? Structure of the lecture: What is the meaning of coinduction? Some


  1. Coinduction and Declarative Programming Horst Reichel December 2012

  2. Structure of the lecture:

  3. Structure of the lecture: ◮ What is the meaning of coinduction?

  4. Structure of the lecture: ◮ What is the meaning of coinduction? ◮ Some applications of coinduction.

  5. Structure of the lecture: ◮ What is the meaning of coinduction? ◮ Some applications of coinduction. ◮ Coinduction and logic programming.

  6. Structure of the lecture: ◮ What is the meaning of coinduction? ◮ Some applications of coinduction. ◮ Coinduction and logic programming. ◮ Coinduction and constraint programming.

  7. Structure of the lecture: ◮ What is the meaning of coinduction? ◮ Some applications of coinduction. ◮ Coinduction and logic programming. ◮ Coinduction and constraint programming.

  8. The notion of INDUCTION is well known, but what is the meaning of COINDUCTION?

  9. The notion of INDUCTION is well known, but what is the meaning of COINDUCTION? Can the pattern AUTHOR and COAUTHOR be used to derive the meaning of coinduction?

  10. The notion of INDUCTION is well known, but what is the meaning of COINDUCTION? Can the pattern AUTHOR and COAUTHOR be used to derive the meaning of coinduction? NO!

  11. The notion of INDUCTION is well known, but what is the meaning of COINDUCTION? Can the pattern AUTHOR and COAUTHOR be used to derive the meaning of coinduction? NO! In our case the prefix CO means that both concepts are dual in the sense of category theory.

  12. The notion of INDUCTION is well known, but what is the meaning of COINDUCTION? Can the pattern AUTHOR and COAUTHOR be used to derive the meaning of coinduction? NO! In our case the prefix CO means that both concepts are dual in the sense of category theory. Intuitively Coinduction is a mathematical technique for (finitely) reasoning about infinite things.

  13. In order to understand the duality of induction and coinduction we start with the Fixed Point Theorem of Knaster and Tarski.

  14. In order to understand the duality of induction and coinduction we start with the Fixed Point Theorem of Knaster and Tarski. Fixed Point Theorem (Knaster, Tarski) : If g : 2 S → 2 S is monotonic with respect to the subset ordering ⊆ then g 1. has a least fixed point with respect to ⊆ given by � { X ⊆ S | g ( X ) ⊆ X } 2. has a greatest fixed point with respect to ⊆ given by � { X ⊆ S | X ⊆ g ( X ) } .

  15. Let denote PRE g = { X ⊆ S | g ( X ) ⊆ X } respectively POST g = { X ⊆ S | X ⊆ g ( X ) } the set of prefixed respectively postfixed points of the monoton mapping g : 2 S → 2 S .

  16. Let denote PRE g = { X ⊆ S | g ( X ) ⊆ X } respectively POST g = { X ⊆ S | X ⊆ g ( X ) } the set of prefixed respectively postfixed points of the monoton mapping g : 2 S → 2 S . The least fixed point lfp ( g ) is the inductively defined prefixed point, and the greatest fixed point gfp ( g ) is the coinductively defined postfixed point of the monoton mapping g : 2 S → 2 S .

  17. Let denote PRE g = { X ⊆ S | g ( X ) ⊆ X } respectively POST g = { X ⊆ S | X ⊆ g ( X ) } the set of prefixed respectively postfixed points of the monoton mapping g : 2 S → 2 S . The least fixed point lfp ( g ) is the inductively defined prefixed point, and the greatest fixed point gfp ( g ) is the coinductively defined postfixed point of the monoton mapping g : 2 S → 2 S . One should remember that the µ –calculus uses least fixed points and greatest fixed points to express liveness respectively safety properties.

  18. As next we generalize the monotonic map g : 2 S → 2 S to an endofunctor of the category of sets.

  19. As next we generalize the monotonic map g : 2 S → 2 S to an endofunctor of the category of sets. A type functor T : S et → S et is a uniform construction 1. that assigns a set T ( X ) to a given set X , 2. and assigns a mapping T ( f ) : T ( A ) → T ( B ) to a given mapping f : A → B , 3. which is compatible with the composition of mappings, i.e., T ( f ; g ) = T ( f ); T ( g ) for f : A → B , g : B → C .

  20. As next we generalize the monotonic map g : 2 S → 2 S to an endofunctor of the category of sets. A type functor T : S et → S et is a uniform construction 1. that assigns a set T ( X ) to a given set X , 2. and assigns a mapping T ( f ) : T ( A ) → T ( B ) to a given mapping f : A → B , 3. which is compatible with the composition of mappings, i.e., T ( f ; g ) = T ( f ); T ( g ) for f : A → B , g : B → C . Prefixed points and postfixed points will become T – algebras and T –coalgebras respectively.

  21. For a given type functor T : S et → S et ◮ a T – algebra A = ( A , α ) is given by a set A and a mapping α : T ( A ) → A ◮ a T – coalgebra S = ( S , σ ) is given by a set S and a mapping σ : S → T ( S ).

  22. For a given type functor T : S et → S et ◮ a T – algebra A = ( A , α ) is given by a set A and a mapping α : T ( A ) → A ◮ a T – coalgebra S = ( S , σ ) is given by a set S and a mapping σ : S → T ( S ). For a A = ( A , α ) A is called the carrier set and α the structure map , and for a T – coalgebra S = ( S , σ ) the set S is called the universe and σ the structure map .

  23. Examples: 1. The signature, or the type of a group G is given by a constant − 1 : G → G and a binary operation e ∈ G , by a unary operation · : G × G → G . This ranked alphabet can be represented by the type functor T 0 : S et → S et with T 0 ( G ) = 1 + G + G × G where 1 = { 0 } represents the empty product of sets.

  24. Examples: 1. The signature, or the type of a group G is given by a constant − 1 : G → G and a binary operation e ∈ G , by a unary operation · : G × G → G . This ranked alphabet can be represented by the type functor T 0 : S et → S et with T 0 ( G ) = 1 + G + G × G where 1 = { 0 } represents the empty product of sets. Let be i 1 : { 0 } → 1 + G + G × G , i 2 : G → 1 + G + G × G , i 3 : G × G → 1 + G + G × G the canonical injections of the summ and let ( G , α ) be a T 0 –algebra, then i 1 ; α, i 2 ; α, i 3 ; α are the constant, unary and binary operation, respectively.

  25. 2. Let be In , Out two fixed sets. Now we can define a type functor T 1 : S et → S et by T 1 ( S ) = S In × Out . If ( S , σ ) is a T 1 –coalgebra and p 1 : S In × Out → S In , p 2 : S In × Out → Out are the canonical projections of the product we get two mappings σ 1 = σ ; p 1 : S → S In σ 2 = σ ; p 2 : S → Out . It is easy to see that a T 1 –coalgebra represents a Moore automaton . The mapping σ 1 is equivalent (by currying) to a mapping σ ′ 1 : S × In → S known as transition function.

  26. Whereas the structure mappings of pre- and postfixed points are set inclusions, the structure mappings of T –algebras and T –coalgebras are arbitrary mappings.

  27. Whereas the structure mappings of pre- and postfixed points are set inclusions, the structure mappings of T –algebras and T –coalgebras are arbitrary mappings. Now we can generalize least and greatest fixed points to T –algebras and T –coalgebras.

  28. Whereas the structure mappings of pre- and postfixed points are set inclusions, the structure mappings of T –algebras and T –coalgebras are arbitrary mappings. Now we can generalize least and greatest fixed points to T –algebras and T –coalgebras. The resulting notions are initial and final (terminal) T –algebras and T –coalgebras respectively.

  29. A T –algebra I = ( I , ι ) is called initial if for for any T –algebra A = ( A , alpha ) there exists exactly one T –homomorphism h : I → A .

  30. A T –algebra I = ( I , ι ) is called initial if for for any T –algebra A = ( A , alpha ) there exists exactly one T –homomorphism h : I → A . Dualy, a T –coalgebra F = ( F , ϕ ) is called final if for any T –coalgebra S = ( S , σ ) there exists exactly one T –homomorphism h : S → F .

  31. A T –algebra I = ( I , ι ) is called initial if for for any T –algebra A = ( A , alpha ) there exists exactly one T –homomorphism h : I → A . Dualy, a T –coalgebra F = ( F , ϕ ) is called final if for any T –coalgebra S = ( S , σ ) there exists exactly one T –homomorphism h : S → F . For a T –homomorphism it is required, that the mapping is compatible with the corresponding structure map of the T –algebras or T –coalgebras respectively.

  32. Induction in terms of initial T –algebras is intensively used in the approach of abstract data types.

  33. Induction in terms of initial T –algebras is intensively used in the approach of abstract data types. Coinduction in terms of final T –coalgebras was manly applied to reason about the behavior of state based systems.

  34. Induction in terms of initial T –algebras is intensively used in the approach of abstract data types. Coinduction in terms of final T –coalgebras was manly applied to reason about the behavior of state based systems. The unique final T –coalgebra represents the behavior that can be observed for elements of T –coalgebras.

  35. Induction in terms of initial T –algebras is intensively used in the approach of abstract data types. Coinduction in terms of final T –coalgebras was manly applied to reason about the behavior of state based systems. The unique final T –coalgebra represents the behavior that can be observed for elements of T –coalgebras. The unique T –homomorphism h : S → F identifies elements in S if and only if they have equal observable behavior.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend