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.
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.