From 93d6391aa8666253cdb9fcf592fc6c7107b5f0cd Mon Sep 17 00:00:00 2001 From: Dylan Roy Date: Wed, 23 Sep 2026 22:30:43 +0000 Subject: [PATCH 1/4] A cell proved disjoint cannot carry a contribution the total then discards `Ledger.reject` validated the kind, the reason and the boundary-area bound and never the residual. `total()` skips every OUTSIDE cell with `continue` before it reaches the branch that sums one. So a caller could reject a cell OUTSIDE while handing over a non-zero residual: the number was stored on the record, dropped from every total, and the run still reported itself sound. Reproduced on a two-cell unit cover, one cell accepted at exactly 1 and the other rejected OUTSIDE carrying [10**6, 10**6]: total.certified True total.covers_region True total.caveats () certified_enclosure Interval(1, 1) A certified enclosure of [1, 1] while holding a discarded possible contribution of a million. THIS WAS A LIVE PATH. Nothing had to be mutated to produce those four lines, which is what separates it from the recorded surviving mutants in the same README. `reject` now refuses a non-zero residual on an OUTSIDE cell. The two statements cannot both be true: OUTSIDE asserts the cell is proved disjoint from the region and therefore contributes exactly zero, so a non-zero possible contribution denies the very rejection the call is recording. Whichever of the two is wrong, the caller must say which rather than have the ledger keep both and silently believe one. The guard is scoped so it closes the hole without removing the feature: `None` and an exact [0, 0] are still accepted on OUTSIDE, and EXCLUDED and UNRESOLVED_BOUNDARY -- the two kinds whose residuals ARE summed -- still take a non-zero one. Controls 33 and 34 in `tests/test_cover.py` (retip of 1796d28, whose controls were 41 and 42; the tip suite ended at 32, so 33 and 34 were free). Control 33 asserts the refusal and was confirmed to FAIL against a copy of the package under the scratchpad with the guard deleted, never by editing the library. Control 34 rebuilds the pre-guard record by hand and asserts the old behaviour, so the defect stays demonstrable after the fix instead of surviving only as prose. Source-branch tests that already occupied numbers 33-40 were not part of 1796d28 and were not taken. `research/cover/README.md` records it with the four lines above, under a heading naming the date it was found. This establishes no mathematics and closes nothing. `D3-LEMMA-RN-UNIF` Piece 1 and Piece 2 remain OPEN, every integrand here is still a labelled reference, and no cell of the program's actual cover is certified. A ledger that refuses to discard a number it was handed is not a cover certificate. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Cz7WZybv8znP64SpPj6sWY Co-authored-by: Dylan Roy --- research/cover/README.md | 36 ++++++++++++++++- research/cover/ledger.py | 22 +++++++++++ tests/test_cover.py | 84 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+), 1 deletion(-) diff --git a/research/cover/README.md b/research/cover/README.md index 256e2c6ee..d4051f4f0 100644 --- a/research/cover/README.md +++ b/research/cover/README.md @@ -231,10 +231,44 @@ kinds, and the distinction matters: | kind | meaning | effect on the total | |---|---|---| -| `OUTSIDE` | proved disjoint from the region by an exact rational test | contributes nothing; the total stays an enclosure | +| `OUTSIDE` | proved disjoint from the region by an exact rational test | contributes nothing; the total stays an enclosure. A non-zero `residual` here is **refused at the point of entry** — see below | | `UNRESOLVED_BOUNDARY` | straddles the boundary, unresolved at the depth limit | contributes its `residual`; without one, `covers_region=False` and `certified=False` | | `EXCLUDED` | excluded by a stated predicate (unused here) | as above | +### An `OUTSIDE` residual the total would have discarded (found 2026-09-23) + +`total()` skips every `OUTSIDE` cell with `continue` *before* it reaches the +branch that sums a residual, and until 2026-09-23 `Ledger.reject` validated the +kind, the reason and the `boundary_area_bound` but never the residual. So a +caller could reject a cell `OUTSIDE` while handing over a non-zero residual, and +the number was stored on the record, dropped from every total, and the run still +reported itself sound. On a two-cell unit cover with one cell accepted at +exactly `1` and the other rejected `OUTSIDE` carrying `[10**6, 10**6]`: + +``` +total.certified True +total.covers_region True +total.caveats () +certified_enclosure Interval(1, 1) +``` + +An enclosure of `[1, 1]` while holding a discarded possible contribution of a +million. **This was a live path, not a mutation** — nothing had to be broken to +produce those four lines. + +`reject` now refuses a non-zero residual on an `OUTSIDE` cell. The two +statements cannot both be true: `OUTSIDE` asserts the cell is *proved disjoint* +and therefore contributes exactly zero, so a non-zero possible contribution +denies the very rejection the call is recording. Whichever is wrong, the caller +must say which. `None` and an exact `[0, 0]` are both still accepted, and the +two kinds whose residuals *are* summed still take a non-zero one — the guard is +scoped to `OUTSIDE`, so it closes the hole without removing the feature. + +Controls 33 and 34 in `tests/test_cover.py`. Control 33 was confirmed to FAIL +against a copy of the package with the guard deleted; control 34 rebuilds the +pre-guard record by hand and asserts the old behaviour, so the defect stays +demonstrable after the fix rather than surviving only as prose. + > **`boundary_area_bound` is the right name for two of those three kinds.** An > `OUTSIDE` cell is *proved disjoint* from the region: it holds no boundary and > contributes exactly zero. Its area is still retained — the recipe says retain diff --git a/research/cover/ledger.py b/research/cover/ledger.py index 74b1c13fb..78c1f404a 100644 --- a/research/cover/ledger.py +++ b/research/cover/ledger.py @@ -545,6 +545,28 @@ def reject(self, cid: str, kind: str, reason: str, raise TypeError("boundary_area_bound must be an exact Fraction") if boundary_area_bound < 0: raise ValueError("boundary_area_bound must be non-negative") + if (kind == RejectKind.OUTSIDE and residual is not None + and not (residual.lo == 0 and residual.hi == 0)): + # ``total()`` skips OUTSIDE cells before it reaches the branch that + # sums a residual, so a non-zero one handed over here is stored on + # the record and then dropped from every total with no caveat, no + # flag and no receipt entry -- the run still reports + # ``certified=True``, ``covers_region=True``, ``caveats=()``. + # Refusing it at the point of entry is the only place the + # contradiction is visible: OUTSIDE asserts the cell is proved + # disjoint from the region, so it contributes exactly zero, and a + # non-zero possible contribution denies the very rejection this + # call is recording. Whichever of the two is wrong, the caller + # must say which rather than have the ledger silently keep both. + raise ValueError( + f"cell {cid!r} is rejected OUTSIDE -- proved disjoint from the " + f"region, so it contributes exactly zero -- but carries a " + f"non-zero residual {residual!r}. An OUTSIDE cell's residual " + f"must be None or exactly [0, 0]; total() would discard this " + f"number and still report the run certified. If the cell can " + f"contribute, it is not OUTSIDE: reject it " + f"UNRESOLVED_BOUNDARY or EXCLUDED, whose residuals are summed." + ) rec.disposition = REJECTED rec.reject_kind = kind rec.reason = reason diff --git a/tests/test_cover.py b/tests/test_cover.py index c904b6e5f..48f9252a7 100644 --- a/tests/test_cover.py +++ b/tests/test_cover.py @@ -1201,3 +1201,87 @@ def flip_second(a, b): region = rn5_annulus_bracket() for a, b in ((F(-1), F(2)), (F(0), F(3)), (F(-4), F(0)), (F(2), F(5))): assert region._axis_min_max(a, b) == (live(a, b), max(abs(a), abs(b))) + + +def test_33_NEGATIVE_CONTROL_outside_cannot_carry_a_nonzero_residual(): + """CONTROL 33. The ledger must refuse a residual it is about to discard. + + ``total()`` skips every OUTSIDE cell with ``continue`` before it reaches + the branch that sums a residual, and until this control landed ``reject()`` + validated the kind, the reason and the boundary-area bound but never the + residual. So a caller could reject a cell OUTSIDE while handing over a + non-zero residual and the number was stored on the record, dropped from + every total, and the run still reported ``certified=True``, + ``covers_region=True``, ``caveats=()``. + + Observed before the guard, on a two-cell unit cover with one cell accepted + at exactly 1 and the other rejected OUTSIDE carrying ``[10**6, 10**6]``:: + + total.certified True + total.covers_region True + total.caveats () + certified_enclosure Interval(1, 1) + + An enclosure of ``[1, 1]`` while holding a discarded possible contribution + of a million. The two statements cannot both be true: OUTSIDE asserts the + cell is proved disjoint and contributes exactly zero. + + This is a live-path control, not a mutation control. Nothing had to be + broken to produce the number above. + """ + def two_cells(): + led = Ledger("guard", Box(F(0), F(2), F(0), F(1)), "cartesian", + integrand="f=1 reference") + led.add(Cell("a", Box(F(0), F(1), F(0), F(1)), 0)) + led.add(Cell("b", Box(F(1), F(2), F(0), F(1)), 0)) + led.accept("a", Interval.exact(F(1)), Interval.exact(F(1)), + Interval.exact(F(1))) + return led + + with pytest.raises(ValueError) as exc: + two_cells().reject("b", RejectKind.OUTSIDE, "proved disjoint", F(1), + Interval.exact(F(10) ** 6)) + assert "OUTSIDE" in str(exc.value) + assert "discard" in str(exc.value) + + # A residual that really is zero is not a contradiction, in either spelling. + two_cells().reject("b", RejectKind.OUTSIDE, "proved disjoint", F(1), None) + two_cells().reject("b", RejectKind.OUTSIDE, "proved disjoint", F(1), + Interval.exact(F(0))) + + # And the guard is scoped to OUTSIDE: the two kinds whose residuals ARE + # summed must still accept a non-zero one, or this control would have + # closed the hole by breaking the feature. + for kind in (RejectKind.EXCLUDED, RejectKind.UNRESOLVED_BOUNDARY): + led = two_cells() + led.reject("b", kind, "held", F(1), Interval.exact(F(7))) + assert led.records["b"].residual == Interval.exact(F(7)) + + +def test_34_NEGATIVE_CONTROL_the_outside_guard_is_load_bearing(): + """CONTROL 34. Control 33 must fail if the guard is removed. + + Re-implements the pre-guard ``reject`` on a copy of the record and shows + the old behaviour reappearing — the residual stored, skipped by ``total()`` + and the run still ``certified=True`` — so that control 33 is known to be + testing the guard rather than some other refusal along the path. + """ + led = Ledger("nogurad", Box(F(0), F(2), F(0), F(1)), "cartesian", + integrand="f=1 reference") + led.add(Cell("a", Box(F(0), F(1), F(0), F(1)), 0)) + led.add(Cell("b", Box(F(1), F(2), F(0), F(1)), 0)) + led.accept("a", Interval.exact(F(1)), Interval.exact(F(1)), + Interval.exact(F(1))) + + rec = led.records["b"] + rec.disposition = REJECTED + rec.reject_kind = RejectKind.OUTSIDE + rec.reason = "proved disjoint" + rec.boundary_area_bound = F(1) + rec.residual = Interval.exact(F(10) ** 6) # the guard would have refused + rec.pending_reason = None + + total = led.total() + assert total.certified and total.covers_region and total.caveats == () + assert total.certified_enclosure() == Interval.exact(F(1)) + assert led.records["b"].residual == Interval.exact(F(10) ** 6) From ec3b4260b07ea31fb7ebc7c6c7bd554d58622d81 Mon Sep 17 00:00:00 2001 From: Dylan Roy Date: Thu, 24 Sep 2026 00:20:15 +0000 Subject: [PATCH 2/4] Correct why the OUTSIDE residual contract is strict, after cross-lane review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The guard is unchanged; its justification was wrong for a case it refuses. I wrote that a non-zero residual on an OUTSIDE cell and the rejection itself "cannot both be true". That holds for the witness that motivated the guard -- [10**6, 10**6] excludes zero, so it does deny "proved disjoint". It is false for a non-singleton enclosure that CONTAINS zero, such as [-eps, eps]: that is a conservative statement of a zero contribution, not a denial of OUTSIDE. Reported by the ChatGPT agent reviewing PR #38, who also reproduced the original witness independently at hardening 6f0f061 -- stored [1000000, 1000000], returned certified [1,1]. The contract stays exactly None or exactly [0, 0], now resting on the reason that is actually true of every value it refuses: total() DISCARDS an OUTSIDE cell's residual before it reaches the summing branch, so a residual of non-zero WIDTH loses the uncertainty it expresses, silently, even when it contains zero. Requiring exact zero makes the discard lossless. A caller who means "zero, conservatively" writes [0, 0]; a caller who means "possibly non-zero" is describing a cell that is not OUTSIDE. Changed in the three places that carried the bad argument -- the guard comment in research/cover/ledger.py, the docstring of control 41, and the README section -- each naming the review rather than quietly rewording. The error message now separates the two cases and gives the remedy for each: reject it UNRESOLVED_BOUNDARY or EXCLUDED if it can contribute, or say [0, 0] and carry the uncertainty on a cell whose residual survives. Also recorded from the same review, and NOT acted on here: research/cover/ ledger.py is pinned twice by research/rn/candidates/inner_wedge_20260920_v1 .json at 37974 bytes / 58ebe18f…, and hardening's copy matches that pin exactly. This edit must not be transported there. The migration branch's copy was already 37269 bytes against that pin, so this branch does not change the binding's status either way -- the hazard is entirely in the transport. The source-compatible integration on that side is an additive checked-total boundary, which catches strictly more than an input guard can. 10/10 checkers pass; 1,927 passed, 1 skipped. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Cz7WZybv8znP64SpPj6sWY --- research/cover/README.md | 18 +++++++++++----- research/cover/ledger.py | 46 +++++++++++++++++++++++++--------------- tests/test_cover.py | 10 +++++++-- 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/research/cover/README.md b/research/cover/README.md index d4051f4f0..ccebc4a3a 100644 --- a/research/cover/README.md +++ b/research/cover/README.md @@ -256,11 +256,19 @@ An enclosure of `[1, 1]` while holding a discarded possible contribution of a million. **This was a live path, not a mutation** — nothing had to be broken to produce those four lines. -`reject` now refuses a non-zero residual on an `OUTSIDE` cell. The two -statements cannot both be true: `OUTSIDE` asserts the cell is *proved disjoint* -and therefore contributes exactly zero, so a non-zero possible contribution -denies the very rejection the call is recording. Whichever is wrong, the caller -must say which. `None` and an exact `[0, 0]` are both still accepted, and the +`reject` now requires an `OUTSIDE` cell's residual to be `None` or exactly +`[0, 0]`, and the reason is the discard rather than a contradiction. The +`[10**6, 10**6]` witness above excludes zero, so it genuinely denies OUTSIDE. +But a non-singleton enclosure that *contains* zero — `[-eps, eps]` — is a +conservative statement of a zero contribution, not a denial, and an earlier +version of this section wrongly called it one. The correction is due to a +cross-lane review on PR #38. + +The strict contract stands on the honest ground: whatever is stored here is +discarded, so a residual of non-zero **width** loses the uncertainty it +expresses, silently. Requiring exact zero makes the discard lossless. A caller +who means "zero, conservatively" writes `[0, 0]`; a caller who means "possibly +non-zero" is describing a cell that is not `OUTSIDE`. `None` and an exact `[0, 0]` are both still accepted, and the two kinds whose residuals *are* summed still take a non-zero one — the guard is scoped to `OUTSIDE`, so it closes the hole without removing the feature. diff --git a/research/cover/ledger.py b/research/cover/ledger.py index 78c1f404a..109eeaba4 100644 --- a/research/cover/ledger.py +++ b/research/cover/ledger.py @@ -548,24 +548,36 @@ def reject(self, cid: str, kind: str, reason: str, if (kind == RejectKind.OUTSIDE and residual is not None and not (residual.lo == 0 and residual.hi == 0)): # ``total()`` skips OUTSIDE cells before it reaches the branch that - # sums a residual, so a non-zero one handed over here is stored on - # the record and then dropped from every total with no caveat, no - # flag and no receipt entry -- the run still reports - # ``certified=True``, ``covers_region=True``, ``caveats=()``. - # Refusing it at the point of entry is the only place the - # contradiction is visible: OUTSIDE asserts the cell is proved - # disjoint from the region, so it contributes exactly zero, and a - # non-zero possible contribution denies the very rejection this - # call is recording. Whichever of the two is wrong, the caller - # must say which rather than have the ledger silently keep both. + # sums a residual, so anything handed over here is stored on the + # record and then DROPPED from every total with no caveat, no flag + # and no receipt entry -- the run still reports ``certified=True``, + # ``covers_region=True``, ``caveats=()``. + # + # The contract is therefore exactly ``None`` or exactly ``[0, 0]``, + # and the reason is the discard rather than a contradiction. An + # earlier version of this comment argued that a non-zero residual + # "denies the very rejection this call is recording". That is true + # of a witness like ``[10**6, 10**6]``, which excludes zero -- but + # it is NOT true of a non-singleton enclosure that CONTAINS zero, + # such as ``[-eps, eps]``: that is a conservative statement of a + # zero contribution, not a denial of OUTSIDE. The correction is due + # to a cross-lane review on PR #38. + # + # The strict contract still holds, on the honest ground: whatever + # is stored here is discarded, so any residual of non-zero WIDTH + # loses the uncertainty it was expressing, silently. Requiring + # exact zero makes the discard lossless. A caller who means "zero, + # conservatively" can say ``[0, 0]``; a caller who means "possibly + # non-zero" is describing a cell that is not OUTSIDE. raise ValueError( - f"cell {cid!r} is rejected OUTSIDE -- proved disjoint from the " - f"region, so it contributes exactly zero -- but carries a " - f"non-zero residual {residual!r}. An OUTSIDE cell's residual " - f"must be None or exactly [0, 0]; total() would discard this " - f"number and still report the run certified. If the cell can " - f"contribute, it is not OUTSIDE: reject it " - f"UNRESOLVED_BOUNDARY or EXCLUDED, whose residuals are summed." + f"cell {cid!r} is rejected OUTSIDE, and total() discards an " + f"OUTSIDE cell's residual before summing -- so the residual " + f"must be None or exactly [0, 0] for that discard to lose " + f"nothing. This one is {residual!r}. If it excludes zero the " + f"cell can contribute and is not OUTSIDE: reject it " + f"UNRESOLVED_BOUNDARY or EXCLUDED, whose residuals are summed. " + f"If it merely has non-zero width around zero, say [0, 0] and " + f"carry the uncertainty on a cell whose residual survives." ) rec.disposition = REJECTED rec.reject_kind = kind diff --git a/tests/test_cover.py b/tests/test_cover.py index 48f9252a7..153e8fb31 100644 --- a/tests/test_cover.py +++ b/tests/test_cover.py @@ -1223,8 +1223,14 @@ def test_33_NEGATIVE_CONTROL_outside_cannot_carry_a_nonzero_residual(): certified_enclosure Interval(1, 1) An enclosure of ``[1, 1]`` while holding a discarded possible contribution - of a million. The two statements cannot both be true: OUTSIDE asserts the - cell is proved disjoint and contributes exactly zero. + of a million. That witness excludes zero, so it does deny OUTSIDE -- but + the contract enforced is the wider one, and for the right reason: whatever + is stored is DISCARDED, so a residual of non-zero width loses the + uncertainty it expresses even when it contains zero. Requiring exact zero + makes the discard lossless. A non-singleton enclosure around zero such as + ``[-eps, eps]`` is a conservative statement of a zero contribution and not + a contradiction; calling it one was an error in the first version of this + control, corrected after cross-lane review on PR #38. This is a live-path control, not a mutation control. Nothing had to be broken to produce the number above. From ba3e527e1fce5bc4f7d23a11d2b6fade0cc95d8d Mon Sep 17 00:00:00 2001 From: Dylan Roy Date: Thu, 24 Sep 2026 00:06:19 +0000 Subject: [PATCH 3/4] Pin the uniform-cost contract, and the 61,642 three documents quote `PolarRegion.uniform_cost` is this package's answer to RN5's "Treat the near-axis refinement cost explicitly", and `research/cover/README.md` stakes its standing on the distinction: "a count, not an estimate -- exact rationals, no fit, no sampling". Its output is quoted as exact arithmetic in three places: `docs/OPEN_PROBLEMS.md` A5 ("98 x 629 = 61,642 polar cells"), `docs/FINDINGS_2026-09-18.md`, and the package README. Control 18 checked the types, that `cells` is the product of the two step counts, that the anisotropy is 50, and that a finer target costs more. None of that constrains the contract the docstring states -- that the grid bounds the cell diameter by `dr + r_hi*2*pi*dt <= target`. The published number was pinned by nothing, and this survived all 48 tests: regions.py:323 half = target_diameter / 2 -> half = target_diameter Under it the annulus reports 49 x 315 = 15,435 cells rather than 61,642, and the grid it describes has diameter bound 0.1997 against a target of 0.1: it does not cover at the resolution it claims, and every document quoting 61,642 becomes false. Nothing failed. Control 43 asserts, in exact rationals and never in float: the headline bound at targets 1/10, 1/20 and 1/3; the even split by which it is achieved; each count minimal for its own half-budget; the published 98 / 629 / 61,642; and that the three documents still quote the figure, so prose and arithmetic cannot drift apart in either direction. ON MINIMALITY, because the first draft of this control asserted the wrong one and failed: `uniform_cost` splits the budget EVENLY and solves each axis against `target/2`, so each count is minimal FOR ITS HALF. The pair is NOT jointly minimal over all (n_r, n_t) meeting the combined bound -- at target 1/3 the annulus reports 30 x 189 while 30 x 188 also satisfies it. Spending less on one axis to spend more on the other is a different algorithm from the one the docstring describes, and a test may not quietly demand it. The control says so in place rather than leaving the weaker property to look like an oversight. Verified against a copy under the scratchpad, never by editing the library: the mutation FAILS control 43 while control 18 still PASSES, which is the whole point -- 18 was blind to it. This establishes no mathematics. A cell count is a count; it certifies no cell, and `D3-LEMMA-RN-UNIF` Piece 1 and Piece 2 remain OPEN. 11/11 checkers pass; 1,928 passed, 1 skipped. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Cz7WZybv8znP64SpPj6sWY --- tests/test_cover.py | 95 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/tests/test_cover.py b/tests/test_cover.py index 153e8fb31..435e5e37a 100644 --- a/tests/test_cover.py +++ b/tests/test_cover.py @@ -122,7 +122,9 @@ check_exact_partition, radial_gaussian_closed_form, rn5_annulus_bracket, rn5_annulus_polar, run, t4_polar_cover, ) -from research.cover.regions import INSIDE, OUTSIDE, STRADDLE # noqa: E402 +from research.cover.regions import ( # noqa: E402 + INSIDE, OUTSIDE, STRADDLE, two_pi_upper, +) # --------------------------------------------------------------- helpers @@ -1291,3 +1293,94 @@ def test_34_NEGATIVE_CONTROL_the_outside_guard_is_load_bearing(): assert total.certified and total.covers_region and total.caveats == () assert total.certified_enclosure() == Interval.exact(F(1)) assert led.records["b"].residual == Interval.exact(F(10) ** 6) + + +def test_43_uniform_cost_meets_its_target_and_the_published_count_is_pinned(): + """CONTROL 43. The cost figure is published in three documents. Pin it. + + ``uniform_cost`` is this package's answer to RN5's "Treat the near-axis + refinement cost explicitly", and the README stakes its standing on the + distinction: "a count, not an estimate -- exact rationals, no fit, no + sampling". Its output is quoted as exact arithmetic in three places: + ``docs/OPEN_PROBLEMS.md`` A5 ("98 x 629 = 61,642 polar cells"), + ``docs/FINDINGS_2026-09-18.md``, and ``research/cover/README.md``. + + Control 18 checks the types, that ``cells`` is the product, that the + anisotropy is 50, and that a finer target costs more. None of that + constrains the *contract* the docstring states -- that a grid of ``N_r`` + radial and ``N_t`` angular steps bounds the cell diameter by + ``dr + r_hi * 2*pi * dt <= target``. So the published number was pinned by + nothing, and this mutation survived all 48 tests: + + regions.py:323 half = target_diameter / 2 -> half = target_diameter + + Under it the annulus reports **49 x 315 = 15,435** cells rather than + 98 x 629 = 61,642, and the grid it describes has diameter bound 0.1997 + against a target of 0.1 -- it does not cover at the requested resolution, + and every document quoting 61,642 becomes false. Nothing failed. + + Three things are asserted here, all in exact rationals and never in float. + """ + a = rn5_annulus_polar() + + # (i) The contract, at several targets. + # + # NOTE ON WHAT MINIMALITY MEANS HERE, because the first draft of this + # control asserted the wrong one and failed. `uniform_cost` splits the + # budget EVENLY -- each axis is solved independently against + # `target/2` -- so each count is minimal FOR ITS HALF, and that is what + # is asserted below. The pair is NOT jointly minimal over all + # (n_r, n_t) meeting the combined bound, and this control does not + # claim it is: at target 1/3 the annulus reports 30 x 189 while + # 30 x 188 also satisfies `dr + r_hi*2*pi*dt <= 1/3`. Spending less on + # one axis to spend more on the other is a different algorithm from the + # one the docstring describes, and a test may not quietly demand it. + for target in (F(1, 10), F(1, 20), F(1, 3)): + cost = a.uniform_cost(target) + n_r, n_t = cost["radial_steps"], cost["angular_steps"] + span = a.r_hi - a.r_lo + circ = a.r_hi * two_pi_upper() + half = target / 2 + + radial_step = span / n_r + angular_extent = circ * (F(1) / n_t) + + # The headline contract the docstring states. + assert radial_step + angular_extent <= target, ( + f"target {target}: grid {n_r}x{n_t} has diameter bound " + f"{radial_step + angular_extent} > {target}; it does not cover at " + f"the resolution it claims") + assert isinstance(radial_step + angular_extent, F) + + # The even split, which is how that bound is actually achieved. + assert radial_step <= half and angular_extent <= half + + # And each count minimal for its own half -- ceil division, so one + # step fewer must overshoot. This is what the mutation breaks. + if n_r > 1: + assert span / (n_r - 1) > half, ( + f"target {target}: {n_r - 1} radial steps would also fit the " + f"half-budget, so the radial count is not minimal") + if n_t > 1: + assert circ * (F(1) / (n_t - 1)) > half, ( + f"target {target}: {n_t - 1} angular steps would also fit the " + f"half-budget, so the angular count is not minimal") + + # (ii) The figure three documents quote, pinned to the arithmetic. + published = a.uniform_cost(F(1, 10)) + assert published["radial_steps"] == 98 + assert published["angular_steps"] == 629 + assert published["cells"] == 61642 + + # (iii) And the documents themselves, so prose and arithmetic cannot drift + # apart in either direction without a failure here. + root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + for rel, fragment in ( + (os.path.join("research", "cover", "README.md"), "61,642"), + (os.path.join("docs", "OPEN_PROBLEMS.md"), "61,642"), + (os.path.join("docs", "FINDINGS_2026-09-18.md"), "61,642")): + path = os.path.join(root, rel) + if not os.path.isfile(path): # the doc set differs per branch + continue + with open(path, encoding="utf-8") as handle: + assert fragment in handle.read(), f"{rel} no longer quotes {fragment}" From 3f14638783e47188344bff0f6c03f5ef56cb2cef Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 25 Sep 2026 17:27:59 +0000 Subject: [PATCH 4/4] Renumber the uniform-cost pin from control 43 to control 35 Source commit 0552c28 added control 43. On this stack controls 33 and 34 are the OUTSIDE residual guard, so the next free number is 35. The test body is unchanged. Co-authored-by: Dylan Roy --- tests/test_cover.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_cover.py b/tests/test_cover.py index 435e5e37a..aab101a9d 100644 --- a/tests/test_cover.py +++ b/tests/test_cover.py @@ -1295,8 +1295,8 @@ def test_34_NEGATIVE_CONTROL_the_outside_guard_is_load_bearing(): assert led.records["b"].residual == Interval.exact(F(10) ** 6) -def test_43_uniform_cost_meets_its_target_and_the_published_count_is_pinned(): - """CONTROL 43. The cost figure is published in three documents. Pin it. +def test_35_uniform_cost_meets_its_target_and_the_published_count_is_pinned(): + """CONTROL 35. The cost figure is published in three documents. Pin it. ``uniform_cost`` is this package's answer to RN5's "Treat the near-axis refinement cost explicitly", and the README stakes its standing on the