Skip to content

Constructive pi with extractable separation witnesses — would CoRN be interested? (referred from stdlib#316) #227

Closed

Description

@hy7pc8gfmf-dotcom

Constructive pi with extractable separation witnesses — would CoRN be interested?

Referral: proux01 suggested contacting you in stdlib#316 — quoting: "You can try to see if the current maintainers of the corn library would be interested."

What we built

A constructive pi for the constructive Cauchy reals, realized by the alternating Leibniz series, with the strong irrationality separation theorem: for every rational q, an explicit computable margin c > 0 and index N with c < |p_m - q| for all m >= N — both extracting to runnable OCaml (zero Obj.magic, zero axioms, coqchk clean).

  • 24 new .v files, ~35.1K lines; premise-free main theorems at top level
  • CI: 180/180 checks green across Rocq 9.2 / 9.3 / master / Alpine; zero compiler warnings
  • Full per-module map, dependency graph, and review-aid materials in stdlib#316 (see the "review-aid" comment)

Lineage

The development extends the constructive-reals line this repository is home of: the method family — alternating series with easy error bounds computing pi in exact real arithmetic — is due to O'Connor (TYPES 2007) and Krebbers–Spitters (LMCS 2013). Our increment is what that line does not carry: apartness statements and per-rational extraction-ready witnesses.

Two questions for the maintainers

  1. Interest in principle? Would a verified constructive pi with extractable separation witnesses fit CoRN's scope?
  2. Dependency stance? Our stack currently builds on stdlib's ConstructiveCauchyReals (CReal / CReal_appart / inject_Q, distributed with Rocq 9.x) plus our own small escape-window engine (stdlib#313). Would CoRN accept that as a dependency, or would you require porting onto CoRN's own CReal? We are willing to port — the escape-window engine is our own mathematics, so the instantiation layer is adaptation work, and we would of course deliver it with the same verification standard (coqchk / Print Assumptions / extraction differential / multi-toolchain CI).

Maintenance

Long-term maintenance is committed publicly (compatibility upkeep across future Rocq releases; review responses within days) — see the maintenance-commitment comment in stdlib#316.

Happy to provide anything else that helps the assessment.

Activity

  1. hy7pc8gfmf-dotcom commented on Oct 14, 2026

    @hy7pc8gfmf-dotcom
    Author

    Following up on this issue: a draft PR is now open that makes the CoRN-native form of the separation engine concrete and CI-testable.

    Draft PR opened: #228 — native-CR port complete and green (five-proof + PA Closed + zero axioms); ready to mark RFC on your preference (this native-CR form, or the stdlib-CReal-dependency variant also prepared).

    In short:

    • The draft adds reals/fast/CrnEscapeSep.v (287 lines): the escape-window irrationality criterion carried directly by CoRN's fast constructive reals. From a family of positive window widths that eventually escapes the dyadic approximations of x, it derives forall q : Q, CRapartT x ('q) with an extractable side certificate — CRapartT is the disjoint sum exhibiting the side, and each component carries a positive rational distance witness (CRltT = CRpos (y - x)).
    • The port is shorter than the standard-library CReal engine: the positivity witness of CRpos_char is a single positive rational, so the Archimedean index pushdown disappears entirely; the witness is the quarter of the escape margin, and the coherence of the approximation function (crn_reg_le) transports the escape inequality across precisions. Top-level statements are premise-free, carried by Set/the sum type, with no axiom and no classical logic (Print Assumptions closed).
    • The PR is marked as a draft and is in a discussion stage — not requesting merge yet. It is meant as a concrete, CI-testable anchor for the question asked here; happy to rework scope, or hold entirely, per maintainer preference.
    • For comparison, the branch crn-pi-stdlibdep on the fork carries the sibling form of the Leibniz-pi construction that depends on the standard library's ConstructiveCauchyReals (the form Constructive pi with extractable separation witnesses — would CoRN be interested? (referred from stdlib#316) #227 describes, 26-file supply chain over there); the native-CR form above is the CoRN-side half of the same program.
  2. Lysxia commented on Oct 26, 2026

    @Lysxia
    Collaborator

    This is a sizeable contribution that stands well enough on its own. I don't think we have the bandwidth to maintain this as part of CoRN, whereas you clearly have the machine power to maintain your project on your side, so I recommend you do just that and there's no need to add anything to CoRN.

  3. hy7pc8gfmf-dotcom commented on Oct 27, 2026

    @hy7pc8gfmf-dotcom
    Author

    Thank you for the clear and prompt assessment. We accept the recommendation: the development will continue as a standalone project, and we will not pursue inclusion in CoRN.

    For the record, the standalone form is already in place: the package is in the official opam repository (opam install rocq-pi-leibniz, v1.0.4, archived on Zenodo with a DOI), with the verification chain (coqchk, Print Assumptions, extraction audit, multi-toolchain CI) running on every push.

    I will close draft PR #228 and keep the branch in our own repository. Thanks again to you and to the stdlib maintainers for the quick and concrete guidance at every step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions