Structured general corecursion and coinductive graphs [extended abstract]
Bove and Capretta’s popular method for justifying function definitions by general recursive equations is based on the observation that any structured general recursion equation defines an inductive subset of the intended domain (the “domain of definedness”) for which the equation has a unique solution. To accept the definition, it is hence enough to prove that this subset contains the whole intended domain. This approach works very well for “terminating” definitions. But it fails to account for “productive” definitions, such as typical definitions of stream-valued functions. We argue that such definitions can be treated in a similar spirit, proceeding from a different unique solvability criterion. Any structured recursive equation defines a coinductive relation between the intended domain and intended codomain (the “coinductive graph”). This relation in turn determines a subset of the intended domain and a quotient of the intended codomain with the property that the equation is uniquely solved for the subset and quotient. The equation is therefore guaranteed to have a unique solution for the intended domain and intended codomain whenever the subset is the full set and the quotient is by equality.
💡 Research Summary
The paper revisits the well‑known Bove‑Capretta method for justifying functions defined by general recursive equations and points out its limitation to terminating definitions. In the original approach a recursive equation induces an inductively defined “domain of definedness”: the smallest subset of the intended input type on which the equation admits a unique solution. Proving that this subset coincides with the whole intended domain guarantees that the function is well‑defined. This works beautifully for functions that always terminate, but it breaks down for productive definitions such as stream‑producing functions, co‑algorithms, or any computation that yields an infinite observable behaviour.
To overcome this gap the authors propose a dual, coinductive perspective. For any structured general recursion equation they construct a coinductive relation R ⊆ D × C, called the “coinductive graph”, between the intended domain D and codomain C. The relation is built by unfolding the equation coinductively: each recursive call contributes a new edge in the graph, and the construction proceeds indefinitely when the equation describes an infinite process. From R two derived structures emerge. First, the set D₀ = { d ∈ D | ∃c. (d,c) ∈ R } is the “R‑definedness” subset of the domain. Second, the projection of R onto C yields an equivalence ≈ on C: two outputs are equivalent if they are related to the same inputs through R, i.e., they exhibit identical observable behaviour.
The central theorem states that if D₀ = D (every intended input participates in the graph) and the induced equivalence ≈ coincides with actual equality on C, then the original recursive equation has a unique solution on the full domain and codomain. In other words, the equation is uniquely solvable for the intended types precisely when the coinductive graph covers the whole domain and does not identify distinct outputs. This mirrors the Bove‑Capretta criterion but replaces the inductive domain with a coinductive graph, thereby handling infinite, productive definitions.
The paper illustrates the theory with several canonical examples. A classic stream‑valued function f : Nat → Stream Nat is defined by f n = cons (g n) (f (h n)). The inductive domain method cannot guarantee that f is defined for all n because the recursion never terminates. By constructing the coinductive graph, each natural number n is linked to an infinite stream whose head is g n and whose tail is obtained by recursively applying f to h n. The resulting D₀ is the whole set of naturals, and the induced equivalence on streams is exactly stream equality (pointwise equality of all positions). Hence f is productive and uniquely determined.
A second example treats a co‑algorithm described by a transition function τ : S → O × S, where S is a state space and O an output alphabet. The recursive equation S = τ(S) yields an infinite observation tree. The coinductive graph connects each state with the infinite output sequence it generates. Again D₀ = S and the induced equivalence on output sequences is equality of the infinite streams, satisfying the theorem’s conditions.
Formally, the authors define the construction of R by coinductive rules that mirror the syntax of the recursive equation. For each constructor of the codomain they introduce a rule that, given related sub‑arguments, yields a related pair at the top level. The coinductive proof principle guarantees that the greatest relation satisfying these rules exists and is precisely the coinductive graph. They also prove that any solution of the original equation must factor through the quotient C/≈, and that when ≈ is equality the factorisation is trivial, giving a unique solution.
Finally, the paper discusses the relationship between the inductive domain and the coinductive graph. Both are dual notions: the former captures termination, the latter captures productivity. The authors argue that many realistic specifications combine both aspects, and a mixed approach—using the inductive domain for terminating sub‑components and the coinductive graph for productive ones—offers a flexible framework for reasoning about complex definitions.
In conclusion, the work extends the theory of general recursion from a purely inductive setting to a unified inductive‑coinductive setting. By introducing the coinductive graph and its associated domain and quotient, it provides a rigorous criterion for the existence and uniqueness of solutions to productive definitions, thereby broadening the applicability of Bove‑Capretta style reasoning to modern functional programming constructs such as infinite streams, co‑algorithms, and reactive systems.
Comments & Academic Discussion
Loading comments...
Leave a Comment