Getting There and Back Again
@article{Danvy2022GettingTA, title={Getting There and Back Again}, author={Olivier Danvy}, journal={Fundam. Informaticae}, year={2022}, volume={185}, pages={115-183} }
“There and Back Again” (TABA) is a programming pattern where the recursive calls traverse one data structure and the subsequent returns traverse another. This article presents new TABA examples, refines existing ones, and formalizes both their control flow and their data flow using the Coq Proof Assistant. Each formalization mechanizes a pen-and-paper proof, thus making it easier to “get” TABA. In addition, this article identifies and illustrates a tail-recursive variant of TABA, There and…
2 Citations
The Tortoise and the Hare Algorithm for Finite Lists, Compositionally
- Computer ScienceACM Transactions on Programming Languages and Systems
- 2022
This article presents a compositional account of the tortoise-and-hare algorithm for finite lists, which means that programs that use a fast and a slow pointer can be expressed with an ordinary fold function for lists and reasoned about using ordinary structural induction on the given list.
Fold–unfold lemmas for reasoning about recursive programs using the Coq proof assistant
- Computer ScienceJournal of Functional Programming
- 2022
Fold–unfold lemmas complement the rewrite tactic in the Coq Proof Assistant to reason about recursive functions, be they defined locally or globally, and prove effective in the classroom, considering the clarity of discourse in the subsequent term reports and oral exams.
References
SHOWING 1-10 OF 97 REFERENCES
Multi-return function call
- Computer ScienceICFP '04
- 2004
It is concluded that multiple-return function call is not only a useful and expressive mechanism, both at the source-code and intermediate-representation level, but is also quite inexpensive to implement.
On typing delimited continuations: three new solutions to the printf problem
- Computer ScienceHigh. Order Symb. Comput.
- 2009
Three new solutions to the printf problem are presented: a simpler one that also uses delimited continuations but that does not use an accumulator, the corresponding two in direct style with the delimited-control operators, shift and reset, and the direct-style counterparts of the two continuation-based ones.
Programs and Proofs Mechanizing Mathematics with Dependent Types Lecture Notes
- Computer Science
- 2014
It is shown that nat rect is indeed a function with three parameters (the keyword fun is similar the lambda notation and is common in the family of ML-like languages), and the summing function can be implemented via the nat’s recursion combinator as follows.
Interactive Theorem Proving and Program Development
- MathematicsTexts in Theoretical Computer Science An EATCS Series
- 2004
The similarity between Fixpoint and fix makes it easier to understand the need for the various parts of this construct, and the construction of higher-order types and simple inductive types defined inside a section is helpful to understanding the form of the induction principle.
Abstracting control
- Computer ScienceLISP and Functional Programming
- 1990
This article investigates an alternative formulation of continuations, exploiting the latent expressive power of the standard continuation-passing style (CPS) instead of introducing yet other new concepts, and describes an improved conversion into applicative-order CPS.
Back to direct style II: first-class continuations
- Computer ScienceLFP '92
- 1992
This work extends the direct-style transformation towards pure, call-by-value functional terms (Scheme) with a counting analysis to detect non-canonical occurrences of a continuation, and presents staged versions of the DS and of the CPS transformations, where administrative reductions are separated from the actual translation, and where the actual translations are carried out by local, structure-preserving rewriting rules.
Deriving Pure , Naturally-Recursive Operations for Processing Tail-Aligned Lists
- Computer Science
- 2016
We present a pattern of programming useful for creating naturally-recursive solutions to a class of problems over linked lists of possibly different lengths, and perhaps even of unknown relative…
Swapping Arguments and Results of Recursive Functions
- Computer ScienceMPC
- 2006
This paper presents new systematic derivations of efficient programs for detecting palindromes, and a method of higher-order removal that can be applied to defunctionalize function arguments, as two concrete applications.
Lambda-dropping: transforming recursive equations into programs with block structure
- Computer ScienceTheor. Comput. Sci.
- 2000
This work presents the symmetric transformation: lambda-dropping, which in a post-processing phase restores block structure and lexical scope thereby significantly reducing both the compile time and the run time of residual programs.