1 Introduction
1.1 Two presentations of , two presentations of
The synthesis paper of our series identified six mutually equivalent presentations of the natural numbers (NNO, Peano, primitive recursion, set-theoretic encoding, Yoneda representable, HoTT inductive type). For the real numbers the analogue narrative produces two presentations rather than six, but each is itself a different universal property:
Inductive (Cauchy/HIIT). Booij’s HoTT Cauchy reals , presented as the initial algebra of a signature consisting of -coercion, a limit operation taking -Cauchy approximations to a point of , plus path constructors that quotient. This is the universal Cauchy-complete Archimedean ordered field.
Coinductive (final coalgebra). The cofree object on a digit-stream signature: for an endofunctor which is roughly (with a digit alphabet) modulo a carry-bisimulation. Streams come with a coinduction principle (Lambek; Rutten ) rather than a recursion principle.
These two presentations are isomorphic as ordered fields by the standard uniqueness theorem for Dedekind-complete Archimedean fields (Paper III Theorem 4.1). They are however not isomorphic as effective structures: the Type II Turing computability literature establishes that Cauchy realizers and stream realizers are interreducible but not equiprimitive. In the intensional setting of HoTT this distinction shows up in the computation rules: the inductive presentation supports recursors that compute on constructors, while the coinductive presentation supports corecursors that produce streams element by element with guarded productivity.
For the transcendentals and , the inductive side is well-understood: Paper V Definitions 8.1–8.2 present as the centre of the contractible type and as via the universal property of as the unique smooth with and . The coinductive side has, prior to this paper, been left implicit: the generic statement “ and are computable hence have canonical digit streams” is true but does not constitute a HoTT-internal characterisation.
1.2 The principal contribution
The principal contribution of this paper is to write down such an internal characterisation. Concretely, we construct:
A functor , , with the alphabet on digits, and prove that its final coalgebra in cubical HoTT is the M-type of streams .
A bisimulation on , the carry-bisimulation, which makes an ordered Archimedean field equipped with a continuous map to .
Two bisimulation-closed observable predicates on , expressed entirely in the internal language of the coalgebra (head/tail/observation), which uniquely identify (up to bisimulation) the Bailey–Borwein–Plouffe digits of in base and the Euler-series digits of in any base.
A coinductive proof, via coinduction up-to-context, that the unique-existence statement is contractible: the type is contractible.
This separates the question “what does name?” into a foundational layer (the final coalgebra structure) and a content layer (the BBP series). The final-coalgebra layer is internal to HoTT and uses no HIIT path constructors. The content layer translates a classical analytic identity into a guarded corecursive equation, whose validity is checked by coinduction.
1.3 Why coinduction matters in HoTT
In Martin-Löf type theory the coinductive types of Coquand and the M-types of Ahrens–Capriotti–Spadotti are treated by dualising the W-type construction. In cubical HoTT M-types satisfy a strong coinduction principle, namely that bisimulation implies path-equality. This is Theorem 5.3 of Paper III in our series, which we recall and refine here as Theorem 13.
Crucially, coinduction allows us to exhibit equalities between streams produced by a priori different corecursive schemes. For instance, the digit stream produced by Machin’s formula is not, as a sequence of base-10 digits, definitionally equal to the digit stream produced by the Leibniz series Their equality must be proven, and coinduction up-to is the natural tool. Once equality is established, both schemes name the same . Our characterisation factors through this identification.
1.4 Outline
2 fixes the type-theoretic framework: cubical HoTT, polynomial endofunctors, M-types, and the construction of final coalgebras. 3 states and proves a HoTT-internal Lambek lemma and the resulting coinduction principle. 4 develops the stream coalgebra in detail, including the carry-bisimulation. 5 introduces bisimulation-closed predicates and the up-to technique. 6 contains the main results: the coalgebraic characterisations of and . 7 sketches the cubical M-type realisation. 8 compares to the Cauchy HIIT of Paper V. 9 states the -prerequisite chain and the -internal-to-coalgebra problem. 10 closes with open problems.
2 Mathematical framework
2.1 Cubical HoTT and polynomial endofunctors
We work in cubical type theory à la Cohen–Coquand–Huber–Mörtberg (CCHM) , with universes closed under the usual type formers, and with the univalence axiom provable from the path-cube structure. We write for the path type, for the constant path, and , for the dependent types. Truncation levels follow Voevodsky’s conventions: a type is a proposition if it has at most one inhabitant up to path equality, a set if its identity types are propositions, and so on.
Definition 1 (Polynomial endofunctor). A polynomial endofunctor on is a functor of the form for some and . The pair is called a container or signature.
The action of on a function is .
Example 2. The stream functor on alphabet is . This is polynomial with -many shapes (one per letter) and a single position per shape: , where is the unit type.
Example 3. For , the base- digit functor is , the special case of 2 with .
Definition 4 (Coalgebra). An -coalgebra is a pair with . A morphism of coalgebras is a function such that . The category of -coalgebras is denoted .
Definition 5 (Final coalgebra). is a final -coalgebra if for every -coalgebra there is a unique morphism .
Remark 6 (Final = terminal in ). “Final” here is the standard terminology of Rutten . In categorical language final coalgebras are terminal objects of , dual to initial algebras (Lambek).
2.2 M-types as final coalgebras
In MLTT the coinductive analogue of W-types is the M-type construction. The M-type for container is where is the type of (potentially infinite) trees and is the productivity (well-formedness) predicate. In cubical HoTT, Ahrens–Capriotti–Spadotti prove:
Theorem 7 (ACS, M-type final coalgebra). For any container , the M-type carries a coalgebra structure which is final.
For our applications the relevant case is the stream functor , where the M-type specialises to streams .
Definition 8 (Stream coalgebra). . The destructor decomposes into the two component maps
Remark 9 (Cubical realisation). In cubical HoTT, admits a definition by guarded recursion using the modality of Birkedal et al. : . The fixed point exists because is a contractive functor and the guarded recursion theorem applies.
3 Lambek’s lemma and coinduction
We recall Lambek’s lemma in its dual coalgebraic form, which is the cornerstone of all coinductive characterisations.
Lemma 10 (Dual Lambek). If is a final -coalgebra, then is a path-equivalence.
Proof. Consider the coalgebra . Finality yields a unique map with . Then is a coalgebra morphism, and so is , so by uniqueness . Symmetrically, is a coalgebra morphism on to itself, equal to the identity. Hence is a path-equivalence with inverse . ◻
Remark 11. 10 is conceptually crucial: it says the final coalgebra is a fixed point of up to path equivalence, the coinductive dual of Lambek’s algebraic “”. In cubical HoTT this equivalence is strict (definitional after path-application) at base types, which is what makes definable.
Definition 12 (Bisimulation). A relation on the carrier of an -coalgebra is an -bisimulation if there exists a coalgebra structure making the two projections coalgebra morphisms. Concretely, for the stream functor , the unfolded definition is: a relation on is a bisimulation iff for all with , we have and .
Theorem 13 (Coinduction principle). Let be a final -coalgebra. For any -bisimulation and any , if holds, then in .
Proof. By 12 the projections are coalgebra morphisms into the final coalgebra. By uniqueness of mediating maps, as coalgebra morphisms, hence as functions, hence pointwise. So if then , i.e. . ◻
This is the fundamental coinductive proof principle: to exhibit a path between two elements of a final coalgebra it suffices to exhibit a bisimulation containing them.
4 Stream coalgebras and digit streams
4.1 The stream functor and its final coalgebra
Theorem 14 (Streams as final coalgebra). For any type , the M-type together with is the final coalgebra of .
Proof sketch. For coalgebra , define by guarded corecursion: The morphism property is judgmental. Uniqueness follows from coinduction (13) applied to the relation . ◻
Example 15 (Constant stream). For , where and , so and .
Example 16 (Naturals as stream). where and . Yields
4.2 Base- digit streams and approximation maps
Fix . We work with digit streams of .
Definition 17 (Approximation map). The base- approximation map takes a stream to the Cauchy real which exists because the partial sums form a -Cauchy approximation in Booij’s sense: for the difference , so the partial sums are uniformly Cauchy with modulus and Booij’s -constructor applies.
Lemma 18 (Approximation surjects onto ). has image .
Proof. Surjection onto is the standard digit-expansion: given , define using the floor function on Cauchy reals. The sum converges to by the standard estimate. Existence of floor on uses Booij’s order. (Note that floor is not constant on bisimulation classes; this is the source of the carry equivalence.) ◻
Definition 19 (Carry-bisimulation). The relation on is the smallest equivalence such that implies . Concretely, for any and any , This is exactly the “” identification.
Theorem 20 ( as quotient final coalgebra). The set-quotient is in HoTT-equivalence with via .
Proof. factors through the quotient by definition of . The induced map is injective by the kernel of being , and surjective by 18. Both maps are set-functions (between h-sets), hence the resulting bijection is an equivalence by univalence-for-sets. ◻
Remark 21 ( from ). The whole real line is recovered as with the obvious carrying identifications, or equivalently as the final coalgebra of the functor modulo the appropriate bisimulation.
5 Bisimulation-closed predicates and coinduction up-to
To characterise and internally to the final coalgebra, we need predicates that respect . We formalise this notion and develop the up-to technique.
Definition 22 (Bisimulation-closed predicate). A predicate is -closed (or simply closed) if . Equivalently, factors through the quotient .
Example 23. The predicate is closed; the predicate in base is not closed: the stream has but is bisimilar to which has .
Definition 24 (Observable predicate). A predicate is observable if it is determined by the function , i.e. for some . Every observable predicate is closed, but not conversely.
Lemma 25. A predicate is closed iff it factors through .
Proof. A closed predicate factors through , and induces an equivalence between and (20). Composition with the inverse equivalence gives the factorisation. Immediate: factoring through implies , which is the definition of closure under the kernel of . ◻
5.1 Coinduction up-to-context
The plain coinduction principle (13) requires exhibiting a strict bisimulation. In practice this is often inconvenient: one wants to prove by exhibiting a relation such that implies that the heads agree and the tails are related by after some closure operations. Sangiorgi–Rutten formalised this via the up-to technique.
Definition 26 (-up-to). Let be a monotone operator on relations on . A relation is a bisimulation up-to if for every , and .
Theorem 27 (Up-to-context soundness). If is compatible (i.e. preserves bisimulations in the sense of Pous–Sangiorgi ), then any bisimulation up-to is contained in .
Proof sketch. Define . Show by induction that is a (plain) bisimulation: heads agree because preserves head-equality, and tails of -related pairs remain in because by monotonicity and the bisimulation-up-to- condition. ◻
Example 28 (Equivalence-closure up-to). is compatible. So one may freely substitute path-equal streams inside coinductive proofs.
Example 29 (Arithmetic up-to). For arithmetic operations on base- digit streams (addition, multiplication, division, exponentiation by digit), the operators are compatible (their compatibility reduces to verifying that each operation is itself definable as coalgebra morphisms, which is ).
6 Coalgebraic characterisations of and
We now state the main results of the paper.
6.1 The case of
Definition 30 (Series coalgebra for ). Define a coalgebra on (state: representing partial summation of in base ), with transition implementing the streaming factorial-series algorithm of Sale (refined to spigot form by Rabinowitz–Wagon and Gibbons ) for streaming the digits of in base . Concretely, where is the next emitted digit and is the updated state.
Theorem 31 ( as final-coalgebra unfold). where is the initial state and . Equivalently, the digit stream of (after subtracting the integer part) is the unique solution of the corecursive equation
Proof. Existence is by guarded corecursion using the productivity of the streaming-factorial algorithm: the state-evolution is structurally decreasing on a measure (the rational interval bounding the unprocessed tail shrinks geometrically), so each output digit is produced after finitely many state transitions. The image under equals by the algorithm’s correctness theorem (a classical fact; see Sale and the spigot-algorithm analysis in ). ◻
Theorem 33 (Coalgebraic characterisation of ). The type quotiented by is contractible. Equivalently: is the unique element of satisfying .
Proof. Existence: 31 gives an inhabitant. Uniqueness: if both satisfy then , so by definition of . Hence after quotient they coincide. Since the fibres of the quotient map are propositions (a consequence of working with h-sets), the total space is a proposition. Combined with inhabitation, this proves contractibility. ◻
Remark 34. 33 is internal in the sense that is expressed in terms of , which is itself definable by guarded corecursion. The HIIT path constructors of Booij’s enter only inside . If one is willing to take as the basic “observation”, the characterisation is purely coalgebraic. We discuss this point further in 8.
6.2 The case of
For the situation is more subtle because no finite-state streaming algorithm is known. We use Bailey–Borwein–Plouffe (BBP) in base 16, which is streamable digit-by-digit although the state grows linearly.
Definition 35 (BBP coalgebra). The Bailey–Borwein–Plouffe identity (1995): This induces a coalgebra with encoding partial summation state, and implementing the BBP digit extraction algorithm in base 16.
Theorem 36 ( as final-coalgebra unfold). satisfies .
Proof. By the BBP correctness theorem (which is constructively valid; see ), the partial sums approximate to within . The hexadecimal digit-extraction state evolves productively, so guarded corecursion yields a stream whose image under equals . ◻
Definition 37 (Predicate ). is . Closed by 25.
Theorem 38 (Coalgebraic characterisation of ). The type quotiented by is contractible.
6.3 Internalisation: removing the reference to
33 and 38 reference and as elements of , hence implicitly the HIIT. We now upgrade these to characterisations expressed purely in terms of bisimulations between streams.
Theorem 39 (Internal characterisation of ). There is a stream defined by guarded corecursion (no use of or HIIT) such that:
, where is from 31.
For any stream , if satisfies the corecursive equation for the (no-) state projection (a partial function defined on the image of , see 13), then .
The unique-existence is proved by coinduction up-to-context.
Proof. Take where from 30 is purely combinatorial (state in , no real numbers; the explicit transition rules are spelled out in 13). Existence: 31.
Uniqueness is the substantive part. Suppose satisfies the equation for some state-projection function that agrees with at . Define the relation This is reflexive on the image of . We claim is a bisimulation up-to the closure defined by (equivalently, is the equivalence-closure under -substitution; this is compatible by the example following 27). To verify the bisimulation-up-to property: given with witness , both heads equal and both tails equal , so heads agree and tails are again related (with the new witness ). By 27 , and by 13 implies .
Now apply this with and : we need to exhibit a with . Such a is provided by together with the corecursive equation, by another application of coinduction (using ). Hence .
Therefore is the unique stream satisfying the corecursive equation, and the bisimulation class is uniquely identified by an internal predicate. ◻
Theorem 40 (Internal characterisation of ). There is a stream defined by guarded corecursion (no use of ) such that uniquely up to bisimulation, characterised by the recursion:
Proof. The argument is structurally identical to that of 39. Concretely, replace by the combinatorial BBP transition function : its state space is (with corresponding to the four sub-series in BBP, plus a position counter; see ) holding the integer numerators and denominators of the modular partial sums. The relation is a bisimulation up-to the substitution-closure , by the same head/tail computation as in 39, and the BBP modular-arithmetic update of ensures the up-to-context operator is compatible (as in the arithmetic example following 27). By [thm:upto-sound,thm:coinduction] is the unique stream up to satisfying the BBP corecursive equation. ◻
Remark 41 (What 39 and 40 do and do not say). The key advance of 39 and 40 over 33 and 38 is that the characterising predicate is now of the form “satisfies the corecursive equation ”, expressed purely in terms of , , , and combinatorial operations on . No reference to or its path constructors is needed. This realises programmes (a)–(c) of with and resp. .
We are however candid about a limitation: the predicate “ satisfies the corecursive equation ” is, in a sense, exactly the description of being the unfold of , and the state projection is canonically defined only on the image of (see 13). Read externally, the theorem says: “the unique stream satisfying the corecursive equation for algorithm is the stream generated by algorithm .” This is not yet a characterisation of or as classical reals without reference to any external structure. Such a fully external characterisation would require either (a) an internal proof that two distinct combinatorial algorithms (e.g. Leibniz and BBP) are bisimilar, or (b) an internal axiomatisation of which streams are “transcendental”.
What [thm:e-internal,thm:pi-internal] do establish is that the bisimulation classes are the unique fixed points of combinatorial corecursive equations, with no path-constructor data (HIIT-data) needed to express the predicate. This is a strict logical advance over the inductive characterisation of Paper V Definition 8.1, which uses sin-zero data internal to . The remaining “gap” is exactly 52 below.
6.4 Comparison: Leibniz, Machin, BBP all name the same
To illustrate the strength of bisimulation as an equality principle in HoTT, we show how three distinct corecursive definitions of -as-stream are proved equal by coinduction.
Definition 42 (Three coalgebras for ). Let (Leibniz), (Machin), (BBP) be three coalgebras whose unfolds in base 10 (resp. 10, 16) yield streams . Each algorithm is a corecursive streaming version of the corresponding analytic identity for .
Proposition 43. , and .
Proof. by classical analytic identities (Leibniz, Machin, BBP all sum to ). Bisimulation follows from 25 and the definition of as the kernel of . ◻
Remark 44 (Limitation: external vs. internal equivalence). 43 factors through the approximation map , hence through . This is therefore not yet a fully internal proof of bisimilarity: the equality of streams is established by mapping to the inductive , computing the values, and pulling back along the kernel of .
A truly internal proof would establish a direct stream-level bisimulation between the Leibniz, Machin, and BBP state machines (after base conversion). Schematically, one might construct a product coalgebra on (running all three algorithms in parallel, with the base-converted BBP state), together with an invariant asserting that the three running partial sums agree to within a shrinking window. The bisimulation would then be coinductively a bisimulation, and 13 would conclude. The technical obstacle is constructing the invariant in HoTT without circular reference to the value of . This is precisely the form 52 would take and we do not claim a solution.
The conceptual picture is striking even in the weaker “factor-through-” form: in HoTT, algorithm equivalence on streams becomes path-equality on the final coalgebra, and coinduction is the proof method.
7 Cubical M-types and stream realisation
We sketch the cubical-HoTT realisation of the M-type used above, following ACS .
7.1 The M-type construction
Definition 45 (M-type). For container , define where , , and the limit is taken along the projections induced by the unique map .
Theorem 46 (Cubical M-type, ACS). In cubical HoTT (CCHM), the limit 45 exists and is the carrier of the final -coalgebra. The destructor is the projection onto the first level.
Remark 47 (Why cubical, not just MLTT). In plain MLTT one cannot prove that is an equivalence (10) without function extensionality and -rules. Cubical HoTT provides function extensionality judgmentally (via path-application) and treats M-types coherently with the path structure, which is what we need for the coinduction principle to compute.
7.2 Productivity and guarded recursion
In cubical HoTT, the topos of trees provides a guarded modality (read “later”). Streams are then a fixed point , and corecursion is just guarded recursion: the recursive call is hidden under , ensuring productivity at the type level. This is what makes our judgmentally well-defined.
8 Comparison with the Cauchy HIIT
8.1 Side-by-side
| Inductive (Booij/HoTT Cauchy) | Coinductive (final coalgebra) |
|---|---|
| HIIT with rat, lim, path-constr | M-type + |
| Recursor: | Corecursor: |
| centre of contractible sin-zero type (Paper V Def. 8.1) | centre of contractible BBP unfold type (40) |
| Equality by computation rule + truncation | Equality by bisimulation |
| Computational content: Cauchy realiser | Computational content: digit stream |
| has join-semilattice + lim-axioms | has digit-shift action |
8.2 Equivalence theorem
Theorem 48 (Inductive–Coinductive equivalence). There is a HoTT equivalence sending the bisimulation class of to .
Proof. Forward direction by 20. Inverse: given , produce its base- digit stream by the floor algorithm of 18; the resulting class is well-defined because two different digit-expansion choices for the same differ only at carry boundaries (the identifications), which is exactly . ◻
Corollary 49. Under , the inductive (Paper V Definition 8.1) and the coinductive (40) coincide.
8.3 Why the duality matters
48 says the two presentations describe the same mathematical object. But computationally they differ:
The inductive presentation supports recursion: to define specify , , and verify path coherence.
The coinductive presentation supports corecursion: to define specify and in terms of head/tail of an evolving state.
For the transcendentals, the natural definitions are corecursive: and are typically given by streaming-digit algorithms (Sale, BBP, spigot algorithms in general). The coinductive presentation matches these algorithms judgmentally; the inductive presentation requires a layer of approximation-and-quotient.
9 Connection to the -prerequisite chain
9.1 The principal open problem
The synthesis paper identifies “ as a HoTT-native statement” as the principal open problem. Loeffler–Stoll formalised in classical Lean/Mathlib (3300 lines for the analytic continuation alone), but no HoTT-native formalisation of the Riemann zeta function is known.
The coalgebraic toolkit developed here suggests an attack route:
Conjecture 50 (Coalgebraic ). There is a polynomial endofunctor with modelling the Riemann zeta function as a stream of digits in some base parametrised by the complex argument , such that:
For with , produces the stream of digits of via the Dirichlet series.
For in the analytic continuation domain , produces digits via Hurwitz formula.
There is a bisimulation-closed predicate such that in iff the unique unfold satisfies .
This conjecture is open. We make some progress in 51 below.
9.2 Dirichlet series as stream
Proposition 51 (Dirichlet partial-sum stream). For with , define a coalgebra on with where (the next partial-sum). Then , modulo the carry-bisimulation.
Proof sketch. The partial sums form a Cauchy approximation to for (standard fact, constructive proof in Booij’s framework). Streaming digits is then 17 applied to that Cauchy approximation. ◻
51 only handles the convergence half-plane. The hard part is analytic continuation (steps 2 and 3 of 50). The classical Mellin-transform approach (Loeffler–Stoll) does not obviously translate to the coalgebraic setting because contour integration along non-trivial paths in is itself a non-trivial constructive issue. We mark this as the principal open problem of the present series.
9.3 Toward analytic continuation coalgebraically
A possible attack: use the functional equation of , to define on by reflection. This is a recursive definition (refer to ), which corresponds in our framework to a morphism between two coalgebras for the same functor , with the morphism implementing the symmetry. A construction of such a morphism in HoTT requires:
A coalgebraic and in (the former is approachable via the universal property of from Paper III §4.3; the latter is significantly harder).
A coalgebraic (complex exponentiation), again via and .
This is a substantial programme; we leave it as a long-term goal of the YonedaAI HoTT mathematics initiative.
10 Open problems and future work
10.1 The internalisation gap
39 and 40 characterise via combinatorial corecursive equations. But the correctness theorems (that the unfold equals resp. ) still reference via .
Open Problem 52 (Fully internal correctness). Find a HoTT statement in the language of streams alone (no , no ) such that , where the property captures via a purely stream-theoretic invariant.
A candidate: stream-bisimulation between and the unfold of an alternative coalgebra (Machin, Leibniz after base conversion). This makes the correctness theorem a bisimulation-only statement, but at the cost of relating distinct combinatorial algorithms via coinduction.
10.2 The carry-bisimulation as HIT vs. propositional truncation
The quotient in 20 can be presented as either (i) a set-quotient HIT, or (ii) a Voevodsky propositional truncation of the equivalence relation. The two are HoTT-equal by univalence-for-sets but differ in computation.
Open Problem 53. Compare the cubical realisation of as set-HIT vs. propositional truncation. Which presentation makes computational (i.e. judgmentally)?
10.3 Productivity and the totality of
In MLTT-without-cubical, the totality of requires a guardedness check on the coalgebra. In our case the BBP and Sale algorithms are guarded by construction (each step emits exactly one digit and modifies state), but a fully formal proof of guardedness is currently absent in our Lean artefact.
Open Problem 54. Formalise productivity of the BBP and Sale digit-extraction algorithms in Lean 4/Mathlib using the Stream’ API and the Coinductive machinery.
10.4 Higher transcendentals
The methods of this paper apply (with the obvious modifications) to other transcendentals with known spigot/streaming algorithms:
Catalan’s constant
Apéry’s constant (Apéry’s series gives a streaming algorithm)
Euler–Mascheroni (no known streaming algorithm of state , an open problem in itself)
Open Problem 55. Extend the coalgebraic characterisation to , Catalan’s constant, and (failing that) prove that has no finite-state stream coalgebra unfold-equal to it.
10.5 Coalgebraic transcendence proofs
The Lindemann–Weierstrass theorem proves the algebraic independence of for -linearly independent algebraic . Paper V §8.3–8.4 marks this as “partially formalisable” in . A coalgebraic proof would require:
A coalgebraic structure on the algebraic numbers (perhaps as a final coalgebra of an “algebraic-extension” functor).
A coalgebraic as the unique coalgebra morphism from the ODE universal property.
Open Problem 56. Formulate a coalgebraic Lindemann–Weierstrass theorem in HoTT.
11 Conclusion
We have given a coinductive characterisation of and in homotopy type theory, completing the programme sketched in Paper III §5 of the prior series. The principal new results are:
A clean statement of the coinduction principle in cubical HoTT (13).
Coalgebraic characterisations of and as unique unfolds satisfying bisimulation-closed observable predicates (33, 38, 39, 40).
An equivalence theorem (48) showing the coinductive presentation matches Booij’s HIIT on .
A Dirichlet-series stream coalgebra (51) giving partial progress towards a coalgebraic .
An accompanying executable framework is provided in Haskell: the stream functor, unfold/corecursion, the carry-bisimulation, and the spigot algorithms for (Leibniz, Machin) and (factorial series), together with QuickCheck properties for stream operations and approximation round-trips. The Lean 4 companion file (using Mathlib’s Stream’ API) formalises the basic coalgebra structure, the corecursive unfold, and a (classical, set-level) coinduction principle; it does not include a formal proof of the productivity of the Sale or BBP transitions, which is left as 54. The Lean component should be read as a partial certification of the type-theoretic infrastructure, not as a complete formalisation of the main theorems. The full formalisation effort is substantial: the main open problem (50) is the construction of a HoTT-native coalgebraic Riemann zeta function with as a bisimulation-closed predicate; this remains far from solved.
Coinductively, the picture has unified beauty: is a stream, namely the unique stream produced by the BBP corecursive equation; is a stream, namely the unique stream produced by the factorial-series corecursive equation; is the type of streams modulo carry; and equality of streams is exactly bisimulation. The HIIT route of Booij is one face of these objects; the final-coalgebra route is the other. Univalence binds them.
12 Prerequisites from the prior series, made explicit
To make the present paper self-contained, we restate (without re-proving) the prior results on which our arguments rely. Each is either a textbook fact found in the standard references on HoTT and coalgebra (see ), or a routine adaptation of a textbook fact to the cubical setting. Where we cite the prior series , the citation is to a particular textbook-style adaptation, and the underlying proofs are the standard ones.
Theorem 57 (A.1; cf. Paper III Theorem 5.2). For any type , the M-type together with is a final coalgebra of the endofunctor .
This is the cubical-HoTT version of Rutten §2 combined with ACS Theorem 3.5. We use it in the form proved by ACS.
Theorem 58 (A.2; cf. Paper III Theorem 5.3). For final coalgebra of polynomial endofunctor , two elements satisfy a path equality iff there exists an -bisimulation with .
This is restated as our 13 and proved internally to the present paper.
Theorem 59 (A.3; cf. Paper III Theorem 4.1). There is, up to unique order-preserving HoTT-equivalence, a unique Dedekind-complete Archimedean ordered field . Booij’s Cauchy HIIT is one such; the quotient for the natural extension of to -shifted streams is another.
We use this in the form: the two presentations agree on , which is 48.
Theorem 60 (A.4; cf. Paper V Definition 8.1, Theorem 5.7). In Booij’s HIIT , the type is contractible. Its centre is by definition .
Theorem 61 (A.5; cf. Paper V Definition 8.2, Theorem 4.3). In Booij’s HIIT , the type is contractible (the universal-property of ). Its centre’s -component is by definition .
These five statements are the only places where the prior series enters our arguments. Reader who prefers to take them as assumptions of the present paper may do so; the rest of the paper then becomes a self-contained development atop these five axioms together with the standard cubical-HoTT infrastructure of .
13 Detailed state-space layout for the proof of Theorem 39
We expand the state-space promise of 39. The streaming-factorial spigot algorithm of maintains a state in : where is the digit position emitted so far, is the next factorial index ready to be summed, and are the bookkeeping triple of (current scaled remainder numerator, current scaled denominator, current digit-out).
The transition is:
Multiply by : .
Extract the integer part: , . (In the cubical implementation and \mod are total constructive operations on .)
Update the position: , (unchanged).
If the remainder is below the precision threshold , advance the factorial: , , and re-normalise by adding the new term’s contribution.
Output: , where is the renormalised remainder.
The state projection function of 39 is the canonical retraction: the unique such that , when such exists. This is a partial function in general, but defined on the image of , which is the only place it is used.
Compatibility of the up-to operator. The up-to operator used in the proof of 39 is By , an up-to operator is compatible iff it preserves the evolution structure of the coalgebra. For our this reduces to the observation that is a coalgebra morphism: heads commute with by definition (they are determined by the first projection of ), and tails commute by the recursive call. Hence is compatible and 27 applies.
99
Long, M. (2026). Universal Properties of Real Numbers and Transcendentals. Paper III, YonedaAI HoTT Foundations Series.
Long, M. (2026). The HoTT Perspective: Numbers as Inductive Types up to Path Equivalence. Paper V, YonedaAI HoTT Foundations Series.
Long, M. (2026). The Univalent Correspondence: How Six Perspectives on Number Become One. Synthesis Paper, YonedaAI HoTT Foundations Series.
Booij, A. (2020). Analysis in Univalent Type Theory. Ph.D. Thesis, University of Birmingham.
Rutten, J.J.M.M. (2000). Universal coalgebra: a theory of systems. Theoretical Computer Science 249(1):3–80.
Jacobs, B. (2016). Introduction to Coalgebra: Towards Mathematics of States and Observation. Cambridge Tracts in Theoretical Computer Science.
Ahrens, B., Capriotti, P., & Spadotti, R. (2015). Non-wellfounded trees in homotopy type theory. Proc. TLCA.
Cohen, C., Coquand, T., Huber, S., & Mörtberg, A. (2018). Cubical Type Theory: a constructive interpretation of the univalence axiom. IfCoLog Journal of Logics.
Birkedal, L., Møgelberg, R.E., Schwinghammer, J., & Støvring, K. (2012). First steps in synthetic guarded domain theory: step-indexing in the topos of trees. Logical Methods in Computer Science 8.
Pous, D., & Sangiorgi, D. (2012). Enhancements of the bisimulation proof method, in Advanced Topics in Bisimulation and Coinduction, CUP.
Ghani, N., Hancock, P., & Pattinson, D. (2009). Continuous functions on final coalgebras. ENTCS 249:3–18.
Sale, A.H.J. (1968). The calculation of to many significant digits. The Computer Journal 11(2):229–230.
Rabinowitz, S., & Wagon, S. (1995). A spigot algorithm for the digits of . American Math. Monthly 102:195–203.
Gibbons, J. (2006). Unbounded spigot algorithms for the digits of pi. American Math. Monthly 113:318–328.
Bailey, D.H., Borwein, P., & Plouffe, S. (1997). On the rapid computation of various polylogarithmic constants. Mathematics of Computation 66:903–913.
Weihrauch, K. (2000). Computable Analysis: An Introduction. Springer.
Loeffler, D., & Stoll, M. (2025). Formalizing zeta and -functions in Lean. Annals of Formalized Mathematics 1. arXiv:2503.00959.
The Univalent Foundations Program. (2013). Homotopy Type Theory: Univalent Foundations of Mathematics. Institute for Advanced Study.
Voevodsky, V. (2010). The univalence axiom and the foundations of mathematics. Lecture series, IAS.
Licata, D.R., & Shulman, M. (2013). Calculating the fundamental group of the circle in homotopy type theory. Proc. LICS.
Coquand, T. (1994). Infinite objects in type theory. Types for Proofs and Programs, Springer LNCS.
Rutten, J.J.M.M. (2003). Behavioural differential equations: a coinductive calculus of streams, automata, and power series. Theoretical Computer Science 308:1–53.
Aczel, P. (1988). Non-Well-Founded Sets. CSLI Lecture Notes 14.
Bordg, A., & Paulson, L. (2024). Coinductive proofs in Isabelle: streams revisited. Journal of Automated Reasoning.
Kleene, S.C. (1952). Introduction to Metamathematics. North-Holland.
Turing, A.M. (1937). On computable numbers, with an application to the Entscheidungsproblem. Proc. London Math. Soc. 42:230–265.
Kapulkin, K., & Lumsdaine, P.L. (2021). The simplicial model of univalent foundations (after Voevodsky). Journal of the European Mathematical Society 23:2071–2126.
Shulman, M. (2018). Brouwer’s fixed-point theorem in real-cohesive homotopy type theory. Math. Structures Comp. Sci. 28:856–941.
Sangiorgi, D. (2012). Introduction to Bisimulation and Coinduction. Cambridge University Press.
Abbott, M., Altenkirch, T., & Ghani, N. (2005). Containers: Constructing Strictly Positive Types. Theoretical Computer Science 342:3–27.