Tail recursion transformation for invertible functions
Joachim Tilsted Kristensen, Robin Kaarsgaard, Michael Kirkedal Thomsen

TL;DR
This paper introduces a novel algorithm for transforming invertible recursive functions into tail recursive form, facilitating optimizations in reversible programming by focusing on global invertibility rather than local reversibility.
Contribution
It presents a new tail recursion transformation method specifically designed for invertible functions, overcoming limitations of CPS in reversible programming contexts.
Findings
Transforming invertible functions into tail recursive form is feasible with the proposed algorithm.
The method simplifies deriving inverses of tail recursive functions in reversible programming.
The approach highlights function calls and maintains invertibility through a specialized context data type.
Abstract
Tail recursive functions allow for a wider range of optimisations than general recursive functions. For this reason, much research has gone into the transformation and optimisation of this family of functions, in particular those written in continuation passing style (CPS). Though the CPS transformation, capable of transforming any recursive function to an equivalent tail recursive one, is deeply problematic in the context of reversible programming (as it relies on troublesome features such as higher-order functions), we argue that relaxing (local) reversibility to (global) invertibility drastically improves the situation. On this basis, we present an algorithm for tail recursion conversion specifically for invertible functions. The key insight is that functions introduced by program transformations that preserve invertibility, need only be invertible in the context in which the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsParallel Computing and Optimization Techniques · Logic, programming, and type systems · Computability, Logic, AI Algorithms
