Tail recursion transformation for invertible functions
Publikation: Bidrag til bog/antologi/rapport › Konferencebidrag i proceedings › Forskning › fagfællebedømt
Dokumenter
- Fulltext
Indsendt manuskript, 214 KB, PDF-dokument
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 functions subject of transformation calls them. We show how a bespoke data type, corresponding to such a context, can be used to transform invertible recursive functions into a pair of tail recursive function acting on this context, in a way where calls are highlighted, and from which a tail recursive inverse can be straightforwardly extracted.
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 functions subject of transformation calls them. We show how a bespoke data type, corresponding to such a context, can be used to transform invertible recursive functions into a pair of tail recursive function acting on this context, in a way where calls are highlighted, and from which a tail recursive inverse can be straightforwardly extracted.
Originalsprog | Engelsk |
---|---|
Titel | Reversible Computation : 15th International Conference, RC 2023, Giessen, Germany, July 18–19, 2023, Proceedings |
Forlag | Springer |
Publikationsdato | 2023 |
Sider | 73–88 |
ISBN (Trykt) | 978-3-031-38099-0 |
ISBN (Elektronisk) | 978-3-031-38100-3 |
DOI | |
Status | Udgivet - 2023 |
Begivenhed | 15th International Conference on Reversible Computation, RC 2023 - Giessen, Tyskland Varighed: 18 jul. 2023 → 19 jul. 2023 |
Konference
Konference | 15th International Conference on Reversible Computation, RC 2023 |
---|---|
Land | Tyskland |
By | Giessen |
Periode | 18/07/2023 → 19/07/2023 |
Navn | Lecture Notes in Computer Science |
---|---|
Vol/bind | 13960 |
ISSN | 0302-9743 |
ID: 359598632