inductive types for free
play

Inductive Types for Free Representing Nested Inductive Types using - PowerPoint PPT Presentation

Inductive Types for Free Representing Nested Inductive Types using W-types Michael Abbott (U. Leicester) Thorsten Altenkirch (U. Nottingham) Neil Ghani (U. Leicester) Inductive Types for Free p.1/22 Ideology Inductive Types for Free


  1. Inductive Types for Free Representing Nested Inductive Types using W-types Michael Abbott (U. Leicester) Thorsten Altenkirch (U. Nottingham) Neil Ghani (U. Leicester) Inductive Types for Free – p.1/22

  2. Ideology Inductive Types for Free – p.2/22

  3. Ideology David Turner: Elementary Strong Functional Programming Inductive Types for Free – p.2/22

  4. Ideology David Turner: Elementary Strong Functional Programming Martin-Löf Type Theory Inductive Types for Free – p.2/22

  5. Ideology David Turner: Elementary Strong Functional Programming Martin-Löf Type Theory Types = sets, programs = total functions. Inductive Types for Free – p.2/22

  6. Ideology David Turner: Elementary Strong Functional Programming Martin-Löf Type Theory Types = sets, programs = total functions. Dependent types to avoid accidental partiality (e.g. hd ). Inductive Types for Free – p.2/22

  7. Ideology David Turner: Elementary Strong Functional Programming Martin-Löf Type Theory Types = sets, programs = total functions. Dependent types to avoid accidental partiality (e.g. hd ). E.g.: Conor McBride’s Epigram system. Inductive Types for Free – p.2/22

  8. Plan of the talk Inductive and coinductive types. Container types for dummies. Properties of container types. W-types are sufficent for inductive types. Further work and applications Related work Inductive Types for Free – p.3/22

  9. ✠ ✡ ✄ ✁ ☎ ✆ ✝ ✞ ✟ ✟ ✆ ✞ Inductive and coinductive types Widespread in functional programming (e.g. Haskell) Lam Int Lam Lam Lam �✂✁ Inductive Types for Free – p.4/22

  10. � ☎ ✁ ✂ ✡ ✆ ✠ ✞ ✟ ✟ ✞ ✝ ✆ ☎ ✁ ✄ ✄ Inductive and coinductive types Widespread in functional programming (e.g. Haskell) Lam Int Lam Lam Lam �✂✁ Categorically: Initial algebra of a functor Lam Inductive Types for Free – p.4/22

  11. � � ☎ ✁ vs. In a total setting (terminal coalgebras): Inductive Types for Free – p.5/22

  12. � � ☎ ✁ � ✁ ✂ ✄ vs. In a total setting (terminal coalgebras): finite lists Inductive Types for Free – p.5/22

  13. ✂ ✁ ✄ � ☎ ✁ ✂ � ✁ � ✄ ✁ vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists Inductive Types for Free – p.5/22

  14. ✁ ✄ ✄ ✄ ✂ ✁ ✁ � ✂ ✁ ✁ � ✁ ☎ � vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists infinite lists Inductive Types for Free – p.5/22

  15. ✁ ✄ ✄ ✄ ✂ ✁ � � ✂ ✁ ✁ � ✁ ✁ ☎ � ✄ ✁ vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists infinite lists Inductive Types for Free – p.5/22

  16. ✁ ✄ ✁ � ✄ ✂ � ✁ ✁ ✂ ✄ ✁ � ✄ ✁ ☎ � � ✁ vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists infinite lists Inductive Types for Free – p.5/22

  17. ✂ ✄ ✁ ✁ ✁ ✄ � ✁ ✁ ✄ � ✂ ✁ � � ✁ ☎ � ✁ ✄ vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists infinite lists can be nested � ✁� Inductive Types for Free – p.5/22

  18. � ✁ ✝ ✂ ✁ � ☎ ✁ � � ✄ ✁ � ✁ ✄ ✁ � ✄ ✄ ✂ ✁ ✁ ✁ ✄ ✂ ✁ � ✂ ✁ ☎ � ✄ ✄ vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists infinite lists can be nested � ✁� Inductive Types for Free – p.5/22

  19. � � ✁ ✄ � ✄ ✁ ✂ ✁ ☎ ✂ ✝ ✄ ✄ ☎ � ✁ � ✄ ✁ ✂ ✂ � ☎ ✁ ✠ � ✁ ✄ ✁ ✁ ✁ ✁ ✂ ✄ � ✁ � vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists infinite lists can be nested � ✁� ✁ ✁� Inductive Types for Free – p.5/22

  20. ✄ ✄ ✂ ✝ � ✄ ☎ � ✁ � ✁ ✂ ☎ � � ✁ ✠ ✆ ✂ ✄ � ✆ ✁ ✂ ✂ ✁ ✡ ✄ ✁ ✄ � ☎ ✁ ✁ � ✁ ✂ ✄ � ✁ ✂ ✁ ✄ ✁ ✁ ✁ ✄ ✁ � ✁ ✄ � ☎ ✝ vs. In a total setting (terminal coalgebras): finite lists potentially infinite lists infinite lists can be nested � ✁� ✁ ✁� Inductive Types for Free – p.5/22

  21. Axiomatically? How do we say? All inductive or coinductive datatypes Inductive Types for Free – p.6/22

  22. Axiomatically? How do we say? All inductive or coinductive datatypes Not every parametrized type has an initial algebra (or terminal coalgebra) in set theory, e.g. Inductive Types for Free – p.6/22

  23. � ✁ � Axiomatically? How do we say? All inductive or coinductive datatypes Not every parametrized type has an initial algebra (or terminal coalgebra) in set theory, e.g. Inductive Types for Free – p.6/22

  24. � ✁ � ✁ ✂ ✁ � ✁ � � Axiomatically? How do we say? All inductive or coinductive datatypes Not every parametrized type has an initial algebra (or terminal coalgebra) in set theory, e.g. Inductive Types for Free – p.6/22

  25. � ✁ � ✁ ✂ ✁ � ✁ � � Axiomatically? How do we say? All inductive or coinductive datatypes Not every parametrized type has an initial algebra (or terminal coalgebra) in set theory, e.g. Strictly positive types, e.g. Inductive Types for Free – p.6/22

  26. ✁ � ✂ ✆ ✂ ✁ � ✁ � � ✁ � � ✂ ✁ Axiomatically? How do we say? All inductive or coinductive datatypes Not every parametrized type has an initial algebra (or terminal coalgebra) in set theory, e.g. Strictly positive types, e.g. ordinal notations Inductive Types for Free – p.6/22

  27. ✂ � ✂ ✆ ✂ ✁ � ✁ � � ✁ � ✁ � ✁ Axiomatically? How do we say? All inductive or coinductive datatypes Not every parametrized type has an initial algebra (or terminal coalgebra) in set theory, e.g. Strictly positive types, e.g. ordinal notations How do we say? Strictly positive Inductive Types for Free – p.6/22

  28. Containers and -types Container types are a syntax-free representation of strictly positive types. Inductive Types for Free – p.7/22

  29. ✁ ✁ ✁ ✁ � ✂ � ☎ � Containers and -types Container types are a syntax-free representation of strictly positive types. In an extensive LCCC: W-types ( ) are sufficent to show that container types are closed under Inductive Types for Free – p.7/22

  30. ✁ ✂ � ✁ ✁ � � ☎ � ✁ Containers and -types Container types are a syntax-free representation of strictly positive types. In an extensive LCCC: W-types ( ) are sufficent to show that container types are closed under (here) Inductive Types for Free – p.7/22

  31. ✂ � ✁ � ✁ ✁ � ☎ � ✁ ✁ Containers and -types Container types are a syntax-free representation of strictly positive types. In an extensive LCCC: W-types ( ) are sufficent to show that container types are closed under (here) (journal paper, submitted) Inductive Types for Free – p.7/22

  32. � ✂ ✁ � ✁ ✁ � ☎ � ✁ ✁ Containers and -types Container types are a syntax-free representation of strictly positive types. In an extensive LCCC: W-types ( ) are sufficent to show that container types are closed under (here) (journal paper, submitted) Application : Generic Programming e.g. see our work on derivatives of datatypes Inductive Types for Free – p.7/22

  33. ✁ ✂ ✁ � ✁ � � ☎ � ✁ ✁ Containers and -types Container types are a syntax-free representation of strictly positive types. In an extensive LCCC: W-types ( ) are sufficent to show that container types are closed under (here) (journal paper, submitted) Application : Generic Programming e.g. see our work on derivatives of datatypes Application : Small trusted cores e.g. for Epigram Inductive Types for Free – p.7/22

  34. Containers for dummies Inductive Types for Free – p.8/22

  35. Containers for dummies A container type is given by Inductive Types for Free – p.8/22

  36. � Containers for dummies A container type is given by A collection of shapes , e.g. { } , , Inductive Types for Free – p.8/22

  37. � Containers for dummies A container type is given by A collection of shapes , e.g. { } , , An assignment of positions to shapes , e.g. Inductive Types for Free – p.8/22

  38. Containers for dummies . . . We can use a container by Inductive Types for Free – p.9/22

  39. Containers for dummies . . . We can use a container by Choosing a shape, e.g. Inductive Types for Free – p.9/22

  40. Containers for dummies . . . We can use a container by Choosing a shape, e.g. Filling the positions with payload (here natural numbers), e.g. 1 4 0 Inductive Types for Free – p.9/22

  41. Container for scientists Inductive Types for Free – p.10/22

  42. ✁ ✁ ✂ � � ✁ � � ✁ ✂ Container for scientists A container type is given by a set of shapes a family of sets of position, e.g. is a set for any . Inductive Types for Free – p.10/22

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