Intrinsically Correct Algorithms and Recursive Coalgebras

📅 2025-12-11
📈 Citations: 0
✨ Influential: 0
📄 PDF
🤖 AI Summary
Formalizing recursive algorithms in proof assistants faces challenges in verifying correctness and termination, while coinductive proofs often incur redundancy. Method: We propose a corecursive algebraic framework based on well-founded functors, which embeds recursion and correctness directly into the type system—ensuring termination automatically via typing—and unifies classical termination techniques (e.g., rank functions) to enhance expressivity and generality. Contribution/Results: The central theoretical theorem has been fully formalized in Cubical Agda. The framework has been successfully applied to classic algorithms—including Quicksort, Euclid’s algorithm, and CYK parsing—demonstrating significant simplification of recursive algorithm formalization under coinductive semantics.

Technology Category

Application Category

📝 Abstract
Recursive coalgebras provide an elegant categorical tool for modelling recursive algorithms and analysing their termination and correctness. By considering coalgebras over categories of suitably indexed families, the correctness of the corresponding algorithms follows intrinsically just from the type of the computed maps. However, proving recursivity of the underlying coalgebras is non-trivial, and proofs are typically ad hoc. This layer of complexity impedes the formalization of coalgebraically defined recursive algorithms in proof assistants. We introduce a framework for constructing coalgebras which are intrinsically recursive in the sense that the type of the coalgebra guarantees recursivity from the outset. Our approach is based on the novel concept of a well-founded functor on a category of families indexed by a well-founded relation. We show as our main result that every coalgebra for a well-founded functor is recursive, and demonstrate that well-known techniques for proving recursivity and termination such as ranking functions are subsumed by this abstract setup. We present a number of case studies, including Quicksort, the Euclidian algorithm, and CYK parsing. Both the main theoretical result and selected case studies have been formalized in Cubical Agda.
Problem

Research questions and friction points this paper is trying to address.

Ensuring recursive coalgebras guarantee algorithm correctness intrinsically
Simplifying proofs of recursivity to avoid ad hoc methods
Formalizing coalgebraic recursive algorithms in proof assistants effectively
Innovation

Methods, ideas, or system contributions that make the work stand out.

Coalgebras guarantee recursivity from type
Well-founded functors ensure recursive coalgebra construction
Framework formalized in Cubical Agda with case studies
🔎 Similar Papers
C
Cass Alexandru
RPTU Kaiserslautern-Landau, Germany and Radboud University Nijmegen, The Netherlands
Henning Urbat
Henning Urbat
Postdoctoral Researcher, Friedrich-Alexander-Universität Erlangen-Nßrnberg
Theoretical Computer Science
T
Thorsten Wißmann
Friedrich-Alexander-Universität Erlangen-Nßrnberg, Germany