## The Recursion Scheme from the Cofree Recursive Comonad

Citations: | 2 - 1 self |

### BibTeX

@MISC{Uustalu_therecursion,

author = {Tarmo Uustalu and Varmo Vene},

title = {The Recursion Scheme from the Cofree Recursive Comonad},

year = {}

}

### OpenURL

### Abstract

We instantiate the general comonad-based construction of recursion schemes for the initial algebra of a functor F to the cofree recursive comonad on F. Differently from the scheme based on the cofree comonad on F in a similar fashion, this scheme allows not only recursive calls on elements structurally smaller than the given argument, but also subsidiary recursions. We develop a Mendler formulation of the scheme via a generalized Yoneda lemma for initial algebras involving strong dinaturality and hint a relation to circular proofs à la Cockett, Santocanale.

### Citations

95 |
Inductive types and type constraints in the second-order lambda calculus
- Mendler
(Show Context)
Citation Context ...uctured recursion schemes into a format with similarities to general recursion that makes them convenient for programming while maintaining the beneficial totality guarantee. Originating from Mendler =-=[19]-=-, this format is known as Mendler-style recursion, but has also been promoted under 1 tarmo@cs.ioc.ee 2 varmo@cs.ut.ee This paper is electronically published in Electronic Notes in Theoretical Compute... |

51 | Inductive and Coinductive types with Iteration and Recursion
- Geuvers
- 1992
(Show Context)
Citation Context ...ambda-calculus with inductive and coinductive types. The original work was exploited and developed further (still in the typed lambda-calculi context) in papers by Leivant [16], Parigot [22], Geuvers =-=[12]-=-, Splawski [26], de Bruin [10], Uustalu and Vene [32], Matthes [18]. More recently, Barthe et al. [4] and Abel [1] have popularized Mendler recursion under the name of “type-based termination”. The mo... |

48 |
Strong Categorical Datatypes I
- Cockett, Spencer
- 1991
(Show Context)
Citation Context ...ogramming where proofs are identified with functions. Functional programming with inductive and coinductive types based on categorical combinators was pioneered by Hagino [15] and Cockett and Spencer =-=[9]-=-. The comonad-based recursion scheme was introduced by Uustalu, Vene, Pardo [36], in an attempt to extract the common pattern of primitive recursion and course-of-value iteration [33]. Independently, ... |

46 | A typed lambda calculus with categorical type constructors
- Hagino
- 1987
(Show Context)
Citation Context ...ages for dependently typed programming where proofs are identified with functions. Functional programming with inductive and coinductive types based on categorical combinators was pioneered by Hagino =-=[15]-=- and Cockett and Spencer [9]. The comonad-based recursion scheme was introduced by Uustalu, Vene, Pardo [36], in an attempt to extract the common pattern of primitive recursion and course-of-value ite... |

41 |
Infinite trees and completely iterative theories: a coalgebraic view. Theoretical Computer Science
- Aczel, Adámek, et al.
- 2003
(Show Context)
Citation Context ...es to record recursive call results. 3 The scheme from the cofree recursive comonad 3.1 Cofree recursive comonads Recursive comonads, dualizing the completely iterative monads of Aczel, Adámek et al. =-=[2,20]-=-, are comonads D ∼ = Id × D0 supporting unique solvability of guarded equations of a certain kind. While the cofree comonad on H is given by the final coalgebras of the functors A ⋉ H for all objects ... |

40 | Type-based termination of recursive definitions
- Barthe, Frade, et al.
(Show Context)
Citation Context ...ther (still in the typed lambda-calculi context) in papers by Leivant [16], Parigot [22], Geuvers [12], Splawski [26], de Bruin [10], Uustalu and Vene [32], Matthes [18]. More recently, Barthe et al. =-=[4]-=- and Abel [1] have popularized Mendler recursion under the name of “type-based termination”. The more subtle Mendler-style course-of-value iteration was first formulated by de Bruin [10]. The semantic... |

35 |
Contracting proofs to programs
- Leivant
- 1990
(Show Context)
Citation Context ...ler’s work [19] on a typed lambda-calculus with inductive and coinductive types. The original work was exploited and developed further (still in the typed lambda-calculi context) in papers by Leivant =-=[16]-=-, Parigot [22], Geuvers [12], Splawski [26], de Bruin [10], Uustalu and Vene [32], Matthes [18]. More recently, Barthe et al. [4] and Abel [1] have popularized Mendler recursion under the name of “typ... |

18 | Complete Sequent Calculi for Induction and Infinite Descent
- Brotherston, Simpson
- 2007
(Show Context)
Citation Context ...t considered by Pliuskevičius [23], Stirling and Walker [28] (in a model checking context) and Wa̷lukiewicz [37] and have been studied further by, e.g., Sprenger and Dam [27], Brotherston and Simpson =-=[5]-=- (this list is far from complete). Into the context of sequent-style versions of intuitionistic proof systems and typed lambdacalculi, circular proof systems were introduced by Santocanale [24] and Co... |

13 |
Completely iterative algebras and completely iterative monads
- Milius
- 2005
(Show Context)
Citation Context ...es to record recursive call results. 3 The scheme from the cofree recursive comonad 3.1 Cofree recursive comonads Recursive comonads, dualizing the completely iterative monads of Aczel, Adámek et al. =-=[2,20]-=-, are comonads D ∼ = Id × D0 supporting unique solvability of guarded equations of a certain kind. While the cofree comonad on H is given by the final coalgebras of the functors A ⋉ H for all objects ... |

13 |
Strong monads, algebras and fixed points
- Mulry
- 1991
(Show Context)
Citation Context ...gebra is the (big!) colimit of the F -coalgebra structure forgetting functor. To present the generalized Yoneda lemma we must first digress to introduce strong (a.k.a. Barr) dinatural transformations =-=[21]-=-. Let H, K : C op × C → D be functors. A dinatural transformation H .. → K is a family of maps ΘX : H(X, X) → K(X, X) in D for all objects X in C such that, for any map f : X → Y in C, the following h... |

11 |
Dualising initial algebras
- Ghani, Lüth, et al.
(Show Context)
Citation Context ...elebil [2,20]. Cofree recursive comonads have been employed in a discussion of an application to tree transformations by Uustalu and Vene [35]; they were also touched upon in the work of Ghani et al. =-=[13]-=-. Circular sequent calculi (where proofs are rational or nonwellfounded trees) for logics with least and greatest fixedpoint operators have mainly been investigated in the context of classical predica... |

10 | Recursive coalgebras from comonads
- Capretta, Uustalu, et al.
- 2006
(Show Context)
Citation Context ...mitive recursion and course-of-value iteration [33]. Independently, Bartels [3] described a dual corecursion scheme and looked also at the corresponding coinduction principle. Capretta, Uustalu, Vene =-=[6]-=- took the original work further, showing that the scheme extends from initial algebras to any coalgebras recursive in the sense of Osius. Mendler-style (co)recursion originates from Mendler’s work [19... |

8 |
About Charity, Yellow Series Report 92/480/18
- Cockett, Fukushima
- 1992
(Show Context)
Citation Context ...we are interested in structured recursion schemes for initial algebras. These are a central tool for programming with inductive types in total functional programming languages like Charity of Cockett =-=[8]-=- or type-theoretically inspired dependently typed languages. We have previously [36] developed a general structured recursion scheme that, for the initial algebra of a functor F , is parameterized by ... |

5 |
Dinatural transformations
- Dubuc, Street
- 1970
(Show Context)
Citation Context ...H(X, X) p0 � ��H(X,f) �� � � � ��� � ���� ��� W ��� H(X, Y ) ⇒ K(X, Y ) ��� � p1 � ���� �� �H(f,Y ) ���� H(Y, Y ) � K(f,Y ) K(Y, Y ) ΘY Differently from the case of ordinary (Dubuc-Street) dinaturals =-=[11]-=-, strong dinaturals compose unproblematically. We denote by SDinat(C, D) the category of mixed-variant functors C op × C → D and strong dinatural transformations between them. (As a downside, however,... |

3 |
P.J.: Inductive types in constructive languages
- Bruin
- 1995
(Show Context)
Citation Context ...and coinductive types. The original work was exploited and developed further (still in the typed lambda-calculi context) in papers by Leivant [16], Parigot [22], Geuvers [12], Splawski [26], de Bruin =-=[10]-=-, Uustalu and Vene [32], Matthes [18]. More recently, Barthe et al. [4] and Abel [1] have popularized Mendler recursion under the name of “type-based termination”. The more subtle Mendler-style course... |

3 | Tarski’s fixed-point theorem and lambda calculi with monotone inductive types, Synthese
- Matthes
- 2002
(Show Context)
Citation Context ...ork was exploited and developed further (still in the typed lambda-calculi context) in papers by Leivant [16], Parigot [22], Geuvers [12], Splawski [26], de Bruin [10], Uustalu and Vene [32], Matthes =-=[18]-=-. More recently, Barthe et al. [4] and Abel [1] have popularized Mendler recursion under the name of “type-based termination”. The more subtle Mendler-style course-of-value iteration was first formula... |

2 |
program transformation, and cut-elimination
- Cockett, Deforestation
(Show Context)
Citation Context ...o admits a tenable Mendler-style formulation and becomes in that format a useful tool for devising categorical semantic descriptions for circular sequent versions of typed lambda-calculi that Cockett =-=[7]-=- and Santocanale [24] have studied as possible cores for total functional programming languages. In this paper we study the new recursion scheme foremostly as an instance of comonad-based recursion an... |

1 |
Termination checking with types, Theor
- Abel
- 2004
(Show Context)
Citation Context ...n the typed lambda-calculi context) in papers by Leivant [16], Parigot [22], Geuvers [12], Splawski [26], de Bruin [10], Uustalu and Vene [32], Matthes [18]. More recently, Barthe et al. [4] and Abel =-=[1]-=- have popularized Mendler recursion under the name of “type-based termination”. The more subtle Mendler-style course-of-value iteration was first formulated by de Bruin [10]. The semantic connection t... |

1 |
Build, augment and destroy
- Ghani, Uustalu, et al.
- 2004
(Show Context)
Citation Context .... Böhm-Berarducci) encodings (fold/build syntax) of inductive types and the deforestation rule of fold/build fusion in terms of strongly dinatural transformations was given by Ghani, Uustalu and Vene =-=[14]-=-. Free completely iterative monads are the subject of a series of recent papers 19Uustalu and Vene by Aczel, Adámek, Milius and Velebil [2,20]. Cofree recursive comonads have been employed in a discu... |

1 |
Altenkirch et al., Polymorphic isomorphisms
- Levy, T
(Show Context)
Citation Context ...n isomorphism indeed, we convince ourselves that i −1 K,H (iK,H(Θ))X(φ) = K(coitH(φ))(ΘνH outH) = 5 (however see our old NWPT ’00 slides [31] as well as the recent discussion in the Types mailinglist =-=[17]-=-) 6Uustalu and Vene ΘX φ (using that Θ is strongly dinatural and outH ◦ coitH(φ) = HcoitH(φ) ◦ φ) and iK,H(i −1 K,H (x)) = K(coitH(outH))(x) = KidνH(x) = id K(νH)(x) = x. The specific choice K =df C(... |

1 |
Recursive programming with proofs, Theor
- Parigot
- 1992
(Show Context)
Citation Context ...] on a typed lambda-calculus with inductive and coinductive types. The original work was exploited and developed further (still in the typed lambda-calculi context) in papers by Leivant [16], Parigot =-=[22]-=-, Geuvers [12], Splawski [26], de Bruin [10], Uustalu and Vene [32], Matthes [18]. More recently, Barthe et al. [4] and Abel [1] have popularized Mendler recursion under the name of “type-based termin... |

1 |
Investigation of finitary calculi for the temporal logics by means of infinitary calculi
- Pliuskevičius
(Show Context)
Citation Context ... trees) for logics with least and greatest fixedpoint operators have mainly been investigated in the context of classical predicate or modal logic. Such calculi were first considered by Pliuskevičius =-=[23]-=-, Stirling and Walker [28] (in a model checking context) and Wa̷lukiewicz [37] and have been studied further by, e.g., Sprenger and Dam [27], Brotherston and Simpson [5] (this list is far from complet... |