From a3db661d0cc630820bc5d4af667bbd166bde154b Mon Sep 17 00:00:00 2001 From: Sagar Thakrar Date: Tue, 13 Oct 2026 23:06:08 +0530 Subject: [PATCH] Independent verification: code-disjoint pricing of the 16 pending kappa claims (no new kappa) --- Makefile | 7 + .../CLAIM.json | 27 + .../README.md | 115 ++++ .../RESULT.json | 445 ++++++++++++++++ .../SNAPSHOT.json | 493 ++++++++++++++++++ .../arith.py | 133 +++++ .../rebind.py | 42 ++ .../sweep.py | 77 +++ .../test_package.py | 39 ++ .../verify.py | 74 +++ 10 files changed, 1452 insertions(+) create mode 100644 research/pending-claims-independent-pricing/CLAIM.json create mode 100644 research/pending-claims-independent-pricing/README.md create mode 100644 research/pending-claims-independent-pricing/RESULT.json create mode 100644 research/pending-claims-independent-pricing/SNAPSHOT.json create mode 100644 research/pending-claims-independent-pricing/arith.py create mode 100644 research/pending-claims-independent-pricing/rebind.py create mode 100644 research/pending-claims-independent-pricing/sweep.py create mode 100644 research/pending-claims-independent-pricing/test_package.py create mode 100644 research/pending-claims-independent-pricing/verify.py diff --git a/Makefile b/Makefile index 66f00cfb30..3cdf61a21b 100644 --- a/Makefile +++ b/Makefile @@ -604,3 +604,10 @@ frontier890-verify: selected-record-check frontier942-verify: selected-record-check @work=$$(mktemp -d "$${TMPDIR:-/tmp}/integer-mult-frontier942.XXXXXX"); \ python3 -B scripts/verify_frontier942.py --work "$$work/replay" + +# Independent verification: code-disjoint pricing of the pending kappa claims (no new kappa). +.PHONY: pending-claims-pricing-verify +pending-claims-pricing-verify: + @work=$$(mktemp -d "$${TMPDIR:-/tmp}/integer-mult-pending-claims.XXXXXX"); \ + python3 -B research/pending-claims-independent-pricing/verify.py --work "$$work/replay" && \ + python3 -B -m unittest discover -s research/pending-claims-independent-pricing -p test_package.py diff --git a/research/pending-claims-independent-pricing/CLAIM.json b/research/pending-claims-independent-pricing/CLAIM.json new file mode 100644 index 0000000000..5a60c9392e --- /dev/null +++ b/research/pending-claims-independent-pricing/CLAIM.json @@ -0,0 +1,27 @@ +{ + "ai_assistance": "substantial: Claude (Anthropic) via Claude Code", + "assignment_seed": 83, + "assumptions": { + "1019": "W,N from the selected T37 record (not recorded in the PR)", + "1030": "W=7168,N=72 (not recorded in the PR)" + }, + "base_commit": "2921874911956718fcaaaf9396fe8267b3cfa9f0", + "claims": [ + "For all 16 open PRs claiming kappa >= 0.001661960547713947 at the snapshot, the recorded complex endpoint certifies with code-disjoint arithmetic and the recomputed kappa equals both the committed record and the PR title.", + "Every claim has deficit exactly W - 64N (320 per replica); the gains come from profile shape only." + ], + "contributor": "Sagar Thakrar (thakrarsagar)", + "expected_last_line": "PASS_PENDING_CLAIMS_PRICING_REPLAY", + "license": "Apache-2.0", + "not_claimed": [ + "realization of the profiles by the claimed words/owners/hosting", + "local words, invoices, owner audits or inherited assumptions", + "acceptance of any claim", + "claims opened after the snapshot" + ], + "reproduce": "make pending-claims-pricing-verify", + "seed_source": "Python secrets (OS CSPRNG)", + "snapshot_time": "2026-10-13T17:34Z", + "status": "independent verification; no new kappa", + "track": "75-84 independent verification" +} diff --git a/research/pending-claims-independent-pricing/README.md b/research/pending-claims-independent-pricing/README.md new file mode 100644 index 0000000000..4f6aca2eb4 --- /dev/null +++ b/research/pending-claims-independent-pricing/README.md @@ -0,0 +1,115 @@ +# Code-disjoint pricing of the pending κ claims + +**Status: independent verification. No new κ; the selected result is unchanged.** +Track 75–84 (independent verification), assignment seed 83 (OS CSPRNG via Python `secrets`). +Base commit `2921874911956718fcaaaf9396fe8267b3cfa9f0`. The snapshot covers all **16 open PRs claiming +a conditional κ at or above the selected 0.001661960547713947**, as listed at 17:34 UTC on +2026-10-13. Each claim is pinned to its PR head. + +## What is checked + +These claims, including Jeremy Kothe's rapid leaver/slot/T16 series, have so far been priced only +with the retained engines in their own packages. PR1049, from another session of this contributor, +independently checks the leaver cells' *local words* and explicitly excludes moment/outer pricing. +This package checks the **pricing chain** of every claim from its committed record, with code that +does not import or read `moment.py`, `base_two_moment.py` or `outer.py`: + +1. **Deficit.** Rank mass and deficit come from the committed global profile. The test is the + coverage form D = W − 64N of the nine-stage hosted template (one free coordinate per live + family, minus 64 per complete invocation; see PR1012). +2. **Halving guard.** 73² > 2·r_max². +3. **Endpoint certification.** The recorded complex endpoint b must certify: the moment is below + one at b and above one at b + 10⁻²⁴. The arithmetic computes logarithms through the prime chain + ln p = ln(p−1) + 2·atanh(1/(2p−1)) and exponentials with a Taylor polynomial and Lagrange + remainder, using exact rationals rounded outward to 2⁻³²⁰. It extends PR1051's arithmetic to + every prime. +4. **κ.** κ is recomputed through the selected outer reduction with PR589's bit endpoint, which + every record cites unchanged, and compared with the record and the PR title. PR1019 uses its + own 10⁻²⁴ objective grid. + +## Result + +| PR | Head | Author | W | N | Deficit | D = W − 64N | Endpoint certified | κ recomputed | = record and title | +|---|---|---|---:|---:|---:|:---:|:---:|---|:---:| +| [#962](https://github.com/CrocSwap/integer-mult-bounds/pull/962) | `50c6ae8151` | GamingPuzzled | 33,152 | 333 | 11,840 | yes | yes | 0.001661960547713947 | yes | +| [#987](https://github.com/CrocSwap/integer-mult-bounds/pull/987) | `0beb9476d1` | rohanarun | 33,152 | 333 | 11,840 | yes | yes | 0.001662039077758742 | yes | +| [#1004](https://github.com/CrocSwap/integer-mult-bounds/pull/1004) | `1974578f82` | jeremykothe2 | 7,168 | 72 | 2,560 | yes | yes | 0.001664233607446043 | yes | +| [#1005](https://github.com/CrocSwap/integer-mult-bounds/pull/1005) | `779e80aef4` | jeremykothe2 | 7,168 | 72 | 2,560 | yes | yes | 0.001671387264390146 | yes | +| [#1018](https://github.com/CrocSwap/integer-mult-bounds/pull/1018) | `eac7547cb1` | jeremykothe2 | 7,168 | 72 | 2,560 | yes | yes | 0.00167166528321877 | yes | +| [#1019](https://github.com/CrocSwap/integer-mult-bounds/pull/1019) | `eff6576441` | 1337isnot1337 | 33,152¹ | 333 | 11,840 | yes | yes | 0.001661960547713947858091 | yes | +| [#1022](https://github.com/CrocSwap/integer-mult-bounds/pull/1022) | `58618bcbfe` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672081255752945 | yes | +| [#1028](https://github.com/CrocSwap/integer-mult-bounds/pull/1028) | `be4bd89cb4` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672166670891177 | yes | +| [#1030](https://github.com/CrocSwap/integer-mult-bounds/pull/1030) | `d71857cd0a` | AlexS-scale | 7,168¹ | 72 | 2,560 | yes | yes | 0.00166202617947539 | yes | +| [#1031](https://github.com/CrocSwap/integer-mult-bounds/pull/1031) | `e900534f0b` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672167430672016 | yes | +| [#1042](https://github.com/CrocSwap/integer-mult-bounds/pull/1042) | `7e8ef087c0` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672188119205421 | yes | +| [#1050](https://github.com/CrocSwap/integer-mult-bounds/pull/1050) | `c87242f846` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672241870811633 | yes | +| [#1053](https://github.com/CrocSwap/integer-mult-bounds/pull/1053) | `6f92ce8884` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672245809535804 | yes | +| [#1055](https://github.com/CrocSwap/integer-mult-bounds/pull/1055) | `a8ea308976` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672251604432734 | yes | +| [#1061](https://github.com/CrocSwap/integer-mult-bounds/pull/1061) | `223f581afb` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.00167259071506618 | yes | +| [#1065](https://github.com/CrocSwap/integer-mult-bounds/pull/1065) | `387d935e35` | jeremykothe2 | 14,336 | 144 | 5,120 | yes | yes | 0.001672644568760139 | yes | + +¹ PR1019 and PR1030 do not record W or N in their JSON. They are priced with the selected T37 +values (33,152, 333) and with (7,168, 72) respectively. The latter is the unique W with +mass = 72W + 64N for the 72-call template. These two rows check the arithmetic under that stated +assumption only. + +- **All 16 recorded endpoints certify, and all 16 recomputed κ values equal both the record and + the title.** The complex side binds in every claim. All 12 slot/T16 and leaver claims use + PR589's bit endpoint unchanged. +- **Every claim has deficit exactly W − 64N**, which is 320 per replica. The recent gains (+0.64% + for the top claim, PR1065) do not come from the deficit. They come entirely from the shape of the + child-rank profile, through helper removal, re-hosting and owner packing. This is the + mass-neutral consolidation mechanism PR1012 prices. +- One documentation trap is worth noting for reviewers. PR1005's head also carries the stacked + PR1004 package `research/gauge44-leaver/`, whose `RESULT.json` and README state 0.001664233607446043. + PR1005's own claim lives in `research/gauge44-leaver8/`, and that package is consistent. GitHub's + file list for PR1005 is capped at 100 entries and does not show `gauge44-leaver8/`. + +## Scope + +This checks the arithmetic from the committed profile to κ, and the deficit identity. It does +**not** verify the following; for the local words, see PR1049: + +- that the profiles are realized by the claimed words, owners and hosting; +- the local words; +- the invoices and prefix bits; +- the owner audits; +- any inherited all-size, realization, precision/tape, analytic or bit H1–H5 assumption. + +Claims opened after the snapshot are not covered. A passing row is consistency evidence, not +acceptance of a claim. + +## Reproduce + +```sh +make pending-claims-pricing-verify # offline: table regenerated and compared, 6 controls, 3 tests (~2 s) +python3 -B research/pending-claims-independent-pricing/rebind.py # optional, network: re-bind every head and blob +``` + +Expected: `PASS_PENDING_CLAIMS_PRICING_REPLAY`, and `PASS_PENDING_CLAIMS_REBOUND` from the optional +rebind. Standard-library Python 3.10+. + +[`SNAPSHOT.json`](SNAPSHOT.json) holds each claim's profile, W, N, endpoint and κ, with the git +blob id of every source file at the pinned head. `rebind.py` refetches the pull refs and requires +those blobs and values. Nothing from the PRs is executed. + +Each negative control uses the top claim: + +| Control | Rejected because | +|---|---| +| C1 one extra rank-one child | moment not below one | +| C2 one replica's live stock (896) removed | moment not below one | +| C3 endpoint + 10⁻²⁴ claimed | moment not below one | +| C4 κ + 10⁻¹⁸ | not admissible under the margin | +| C5 a bit endpoint below b | the binding side and κ change | +| C6 exponential truncated at degree 2 | the enclosure is too wide, so the check fails closed | + +## Credit + +- The claims and their constructions belong to their authors: Jeremy Kothe (PR1004, PR1005, + PR1018, PR1022, PR1028, PR1031, PR1042, PR1050, PR1053, PR1055, PR1061, PR1065), rohanarun + (PR987), GamingPuzzled (PR962), 1337isnot1337 (PR1019) and AlexS-scale (PR1030), and to the + lineage credited in their packages. +- The retained engines' authors are credited for the reduction this replicates. +- Prepared by Sagar Thakrar (thakrarsagar) with substantial AI assistance from Claude (Anthropic) + via Claude Code. New material is Apache-2.0. diff --git a/research/pending-claims-independent-pricing/RESULT.json b/research/pending-claims-independent-pricing/RESULT.json new file mode 100644 index 0000000000..aa441c8ce9 --- /dev/null +++ b/research/pending-claims-independent-pricing/RESULT.json @@ -0,0 +1,445 @@ +{ + "base_commit": "2921874911956718fcaaaf9396fe8267b3cfa9f0", + "claims": [ + { + "assumed_live": null, + "binding": "complex", + "calls": 333, + "claimed_kappa_decimal": "0.001661960547713947", + "complex_lower": "416181814685169713943/250000000000000000000000", + "deficit": 11840, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "50c6ae8151493af21d284afe34fb35f68f6d4934", + "kappa": "1661960547713947/1000000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001661960547713947", + "kappa_grid": "1/1000000000000000000", + "live": 33152, + "max_child": 48, + "moment_minus_one": [ + -3.361953297269796e-25, + 2.6116088264013558e-24 + ], + "pr": 962, + "rank_mass": 2408256, + "record_bit_is_pr589": true, + "record_kappa": "1661960547713947/1000000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 333, + "claimed_kappa_decimal": "0.001662039077758742", + "complex_lower": "33296121009430302887/20000000000000000000000", + "deficit": 11840, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "0beb9476d10308e6693a886be78b36df8fa0a288", + "kappa": "831019538879371/500000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001662039077758742", + "kappa_grid": "1/1000000000000000000", + "live": 33152, + "max_child": 48, + "moment_minus_one": [ + -4.30108568812966e-25, + 2.5175564787017098e-24 + ], + "pr": 987, + "rank_mass": 2408256, + "record_bit_is_pr589": true, + "record_kappa": "831019538879371/500000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 72, + "claimed_kappa_decimal": "0.001664233607446043", + "complex_lower": "1667007898013796187659/1000000000000000000000000", + "deficit": 2560, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "1974578f82a30158dd5fcdcdf226b83df8e7196f", + "kappa": "1664233607446043/1000000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001664233607446043", + "kappa_grid": "1/1000000000000000000", + "live": 7168, + "max_child": 48, + "moment_minus_one": [ + -2.4314261480232887e-24, + 5.123273217930672e-25 + ], + "pr": 1004, + "rank_mass": 520704, + "record_bit_is_pr589": true, + "record_kappa": "1664233607446043/1000000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 72, + "claimed_kappa_decimal": "0.001671387264390146", + "complex_lower": "837092738337043214923/500000000000000000000000", + "deficit": 2560, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "779e80aef469bc3a28b19f1adde199871a9a22e3", + "kappa": "835693632195073/500000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001671387264390146", + "kappa_grid": "1/1000000000000000000", + "live": 7168, + "max_child": 48, + "moment_minus_one": [ + -9.258737006004893e-25, + 2.0052907720365676e-24 + ], + "pr": 1005, + "rank_mass": 520704, + "record_bit_is_pr589": true, + "record_kappa": "835693632195073/500000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 72, + "claimed_kappa_decimal": "0.00167166528321877", + "complex_lower": "837232213634911250061/500000000000000000000000", + "deficit": 2560, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "eac7547cb191f875d5f5ea5f9bbb1d2b8c51c4ef", + "kappa": "167166528321877/100000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001671665283218770", + "kappa_grid": "1/1000000000000000000", + "live": 7168, + "max_child": 48, + "moment_minus_one": [ + -1.979307000988187e-24, + 9.513705783902783e-25 + ], + "pr": 1018, + "rank_mass": 520704, + "record_bit_is_pr589": true, + "record_kappa": "167166528321877/100000000000000000" + }, + { + "assumed_live": "same construction as the selected T37 record; the PR does not record W or N", + "binding": "complex", + "calls": 333, + "claimed_kappa_decimal": "0.001661960547713947858091", + "complex_lower": "416181814685169713943/250000000000000000000000", + "deficit": 11840, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "eff657644137971f6e31ac3c825950c770471349", + "kappa": "1661960547713947858091/1000000000000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001661960547713947858091", + "kappa_grid": "1/1000000000000000000000000", + "live": 33152, + "max_child": 48, + "moment_minus_one": [ + -3.361953297269796e-25, + 2.6116088264013558e-24 + ], + "pr": 1019, + "rank_mass": 2408256, + "record_bit_is_pr589": true, + "record_kappa": "1661960547713947858091/1000000000000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672081255752945", + "complex_lower": "837440897103320120967/500000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "58618bcbfe88a252467755fc283c04c3db5ca4fd", + "kappa": "334416251150589/200000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672081255752945", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -1.4542276185711208e-24, + 1.4757224565021068e-24 + ], + "pr": 1022, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "334416251150589/200000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672166670891177", + "complex_lower": "418741873928083522699/250000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "be4bd89cb4483dcee43257200cd27601f938f13d", + "kappa": "1672166670891177/1000000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672166670891177", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -1.007383533558856e-24, + 1.922417513868155e-24 + ], + "pr": 1028, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "1672166670891177/1000000000000000000" + }, + { + "assumed_live": "not recorded in the PR; the unique W with mass = 72W + 64N for N = 72", + "binding": "complex", + "calls": 72, + "claimed_kappa_decimal": "0.00166202617947539", + "complex_lower": "6659172436825204659/4000000000000000000000", + "deficit": 2560, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "d71857cd0ae7824e935aac17327e4ec27f66322b", + "kappa": "166202617947539/100000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001662026179475390", + "kappa_grid": "1/1000000000000000000", + "live": 7168, + "max_child": 48, + "moment_minus_one": [ + -2.84216519038647e-24, + 1.0552393084223625e-25 + ], + "pr": 1030, + "rank_mass": 520704, + "record_bit_is_pr589": true, + "record_kappa": "166202617947539/100000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672167430672016", + "complex_lower": "167496825804052126943/100000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "e900534f0beda892c726723524203b97471fb9a3", + "kappa": "104510464417001/62500000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672167430672016", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -2.011337084587053e-24, + 9.18462628735048e-25 + ], + "pr": 1031, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "104510464417001/62500000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672188119205421", + "complex_lower": "418747253984418082117/250000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "7e8ef087c02a77038a28a337a7ee3a77039cac0d", + "kappa": "1672188119205421/1000000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672188119205421", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -2.3889779456209852e-24, + 5.407856824204997e-25 + ], + "pr": 1042, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "1672188119205421/1000000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672241870811633", + "complex_lower": "1675042947764293066129/1000000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "c87242f846cfab8c0b97fd889b5fecb0eacef939", + "kappa": "1672241870811633/1000000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672241870811633", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -1.5192235017619388e-24, + 1.4104463554463648e-24 + ], + "pr": 1050, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "1672241870811633/1000000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672245809535804", + "complex_lower": "1675046899694594506681/1000000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "6f92ce8884929c9fd4730c86a28e2e3735de02af", + "kappa": "418061452383951/250000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672245809535804", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -1.3551628881509305e-24, + 1.5745000970974846e-24 + ], + "pr": 1053, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "418061452383951/250000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672251604432734", + "complex_lower": "1675052714021265690157/1000000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "a8ea308976f1709eef0a328463f010cf51469277", + "kappa": "836125802216367/500000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672251604432734", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -1.2834336995190958e-25, + 2.8013094311833555e-24 + ], + "pr": 1055, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "836125802216367/500000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.00167259071506618", + "complex_lower": "1675392961778137655331/1000000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "223f581afb1d63d5f8476a69040617e11bcd50e4", + "kappa": "83629535753309/50000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672590715066180", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -1.5576526146085553e-24, + 1.3714079676703798e-24 + ], + "pr": 1061, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "83629535753309/50000000000000000" + }, + { + "assumed_live": null, + "binding": "complex", + "calls": 144, + "claimed_kappa_decimal": "0.001672644568760139", + "complex_lower": "1675446996078375166313/1000000000000000000000000", + "deficit": 5120, + "deficit_equals_W_minus_64N": true, + "endpoint_certified": true, + "halving": true, + "head": "387d935e354a931d636e2c5e6ee63a6910f78a1b", + "kappa": "1672644568760139/1000000000000000000", + "kappa_equals_record": true, + "kappa_equals_title": true, + "kappa_exact_decimal": "0.001672644568760139", + "kappa_grid": "1/1000000000000000000", + "live": 14336, + "max_child": 48, + "moment_minus_one": [ + -1.8982085012907377e-24, + 1.030757955629281e-24 + ], + "pr": 1065, + "rank_mass": 1041408, + "record_bit_is_pr589": true, + "record_kappa": "1672644568760139/1000000000000000000" + } + ], + "method": "code-disjoint: atanh prime chain, Taylor exp with Lagrange remainder, 2^-320 outward rounding", + "status": "PASS_PENDING_CLAIMS_PRICED", + "summary": { + "claims": 16, + "deficit_identity_holds": 16, + "endpoints_certified": 16, + "kappa_matches_record": 16 + } +} diff --git a/research/pending-claims-independent-pricing/SNAPSHOT.json b/research/pending-claims-independent-pricing/SNAPSHOT.json new file mode 100644 index 0000000000..cab5ae8e67 --- /dev/null +++ b/research/pending-claims-independent-pricing/SNAPSHOT.json @@ -0,0 +1,493 @@ +[ + { + "author": "GamingPuzzled", + "bit_lower": null, + "calls": 333, + "claimed_kappa_decimal": "0.001661960547713947", + "complex_lower": "416181814685169713943/250000000000000000000000", + "head": "50c6ae8151493af21d284afe34fb35f68f6d4934", + "live": 33152, + "pr": 962, + "profile": { + "1": 848490, + "2": 112554, + "3": 148518, + "4": 53946, + "48": 11086, + "5": 23976, + "8": 2664 + }, + "record_kappa": "1661960547713947/1000000000000000000", + "sources": { + "record": [ + "research/complex-t37-owners/data/SPEC.json", + "03a64d19868c3216b369f0ec8507ad514fa7d561" + ] + }, + "title": "Conditional \u03ba = 0.001661960547713947: T37 owner map on PR890's U8 word (independent cross-check of #942)" + }, + { + "author": "rohanarun", + "bit_lower": "0.001733427039589844234749", + "calls": 333, + "claimed_kappa_decimal": "0.001662039077758742", + "complex_lower": "33296121009430302887/20000000000000000000000", + "head": "0beb9476d10308e6693a886be78b36df8fa0a288", + "live": 33152, + "pr": 987, + "profile": { + "1": 848490, + "2": 112554, + "3": 149850, + "4": 51282, + "48": 11086, + "5": 25308, + "8": 2664 + }, + "record_kappa": "831019538879371/500000000000000000", + "sources": { + "record": [ + "research/complex-u10-t37/CLAIM.json", + "5577c0c8963814e6e359db1e3b926924a870984e" + ] + }, + "title": "Draft: conditional \u03ba = 0.001662039077758742 \u2014 U10 (two new triangle-hybrid slots) on PR942's T37 owners" + }, + { + "author": "jeremykothe2", + "bit_lower": null, + "calls": 72, + "claimed_kappa_decimal": "0.001664233607446043", + "complex_lower": "1667007898013796187659/1000000000000000000000000", + "head": "1974578f82a30158dd5fcdcdf226b83df8e7196f", + "live": 7168, + "pr": 1004, + "profile": { + "1": 177877, + "16": 18, + "2": 27944, + "3": 31001, + "32": 13, + "4": 11952, + "48": 2364, + "5": 5040, + "7": 280, + "8": 599 + }, + "record_kappa": "1664233607446043/1000000000000000000", + "sources": { + "record": [ + "research/gauge44-leaver/data/SPEC.json", + "215ab7a3e856fd4a938595c0814e2ff9594355fe" + ] + }, + "title": "Conditional \u03ba = 0.001664233607446043: mutable-leaver all-K cells, U8 hybrids and frame re-optimisation on PR79" + }, + { + "author": "jeremykothe2", + "bit_lower": null, + "calls": 72, + "claimed_kappa_decimal": "0.001671387264390146", + "complex_lower": "837092738337043214923/500000000000000000000000", + "head": "779e80aef469bc3a28b19f1adde199871a9a22e3", + "live": 7168, + "pr": 1005, + "profile": { + "1": 174763, + "16": 23, + "2": 30105, + "3": 30275, + "4": 12240, + "48": 2419, + "5": 4896, + "7": 54, + "8": 576 + }, + "record_kappa": "835693632195073/500000000000000000", + "sources": { + "record": [ + "research/gauge44-leaver8/data/SPEC.json", + "db24c49da468c91eff1d3339c487287a771272d3" + ] + }, + "title": "Conditional \u03ba = 0.001671387264390146: all eight mutable-leaver all-K cells, U8 hybrids and frame re-optimisati" + }, + { + "author": "jeremykothe2", + "bit_lower": null, + "calls": 72, + "claimed_kappa_decimal": "0.00167166528321877", + "complex_lower": "837232213634911250061/500000000000000000000000", + "head": "eac7547cb191f875d5f5ea5f9bbb1d2b8c51c4ef", + "live": 7168, + "pr": 1018, + "profile": { + "1": 174763, + "16": 23, + "2": 30105, + "3": 31283, + "4": 10224, + "48": 2419, + "5": 5904, + "7": 54, + "8": 576 + }, + "record_kappa": "167166528321877/100000000000000000", + "sources": { + "record": [ + "research/gauge44-slots/data/SPEC.json", + "6ac06e4b75800605270d7ec06fef3eab438e06e0" + ] + }, + "title": "Conditional \u03ba = 0.00167166528321877: seven triangle-hybrid slots (PR987 search) on the k8 leaver word" + }, + { + "author": "1337isnot1337", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": null, + "claimed_kappa_decimal": "0.001661960547713947858091", + "complex_lower": "416181814685169713943/250000000000000000000000", + "head": "eff657644137971f6e31ac3c825950c770471349", + "live": null, + "pr": 1019, + "profile": { + "1": 848490, + "2": 112554, + "3": 148518, + "4": 53946, + "48": 11086, + "5": 23976, + "8": 2664 + }, + "record_kappa": "1661960547713947858091/1000000000000000000000000", + "sources": { + "record": [ + "research/t37-rational-refinement/ASSEMBLY.json", + "ef910a2945b0732546056ed5c67573c9df4ecaf7" + ] + }, + "title": "Conditional \u03ba = 0.001661960547713947858091 by exact T37 grid refinement" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672081255752945", + "complex_lower": "837440897103320120967/500000000000000000000000", + "head": "58618bcbfe88a252467755fc283c04c3db5ca4fd", + "live": 14336, + "pr": 1022, + "profile": { + "1": 349569, + "16": 58, + "2": 60208, + "3": 62552, + "4": 20448, + "48": 4845, + "5": 11808, + "7": 33, + "8": 1152 + }, + "record_kappa": "334416251150589/200000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "a82510f16f1ee7b95eba25bacecddd9cdb7d59bf" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "dedeb2ed5a5aa427f30ebdf05112be6f1ef2b70c" + ] + }, + "title": "Conditional \u03ba = 0.001672081255752945: sixteen-replica owner controller on the seven-slot k8 word" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672166670891177", + "complex_lower": "418741873928083522699/250000000000000000000000", + "head": "be4bd89cb4483dcee43257200cd27601f938f13d", + "live": 14336, + "pr": 1028, + "profile": { + "1": 349579, + "16": 49, + "2": 60192, + "3": 62597, + "4": 20448, + "48": 4849, + "5": 11808, + "7": 10, + "8": 1152 + }, + "record_kappa": "1672166670891177/1000000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "101323316241c9ed3522321f49b4836ce0d403c7" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "79aafee58305369247dd4fae7e9470e3be382d26" + ] + }, + "title": "Conditional \u03ba = 0.001672166670891177: improved T16 owner packing on the seven-slot k8 word" + }, + { + "author": "AlexS-scale", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": null, + "claimed_kappa_decimal": "0.00166202617947539", + "complex_lower": "6659172436825204659/4000000000000000000000", + "head": "d71857cd0ae7824e935aac17327e4ec27f66322b", + "live": null, + "pr": 1030, + "profile": { + "1": 183024, + "2": 25344, + "3": 31536, + "4": 11664, + "48": 2400, + "5": 5184, + "8": 576 + }, + "record_kappa": "166202617947539/100000000000000000", + "sources": { + "record": [ + "research/complex-rank7-end-pair/data/EXPECTED.json", + "083c78b9519f662cd15d965894d2c3d412ee511a" + ] + }, + "title": "Conditional \u03ba = 0.00166202617947539: U8 with two rank-seven helper ends" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672167430672016", + "complex_lower": "167496825804052126943/100000000000000000000000", + "head": "e900534f0beda892c726723524203b97471fb9a3", + "live": 14336, + "pr": 1031, + "profile": { + "1": 349577, + "16": 49, + "2": 60193, + "3": 62597, + "4": 20448, + "48": 4849, + "5": 11808, + "7": 10, + "8": 1152 + }, + "record_kappa": "104510464417001/62500000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "b7436c9c1689e13ff813e46954676734b3f05801" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "967b7616bac16b71063cf43f5a422581a749c303" + ] + }, + "title": "Conditional \u03ba = 0.001672167430672016: improved T16 owner packing on the seven-slot k8 word" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672188119205421", + "complex_lower": "418747253984418082117/250000000000000000000000", + "head": "7e8ef087c02a77038a28a337a7ee3a77039cac0d", + "live": 14336, + "pr": 1042, + "profile": { + "1": 349577, + "16": 47, + "2": 60193, + "3": 62608, + "4": 20448, + "48": 4850, + "5": 11808, + "7": 3, + "8": 1152 + }, + "record_kappa": "1672188119205421/1000000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "84450b3b278e0409b66176598900b74412298a72" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "e6fdc026462e4505653051cb3f158cd22dfae474" + ] + }, + "title": "Conditional \u03ba = 0.001672188119205421: improved T16 owner packing on the seven-slot k8 word" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672241870811633", + "complex_lower": "1675042947764293066129/1000000000000000000000000", + "head": "c87242f846cfab8c0b97fd889b5fecb0eacef939", + "live": 14336, + "pr": 1050, + "profile": { + "1": 349577, + "16": 36, + "2": 60193, + "3": 62621, + "4": 20448, + "48": 4853, + "5": 11808, + "7": 2, + "8": 1152 + }, + "record_kappa": "1672241870811633/1000000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "0672c2b3926647ce712b30af1b80d8c55f6f424f" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "9e60fd2cb7ea307ca0a6f1319ae47d95d28b1f47" + ] + }, + "title": "Conditional \u03ba = 0.001672241870811633: improved T16 owner packing on the seven-slot k8 word" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672245809535804", + "complex_lower": "1675046899694594506681/1000000000000000000000000", + "head": "6f92ce8884929c9fd4730c86a28e2e3735de02af", + "live": 14336, + "pr": 1053, + "profile": { + "1": 349584, + "16": 37, + "2": 60193, + "3": 62618, + "4": 20448, + "48": 4853, + "5": 11808, + "8": 1152 + }, + "record_kappa": "418061452383951/250000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "ea3a4350a5131e7f9411ab54b221b5a8fc10c3d0" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "5713a7701e6f4ec0e1f488f7a2ae80e5da0f6e25" + ] + }, + "title": "Conditional \u03ba = 0.001672245809535804: improved T16 owner packing on the seven-slot k8 word" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672251604432734", + "complex_lower": "1675052714021265690157/1000000000000000000000000", + "head": "a8ea308976f1709eef0a328463f010cf51469277", + "live": 14336, + "pr": 1055, + "profile": { + "1": 349577, + "16": 36, + "2": 60193, + "3": 62614, + "4": 20448, + "48": 4853, + "5": 11808, + "7": 5, + "8": 1152 + }, + "record_kappa": "836125802216367/500000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "d1b08fc6b68666c9f12bee7f4eb50c2ecebaf14e" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "5c626eb9117724567bf894de63d93aa58680917d" + ] + }, + "title": "Conditional \u03ba = 0.001672251604432734: improved T16 owner packing on the seven-slot k8 word" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.00167259071506618", + "complex_lower": "1675392961778137655331/1000000000000000000000000", + "head": "223f581afb1d63d5f8476a69040617e11bcd50e4", + "live": 14336, + "pr": 1061, + "profile": { + "1": 349596, + "16": 1, + "2": 60192, + "3": 62610, + "4": 20448, + "48": 4865, + "5": 11808, + "7": 2, + "8": 1152 + }, + "record_kappa": "83629535753309/50000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "75024d902221b999cc28bd46d4dac96eb824d54f" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "1a6d0c0e278f7669e9bba63cb1b51e89232d37d8" + ] + }, + "title": "Conditional \u03ba = 0.00167259071506618: improved T16 owner packing on the seven-slot k8 word" + }, + { + "author": "jeremykothe2", + "bit_lower": "1733427039589844234749/1000000000000000000000000", + "calls": 144, + "claimed_kappa_decimal": "0.001672644568760139", + "complex_lower": "1675446996078375166313/1000000000000000000000000", + "head": "387d935e354a931d636e2c5e6ee63a6910f78a1b", + "live": 14336, + "pr": 1065, + "profile": { + "1": 349603, + "2": 60192, + "3": 62597, + "4": 20448, + "48": 4866, + "5": 11808, + "7": 2, + "8": 1152 + }, + "record_kappa": "1672644568760139/1000000000000000000", + "sources": { + "data/SPEC.json": [ + "research/gauge44-slots-t16/data/SPEC.json", + "39628452981f1156af05d951a0c75ba0df867e93" + ], + "record": [ + "research/gauge44-slots-t16/RESULT.json", + "c444037ca10a75b27f46f43a9ce50dcc4199c5bc" + ] + }, + "title": "Conditional \u03ba = 0.001672644568760139: improved T16 owner packing on the seven-slot k8 word" + } +] \ No newline at end of file diff --git a/research/pending-claims-independent-pricing/arith.py b/research/pending-claims-independent-pricing/arith.py new file mode 100644 index 0000000000..b9e3014443 --- /dev/null +++ b/research/pending-claims-independent-pricing/arith.py @@ -0,0 +1,133 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Code-disjoint exact interval arithmetic for complex-moment endpoints and the kappa reduction. + +Imports nothing from the retained engines (moment.py, base_two_moment.py, outer.py). +Extends the arithmetic of research/t37-endpoints-independent (PR1051) to every prime: + ln 2 = 2 atanh(1/3), ln p = ln(p-1) + 2 atanh(1/(2p-1)) for odd primes p, +since p/(p-1) = (1+t)/(1-t) with t = 1/(2p-1) <= 1/5. atanh tails use the geometric bound +t^(2K+1) / ((2K+1)(1-t^2)); exp uses a Taylor polynomial with remainder 2 y^(K+1)/(K+1)!; +all intervals are exact rationals rounded outward to multiples of 2^-PREC. +""" +from fractions import Fraction as Q +from functools import lru_cache + +PREC = 320 +TERMS = 120 +TAYLOR = 16 + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def down(x): + return Q((x.numerator << PREC) // x.denominator, 1 << PREC) + + +def up(x): + return -down(-x) + + +class I: + __slots__ = ('lo', 'hi') + + def __init__(self, lo, hi=None): + hi = lo if hi is None else hi + require(lo <= hi, 'interval order') + self.lo, self.hi = down(Q(lo)), up(Q(hi)) + + def __add__(self, o): + o = o if isinstance(o, I) else I(o) + return I(self.lo + o.lo, self.hi + o.hi) + + def __sub__(self, o): + o = o if isinstance(o, I) else I(o) + return I(self.lo - o.hi, self.hi - o.lo) + + def __mul__(self, o): + o = o if isinstance(o, I) else I(o) + p = (self.lo * o.lo, self.lo * o.hi, self.hi * o.lo, self.hi * o.hi) + return I(min(p), max(p)) + + __radd__ = __add__ + __rmul__ = __mul__ + + +def atanh(t): + t = Q(t) + require(0 < t <= Q(1, 3), 'atanh argument') + s, power = Q(0), t + for k in range(TERMS): + s += power / (2 * k + 1) + power *= t * t + return I(s, s + power / ((2 * TERMS + 1) * (1 - t * t))) + + +def is_prime(p): + return p >= 2 and all(p % d for d in range(2, int(p ** 0.5) + 1)) + + +@lru_cache(None) +def ln_prime(p): + require(is_prime(p), 'not a prime') + if p == 2: + return 2 * atanh(Q(1, 3)) + return ln_int(p - 1) + 2 * atanh(Q(1, 2 * p - 1)) + + +@lru_cache(None) +def ln_int(k): + require(k >= 1, 'positive integer') + out, d = I(0), 2 + while k > 1: + while k % d == 0: + out = out + ln_prime(d) + k //= d + d += 1 + return out + + +def exp_small(y): + require(0 <= y.lo and y.hi < Q(1, 100), 'exp range') + lo = hi = tlo = thi = Q(1) + for k in range(1, TAYLOR + 1): + tlo = down(tlo * y.lo / k) + thi = up(thi * y.hi / k) + lo += tlo + hi += thi + return I(lo, hi + thi * y.hi / (TAYLOR + 1) * 2) + + +def moment(H, m, W, z, surcharge=False): + total = I(0) + lm = ln_int(m) + for r, n in H.items(): + require(0 < r < m, 'child rank range') + total = total + I(Q(r * n, m * W)) * exp_small((lm - ln_int(r)) * I(z)) + if surcharge: + total = total + I(Q(32 * m * sum(H.values()), 10 ** 16 * W)) * exp_small(lm * I(z)) + return total + + +def certify(H, m, W, b, grid=Q(1, 10 ** 24), surcharge=False): + at, nxt = moment(H, m, W, b, surcharge), moment(H, m, W, b + grid, surcharge) + require(at.hi < 1, 'moment not below one at the endpoint') + require(nxt.lo > 1, 'moment not above one at the next grid point') + return (float(at.hi - 1), float(nxt.lo - 1)) + + +def kappa_from(b, c, grid=Q(1, 10 ** 18)): + """Selected T37 reduction: s = min(c, (1-beta) b) - 10^-27, seven bootstrap steps from 384599/10^10, + q = a7 (1 - 2 eta), kappa = largest grid point strictly below (1 - eta) q / (1 + q); eta = beta = 10^-24.""" + eta = beta = Q(1, 10 ** 24) + s = min(c, (1 - beta) * b) - Q(1, 10 ** 27) + a = Q(384599, 10 ** 10) + for _ in range(7): + a = (1 - s) * s + s * a + q = a * (1 - 2 * eta) + margin = (1 - eta) * q / (1 + q) + t = margin / grid + k = (-((-t.numerator) // t.denominator) - 1) * grid + require(k < margin <= k + grid, 'grid reduction') + return k, margin, ('bit' if c <= (1 - beta) * b else 'complex') diff --git a/research/pending-claims-independent-pricing/rebind.py b/research/pending-claims-independent-pricing/rebind.py new file mode 100644 index 0000000000..9a1c379bc9 --- /dev/null +++ b/research/pending-claims-independent-pricing/rebind.py @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Re-bind SNAPSHOT.json to the pinned PR heads (needs network access to fetch the pull refs). + +Usage: python3 -B research/pending-claims-independent-pricing/rebind.py +For every claim: fetch refs/pull/N/head, require the recorded head to be that ref or an ancestor of it, +require every recorded source file's git blob id at the recorded head, and require the profile, live +stock, calls and endpoint values in those files to equal the snapshot. +""" +import json +import subprocess +from pathlib import Path + +HERE = Path(__file__).resolve().parent + + +def git(*a): + r = subprocess.run(['git', *a], cwd=HERE, capture_output=True, text=True) + return r.returncode, r.stdout.strip() + + +def main(): + snap = json.loads((HERE / 'SNAPSHOT.json').read_text()) + for c in snap: + rc, _ = git('cat-file', '-e', c['head'] + '^{commit}') + if rc: + git('fetch', '--quiet', 'origin', f"pull/{c['pr']}/head") + rc, _ = git('cat-file', '-e', c['head'] + '^{commit}') + assert rc == 0, f"#{c['pr']}: head {c['head']} not available" + for key, (path, blob) in c['sources'].items(): + rc, got = git('rev-parse', f"{c['head']}:{path}") + assert rc == 0 and got == blob, f"#{c['pr']}: {path} blob differs" + rc, txt = git('show', f"{c['head']}:{c['sources']['record'][0]}") + rec = json.loads(txt) + exp = rec.get('expected', {}) + prof = rec.get('complex_profile') or exp.get('global_profile') or rec.get('profile') or rec.get('global_profile') + assert prof == c['profile'], f"#{c['pr']}: profile differs" + print('rebound', c['pr'], c['head'][:12], len(c['sources']), 'source files') + print('PASS_PENDING_CLAIMS_REBOUND') + + +if __name__ == '__main__': + main() diff --git a/research/pending-claims-independent-pricing/sweep.py b/research/pending-claims-independent-pricing/sweep.py new file mode 100644 index 0000000000..dc60fab01d --- /dev/null +++ b/research/pending-claims-independent-pricing/sweep.py @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Code-disjoint pricing of every pending conditional-kappa claim at or above the selected record. + +Usage: sweep.py OUT.json + +Reads SNAPSHOT.json (each claim's committed profile, live stock, calls, complex endpoint and kappa, +copied from the PR's pinned head with the git blob id of every source file). For every claim: + 1. rank mass and deficit, and the coverage form D = W - 64 N of the nine-stage hosted template; + 2. the halving guard 73^2 > 2 r_max^2; + 3. the recorded complex endpoint: moment < 1 there and > 1 at the next 10^-24 grid point; + 4. kappa from the selected outer reduction with the unchanged PR589 bit endpoint, compared with + the record and the title. +Nothing is fetched or executed from the PRs; rebind.py re-checks the snapshot against the heads. +""" +import json +import sys +from fractions import Fraction as Q +from pathlib import Path + +from arith import certify, kappa_from, require + +HERE = Path(__file__).resolve().parent +M = 73 +BIT = Q('1733427039589844234749/1000000000000000000000000') # PR589, unchanged in every claim +ASSUMED = {1019: (33152, 333, 'same construction as the selected T37 record; the PR does not record W or N'), + 1030: (7168, 72, 'not recorded in the PR; the unique W with mass = 72W + 64N for N = 72')} + + +def price(c): + H = {int(r): n for r, n in c['profile'].items()} + W, N, note = c['live'], c['calls'], None + if W is None: + W, N, note = ASSUMED[c['pr']] + mass = sum(r * n for r, n in H.items()) + D = M * W - mass + b = Q(c['complex_lower']) + grid = Q(1, 10 ** 24) if c['pr'] == 1019 else Q(1, 10 ** 18) + row = dict(pr=c['pr'], head=c['head'], live=W, calls=N, assumed_live=note, rank_mass=mass, deficit=D, + deficit_equals_W_minus_64N=(D == W - 64 * N), max_child=max(H), halving=M * M > 2 * max(H) ** 2, + complex_lower=str(b), claimed_kappa_decimal=c['claimed_kappa_decimal'], record_kappa=c['record_kappa']) + try: + row['moment_minus_one'] = certify(H, M, W, b) + row['endpoint_certified'] = True + except ValueError as e: + row['endpoint_certified'] = False + row['endpoint_failure'] = str(e) + k, margin, binding = kappa_from(b, BIT, grid) + digits = len(str(grid.denominator)) - 1 + exact = '0.' + str(k.numerator * (grid.denominator // k.denominator)).zfill(digits) + bit_ok = c.get('bit_lower') in (None, str(BIT)) or Q(c['bit_lower']) == BIT + row.update(kappa=str(k), kappa_exact_decimal=exact, binding=binding, kappa_grid=str(grid), record_bit_is_pr589=bit_ok, + kappa_equals_record=(k == Q(c['record_kappa'])), + kappa_equals_title=(exact.rstrip('0') == c['claimed_kappa_decimal'].rstrip('0'))) + return row + + +def main(): + snap = json.loads((HERE / 'SNAPSHOT.json').read_text()) + rows = [price(c) for c in sorted(snap, key=lambda c: c['pr'])] + out = dict(status='PASS_PENDING_CLAIMS_PRICED', base_commit='2921874911956718fcaaaf9396fe8267b3cfa9f0', + method='code-disjoint: atanh prime chain, Taylor exp with Lagrange remainder, 2^-320 outward rounding', + claims=rows, + summary=dict(claims=len(rows), endpoints_certified=sum(r['endpoint_certified'] for r in rows), + kappa_matches_record=sum(r['kappa_equals_record'] for r in rows), + deficit_identity_holds=sum(r['deficit_equals_W_minus_64N'] for r in rows))) + with open(sys.argv[1], 'w') as f: + f.write(json.dumps(out, indent=1, sort_keys=True) + '\n') + print(out['status'], json.dumps(out['summary'])) + for r in rows: + print(f"#{r['pr']:5d} W {r['live']:6d} N {r['calls']:3d} D {r['deficit']:6d} D=W-64N {str(r['deficit_equals_W_minus_64N']):5s}" + f" endpoint {'ok' if r['endpoint_certified'] else 'FAIL'} kappa {float(Q(r['kappa'])):.18f}" + f" record {'=' if r['kappa_equals_record'] else '!='} title {'=' if r['kappa_equals_title'] else '!='}" + f"{' (assumed W)' if r['assumed_live'] else ''}") + + +if __name__ == '__main__': + main() diff --git a/research/pending-claims-independent-pricing/test_package.py b/research/pending-claims-independent-pricing/test_package.py new file mode 100644 index 0000000000..b91212d026 --- /dev/null +++ b/research/pending-claims-independent-pricing/test_package.py @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Fast checks. Run: python3 -B -m unittest discover -s research/pending-claims-independent-pricing -p test_package.py -v""" +import json +import math +import sys +import unittest +from fractions import Fraction as Q +from pathlib import Path + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) + +import arith # noqa: E402 + + +class Tests(unittest.TestCase): + def test_prime_logarithms(self): + for p in (2, 3, 5, 7, 11, 13, 17, 19, 23, 37, 47, 73): + iv = arith.ln_int(p) + self.assertLess(float(iv.hi - iv.lo), 1e-90) + self.assertAlmostEqual(float(iv.lo), math.log(p), places=14) + self.assertAlmostEqual(float(arith.ln_int(44).lo), math.log(44), places=14) + + def test_reduction_reproduces_selected(self): + k, margin, binding = arith.kappa_from(Q('416181814685169713943/250000000000000000000000'), + Q('1733427039589844234749/1000000000000000000000000')) + self.assertEqual((str(k), binding), ('1661960547713947/1000000000000000000', 'complex')) + + def test_snapshot_provenance_shape(self): + snap = json.loads((HERE / 'SNAPSHOT.json').read_text()) + self.assertEqual(len(snap), 16) + for c in snap: + self.assertEqual(len(c['head']), 40) + for path, blob in c['sources'].values(): + self.assertEqual(len(blob), 40) + + +if __name__ == '__main__': + unittest.main() diff --git a/research/pending-claims-independent-pricing/verify.py b/research/pending-claims-independent-pricing/verify.py new file mode 100644 index 0000000000..c3e66437b3 --- /dev/null +++ b/research/pending-claims-independent-pricing/verify.py @@ -0,0 +1,74 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Offline replay of the pending-claims pricing table with negative controls. + +Usage: python3 -B research/pending-claims-independent-pricing/verify.py --work NEW_EMPTY_DIR +Expected last line: PASS_PENDING_CLAIMS_PRICING_REPLAY +""" +import argparse +import json +import subprocess +import sys +from fractions import Fraction as Q +from pathlib import Path + +import arith +import sweep + +HERE = Path(__file__).resolve().parent + + +def rejects(name, fn, reason): + try: + fn() + except ValueError as e: + if reason not in str(e): + raise SystemExit(f'FAIL {name}: rejected for another reason: {e}') + return name + raise SystemExit(f'FAIL {name} accepted') + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('--work', required=True) + work = Path(ap.parse_args().work).resolve() + arith.require(not work.exists(), 'work directory must not exist') + work.mkdir(parents=True) + p = subprocess.run([sys.executable, '-B', str(HERE / 'sweep.py'), str(work / 'RESULT.json')], cwd=HERE, + capture_output=True, text=True) + sys.stdout.write(p.stdout) + arith.require(p.returncode == 0, 'sweep failed:\n' + p.stderr) + got = json.loads((work / 'RESULT.json').read_text()) + arith.require(got == json.loads((HERE / 'RESULT.json').read_text()), 'RESULT.json differs from the committed table') + s = got['summary'] + arith.require(s['claims'] == s['endpoints_certified'] == s['kappa_matches_record'] == 16, 'summary') + snap = {c['pr']: c for c in json.loads((HERE / 'SNAPSHOT.json').read_text())} + top = snap[1061] + H = {int(r): n for r, n in top['profile'].items()} + b = Q(top['complex_lower']) + passed = [ + rejects('C1_extra_rank_one_child', lambda: arith.certify({**H, 1: H[1] + 1}, 73, top['live'], b), 'not below one'), + rejects('C2_one_replica_less_stock', lambda: arith.certify(H, 73, top['live'] - 896, b), 'not below one'), + rejects('C3_endpoint_plus_grid', lambda: arith.certify(H, 73, top['live'], b + Q(1, 10 ** 24)), 'not below one'), + ] + + def c4(): + k, margin, _ = arith.kappa_from(b, sweep.BIT) + arith.require(k + Q(1, 10 ** 18) < margin, 'next kappa grid point not admissible') + passed.append(rejects('C4_claimed_kappa_plus_grid', c4, 'next kappa grid point not admissible')) + + def c5(): + k, _, binding = arith.kappa_from(b, b - Q(1, 10 ** 6)) + arith.require(binding == 'complex' and str(k) == top['record_kappa'], 'kappa or binding changes with a weaker bit side') + passed.append(rejects('C5_weaker_bit_side', c5, 'kappa or binding changes')) + saved = arith.TAYLOR + arith.TAYLOR = 2 + try: + passed.append(rejects('C6_truncated_exponential', lambda: arith.certify(H, 73, top['live'], b), 'not below one')) + finally: + arith.TAYLOR = saved + print('controls rejected as expected:', ', '.join(passed)) + print('PASS_PENDING_CLAIMS_PRICING_REPLAY') + + +if __name__ == '__main__': + main()