Formalizing termination/productivity across de/refunctionalization

Develop a formal method that composes termination and productivity evidence in the presented dependently typed calculus so that defunctionalization and refunctionalization map valid programs to valid programs. In particular, determine how proofs that the functions plus and mul terminate for the data representation of Nat can be systematically transformed into proofs that the corresponding codefinitions Z and S in the refunctionalized codata representation of Nat are productive.

Background

The paper’s goal is to design a dependently typed calculus whose data and codata fragments are closed under defunctionalization and refunctionalization. However, standard termination (for recursive definitions) and productivity (for corecursive definitions) checks may not be preserved by these transformations.

A concrete example is given with natural numbers: termination proofs for data-level functions plus and mul should, after refunctionalization, correspond to productivity proofs for codata-level codefinitions Z and S. The authors point out that while this correspondence is desired to keep programs valid under transformation, it is presently unspecified how to formally construct such composed evidence.

References

If we want de/refunctionalization to be a transformation that maps valid programs to valid programs, then the evidence for the productivity of Z and S has to be composed of the evidence for the termination of plus and mul. But it is not at all clear how this can be formally specified at the moment.

Deriving Dependently-Typed OOP from First Principles -- Extended Version with Additional Appendices  (2403.06707 - Binder et al., 2024) in Section 7.1 (Specifying Termination and Productivity)