Introduction Solution Applications Conclusion Coalgebraic Semantics of Recursion on Circular Data Structures Baltasar Trancón y Widemann (Technische Universität Berlin) Universität Bayreuth CALCO-Jnr 2011-08-29 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 0 / 23
Introduction Solution Applications Conclusion Introduction 1 Context The Problem Solution 2 Technique Semantics Applications 3 Conclusion 4 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 0 / 23
Introduction Solution Applications Conclusion Context The Problem Introduction 1 Context The Problem Solution 2 Technique Semantics Applications 3 Conclusion 4 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 0 / 23
Introduction Solution Applications Conclusion Context The Problem Introduction 1 Context The Problem Solution 2 Technique Semantics Applications 3 Conclusion 4 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 0 / 23
Introduction Solution Applications Conclusion Context The Problem The Story of a PhD Thesis Timeline 2000–2002 Search 2002–2004 Experiments 2004–2006 Writing 2007 Success! For my Thesis I Wanted to do something with functional programming, something with coalgebra, something funny, or at least surprising. B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 1 / 23
Introduction Solution Applications Conclusion Context The Problem The Story of a PhD Thesis Timeline 2000–2002 Search 2002–2004 Experiments 2004–2006 Writing 2007 Success! For my Thesis I Wanted to do something with functional programming, something with coalgebra, something funny, or at least surprising. B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 1 / 23
Introduction Solution Applications Conclusion Context The Problem My Inspirations Karczmarczuk, Jerzy (1998). “The Most Unreliable Technique in the World to Compute PI”. In: Workshop at the 3rd International Summer School on Advanced Functional Programming . Ruiz de Santayana, Jorge Augustín Nicolás (1906). The Life of Reason . B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 2 / 23
Introduction Solution Applications Conclusion Context The Problem Introduction 1 Context The Problem Solution 2 Technique Semantics Applications 3 Conclusion 4 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 2 / 23
Introduction Solution Applications Conclusion Context The Problem Basic Scenario Data structures as cells in memory Substructure relation as pointers between cells Computation by recursion along pointer chains 1 2 3 5 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 3 / 23
Introduction Solution Applications Conclusion Context The Problem Basic Scenario Data structures as cells in memory Substructure relation as pointers between cells Computation by recursion along pointer chains 1 2 3 5 6 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 3 / 23
Introduction Solution Applications Conclusion Context The Problem Basic Scenario Data structures as cells in memory Substructure relation as pointers between cells Computation by recursion along pointer chains 1 2 3 5 4 6 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 3 / 23
Introduction Solution Applications Conclusion Context The Problem Basic Scenario Data structures as cells in memory Substructure relation as pointers between cells Computation by recursion along pointer chains 1 2 3 5 3 4 6 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 3 / 23
Introduction Solution Applications Conclusion Context The Problem Basic Scenario Data structures as cells in memory Substructure relation as pointers between cells Computation by recursion along pointer chains 1 2 3 5 2 3 4 6 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 3 / 23
Introduction Solution Applications Conclusion Context The Problem Extension #1: Laziness Lazy Thunks (Ingerman 1961) Contain code to perform suspended computations Replaced on demand by data computed on the fly Allow for potentially infinite data Break temporal connection between call and result B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 4 / 23
Introduction Solution Applications Conclusion Context The Problem Extension #2 (xkcd 2009) B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 5 / 23
Introduction Solution Applications Conclusion Context The Problem Extension #2 (xkcd 2009) B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 5 / 23
Introduction Solution Applications Conclusion Context The Problem Extension #2 (xkcd 2009) B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 5 / 23
Introduction Solution Applications Conclusion Context The Problem Extension #2 (xkcd 2009) B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 5 / 23
Introduction Solution Applications Conclusion Context The Problem Extension #2: Cycles Pointer cycles arise naturally – ring lists, doubly linked lists, threaded trees, . . . Traditional segregation: acyclic data; referential transparency; structural recursion cyclic data; explicit mutable pointers; imperative updates Goal: Recursion in the presence of YOINK ! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 6 / 23
Introduction Solution Applications Conclusion Context The Problem Extension #2: Cycles Pointer cycles arise naturally – ring lists, doubly linked lists, threaded trees, . . . Traditional segregation: acyclic data; referential transparency; structural recursion cyclic data; explicit mutable pointers; imperative updates Goal: Recursion in the presence of YOINK ! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 6 / 23
Introduction Solution Applications Conclusion Context The Problem Heureka! Motto (Ruiz de Santayana 1906) Those who cannot remember the past are condemned to repeat it. B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 7 / 23
Introduction Solution Applications Conclusion Technique Semantics Introduction 1 Context The Problem Solution 2 Technique Semantics Applications 3 Conclusion 4 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 7 / 23
Introduction Solution Applications Conclusion Technique Semantics Introduction 1 Context The Problem Solution 2 Technique Semantics Applications 3 Conclusion 4 B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 7 / 23
Introduction Solution Applications Conclusion Technique Semantics Order of Operations 1 2 3 5 Destination-passing style (Minamide 1998) Tail recursion modulo cons(tructor) (Warren 1980) – can be used to eliminate tail calls, or – alternatively allows to handle duckling loops! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 8 / 23
Introduction Solution Applications Conclusion Technique Semantics Order of Operations 1 2 3 5 2 Destination-passing style (Minamide 1998) Tail recursion modulo cons(tructor) (Warren 1980) – can be used to eliminate tail calls, or – alternatively allows to handle duckling loops! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 8 / 23
Introduction Solution Applications Conclusion Technique Semantics Order of Operations 1 2 3 5 2 3 Destination-passing style (Minamide 1998) Tail recursion modulo cons(tructor) (Warren 1980) – can be used to eliminate tail calls, or – alternatively allows to handle duckling loops! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 8 / 23
Introduction Solution Applications Conclusion Technique Semantics Order of Operations 1 2 3 5 2 3 4 Destination-passing style (Minamide 1998) Tail recursion modulo cons(tructor) (Warren 1980) – can be used to eliminate tail calls, or – alternatively allows to handle duckling loops! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 8 / 23
Introduction Solution Applications Conclusion Technique Semantics Order of Operations 1 2 3 5 2 3 4 6 Destination-passing style (Minamide 1998) Tail recursion modulo cons(tructor) (Warren 1980) – can be used to eliminate tail calls, or – alternatively allows to handle duckling loops! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 8 / 23
Introduction Solution Applications Conclusion Technique Semantics Order of Operations 1 2 3 5 2 3 4 6 Destination-passing style (Minamide 1998) Tail recursion modulo cons(tructor) (Warren 1980) – can be used to eliminate tail calls, or – alternatively allows to handle duckling loops! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 8 / 23
Introduction Solution Applications Conclusion Technique Semantics Order of Operations 1 2 3 5 2 3 4 6 Destination-passing style (Minamide 1998) Tail recursion modulo cons(tructor) (Warren 1980) – can be used to eliminate tail calls, or – alternatively allows to handle duckling loops! B. Trancón y Widemann Coalgebraic . . . Circular Data Structures 8 / 23
Recommend
More recommend