diff --git a/research/h6-banked-invoice-audit/README.md b/research/h6-banked-invoice-audit/README.md new file mode 100644 index 0000000000..832806c31a --- /dev/null +++ b/research/h6-banked-invoice-audit/README.md @@ -0,0 +1,45 @@ +# H6 conditional banked-invoice audit + +For the fixed H6 model in PR1590, this audit certifies the largest integer helper allowance for five distinct target inputs at L = 3, 5, 7. It uses Dominik Scholz's unchanged PR606 banked invoice. The original twelve cases remain intact; the three full-title PR1424 cases are a separate appendix. + +| Exact target | L = 3 | L = 5 | L = 7 | +|---|---:|---:|---:| +| Quoted PR890: `0.001661957775` | 80,558 | 89,683 | 80,753 | +| Retained PR890: `0.001661957774647029` | 80,558 | 89,683 | 80,753 | +| Pinned selected: `0.001672660197076918` | 79,880 | 88,765 | 79,778 | +| Quoted PR1424: `0.001676855229071321` | 79,617 | 88,409 | 79,399 | +| Full PR1424 title: `0.001676855229071321886206381217337893` | 79,617 | 88,409 | 79,399 | + +The frozen inputs are `n=30960`, `h=17`, `hist={17:256,15:560}`, data path `[16]`, helper path `[1,7,8,1]`, `virtual=False`, and `bad=False`. Historical PR592 is the source's internal default, not one of these targets. The selected target is pinned historical provenance; PR1424 is a comparison input, not the selected result. + +At every reported R, exact outward bounds prove `lower(R) > target > upper(R+1)` and an open real pressure boundary between R and R+1. The written proofs use monotonicity of the true pressure root to exclude every larger count. They do not assume monotonicity of floating nomination or rounded program output. Synthetic controls distinguish the invoice's rounded endpoint criterion from the true-root criterion, and binary64 comparison from exact rational comparison; these distinctions do not change the reported boundaries. + +## Evidence and replay + +Read the unchanged [original model and proof](h6_banked_invoice_audit/MODEL_NOTE.md), its [source register](h6_banked_invoice_audit/SOURCES.md), and the [full-title appendix](h6_full_pr1424_appendix/APPENDIX.md). The new audit reconstruction is checked against the authenticated invoice. Source and rational modes share `model.py`; they are not independently authored or code-disjoint verifiers. The separate GPT-6 Pro review found no substantive mathematical flaw and requested execution hardening. The exact Pro-authored hardening and its 22 execution controls passed locally normally and optimized. This review is supported here by the recorded textual verdict and hardening excerpt; the full peer report and mathematical review checker were not recovered or locally replayed. No independent human or formal review is claimed. + +From the repository root: + +```sh +python3.12 scripts/research_package.py --package research/h6-banked-invoice-audit +``` + +The registered commands require `authenticated_run.py`, use only the standard library, run with `-I -O -B`, require no network, and read package-local files. The launcher authenticates the complete application source closure before execution and compiles the retained source bytes, including nested explicit-path imports; application bytecode caches are not used. They check all fifteen cases, four source guards, seventeen original certificate controls, ten appendix rejection controls and three positive-control groups. The four arithmetic commands have 30-second caps and took under one second locally. A fifth registered command runs 22 execution-hygiene controls with a 120-second process-group cap; local normal/optimized runs took 0.97/3.12 seconds. It first binds the active launcher and appendix bytes to the exact fixed-hash control fixtures. The control fixtures use a synthetic import closure and explicit doubles for the real appendix entrypoint; they do not add mathematical cases or certify invoice arithmetic. + +Local CPython 3.12.14 normal and optimized replays passed. Regenerated original evidence (58,405 bytes, SHA256 `37c44122652782b05e43b13383d19d41f9eadfaa5f2fab59ed330cc57c0b18f9`) and appendix evidence (16,238 bytes, SHA256 `a64701a8d2187604b74f939bbba00b3ea9afc0d3b84a22136c4027f2d2180325`) match the canonical receipts exactly. [REPLAY.json](REPLAY.json) preserves those historical receipts and adds twelve local hardening runs: the four registered modes normally and optimized, plus both evidence regenerations in both modes. All passed in under one second per command and reproduced both canonical evidence hashes. + +For authenticated regeneration from this package directory, use `python3.12 -I -B authenticated_run.py audit --output PATH` or `python3.12 -I -B authenticated_run.py appendix --source --output PATH`, with an unused output path. Both refuse to overwrite existing files. The patched appendix finishes all requested checks and final source reauthentication before writing. Output writes are not atomic: an I/O error can leave a partial file, and a later controls-output failure can leave the evidence file. File existence alone is not a success receipt; require exit zero and exact evidence comparison. The appendix's `--source` mode adds actual invoice/threshold and native float comparisons. The author's `price_h6.py` is hash-checked and parsed only by registered replay; its separate local producer replay reproduced the author's saved output in both modes, but is not a substitute for these explicit-guard checks. + +## Scope and attribution + +The final bounded overlap check at 06:57:59 UTC read four relevant Discussions with complete comment/reply pages and the latest 100 open PRs, supplemented by the earlier complete cache; it is not an all-history novelty claim. PR1590 and PR1424 heads were unchanged. The [PR1424 review comment](https://github.com/CrocSwap/integer-mult-bounds/pull/1424#issuecomment-6162623622) leaves parent regenerated-container binding and controller/invoice/geometry obligations outstanding. Its full title remains only a comparison target here. + +These are conditional arithmetic allowances. Encoder extras, compensation chronology and arbitrary-dirt restoration, frame-zero precompensation, target cap-15/FULL restrictions, spectators beyond the model, inter-stage sharing, and physical helper loading remain unpriced or unproved. Neither `30960/R` nor the author's `1.538281` ratio establishes helper capacity. The latter is the ratio of printed zero-helper paper values `0.006945535353 / 0.004515128332`. No complete paid profile, 5% gate, supplier admission, new kappa or selected-record change follows. + +Credit [PR606](https://github.com/CrocSwap/integer-mult-bounds/pull/606)/Dominik Scholz and the retained Niemeier/Leech notices for the model and inherited interval engine; [PR1590](https://github.com/CrocSwap/integer-mult-bounds/pull/1590)/DreamingOfClouds, with Claude Opus 5.5 via Claude Code, for the H6 interpretation and [published pricing script](https://github.com/DreamingOfClouds/integer-mult-bounds/blob/b496aed769dd724cd1ff6b921cade626562be27b/research/h6-banked-breakeven/price_h6.py). New arithmetic research and checker authorship are by Andrey Mas with GPT-6 Pro through ChatGPT. Codex performed source coordination, execution audit, mechanical replay and packaging, without mathematical derivation or proof repair. Coordination: [Discussion1635](https://github.com/CrocSwap/integer-mult-bounds/discussions/1635). + +The proof notes, arithmetic, vendor source and scientific evidence retain their authenticated producer bytes. The appendix has only the supplied output-order hardening, and the new launcher is the exact authenticated Pro source. The original direct entrypoints remain available as historical source; running them directly does not provide the launcher's bytecode-cache guarantee. The guarantee assumes a trusted interpreter/standard library, stable package layout and a fresh single-threaded isolated process. The authenticated launcher's embedded model label is retained as producer text; the observed research/review model is recorded here as GPT-6 Pro. Their source-acquisition limitations, Python 3.13.5 statements, host-log references and archive inventories describe the original Pro execution. Omitted duplicate views and host logs are not required by replay. The package adds a separate local Python 3.12 receipt and exact upstream [license](h6_banked_invoice_audit/LICENSE) and [notices](h6_banked_invoice_audit/notices/). [SOURCES.json](SOURCES.json) records the notice blank-line normalization difference and historical source pins. No structure/Walsh program or geometry census was run. + +## Open next questions + +Can a concrete compensation and helper-loading chronology realize a complete paid physical invoice within one of these allowances? First specify all physical roles, paths, pending factors, restoration, encoder and spectator charges, then screen the whole invoice. The missing construction and interfaces, rather than the arithmetic threshold, block that conclusion. [TASK.json](TASK.json) records the current revision-3 audit card, the session's scope change and this precise handoff. diff --git a/research/h6-banked-invoice-audit/REPLAY.json b/research/h6-banked-invoice-audit/REPLAY.json new file mode 100644 index 0000000000..60dcb3af27 --- /dev/null +++ b/research/h6-banked-invoice-audit/REPLAY.json @@ -0,0 +1,617 @@ +{ + "runtime": "CPython 3.12.14", + "scope": "Local coordinator replay of authenticated unchanged source. This receipt is separate from the original notes' remote Python 3.13.5 observations.", + "original": { + "runs": [ + { + "label": "source-normal-regenerate", + "exit_code": 0, + "seconds": 0.481923, + "stdout_sha256": "444e2932dbef562d5ec72592a241834e97ec649b2b3b11f2d52635680db4bada", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_bytes": 985, + "stderr_bytes": 0 + }, + { + "label": "source-optimized-default", + "exit_code": 0, + "seconds": 0.54236, + "stdout_sha256": "4f1cf2f009df95f22e2d928161185c7d12b169330e686309f0eaed0366a0177c", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_bytes": 1010, + "stderr_bytes": 0 + }, + { + "label": "rational-normal", + "exit_code": 0, + "seconds": 0.274659, + "stdout_sha256": "481ae9eacb3c827dfaf5d57713f2af9881c89123d0aab2e17234a276aa2dc013", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_bytes": 1529, + "stderr_bytes": 0 + }, + { + "label": "rational-optimized", + "exit_code": 0, + "seconds": 0.350712, + "stdout_sha256": "481ae9eacb3c827dfaf5d57713f2af9881c89123d0aab2e17234a276aa2dc013", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_bytes": 1529, + "stderr_bytes": 0 + } + ], + "evidence_bytes": 58405, + "evidence_sha256": "37c44122652782b05e43b13383d19d41f9eadfaa5f2fab59ed330cc57c0b18f9", + "controls": "Four source guards; sixteen rejection controls and one positive semantics control. Normal/-O control receipts match the canonical hash 7dffa0607a68d07cca3e0fd3852056a75cb13ba65f626fb64e34d06b90dc243b." + }, + "appendix": { + "runs": [ + { + "label": "rational-regenerate", + "exit_code": 0, + "seconds": 0.169205, + "stdout_bytes": 454, + "stderr_bytes": 0, + "stdout_sha256": "b6ef6828ba7c57e88a0baabb68a7fad93bec980eed36b9a26875c79df81a151c", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "rational-normal", + "exit_code": 0, + "seconds": 0.121324, + "stdout_bytes": 454, + "stderr_bytes": 0, + "stdout_sha256": "b6ef6828ba7c57e88a0baabb68a7fad93bec980eed36b9a26875c79df81a151c", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "source-normal", + "exit_code": 0, + "seconds": 0.181549, + "stdout_bytes": 461, + "stderr_bytes": 0, + "stdout_sha256": "0bfc261a687d533becc93d191cc50ec3c871e8a8cc06271e5610e6ff0dcf1fda", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "rational-optimized", + "exit_code": 0, + "seconds": 0.223029, + "stdout_bytes": 454, + "stderr_bytes": 0, + "stdout_sha256": "b6ef6828ba7c57e88a0baabb68a7fad93bec980eed36b9a26875c79df81a151c", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "label": "source-optimized", + "exit_code": 0, + "seconds": 0.270835, + "stdout_bytes": 461, + "stderr_bytes": 0, + "stdout_sha256": "0bfc261a687d533becc93d191cc50ec3c871e8a8cc06271e5610e6ff0dcf1fda", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "evidence_bytes": 16238, + "evidence_sha256": "a64701a8d2187604b74f939bbba00b3ea9afc0d3b84a22136c4027f2d2180325", + "controls": "Ten rejection controls and three positive-control groups. All five emitted control receipts match canonical SHA256 bdea93387d16c3c7aacc554ccc293947dd77ea4878a20f10dd304a4b0ba53de5." + }, + "immutability": { + "received_source_unchanged": true, + "isolated_copy_unchanged": true, + "execution_cwd_files_created": [] + }, + "author_producer_replay": { + "runtime": "CPython 3.12.14", + "normal_seconds": 0.873577, + "optimized_seconds": 0.891861, + "exit_codes": [ + 0, + 0 + ], + "stderr_bytes": [ + 0, + 0 + ], + "stdout_sha256": "d4f360504140738815dffccc9ff5d46e3e5783fc63289786e69b31b4befe50a3", + "scope": "Separate unchanged price_h6.py producer replay; all 18 printed boundary rows exactly reproduce the published transcript. Exit zero alone is not fail-closed evidence: its assert disappears under -O and failure labels are printed. The new registered checkers use explicit guards. Structure/Walsh were not executed." + }, + "limits": [ + "Source and rational modes share model.py; not independently authored or code-disjoint verifiers.", + "No independent human review, formal verification, geometry replay or physical compensation/helper-loading construction.", + "Producer host logs, mutated-target subprocess tests and overwrite-refusal tests mentioned in the unchanged proof notes are not relabeled as local observations.", + "Separate Pro mathematical review completed with no substantive flaw reported; 22 local hardening controls passed normally and optimized; full peer report and mathematical review checker were not recovered or locally replayed." + ], + "registered_layout_replay": { + "metadata_with_exact_git_provenance": "passed outside the checkout using the unchanged repository validator", + "runs": [ + { + "command": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_banked_invoice_audit/audit.py" + ], + "seconds": 0.544612, + "exit_code": 0, + "stdout_sha256": "4f1cf2f009df95f22e2d928161185c7d12b169330e686309f0eaed0366a0177c", + "stderr_bytes": 0 + }, + { + "command": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_banked_invoice_audit/verify_certificate.py" + ], + "seconds": 0.355802, + "exit_code": 0, + "stdout_sha256": "481ae9eacb3c827dfaf5d57713f2af9881c89123d0aab2e17234a276aa2dc013", + "stderr_bytes": 0 + }, + { + "command": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_full_pr1424_appendix/appendix.py" + ], + "seconds": 0.216136, + "exit_code": 0, + "stdout_sha256": "b6ef6828ba7c57e88a0baabb68a7fad93bec980eed36b9a26875c79df81a151c", + "stderr_bytes": 0 + }, + { + "command": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_full_pr1424_appendix/appendix.py", + "--source" + ], + "seconds": 0.276726, + "exit_code": 0, + "stdout_sha256": "0bfc261a687d533becc93d191cc50ec3c871e8a8cc06271e5610e6ff0dcf1fda", + "stderr_bytes": 0 + } + ], + "package_bytes_unchanged": true + }, + "authenticated_hardening_replay": { + "observed_at_utc": "2026-10-14T06:58:19.694830+00:00", + "runtime": "3.12.14 (main, Aug 25 2026, 13:50:33) [Clang 22.1.3 ]", + "platform": "macOS-26.5.1-arm64-arm-64bit", + "source_changes": [ + "New authenticated_run.py compiles pinned source bytes, bypassing application bytecode caches.", + "Exact appendix output-order patch moves all checks and final source guards before output creation." + ], + "runs": [ + { + "label": "normal-original-source", + "exit_code": 0, + "seconds": 0.450145, + "stdout_bytes": 1010, + "stdout_sha256": "4f1cf2f009df95f22e2d928161185c7d12b169330e686309f0eaed0366a0177c", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-B", + "{package}/authenticated_run.py", + "audit" + ] + }, + { + "label": "normal-original-rational", + "exit_code": 0, + "seconds": 0.280114, + "stdout_bytes": 1529, + "stdout_sha256": "481ae9eacb3c827dfaf5d57713f2af9881c89123d0aab2e17234a276aa2dc013", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-B", + "{package}/authenticated_run.py", + "verify" + ] + }, + { + "label": "normal-appendix-rational", + "exit_code": 0, + "seconds": 0.126463, + "stdout_bytes": 454, + "stdout_sha256": "b6ef6828ba7c57e88a0baabb68a7fad93bec980eed36b9a26875c79df81a151c", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-B", + "{package}/authenticated_run.py", + "appendix" + ] + }, + { + "label": "normal-appendix-source", + "exit_code": 0, + "seconds": 0.185033, + "stdout_bytes": 461, + "stdout_sha256": "0bfc261a687d533becc93d191cc50ec3c871e8a8cc06271e5610e6ff0dcf1fda", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-B", + "{package}/authenticated_run.py", + "appendix", + "--source" + ] + }, + { + "label": "normal-regenerate-original", + "exit_code": 0, + "seconds": 0.451333, + "stdout_bytes": 985, + "stdout_sha256": "444e2932dbef562d5ec72592a241834e97ec649b2b3b11f2d52635680db4bada", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-B", + "{package}/authenticated_run.py", + "audit", + "--output", + "{unused-output-directory}/normal-original.json" + ] + }, + { + "label": "normal-regenerate-appendix", + "exit_code": 0, + "seconds": 0.193428, + "stdout_bytes": 461, + "stdout_sha256": "0bfc261a687d533becc93d191cc50ec3c871e8a8cc06271e5610e6ff0dcf1fda", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-B", + "{package}/authenticated_run.py", + "appendix", + "--source", + "--output", + "{unused-output-directory}/normal-appendix.json", + "--controls-output", + "{unused-output-directory}/normal-appendix-controls.json" + ] + }, + { + "label": "optimized-original-source", + "exit_code": 0, + "seconds": 0.549755, + "stdout_bytes": 1010, + "stdout_sha256": "4f1cf2f009df95f22e2d928161185c7d12b169330e686309f0eaed0366a0177c", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "audit" + ] + }, + { + "label": "optimized-original-rational", + "exit_code": 0, + "seconds": 0.345974, + "stdout_bytes": 1529, + "stdout_sha256": "481ae9eacb3c827dfaf5d57713f2af9881c89123d0aab2e17234a276aa2dc013", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "verify" + ] + }, + { + "label": "optimized-appendix-rational", + "exit_code": 0, + "seconds": 0.205435, + "stdout_bytes": 454, + "stdout_sha256": "b6ef6828ba7c57e88a0baabb68a7fad93bec980eed36b9a26875c79df81a151c", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "appendix" + ] + }, + { + "label": "optimized-appendix-source", + "exit_code": 0, + "seconds": 0.268149, + "stdout_bytes": 461, + "stdout_sha256": "0bfc261a687d533becc93d191cc50ec3c871e8a8cc06271e5610e6ff0dcf1fda", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "appendix", + "--source" + ] + }, + { + "label": "optimized-regenerate-original", + "exit_code": 0, + "seconds": 0.531413, + "stdout_bytes": 985, + "stdout_sha256": "444e2932dbef562d5ec72592a241834e97ec649b2b3b11f2d52635680db4bada", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "audit", + "--output", + "{unused-output-directory}/optimized-original.json" + ] + }, + { + "label": "optimized-regenerate-appendix", + "exit_code": 0, + "seconds": 0.278483, + "stdout_bytes": 461, + "stdout_sha256": "0bfc261a687d533becc93d191cc50ec3c871e8a8cc06271e5610e6ff0dcf1fda", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "argv": [ + "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "appendix", + "--source", + "--output", + "{unused-output-directory}/optimized-appendix.json", + "--controls-output", + "{unused-output-directory}/optimized-appendix-controls.json" + ] + } + ], + "regenerated_evidence": [ + { + "file": "normal-original.json", + "bytes": 58405, + "sha256": "37c44122652782b05e43b13383d19d41f9eadfaa5f2fab59ed330cc57c0b18f9", + "equals_canonical": true + }, + { + "file": "normal-appendix.json", + "bytes": 16238, + "sha256": "a64701a8d2187604b74f939bbba00b3ea9afc0d3b84a22136c4027f2d2180325", + "equals_canonical": true + }, + { + "file": "optimized-original.json", + "bytes": 58405, + "sha256": "37c44122652782b05e43b13383d19d41f9eadfaa5f2fab59ed330cc57c0b18f9", + "equals_canonical": true + }, + { + "file": "optimized-appendix.json", + "bytes": 16238, + "sha256": "a64701a8d2187604b74f939bbba00b3ea9afc0d3b84a22136c4027f2d2180325", + "equals_canonical": true + } + ], + "source_bytes_unchanged_during_replay": true, + "original_draft_unchanged": true, + "reviewer_controls": "All 22 exact source-authenticated execution-hygiene controls passed under normal and optimized CPython 3.12.14.", + "limits": [ + "Source and rational arithmetic modes share model.py.", + "Trusted interpreter/stdlib, stable layout, fresh single-threaded isolated process required.", + "Original direct entrypoints do not bypass bytecode caches.", + "Output creation is exclusive but not atomic; file existence is not a successful receipt.", + "No physical construction, new mathematical derivation or proof repair." + ] + }, + "registered_commands_before_hardening": [ + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_banked_invoice_audit/audit.py" + ], + "timeout_seconds": 30, + "checks": "Authenticate four dependencies, reconstruct all twelve original cases, compare source thresholds and 24 endpoint invoices, compare canonical evidence, and run four source guards." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_banked_invoice_audit/verify_certificate.py" + ], + "timeout_seconds": 30, + "checks": "Rational-only original evidence replay: exact grid cells, endpoint and pressure separation, rank-mass/caps and seventeen supplied controls. Shares model.py with the source checker." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_full_pr1424_appendix/appendix.py" + ], + "timeout_seconds": 30, + "checks": "Three full-title PR1424 cases, exact binary64 witness arithmetic, canonical evidence, ten rejection controls and three positive-control groups; no source invoice execution." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/h6_full_pr1424_appendix/appendix.py", + "--source" + ], + "timeout_seconds": 30, + "checks": "Recheck the three appendix thresholds and six invoices against authenticated source, plus native float comparison witnesses and the supplied controls. Shares the original model." + } + ], + "registered_commands": [ + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "audit" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Authenticate four dependencies, reconstruct all twelve original cases, compare source thresholds and 24 endpoint invoices, compare canonical evidence, and run four source guards." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "verify" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Rational-only original evidence replay: exact grid cells, endpoint and pressure separation, rank-mass/caps and seventeen supplied controls. Shares model.py with the source checker." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "appendix" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Three full-title PR1424 cases, exact binary64 witness arithmetic, canonical evidence, ten rejection controls and three positive-control groups; no source invoice execution." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "appendix", + "--source" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Recheck the three appendix thresholds and six invoices against authenticated source, plus native float comparison witnesses and the supplied controls. Shares the original model." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "-c", + "import pathlib,runpy,sys; p=pathlib.Path(sys.argv[1]); h=p/'hardening_controls'; pairs=[('authenticated_run.py','patch_tree/authenticated_run.py'),('h6_full_pr1424_appendix/appendix.py','patch_tree/h6_full_pr1424_appendix/appendix.py')]; mismatches=[a for a,b in pairs if (p/a).read_bytes()!=(h/b).read_bytes()];\nif mismatches: raise SystemExit('Active package differs from fixed-hash control fixtures: '+','.join(mismatches))\nsys.argv=[str(h/'hardening_checks.py'),*sys.argv[2:]]; runpy.run_path(sys.argv[0],run_name='__main__')", + "{package}" + ], + "timeout_seconds": 120, + "checks": "Bind active appendix/launcher bytes to the exact fixed-hash control fixtures, then run the unchanged 22 execution-hygiene controls: synthetic stale-cache closure, source/hash/override guards, process restoration, deferred-output failure and success fixtures, and overwrite refusal. No mathematical proof or extra invoice cases." + } + ], + "hardening_control_replay": { + "observed_at_utc": "2026-10-14T07:13:50.079211+00:00", + "runtime": "3.12.14 (main, Aug 25 2026, 13:50:33) [Clang 22.1.3 ]", + "executable": "/Users/andrejmas/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "platform": "macOS-26.5.1-arm64-arm-64bit", + "checker_bytes": 15672, + "checker_sha256": "c5987d043c7c4e11cf067074f25826d4c3a1107b054740f237b14fb7653d12c7", + "source_bytes_unchanged": true, + "active_to_fixture_binding": true, + "scope": "Exact Pro hardening checker: synthetic seven-file loader closures and test-double-driven real old/new appendix.main; no H6 mathematical proof or independent invoice reconstruction.", + "review_boundary": "No full independent mathematical review checker or full peer review text was recovered by this task.", + "runs": [ + { + "label": "normal", + "exit_code": 0, + "seconds": 0.97138, + "timed_out": false, + "watchdog_seconds": 120, + "watchdog_scope": "Whole checker process group including its inherited-session subprocesses", + "stdout_bytes": 1550, + "stdout_sha256": "3a9b07281d74b09087b94e4a0e3a8a3895d4713ae16d2efa013757a63a746547", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "passed_controls": 22, + "receipt_sha256": "0f86b4b0fe5089a83c5b7120a595608a10d137e24cb0b7df0983ff512cde708d" + }, + { + "label": "optimized", + "exit_code": 0, + "seconds": 3.123697, + "timed_out": false, + "watchdog_seconds": 120, + "watchdog_scope": "Whole checker process group including its inherited-session subprocesses", + "stdout_bytes": 1550, + "stdout_sha256": "3a9b07281d74b09087b94e4a0e3a8a3895d4713ae16d2efa013757a63a746547", + "stderr_bytes": 0, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "passed_controls": 22, + "receipt_sha256": "7b038193eb5b5a36e82207919f6f57854adf9dcfd9511ac78a27581290f0177b" + } + ] + }, + "final_registered_replay": { + "observed_at_utc": "2026-10-14T07:18:00Z", + "time_precision": "minute", + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "python": "3.12.14", + "command": [ + "python3.12", + "-I", + "-B", + "scripts/research_package.py", + "--package", + "research/h6-banked-invoice-audit" + ], + "exit_code": 0, + "wall_seconds": 4.804796875, + "registered_commands": 5, + "result": "PASS_REGISTERED_RESEARCH_PACKAGE research/h6-banked-invoice-audit outcome=completed", + "scope": "Local repository execution; no hosted CI or mathematical theorem acceptance inferred." + } +} diff --git a/research/h6-banked-invoice-audit/SOURCES.json b/research/h6-banked-invoice-audit/SOURCES.json new file mode 100644 index 0000000000..1db714494a --- /dev/null +++ b/research/h6-banked-invoice-audit/SOURCES.json @@ -0,0 +1,280 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "files": [ + { + "path": "AGENTS.md", + "usage": "provenance", + "git_blob": "860762e04e963e1b163b8fa5267854c0040a9e67", + "sha256": "5f29c7cbf0eb28f4e87f0affa9cffdaef4e39a630a5878c8fed02b544c894d2e" + }, + { + "path": "autoresearch.md", + "usage": "provenance", + "git_blob": "8d5403e0f10f68a61d0cb9294fa2e83e872d1d82", + "sha256": "215b3222f6a943edc69422a28ac21ea1f397ddf54770f1d87ac4195385d73699" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "docs/research/research-package-guide.md", + "usage": "provenance", + "git_blob": "8dc1a921179dcc7a9ecc2dc961ccd77b5ed60c02", + "sha256": "ff1b2842a962df1243e226d3f23a2d70600339e3f601dbb988de618b09853709" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "LICENSE", + "usage": "provenance", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "research/leech-lattice/NOTICE", + "usage": "provenance", + "git_blob": "2246e973b586529652817ce09598254c51595899", + "sha256": "2872d615b4eeaa1278d92a284dc1a9d4e3c3ba62bfa081a162309de9a097fc6f" + }, + { + "path": "research/niemeier-lattices/NOTICE", + "usage": "provenance", + "git_blob": "e6dcbd0c683ca877031fdaefd5803f6e4cf5ac78", + "sha256": "a5085b5f46ef649f493cb7447ab3cb4885873e30fa72196e3286e95ed13c9562" + }, + { + "path": "research/niemeier-lattices/COSTS.txt", + "usage": "provenance", + "git_blob": "576e4e0e11d446c57776ac0dc22da5147f21fa78", + "sha256": "8feebf99fdfcdbdffc6217ce3f24e9a459b0275eaff72769a68e05342ad56ca4" + }, + { + "path": "research/niemeier-lattices/workbench/paid-controller/PAID-CONTROLLER.txt", + "usage": "provenance", + "git_blob": "297ee6a781c1139931f64965b6b1b8b04ff92489", + "sha256": "bbf3cd9327fbd4de5e4215a3d3c18da41b7fe3ba5ec04f05cbcc1565540972c9" + }, + { + "path": "research/leech-lattice/code/screen.py", + "usage": "provenance", + "git_blob": "10cf894ee7383f918d69e52869ccce99919e3d49", + "sha256": "6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385" + }, + { + "path": "research/niemeier-lattices/code/costs.py", + "usage": "provenance", + "git_blob": "e6ed87c2e80aa7a79b75ff90fc2677998ee5daf7", + "sha256": "885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8" + }, + { + "path": "research/niemeier-lattices/workbench/paid-controller/banked.py", + "usage": "provenance", + "git_blob": "6357b37fbaf3605bf9a26485e740bd5fa817cebb", + "sha256": "8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079" + }, + { + "path": "research/niemeier-lattices/workbench/paid-controller/portable.py", + "usage": "provenance", + "git_blob": "416f392ed5d203fa9dcfac617eb0a07258f00128", + "sha256": "95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8" + }, + { + "path": "certificates/checkpoints/frontier890.json", + "usage": "provenance", + "git_blob": "5dbfac5424703adbb97f38edbdcaea4627215132", + "sha256": "41fb066ff0f43ce472323195e9088d6d888715c13c54eae7b42e357ed5bfc726" + } + ], + "initial_science_pin": "81e81af67714bdc8d1693b0bf5c29468b92f62ff", + "dependency_policy": "Only four authenticated, unchanged invoice import files are vendored. Replay reads package-local files only; upstream pins are historical provenance, not mutable live inputs.", + "predecessors": [ + { + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/606", + "head": "048f884ea9c222faad43e8bb01e2a6863f6925d4", + "credit": "Dominik Scholz and retained Niemeier/Leech NOTICE lineage; inherited PR598 interval engine." + }, + { + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1590", + "head": "08e134b4a0c7f04869dae703f2a2e688e53c44f0", + "credit": "DreamingOfClouds with Claude Opus 5.5 via Claude Code; H6 interpretation and original thresholds." + }, + { + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1424", + "head": "bfe423c24555baf35dab991a8d6fe723a038945c", + "usage": "An open-PR comparison input, not the pinned selected record." + } + ], + "author_source": { + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "b496aed769dd724cd1ff6b921cade626562be27b", + "path": "research/h6-banked-breakeven/price_h6.py", + "git_blob": "0e2a352bc3bb9aeea2605b19f75b2aa52f5f6d6d", + "sha256": "ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a", + "comment": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18914905", + "local_path": "h6_full_pr1424_appendix/author_source/price_h6.py" + }, + "authorship": "New bounded arithmetic audit and proof: Andrey Mas with GPT-6 Pro research through ChatGPT. Codex source coordination, execution audit, mechanical replay and packaging; no local mathematical derivation or proof repair.", + "packaging_differences": { + "proof_and_python": "Proof, arithmetic model, original entrypoints and vendor files remain exact authenticated producer bytes. The appendix has only the exact Pro output-order patch; authenticated_run.py is the exact new Pro source. Scientific evidence remains byte-identical.", + "notices": "Package uses exact upstream notices at base_commit. Producer text transfers omitted three blank lines in LEECH-NOTICE and nine in NIEMEIER-NOTICE; all nonblank lines agree. Canonical producer notice hashes are not claimed for these upstream copies.", + "license": "Exact upstream LICENSE at base_commit, 11357 bytes. Producer inventory declared a different 11358-byte text; that unreceived file is not represented as byte-identical.", + "omitted_producer_artifacts": "Transport ZIPs, RUN_LOG.txt, inventories, duplicate README/CORE_VERDICT, CSV views and remote execution records remain outside this minimal package. Their mentions in unchanged proof notes describe the historical producer bundle; local execution is documented in ../REPLAY.json.", + "hardening_controls": "Unchanged authenticated checker with its three required original/patched/launcher fixture files; duplicate source serves the before/after and cached-bytecode controls. VERIFY adds source-binding orchestration only, no new mathematical test. Full mathematical peer report/checker were not recovered or locally replayed." + }, + "delivered_files": [ + { + "path": "h6_banked_invoice_audit/audit.py", + "bytes": 6639, + "sha256": "458c7f01a5151ddc7e532d165992d8177f7be6644cf9309ef25cfadf01c251c0", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/verify_certificate.py", + "bytes": 8321, + "sha256": "8bc83e304ce2f259295bc81f1ab9dc681def9d7e54fb09fc2915386fd2b31f58", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/model.py", + "bytes": 7547, + "sha256": "d18c4c589e37de077d29120d7b4688ad6a335cd63d225f93621a2573cd23cd80", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/source_bindings.py", + "bytes": 2845, + "sha256": "f247b8a5ef341737318af2d926808b92d26d90ff6db9abf2f714ba132ff6f335", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/MODEL_NOTE.md", + "bytes": 18222, + "sha256": "9335d39d6951952a312a9b1b8041a59be62735a7cb178b8dd086fcbed1574feb", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/NOTICE.md", + "bytes": 2019, + "sha256": "18b74611d789246cd1559b89d2834d81331d62eabdd9bcb630e1b97d7121376c", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/vendor/research/leech-lattice/code/screen.py", + "bytes": 12756, + "sha256": "6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/vendor/research/niemeier-lattices/code/costs.py", + "bytes": 16210, + "sha256": "885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/vendor/research/niemeier-lattices/workbench/paid-controller/banked.py", + "bytes": 4796, + "sha256": "8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/vendor/research/niemeier-lattices/workbench/paid-controller/portable.py", + "bytes": 2800, + "sha256": "95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_full_pr1424_appendix/appendix.py", + "bytes": 13608, + "sha256": "69b1981b049df19655c497387741ab04c93a40d82b48135b157b4d472f3ae345", + "authentication": "Exact authenticated Pro hardening patch applied to canonical original; no arithmetic changes.", + "previous_producer_bytes": 13519, + "previous_producer_sha256": "cc43d4c89e32497caff1a8cd6f0ddd54c5fc1619c00d2e70ffe08ec52d473640" + }, + { + "path": "h6_full_pr1424_appendix/APPENDIX.md", + "bytes": 14778, + "sha256": "c12068c20bd9bf0af953ee75bc096c2f538654c3d8bff2961dfa3ae6b1c28aa0", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_full_pr1424_appendix/SOURCE_UPDATE.json", + "bytes": 2391, + "sha256": "0a532f2e5522fcfe4e2c7aa436dcb92dbb03a95d7b4679fdd749c689629351d6", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_full_pr1424_appendix/author_source/price_h6.py", + "bytes": 4211, + "sha256": "ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/EVIDENCE.json", + "bytes": 58405, + "sha256": "37c44122652782b05e43b13383d19d41f9eadfaa5f2fab59ed330cc57c0b18f9", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_full_pr1424_appendix/APPENDIX_EVIDENCE.json", + "bytes": 16238, + "sha256": "a64701a8d2187604b74f939bbba00b3ea9afc0d3b84a22136c4027f2d2180325", + "authentication": "canonical producer inventory" + }, + { + "path": "h6_banked_invoice_audit/SOURCES.md", + "bytes": 6631, + "sha256": "f44d8d997200e92c480f49a1f196f01b043c277b8ab34c7e79df9ef282b6196e", + "authentication": "canonical producer inventory" + }, + { + "path": "authenticated_run.py", + "bytes": 5528, + "sha256": "704ee91443ea892c1fd296fafb5fe0b1a66e881f311620e2dcc0db1154e84449", + "authentication": "Exact authenticated Pro hardening source; embedded producer label retained, observed model GPT-6 Pro." + }, + { + "path": "hardening_controls/hardening_checks.py", + "bytes": 15672, + "sha256": "c5987d043c7c4e11cf067074f25826d4c3a1107b054740f237b14fb7653d12c7", + "authentication": "Exact authenticated Pro hardening checker or required original/patched fixture. Registered command binds active new source to fixture bytes before these fixed-hash checks." + }, + { + "path": "hardening_controls/original/h6_full_pr1424_appendix/appendix.py", + "bytes": 13519, + "sha256": "cc43d4c89e32497caff1a8cd6f0ddd54c5fc1619c00d2e70ffe08ec52d473640", + "authentication": "Exact authenticated Pro hardening checker or required original/patched fixture. Registered command binds active new source to fixture bytes before these fixed-hash checks." + }, + { + "path": "hardening_controls/patch_tree/authenticated_run.py", + "bytes": 5528, + "sha256": "704ee91443ea892c1fd296fafb5fe0b1a66e881f311620e2dcc0db1154e84449", + "authentication": "Exact authenticated Pro hardening checker or required original/patched fixture. Registered command binds active new source to fixture bytes before these fixed-hash checks." + }, + { + "path": "hardening_controls/patch_tree/h6_full_pr1424_appendix/appendix.py", + "bytes": 13608, + "sha256": "69b1981b049df19655c497387741ab04c93a40d82b48135b157b4d472f3ae345", + "authentication": "Exact authenticated Pro hardening checker or required original/patched fixture. Registered command binds active new source to fixture bytes before these fixed-hash checks." + } + ], + "historical_package_provenance": { + "base_commit": "0a201997097b8a89b638f3a2afcb35db4184c8b2", + "changed_provenance_files": [ + { + "path": "docs/research/research-package-guide.md", + "usage": "provenance", + "git_blob": "f8c3b3340b8bcb8d8ca655f5d7ca2fa55f409fd2", + "sha256": "fcd22035031f59fb9892e013f5d71f636aba61f687fe38b0a9725a29caa34b85" + } + ], + "note": "Current integration-base guidance pins; initial scientific pin and unchanged source_bindings.py still retain81e81af provenance." + } +} diff --git a/research/h6-banked-invoice-audit/TASK.json b/research/h6-banked-invoice-audit/TASK.json new file mode 100644 index 0000000000..810151b842 --- /dev/null +++ b/research/h6-banked-invoice-audit/TASK.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "task_id": "independent-moment", + "priority_revision": 3, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "original_card": { + "id": "independent-moment", + "question": "Can one selected pricing or assembly claim be checked by a genuinely independent exact implementation?", + "starting_points": [ + "certificates/selected-result.json" + ], + "methods": [ + "Reconstruct the rank ledger from original operations rather than trusting its aggregate.", + "Implement certified moment inequalities through a different exact enclosure method." + ], + "acceptance_gate": "Demonstrate independence, source binding, positive cases and semantic failure controls.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Record the selected certificate and complex_profile rather than taking a PR headline as input.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Recompute one small part of the ledger or one certified enclosure using an independent implementation.", + "bottleneck_link": "Independent pricing prevents unsupported frontier claims and can reveal genuine accounting slack.", + "allowed_variations": [ + "Reconstruct either a source ledger or a numeric enclosure with a different method." + ], + "scope_change_triggers": [ + "Importing the primary function and calling its output independent verification." + ], + "overlap_terms": [ + "independent moment", + "rank histogram", + "exact enclosure" + ] + }, + "scope_status": "changed", + "actual_scope": "Audit fifteen exact H6 conditional banked-invoice target/stage cases: twelve original cases plus three separate full-title PR1424 cases, all at L=3,5,7. Authenticate the frozen import closure, certify strict adjacent endpoint separation and distinguish exact-pressure, rounded-invoice and binary64 predicates. Required source-only authenticated launch and appendix output-order hardening preserve the same fifteen-case arithmetic scope.", + "scope_change_reason": "The session moved from the retired revision-2 complex-masked-decoder card to the revision-3 independent-moment audit priority. This is a bounded audit of one changed-model conditional invoice, not a revived decoder search or a new paid construction. The current card is refined to this exact scope.", + "bottleneck_link": "Gives exact conditional helper allowances and explicit unpaid obligations, so construction work can screen its complete paid invoice against the selected comparison instead of relying on rounded historical thresholds.", + "budget_minutes": 90, + "stop_rule": "Stop after the twelve original cases and three separately authorized full-title cases have exact evidence or a reproducible mismatch. No extra stages, geometry census, structure/Walsh execution or physical construction search.", + "outcome": "completed", + "evidence": "Original checkers and the output-order-only patched appendix replayed locally on CPython 3.12.14 normally and under -O. Original evidence (58405 bytes) and appendix evidence (16238 bytes) regenerate byte-identically to canonical hashes. Four source guards, seventeen original certificate controls, ten appendix rejection controls and three positive-control groups pass. Two original entrypoints and both appendix modes share model.py. Written maximality arguments are not formal proofs; separate GPT-6 Pro review found no substantive mathematical flaw and requested execution hardening. The supplied launcher and patch passed twelve local runs; the unchanged 22 hardening controls also passed normally and optimized, after binding their fixtures to the active package. These controls concern execution hygiene, not additional mathematical cases. The full peer report and mathematical review checker were not recovered or locally replayed.", + "author": "Andrey Mas", + "ai_assistance": "New bounded arithmetic audit and proof: Andrey Mas with GPT-6 Pro research through ChatGPT. Codex source coordination, execution audit, mechanical replay and packaging; no local mathematical derivation or proof repair.", + "open_questions": [ + { + "question": "Can a concrete compensation/helper-loading chronology realize a complete paid physical invoice within a certified conditional allowance?", + "why_it_matters": "The arithmetic allowance does not prove restored-helper capacity or a construction.", + "first_step": "Specify exact physical roles, paths, pending factors and all omitted restoration/encoder/spectator charges.", + "blocked_by": "No published complete helper-loading/chronology construction is supplied by this audit." + } + ], + "scope_key": "H6/frozen-banked-invoice/five-distinct-targets/L3-L5-L7/conditional-allowance", + "publication_status": "ready-for-root-review", + "coordination": { + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1635", + "expires_at": "2026-10-14T07:30:00Z", + "overlap_checked_at": "2026-10-14T06:04:59.789932+00:00", + "overlap_boundary": "Top-level H6/banked searches complete. Search result1166 first25roots is incomplete, supplemented by direct last100 read covering all44roots and all replies; other returned pages complete.", + "finding": "No new H6/banked PR or exact conditional-budget audit claim identified; source heads unchanged. Own1635 and PR1590 have no comments. Author H6 thread retains the same three replies, latest18914905. Selected, catalogue and guidance match claim-base bytes. Separate H6/banked discovery search, not universal novelty proof.", + "current_main_at_check": "2cb97fd645e99cf6d7def35159abfc253a3ef4f0", + "expiry_history": [ + { + "expires_at": "2026-10-14T06:30:00Z", + "status": "original advisory expiry, preserved as history" + }, + { + "expires_at": "2026-10-14T07:30:00Z", + "published_at": "2026-10-14T06:15:42Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1635", + "body_sha256": "67a79ffd0e17544a122de39ec6a7cba055278c388eae829f3e0a131a002637a6" + } + ], + "final_overlap_checkpoint": { + "checked_at": "2026-10-14T06:57:59.166919+00:00", + "current_main": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "coverage": "Complete root/reply pagination for Discussions 1635,1167,1527,1166; newest 100 open PRs of 382, further pages not refreshed; earlier complete 533-PR/305-Discussion cache searched. Bounded coverage, not an all-history novelty certificate.", + "conclusion": "No competing exact frozen H6 fifteen-case threshold audit identified within this coverage.", + "source_heads": { + "p1590": "08e134b4a0c7f04869dae703f2a2e688e53c44f0", + "p1424": "bfe423c24555baf35dab991a8d6fe723a038945c" + }, + "comparison_only_caveat": { + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1424#issuecomment-6162623622", + "updated_at": "2026-10-14T06:48:08Z", + "summary": "PR1424 is still open. The batch reviewer separates arithmetic from unresolved parent regenerated-container binding and controller/invoice/geometry replay. Preserve comparison-only/nonselected wording; the H6 conditional audit does not admit that construction." + } + } + }, + "historical_initial_assignment": { + "task_id": "complex-masked-decoder", + "priority_revision": 2, + "status": "retired before this study; not represented as the current card" + }, + "model": { + "n": 30960, + "h": 17, + "hist": { + "17": 256, + "15": 560 + }, + "data": [ + 16 + ], + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "virtual": false, + "stages": [ + 3, + 5, + 7 + ] + }, + "targets": [ + { + "label": "author_rounded_PR890", + "value": "0.001661957775", + "cases": 3 + }, + { + "label": "retained_PR890", + "value": "1661957774647029/1000000000000000000", + "cases": 3 + }, + { + "label": "pinned_selected", + "value": "836330098538459/500000000000000000", + "cases": 3 + }, + { + "label": "author_quoted_PR1424", + "value": "0.001676855229071321", + "cases": 3 + }, + { + "label": "published_full_PR1424_title_appendix", + "value": "0.001676855229071321886206381217337893", + "cases": 3 + } + ], + "selected_record_changed": false, + "historical_package_base_commit": "0a201997097b8a89b638f3a2afcb35db4184c8b2" +} diff --git a/research/h6-banked-invoice-audit/VERIFY.json b/research/h6-banked-invoice-audit/VERIFY.json new file mode 100644 index 0000000000..3c7a6f0385 --- /dev/null +++ b/research/h6-banked-invoice-audit/VERIFY.json @@ -0,0 +1,71 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "audit" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Authenticate four dependencies, reconstruct all twelve original cases, compare source thresholds and 24 endpoint invoices, compare canonical evidence, and run four source guards." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "verify" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Rational-only original evidence replay: exact grid cells, endpoint and pressure separation, rank-mass/caps and seventeen supplied controls. Shares model.py with the source checker." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "appendix" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Three full-title PR1424 cases, exact binary64 witness arithmetic, canonical evidence, ten rejection controls and three positive-control groups; no source invoice execution." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/authenticated_run.py", + "appendix", + "--source" + ], + "timeout_seconds": 30, + "checks": "Required authenticated source-only launcher; Recheck the three appendix thresholds and six invoices against authenticated source, plus native float comparison witnesses and the supplied controls. Shares the original model." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "-c", + "import pathlib,runpy,sys; p=pathlib.Path(sys.argv[1]); h=p/'hardening_controls'; pairs=[('authenticated_run.py','patch_tree/authenticated_run.py'),('h6_full_pr1424_appendix/appendix.py','patch_tree/h6_full_pr1424_appendix/appendix.py')]; mismatches=[a for a,b in pairs if (p/a).read_bytes()!=(h/b).read_bytes()];\nif mismatches: raise SystemExit('Active package differs from fixed-hash control fixtures: '+','.join(mismatches))\nsys.argv=[str(h/'hardening_checks.py'),*sys.argv[2:]]; runpy.run_path(sys.argv[0],run_name='__main__')", + "{package}" + ], + "timeout_seconds": 120, + "checks": "Bind active appendix/launcher bytes to the exact fixed-hash control fixtures, then run the unchanged 22 execution-hygiene controls: synthetic stale-cache closure, source/hash/override guards, process restoration, deferred-output failure and success fixtures, and overwrite refusal. No mathematical proof or extra invoice cases." + } + ] +} diff --git a/research/h6-banked-invoice-audit/authenticated_run.py b/research/h6-banked-invoice-audit/authenticated_run.py new file mode 100644 index 0000000000..36a81d0ca1 --- /dev/null +++ b/research/h6-banked-invoice-audit/authenticated_run.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Required source-only launcher for the frozen H6 entrypoints. + +Run with python3 -I -B [and optionally -O]. All application source bytes are +hashed before execution. The entrypoint and both ordinary/explicit-path +SourceFileLoader imports compile those same retained bytes, never a .pyc. +Trusted interpreter/stdlib, stable package layout, single-threaded execution. +No mathematical changes; existing source/evidence provenance stays intact. +For Andrey Mas by ChatGPT (GPT-6 Astra Pro); Codex coordination is separate. +""" +import argparse +import hashlib +import importlib.machinery +from pathlib import Path +import sys +import types + +ORIGINAL = 'h6_banked_invoice_audit' +APPENDIX = 'h6_full_pr1424_appendix' +COMMON = { + ORIGINAL+'/model.py': + 'd18c4c589e37de077d29120d7b4688ad6a335cd63d225f93621a2573cd23cd80', + ORIGINAL+'/source_bindings.py': + 'f247b8a5ef341737318af2d926808b92d26d90ff6db9abf2f714ba132ff6f335', + ORIGINAL+'/vendor/research/niemeier-lattices/workbench/paid-controller/banked.py': + '8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079', + ORIGINAL+'/vendor/research/niemeier-lattices/workbench/paid-controller/portable.py': + '95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8', + ORIGINAL+'/vendor/research/niemeier-lattices/code/costs.py': + '885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8', + ORIGINAL+'/vendor/research/leech-lattice/code/screen.py': + '6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385', +} +ENTRYPOINTS = { + 'audit': (ORIGINAL+'/audit.py', + '458c7f01a5151ddc7e532d165992d8177f7be6644cf9309ef25cfadf01c251c0'), + 'verify': (ORIGINAL+'/verify_certificate.py', + '8bc83e304ce2f259295bc81f1ab9dc681def9d7e54fb09fc2915386fd2b31f58'), + 'appendix': (APPENDIX+'/appendix.py', + '69b1981b049df19655c497387741ab04c93a40d82b48135b157b4d472f3ae345'), +} +AUTHOR = (APPENDIX+'/author_source/price_h6.py', + 'ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a') + + +def require(test, message): + if not test: + raise ValueError(message) + + +def run_authenticated(root: Path, entry: str, arguments: list[str], + manifest: dict[str, str]) -> None: + """Execute one pinned closure; manifest is fixed by main(), not CLI data.""" + root = root.resolve() + blobs = {} + for relative, expected in sorted(manifest.items()): + path = (root/relative).resolve() + require(path.is_relative_to(root), 'Source outside package root: '+relative) + data = path.read_bytes() + require(hashlib.sha256(data).hexdigest() == expected, + 'Source SHA256 mismatch: '+relative) + blobs[path] = data + entry_path = (root/entry).resolve() + require(entry_path in blobs, 'Unauthenticated entrypoint') + # Fresh isolated CLI invocations have no application modules preloaded. + require(not any(name in sys.modules for name in ('model', 'source_bindings', 'portable')), + 'Application module already loaded; use a fresh isolated process') + loader_type = importlib.machinery.SourceFileLoader + saved_get_code = loader_type.get_code + + def source_code(loader, fullname): + path = Path(loader.path).resolve() + if path in blobs: + return compile(blobs[path], str(path), 'exec', dont_inherit=True) + require(not path.is_relative_to(root), 'Unlisted application source: '+str(path)) + return saved_get_code(loader, fullname) + + saved_argv, saved_path = sys.argv, sys.path[:] + saved_main = sys.modules.get('__main__') + program = types.ModuleType('__main__') + program.__file__ = str(entry_path) + program.__package__ = None + program.__spec__ = None + try: + # Covers the nested explicit loaders in banked.py and costs.py too. + loader_type.get_code = source_code + sys.argv = [str(entry_path), *arguments] + sys.modules['__main__'] = program + exec(compile(blobs[entry_path], str(entry_path), 'exec', dont_inherit=True), + program.__dict__) + finally: + loader_type.get_code = saved_get_code + sys.argv = saved_argv + sys.path[:] = saved_path + if saved_main is None: + sys.modules.pop('__main__', None) + else: + sys.modules['__main__'] = saved_main + + +def main(): + require(sys.flags.isolated and sys.dont_write_bytecode, + 'Use python3 -I -B authenticated_run.py') + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--root', type=Path, default=Path(__file__).resolve().parent, + help='Parent of the two sibling package directories') + parser.add_argument('mode', choices=ENTRYPOINTS) + parser.add_argument('arguments', nargs=argparse.REMAINDER) + args = parser.parse_args() + forwarded = args.arguments + if forwarded[:1] == ['--']: + forwarded = forwarded[1:] + # argparse also accepts abbreviations such as --ori; block those too. + require(not any(x.startswith('--') and '--original'.startswith(x.split('=',1)[0]) + for x in forwarded), + 'Use launcher --root, not appendix --original') + entry, digest = ENTRYPOINTS[args.mode] + manifest = dict(COMMON) + manifest[entry] = digest + if args.mode == 'appendix': + manifest[AUTHOR[0]] = AUTHOR[1] + run_authenticated(args.root, entry, forwarded, manifest) + + +if __name__ == '__main__': + main() diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/EVIDENCE.json b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/EVIDENCE.json new file mode 100644 index 0000000000..326ea0a6bc --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/EVIDENCE.json @@ -0,0 +1,1562 @@ +{ + "cases": [ + { + "L": 3, + "exact": { + "R": 80558, + "alpha_target": "66478311/39933521689", + "budget_ratio_n_over_R": "15480/40279", + "positive_pressure_excess_at_R_plus_1": "1214635276854252882142731735674844658953/10000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "1025766958948493306583801810909883103067/10000000000000000000000000000000000000000", + "pressure_at_R": [ + "118319487116520525753346684879776729948564801/5000000000000000000000000000000000000000", + "236638974233041051506693416198189090116896933/10000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "236641214635276854252882142731735674844658953/10000000000000000000000000000000000000000", + "473282429270553708505764378341656343535556797/20000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "120322232719171050645653142440633694394800544/1493601490535164125848648426054433920977", + "60161116359585525322826574431772761057442752/746800745267582062924324060738315843117" + ] + }, + "invoice_at_R": { + "R": 80558, + "alpha_bracket": [ + "10404573011/6250000000000", + "332946336353/200000000000000" + ], + "alpha_grid_cell": [ + "832365840881/500000000000000", + "1664731681763/1000000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "208544649845018245037801518839987/5000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "147378477801488470889987371998909/5000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "11831999999979145535015495853554356009571751/500000000000000000000000000000000000000", + "118319999999791455350154981754962198481160013/5000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "118320000000147378477801488470889987371998909/5000000000000000000000000000000000000000", + "236640000000294756955603023380617251661136541/10000000000000000000000000000000000000000" + ], + "rank_mass": "8931429", + "scaled_kappa_interval": [ + 1661964956043699, + 1661964956048683 + ], + "stock": "182757", + "z": 1664731681762 + }, + "invoice_at_R_plus_1": { + "R": 80559, + "alpha_bracket": [ + "1664715945281/1000000000000000", + "832357972643/500000000000000" + ], + "alpha_grid_cell": [ + "1664715945283/1000000000000000", + "416178986321/250000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "759583745826110176665156958905411/20000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "83015275575373641150527581909731/2500000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "23663999999962020812708689847281369937370921/1000000000000000000000000000000000000000", + "473279999999240416254173889823334843041094589/20000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "59160000000083015275575373641150527581909731/2500000000000000000000000000000000000000", + "473280000000664122204603082006911665230538469/20000000000000000000000000000000000000000" + ], + "rank_mass": "17863005/2", + "scaled_kappa_interval": [ + 1661949271827939, + 1661949271832924 + ], + "stock": "365517/2", + "z": 1664715945283 + }, + "quoted_R": 80558, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 23664, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 2, + "helpers_per_port": "40279/15480", + "m": 49, + "max_helpers": 80558, + "pad_rank": 15, + "stages": 3, + "total_stock_at_max": "182757", + "virtual_entrance_dimension": 0 + }, + "target": "66478311/40000000000", + "target_id": "author_PR890" + }, + { + "L": 5, + "exact": { + "R": 89683, + "alpha_target": "66478311/39933521689", + "budget_ratio_n_over_R": "30960/89683", + "positive_pressure_excess_at_R_plus_1": "286218409398892645739639505158178732447/1000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "1073436240663776051733226624800566680423/8000000000000000000000000000000000000000", + "pressure_at_R": [ + "48063892656375933622394815274548612307938093/800000000000000000000000000000000000000", + "480638926563759336223948266773375199433319577/8000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "60080286218409398892645739639505158178732447/1000000000000000000000000000000000000000", + "120160572436818797785291507786186343730403391/2000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "301621460688657204616813850818073117236316544/3363183515854917217764371370175488293987", + "50270243448109534102802315291890882482838048/560530585975819536294061759190391746441" + ] + }, + "invoice_at_R": { + "R": 89683, + "alpha_bracket": [ + "1664728187881/1000000000000000", + "832364093943/500000000000000" + ], + "alpha_grid_cell": [ + "1664728187883/1000000000000000", + "416182046971/250000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "194279168366046728901836781561/2500000000000000000000000000000000000", + "positive_upper_bracket_margin": "412279548685637251542599233839071/4000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "120159999999844576665307134109842473784765663/2000000000000000000000000000000000000000", + "150199999999805720831633953271098163218439/2500000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "240320000000412279548685637251542599233839071/4000000000000000000000000000000000000000", + "480640000000824559097371388531229425977442719/8000000000000000000000000000000000000000" + ], + "rank_mass": "76205455/4", + "scaled_kappa_interval": [ + 1661961473768445, + 1661961473773429 + ], + "stock": "943775/4", + "z": 1664728187883 + }, + "invoice_at_R_plus_1": { + "R": 89684, + "alpha_bracket": [ + "16647165607/10000000000000", + "332943312141/200000000000000" + ], + "alpha_grid_cell": [ + "832358280351/500000000000000", + "1664716560703/1000000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "43006820433793261297064964680559/400000000000000000000000000000000000000", + "positive_upper_bracket_margin": "146531528526753624718382393141703/2000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "120159999999784965897831005186474713526300477/2000000000000000000000000000000000000000", + "24031999999956993179566206738702935035319441/400000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "120160000000146531528526753624718382393141703/2000000000000000000000000000000000000000", + "120160000000146531528526782131758344128565269/2000000000000000000000000000000000000000" + ], + "rank_mass": "19051465", + "scaled_kappa_interval": [ + 1661949885203049, + 1661949885208033 + ], + "stock": "235945", + "z": 1664716560702 + }, + "quoted_R": 89683, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 60080, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 4, + "helpers_per_port": "89683/30960", + "m": 81, + "max_helpers": 89683, + "pad_rank": 13, + "stages": 5, + "total_stock_at_max": "943775/4", + "virtual_entrance_dimension": 0 + }, + "target": "66478311/40000000000", + "target_id": "author_PR890" + }, + { + "L": 7, + "exact": { + "R": 80753, + "alpha_target": "66478311/39933521689", + "budget_ratio_n_over_R": "30960/80753", + "positive_pressure_excess_at_R_plus_1": "956256564394315252163452201857006735713/5000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "5328459571914815405007135443914567047827/12000000000000000000000000000000000000000", + "pressure_at_R": [ + "192991111923404680864099126166939448523896237/2000000000000000000000000000000000000000", + "1157946671540428085184594992864556085432952173/12000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "482480956256564394315252163452201857006735713/5000000000000000000000000000000000000000", + "192992382502625757726100904691679701963864743/2000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "87946261642470134024869374129101867885395776/1089067903780167430062183646018050033755", + "73288551368725111687391155167426748039207184/907556586483472858385152815210199141463" + ] + }, + "invoice_at_R": { + "R": 80753, + "alpha_bracket": [ + "104045757639/62500000000000", + "1664732122229/1000000000000000" + ], + "alpha_grid_cell": [ + "832366061113/500000000000000", + "1664732122227/1000000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "1647882361271107863533322250843123/12000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "765353601404555818011629214770647/5000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "964959999998626764698940546893716133184734377/10000000000000000000000000000000000000000", + "1157951999998352117638728892136466677749156877/12000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "482480000000765353601404555818011629214770647/5000000000000000000000000000000000000000", + "5789760000009184243216855849136176143766492769/60000000000000000000000000000000000000000" + ], + "rank_mass": "189241927/6", + "scaled_kappa_interval": [ + 1661965395044844, + 1661965395049828 + ], + "stock": "1679831/6", + "z": 1664732122226 + }, + "invoice_at_R_plus_1": { + "R": 80754, + "alpha_bracket": [ + "1664721183847/1000000000000000", + "416180295963/250000000000000" + ], + "alpha_grid_cell": [ + "1664721183849/1000000000000000", + "33294423677/20000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "1362760716017404273860325877847613/10000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "308240168397048854051261144195927/2000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "60309999999914827455248899948283460085803063/625000000000000000000000000000000000000", + "964959999998637239283982595726139674122152387/10000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "192992000000308240168397048854051261144195927/2000000000000000000000000000000000000000", + "241240000000385300210496360205965154767533127/2500000000000000000000000000000000000000" + ], + "rank_mass": "31540453", + "scaled_kappa_interval": [ + 1661954492995919, + 1661954493000904 + ], + "stock": "279973", + "z": 1664721183849 + }, + "quoted_R": 80753, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 96496, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 6, + "helpers_per_port": "80753/30960", + "m": 113, + "max_helpers": 80753, + "pad_rank": 11, + "stages": 7, + "total_stock_at_max": "1679831/6", + "virtual_entrance_dimension": 0 + }, + "target": "66478311/40000000000", + "target_id": "author_PR890" + }, + { + "L": 3, + "exact": { + "R": 80558, + "alpha_target": "1661957774647029/998338042225352971", + "budget_ratio_n_over_R": "15480/40279", + "positive_pressure_excess_at_R_plus_1": "607292428354556752273584542914689956061/5000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "1025817378616188129680487807410498220591/10000000000000000000000000000000000000000", + "pressure_at_R": [ + "59159743545655345952967568268389242298528149/2500000000000000000000000000000000000000", + "236638974182621383811870319512192589501779409/10000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "118320607292428354556752273584542914689956061/5000000000000000000000000000000000000000", + "94656485833942683645401837443271326556333397/4000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "120322232727142843494654869937329425944719456/1493601490216867756182730657151259369389", + "30080558181785710873663719090060313074017152/373400372554216939045682588143364299921" + ] + }, + "invoice_at_R": { + "R": 80558, + "alpha_bracket": [ + "10404573011/6250000000000", + "332946336353/200000000000000" + ], + "alpha_grid_cell": [ + "832365840881/500000000000000", + "1664731681763/1000000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "208544649845018245037801518839987/5000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "147378477801488470889987371998909/5000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "11831999999979145535015495853554356009571751/500000000000000000000000000000000000000", + "118319999999791455350154981754962198481160013/5000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "118320000000147378477801488470889987371998909/5000000000000000000000000000000000000000", + "236640000000294756955603023380617251661136541/10000000000000000000000000000000000000000" + ], + "rank_mass": "8931429", + "scaled_kappa_interval": [ + 1661964956043699, + 1661964956048683 + ], + "stock": "182757", + "z": 1664731681762 + }, + "invoice_at_R_plus_1": { + "R": 80559, + "alpha_bracket": [ + "1664715945281/1000000000000000", + "832357972643/500000000000000" + ], + "alpha_grid_cell": [ + "1664715945283/1000000000000000", + "416178986321/250000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "759583745826110176665156958905411/20000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "83015275575373641150527581909731/2500000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "23663999999962020812708689847281369937370921/1000000000000000000000000000000000000000", + "473279999999240416254173889823334843041094589/20000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "59160000000083015275575373641150527581909731/2500000000000000000000000000000000000000", + "473280000000664122204603082006911665230538469/20000000000000000000000000000000000000000" + ], + "rank_mass": "17863005/2", + "scaled_kappa_interval": [ + 1661949271827939, + 1661949271832924 + ], + "stock": "365517/2", + "z": 1664715945283 + }, + "quoted_R": null, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 23664, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 2, + "helpers_per_port": "40279/15480", + "m": 49, + "max_helpers": 80558, + "pad_rank": 15, + "stages": 3, + "total_stock_at_max": "182757", + "virtual_entrance_dimension": 0 + }, + "target": "1661957774647029/1000000000000000000", + "target_id": "retained_PR890" + }, + { + "L": 5, + "exact": { + "R": 89683, + "alpha_target": "1661957774647029/998338042225352971", + "budget_ratio_n_over_R": "30960/89683", + "positive_pressure_excess_at_R_plus_1": "572411209307847082589413629210501514251/2000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "268384669476617197555165031330197071427/2000000000000000000000000000000000000000", + "pressure_at_R": [ + "480638926461322093531209665311985627205878557/8000000000000000000000000000000000000000", + "120159731615330523382802444834968669802928573/2000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "120160572411209307847082589413629210501514251/2000000000000000000000000000000000000000", + "30040143102802326961770654480201307946845867/500000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "75405365181696586655960412245419782065419712/840795878784464280173085836561984454895", + "1971382096253505533489161371993145733318848/21981591602208216475113349877220916199" + ] + }, + "invoice_at_R": { + "R": 89683, + "alpha_bracket": [ + "1664728187881/1000000000000000", + "832364093943/500000000000000" + ], + "alpha_grid_cell": [ + "1664728187883/1000000000000000", + "416182046971/250000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "194279168366046728901836781561/2500000000000000000000000000000000000", + "positive_upper_bracket_margin": "412279548685637251542599233839071/4000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "120159999999844576665307134109842473784765663/2000000000000000000000000000000000000000", + "150199999999805720831633953271098163218439/2500000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "240320000000412279548685637251542599233839071/4000000000000000000000000000000000000000", + "480640000000824559097371388531229425977442719/8000000000000000000000000000000000000000" + ], + "rank_mass": "76205455/4", + "scaled_kappa_interval": [ + 1661961473768445, + 1661961473773429 + ], + "stock": "943775/4", + "z": 1664728187883 + }, + "invoice_at_R_plus_1": { + "R": 89684, + "alpha_bracket": [ + "16647165607/10000000000000", + "332943312141/200000000000000" + ], + "alpha_grid_cell": [ + "832358280351/500000000000000", + "1664716560703/1000000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "43006820433793261297064964680559/400000000000000000000000000000000000000", + "positive_upper_bracket_margin": "146531528526753624718382393141703/2000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "120159999999784965897831005186474713526300477/2000000000000000000000000000000000000000", + "24031999999956993179566206738702935035319441/400000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "120160000000146531528526753624718382393141703/2000000000000000000000000000000000000000", + "120160000000146531528526782131758344128565269/2000000000000000000000000000000000000000" + ], + "rank_mass": "19051465", + "scaled_kappa_interval": [ + 1661949885203049, + 1661949885208033 + ], + "stock": "235945", + "z": 1664716560702 + }, + "quoted_R": null, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 60080, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 4, + "helpers_per_port": "89683/30960", + "m": 81, + "max_helpers": 89683, + "pad_rank": 13, + "stages": 5, + "total_stock_at_max": "943775/4", + "virtual_entrance_dimension": 0 + }, + "target": "1661957774647029/1000000000000000000", + "target_id": "retained_PR890" + }, + { + "L": 7, + "exact": { + "R": 80753, + "alpha_target": "1661957774647029/998338042225352971", + "budget_ratio_n_over_R": "30960/80753", + "positive_pressure_excess_at_R_plus_1": "382461488565877274292240251310727747663/2000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "6660882991800026746891941064280374724371/15000000000000000000000000000000000000000", + "pressure_at_R": [ + "5789733356468032799893011252921146159042734073/60000000000000000000000000000000000000000", + "1447433339117008199973253108058935719625275629/15000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "192992382461488565877274292240251310727747663/2000000000000000000000000000000000000000", + "241240478076860707346592914438812826861501443/2500000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "769529789516021516424229873418142661448015208/9529344156044106304378573941241543733029", + "3078119158064086065696919916185928597263576128/38117376624176425217514286393162789695817" + ] + }, + "invoice_at_R": { + "R": 80753, + "alpha_bracket": [ + "104045757639/62500000000000", + "1664732122229/1000000000000000" + ], + "alpha_grid_cell": [ + "832366061113/500000000000000", + "1664732122227/1000000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "1647882361271107863533322250843123/12000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "765353601404555818011629214770647/5000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "964959999998626764698940546893716133184734377/10000000000000000000000000000000000000000", + "1157951999998352117638728892136466677749156877/12000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "482480000000765353601404555818011629214770647/5000000000000000000000000000000000000000", + "5789760000009184243216855849136176143766492769/60000000000000000000000000000000000000000" + ], + "rank_mass": "189241927/6", + "scaled_kappa_interval": [ + 1661965395044844, + 1661965395049828 + ], + "stock": "1679831/6", + "z": 1664732122226 + }, + "invoice_at_R_plus_1": { + "R": 80754, + "alpha_bracket": [ + "1664721183847/1000000000000000", + "416180295963/250000000000000" + ], + "alpha_grid_cell": [ + "1664721183849/1000000000000000", + "33294423677/20000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "1362760716017404273860325877847613/10000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "308240168397048854051261144195927/2000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "60309999999914827455248899948283460085803063/625000000000000000000000000000000000000", + "964959999998637239283982595726139674122152387/10000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "192992000000308240168397048854051261144195927/2000000000000000000000000000000000000000", + "241240000000385300210496360205965154767533127/2500000000000000000000000000000000000000" + ], + "rank_mass": "31540453", + "scaled_kappa_interval": [ + 1661954492995919, + 1661954493000904 + ], + "stock": "279973", + "z": 1664721183849 + }, + "quoted_R": null, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 96496, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 6, + "helpers_per_port": "80753/30960", + "m": 113, + "max_helpers": 80753, + "pad_rank": 11, + "stages": 7, + "total_stock_at_max": "1679831/6", + "virtual_entrance_dimension": 0 + }, + "target": "1661957774647029/1000000000000000000", + "target_id": "retained_PR890" + }, + { + "L": 3, + "exact": { + "R": 79880, + "alpha_target": "836330098538459/499163669901461541", + "budget_ratio_n_over_R": "774/1997", + "positive_pressure_excess_at_R_plus_1": "612903097541528411884325067975399278331/5000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "32158529346080522050996648806723081999/312500000000000000000000000000000000000", + "pressure_at_R": [ + "2957987136588261567791179020997822002150507/125000000000000000000000000000000000000", + "7394967841470653919477949003351193276918001/312500000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "118320612903097541528411884325067975399278331/5000000000000000000000000000000000000000", + "11832061290309754152841190753900410000130379/500000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "15010064525787570075744138083464274726223184/187906594513136127453914230834595102629", + "30020129051575140151488277783033580989031200/375813189026272254907828385031771086017" + ] + }, + "invoice_at_R": { + "R": 79880, + "alpha_bracket": [ + "418867487891/250000000000000", + "1675469951569/1000000000000000" + ], + "alpha_grid_cell": [ + "837734975783/500000000000000", + "1675469951567/1000000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "81679929808767071082494111592021/2500000000000000000000000000000000000000", + "positive_upper_bracket_margin": "5946412780672665174739115707803/156250000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "59159999999918320070191221322013837324041401/2500000000000000000000000000000000000000", + "59159999999918320070191232928917505888407979/2500000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "3697500000005946412780672665174739115707803/156250000000000000000000000000000000000", + "29580000000047571302245387124849747225268213/1250000000000000000000000000000000000000" + ], + "rank_mass": "8881596", + "scaled_kappa_interval": [ + 1672667447516726, + 1672667447521710 + ], + "stock": "181740", + "z": 1675469951566 + }, + "invoice_at_R_plus_1": { + "R": 79881, + "alpha_bracket": [ + "104715875711/62500000000000", + "1675454011381/1000000000000000" + ], + "alpha_grid_cell": [ + "837727005689/500000000000000", + "1675454011379/1000000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "393236681950876059935770518582087/10000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "628120350404301405371946929095719/20000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "94655999999842705327219631004973158079974927/4000000000000000000000000000000000000000", + "236639999999606763318049123940064229481417913/10000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "473280000000628120350404301405371946929095719/20000000000000000000000000000000000000000", + "23664000000031406017520219713031730788756661/1000000000000000000000000000000000000000" + ], + "rank_mass": "17763339/2", + "scaled_kappa_interval": [ + 1672651560609143, + 1672651560614127 + ], + "stock": "363483/2", + "z": 1675454011378 + }, + "quoted_R": null, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 23664, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 2, + "helpers_per_port": "1997/774", + "m": 49, + "max_helpers": 79880, + "pad_rank": 15, + "stages": 3, + "total_stock_at_max": "181740", + "virtual_entrance_dimension": 0 + }, + "target": "836330098538459/500000000000000000", + "target_id": "selected_pinned" + }, + { + "L": 5, + "exact": { + "R": 88765, + "alpha_target": "836330098538459/499163669901461541", + "budget_ratio_n_over_R": "6192/17753", + "positive_pressure_excess_at_R_plus_1": "253945165038544533396490902354630846897/2000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "1184572677859332940953325194576439394323/4000000000000000000000000000000000000000", + "pressure_at_R": [ + "240318815427322140667058989668231603110207139/4000000000000000000000000000000000000000", + "240318815427322140667059046674805423560605677/4000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "120160253945165038544533396490902354630846897/2000000000000000000000000000000000000000", + "120160253945165038544533424994394343424149999/2000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "150232663472154358855602119049560308625797888/1692463007936422007803313983263287694321", + "150232663472154358855602139648535933602723936/1692463007936422007803313573106151486655" + ] + }, + "invoice_at_R": { + "R": 88765, + "alpha_bracket": [ + "83773546011/50000000000000", + "67018836809/40000000000000" + ], + "alpha_grid_cell": [ + "837735460111/500000000000000", + "1675470920223/1000000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "578635986306768681945777744676401/8000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "858356868211643585588514377653621/8000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "240319999999710682006846558652171756035850587/4000000000000000000000000000000000000000", + "480639999999421364013693231318054222255323599/8000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "480640000000858356868211643585588514377653621/8000000000000000000000000000000000000000", + "480640000000858356868211757599299224895557909/8000000000000000000000000000000000000000" + ], + "rank_mass": "75833665/4", + "scaled_kappa_interval": [ + 1672668412934956, + 1672668412939941 + ], + "stock": "939185/4", + "z": 1675470920222 + }, + "invoice_at_R_plus_1": { + "R": 88766, + "alpha_bracket": [ + "1675459142433/1000000000000000", + "837729571219/500000000000000" + ], + "alpha_grid_cell": [ + "335091828487/200000000000000", + "418864785609/250000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "8274677903995017314781166055611/80000000000000000000000000000000000000", + "positive_upper_bracket_margin": "304767575429654062663604849119019/4000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "4806399999991725322096003842547953467438501/80000000000000000000000000000000000000", + "4806399999991725322096004982685218833944389/80000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "240320000000304767575429654062663604849119019/4000000000000000000000000000000000000000", + "12016000000015238378771485553476343667237361/200000000000000000000000000000000000000" + ], + "rank_mass": "37917035/2", + "scaled_kappa_interval": [ + 1672656674515531, + 1672656674520515 + ], + "stock": "469595/2", + "z": 1675459142435 + }, + "quoted_R": null, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 60080, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 4, + "helpers_per_port": "17753/6192", + "m": 81, + "max_helpers": 88765, + "pad_rank": 13, + "stages": 5, + "total_stock_at_max": "939185/4", + "virtual_entrance_dimension": 0 + }, + "target": "836330098538459/500000000000000000", + "target_id": "selected_pinned" + }, + { + "L": 7, + "exact": { + "R": 79778, + "alpha_target": "836330098538459/499163669901461541", + "budget_ratio_n_over_R": "15480/39889", + "positive_pressure_excess_at_R_plus_1": "4525850811865476645401293068960081545639/10000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "5604385372123639016072308366814594683681/30000000000000000000000000000000000000000", + "pressure_at_R": [ + "96495813187154262545366111293752175019255569/1000000000000000000000000000000000000000", + "2894874395614627876360983927691633185405316319/30000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "964964525850811865476645401293068960081545639/10000000000000000000000000000000000000000", + "1929929051701623730953291195175327397775376847/20000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "437229211088475367017338781457088895797296128/5480553659348591129390020387974645071129", + "510100746269887928186895315907788773647595632/6393979269240022984288355547209888989949" + ] + }, + "invoice_at_R": { + "R": 79778, + "alpha_bracket": [ + "837732957027/500000000000000", + "1675465914059/1000000000000000" + ], + "alpha_grid_cell": [ + "209433239257/125000000000000", + "1675465914057/1000000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "2294087640984680466249425243356633/15000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "67798641387182147433637956677023/500000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "192991999999694121647868670012486030229091079/2000000000000000000000000000000000000000", + "1447439999997705912359015319533750574756643367/15000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "48248000000067798641387182147433637956677023/500000000000000000000000000000000000000", + "361860000000508489810403939715778621910339449/3750000000000000000000000000000000000000" + ], + "rank_mass": "94235351/3", + "scaled_kappa_interval": [ + 1672663423502237, + 1672663423507221 + ], + "stock": "836503/3", + "z": 1675465914056 + }, + "invoice_at_R_plus_1": { + "R": 79779, + "alpha_bracket": [ + "837727417043/500000000000000", + "1675454834091/1000000000000000" + ], + "alpha_grid_cell": [ + "209431854261/125000000000000", + "1675454834089/1000000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "328820841428667273434935483024247/2000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "2482558871335272924032582202266657/20000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "482479999999177947896428233669576714495570231/5000000000000000000000000000000000000000", + "192991999999671179158571332726565064516975753/2000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "1929920000002482558871335272924032582202266657/20000000000000000000000000000000000000000", + "482480000000620639717833916377844092639124797/5000000000000000000000000000000000000000" + ], + "rank_mass": "62823831/2", + "scaled_kappa_interval": [ + 1672652380569229, + 1672652380574214 + ], + "stock": "557671/2", + "z": 1675454834088 + }, + "quoted_R": null, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 96496, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 6, + "helpers_per_port": "39889/15480", + "m": 113, + "max_helpers": 79778, + "pad_rank": 11, + "stages": 7, + "total_stock_at_max": "836503/3", + "virtual_entrance_dimension": 0 + }, + "target": "836330098538459/500000000000000000", + "target_id": "selected_pinned" + }, + { + "L": 3, + "exact": { + "R": 79617, + "alpha_target": "1676855229071321/998323144770928679", + "budget_ratio_n_over_R": "10320/26539", + "positive_pressure_excess_at_R_plus_1": "424355074545063873443129126633502068913/2000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "138778449528298643090164879482312064161/10000000000000000000000000000000000000000", + "pressure_at_R": [ + "473279722443100943402713726823851667187423141/20000000000000000000000000000000000000000", + "236639861221550471701356909835120517687935839/10000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "47328424355074545063873443129126633502068913/2000000000000000000000000000000000000000", + "118321060887686362659683631034644417774413871/5000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "59992884148271944476285639314614204314235104/753517940751206003450744722772620297301", + "119985768296543888952571285109919071316941024/1507035881502412006901489138222611088663" + ] + }, + "invoice_at_R": { + "R": 79617, + "alpha_bracket": [ + "1679672779017/1000000000000000", + "839836389511/500000000000000" + ], + "alpha_grid_cell": [ + "1679672779019/1000000000000000", + "83983638951/50000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "773969733618312004009362939430761/20000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "31853792051829306287997762020241/1000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "236639999999613015133190797574773362057384477/10000000000000000000000000000000000000000", + "473279999999226030266381687995990637060569239/20000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "23664000000031853792051829306287997762020241/1000000000000000000000000000000000000000", + "94656000000127415168207335794440773694276991/4000000000000000000000000000000000000000" + ], + "rank_mass": "17724531/2", + "scaled_kappa_interval": [ + 1676856209287933, + 1676856209292917 + ], + "stock": "362691/2", + "z": 1679672779019 + }, + "invoice_at_R_plus_1": { + "R": 79618, + "alpha_bracket": [ + "209957094843/125000000000000", + "1679656758749/1000000000000000" + ], + "alpha_grid_cell": [ + "839828379373/500000000000000", + "1679656758747/1000000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "335705124268291863538641792693099/10000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "184912191513593300653037515531899/5000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "59159999999916073718932915428305664318543963/2500000000000000000000000000000000000000", + "236639999999664294875731708136461358207306901/10000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "118320000000184912191513593300653037515531899/5000000000000000000000000000000000000000", + "59160000000092456095756808256136194025024911/2500000000000000000000000000000000000000" + ], + "rank_mass": "8862339", + "scaled_kappa_interval": [ + 1676840242697020, + 1676840242702004 + ], + "stock": "181347", + "z": 1679656758746 + }, + "quoted_R": 79617, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 23664, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 2, + "helpers_per_port": "26539/10320", + "m": 49, + "max_helpers": 79617, + "pad_rank": 15, + "stages": 3, + "total_stock_at_max": "362691/2", + "virtual_entrance_dimension": 0 + }, + "target": "1676855229071321/1000000000000000000", + "target_id": "author_PR1424" + }, + { + "L": 5, + "exact": { + "R": 88409, + "alpha_target": "1676855229071321/998323144770928679", + "budget_ratio_n_over_R": "30960/88409", + "positive_pressure_excess_at_R_plus_1": "1328422223605313696354517474777220353781/4000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "73660428077884639802459667740711428189/800000000000000000000000000000000000000", + "pressure_at_R": [ + "19225570535828768846144074455817427904510281/320000000000000000000000000000000000000", + "48063926339571922115360197540332259288571811/800000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "240321328422223605313696354517474777220353781/4000000000000000000000000000000000000000", + "24032132842222360531369641152182941707428623/400000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "30001214519710216722144705908343121480451104/339344872798947379084764033624126285435", + "300012145197102167221447100385132604666268608/3393448727989473790847639513856827950537" + ] + }, + "invoice_at_R": { + "R": 88409, + "alpha_bracket": [ + "1679674364929/1000000000000000", + "839837182467/500000000000000" + ], + "alpha_grid_cell": [ + "1679674364931/1000000000000000", + "419918591233/250000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "180946614839981212832844177693969/2000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "354807754279478848153907470852261/4000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "480639999999276213540639961140606669108346807/8000000000000000000000000000000000000000", + "120159999999819053385160018787167155822306031/2000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "240320000000354807754279478848153907470852261/4000000000000000000000000000000000000000", + "9612800000014192310171181434087395389182557/160000000000000000000000000000000000000" + ], + "rank_mass": "75689485/4", + "scaled_kappa_interval": [ + 1676857789885697, + 1676857789890681 + ], + "stock": "937405/4", + "z": 1679674364931 + }, + "invoice_at_R_plus_1": { + "R": 88410, + "alpha_bracket": [ + "1679662527949/1000000000000000", + "839831263977/500000000000000" + ], + "alpha_grid_cell": [ + "1679662527951/1000000000000000", + "104978907997/62500000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "401019232363856067881342969572801/4000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "157843397492732537925165113836201/2000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "240319999999598980767636086928079725989154951/4000000000000000000000000000000000000000", + "240319999999598980767636143932118657030427199/4000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "120160000000157843397492732537925165113836201/2000000000000000000000000000000000000000", + "240320000000315686794985522079889261440395413/4000000000000000000000000000000000000000" + ], + "rank_mass": "37844945/2", + "scaled_kappa_interval": [ + 1676845992570138, + 1676845992575122 + ], + "stock": "468705/2", + "z": 1679662527951 + }, + "quoted_R": 88409, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 60080, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 4, + "helpers_per_port": "88409/30960", + "m": 81, + "max_helpers": 88409, + "pad_rank": 13, + "stages": 5, + "total_stock_at_max": "937405/4", + "virtual_entrance_dimension": 0 + }, + "target": "1676855229071321/1000000000000000000", + "target_id": "author_PR1424" + }, + { + "L": 7, + "exact": { + "R": 79399, + "alpha_target": "1676855229071321/998323144770928679", + "budget_ratio_n_over_R": "30960/79399", + "positive_pressure_excess_at_R_plus_1": "512604636677181681728176305578341146167/1250000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "4618492325607814082362820202294837896439/20000000000000000000000000000000000000000", + "pressure_at_R": [ + "964957690753837196092958622398920038792657529/10000000000000000000000000000000000000000", + "1929915381507674392185917637179797705162103561/20000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "120620512604636677181681728176305578341146167/1250000000000000000000000000000000000000", + "241241025209273354363363505400749875989912459/2500000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "339304339804588403910443479059146637817304576/4273388837480906996802008733767585732037", + "508956509706882605865665289641837532308306464/6410083256221360495203011524587936511807" + ] + }, + "invoice_at_R": { + "R": 79399, + "alpha_bracket": [ + "1679675807197/1000000000000000", + "839837903601/500000000000000" + ], + "alpha_grid_cell": [ + "1679675807199/1000000000000000", + "2099594759/1250000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "8495426085798999975932385539635627/60000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "4386715795096454201531636424173269/30000000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "2894879999995752286957099911437685492629043863/30000000000000000000000000000000000000000", + "5789759999991504573914201000024067614460364373/60000000000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "2894880000004386715795096454201531636424173269/30000000000000000000000000000000000000000", + "2894880000004386715795097042775879952781793143/30000000000000000000000000000000000000000" + ], + "rank_mass": "188170913/6", + "scaled_kappa_interval": [ + 1676859227320794, + 1676859227325778 + ], + "stock": "1670353/6", + "z": 1679675807199 + }, + "invoice_at_R_plus_1": { + "R": 79400, + "alpha_bracket": [ + "1679664671447/1000000000000000", + "419916167863/250000000000000" + ], + "alpha_grid_cell": [ + "1679664671449/1000000000000000", + "33593293429/20000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "130730358075929308280901180250993/937500000000000000000000000000000000000", + "positive_upper_bracket_margin": "370926211927147339326053089426753/2500000000000000000000000000000000000000", + "pressure_at_alpha_lower": [ + "723719999998954157135392418389963447110082073/7500000000000000000000000000000000000000", + "90464999999869269641924070691719098819749007/937500000000000000000000000000000000000" + ], + "pressure_at_alpha_upper": [ + "241240000000370926211927147339326053089426753/2500000000000000000000000000000000000000", + "241240000000370926211927196387255834387326759/2500000000000000000000000000000000000000" + ], + "rank_mass": "94085852/3", + "scaled_kappa_interval": [ + 1676848128885528, + 1676848128890513 + ], + "stock": "835180/3", + "z": 1679664671449 + }, + "quoted_R": 79399, + "source_threshold": { + "bad_envelope": false, + "data_path": [ + 16 + ], + "deficit": 96496, + "helper_path": [ + 1, + 7, + 8, + 1 + ], + "helpers_per_bank": 6, + "helpers_per_port": "79399/30960", + "m": 113, + "max_helpers": 79399, + "pad_rank": 11, + "stages": 7, + "total_stock_at_max": "1670353/6", + "virtual_entrance_dimension": 0 + }, + "target": "1676855229071321/1000000000000000000", + "target_id": "author_PR1424" + } + ], + "excluded_historical_default": "1612719427075359/1000000000000000000", + "parameters": { + "bad": false, + "data": [ + 16 + ], + "h": 17, + "hist": { + "15": 560, + "17": 256 + }, + "hp": [ + 1, + 7, + 8, + 1 + ], + "n": 30960, + "scale": 1000000000000000000, + "stages": [ + 3, + 5, + 7 + ], + "virtual": false + }, + "retained_source_revision": "81e81af67714bdc8d1693b0bf5c29468b92f62ff", + "schema": "h6-banked-twelve-case-audit-v1", + "skeletons": [ + { + "L": 3, + "base_children": [ + { + "base_m_over_rank": "49/16", + "count": "185760", + "mass": "2972160", + "rank": 16 + }, + { + "base_m_over_rank": "49/17", + "count": "768", + "mass": "13056", + "rank": 17 + }, + { + "base_m_over_rank": "49/15", + "count": "1680", + "mass": "25200", + "rank": 15 + } + ], + "cap": 34, + "center_bill": 12752, + "deficit": 23664, + "idle_ranks": [], + "m": 49, + "pad": 15, + "q": 2, + "stock_before_helpers": "61920", + "unit_helper_children": [ + { + "base_m_over_rank": "49", + "count": "3", + "mass": "3", + "rank": 1 + }, + { + "base_m_over_rank": "7", + "count": "3", + "mass": "21", + "rank": 7 + }, + { + "base_m_over_rank": "49/8", + "count": "3", + "mass": "24", + "rank": 8 + }, + { + "base_m_over_rank": "49", + "count": "3", + "mass": "3", + "rank": 1 + }, + { + "base_m_over_rank": "49/15", + "count": "3/2", + "mass": "45/2", + "rank": 15 + } + ] + }, + { + "L": 5, + "base_children": [ + { + "base_m_over_rank": "81/16", + "count": "309600", + "mass": "4953600", + "rank": 16 + }, + { + "base_m_over_rank": "81/17", + "count": "1280", + "mass": "21760", + "rank": 17 + }, + { + "base_m_over_rank": "27/5", + "count": "2800", + "mass": "42000", + "rank": 15 + }, + { + "base_m_over_rank": "81/32", + "count": "61920", + "mass": "1981440", + "rank": 32 + }, + { + "base_m_over_rank": "81/32", + "count": "61920", + "mass": "1981440", + "rank": 32 + }, + { + "base_m_over_rank": "81/16", + "count": "61920", + "mass": "990720", + "rank": 16 + } + ], + "cap": 57, + "center_bill": 12752, + "deficit": 60080, + "idle_ranks": [ + 32, + 32, + 16 + ], + "m": 81, + "pad": 13, + "q": 4, + "stock_before_helpers": "123840", + "unit_helper_children": [ + { + "base_m_over_rank": "81", + "count": "5", + "mass": "5", + "rank": 1 + }, + { + "base_m_over_rank": "81/7", + "count": "5", + "mass": "35", + "rank": 7 + }, + { + "base_m_over_rank": "81/8", + "count": "5", + "mass": "40", + "rank": 8 + }, + { + "base_m_over_rank": "81", + "count": "5", + "mass": "5", + "rank": 1 + }, + { + "base_m_over_rank": "81/13", + "count": "5/4", + "mass": "65/4", + "rank": 13 + } + ] + }, + { + "L": 7, + "base_children": [ + { + "base_m_over_rank": "113/16", + "count": "433440", + "mass": "6935040", + "rank": 16 + }, + { + "base_m_over_rank": "113/17", + "count": "1792", + "mass": "30464", + "rank": 17 + }, + { + "base_m_over_rank": "113/15", + "count": "3920", + "mass": "58800", + "rank": 15 + }, + { + "base_m_over_rank": "113/64", + "count": "61920", + "mass": "3962880", + "rank": 64 + }, + { + "base_m_over_rank": "113/32", + "count": "61920", + "mass": "1981440", + "rank": 32 + }, + { + "base_m_over_rank": "113/16", + "count": "61920", + "mass": "990720", + "rank": 16 + }, + { + "base_m_over_rank": "113/32", + "count": "61920", + "mass": "1981440", + "rank": 32 + }, + { + "base_m_over_rank": "113/64", + "count": "61920", + "mass": "3962880", + "rank": 64 + }, + { + "base_m_over_rank": "113/16", + "count": "61920", + "mass": "990720", + "rank": 16 + } + ], + "cap": 79, + "center_bill": 12752, + "deficit": 96496, + "idle_ranks": [ + 64, + 32, + 16, + 32, + 64, + 16 + ], + "m": 113, + "pad": 11, + "q": 6, + "stock_before_helpers": "185760", + "unit_helper_children": [ + { + "base_m_over_rank": "113", + "count": "7", + "mass": "7", + "rank": 1 + }, + { + "base_m_over_rank": "113/7", + "count": "7", + "mass": "49", + "rank": 7 + }, + { + "base_m_over_rank": "113/8", + "count": "7", + "mass": "56", + "rank": 8 + }, + { + "base_m_over_rank": "113", + "count": "7", + "mass": "7", + "rank": 1 + }, + { + "base_m_over_rank": "113/11", + "count": "7/6", + "mass": "77/6", + "rank": 11 + } + ] + } + ], + "source_files": [ + { + "bytes": 12756, + "path": "research/leech-lattice/code/screen.py", + "sha256": "6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/leech-lattice/code/screen.py" + }, + { + "bytes": 16210, + "path": "research/niemeier-lattices/code/costs.py", + "sha256": "885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/code/costs.py" + }, + { + "bytes": 4796, + "path": "research/niemeier-lattices/workbench/paid-controller/banked.py", + "sha256": "8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/workbench/paid-controller/banked.py" + }, + { + "bytes": 2800, + "path": "research/niemeier-lattices/workbench/paid-controller/portable.py", + "sha256": "95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/workbench/paid-controller/portable.py" + } + ] +} diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/LICENSE b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/MODEL_NOTE.md b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/MODEL_NOTE.md new file mode 100644 index 0000000000..bdf389a8e0 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/MODEL_NOTE.md @@ -0,0 +1,382 @@ +# H6 banked-invoice source and threshold audit + +**Prepared for Andrey Mas through ChatGPT.** Model and geometry: Dominik +Scholz / PR606 and its NOTICE. H6 interpretation and six quoted thresholds: +DreamingOfClouds / PR1590, with Claude Opus 5.5 via Claude Code. New work here +is the bounded arithmetic audit and its proof, not a new pricing model. +See `NOTICE.md` for the complete attribution boundary and `SOURCES.md` for +references [S1]–[S8]. + +## 1. Claim and result + +For the twelve inputs below, the largest nonnegative integer helper count +whose **returned invoice lower scaled κ endpoint, divided by 10^18, strictly +exceeds the specified exact target** is the stated R. The source +`threshold(..., bad=False)` returns the same integer in each case. The proof +certifies R and R+1 and excludes every greater count by analytic monotonicity +of the true pressure root. It does not assume monotonicity of floating +nomination or of rounded endpoint output. + +| Exact comparison target | L = 3 | L = 5 | L = 7 | +|---|---:|---:|---:| +| Author's rounded PR890: 0.001661957775 | **80,558** | **89,683** | **80,753** | +| Retained PR890: 0.001661957774647029 | **80,558** | **89,683** | **80,753** | +| Pinned selected record: 0.001672660197076918 | **79,880** | **88,765** | **79,778** | +| Author's quoted open-PR1424: 0.001676855229071321 | **79,617** | **88,409** | **79,399** | + +All six originally quoted integers reproduce. The selected-target allowances +are smaller than the rounded-PR890 allowances by 678, 918, and 975 helpers, +respectively. The two PR890 inputs remain distinct even though their integer +answers coincide. The longer PR1424 title endpoint is not substituted for +the last row. PR1424 is a comparison target, not the pinned selected result. + +Every comparison is exact. In fact, at each R+1 the **upper** scaled endpoint +is already below its target. No boundary tie remains unresolved in these +twelve cases. These are conditional invoice allowances only; no new κ, +compensation construction, or supplier admission follows. + +## 2. Frozen inputs and source binding + +The only stages are L in {3,5,7}. The inputs are n=30960, h=17, +`hist={17:256,15:560}`, data path `[16]`, helper path `[1,7,8,1]`, +`virtual=False`, and `bad=False`. The unchanged factor is the supplied +K=(t^3−4t)/48, of rank 816. Its geometry and full-rank compensation receipt +are inherited inputs, not independently reconstructed geometry in this study. +The center bill is exactly + +\[ + C=17\cdot256+15\cdot560=12752. +\] + +The four full source files were authenticated against the provided SHA-256 +values before importing PR606. Their paths, byte counts, hashes, and public +URLs appear in `SOURCES.md` and `EVIDENCE.json`. No upstream file was changed. +Only the narrow invoice/threshold import closure was evaluated. Neither +`banked.run()` nor `costs.source_check()` was called; no unavailable historical +data were required. + +The source's `costs.FRONTIER` is exactly 0.001612719427075359, the historical +PR592 comparison. It is a fifth value, **excluded** from the twelve cases. +The retained PR890 and pinned selected targets were also read in their +respective public JSON `kappa` fields [S5,S6]. Their construction chains and +complete source manifests were not replayed here. + +## 3. Paid stock, children, and rank mass + +Set d=h−1=16 and + +\[ + m=16L+1,\qquad W_0=(L-1)n,\qquad D=W_0-LC, + \qquad q=\lfloor m/17\rfloor,\quad p=m-17q. +\] + +Here D is a scalar deficit, not a matrix. To avoid confusing the packing +integer q with an exponent, the pressure exponent below is always α. + +| L | m | W0 | D | q | helper pad p | child cap | actual largest child | +|---:|---:|---:|---:|---:|---:|---:|---:| +| 3 | 49 | 61920 | 23664 | 2 | 15 | 34 | 17 | +| 5 | 81 | 123840 | 60080 | 4 | 13 | 57 | 32 | +| 7 | 113 | 185760 | 96496 | 6 | 11 | 79 | 64 | + +The cap is `isqrt((m*m−1)//2)`, so an integer child rank r at or below the +cap satisfies the strict guard m²>2r². A term is recorded as (mass M, base +b=m/r). The base has active data mass 2nL·16 at rank 16 and center masses +L·17·256 and L·15·560 at ranks 17 and 15. The retained idle-rank lists are + +``` +L3: [] +L5: [32, 32, 16] +L7: [64, 32, 16, 32, 64, 16] +``` + +Each idle occurrence has mass 2nr at its actual rank r. All listed idle ranks +already obey their stage's cap; no splitting is needed. This is the actual +`banked.base` accounting, with no added free idle-hosting credit. In +particular, it is not an unannounced substitution of a different idle model +elsewhere in `costs.py`. Summing the base terms gives mW0−D exactly. + +One ordinary helper follows nested increments 1,7,8,1, totaling 17. Its four +path terms have masses L,7L,8L,L at the corresponding ranks. The paid pad +term has mass Lp/q at rank p. Therefore the total mass per helper is + +\[ + L(1+7+8+1)+Lp/q=17L+Lp/q=Lm/q. +\] + +Adding R such helpers adds stock LR/q, **as well as** their path and pad +children. Thus + +\[ + W_R=W_0+LR/q,\qquad + \sum M=mW_0-D+RLm/q=mW_R-D. +\] + +This is the complete rank-mass identity for this frozen invoice. Adding +children without their banked stock, or stock without residual/pad children, +is not the same model. Omitting the pad fails the identity. The two rank-one +entries are both present; one helper is not one scalar term or copy. + +The physical interpretation is conditional on [S1]: a helper is a restored +physical local register role, with the specified path, banked across +separately invoked replicas. Replicate by a multiple T of q, pack TR +width-17 residual slots into TR/q full banks at each stage, and pay each +bank's remaining rank p. The slots must be disjoint. Fractional reported +stock is a normalization of that integral replicated accounting, not a +fractional physical register. + +The ordinary zero-entrance assumption explains why this particular bank +wrapper has no virtual-entrance spectators. It does not waive spectators +needed by an eventual compensation implementation. Numerically checking +that the four increments sum to 17 does not prove gate legality, physical +loading, arbitrary-dirt restoration, or the existence of those paths. + +## 4. Pressure model and maximality proof + +For a child of mass M and base b=m/r, define its pressure at α≥0 by + +\[ + M(b^\alpha-1). +\] + +Let P0,L(α) be the sum for the base terms. A unit helper contributes + +\[ + H_L(\alpha)=L\left[ + 2(m^\alpha-1) + +7((m/7)^\alpha-1) + +8((m/8)^\alpha-1) + +\frac p q((m/p)^\alpha-1)\right]. +\] + +The two rank-one increments explain the coefficient 2. All actual bases +exceed 1; masses are nonnegative, with positive base mass. Therefore + +\[ + P_{L,R}(\alpha)=P_{0,L}(\alpha)+R H_L(\alpha) +\] + +is continuous and strictly increasing in α, starts at zero, and tends to +infinity. Since D>0, there is a unique positive root αR of P=D. Its nominal +κ is κR=αR/(1+αR). For α>0, HL(α)>0. If R2>R1 then +P(L,R2,αR1)>D, hence αR2<αR1 and κR2<κR1. This proves strict decrease of the +**true** root for all finite nonnegative helper counts, not merely at +sampled integers. + +For a target τ in (0,1), put a=τ/(1−τ). Then + +\[ + \kappa_R>\tau\quad\Longleftrightarrow\quad P_{L,R}(a)10^{18}u. +\] + +It is not a float comparison, and equality fails. It is also not the same +predicate as P(τ/(1−τ)) exact target > upper(R+1)/10^18`. +The complete lower/upper pairs and exact pressure margins are also provided +in the JSON certificate. + +| Target | L | R | lower(R) | upper(R) | lower(R+1) | upper(R+1) | +|---|---:|---:|---:|---:|---:|---:| +| author_PR890 | 3 | 80558 | 1661964956043699 | 1661964956048683 | 1661949271827939 | 1661949271832924 | +| author_PR890 | 5 | 89683 | 1661961473768445 | 1661961473773429 | 1661949885203049 | 1661949885208033 | +| author_PR890 | 7 | 80753 | 1661965395044844 | 1661965395049828 | 1661954492995919 | 1661954493000904 | +| retained_PR890 | 3 | 80558 | 1661964956043699 | 1661964956048683 | 1661949271827939 | 1661949271832924 | +| retained_PR890 | 5 | 89683 | 1661961473768445 | 1661961473773429 | 1661949885203049 | 1661949885208033 | +| retained_PR890 | 7 | 80753 | 1661965395044844 | 1661965395049828 | 1661954492995919 | 1661954493000904 | +| selected_pinned | 3 | 79880 | 1672667447516726 | 1672667447521710 | 1672651560609143 | 1672651560614127 | +| selected_pinned | 5 | 88765 | 1672668412934956 | 1672668412939941 | 1672656674515531 | 1672656674520515 | +| selected_pinned | 7 | 79778 | 1672663423502237 | 1672663423507221 | 1672652380569229 | 1672652380574214 | +| author_PR1424 | 3 | 79617 | 1676856209287933 | 1676856209292917 | 1676840242697020 | 1676840242702004 | +| author_PR1424 | 5 | 88409 | 1676857789885697 | 1676857789890681 | 1676845992570138 | 1676845992575122 | +| author_PR1424 | 7 | 79399 | 1676859227320794 | 1676859227325778 | 1676848128885528 | 1676848128890513 | diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/NOTICE.md b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/NOTICE.md new file mode 100644 index 0000000000..c0b8f3c68a --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/NOTICE.md @@ -0,0 +1,33 @@ +# Attribution and scope of authorship + +The banked pricing model, geometry inputs, rank-mass identities, packing +hypotheses, and original interval implementation belong to Dominik Scholz's +PR606 and its retained predecessors, with the disclosed OpenAI GPT-6 Astra +assistance in T3 Code. The engine is inherited from PR598. The full upstream +Niemeier and Leech attribution texts are preserved in `notices/`; they were +transferred from the pinned public NOTICE text, not represented as newly +authored research or as separately hash-authenticated upstream files. + +The H6 interpretation and six originally quoted helper thresholds belong to +DreamingOfClouds / PR1590, prepared with Claude Opus 5.5 via Claude Code. The +subsequent public pricing supplement at commit +`b496aed769dd724cd1ff6b921cade626562be27b` belongs to the same author and is +cited as a later source clarification, not as this audit's implementation. + +This new, bounded arithmetic audit and proof were prepared for Andrey Mas, +with GPT-6 Astra Pro research through ChatGPT. Codex selected/coordinated the +source input and is designated for later local mechanical replay. No Codex +mathematical derivation, independent human review, or formal verification is +claimed. Tests actually performed in this ChatGPT runtime are listed in +`RUN_LOG.txt`; later replay is not represented as already completed. + +New work is limited to the twelve exact comparisons, a source-bound replay, +strict-threshold and maximality analysis, rational evidence, and rejection +controls. No new geometry, pricing model, compensation construction, physical +helper-capacity theorem, admitted supplier, or multiplication exponent is +claimed. The four files under `vendor/` have their original full-file bytes; +all other Python files are newly assembled narrow audit code, with the +interval method explicitly credited to the upstream authors. + +The redistributed upstream source is Apache-2.0. A copy of that license is +included in `LICENSE`. Retain these attributions with derivative use. diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/SOURCES.md b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/SOURCES.md new file mode 100644 index 0000000000..7f0902e973 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/SOURCES.md @@ -0,0 +1,113 @@ +# Source register and authentication boundary + +All references are public source data. No external write was performed. +The frozen arithmetic inputs are those in the task, not a moving frontier. + +## Imported closure: authenticated before import + +Retained revision: `81e81af67714bdc8d1693b0bf5c29468b92f62ff`. +Merged PR606 head supplied by the task: +`048f884ea9c222faad43e8bb01e2a6863f6925d4`. +The task reports the four files are byte-identical at both commits; the +executed closure is authenticated against the retained-revision full-file +hashes below. This audit does not claim an additional independent binary +comparison of both Git commits. + +The full pinned files were viewed at their public URLs and transferred into +the local package as text. Direct container downloads were unavailable. All +four resulting byte strings matched their supplied full-file SHA-256 values +**before any upstream import**. Thus this is not an import of unchecked +excerpt concatenations. Source bytes were checked again after execution. + +| File relative to repository | Bytes | SHA-256 | +|---|---:|---| +| research/niemeier-lattices/workbench/paid-controller/banked.py | 4796 | 8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079 | +| research/niemeier-lattices/workbench/paid-controller/portable.py | 2800 | 95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8 | +| research/niemeier-lattices/code/costs.py | 16210 | 885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8 | +| research/leech-lattice/code/screen.py | 12756 | 6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385 | + +Each exact URL is also recorded in `EVIDENCE.json` under `source_files`. +The URL prefix is: + +https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/ + +Only `base`, `helper`, `threshold`, `invoice`, their required pressure/interval +functions, and module initialization were used from this closure. We did not +call `run()`, `source_check()`, geometric verification, a native compiler, or +any of the historical controller scans. The code's historical PR592 default +is authenticated as a constant, expressly excluded as a scientific target. + +## Model, attribution, and target references + +[S1] Dominik Scholz, PR606 and retained banked accounting: +https://github.com/CrocSwap/integer-mult-bounds/pull/606 +https://github.com/CrocSwap/integer-mult-bounds/blob/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/workbench/paid-controller/PAID-CONTROLLER.txt + +[S2] Moment screens and construction caveats: +https://github.com/CrocSwap/integer-mult-bounds/blob/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/COSTS.txt + +[S3] Upstream attribution notices: +https://github.com/CrocSwap/integer-mult-bounds/blob/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/NOTICE +https://github.com/CrocSwap/integer-mult-bounds/blob/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/leech-lattice/NOTICE + +[S4] DreamingOfClouds's original H6 response, supplied creation time +2026-10-14T04:10:46Z: +https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18914612 +The task's response-body SHA-256 is +`596422e39ead6c6f629412c052d8ef83a70611dfe4d56ad284cf208837f48cb7`. +This is a **supplied body hash**, not a newly authenticated raw-comment hash. +The visible public text was read and matched substantively to the supplied +response. It is not part of the imported code closure. + +[S5] Retained PR890 checkpoint, exact target read from its `kappa` field: +https://github.com/CrocSwap/integer-mult-bounds/blob/81e81af67714bdc8d1693b0bf5c29468b92f62ff/certificates/checkpoints/frontier890.json +`1661957774647029/1000000000000000000`. +The associated construction/certificate chain was not replayed here. + +[S6] Selected record at the task's pinned main revision, exact target read +from its `kappa` field: +https://github.com/CrocSwap/integer-mult-bounds/blob/0a201997097b8a89b638f3a2afcb35db4184c8b2/certificates/selected-result.json +`836330098538459/500000000000000000`. +The task supplies Git blob `ae6a99f28aa468649eb66a361e764d769363bf11`. +The target field was verified in the pinned public text; the complete blob +hash and selected construction were not independently replayed by this audit. +“Selected” below always means this pinned selection, not an assertion about +whatever a moving main branch might select later. + +[S7] H6 proposal provenance: +https://github.com/CrocSwap/integer-mult-bounds/pull/1590 +Task-observed head `08e134b4a0c7f04869dae703f2a2e688e53c44f0`; +H6 table reported unchanged from `8423efd138226d2d760a01b91573db186c3ca76c`. +The task's quoted PR1424 comparison is `0.001676855229071321`. +PR1424 comparison head supplied by the task: +`bfe423c24555baf35dab991a8d6fe723a038945c`. +https://github.com/CrocSwap/integer-mult-bounds/pull/1424 +No longer endpoint was substituted into that frozen comparison. + +## Later author supplement: read, not executed + +[S8] A later reply in the same discussion publicly linked an exact commit: +https://github.com/DreamingOfClouds/integer-mult-bounds/tree/b496aed769dd724cd1ff6b921cade626562be27b/research/h6-banked-breakeven +https://raw.githubusercontent.com/DreamingOfClouds/integer-mult-bounds/b496aed769dd724cd1ff6b921cade626562be27b/research/h6-banked-breakeven/price_h6.py +https://raw.githubusercontent.com/DreamingOfClouds/integer-mult-bounds/b496aed769dd724cd1ff6b921cade626562be27b/research/h6-banked-breakeven/README.md + +This was observed during the audit on 2026-10-14. It supersedes the initial +“not supplied at preparation time” status; it does not retrospectively add +scripts or a ceiling definition to the original response itself. The request +for those sources remains at: +https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18914809 + +The newly visible price script specifies float versus Fraction comparisons, +a [0, 2,000,000) search range, a longer PR1424 title target, and the ceiling +ratio. Its main loop would perform a different target/mode set. It was read +as clarification, not executed, imported, hash-authenticated, or represented +as the author's original previously unpublished implementation. Its +structure/Walsh programs and saved runs were not independently verified. + +## Coordination and scope + +https://github.com/CrocSwap/integer-mult-bounds/discussions/1635 +The claim and advisory expiry are coordination metadata, not proof premises. +The user/root retains all posting and coordination authority. No posting, +claim update, PR, installation, source-package edit, or frontier change was +performed by this audit. diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/audit.py b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/audit.py new file mode 100644 index 0000000000..3cba15842c --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/audit.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python3 +"""Exactly twelve H6 cases; original PR606 import plus exact reconstruction. + +No network, dependencies, geometry files, run(), source_check(), stage scan, +virtual helpers, bad-branch pricing, or author-supplement main program. +The only floating computation is upstream/reconstructed nomination; every +scientific sign and alpha grid cell is independently rationally certified. +""" +import argparse +import json +from pathlib import Path +import sys +sys.dont_write_bytecode = True +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from fractions import Fraction as F +import model as m +from source_bindings import authenticate, import_banked, REVISION + + +def source_controls(b): + """Negative fixtures at an existing stage, not extra comparison cases.""" + def reject(name, operation, fragment): + try: + operation() + except ValueError as exc: + m.require(fragment in str(exc), 'wrong exception for source control: '+name) + else: + raise ValueError('source guard accepted: '+name) + print('PASS SOURCE CONTROL '+name, flush=True) + reject('incomplete data path', + lambda:b.base(m.N,m.H,m.HIST,3,[15]), 'each data chain spans h-1') + r=b.base(m.N,m.H,m.HIST,3,m.DATA) + reject('ordinary helper with residual width 16', + lambda:b.helper(r,[1,7,8],False), 'ordinary helper runs from zero to full') + reject('helper exceeding ambient width', + lambda:b.helper(r,[1,7,8,2],False), 'positive helper residual') + saved=b.c.nominate + try: + # Deliberately wrong positive proposal. Only a function object in this + # temporary process is replaced; no original file bytes are modified. + b.c.nominate=lambda row: 0.019 + reject('bad floating nomination cannot certify a root', + lambda:b.invoice(m.N,m.H,m.HIST,3,m.DATA,m.HP,80558,False), + 'Certified root bracket') + finally: + b.c.nominate=saved + + +def build(): + sources = authenticate() + b = import_banked() + m.require(b.c.FRONTIER == F(1612719427075359, 10**18), + 'historical PR592 constant changed') + cases = [] + for name, target, quoted in m.TARGETS: + m.require(target != b.c.FRONTIER, 'historical default is not a case') + for k, L in enumerate((3, 5, 7)): + native_base = b.base(m.N, m.H, m.HIST, L, m.DATA) + unit, q, pad = b.helper(native_base, m.HP, False) + local_base = m.row(L) + m.require(native_base['terms'] == local_base['terms'][:-len(unit)], + 'base terms differ from source') + m.require((unit, q, pad) == + (local_base['unit'], local_base['q'], local_base['p']), + 'unit helper terms differ from source') + for field, local in [('m','m'), ('deficit','D'), ('stock','W'), ('cap','cap')]: + m.require(native_base[field] == local_base[local], 'base field '+field) + exact = m.boundary_record(L, target) + R = exact['R'] + threshold = b.threshold(m.N, m.H, m.HIST, L, m.DATA, m.HP, + target, virtual=False, bad=False) + m.require(threshold['max_helpers'] == R, 'source threshold mismatch') + if quoted is not None: + m.require(R == quoted[k], 'quoted author threshold falsified') + invoices = [] + for count in (R, R+1): + upstream = b.invoice(m.N, m.H, m.HIST, L, m.DATA, m.HP, + count, virtual=False) + endpoints, al, ah = m.invoice(L, count) + z0 = al*10**15+2 + m.require(z0.denominator == 1, 'alpha index not integral') + rec = m.invoice_record(L, count, int(z0)) + m.require(endpoints == rec['scaled_kappa_interval'] == + upstream['nominal_kappa_interval_scaled_1e18'], + 'source/reconstruction interval mismatch') + m.require(upstream['stock'] == rec['stock'], 'invoice stock mismatch') + m.require(upstream['stock_replication_factor'] == q and + upstream['helper_pad'] == pad and + upstream['max_child'] == rec['max_child_rank'], + 'invoice packing fields mismatch') + invoices.append(rec) + m.require(F(invoices[0]['scaled_kappa_interval'][0], m.SCALE) > target, + 'R fails lower endpoint criterion') + m.require(F(invoices[1]['scaled_kappa_interval'][1], m.SCALE) < target, + 'R+1 not excluded by upper endpoint') + cases.append({ + 'target_id': name, 'target': str(target), 'L': L, + 'quoted_R': None if quoted is None else quoted[k], + 'exact': exact, 'source_threshold': threshold, + 'invoice_at_R': invoices[0], 'invoice_at_R_plus_1': invoices[1], + }) + print(f"PASS {name:17s} L={L} R={R} lower(R)>target>upper(R+1)", flush=True) + m.require(len(cases) == 12, 'exactly twelve cases') + source_controls(b) + authenticate() # Imported source files must still have their original bytes. + return { + 'schema': 'h6-banked-twelve-case-audit-v1', + 'retained_source_revision': REVISION, + 'source_files': sources, + 'parameters': {'n': m.N, 'h': m.H, 'hist': {'17':256,'15':560}, + 'data':m.DATA, 'hp':m.HP, 'virtual':False, 'bad':False, + 'stages':[3,5,7], 'scale':m.SCALE}, + 'excluded_historical_default': str(b.c.FRONTIER), + 'skeletons': [m.skeleton_record(L) for L in (3,5,7)], + 'cases': cases, + } + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--output', type=Path, + help='Write a NEW evidence JSON; existing files are never overwritten') + args = parser.parse_args() + evidence = build() + if args.output: + args.output.parent.mkdir(parents=True, exist_ok=True) + with args.output.open('x', encoding='utf-8', newline='\n') as stream: + json.dump(evidence, stream, sort_keys=True, indent=2) + stream.write('\n') + print('WROTE new evidence JSON') + else: + expected = json.loads((Path(__file__).resolve().parent/'EVIDENCE.json').read_text()) + m.require(evidence == expected, 'replayed evidence differs from canonical evidence') + print('PASS exact replay equals canonical EVIDENCE.json') + +if __name__ == '__main__': + main() diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/model.py b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/model.py new file mode 100644 index 0000000000..4621dd3eb9 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/model.py @@ -0,0 +1,201 @@ +"""Independent, narrowly frozen H6 invoice reconstruction; not upstream source. + +Model and outward series: Dominik Scholz / PR606 and inherited PR598. +New exact twelve-case audit for Andrey Mas by ChatGPT. +All scientific targets are explicit; no upstream default or stage scan. +""" +from fractions import Fraction as F +from functools import lru_cache +from math import isqrt, expm1, log, floor + +SCALE = 10**18 +ROUND = 10**40 +N, H, HIST, DATA, HP = 30960,17,{17:256,15:560},[16],[1,7,8,1] +TARGETS = ( + ('author_PR890', F('0.001661957775'), (80558,89683,80753)), + ('retained_PR890', F(1661957774647029,10**18), None), + ('selected_pinned', F(836330098538459,500000000000000000), None), + ('author_PR1424', F('0.001676855229071321'), (79617,88409,79399)), +) + +def require(test, message): + if not test: raise ValueError(message) + +def ln_bounds(value, terms=24): + value=F(value) + require(value>=1,'log argument') + e=0 + while value>=2: + value/=2; e+=1 + def unit(x): + z=(x-1)/(x+1); z2=z*z; p=z; total=F(0) + for j in range(terms): + total+=p/(2*j+1); p*=z2 + return 2*total,2*total+2*p/((2*terms+1)*(1-z2)) + l,h=unit(value); l2,h2=unit(F(2)) + return l+e*l2,h+e*h2 + +def exp_bounds(lo,hi,terms=12): + require(0<=lo<=hi<1,'exp argument') + def series(x): + t=s=F(1) + for j in range(1,terms+1): t*=x/j; s+=t + return s,t + lower,_=series(lo); upper,last=series(hi) + return lower,upper+last*hi/(terms+1)/(1-hi/(terms+2)) + +def round_out(lo,hi,scale=ROUND): + return F(lo.numerator*scale//lo.denominator,scale),F(-((-hi.numerator*scale)//hi.denominator),scale) + +@lru_cache(None) +def logarithm(base): return round_out(*ln_bounds(base)) + +@lru_cache(None) +def powers(base,a): + lo,hi=logarithm(base) + return round_out(*exp_bounds(a*lo,a*hi)) + +def row(L,R=0): + require(type(L) is int and L in (3,5,7),'frozen L') + require(type(R) is int and R>=0,'nonnegative integer R') + m=16*L+1; q,p=divmod(m,17); cap=isqrt((m*m-1)//2) + # Lists of actual idle ranks for exactly these stages, before any splitting. + idle={3:[],5:[32,32,16],7:[64,32,16,32,64,16]}[L] + require(all(x<=cap for x in idle),'frozen idle ranks need no split') + terms=[(F(2*N*L*16),F(m,16)),(F(L*17*256),F(m,17)),(F(L*15*560),F(m,15))] + terms += [(F(2*N*x),F(m,x)) for x in idle] + unit=[(F(L*x),F(m,x)) for x in HP]+[(F(L*p,q),F(m,p))] + W0=(L-1)*N; D=W0-L*12752 + require(sum(x for x,_ in terms)==m*W0-D,'base mass') + require(sum(x for x,_ in unit)==F(m*L,q),'helper mass') + terms += [(R*x,b) for x,b in unit] + W=F(W0)+F(L*R,q) + require(sum(x for x,_ in terms)==m*W-D,'total mass') + require(all(m/b<=cap for _,b in terms),'child cap') + return dict(L=L,m=m,q=q,p=p,cap=cap,idle=idle,D=D,W=W,terms=terms,unit=unit) + +def pressure_terms(terms,a): + l=h=F(0) + for mass,base in terms: + pl,ph=powers(base,a); l+=mass*(pl-1); h+=mass*(ph-1) + return l,h + +def pressure(r,a): return pressure_terms(r['terms'],a) + +def boundary(L,t): + r=row(L); a=t/(1-t); lo,hi=pressure(r,a); ul,uh=pressure_terms(r['unit'],a) + require(0=0 and R 2, 'positive alpha grid index') + gl, gh = F(z, 10**15), F(z+1, 10**15) + require(pressure(r, gl)[1] < r['D'] < pressure(r, gh)[0], + 'exact alpha grid cell does not bracket root') + return gl, gh + + +def scaled_interval(al, ah): + kl, kh = al/(1+al), ah/(1+ah) + return [kl.numerator*SCALE//kl.denominator, + -((-kh.numerator*SCALE)//kh.denominator)] + + +def validate_mass_cap(r): + require(sum(mass for mass, _ in r['terms']) == r['m']*r['W']-r['D'], + 'complete mass identity') + require(all(mass >= 0 and 0 < r['m']/base <= r['cap'] + for mass, base in r['terms']), 'positive capped children') + + +def encode_interval(pair): + return [str(pair[0]), str(pair[1])] + + +def boundary_record(L, target): + """Exact target-pressure evidence, no nomination or source execution.""" + R, xl, xh = boundary(L, target) + require(strict_allowance(xl, xh) == R, 'strict threshold guard') + r0, r1 = row(L, R), row(L, R+1) + a = target/(1-target) + p0, p1 = pressure(r0, a), pressure(r1, a) + require(p0[1] < r0['D'] < p1[0], 'adjacent strict pressure signs') + return { + 'R': R, + 'alpha_target': str(a), + 'real_helper_boundary': encode_interval((xl, xh)), + 'pressure_at_R': encode_interval(p0), + 'pressure_at_R_plus_1': encode_interval(p1), + 'positive_pressure_margin_at_R': str(r0['D']-p0[1]), + 'positive_pressure_excess_at_R_plus_1': str(p1[0]-r0['D']), + 'budget_ratio_n_over_R': str(F(N, R)), + } + + +def invoice_record(L, R, z): + """Canonical invoice evidence from a supplied, exactly proved grid cell.""" + r = row(L, R) + validate_mass_cap(r) + gl, gh = exact_grid_certificate(r, z) + al, ah = F(z-2, 10**15), F(z+3, 10**15) + pl, ph = pressure(r, al), pressure(r, ah) + require(pl[1] < r['D'] < ph[0], 'invoice bracket signs') + return { + 'R': R, 'z': z, + 'alpha_grid_cell': encode_interval((gl, gh)), + 'alpha_bracket': encode_interval((al, ah)), + 'scaled_kappa_interval': scaled_interval(al, ah), + 'stock': str(r['W']), + 'rank_mass': str(sum(x for x, _ in r['terms'])), + 'pressure_at_alpha_lower': encode_interval(pl), + 'pressure_at_alpha_upper': encode_interval(ph), + 'positive_lower_bracket_margin': str(r['D']-pl[1]), + 'positive_upper_bracket_margin': str(ph[0]-r['D']), + 'max_child_rank': max(int(r['m']/b) for _, b in r['terms']), + } + + +def skeleton_record(L): + r = row(L) + base = r['terms'][:-len(r['unit'])] + def child(mass, b): + rank = r['m']/b + require(rank.denominator == 1, 'integer child rank') + return {'rank': int(rank), 'mass': str(mass), + 'count': str(mass/rank), 'base_m_over_rank': str(b)} + return { + 'L': L, 'm': r['m'], 'q': r['q'], 'pad': r['p'], 'cap': r['cap'], + 'stock_before_helpers': str(r['W']), 'deficit': r['D'], + 'idle_ranks': r['idle'], 'center_bill': 12752, + 'base_children': [child(x,b) for x,b in base], + 'unit_helper_children': [child(x,b) for x,b in r['unit']], + } diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/notices/LEECH-NOTICE.txt b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/notices/LEECH-NOTICE.txt new file mode 100644 index 0000000000..2246e973b5 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/notices/LEECH-NOTICE.txt @@ -0,0 +1,29 @@ +Prepared for DominikScholz with OpenAI GPT-6 Astra assistance in T3 Code. +Copyright 2026 DominikScholz. Apache-2.0, following the repository license. + +New work: exact Leech/Turyn generators and compatibility experiments, +dyadic cubic factorization, norm-six encoder basis, scoped cost screens, +and explicit E8 equivalence and cross-profile constraint certificates. +No improved numerical result or complete supplier is claimed. + +Mathematical attribution: +R. J. Turyn: Hamming/Golay gluing construction. +J. H. Conway and N. J. A. Sloane: Leech constructions and coset decoding. +E. Bannai and N. J. A. Sloane: minimal-shell description and spherical design. +Gabriele Nebe: polarization form and generalization of Turyn's construction. +Vincent Corlay, Joseph J. Boutros, Philippe Ciblat and Loic Brunel: +explicit three-block polarization formulation used here. +SageMath contributors: published Golay generator matrix (numerical matrix +transcribed; no Sage implementation code copied). + +The supplier model and cost interface are inherited from the community +research maintained by Douglas Colkitt, conditional on original OpenAI#109. +The E8 constructions and descendant common-frame, dirty-helper, paired-bank, +hosting and certificate interfaces credit Avi Eisenberg, Henry Grant and +Jacob Sussman, Evan McKinney, Rohan Arun, Chafik Boukhalfa, DreamingOfClouds, +Dugongue, eumemic and icekylinx, together with the earlier authors retained +in the repository's notices. Those supplier implementations are read as +source context, not republished as newly authored code in this package. + +PR588 is a comparison source, read at its recorded exact head; its declared +kappa is not represented as freshly verified by this research package. diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/notices/NIEMEIER-NOTICE.txt b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/notices/NIEMEIER-NOTICE.txt new file mode 100644 index 0000000000..e6dcbd0c68 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/notices/NIEMEIER-NOTICE.txt @@ -0,0 +1,75 @@ +Prepared for DominikScholz with OpenAI GPT-6 Astra assistance in T3 Code. +Copyright 2026 DominikScholz. Apache-2.0, following the repository license. + +User guidance: examine the other 23 rooted Niemeier lattices, following +the suggestion attributed to David Ryan (@davidryan59) in the supplied +image. Earlier user guidance on Leech, Turyn and code-space transforms +is preserved in the three predecessor packages. This is research with +no new kappa or O(1) indexing claim. + +New work: the reproducible low-shell census; D24+ and E8^3 scalar factors; +E8^2 sections; dyadic Fano elimination; the symmetric Pauli operator-space +factorization and exhaustive support/frame certificates; scoped exact +moment screens; and the complex/bit interface analysis. + +The continuation adds rational h=16 bit labels, D16+ spinor operator +transforms, exact residual/cross ranks, the scoped support obstruction, +tensor frame embeddings and paid invoices, and the clique/matching +compensation subword with earlier cleanup. OpenAI GPT-6 Astra, running +in T3 Code, developed the research, certificates, code and write-up under +DominikScholz's direction. These are research contributions, not a claim +to a new multiplication exponent or to priority for classical identities. + +Lattice classification and theta identities credit J. H. Conway, +N. J. A. Sloane, Gabriele Nebe, Shoyu Nagaoka and Sho Takemori. The E8 +geometry, Fano plane, Walsh/Hadamard transforms and Pauli matrices are +classical constructions; no priority is claimed for them. SOURCES.txt +gives primary sources. Their use and the supplier deductions here are +distinguished from claims in those sources. + +The general binary-subspace Clifford-frame construction is inherited from +icekylinx with the OpenAI GPT-6 Astra assistance credited in +notes/general-clifford-frames.tex. The common-frame scalar interface, +transparent cleanup and copied-center lineage includes Zhihao Chen / +jacklightChen, icekylinx, Jacob Sussman and the other contributors retained +in the repository and predecessor NOTICE files. Cost-source pins are in +sources/COST-SOURCES.json; INTERFACES.txt identifies the inherited +construction sources. + +The exact interval engine comes from research/leech-lattice in PR598. +The inherited hosting relaxation credits DreamingOfClouds and the +disclosed Claude Opus 5.5 assistance via Claude Code for PR595. PR592's +reported comparison and pinned assembly source credit Jeremy Kothe / +jeremykothe2 and the disclosed Claude Opus 5.5 assistance in the omp +harness. The retained bit input credits eumemic with substantial +Anthropic Claude assistance via Claude Code for PR543, and that PR's +predecessor contributors. The cited upstream circuits and endpoints +are not represented as freshly replayed here. + +The tensor transport inherits the native E8/Hamming prototype from +research/frame-sa504, credited to icekylinx with OpenAI GPT-6 Astra +assistance and its preserved Hamming-input lineage. Its exact source hash and inherited +interface are recorded beside verify_tensor.py. Its native circuit is +not freshly replayed by this contribution. The full original attribution +is retained in that predecessor package's NOTICE. + +The continuation's PR600 profiles credit Jeremy Kothe / jeremykothe2 +with the disclosed Claude Opus 5.5 assistance in the omp harness. +Its archived source files and NOTICE.md are retained without modification +in workbench/continuation/endpoint-costs/sources, with exact hashes. +PR604's contemporary proper-endpoint result credits DreamingOfClouds +with Claude Opus 5.5 via Claude Code, building on Jeremy Kothe's PR601. +This package does not claim priority over that work for ending cold +helpers in proper subspaces. PR589's stronger bit-side comparison +likewise credits DreamingOfClouds and its retained predecessor lineage. + +Related orthogonal-basis and Pauli references credit Mordecai Waegell, +P. K. Aravind, Simon Schmidt, K. Abdukhalikov, E. Bannai and S. Suda. +The binary-code background includes A. R. Calderbank, P. J. Cameron, +W. M. Kantor and J. J. Seidel. References are listed in SOURCES.txt; +the supplier deductions and finite experiments are those made here. + +The conditional supplier framework is inherited from original OpenAI #109 +and the community research maintained by Douglas Colkitt / CrocSwap. +The predecessor NOTICE files retain their full supplier lineage. Imported +source files remain unchanged; they are not presented as newly authored. diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/source_bindings.py b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/source_bindings.py new file mode 100644 index 0000000000..615ff53bff --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/source_bindings.py @@ -0,0 +1,65 @@ +"""SHA-256 gate for the exact four-file PR606 import closure. + +These are full-file hashes supplied in the public-source handoff. All four +files must authenticate before any upstream module is imported. The original +files are redistributed unchanged. This is not a geometry/source_check replay. +""" +from pathlib import Path +import hashlib +import importlib.util +import sys + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +REVISION = '81e81af67714bdc8d1693b0bf5c29468b92f62ff' +FILES = { + 'research/niemeier-lattices/workbench/paid-controller/banked.py': + '8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079', + 'research/niemeier-lattices/workbench/paid-controller/portable.py': + '95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8', + 'research/niemeier-lattices/code/costs.py': + '885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8', + 'research/leech-lattice/code/screen.py': + '6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385', +} + + +def check_bytes(data: bytes, expected: str, name: str) -> None: + if hashlib.sha256(data).hexdigest() != expected: + raise ValueError('Source SHA256 mismatch: ' + name) + + +def authenticate() -> list[dict]: + result = [] + for relative, expected in sorted(FILES.items()): + data = (HERE / 'vendor' / relative).read_bytes() + check_bytes(data, expected, relative) + result.append({'path': relative, 'bytes': len(data), 'sha256': expected, + 'url': 'https://raw.githubusercontent.com/CrocSwap/' + 'integer-mult-bounds/' + REVISION + '/' + relative}) + return result + + +def import_banked(): + """Import only after authenticating the whole closure, including screen.py.""" + authenticate() + path = HERE / 'vendor/research/niemeier-lattices/workbench/paid-controller/banked.py' + spec = importlib.util.spec_from_file_location('h6_authenticated_banked', path) + if spec is None or spec.loader is None: + raise ValueError('Unable to construct banked.py module loader') + # banked.py imports the sibling name `portable`; do not accept an unrelated + # preloaded module from a caller's environment. + saved_portable = sys.modules.pop('portable', None) + saved_path = sys.path[:] + try: + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + expected_portable = path.with_name('portable.py').resolve() + if Path(sys.modules['portable'].__file__).resolve() != expected_portable: + raise ValueError('Unexpected portable.py import location') + finally: + sys.path[:] = saved_path + sys.modules.pop('portable', None) + if saved_portable is not None: + sys.modules['portable'] = saved_portable + return module diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/leech-lattice/code/screen.py b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/leech-lattice/code/screen.py new file mode 100644 index 0000000000..10cf894ee7 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/leech-lattice/code/screen.py @@ -0,0 +1,300 @@ +#!/usr/bin/env python3 +"""Scoped Leech/controller moment relaxations; no supplier or new kappa claim.""" + +import argparse +import ast +import hashlib +from collections import Counter +from fractions import Fraction +import json +from math import isqrt +from pathlib import Path + +V = 98280 +H = 25 +FEATURES = 2600 +FRONTIER_KAPPA = Fraction(400569730495803, 250000000000000000) +FRONTIER_ALPHA = FRONTIER_KAPPA / (1 - FRONTIER_KAPPA) +FRONTIER_HEAD = "6d0e53b66c29abd17981881a09eaff41ac862d85" + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def ln_bounds(value, terms=40): + """Exact atanh-series bounds for rational value >= 1.""" + value = Fraction(value) + require(value >= 1, "log argument") + exponent = 0 + while value >= 2: + value /= 2 + exponent += 1 + + def unit_bounds(x): + z = (x - 1) / (x + 1) + z2 = z * z + power = z + total = Fraction(0) + for j in range(terms): + total += power / (2 * j + 1) + power *= z2 + remainder = 2 * power / ((2 * terms + 1) * (1 - z2)) + return 2 * total, 2 * total + remainder + + low, high = unit_bounds(value) + low2, high2 = unit_bounds(Fraction(2)) + return low + exponent * low2, high + exponent * high2 + + +def exp_bounds(low, high, terms=20): + """Positive Taylor sums; geometric majorant of the omitted tail.""" + require(0 <= low <= high < 1, "exponential interval") + + def series(x): + term = total = Fraction(1) + for j in range(1, terms + 1): + term *= x / j + total += term + return total, term + + lower, _ = series(low) + upper, last = series(high) + next_term = last * high / (terms + 1) + upper += next_term / (1 - high / (terms + 2)) + return lower, upper + + +def power_bounds(base): + low, high = ln_bounds(base) + return exp_bounds(FRONTIER_ALPHA * low, FRONTIER_ALPHA * high) + + +def nominal_root(terms, denominator): + """Floating nomination only; exact comparison is computed separately.""" + if sum(mass for mass, _ in terms) >= denominator: + return 0.0 + low, high = 0.0, 1.0 + for _ in range(70): + mid = (low + high) / 2 + moment = sum(mass * base ** mid for mass, base in terms) + if moment < denominator: + low = mid + else: + high = mid + return float(format(low / (1 + low), ".12g")) + + +def exact_frontier_comparison(terms, denominator): + low = high = Fraction(0) + for mass, base in terms: + a, b = power_bounds(base) + low += mass * a + high += mass * b + low = low / denominator - 1 + high = high / denominator - 1 + scale = 10**18 + lower_scaled = low.numerator * scale // low.denominator + upper_scaled = -((-high.numerator * scale) // high.denominator) + verdict = ("STRICTLY_BELOW_FRONTIER" if low > 0 else + "RELAXATION_HAS_HEADROOM" if high < 0 else "UNDECIDED") + return dict(verdict=verdict, normalized_moment_excess_interval_scaled_1e18= + [lower_scaled, upper_scaled]) + + +def case(center_rank, pairs): + stages = 2 * pairs + 1 + m = (H - 1) * stages + 1 + live = 2 * pairs * V + cap = isqrt(m * m // 2) + center_bill = FEATURES * center_rank + deficit = 2 * pairs * V - stages * center_bill + denominator = m * live + total_mass = denominator - deficit + fixed_mass = 2 * V * stages * (H - 1) + residual_mass = total_mass - fixed_mass + require(residual_mass >= 0 and cap >= H, "relaxation inputs") + + # The maximally coalesced, zero-helper paired-controller profile. + profile = Counter({H - 1: 2 * V * stages + 2 * (pairs - 1) * V}) + profile[center_rank] += FEATURES * stages + for j in range(1, pairs): + rank = 2 * j * (H - 1) + full, remainder = divmod(rank, cap) + profile[cap] += 4 * V * full + if remainder: + profile[remainder] += 4 * V + profile = {r: n for r, n in sorted(profile.items()) if n} + require(sum(r * n for r, n in profile.items()) == total_mass, "mass identity") + require(max(profile) <= cap, "two-level cap") + profile_terms = [(r * n, m / r) for r, n in profile.items()] + + # Keep only mandatory local data paths. Every other paid mass is allowed + # to form fractional children of the maximum permitted rank. + relaxed_terms = [(fixed_mass, Fraction(m, H - 1)), + (residual_mass, Fraction(m, cap))] + return dict(pairs=pairs, stages=stages, m=m, live=live, cap=cap, + center_rank=center_rank, center_bill=center_bill, + deficit=deficit, total_mass=total_mass, + mandatory_local_data_mass=fixed_mass, + relaxed_other_mass=residual_mass, + zero_helper_fixed_profile=profile, + zero_helper_fixed_profile_nominal_kappa= + nominal_root(profile_terms, denominator), + all_other_mass_at_cap_nominal_kappa=nominal_root( + [(mass, float(base)) for mass, base in relaxed_terms], denominator), + all_other_mass_at_cap_frontier_check= + exact_frontier_comparison(relaxed_terms, denominator)) + + +def basis(vectors): + rows = {} + for x in vectors: + for p in sorted(rows, reverse=True): + if x >> p & 1: + x ^= rows[p] + if x: + p = x.bit_length() - 1 + for q in rows: + if rows[q] >> p & 1: + rows[q] ^= x + rows[p] = x + return tuple(rows[p] for p in sorted(rows, reverse=True)) + + +def perp(vectors, h=25): + rows = basis(vectors) + pivots = {r.bit_length() - 1 for r in rows} + out = [] + for j in range(h): + if j in pivots: + continue + x = 1 << j + for row in rows: + if row >> j & 1: + x |= 1 << (row.bit_length() - 1) + out.append(x) + return basis(out) + + +def distance(a, b): + return 2 * len(basis(a + b)) - len(basis(a)) - len(basis(b)) + + +def fiber(size): + ports = {1: [1], 2: [1, 7], 4: [1, 7, 25, 31]}[size] + u = basis(ports) + f = tuple(1 << j for j in range(25)) + up = perp(u) + gram = [[(x & y).bit_count() % 2 for y in ports] for x in ports] + require(all(all(row) for row in gram), "all-ones Gram") + walsh = [[(-1)**((i & j).bit_count()) for j in range(size)] for i in range(size)] + square = [[sum(walsh[i][k] * walsh[k][j] for k in range(size)) + for j in range(size)] for i in range(size)] + require(square == [[size * (i == j) for j in range(size)] + for i in range(size)], "Walsh inverse") + source = [distance((ports[0],), u), distance(u, f)] + target = [distance((), up), distance(up, perp((ports[0],)))] + relabeled_source = [distance((ports[0],), u), distance(u, (ports[-1],)), + distance((ports[-1],), f)] + require(sum(source) == sum(target) == 24, "mass preserving thick paths") + return dict(size=size, ports=ports, common_frame=list(u), rank=len(u), + binary_gram=gram, restricted_gram_rank=1, + radical_dimension=len(u)-1, walsh=walsh, + inverse_walsh_denominator=size, + source_path_ranks=source, target_path_ranks=target, + relabeled_source_path_ranks=relabeled_source, + both_side_relabel_extra_per_port=2*(sum(relabeled_source)-24)) + + +def moment_case(pairs, center_rank, transformed_sides, port_counts): + v = sum(port_counts.values()) + stages = 2 * pairs + 1 + m = 24 * stages + 1 + cap = isqrt(m*m//2) + denominator = m * 2 * pairs * v + center_bill = 2600 * center_rank + deficit = 2 * pairs * v - stages * center_bill + mandatory = Counter({24: (2-transformed_sides)*v*stages}) + for active_blocks, count in port_counts.items(): + for rank in (active_blocks-1, 25-active_blocks): + if rank: + mandatory[rank] += transformed_sides * count * stages + mandatory = {r: n for r, n in sorted(mandatory.items()) if n} + mass = sum(r*n for r, n in mandatory.items()) + require(mass == 2*v*stages*24, "unchanged mandatory data rank mass") + other = denominator - deficit - mass + terms = [(r*n, Fraction(m, r)) for r, n in mandatory.items()] + terms.append((other, Fraction(m, cap))) + return dict(pairs=pairs, stages=stages, m=m, cap=cap, + center_rank=center_rank, center_bill=center_bill, + transformed_sides=transformed_sides, mandatory_profile=mandatory, + mandatory_mass=mass, other_mass=other, deficit=deficit, + nominal_kappa=nominal_root( + [(a, float(b)) for a, b in terms], denominator), + exact_frontier_comparison=exact_frontier_comparison(terms, denominator)) + + + +def main(): + parser = argparse.ArgumentParser() + root = Path(__file__).resolve().parents[1] + parser.add_argument("--out", type=Path, default=root / "evidence/SCREEN.json") + parser.add_argument("--verify", action="store_true") + args = parser.parse_args() + sources = json.loads((root / "sources/FRONTIER-SOURCES.json").read_text()) + pr_blob = (root / "sources/PR588.json").read_bytes() + require(hashlib.sha256(pr_blob).hexdigest() == sources["files"]["PR588.json"], "PR588 source hash") + pr = json.loads(pr_blob) + require(pr["headRefOid"] == FRONTIER_HEAD, "PR588 exact head") + require("0.001602278921983212" in pr["title"], "PR588 title target") + baseline = [case(rank, k) for rank in (24, 25) for k in range(1, 51)] + for row in baseline: + if row["center_rank"] == 25: + require(row["all_other_mass_at_cap_frontier_check"]["verdict"] == + "STRICTLY_BELOW_FRONTIER", "full-rank center relaxation") + counts = {1: 360, 2: 5760, 3: 92160} + cases = [moment_case(k, rank, sides, counts) + for sides in (1, 2) for rank in (24, 25) for k in range(1, 51)] + summaries = [] + for sides in (1, 2): + for rank in (24, 25): + rows = [x for x in cases if x["center_rank"] == rank and x["transformed_sides"] == sides] + best = max(rows, key=lambda x:x["nominal_kappa"]) + failed = sum(x["exact_frontier_comparison"]["verdict"] == "STRICTLY_BELOW_FRONTIER" for x in rows) + if sides == 2: + require(failed == 50, "every two-sided case must fail target") + summaries.append(dict(transformed_sides=sides, center_rank=rank, + best_pairs=best["pairs"], best_nominal_kappa=best["nominal_kappa"], + exact_below_frontier_count=failed)) + gather_cost = sum(count * (active - 1) for active, count in counts.items()) + require(gather_cost == 190080 > V, "full-fiber source clone cost") + clone_rows = [dict(pairs=k, stages=2*k+1, effective_center_bill=62400+gather_cost, + deficit=2*k*V-(2*k+1)*(62400+gather_cost)) for k in range(1, 51)] + require(all(x["deficit"] < 0 for x in clone_rows), "clone rank deficit") + result = dict(status="PASS_SCOPED_LEECH_AND_TURYN_MOMENT_SCREENS", + frontier=dict(pr=588, head=FRONTIER_HEAD, kappa=str(FRONTIER_KAPPA), + alpha=str(FRONTIER_ALPHA), freshly_replayed=False), + geometry_parameters=dict(v=V, h=H, polynomial_features=FEATURES, + port_counts_by_active_blocks=counts), + parameter_scope="Center ranks24/25 are supplied scenarios. This script does not construct the dyadic factorization or a scalar side supplier.", + engine="Fraction log/exp intervals (40/20 terms) at the nominal target; floating roots rounded to12 significant digits are discovery estimates only", + pair_range=[1,50], baseline=baseline, + fibers=[fiber(n) for n in (1,2,4)], turyn_summaries=summaries, turyn_cases=cases, + source_clone=dict(extra_rank_per_local_call=gather_cost, + proof="Even with zero center bill, D=(L-1)*v-L*gather_cost is negative for every positive L because gather_cost>v.", + cases=clone_rows), + both_side_relabel_extra_rank_per_local_call=4*gather_cost, + scope="Paired controller, original individual-port endpoints, supplied center bill, and floor(m/sqrt2) child cap. Turyn bounds additionally require full common-frame Walsh mixing on every sign fiber. Partial transforms and other interfaces are not excluded.") + serialized = json.dumps(result, indent=2)+"\n" + if args.verify: + require(json.loads(args.out.read_text()) == json.loads(serialized), "stored SCREEN.json") + else: + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(serialized) + print(json.dumps(dict(status=result["status"], turyn_summaries=summaries))) + + +if __name__ == "__main__": + main() diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/niemeier-lattices/code/costs.py b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/niemeier-lattices/code/costs.py new file mode 100644 index 0000000000..e6ed87c2e8 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/niemeier-lattices/code/costs.py @@ -0,0 +1,314 @@ +"""Exact necessary moment screens; no scalar word or exponent claim.""" +from fractions import Fraction +from functools import lru_cache +import hashlib +import importlib.util +import json +from math import expm1, floor, log +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +RESEARCH = ROOT.parent +FRONTIER = Fraction(1612719427075359, 10**18) +FACTORS = (Fraction(1), Fraction(11, 10), Fraction(6, 5), Fraction(3, 2), Fraction(2)) +INTERVAL_SCALE = 10**40 + + +def require(value, message): + if not value: + raise ValueError(message) + + +def source_check(): + specification = json.loads((ROOT/'sources/COST-SOURCES.json').read_text()) + for name, digest in specification['inherited_files'].items(): + require(hashlib.sha256((RESEARCH/name).read_bytes()).hexdigest() == digest, f'Cost source hash: {name}') + for name, digest in specification['repository_files'].items(): + require(hashlib.sha256((RESEARCH.parent/name).read_bytes()).hexdigest() == digest, + f'Frame lemma source hash: {name}') + for name, source in specification['bit_source_files'].items(): + require(hashlib.sha256((ROOT/'sources'/name).read_bytes()).hexdigest() == source['sha256'], + f'Bit comparison source hash: {name}') + bit_data = (ROOT/'sources/PR543-EXPECTED.json').read_bytes() + blob = b'blob '+str(len(bit_data)).encode()+b'\0'+bit_data + require(hashlib.sha1(blob).hexdigest() == specification['bit_citation']['git_blob_sha1'], + 'Original cited bit receipt blob') + require(FRONTIER == Fraction(specification['frontier']['declared_kappa']), 'Pinned comparison value') + return specification + + +def verify_input_links(specification, receipts=None): + """Bind cost parameters to independently replayed geometry or stated bounds.""" + names = ('E8-CUBED.json', 'E8-SECTIONS.json', 'D24.json') + if receipts is None: + receipts = {name: json.loads((ROOT/'evidence'/name).read_text()) for name in names} + cube, sections, d24 = (receipts[name] for name in names) + section = {case['blocks']: case for case in sections['cases']} + expected = {} + + def add(name, ports, h, histogram, source): + expected[name] = dict(ports=ports, binary_dimension=h, + center_width_histogram=histogram, source=source) + + add('E8_cubed_verified_factor', cube['norm_four_lines'], cube['fitting']['dimension'], + cube['factorization']['center_width_histogram'], 'E8-CUBED.json: factorization') + add('E8_cubed_all_full_width_fallback', cube['norm_four_lines'], cube['fitting']['dimension'], + {'25': cube['factorization']['center_count']}, 'E8-CUBED.json: all centers charged at ambient width') + for blocks, word in ((2, 'squared'), (3, 'cubed')): + case = section[blocks] + for suffix, field in (('Fano_factor', 'coordinate_factorization'), + ('Pauli_factor', 'operator_factorization')): + add(f'E8_{word}_{suffix}', case['port_count'], case['fitting']['dimension'], + case[field]['center_width_histogram'], f'E8-SECTIONS.json: blocks={blocks}, {field}') + add('D24_verified_factor', d24['port_count'], d24['binary_dimension'], + d24['center_width_histogram'], 'D24.json: full factor') + omitted = d24['omitted_axis_variant'] + add('D24_omit_axes', omitted['port_count'], d24['binary_dimension'], + omitted['center_width_histogram'], 'D24.json: omitted_axis_variant') + # Restrict the certified unary identity to two blocks. Each block has + # 56 repeated cubics, 56 distinct cubics and 16 unary centers; each + # ordered block pair has 8*36 mixed centers. Full ambient width is safe. + unary_count = 2*(56+56+16)+2*8*36 + add('E8_squared_unary_factor', section[2]['port_count'], section[2]['fitting']['dimension'], + {'17': unary_count}, 'E8-CUBED.json: two-block restriction, ambient-width upper bound') + add('E8_squared_pair_only', section[2]['port_count']-2*cube['e8_norm_four_lines'], + section[2]['fitting']['dimension'], {'17': unary_count}, + 'Same two-block factor restricted to pair ports, ambient-width upper bound') + add('E8_root_reference', cube['e8_root_lines'], 9, {'9': 8}, + 'Inherited eight-coordinate E8 root unit, ambient-width bound') + add('D24_root_coordinate_unit', 24*23, 23, {'23': 24}, + 'D_n root-coordinate formula at n=24') + require(len(specification['cases']) == len(expected), 'Complete cost input coverage') + require({case['name'] for case in specification['cases']} == set(expected), 'Unique cost case names') + for case in specification['cases']: + link = expected[case['name']] + require(all(case[key] == link[key] for key in + ('ports', 'binary_dimension', 'center_width_histogram')), + f'Cost input disagrees with geometry: {case["name"]}') + return expected + + +path = RESEARCH/'leech-lattice/code/screen.py' +spec = importlib.util.spec_from_file_location('frozen_niemeier_moment_bounds', path) +engine = importlib.util.module_from_spec(spec) +spec.loader.exec_module(engine) + + +@lru_cache(maxsize=None) +def logarithm(base): + low, high = engine.ln_bounds(base, terms=24) + return rounded_bounds(low, high) + + +def rounded_bounds(low, high): + # Outward rounding keeps all later sums on one rational denominator. + # This preserves the proof intervals and avoids enormous denominator lcms. + return (Fraction(low.numerator*INTERVAL_SCALE//low.denominator, INTERVAL_SCALE), + Fraction(-((-high.numerator*INTERVAL_SCALE)//high.denominator), INTERVAL_SCALE)) + + +@lru_cache(maxsize=None) +def power_bounds(base, alpha): + low, high = logarithm(base) + lower, upper = engine.exp_bounds(alpha*low, alpha*high, terms=12) + return rounded_bounds(lower, upper) + + +def idle_slots(stages, d): + pairs = (stages-1)//2 + slots = [2*(pairs-1)*d] if pairs > 1 else [] + for pair in range(1, pairs): + slots.extend((2*pair*d, d)) + if pairs-pair-1: + slots.append(2*(pairs-pair-1)*d) + return slots + + +def instance(n, h, histogram, stages, relaxed=False): + require(n > 0 and h >= 2 and stages >= 3 and stages % 2 == 1, 'Moment parameters') + require(all(1 <= width <= h and count >= 0 for width, count in histogram.items()), 'Center widths') + d, m = h-1, (h-1)*stages+1 + bill = sum(width*count for width, count in histogram.items()) + deficit = (stages-1)*n-stages*bill + terms = [(2*n*stages*d, Fraction(m, d))] + terms.extend((stages*width*count, Fraction(m, h if relaxed else width)) + for width, count in sorted(histogram.items()) if count) + terms.extend((2*n*rank, Fraction(m, max(rank, h))) for rank in idle_slots(stages, d)) + require(sum(mass for mass, _ in terms) == m*(stages-1)*n-deficit, 'Exact forced rank-mass identity') + return dict(ports=n, binary_dimension=h, center_bill=bill, stages=stages, m=m, + stock=(stages-1)*n, deficit=deficit, terms=terms) + + +def pressure_bounds(row, alpha): + low = high = Fraction(0) + for mass, base in row['terms']: + lower, upper = power_bounds(base, alpha) + low += mass*(lower-1) + high += mass*(upper-1) + return low, high + + +def nominate(row): + if row['deficit'] <= 0: + return 0. + lo, hi = 0., .02 + for _ in range(60): + a = (lo+hi)/2 + p = sum(mass*expm1(a*log(float(base))) for mass, base in row['terms']) + if p < row['deficit']: + lo = a + else: + hi = a + return lo + + +def scaled(low, high, scale=10**18): + return [low.numerator*scale//low.denominator, -((-high.numerator*scale)//high.denominator)] + + +def bracket(row): + integer = floor(nominate(row)*10**15) + lo, hi = Fraction(integer-2, 10**15), Fraction(integer+3, 10**15) + require(pressure_bounds(row, lo)[1] < row['deficit'] < pressure_bounds(row, hi)[0], 'Certified root bracket') + return lo, hi + + +def tail_bound(n, h, bill, alpha, start): + # Active climbs and the (L-3)/2 bridge slots alone suffice. Each term + # of this divided-by-L bound increases for real L >= start >= 3. + d = h-1 + log_l = logarithm(Fraction(start))[0] + log_bridge = logarithm(Fraction(d*start+1, h))[0] + lower = d*alpha*(2*log_l+(1-Fraction(3, start))*log_bridge) + return lower, Fraction(n-bill, n) + + +def dominates(row, alpha): + linear = alpha*sum(mass*logarithm(base)[0] for mass, base in row['terms']) + return linear > row['deficit'] or pressure_bounds(row, alpha)[0] > row['deficit'] + + +def compare(row, target): + alpha = target/(1-target) + low, high = pressure_bounds(row, alpha) + slack = row['deficit']-high, row['deficit']-low + return dict(target_kappa=str(target), slack_interval_scaled_1e12=scaled(*slack, 10**12), + verdict='NOMINAL_HEADROOM' if slack[0] > 0 else 'FAILS_NECESSARY_SCREEN' if slack[1] < 0 else 'UNDECIDED') + + +def optimize(n, h, histogram, relaxed=False): + bill = sum(width*count for width, count in histogram.items()) + if bill >= n: + return dict(status='NO_POSITIVE_DEFICIT', center_bill=bill, + proof='D=L*(N-C)-N is negative for every positive stage count') + limit = 101 + while True: + rows = [instance(n, h, histogram, stages, relaxed) for stages in range(3, limit+1, 2)] + best = max(rows, key=nominate) + low, high = bracket(best) + tail_low, tail_right = tail_bound(n, h, bill, low, limit) + if tail_low > tail_right: + break + limit = 2*limit-1 + require(limit <= 3201, 'Finite tail search resource bound') + require(all(row is best or row['deficit'] <= 0 or dominates(row, low) for row in rows), + 'Selected stage strictly dominates every other finite candidate') + return dict(status='CERTIFIED_GLOBAL_ODD_STAGE_MAXIMUM', best_stages=best['stages'], m=best['m'], + center_bill=bill, stock=best['stock'], deficit=best['deficit'], + kappa_interval_scaled_1e18=scaled(low/(1+low), high/(1+high)), + finite_odd_stage_range=[3, limit], tail_start=limit, + tail_pressure_lower_bound=str(tail_low), tail_deficit_upper_bound=str(tail_right), + comparisons=[compare(best, FRONTIER*factor) for factor in FACTORS]) + + +def extra_children_budget(row, target, child_rank, copies_per_call=1): + alpha = target/(1-target) + low, high = pressure_bounds(row, alpha) + slack = row['deficit']-high, row['deficit']-low + power_low, power_high = power_bounds(Fraction(row['m'], child_rank), alpha) + cost_low = row['stages']*copies_per_call*child_rank*power_low + cost_high = row['stages']*copies_per_call*child_rank*power_high + if slack[0] < 0: + return dict(child_rank=child_rank, copies_per_call=copies_per_call, admissible_count=0) + lower, upper = slack[0]/cost_high, slack[1]/cost_low + lo, hi = lower.numerator//lower.denominator, upper.numerator//upper.denominator + require(lo == hi, 'Exact integer additional-child budget') + require(lo*cost_high < slack[0] and (lo+1)*cost_low > slack[1], + 'Strict admissibility and rejection of the next child count') + return dict(child_rank=child_rank, copies_per_call=copies_per_call, admissible_count=lo, + scope='Additional paid children in every local call, no stock change and no hosting credit') + + +def center_threshold(h, target): + alpha = target/(1-target) + candidates = [] + for stages in range(3, 102, 2): + row = instance(1, h, {}, stages, True) + low, high = pressure_bounds(row, alpha) + pl, ph = power_bounds(Fraction(row['m'], h), alpha) + numerator_low, numerator_high = stages-1-high, stages-1-low + # Once the numerator is negative, C >= 0 cannot pass at this stage. + if numerator_high <= 0: + continue + require(numerator_low > 0, 'Resolved center-threshold numerator sign') + candidates.append((numerator_low/(stages*ph), numerator_high/(stages*pl), stages)) + best = max(candidates, key=lambda item: item[0]) + require(all(item is best or item[1] < best[0] for item in candidates), 'Exact optimal center threshold stage') + tl, tr = tail_bound(1, h, best[0], alpha, 101) + require(tl > tr, 'All later stages have smaller center threshold') + return dict(binary_dimension=h, target_kappa=str(target), best_stages=best[2], + maximum_center_bill_per_port_interval_scaled_1e12=scaled(best[0], best[1], 10**12), + scope='Relaxed center cap h and inherited hosting-aware slots; a necessary threshold') + + +def run(): + sources = source_check() + specification = json.loads((ROOT/'evidence/COST-INPUTS.json').read_text()) + links = verify_input_links(specification) + results = [] + for case in specification['cases']: + histogram = {int(width): count for width, count in case['center_width_histogram'].items()} + results.append(dict(name=case['name'], input_scope=case['scope'], + fixed_center_widths=optimize(case['ports'], case['binary_dimension'], histogram), + relaxed_center_cap=optimize(case['ports'], case['binary_dimension'], histogram, True))) + budgets = [] + for name in specification['budget_cases']: + candidate = next(case for case in specification['cases'] if case['name'] == name) + histogram = {int(width): count for width, count in candidate['center_width_histogram'].items()} + h = candidate['binary_dimension'] + for stages in (3, 5, 7, 9): + row = instance(candidate['ports'], h, histogram, stages) + entries = [] + for factor in FACTORS: + target = FRONTIER*factor + entries.append(dict(**compare(row, target), additional_children=[ + extra_children_budget(row, target, rank, copies) + for rank, copies in ((1, 1), (h-1, 2))])) + budgets.append(dict(candidate=name, stages=stages, m=row['m'], stock=row['stock'], deficit=row['deficit'], + idle_rank_mass=sum(2*candidate['ports']*rank for rank in idle_slots(stages, h-1)), targets=entries)) + catalog = json.loads((ROOT/'catalog.json').read_text()) + uniform = [] + cap = center_threshold(25, FRONTIER) + cap_upper = Fraction(cap['maximum_center_bill_per_port_interval_scaled_1e12'][1], 10**12) + for lattice in catalog['lattices']: + ratio = Fraction(65000, lattice['norm4_lines']) + require(ratio > cap_upper, 'Uniform catalog baseline fails for all odd stages') + uniform.append(dict(root_system=lattice['root_system'], ports=lattice['norm4_lines'], + hypothetical_center_bill_per_port=str(ratio), + result='FAILS_FRONTIER_FOR_EVERY_ODD_STAGE')) + bit = json.loads((ROOT/'sources/PR543-EXPECTED.json').read_text())['nine'] + bit_low = Fraction(bit['bit_lower']) + bit_high = bit_low+Fraction(1, 10**24) + return dict(status='PASS_SCOPED_NIEMEIER_MOMENT_SCREENS', sources=sources, + geometry_input_links=links, cases=results, + additional_child_budgets=budgets, + cited_bit_limitation=dict(moment_lower=str(bit_low), claimed_rejected_next_endpoint=str(bit_high), + nominal_outer_cap_interval_scaled_1e18=scaled(bit_low/(1+bit_low), bit_high/(1+bit_high)), + maximum_gain_over_frontier_percent_interval_scaled_1e12=scaled( + 100*(bit_low/(1+bit_low)/FRONTIER-1), 100*(bit_high/(1+bit_high)/FRONTIER-1), 10**12), + scope='Retained PR543 bit supplier as cited and repriced by PR592. These upstream moment endpoints were read, not freshly replayed here. Larger overall gains require improving the bit supplier as well.'), + necessary_center_thresholds=[center_threshold(h, FRONTIER*factor) + for h in (23, 25) for factor in (1, Fraction(6, 5))], + uniform_catalog_baseline=uniform, + uniform_catalog_scope='Hypothetical h=25 and 2600 centers of width 25 for each norm-four shell; no rank, labeling, support or factorization claim for the other lattices', + scope='Necessary one-supplier moment screens only. No native scalar word, helper inventory, physical hosting, bit supplier or outer transfer is supplied; no overall kappa improvement is claimed.') diff --git a/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/niemeier-lattices/workbench/paid-controller/banked.py b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/niemeier-lattices/workbench/paid-controller/banked.py new file mode 100644 index 0000000000..6357b37fba --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_banked_invoice_audit/vendor/research/niemeier-lattices/workbench/paid-controller/banked.py @@ -0,0 +1,101 @@ +from pathlib import Path +import sys +sys.dont_write_bytecode = True +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from portable import PACKAGE, output_path, source_name +"""Conditional complete rank invoices, not native scalar words or supplier admission.""" +from fractions import Fraction as F +from pathlib import Path +import importlib.util,json,math +P=PACKAGE / 'code/costs.py' +s=importlib.util.spec_from_file_location('niemeier_costs',P);c=importlib.util.module_from_spec(s);s.loader.exec_module(c) + +def parts(total,cap): + if total==0:return [] + k=(total+cap-1)//cap + return [total//k+(i2r^2') + c.require(sum(x for x,_ in terms)==m*W-D,'base rank-mass identity') + return dict(ports=n,h=h,m=m,stages=L,deficit=D,stock=F(W),terms=terms,cap=cap) + +def helper(r,profile,virtual=False): + w=sum(profile);h=r['h'];m=r['m'];e=h-w + c.require(0 target > F(upper_next,m.SCALE), + 'strict scaled endpoint separation') + m.require(set(case) == {'target_id','target','L','quoted_R','exact', + 'source_threshold','invoice_at_R','invoice_at_R_plus_1'}, + 'unexpected/missing case fields') + + +def validate(evidence): + m.require(evidence['schema'] == 'h6-banked-twelve-case-audit-v1', 'schema') + m.require(evidence['retained_source_revision'] == REVISION, 'source revision') + m.require(evidence['source_files'] == authenticate(), 'source manifest') + m.require(evidence['parameters'] == { + 'n':m.N,'h':m.H,'hist':{'17':256,'15':560},'data':m.DATA,'hp':m.HP, + 'virtual':False,'bad':False,'stages':[3,5,7],'scale':m.SCALE}, + 'frozen parameter bindings') + m.require(evidence['excluded_historical_default'] == + str(F(1612719427075359,10**18)), 'historical default binding') + m.require(evidence['skeletons'] == [m.skeleton_record(L) for L in (3,5,7)], + 'rank-mass skeletons') + m.require(len(evidence['cases']) == 12, 'exact twelve-case coverage') + j = 0 + for name,target,quoted in m.TARGETS: + for k,L in enumerate((3,5,7)): + validate_case(evidence['cases'][j], name,target,L, + None if quoted is None else quoted[k]) + j += 1 + m.require(set(evidence) == {'schema','retained_source_revision','source_files', + 'parameters','excluded_historical_default','skeletons','cases'}, + 'unexpected/missing top-level evidence fields') + + +def controls(evidence): + result = [] + def rejected(name, operation): + try: + operation() + except ValueError: + result.append({'control':name,'result':'REJECTED as required'}) + else: + raise ValueError('Negative control was accepted: '+name) + + path = next(iter(FILES)) + original = (HERE/'vendor'/path).read_bytes() + rejected('one-byte source mutation before import', + lambda: check_bytes(bytes([original[0]^1])+original[1:], FILES[path],path)) + r = m.row(3,80558) + without_pad = deepcopy(r) + without_pad['terms'].pop() + rejected('helper children without paid pad', lambda:m.validate_mass_cap(without_pad)) + stock_only = deepcopy(r) + stock_only['W'] += F(r['L'],r['q']) + rejected('one extra banked stock share without children', + lambda:m.validate_mass_cap(stock_only)) + children_only = deepcopy(r) + children_only['terms'] += r['unit'] + rejected('one helper of children without stock',lambda:m.validate_mass_cap(children_only)) + bad_cap = deepcopy(r) + mass,_ = bad_cap['terms'][0] + bad_cap['terms'][0] = (mass,F(r['m'],r['cap']+1)) + rejected('over-cap child with unchanged total mass',lambda:m.validate_mass_cap(bad_cap)) + + cases = evidence['cases'] + def case_test(case, index): + name,target,quoted = m.TARGETS[index//3] + L = (3,5,7)[index%3] + validate_case(case,name,target,L,None if quoted is None else quoted[index%3]) + fake = deepcopy(cases[3]); fake['target']=str(m.TARGETS[0][1]) + rejected('rounded PR890 silently substituted for retained target', + lambda:case_test(fake,3)) + fake = deepcopy(cases[6]); fake['target']=str(F(1612719427075359,10**18)) + rejected('historical FRONTIER silently substituted for selected target', + lambda:case_test(fake,6)) + fake = deepcopy(cases[0]); fake['exact']['R']+=1 + rejected('R+1 falsely relabeled as admissible maximum',lambda:case_test(fake,0)) + fake = deepcopy(cases[0]); fake['invoice_at_R']['scaled_kappa_interval'][0]+=1 + rejected('one-unit forged lower scaled endpoint',lambda:case_test(fake,0)) + fake = deepcopy(cases[0]); fake['invoice_at_R']['z']+=1 + rejected('wrong exact alpha grid cell',lambda:case_test(fake,0)) + incomplete = deepcopy(evidence); incomplete['cases'].pop() + rejected('omitted twelfth scientific case',lambda:validate(incomplete)) + rejected('extra stage L=9',lambda:m.row(9)) + rejected('exact strict-boundary tie is not resolved by floor', + lambda:m.strict_allowance(F(3),F(3))) + rejected('interval crossing integer is left unresolved', + lambda:m.strict_allowance(F(299,100),F(301,100))) + rejected('invalid logarithm range',lambda:m.ln_bounds(F(1,2))) + rejected('invalid exponential range',lambda:m.exp_bounds(F(0),F(1))) + + # A concrete same-row control that separates semantics. This is NOT a + # thirteenth comparison target: it tests equality at an output endpoint. + example = cases[0] + count = example['exact']['R'] + s = example['invoice_at_R']['scaled_kappa_interval'][0] + synthetic_t = F(s,m.SCALE) + exact_pressure = m.pressure(m.row(3,count),synthetic_t/(1-synthetic_t)) + m.require(not F(s,m.SCALE)>synthetic_t, 'rounded-lower equality must fail strict test') + m.require(exact_pressure[1] 10^18 * u. +``` + +Equality fails. All six complete endpoint pairs below are certified from +rational pressure signs, not accepted from floating nomination: + +| L | R | lower(R) | upper(R) | lower(R+1) | upper(R+1) | +|---:|---:|---:|---:|---:|---:| +| 3 | 79617 | 1676856209287933 | 1676856209292917 | 1676840242697020 | 1676840242702004 | +| 5 | 88409 | 1676857789885697 | 1676857789890681 | 1676845992570138 | 1676845992575122 | +| 7 | 79399 | 1676859227320794 | 1676859227325778 | 1676848128885528 | 1676848128890513 | + +In every row, **lower(R) > 10^18 t > upper(R+1)**. The evidence contains +exact positive pressure margins and rational root brackets for these rows. +The source-bound mode separately checks equality with the actual six +`banked.invoice` receipts. + +The target-independent alpha-grid proposals are + +``` +L3: 1679672779019, 1679656758746 +L5: 1679674364931, 1679662527951 +L7: 1679675807199, 1679664671449 +``` + +For each proposed z, the checker proves that the true alpha root lies +strictly between z/10^15 and (z+1)/10^15. It reconstructs the wider source +bracket [(z-2)/10^15, (z+3)/10^15], checks its pressure signs, and computes +the scaled endpoints by exact floor/ceiling. The inherited grid proposals +are therefore checked witnesses, not assumed numerical facts. + +## Exact pressure boundary and maximality + +Use the original, unchanged PR606 banked model: + +``` +n=30960; h=17; hist={17:256,15:560}; data=[16]; hp=[1,7,8,1] +virtual=False; bad=False; L in {3,5,7} +C=12752; m=16L+1; W0=(L-1)n; D=W0-LC +q=floor(m/17); p=m-17q +``` + +Write a=t/(1-t), and let P0(a) be base pressure. The unit-helper pressure is + +``` +H(a) = L [2(m^a-1) + 7((m/7)^a-1) + 8((m/8)^a-1) + + (p/q)((m/p)^a-1)]. +``` + +The exact real helper boundary is x=(D-P0(a))/H(a). Outward rational +logarithm/exponential bounds, inherited unchanged from the original model, +certify the following containing intervals. The decimal endpoints here +are exact rationals with denominator 10^6, not floating approximations: + +| L | Certified containing interval for x | +|---:|---| +| 3 | [79617.061391, 79617.061392] | +| 5 | [88409.217066, 88409.217067] | +| 7 | [79399.360252, 79399.360253] | + +Each interval lies strictly inside (R,R+1). The full tighter rational +intervals, target-alpha fractions, and adjacent pressure enclosures are in +`APPENDIX_EVIDENCE.json`. In particular, P_R(a)0 for +alpha>0, and the positive root of P_R=D decreases strictly with R. Since +the certified upper endpoint at R+1 is already below t, all larger counts +have true roots below t. Any successfully returned certified lower endpoint +is below its true root. Together with the accepted lower endpoint at R, +this proves maximality over all nonnegative integer counts, not merely the +author's finite [0,2000000) search bracket. + +No monotonicity of floating nomination or the program's rounded output is +assumed. No assertion is made that the source can successfully bracket the +root for every arbitrarily large helper count. + +The source `threshold()` floors an outward enclosure of x. Strict +admissibility is R t : true +s / 1e18 > float(full_target_decimal_string) : false +``` + +The float failure is equality: both rounded quantities are exactly + +``` +3866564907417535 / 2305843009213693952. +``` + +The unrounded endpoint exceeds t by exactly + +``` +113793618782662107 / 10**36. +``` + +This is a synthetic comparison control, not an additional H6 invoice or +an assertion that this scaled integer occurs in a tested source receipt. +It falsifies general equivalence of the two predicates without disputing +any of the reported helper counts. + +The appendix implements binary64 nearest-even rounding using integers and +Fractions. Every tested s is below 2^53, so conversion of s is exact; +10^18 is also exactly representable as binary64. A single rational +nearest-even rounding of s/10^18 therefore models the source division. +The default checker uses no machine float in any acceptance calculation. +The source mode additionally checks native binary64 quotients and target +conversion against these exact dyadic witnesses. + +At lower(R), lower(R+1), and upper(R+1), the exact and binary64 predicates +agree for all three stages. For larger counts, a successfully returned +lower integer endpoint is bounded above by the already-excluded scaled +upper endpoint at R+1. Monotonicity of integer-to-binary64 conversion and +positive division, and the checked float failure at that upper endpoint, +exclude all those larger counts in the float convention as well. This is +not an assumption of monotonicity of the source's computed endpoint as a +function of R. + +The shorter and full targets are distinct, but both have the same floor +after multiplication by 10^18. Consequently their exact strict predicates +on integer lower endpoints happen to coincide. This observation does not +identify their exact pressure tests; those were re-certified separately +for the longer target in this appendix. + +## Producer replay: what the new source establishes + +The supplied coordinator receipt reports isolated Python 3.12.14 normal +and optimized executions of only the unchanged author `price_h6.py`, both +with exit 0, no stderr, and stdout SHA256 + +``` +d4f360504140738815dffccc9ff5d46e3e5783fc63289786e69b31b4befe50a3 +``` + +matching the saved author output and all 18 printed boundary rows. This is +coordinator-reported producer replay, not an execution witnessed in this +appendix. The local coordinator receipt path is recorded in +`SOURCE_UPDATE.json`; that local file was not available to open here. + +The author program's upper-bracket guard is an `assert`, removed under +`-O`. Its final boundary check only prints a failure label. Therefore an +exit-0 optimized run alone is not fail-closed verification, and one +adjacent output check alone is not a global monotonicity proof. The proof +above supplies the needed maximality reasoning for these cases. The new +checker instead uses explicit exception guards, active under `-O`. + +This appendix does not execute the author's main program, reproduce its +search trace, or claim independent implementation agreement for targets +not checked here. Original twelve-case results remain the original study. + +## Source authentication and execution in this appendix + +The four original PR606 dependency files and the unchanged original +`model.py` and `source_bindings.py` authenticate before use. The included +4,211-byte author pricing script was transcribed from the supplied verbatim +text and matched full-file SHA256 + +``` +ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a +``` + +Its pinned public text was also read. The script is only hash-checked and +AST-parsed; it is not imported or executed. Direct container download was +unavailable, so this appendix does not claim a fresh full-package byte +fetch. The other author-package hashes and complete-chain authentication +are coordinator-supplied source evidence, clearly separated in +`SOURCE_UPDATE.json`. + +Actual local execution here used Python 3.13.5. Rational and source modes +passed normally and under `-O`; regeneration of evidence and control +receipts was byte-identical. Ten rejection controls and three groups of +positive controls passed. Separate end-to-end mutated-target runs failed +in both modes of optimization, and overwriting existing evidence was +refused. Python 3.12 grammar compatibility was checked for ten Python +files; this is not Python 3.12 runtime execution. See `RUN_LOG.txt` and +`EXECUTION.json`. No original twelve-case entrypoint was rerun. + +## Replay files and transfer inventory + +For the original default twelve-case replay, retain these eight Python +files and `EVIDENCE.json`, at their original relative paths: + +``` +audit.py +verify_certificate.py +model.py +source_bindings.py +vendor/research/leech-lattice/code/screen.py +vendor/research/niemeier-lattices/code/costs.py +vendor/research/niemeier-lattices/workbench/paid-controller/banked.py +vendor/research/niemeier-lattices/workbench/paid-controller/portable.py +``` + +The first four are original audit code; the last four are unchanged pinned +repository dependencies. No historical data, author package, geometry +receipt, installation, or network access is needed. To regenerate instead +of compare to the canonical receipt, the eight Python files suffice: + +``` +python3.12 -I -B audit.py --output /tmp/h6-recomputed.json +python3.12 -I -B verify_certificate.py /tmp/h6-recomputed.json +``` + +Use a new output path; existing files are refused. Default replay without +`--output` additionally needs the original `EVIDENCE.json`. `CONTROLS.json` +is an optional canonical control receipt. License/NOTICE files preserve +redistribution attribution but are not runtime inputs. + +For this appendix, only six of those original files are needed: `model.py`, +`source_bindings.py`, and the four vendor dependencies. Neither original +entrypoint nor original `EVIDENCE.json` is needed. Keep this directory next +to the original directory, then run: + +``` +python3.12 -I -B appendix.py +python3.12 -I -B -O appendix.py +python3.12 -I -B appendix.py --source +python3.12 -I -B -O appendix.py --source +``` + +These commands assume the current directory is the appendix directory. +Use `--original /path/to/h6_banked_invoice_audit` for another location. +The appendix default additionally reads `APPENDIX_EVIDENCE.json` and +`author_source/price_h6.py`. `--output /new/path.json` regenerates evidence. + +`ORIGINAL_INVENTORY.tsv` lists every original member plus the unchanged +original archive. The separately delivered `h6_combined_inventory.tsv` +lists every original and appendix payload file and both ZIPs, with exact +byte counts, SHA256, role, and replay-use flags. It excludes only its own +bytes; its own size and SHA256 are provided in the final chat to avoid a +self-hash cycle. Every necessary original Python file is under 19,000 +bytes, and the new checker and new evidence file also fit individually +under that limit. No base64 transfer is supplied. + +`APPENDIX_EVIDENCE.json` and `CONTROLS.json` are deterministic generated +outputs, actually checked for byte-identical regeneration. Execution logs +and environment receipts are observations, not platform-independent +outputs. Inventories are deterministic functions of the frozen bytes. + +## Meaning, exclusions, and attribution + +The helper path still has mass 17, with q=(2,4,6), paid pads p=(15,13,11), +and caps (34,57,79). Every helper adds stock L/q and child rank mass Lm/q, +so total mass remains m(W0+LR/q)-D. The rank-mass identity and actual child +caps are checked in the reused exact model. A helper remains a physical +restored bank-register role under the original banking hypotheses, not +one term or copy occurrence. This appendix supplies no loading, capacity, +chronology, arbitrary-dirt restoration, or physical packing construction. + +The unchanged K factor, encoder extras beyond base terms, frame-zero +precompensation, target cap-15/FULL restriction, restoration, spectators +and padding beyond helper_pad, and any sharing with other stages retain +all original obligations. No geometry or structure/Walsh program was run. +The ratio 30960/R remains a budget ratio, not measured throughput. + +The now-defined paper ceiling is exactly the ratio of printed values + +``` +0.006945535353 / 0.004515128332 = 6945535353 / 4515128332 +``` + +which prints as 1.538281. These are zero-helper paper-level values. This +is not a newly certified ratio of fully paid constructions, a bit-side +cap result, a five-percent priority gate, a selected-frontier gain, +supplier admission, or a new kappa. + +Model/geometry: Dominik Scholz, merged PR606, and the retained original +NOTICE files. H6 interpretation, script, and published numbers: +DreamingOfClouds, with Claude Opus 5.5 via Claude Code. New mathematical and +arithmetic appendix: ChatGPT (GPT-6 Astra Pro) for Andrey Mas, with Codex +source coordination and separately reported local mechanical replay. +The two appendix modes reuse the original `model.py`; they are not +independently authored or code-disjoint verifiers. No independent human +review or formal verification is claimed. No external publication or +frontier change was performed. + +Pinned public references (source text is data, not execution authority): + +``` +https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18914905 +https://raw.githubusercontent.com/DreamingOfClouds/integer-mult-bounds/b496aed769dd724cd1ff6b921cade626562be27b/research/h6-banked-breakeven/price_h6.py +https://raw.githubusercontent.com/DreamingOfClouds/integer-mult-bounds/b496aed769dd724cd1ff6b921cade626562be27b/research/h6-banked-breakeven/outputs/price_h6.txt +https://raw.githubusercontent.com/DreamingOfClouds/integer-mult-bounds/b496aed769dd724cd1ff6b921cade626562be27b/research/niemeier-lattices/COSTS.txt +``` diff --git a/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/APPENDIX_EVIDENCE.json b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/APPENDIX_EVIDENCE.json new file mode 100644 index 0000000000..4fed04613f --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/APPENDIX_EVIDENCE.json @@ -0,0 +1,398 @@ +{ + "author_source": { + "bytes": 4211, + "imported_or_executed": false, + "path": "author_source/price_h6.py", + "revision": "b496aed769dd724cd1ff6b921cade626562be27b", + "sha256": "ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a" + }, + "binary64_control": { + "binary64_first_passing_scaled_integer": 1676855229071323, + "binary64_target": "3866564907417535/2305843009213693952", + "control": "synthetic scaled integer, NOT an added invoice case", + "evidence": { + "binary64_above": false, + "binary64_value": "3866564907417535/2305843009213693952", + "endpoint_rounding_error": "-827484184601/8796093022208000000000000000000", + "exact_above": true, + "exact_endpoint_minus_target": "113793618782662107/1000000000000000000000000000000000000", + "scaled_endpoint": 1676855229071322 + }, + "exact_first_passing_scaled_integer": 1676855229071322, + "target_rounding_error": "661678587131391016667599/33554432000000000000000000000000000000000000" + }, + "cases": [ + { + "L": 3, + "comparison_evidence": [ + { + "binary64_above": true, + "binary64_value": "3866567167643155/2305843009213693952", + "endpoint_rounding_error": "-787387369189/8796093022208000000000000000000", + "exact_above": true, + "exact_endpoint_minus_target": "980216611113793618782662107/1000000000000000000000000000000000000", + "scaled_endpoint": 1676856209287933 + }, + { + "binary64_above": false, + "binary64_value": "7733060702382235/4611686018427387904", + "endpoint_rounding_error": "14545066311/3518437208883200000000000000000", + "exact_above": false, + "exact_endpoint_minus_target": "-14986374301886206381217337893/1000000000000000000000000000000000000", + "scaled_endpoint": 1676840242697020 + }, + { + "binary64_above": false, + "binary64_value": "1933265175601305/1152921504606846976", + "endpoint_rounding_error": "358532588209/4398046511104000000000000000000", + "exact_above": false, + "exact_endpoint_minus_target": "-14986369317886206381217337893/1000000000000000000000000000000000000", + "scaled_endpoint": 1676840242702004 + } + ], + "comparisons_order": [ + "lower(R)", + "lower(R+1)", + "upper(R+1)" + ], + "exact": { + "R": 79617, + "alpha_target": "1676855229071321886206381217337893/998323144770928678113793618782662107", + "budget_ratio_n_over_R": "10320/26539", + "positive_pressure_excess_at_R_plus_1": "530443843212697189053171404416544523339/2500000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "277556898805660905778483773234383357631/20000000000000000000000000000000000000000", + "pressure_at_R": [ + "118319930610775298584773532167459349355860731/5000000000000000000000000000000000000000", + "473279722443101194339094221516226765616642369/20000000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "59160530443843212697189053171404416544523339/2500000000000000000000000000000000000000", + "236642121775372850788756259109273334218952017/10000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "119985768296543868936811442362492051591113312/1507035881502412806098900773300940420555", + "29996442074135967234202862210795678569893856/376758970375603201524725116494577728649" + ] + }, + "helper_boundary_outward_1e6": [ + "79617061391/1000000", + "4976066337/62500" + ], + "invoice_at_R": { + "R": 79617, + "alpha_bracket": [ + "1679672779017/1000000000000000", + "839836389511/500000000000000" + ], + "alpha_grid_cell": [ + "1679672779019/1000000000000000", + "83983638951/50000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "773969733618312004009362939430761/20000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "31853792051829306287997762020241/1000000000000000000000000000000000000000", + "rank_mass": "17724531/2", + "scaled_kappa_interval": [ + 1676856209287933, + 1676856209292917 + ], + "stock": "362691/2", + "z": 1679672779019 + }, + "invoice_at_R_plus_1": { + "R": 79618, + "alpha_bracket": [ + "209957094843/125000000000000", + "1679656758749/1000000000000000" + ], + "alpha_grid_cell": [ + "839828379373/500000000000000", + "1679656758747/1000000000000000" + ], + "max_child_rank": 17, + "positive_lower_bracket_margin": "335705124268291863538641792693099/10000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "184912191513593300653037515531899/5000000000000000000000000000000000000000", + "rank_mass": "8862339", + "scaled_kappa_interval": [ + 1676840242697020, + 1676840242702004 + ], + "stock": "181347", + "z": 1679656758746 + } + }, + { + "L": 5, + "comparison_evidence": [ + { + "binary64_above": true, + "binary64_value": "7733141624506919/4611686018427387904", + "endpoint_rounding_error": "-1561011758577/17592186044416000000000000000000", + "exact_above": true, + "exact_endpoint_minus_target": "2560814375113793618782662107/1000000000000000000000000000000000000", + "scaled_endpoint": 1676857789885697 + }, + { + "binary64_above": false, + "binary64_value": "7733087218991701/4611686018427387904", + "endpoint_rounding_error": "26604328717/17592186044416000000000000000000", + "exact_above": false, + "exact_endpoint_minus_target": "-9236501183886206381217337893/1000000000000000000000000000000000000", + "scaled_endpoint": 1676845992570138 + }, + { + "binary64_above": false, + "binary64_value": "3866543609507343/2305843009213693952", + "endpoint_rounding_error": "694004674999/8796093022208000000000000000000", + "exact_above": false, + "exact_endpoint_minus_target": "-9236496199886206381217337893/1000000000000000000000000000000000000", + "scaled_endpoint": 1676845992575122 + } + ], + "comparisons_order": [ + "lower(R)", + "lower(R+1)", + "upper(R+1)" + ], + "exact": { + "R": 88409, + "alpha_target": "1676855229071321886206381217337893/998323144770928678113793618782662107", + "budget_ratio_n_over_R": "30960/88409", + "positive_pressure_excess_at_R_plus_1": "1328422223732770685374982954169588151771/4000000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "29464171220957368817448069534578138913/320000000000000000000000000000000000000", + "pressure_at_R": [ + "480639263395719476065779449790374740271562511/8000000000000000000000000000000000000000", + "19225570535828779042631182551930465421861087/320000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "240321328422223732770685374982954169588151771/4000000000000000000000000000000000000000", + "240321328422223732770685431987308809443086003/4000000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "33334682799678007942830858628652159901481856/377049858665497287922241817331482182759", + "300012145197102071485477768959570828978247168/3393448727989475591300175533598904741031" + ] + }, + "helper_boundary_outward_1e6": [ + "44204608533/500000", + "88409217067/1000000" + ], + "invoice_at_R": { + "R": 88409, + "alpha_bracket": [ + "1679674364929/1000000000000000", + "839837182467/500000000000000" + ], + "alpha_grid_cell": [ + "1679674364931/1000000000000000", + "419918591233/250000000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "180946614839981212832844177693969/2000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "354807754279478848153907470852261/4000000000000000000000000000000000000000", + "rank_mass": "75689485/4", + "scaled_kappa_interval": [ + 1676857789885697, + 1676857789890681 + ], + "stock": "937405/4", + "z": 1679674364931 + }, + "invoice_at_R_plus_1": { + "R": 88410, + "alpha_bracket": [ + "1679662527949/1000000000000000", + "839831263977/500000000000000" + ], + "alpha_grid_cell": [ + "1679662527951/1000000000000000", + "104978907997/62500000000000" + ], + "max_child_rank": 32, + "positive_lower_bracket_margin": "401019232363856067881342969572801/4000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "157843397492732537925165113836201/2000000000000000000000000000000000000000", + "rank_mass": "37844945/2", + "scaled_kappa_interval": [ + 1676845992570138, + 1676845992575122 + ], + "stock": "468705/2", + "z": 1679662527951 + } + }, + { + "L": 7, + "comparison_evidence": [ + { + "binary64_above": true, + "binary64_value": "7733148253506259/4611686018427387904", + "endpoint_rounding_error": "1369758660571/17592186044416000000000000000000", + "exact_above": true, + "exact_endpoint_minus_target": "3998249472113793618782662107/1000000000000000000000000000000000000", + "scaled_endpoint": 1676859227320794 + }, + { + "binary64_above": false, + "binary64_value": "1933274267751879/1152921504606846976", + "endpoint_rounding_error": "-6941043537/4398046511104000000000000000000", + "exact_above": false, + "exact_endpoint_minus_target": "-7100185793886206381217337893/1000000000000000000000000000000000000", + "scaled_endpoint": 1676848128885528 + }, + { + "binary64_above": false, + "binary64_value": "7733097071030505/4611686018427387904", + "endpoint_rounding_error": "-999756134783/17592186044416000000000000000000", + "exact_above": false, + "exact_endpoint_minus_target": "-7100180808886206381217337893/1000000000000000000000000000000000000", + "scaled_endpoint": 1676848128890513 + } + ], + "comparisons_order": [ + "lower(R)", + "lower(R+1)", + "upper(R+1)" + ], + "exact": { + "R": 79399, + "alpha_target": "1676855229071321886206381217337893/998323144770928678113793618782662107", + "budget_ratio_n_over_R": "30960/79399", + "positive_pressure_excess_at_R_plus_1": "2460502256357578624073934480167421217/6000000000000000000000000000000000000", + "positive_pressure_margin_at_R": "110843815790019177131651324854158486029/480000000000000000000000000000000000000", + "pressure_at_R": [ + "2894873072261513123801428683219260173716192793/30000000000000000000000000000000000000000", + "46317969156184209980822868348675145841513971/480000000000000000000000000000000000000" + ], + "pressure_at_R_plus_1": [ + "578978460502256357578624073934480167421217/6000000000000000000000000000000000000", + "723723075627820446973280239562516367202693577/7500000000000000000000000000000000000000" + ], + "real_helper_boundary": [ + "3053739058241294184853567593073839187176386784/38460499537328183383372915737707432302241", + "1526869529120647092426784009696272320335150800/19230249768664091691686453140663389892207" + ] + }, + "helper_boundary_outward_1e6": [ + "19849840063/250000", + "79399360253/1000000" + ], + "invoice_at_R": { + "R": 79399, + "alpha_bracket": [ + "1679675807197/1000000000000000", + "839837903601/500000000000000" + ], + "alpha_grid_cell": [ + "1679675807199/1000000000000000", + "2099594759/1250000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "8495426085798999975932385539635627/60000000000000000000000000000000000000000", + "positive_upper_bracket_margin": "4386715795096454201531636424173269/30000000000000000000000000000000000000000", + "rank_mass": "188170913/6", + "scaled_kappa_interval": [ + 1676859227320794, + 1676859227325778 + ], + "stock": "1670353/6", + "z": 1679675807199 + }, + "invoice_at_R_plus_1": { + "R": 79400, + "alpha_bracket": [ + "1679664671447/1000000000000000", + "419916167863/250000000000000" + ], + "alpha_grid_cell": [ + "1679664671449/1000000000000000", + "33593293429/20000000000000" + ], + "max_child_rank": 64, + "positive_lower_bracket_margin": "130730358075929308280901180250993/937500000000000000000000000000000000000", + "positive_upper_bracket_margin": "370926211927147339326053089426753/2500000000000000000000000000000000000000", + "rank_mass": "94085852/3", + "scaled_kappa_interval": [ + 1676848128885528, + 1676848128890513 + ], + "stock": "835180/3", + "z": 1679664671449 + } + } + ], + "full_minus_short": "886206381217337893/1000000000000000000000000000000000000", + "original_code": [ + { + "bytes": 7547, + "path": "model.py", + "sha256": "d18c4c589e37de077d29120d7b4688ad6a335cd63d225f93621a2573cd23cd80" + }, + { + "bytes": 2845, + "path": "source_bindings.py", + "sha256": "f247b8a5ef341737318af2d926808b92d26d90ff6db9abf2f714ba132ff6f335" + } + ], + "paper_ratio": { + "denominator_printed": "0.004515128332", + "exact_ratio": "6945535353/4515128332", + "fully_paid_improvement_certified": false, + "numerator_printed": "0.006945535353" + }, + "parameters": { + "bad": false, + "data": [ + 16 + ], + "h": 17, + "hist": { + "15": 560, + "17": 256 + }, + "hp": [ + 1, + 7, + 8, + 1 + ], + "n": 30960, + "stages": [ + 3, + 5, + 7 + ], + "virtual": false + }, + "retained_short_target": "1676855229071321/1000000000000000000", + "schema": "h6-full-pr1424-appendix-v1", + "target_decimal": "0.001676855229071321886206381217337893", + "target_fraction": "1676855229071321886206381217337893/1000000000000000000000000000000000000", + "target_id": "author_PR1424_full_title", + "target_scale": 1000000000000000000, + "unchanged_PR606_dependencies": [ + { + "bytes": 12756, + "path": "research/leech-lattice/code/screen.py", + "sha256": "6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/leech-lattice/code/screen.py" + }, + { + "bytes": 16210, + "path": "research/niemeier-lattices/code/costs.py", + "sha256": "885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/code/costs.py" + }, + { + "bytes": 4796, + "path": "research/niemeier-lattices/workbench/paid-controller/banked.py", + "sha256": "8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/workbench/paid-controller/banked.py" + }, + { + "bytes": 2800, + "path": "research/niemeier-lattices/workbench/paid-controller/portable.py", + "sha256": "95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/81e81af67714bdc8d1693b0bf5c29468b92f62ff/research/niemeier-lattices/workbench/paid-controller/portable.py" + } + ] +} diff --git a/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/SOURCE_UPDATE.json b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/SOURCE_UPDATE.json new file mode 100644 index 0000000000..0638db5ed4 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/SOURCE_UPDATE.json @@ -0,0 +1,44 @@ +{ + "appendix_source_acquisition": { + "COSTS.txt": "Pinned public text read with web tool; no local full-byte fetch in this appendix.", + "README.md": "Coordinator-supplied hash only; not fetched or parsed in this appendix.", + "direct_container_download": "Unavailable; no successful network fetch claimed.", + "original_dependency_chain": "All four local archived full-file SHA256 values matched before import and after execution.", + "price_h6.py": "Supplied verbatim full text transcribed to UTF-8 LF bytes; SHA256 matched; pinned public text also read. AST parsed only.", + "price_h6.txt": "Pinned public text read with web tool; no local full-byte fetch or producer replay in this appendix." + }, + "author_comment": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18914905", + "author_commit": "b496aed769dd724cd1ff6b921cade626562be27b", + "coordinator_report": { + "cwd_files_created_reported": false, + "normal_exit_code": 0, + "normal_seconds": "0.873577", + "optimized_exit_code": 0, + "optimized_seconds": "0.891861", + "printed_boundary_checks": 18, + "python": "3.12.14", + "receipt_file_opened_here": false, + "receipt_path": "work/coordination/h6-author-price-replay/RECEIPT.json", + "script": "price_h6.py", + "source": "User-supplied receipt transcription, not locally witnessed execution", + "source_bytes_unchanged_reported": true, + "stderr": "empty in both runs", + "stdout_sha256_both": "d4f360504140738815dffccc9ff5d46e3e5783fc63289786e69b31b4befe50a3", + "structure_walsh_executed_reported": false + }, + "coordinator_supplied_full_file_sha256": { + "COSTS.txt": "8feebf99fdfcdbdffc6217ce3f24e9a459b0275eaff72769a68e05342ad56ca4", + "README.md": "0ca2f3011d848bb216584d932d23d587df8c637fbe755cf0697c4e11dcb5663f", + "outputs/price_h6.txt": "d4f360504140738815dffccc9ff5d46e3e5783fc63289786e69b31b4befe50a3", + "price_h6.py": "ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a" + }, + "paper_ceiling_definition": "Ratio of the printed zero-helper paper-level values .006945535353 and .004515128332, not a fully paid improvement.", + "unproved_obligations": [ + "helper loading/capacity", + "compensation chronology and arbitrary-dirt restoration", + "fully paid local profile", + "supplier admission", + "bit-side cap", + "selected-frontier gain" + ] +} diff --git a/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/appendix.py b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/appendix.py new file mode 100644 index 0000000000..d4a7e82880 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/appendix.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python3 +"""Three full-title PR1424 cases only; offline, fail-closed H6 appendix. + +Default: exact rational pressure/grid verification, including a rational +binary64 rounding model; no upstream execution or floating nomination. +--source: additionally replay 3 threshold calls and 6 adjacent invoices in +unchanged, hash-authenticated PR606, and check native binary64 comparisons. +Never executes price_h6.py's main program or any structure/Walsh program. +""" +import argparse +import ast +from copy import deepcopy +from fractions import Fraction as F +import hashlib +import importlib.util +import json +from pathlib import Path +import sys +sys.dont_write_bytecode = True + +HERE = Path(__file__).resolve().parent +TARGET_TEXT = '0.001676855229071321886206381217337893' +TARGET = F(TARGET_TEXT) +SHORT = F('0.001676855229071321') +SCALE = 10**18 +# Proposals inherited from original target-independent row certificates. +# Each cell is re-proved; no floating nomination is used to accept it. +SEEDS = {3:(1679672779019,1679656758746), + 5:(1679674364931,1679662527951), + 7:(1679675807199,1679664671449)} +EXPECTED = {3:79617,5:88409,7:79399} +ORIGINAL_CODE = { + 'model.py':'d18c4c589e37de077d29120d7b4688ad6a335cd63d225f93621a2573cd23cd80', + 'source_bindings.py':'f247b8a5ef341737318af2d926808b92d26d90ff6db9abf2f714ba132ff6f335'} +AUTHOR_SHA = 'ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a' +AUTHOR_REV = 'b496aed769dd724cd1ff6b921cade626562be27b' + + +def require(value, message): + if not value: + raise ValueError(message) + + +def check_bytes(data, expected, name): + require(hashlib.sha256(data).hexdigest() == expected, 'SHA256 mismatch: '+name) + + +def load_module(path, name): + spec = importlib.util.spec_from_file_location(name, path) + require(spec is not None and spec.loader is not None, 'module loader') + result = importlib.util.module_from_spec(spec) + spec.loader.exec_module(result) + return result + + +def load_original(root): + code = [] + for name, sha in sorted(ORIGINAL_CODE.items()): + data = (root/name).read_bytes() + check_bytes(data, sha, name) + code.append(dict(path=name, bytes=len(data), sha256=sha)) + bindings = load_module(root/'source_bindings.py', 'h6_appendix_bindings') + dependencies = bindings.authenticate() # bytes only, before upstream import + model = load_module(root/'model.py', 'h6_appendix_model') + return model, bindings, code, dependencies + + +def author_binding(): + path = HERE/'author_source/price_h6.py' + data = path.read_bytes() + check_bytes(data, AUTHOR_SHA, 'author price_h6.py') + tree = ast.parse(data, filename=str(path)) # parse, never import or execute + values = [ast.literal_eval(node.value) for node in tree.body + if isinstance(node, ast.Assign) and any( + isinstance(t, ast.Name) and t.id == 'TARGETS' for t in node.targets)] + require(values == [{'#890 as used (rounded)':'0.001661957775', + '#890 title (exact)':'0.001661957774647029', + '#1424 title (exact)':TARGET_TEXT}], 'author target literal binding') + return dict(path='author_source/price_h6.py', bytes=len(data), sha256=AUTHOR_SHA, + revision=AUTHOR_REV, imported_or_executed=False) + + +def nearest_binary64(x): + """Exact nearest-even rounding for positive normal binary64 values only.""" + x = F(x) + require(x > 0, 'binary64 positive domain') + e = x.numerator.bit_length()-x.denominator.bit_length() + if x < F(2)**e: + e -= 1 + require(-1022 <= e <= 1023, 'binary64 normal domain') + step = F(2)**(e-52) + y = x/step + q, r = divmod(y.numerator, y.denominator) + if 2*r > y.denominator or (2*r == y.denominator and q % 2): + q += 1 + answer = q*step + require(answer <= F(2)**1024-F(2)**971, 'binary64 finite rounding') + require(abs(answer-x) <= step/2, 'binary64 outward error bound') + return answer + + +def comparison_record(s): + require(type(s) is int and 0 < s < 2**53, 'exact integer-to-binary64 range') + x = F(s,SCALE) + fx, ft = nearest_binary64(x), nearest_binary64(TARGET) + return {'scaled_endpoint':s, 'exact_above':x>TARGET, + 'binary64_above':fx>ft, 'binary64_value':str(fx), + 'endpoint_rounding_error':str(fx-x), + 'exact_endpoint_minus_target':str(x-TARGET)} + + +def compact_invoice(m, L, count, z): + rec = m.invoice_record(L,count,z) + return {key:rec[key] for key in ( + 'R','z','alpha_grid_cell','alpha_bracket','scaled_kappa_interval', + 'stock','rank_mass','max_child_rank', + 'positive_lower_bracket_margin','positive_upper_bracket_margin')} + + +def make_case(m,L): + exact = m.boundary_record(L,TARGET) + R = exact['R'] + require(R == EXPECTED[L], 'claimed full-title threshold falsified') + left = compact_invoice(m,L,R,SEEDS[L][0]) + right = compact_invoice(m,L,R+1,SEEDS[L][1]) + s = left['scaled_kappa_interval'][0] + unext = right['scaled_kappa_interval'][1] + require(F(s,SCALE)>TARGET>F(unext,SCALE), 'strict adjacent scaled endpoints') + comparisons = [comparison_record(v) for v in ( + s,right['scaled_kappa_interval'][0],unext)] + require([a['exact_above'] for a in comparisons] == [True,False,False], + 'exact boundary comparisons') + require([a['binary64_above'] for a in comparisons] == [True,False,False], + 'binary64 boundary comparisons') + xl,xh = map(F,exact['real_helper_boundary']) + coarse = m.round_out(xl,xh,10**6) + return dict(L=L, exact=exact, + helper_boundary_outward_1e6=[str(x) for x in coarse], + invoice_at_R=left, invoice_at_R_plus_1=right, + comparisons_order=['lower(R)','lower(R+1)','upper(R+1)'], + comparison_evidence=comparisons) + + +def rounding_control(): + k = TARGET*SCALE + lower = k.numerator//k.denominator + require(lower == 1676855229071321, 'scaled target floor') + require(SHORT*SCALE == lower and lower < k < lower+1, + 'short and full targets have same integer endpoint cutoff') + s = lower+1 + rec = comparison_record(s) + require(rec['exact_above'] and not rec['binary64_above'], + 'float/Fraction disagreement control') + require(nearest_binary64(F(s,SCALE)) == nearest_binary64(TARGET), + 'control fails float strictness by equality') + require(comparison_record(s+1)['binary64_above'], 'next scaled integer passes float') + return dict(control='synthetic scaled integer, NOT an added invoice case', + exact_first_passing_scaled_integer=s, + binary64_first_passing_scaled_integer=s+1, + evidence=rec, binary64_target=str(nearest_binary64(TARGET)), + target_rounding_error=str(nearest_binary64(TARGET)-TARGET)) + + +def build(m, code, deps): + return dict(schema='h6-full-pr1424-appendix-v1', + target_id='author_PR1424_full_title', target_decimal=TARGET_TEXT, + target_fraction=str(TARGET), target_scale=SCALE, + retained_short_target=str(SHORT), full_minus_short=str(TARGET-SHORT), + original_code=code, unchanged_PR606_dependencies=deps, + author_source=author_binding(), + parameters=dict(n=30960,h=17,hist={'17':256,'15':560},data=[16], + hp=[1,7,8,1],virtual=False,bad=False,stages=[3,5,7]), + cases=[make_case(m,L) for L in (3,5,7)], + binary64_control=rounding_control(), + paper_ratio=dict(numerator_printed='0.006945535353', + denominator_printed='0.004515128332', + exact_ratio=str(F('0.006945535353')/F('0.004515128332')), + fully_paid_improvement_certified=False)) + + +def validate(got, expected): + require(got == expected, 'appendix evidence differs from exact recomputation') + + +def controls(m,evidence): + names = [] + def rejected(name,operation): + try: + operation() + except ValueError: + names.append(name) + else: + raise ValueError('Control accepted: '+name) + for name, mutate in ( + ('short target silently substituted',lambda x:x.update(target_decimal=str(SHORT))), + ('an extra fourth stage case',lambda x:x['cases'].append(deepcopy(x['cases'][0]))), + ('one endpoint forged',lambda x:x['cases'][0]['invoice_at_R']['scaled_kappa_interval'].__setitem__(0,0)), + ('R+1 falsely admitted',lambda x:x['cases'][0]['exact'].__setitem__('R',79618)), + ('one pressure margin forged',lambda x:x['cases'][0]['exact'].__setitem__('positive_pressure_margin_at_R','0'))): + bad=deepcopy(evidence); mutate(bad) + rejected(name,lambda:validate(bad,evidence)) + rejected('wrong positive grid cell',lambda:m.invoice_record(3,79617,SEEDS[3][0]+1)) + rejected('integer pressure tie unresolved',lambda:m.strict_allowance(F(3),F(3))) + rejected('straddled pressure interval unresolved',lambda:m.strict_allowance(F(299,100),F(301,100))) + rejected('one author-source byte changed',lambda:check_bytes( + (HERE/'author_source/price_h6.py').read_bytes()+b' ',AUTHOR_SHA,'mutated copy')) + rejected('binary64 nonpositive domain',lambda:nearest_binary64(F(0))) + # Halfway fixtures exercise both parity branches of nearest-even rounding. + require(nearest_binary64(F(1)+F(1,2**53)) == F(1), 'even tie rounds down') + require(nearest_binary64(F(1)+F(3,2**53)) == F(1)+F(1,2**51), 'odd tie rounds up') + return dict(rejected=names, positive=[ + 'nearest-even binary64 halfway fixtures', + 'same full-target synthetic integer distinguishes exact from float', + 'three exact adjacent pressure and endpoint certificates']) + + +def replay_source(m,bindings,evidence): + require(sys.float_info.radix == 2 and sys.float_info.mant_dig == 53 and + sys.float_info.rounds == 1, 'native binary64 nearest rounding required') + b = bindings.import_banked() + for case in evidence['cases']: + L = case['L']; R = case['exact']['R'] + base = b.base(m.N,m.H,m.HIST,L,m.DATA) + unit,q,pad = b.helper(base,m.HP,False) + local = m.row(L) + require(base['terms'] == local['terms'][:-len(unit)] and + (unit,q,pad) == (local['unit'],local['q'],local['p']), 'source skeleton') + result = b.threshold(m.N,m.H,m.HIST,L,m.DATA,m.HP,TARGET,False,False) + require(result['max_helpers'] == R, 'source threshold differs') + for key in ('invoice_at_R','invoice_at_R_plus_1'): + rec=case[key] + inv=b.invoice(m.N,m.H,m.HIST,L,m.DATA,m.HP,rec['R'],False) + require(inv['nominal_kappa_interval_scaled_1e18']==rec['scaled_kappa_interval'], + 'source adjacent endpoints differ') + require(inv['stock']==rec['stock'] and inv['deficit']==local['D'] and + inv['stock_replication_factor']==q and inv['helper_pad']==pad and + inv['max_child']==rec['max_child_rank'], 'source invoice packing') + for rec in case['comparison_evidence']: + s=rec['scaled_endpoint'] + require((s/1e18>float(TARGET_TEXT)) == rec['binary64_above'], 'native float comparison') + require(F.from_float(s/1e18)==F(rec['binary64_value']), 'native quotient rounding') + ctrl=evidence['binary64_control']; s=ctrl['exact_first_passing_scaled_integer'] + require(F.from_float(float(TARGET_TEXT))==F(ctrl['binary64_target']), 'native target rounding') + require(F(s)>TARGET*SCALE and not s/1e18>float(TARGET_TEXT), 'native disagreement control') + bindings.authenticate() + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--original',type=Path,default=HERE.parent/'h6_banked_invoice_audit') + parser.add_argument('--evidence',type=Path,default=HERE/'APPENDIX_EVIDENCE.json') + parser.add_argument('--source',action='store_true') + parser.add_argument('--output',type=Path,help='Write new evidence, never overwrite') + parser.add_argument('--controls-output',type=Path,help='Write new control receipt, never overwrite') + args=parser.parse_args() + m,bindings,code,deps=load_original(args.original.resolve()) + evidence=build(m,code,deps) + if not args.output: + validate(json.loads(args.evidence.read_text()),evidence) + result=controls(m,evidence) + if args.source: + replay_source(m,bindings,evidence) + require(author_binding()==evidence['author_source'], 'author source changed') + require(bindings.authenticate()==deps,'original dependency bytes changed') + # Publish only after every requested check; retain exclusive creation. + if args.output: + with args.output.open('x',encoding='utf-8',newline='\n') as f: + json.dump(evidence,f,sort_keys=True,indent=2); f.write('\n') + if args.controls_output: + with args.controls_output.open('x',encoding='utf-8',newline='\n') as f: + json.dump(result,f,sort_keys=True,indent=2); f.write('\n') + for case in evidence['cases']: + print('PASS full PR1424 L=%d R=%d: lower(R)>target>upper(R+1); exact pressure signs' % + (case['L'],case['exact']['R'])) + print('PASS %d rejection controls and %d positive controls' % + (len(result['rejected']),len(result['positive']))) + print('PASS Fraction and binary64 agree at all three boundaries, but differ at synthetic s=1676855229071322') + print('PASS source mode: 3 threshold calls, 6 invoices, native rounding checks' if args.source + else 'PASS rational mode: no upstream execution or floating nomination') + +if __name__ == '__main__': + main() diff --git a/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/author_source/price_h6.py b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/author_source/price_h6.py new file mode 100644 index 0000000000..0e2a352bc3 --- /dev/null +++ b/research/h6-banked-invoice-audit/h6_full_pr1424_appendix/author_source/price_h6.py @@ -0,0 +1,78 @@ +"""Banked-invoice break-even helper counts R* for the E8^2 Pauli factor (the H6 row of PR1590 / our escape map). + +Run from the repository root: python3 -B research/h6-banked-breakeven/price_h6.py +Uses PR606's research/niemeier-lattices/workbench/paid-controller/banked.py unchanged (invoice(), lines 65-72). + +Model (PR606 'complex' row inputs): n=30960 ports, h=17, hist={17:256, 15:560} (256 width-17 + 560 width-15 centres, +degree-3 K=(t^3-4t)/48 of rank 816), data path [16], helper path hp=[1,7,8,1] (17 rank of stock per helper), +virtual=False, L in {3,5,7} stages. kappa(L,R) = lower end of invoice(...)['nominal_kappa_interval_scaled_1e18']. + +Convention: R* = the largest R in [0, 2,000,000) with kappa(L,R) STRICTLY above the target, found by bisection on +the invariant kappa(lo) > target >= kappa(hi) (lo=0, hi=2,000,000). Monotonicity in R is checked at the boundary +(kappa(R*) > target >= kappa(R*+1)) and printed. Two comparison modes are reported: + float : kappa_scaled/1e18 (Python float) > float(target) -- the convention behind the published 80,558 + exact : kappa_scaled (int) > target * 1e18 (Fraction, exact) -- no rounding +Targets are kept as the exact decimal strings below. '#890 as used' is the 10-digit rounding we used in the escape +map; '#890 title' is PR890's merged title value; '#1424 title' is the open best at the time of writing (2026-10-14). + +The 'x1.538 paper ceiling' is the ratio of two zero-helper nominal kappas in PR606's COSTS.txt (same model): +E8^2 full Pauli factor (.006945535353) / E8 root reference (.004515128332); see ceiling() below, which parses them. +It is a paper ceiling: no compensation helpers, no bit-side cap, no construction. + +Not included in the invoice (necessary budget, not sufficient): K encoder beyond PR606's base terms, compensation +restoration/chronology (frame-0 precompensation, target cap-15 <-> FULL), spectator/padding beyond helper_pad, +sharing between compensation and other stages, and any helper-loading/capacity lemma. +""" +import sys, re, os +from fractions import Fraction as F +sys.dont_write_bytecode = True +ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +NM = ROOT + '/research/niemeier-lattices' +sys.path.insert(0, NM + '/workbench/paid-controller') +import banked as b + +N, H, HIST, DATA, HP = 30960, 17, {17: 256, 15: 560}, (16,), (1, 7, 8, 1) +TARGETS = { + '#890 as used (rounded)': '0.001661957775', + '#890 title (exact)': '0.001661957774647029', + '#1424 title (exact)': '0.001676855229071321886206381217337893', +} +HI = 2_000_000 + +def kscaled(L, R): + d = b.invoice(N, H, HIST, L, list(DATA), list(HP), R, False) + return int(d['nominal_kappa_interval_scaled_1e18'][0]) + +def above(L, R, t, mode): + s = kscaled(L, R) + return (s / 1e18 > float(t)) if mode == 'float' else (F(s) > F(t) * 10**18) + +def breakeven(L, t, mode): + if not above(L, 0, t, mode): return 0 + lo, hi = 0, HI + assert not above(L, hi, t, mode) + while hi - lo > 1: + m = (lo + hi) // 2 + if above(L, m, t, mode): lo = m + else: hi = m + return lo + +def ceiling(): + txt = open(NM + '/COSTS.txt').read() + e8 = re.search(r'E8 root reference\s+\d+\s+\d+\s+\d+\s+(\.\d+)', txt).group(1) + pa = re.search(r'E8\^2 full Pauli factor\s+\d+\s+\d+\s+\d+\s+(\.\d+)', txt).group(1) + return e8, pa, F(pa) / F(e8) + +if __name__ == '__main__': + e8, pa, r = ceiling() + print('ceiling: E8^2 full Pauli %s / E8 root reference %s = %.6f (COSTS.txt, zero helpers)' % (pa, e8, float(r))) + print('model: n=%d h=%d hist=%s data=%s hp=%s virtual=False; bracket [0,%d); strict >' % (N, H, HIST, list(DATA), list(HP), HI)) + for name, t in TARGETS.items(): + for mode in ('float', 'exact'): + row = [] + for L in (3, 5, 7): + R = breakeven(L, t, mode) + ok = above(L, R, t, mode) and not above(L, R + 1, t, mode) + row.append('L%d R*=%d (30960/R*=%.4f, k(R*)=%d, k(R*+1)=%d, boundary %s)' % ( + L, R, N / R if R else 0, kscaled(L, R), kscaled(L, R + 1), 'ok' if ok else 'NON-MONOTONE')) + print('%-24s %-5s target=%s' % (name, mode, t)); [print(' ' + x) for x in row] diff --git a/research/h6-banked-invoice-audit/hardening_controls/hardening_checks.py b/research/h6-banked-invoice-audit/hardening_controls/hardening_checks.py new file mode 100644 index 0000000000..0c1967a912 --- /dev/null +++ b/research/h6-banked-invoice-audit/hardening_controls/hardening_checks.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Execution-hygiene controls only; no H6 mathematical cases or producer JSON. + +Uses a synthetic import closure with the original path/loading topology, and +executes the real original/patched appendix.main with explicit test doubles +for build, controls, source replay, and final authentication. The original +appendix bytes are hash-checked. These are not real upstream invoice replays. +""" +import argparse +import hashlib +import importlib.machinery +import importlib.util +import json +import os +from pathlib import Path +import py_compile +import subprocess +import sys +import tempfile +import types + +HERE = Path(__file__).resolve().parent +LAUNCHER = HERE/'patch_tree/authenticated_run.py' +OLD = HERE/'original/h6_full_pr1424_appendix/appendix.py' +NEW = HERE/'patch_tree/h6_full_pr1424_appendix/appendix.py' +HASHES = { + 'old': 'cc43d4c89e32497caff1a8cd6f0ddd54c5fc1619c00d2e70ffe08ec52d473640', + 'new': '69b1981b049df19655c497387741ab04c93a40d82b48135b157b4d472f3ae345', + 'launcher': '704ee91443ea892c1fd296fafb5fe0b1a66e881f311620e2dcc0db1154e84449', +} + + +def need(test, message): + if not test: + raise ValueError(message) + + +def digest(data): + return hashlib.sha256(data).hexdigest() + + +def direct(path, name, sha=None): + data = path.read_bytes() + if sha is not None: + need(digest(data) == sha, 'test source SHA256: '+str(path)) + module = types.ModuleType(name) + module.__file__ = str(path) + exec(compile(data, str(path), 'exec', dont_inherit=True), module.__dict__) + return module + + +def command(*arguments): + return [sys.executable, '-I', '-B'] + (['-O'] if sys.flags.optimize else []) + [ + str(Path(__file__).resolve()), *map(str, arguments)] + + +def invoke(*arguments): + return subprocess.run(command(*arguments), capture_output=True, text=True, + timeout=45) + + +LOAD = '''import importlib.util +from pathlib import Path +import sys + +def load(path, name): + spec = importlib.util.spec_from_file_location(name, path) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod +''' + + +def make_closure(root, explicit=False, snapshot=False, fail=False): + """Harmless source/CACHED strings, not substituted scientific assertions.""" + api = direct(LAUNCHER, 'fixture_launcher', HASHES['launcher']) + prefix = api.ORIGINAL + bank = prefix+'/vendor/research/niemeier-lattices/workbench/paid-controller/banked.py' + portable = bank.replace('banked.py', 'portable.py') + costs = prefix+'/vendor/research/niemeier-lattices/code/costs.py' + screen = prefix+'/vendor/research/leech-lattice/code/screen.py' + entry = (api.APPENDIX+'/appendix.py') if explicit else prefix+'/audit.py' + sources = { + prefix+'/model.py': 'MARKER = "SOURCE"\n', + prefix+'/source_bindings.py': LOAD+'''MARKER = "SOURCE" +def import_banked(): + return load(Path(__file__).parent/'vendor/research/niemeier-lattices/workbench/paid-controller/banked.py', 'h6_authenticated_banked') +''', + portable: '''from pathlib import Path +MARKER = "SOURCE" +PACKAGE = Path(__file__).resolve().parents[2] +''', + bank: LOAD+'''MARKER = "SOURCE" +sys.path.insert(0, str(Path(__file__).parent)) +import portable +c = load(portable.PACKAGE/'code/costs.py', 'niemeier_costs') +''', + costs: LOAD+'''MARKER = "SOURCE" +engine = load(Path(__file__).resolve().parents[2]/'leech-lattice/code/screen.py', 'frozen_niemeier_moment_bounds') +''', + screen: 'MARKER = "SOURCE"\n', + } + top = LOAD+'''import json +MARKER = "SOURCE" +root = Path(__file__).resolve().parents[1] +(root/'ENTERED').write_text('entered') +''' + if snapshot: + top += '''p=root/'h6_banked_invoice_audit/model.py' +p.write_bytes(p.read_bytes().replace(b'SOURCE',b'ALTERD')) +''' + if fail: + top += "raise ValueError('forced entry failure')\n" + if explicit: + top += '''model = load(root/'h6_banked_invoice_audit/model.py', 'h6_appendix_model') +source_bindings = load(root/'h6_banked_invoice_audit/source_bindings.py', 'h6_appendix_bindings') +''' + else: + top += '''sys.path.insert(0, str(root/'h6_banked_invoice_audit')) +import model, source_bindings +''' + top += '''b = source_bindings.import_banked() +print(json.dumps([MARKER, model.MARKER, source_bindings.MARKER, + b.MARKER, b.portable.MARKER, b.c.MARKER, b.c.engine.MARKER])) +''' + sources[entry] = top + manifest = {} + stamp = 1700000000000000000 + for relative, text in sources.items(): + path = root/relative + path.parent.mkdir(parents=True, exist_ok=True) + current = text.encode('utf-8') + cached = current.replace(b'MARKER = "SOURCE"', b'MARKER = "CACHED"') + need(len(current) == len(cached), 'timestamp fixture equal source length') + path.write_bytes(cached) + os.utime(path, ns=(stamp, stamp)) + py_compile.compile(str(path), doraise=True, optimize=sys.flags.optimize, + invalidation_mode=py_compile.PycInvalidationMode.TIMESTAMP) + path.write_bytes(current) + os.utime(path, ns=(stamp, stamp)) + manifest[relative] = digest(current) + (root/'fixture-manifest.json').write_text(json.dumps(manifest)) + (root/'entry.txt').write_text(entry) + + +def loader_worker(root, mode): + api = direct(LAUNCHER, 'worker_launcher', HASHES['launcher']) + entry = (root/'entry.txt').read_text() + manifest = json.loads((root/'fixture-manifest.json').read_text()) + if mode == 'unchecked': + spec = importlib.util.spec_from_file_location('__main__', root/entry) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return + before = importlib.machinery.SourceFileLoader.get_code + argv = sys.argv + path = sys.path[:] + main = sys.modules.get('__main__') + try: + api.run_authenticated(root, entry, [], manifest) + finally: + need(importlib.machinery.SourceFileLoader.get_code is before, 'loader not restored') + need(sys.argv is argv and sys.path == path and sys.modules.get('__main__') is main, + 'process state not restored') + + +def appendix_worker(root, version, failure, source): + app = direct(OLD if version == 'old' else NEW, 'ordering_fixture', HASHES[version]) + print('TEST DOUBLE ONLY: no real invoice/controls/source replay is executed.', flush=True) + evidence = {'test_double': True, 'cases': [], 'author_source': {'fixture': 'author'}} + result = {'rejected': [], 'positive': []} + deps = [{'fixture': 'dependency'}] + events = [] + + def maybe(label): + events.append(label) + if failure == label: + raise ValueError('injected '+label+' failure') + + def fake_build(*args): + maybe('build') + return evidence + + def fake_controls(*args): + maybe('controls') + return result + + def fake_source(*args): + maybe('source_replay') + + def author(): + maybe('final_author') + return evidence['author_source'] + + def authenticate(): + maybe('final_dependencies') + return deps + + app.load_original = lambda root: (None, types.SimpleNamespace(authenticate=authenticate), [], deps) + app.build, app.controls, app.replay_source = fake_build, fake_controls, fake_source + app.author_binding = author + sys.argv = [str(OLD if version == 'old' else NEW), + '--controls-output', str(root/'TEST_DOUBLE_CONTROLS.json')] + if failure == 'validation': + (root/'INPUT.json').write_text('{}\n') + sys.argv += ['--evidence', str(root/'INPUT.json')] + else: + sys.argv += ['--output', str(root/'TEST_DOUBLE_EVIDENCE.json')] + if source: + sys.argv.append('--source') + try: + app.main() + finally: + (root/'events.json').write_text(json.dumps(events)) + + +def run_checks(group): + rows = [] + def add(name, proc=None, **details): + row = {'test': name, 'result': 'PASS', **details} + if proc is not None: + row.update(returncode=proc.returncode, stdout=proc.stdout, stderr=proc.stderr) + rows.append(row) + print('PASS '+name, flush=True) + + for key, path in [('old', OLD), ('new', NEW), ('launcher', LAUNCHER)]: + need(digest(path.read_bytes()) == HASHES[key], 'complete source hash '+key) + need(OLD.read_bytes().split(b'\ndef main():')[0] == + NEW.read_bytes().split(b'\ndef main():')[0], 'non-main prefix changed') + add('Original appendix authenticated; every byte preceding main unchanged') + for redirect in ('--original', '--ori', '--orig=/untrusted'): + cmd = [sys.executable, '-I', '-B'] + (['-O'] if sys.flags.optimize else []) + p = subprocess.run(cmd+[str(LAUNCHER), 'appendix', redirect], + capture_output=True, text=True, timeout=45) + need(p.returncode != 0 and 'Use launcher --root' in p.stderr, + 'source-root override was not rejected') + add('Launcher rejects source-root override '+redirect, p) + with tempfile.TemporaryDirectory(prefix='h6-hardening-') as temp: + temp = Path(temp) + if group in ('all','loader'): + for explicit in (False, True): + root = temp/('explicit' if explicit else 'ordinary') + root.mkdir() + make_closure(root, explicit=explicit) + unguarded = invoke('--worker', 'loader', root, 'unchecked') + need(unguarded.returncode == 0 and json.loads(unguarded.stdout) == ['CACHED']*7, + 'cached reference not witnessed: '+unguarded.stderr) + add(('Explicit' if explicit else 'Ordinary')+' closure: seven stale caches witnessed', unguarded) + guarded = invoke('--worker', 'loader', root, 'guarded') + need(guarded.returncode == 0 and json.loads(guarded.stdout) == ['SOURCE']*7, + 'guard failed to compile authenticated closure: '+guarded.stderr) + add(('Explicit' if explicit else 'Ordinary')+' closure: seven authenticated sources executed', guarded) + + root = temp/'snapshot'; root.mkdir(); make_closure(root, snapshot=True) + p = invoke('--worker', 'loader', root, 'guarded') + need(p.returncode == 0 and json.loads(p.stdout) == ['SOURCE']*7, 'authenticated snapshot lost') + need(b'ALTERD' in (root/'h6_banked_invoice_audit/model.py').read_bytes(), 'snapshot mutation absent') + add('Compile retained authenticated bytes, not a later source reread (synthetic only)', p) + + root = temp/'corrupt'; root.mkdir(); make_closure(root) + with (root/'h6_banked_invoice_audit/model.py').open('ab') as f: + f.write(b' ') + p = invoke('--worker', 'loader', root, 'guarded') + need(p.returncode != 0 and 'Source SHA256 mismatch' in p.stderr and + not (root/'ENTERED').exists(), 'preexecution hash gate failed') + add('Preexisting one-byte source change rejected before entrypoint', p) + + root = temp/'exception'; root.mkdir(); make_closure(root, fail=True) + p = invoke('--worker', 'loader', root, 'guarded') + need(p.returncode != 0 and 'forced entry failure' in p.stderr and + 'not restored' not in p.stderr, 'exception restoration failed') + add('Loader/argv/path/main restored after entrypoint exception', p) + + if group in ('all','failures'): + for version in ('old', 'new'): + root = temp/(version+'-source-fail'); root.mkdir() + p = invoke('--worker', 'appendix', root, version, 'source_replay', 'yes') + exists = [(root/name).exists() for name in ('TEST_DOUBLE_EVIDENCE.json','TEST_DOUBLE_CONTROLS.json')] + need(p.returncode != 0 and 'injected source_replay failure' in p.stderr, + 'source failure not propagated') + need(exists == ([True, True] if version == 'old' else [False, False]), + 'unexpected output publication: '+str(exists)) + add(version+' appendix: injected source replay failure, output existence '+str(exists), + p, evidence_exists=exists[0], controls_exists=exists[1]) + + for failure in ('build', 'controls', 'final_author', 'final_dependencies', 'validation'): + root = temp/failure; root.mkdir() + p = invoke('--worker', 'appendix', root, 'new', failure, 'yes') + need(p.returncode != 0, 'injected failure accepted: '+failure) + need(not (root/'TEST_DOUBLE_EVIDENCE.json').exists() and + not (root/'TEST_DOUBLE_CONTROLS.json').exists(), 'failed check left requested output') + add('Patched appendix: '+failure+' failure leaves neither requested output', p) + + if group in ('all','success'): + successes = [] + for version, source in (('old','yes'), ('new','yes'), ('new','no')): + root = temp/(version+'-success-'+source); root.mkdir() + p = invoke('--worker', 'appendix', root, version, 'none', source) + need(p.returncode == 0, 'positive ordering fixture failed: '+p.stderr) + pair = [(root/name).read_bytes() for name in + ('TEST_DOUBLE_EVIDENCE.json','TEST_DOUBLE_CONTROLS.json')] + if successes: + need(pair == successes[0], 'successful serialization changed') + successes.append(pair) + events = json.loads((root/'events.json').read_text()) + need(('source_replay' in events) == (source == 'yes'), 'wrong requested source mode') + add(version+' appendix: successful test-double serialization, source='+source, + p, output_hashes=list(map(digest,pair)), events=events) + + root=temp/'no-overwrite'; root.mkdir() + dest=root/'TEST_DOUBLE_EVIDENCE.json'; dest.write_bytes(b'KEEP\n') + p=invoke('--worker','appendix',root,'new','none','yes') + need(p.returncode != 0 and 'FileExistsError' in p.stderr and dest.read_bytes()==b'KEEP\n', + 'exclusive creation changed') + need(not (root/'TEST_DOUBLE_CONTROLS.json').exists(), 'unexpected second output') + add('Existing evidence refuses overwrite and keeps original bytes',p) + return {'schema':'h6-execution-hardening-tests-v1', + 'python':sys.version,'optimization':sys.flags.optimize,'group':group, + 'scope':'Synthetic import closure and test-double-driven real appendix.main only; no producer evidence JSON or real upstream invoice replay.', + 'checked_code_hashes':HASHES,'tests':rows} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--output',type=Path) + parser.add_argument('--group',choices=('all','loader','failures','success'),default='all') + args=parser.parse_args() + receipt=run_checks(args.group) + if args.output: + with args.output.open('x',encoding='utf-8',newline='\n') as f: + json.dump(receipt,f,sort_keys=True,indent=2); f.write('\n') + print('PASS %d scoped execution-hygiene tests; no new mathematical cases' % len(receipt['tests'])) + + +if __name__ == '__main__': + if sys.argv[1:2] == ['--worker']: + kind, root, *rest = sys.argv[2:] + if kind == 'loader': + loader_worker(Path(root),rest[0]) + elif kind == 'appendix': + appendix_worker(Path(root),rest[0],rest[1],rest[2]=='yes') + else: + raise ValueError('Unknown worker') + else: + main() diff --git a/research/h6-banked-invoice-audit/hardening_controls/original/h6_full_pr1424_appendix/appendix.py b/research/h6-banked-invoice-audit/hardening_controls/original/h6_full_pr1424_appendix/appendix.py new file mode 100644 index 0000000000..3f58411123 --- /dev/null +++ b/research/h6-banked-invoice-audit/hardening_controls/original/h6_full_pr1424_appendix/appendix.py @@ -0,0 +1,281 @@ +#!/usr/bin/env python3 +"""Three full-title PR1424 cases only; offline, fail-closed H6 appendix. + +Default: exact rational pressure/grid verification, including a rational +binary64 rounding model; no upstream execution or floating nomination. +--source: additionally replay 3 threshold calls and 6 adjacent invoices in +unchanged, hash-authenticated PR606, and check native binary64 comparisons. +Never executes price_h6.py's main program or any structure/Walsh program. +""" +import argparse +import ast +from copy import deepcopy +from fractions import Fraction as F +import hashlib +import importlib.util +import json +from pathlib import Path +import sys +sys.dont_write_bytecode = True + +HERE = Path(__file__).resolve().parent +TARGET_TEXT = '0.001676855229071321886206381217337893' +TARGET = F(TARGET_TEXT) +SHORT = F('0.001676855229071321') +SCALE = 10**18 +# Proposals inherited from original target-independent row certificates. +# Each cell is re-proved; no floating nomination is used to accept it. +SEEDS = {3:(1679672779019,1679656758746), + 5:(1679674364931,1679662527951), + 7:(1679675807199,1679664671449)} +EXPECTED = {3:79617,5:88409,7:79399} +ORIGINAL_CODE = { + 'model.py':'d18c4c589e37de077d29120d7b4688ad6a335cd63d225f93621a2573cd23cd80', + 'source_bindings.py':'f247b8a5ef341737318af2d926808b92d26d90ff6db9abf2f714ba132ff6f335'} +AUTHOR_SHA = 'ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a' +AUTHOR_REV = 'b496aed769dd724cd1ff6b921cade626562be27b' + + +def require(value, message): + if not value: + raise ValueError(message) + + +def check_bytes(data, expected, name): + require(hashlib.sha256(data).hexdigest() == expected, 'SHA256 mismatch: '+name) + + +def load_module(path, name): + spec = importlib.util.spec_from_file_location(name, path) + require(spec is not None and spec.loader is not None, 'module loader') + result = importlib.util.module_from_spec(spec) + spec.loader.exec_module(result) + return result + + +def load_original(root): + code = [] + for name, sha in sorted(ORIGINAL_CODE.items()): + data = (root/name).read_bytes() + check_bytes(data, sha, name) + code.append(dict(path=name, bytes=len(data), sha256=sha)) + bindings = load_module(root/'source_bindings.py', 'h6_appendix_bindings') + dependencies = bindings.authenticate() # bytes only, before upstream import + model = load_module(root/'model.py', 'h6_appendix_model') + return model, bindings, code, dependencies + + +def author_binding(): + path = HERE/'author_source/price_h6.py' + data = path.read_bytes() + check_bytes(data, AUTHOR_SHA, 'author price_h6.py') + tree = ast.parse(data, filename=str(path)) # parse, never import or execute + values = [ast.literal_eval(node.value) for node in tree.body + if isinstance(node, ast.Assign) and any( + isinstance(t, ast.Name) and t.id == 'TARGETS' for t in node.targets)] + require(values == [{'#890 as used (rounded)':'0.001661957775', + '#890 title (exact)':'0.001661957774647029', + '#1424 title (exact)':TARGET_TEXT}], 'author target literal binding') + return dict(path='author_source/price_h6.py', bytes=len(data), sha256=AUTHOR_SHA, + revision=AUTHOR_REV, imported_or_executed=False) + + +def nearest_binary64(x): + """Exact nearest-even rounding for positive normal binary64 values only.""" + x = F(x) + require(x > 0, 'binary64 positive domain') + e = x.numerator.bit_length()-x.denominator.bit_length() + if x < F(2)**e: + e -= 1 + require(-1022 <= e <= 1023, 'binary64 normal domain') + step = F(2)**(e-52) + y = x/step + q, r = divmod(y.numerator, y.denominator) + if 2*r > y.denominator or (2*r == y.denominator and q % 2): + q += 1 + answer = q*step + require(answer <= F(2)**1024-F(2)**971, 'binary64 finite rounding') + require(abs(answer-x) <= step/2, 'binary64 outward error bound') + return answer + + +def comparison_record(s): + require(type(s) is int and 0 < s < 2**53, 'exact integer-to-binary64 range') + x = F(s,SCALE) + fx, ft = nearest_binary64(x), nearest_binary64(TARGET) + return {'scaled_endpoint':s, 'exact_above':x>TARGET, + 'binary64_above':fx>ft, 'binary64_value':str(fx), + 'endpoint_rounding_error':str(fx-x), + 'exact_endpoint_minus_target':str(x-TARGET)} + + +def compact_invoice(m, L, count, z): + rec = m.invoice_record(L,count,z) + return {key:rec[key] for key in ( + 'R','z','alpha_grid_cell','alpha_bracket','scaled_kappa_interval', + 'stock','rank_mass','max_child_rank', + 'positive_lower_bracket_margin','positive_upper_bracket_margin')} + + +def make_case(m,L): + exact = m.boundary_record(L,TARGET) + R = exact['R'] + require(R == EXPECTED[L], 'claimed full-title threshold falsified') + left = compact_invoice(m,L,R,SEEDS[L][0]) + right = compact_invoice(m,L,R+1,SEEDS[L][1]) + s = left['scaled_kappa_interval'][0] + unext = right['scaled_kappa_interval'][1] + require(F(s,SCALE)>TARGET>F(unext,SCALE), 'strict adjacent scaled endpoints') + comparisons = [comparison_record(v) for v in ( + s,right['scaled_kappa_interval'][0],unext)] + require([a['exact_above'] for a in comparisons] == [True,False,False], + 'exact boundary comparisons') + require([a['binary64_above'] for a in comparisons] == [True,False,False], + 'binary64 boundary comparisons') + xl,xh = map(F,exact['real_helper_boundary']) + coarse = m.round_out(xl,xh,10**6) + return dict(L=L, exact=exact, + helper_boundary_outward_1e6=[str(x) for x in coarse], + invoice_at_R=left, invoice_at_R_plus_1=right, + comparisons_order=['lower(R)','lower(R+1)','upper(R+1)'], + comparison_evidence=comparisons) + + +def rounding_control(): + k = TARGET*SCALE + lower = k.numerator//k.denominator + require(lower == 1676855229071321, 'scaled target floor') + require(SHORT*SCALE == lower and lower < k < lower+1, + 'short and full targets have same integer endpoint cutoff') + s = lower+1 + rec = comparison_record(s) + require(rec['exact_above'] and not rec['binary64_above'], + 'float/Fraction disagreement control') + require(nearest_binary64(F(s,SCALE)) == nearest_binary64(TARGET), + 'control fails float strictness by equality') + require(comparison_record(s+1)['binary64_above'], 'next scaled integer passes float') + return dict(control='synthetic scaled integer, NOT an added invoice case', + exact_first_passing_scaled_integer=s, + binary64_first_passing_scaled_integer=s+1, + evidence=rec, binary64_target=str(nearest_binary64(TARGET)), + target_rounding_error=str(nearest_binary64(TARGET)-TARGET)) + + +def build(m, code, deps): + return dict(schema='h6-full-pr1424-appendix-v1', + target_id='author_PR1424_full_title', target_decimal=TARGET_TEXT, + target_fraction=str(TARGET), target_scale=SCALE, + retained_short_target=str(SHORT), full_minus_short=str(TARGET-SHORT), + original_code=code, unchanged_PR606_dependencies=deps, + author_source=author_binding(), + parameters=dict(n=30960,h=17,hist={'17':256,'15':560},data=[16], + hp=[1,7,8,1],virtual=False,bad=False,stages=[3,5,7]), + cases=[make_case(m,L) for L in (3,5,7)], + binary64_control=rounding_control(), + paper_ratio=dict(numerator_printed='0.006945535353', + denominator_printed='0.004515128332', + exact_ratio=str(F('0.006945535353')/F('0.004515128332')), + fully_paid_improvement_certified=False)) + + +def validate(got, expected): + require(got == expected, 'appendix evidence differs from exact recomputation') + + +def controls(m,evidence): + names = [] + def rejected(name,operation): + try: + operation() + except ValueError: + names.append(name) + else: + raise ValueError('Control accepted: '+name) + for name, mutate in ( + ('short target silently substituted',lambda x:x.update(target_decimal=str(SHORT))), + ('an extra fourth stage case',lambda x:x['cases'].append(deepcopy(x['cases'][0]))), + ('one endpoint forged',lambda x:x['cases'][0]['invoice_at_R']['scaled_kappa_interval'].__setitem__(0,0)), + ('R+1 falsely admitted',lambda x:x['cases'][0]['exact'].__setitem__('R',79618)), + ('one pressure margin forged',lambda x:x['cases'][0]['exact'].__setitem__('positive_pressure_margin_at_R','0'))): + bad=deepcopy(evidence); mutate(bad) + rejected(name,lambda:validate(bad,evidence)) + rejected('wrong positive grid cell',lambda:m.invoice_record(3,79617,SEEDS[3][0]+1)) + rejected('integer pressure tie unresolved',lambda:m.strict_allowance(F(3),F(3))) + rejected('straddled pressure interval unresolved',lambda:m.strict_allowance(F(299,100),F(301,100))) + rejected('one author-source byte changed',lambda:check_bytes( + (HERE/'author_source/price_h6.py').read_bytes()+b' ',AUTHOR_SHA,'mutated copy')) + rejected('binary64 nonpositive domain',lambda:nearest_binary64(F(0))) + # Halfway fixtures exercise both parity branches of nearest-even rounding. + require(nearest_binary64(F(1)+F(1,2**53)) == F(1), 'even tie rounds down') + require(nearest_binary64(F(1)+F(3,2**53)) == F(1)+F(1,2**51), 'odd tie rounds up') + return dict(rejected=names, positive=[ + 'nearest-even binary64 halfway fixtures', + 'same full-target synthetic integer distinguishes exact from float', + 'three exact adjacent pressure and endpoint certificates']) + + +def replay_source(m,bindings,evidence): + require(sys.float_info.radix == 2 and sys.float_info.mant_dig == 53 and + sys.float_info.rounds == 1, 'native binary64 nearest rounding required') + b = bindings.import_banked() + for case in evidence['cases']: + L = case['L']; R = case['exact']['R'] + base = b.base(m.N,m.H,m.HIST,L,m.DATA) + unit,q,pad = b.helper(base,m.HP,False) + local = m.row(L) + require(base['terms'] == local['terms'][:-len(unit)] and + (unit,q,pad) == (local['unit'],local['q'],local['p']), 'source skeleton') + result = b.threshold(m.N,m.H,m.HIST,L,m.DATA,m.HP,TARGET,False,False) + require(result['max_helpers'] == R, 'source threshold differs') + for key in ('invoice_at_R','invoice_at_R_plus_1'): + rec=case[key] + inv=b.invoice(m.N,m.H,m.HIST,L,m.DATA,m.HP,rec['R'],False) + require(inv['nominal_kappa_interval_scaled_1e18']==rec['scaled_kappa_interval'], + 'source adjacent endpoints differ') + require(inv['stock']==rec['stock'] and inv['deficit']==local['D'] and + inv['stock_replication_factor']==q and inv['helper_pad']==pad and + inv['max_child']==rec['max_child_rank'], 'source invoice packing') + for rec in case['comparison_evidence']: + s=rec['scaled_endpoint'] + require((s/1e18>float(TARGET_TEXT)) == rec['binary64_above'], 'native float comparison') + require(F.from_float(s/1e18)==F(rec['binary64_value']), 'native quotient rounding') + ctrl=evidence['binary64_control']; s=ctrl['exact_first_passing_scaled_integer'] + require(F.from_float(float(TARGET_TEXT))==F(ctrl['binary64_target']), 'native target rounding') + require(F(s)>TARGET*SCALE and not s/1e18>float(TARGET_TEXT), 'native disagreement control') + bindings.authenticate() + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--original',type=Path,default=HERE.parent/'h6_banked_invoice_audit') + parser.add_argument('--evidence',type=Path,default=HERE/'APPENDIX_EVIDENCE.json') + parser.add_argument('--source',action='store_true') + parser.add_argument('--output',type=Path,help='Write new evidence, never overwrite') + parser.add_argument('--controls-output',type=Path,help='Write new control receipt, never overwrite') + args=parser.parse_args() + m,bindings,code,deps=load_original(args.original.resolve()) + evidence=build(m,code,deps) + if args.output: + with args.output.open('x',encoding='utf-8',newline='\n') as f: + json.dump(evidence,f,sort_keys=True,indent=2); f.write('\n') + else: + validate(json.loads(args.evidence.read_text()),evidence) + result=controls(m,evidence) + if args.controls_output: + with args.controls_output.open('x',encoding='utf-8',newline='\n') as f: + json.dump(result,f,sort_keys=True,indent=2); f.write('\n') + if args.source: + replay_source(m,bindings,evidence) + for case in evidence['cases']: + print('PASS full PR1424 L=%d R=%d: lower(R)>target>upper(R+1); exact pressure signs' % + (case['L'],case['exact']['R'])) + print('PASS %d rejection controls and %d positive controls' % + (len(result['rejected']),len(result['positive']))) + print('PASS Fraction and binary64 agree at all three boundaries, but differ at synthetic s=1676855229071322') + print('PASS source mode: 3 threshold calls, 6 invoices, native rounding checks' if args.source + else 'PASS rational mode: no upstream execution or floating nomination') + require(author_binding()==evidence['author_source'], 'author source changed') + require(bindings.authenticate()==deps,'original dependency bytes changed') + +if __name__ == '__main__': + main() diff --git a/research/h6-banked-invoice-audit/hardening_controls/patch_tree/authenticated_run.py b/research/h6-banked-invoice-audit/hardening_controls/patch_tree/authenticated_run.py new file mode 100644 index 0000000000..36a81d0ca1 --- /dev/null +++ b/research/h6-banked-invoice-audit/hardening_controls/patch_tree/authenticated_run.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Required source-only launcher for the frozen H6 entrypoints. + +Run with python3 -I -B [and optionally -O]. All application source bytes are +hashed before execution. The entrypoint and both ordinary/explicit-path +SourceFileLoader imports compile those same retained bytes, never a .pyc. +Trusted interpreter/stdlib, stable package layout, single-threaded execution. +No mathematical changes; existing source/evidence provenance stays intact. +For Andrey Mas by ChatGPT (GPT-6 Astra Pro); Codex coordination is separate. +""" +import argparse +import hashlib +import importlib.machinery +from pathlib import Path +import sys +import types + +ORIGINAL = 'h6_banked_invoice_audit' +APPENDIX = 'h6_full_pr1424_appendix' +COMMON = { + ORIGINAL+'/model.py': + 'd18c4c589e37de077d29120d7b4688ad6a335cd63d225f93621a2573cd23cd80', + ORIGINAL+'/source_bindings.py': + 'f247b8a5ef341737318af2d926808b92d26d90ff6db9abf2f714ba132ff6f335', + ORIGINAL+'/vendor/research/niemeier-lattices/workbench/paid-controller/banked.py': + '8fb244f0f8dd007b29bc033c709bc04acd39fb562fb9c5382e7b4573233fb079', + ORIGINAL+'/vendor/research/niemeier-lattices/workbench/paid-controller/portable.py': + '95d245eb15ff930847b6872eb10e9d1feb382ce135013e18ab5737ae626efde8', + ORIGINAL+'/vendor/research/niemeier-lattices/code/costs.py': + '885303fde89db6153b9cf74e229e5ababe511f971c2f928f93355ac4740631e8', + ORIGINAL+'/vendor/research/leech-lattice/code/screen.py': + '6118abd81e8860bdb551526029d8b36958835de52adb8f50c1a43bb247005385', +} +ENTRYPOINTS = { + 'audit': (ORIGINAL+'/audit.py', + '458c7f01a5151ddc7e532d165992d8177f7be6644cf9309ef25cfadf01c251c0'), + 'verify': (ORIGINAL+'/verify_certificate.py', + '8bc83e304ce2f259295bc81f1ab9dc681def9d7e54fb09fc2915386fd2b31f58'), + 'appendix': (APPENDIX+'/appendix.py', + '69b1981b049df19655c497387741ab04c93a40d82b48135b157b4d472f3ae345'), +} +AUTHOR = (APPENDIX+'/author_source/price_h6.py', + 'ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a') + + +def require(test, message): + if not test: + raise ValueError(message) + + +def run_authenticated(root: Path, entry: str, arguments: list[str], + manifest: dict[str, str]) -> None: + """Execute one pinned closure; manifest is fixed by main(), not CLI data.""" + root = root.resolve() + blobs = {} + for relative, expected in sorted(manifest.items()): + path = (root/relative).resolve() + require(path.is_relative_to(root), 'Source outside package root: '+relative) + data = path.read_bytes() + require(hashlib.sha256(data).hexdigest() == expected, + 'Source SHA256 mismatch: '+relative) + blobs[path] = data + entry_path = (root/entry).resolve() + require(entry_path in blobs, 'Unauthenticated entrypoint') + # Fresh isolated CLI invocations have no application modules preloaded. + require(not any(name in sys.modules for name in ('model', 'source_bindings', 'portable')), + 'Application module already loaded; use a fresh isolated process') + loader_type = importlib.machinery.SourceFileLoader + saved_get_code = loader_type.get_code + + def source_code(loader, fullname): + path = Path(loader.path).resolve() + if path in blobs: + return compile(blobs[path], str(path), 'exec', dont_inherit=True) + require(not path.is_relative_to(root), 'Unlisted application source: '+str(path)) + return saved_get_code(loader, fullname) + + saved_argv, saved_path = sys.argv, sys.path[:] + saved_main = sys.modules.get('__main__') + program = types.ModuleType('__main__') + program.__file__ = str(entry_path) + program.__package__ = None + program.__spec__ = None + try: + # Covers the nested explicit loaders in banked.py and costs.py too. + loader_type.get_code = source_code + sys.argv = [str(entry_path), *arguments] + sys.modules['__main__'] = program + exec(compile(blobs[entry_path], str(entry_path), 'exec', dont_inherit=True), + program.__dict__) + finally: + loader_type.get_code = saved_get_code + sys.argv = saved_argv + sys.path[:] = saved_path + if saved_main is None: + sys.modules.pop('__main__', None) + else: + sys.modules['__main__'] = saved_main + + +def main(): + require(sys.flags.isolated and sys.dont_write_bytecode, + 'Use python3 -I -B authenticated_run.py') + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--root', type=Path, default=Path(__file__).resolve().parent, + help='Parent of the two sibling package directories') + parser.add_argument('mode', choices=ENTRYPOINTS) + parser.add_argument('arguments', nargs=argparse.REMAINDER) + args = parser.parse_args() + forwarded = args.arguments + if forwarded[:1] == ['--']: + forwarded = forwarded[1:] + # argparse also accepts abbreviations such as --ori; block those too. + require(not any(x.startswith('--') and '--original'.startswith(x.split('=',1)[0]) + for x in forwarded), + 'Use launcher --root, not appendix --original') + entry, digest = ENTRYPOINTS[args.mode] + manifest = dict(COMMON) + manifest[entry] = digest + if args.mode == 'appendix': + manifest[AUTHOR[0]] = AUTHOR[1] + run_authenticated(args.root, entry, forwarded, manifest) + + +if __name__ == '__main__': + main() diff --git a/research/h6-banked-invoice-audit/hardening_controls/patch_tree/h6_full_pr1424_appendix/appendix.py b/research/h6-banked-invoice-audit/hardening_controls/patch_tree/h6_full_pr1424_appendix/appendix.py new file mode 100644 index 0000000000..d4a7e82880 --- /dev/null +++ b/research/h6-banked-invoice-audit/hardening_controls/patch_tree/h6_full_pr1424_appendix/appendix.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python3 +"""Three full-title PR1424 cases only; offline, fail-closed H6 appendix. + +Default: exact rational pressure/grid verification, including a rational +binary64 rounding model; no upstream execution or floating nomination. +--source: additionally replay 3 threshold calls and 6 adjacent invoices in +unchanged, hash-authenticated PR606, and check native binary64 comparisons. +Never executes price_h6.py's main program or any structure/Walsh program. +""" +import argparse +import ast +from copy import deepcopy +from fractions import Fraction as F +import hashlib +import importlib.util +import json +from pathlib import Path +import sys +sys.dont_write_bytecode = True + +HERE = Path(__file__).resolve().parent +TARGET_TEXT = '0.001676855229071321886206381217337893' +TARGET = F(TARGET_TEXT) +SHORT = F('0.001676855229071321') +SCALE = 10**18 +# Proposals inherited from original target-independent row certificates. +# Each cell is re-proved; no floating nomination is used to accept it. +SEEDS = {3:(1679672779019,1679656758746), + 5:(1679674364931,1679662527951), + 7:(1679675807199,1679664671449)} +EXPECTED = {3:79617,5:88409,7:79399} +ORIGINAL_CODE = { + 'model.py':'d18c4c589e37de077d29120d7b4688ad6a335cd63d225f93621a2573cd23cd80', + 'source_bindings.py':'f247b8a5ef341737318af2d926808b92d26d90ff6db9abf2f714ba132ff6f335'} +AUTHOR_SHA = 'ed83a457ae9deb1a8e06551404735ad3c6d71153ef4a22ec64f615f8d1a5d92a' +AUTHOR_REV = 'b496aed769dd724cd1ff6b921cade626562be27b' + + +def require(value, message): + if not value: + raise ValueError(message) + + +def check_bytes(data, expected, name): + require(hashlib.sha256(data).hexdigest() == expected, 'SHA256 mismatch: '+name) + + +def load_module(path, name): + spec = importlib.util.spec_from_file_location(name, path) + require(spec is not None and spec.loader is not None, 'module loader') + result = importlib.util.module_from_spec(spec) + spec.loader.exec_module(result) + return result + + +def load_original(root): + code = [] + for name, sha in sorted(ORIGINAL_CODE.items()): + data = (root/name).read_bytes() + check_bytes(data, sha, name) + code.append(dict(path=name, bytes=len(data), sha256=sha)) + bindings = load_module(root/'source_bindings.py', 'h6_appendix_bindings') + dependencies = bindings.authenticate() # bytes only, before upstream import + model = load_module(root/'model.py', 'h6_appendix_model') + return model, bindings, code, dependencies + + +def author_binding(): + path = HERE/'author_source/price_h6.py' + data = path.read_bytes() + check_bytes(data, AUTHOR_SHA, 'author price_h6.py') + tree = ast.parse(data, filename=str(path)) # parse, never import or execute + values = [ast.literal_eval(node.value) for node in tree.body + if isinstance(node, ast.Assign) and any( + isinstance(t, ast.Name) and t.id == 'TARGETS' for t in node.targets)] + require(values == [{'#890 as used (rounded)':'0.001661957775', + '#890 title (exact)':'0.001661957774647029', + '#1424 title (exact)':TARGET_TEXT}], 'author target literal binding') + return dict(path='author_source/price_h6.py', bytes=len(data), sha256=AUTHOR_SHA, + revision=AUTHOR_REV, imported_or_executed=False) + + +def nearest_binary64(x): + """Exact nearest-even rounding for positive normal binary64 values only.""" + x = F(x) + require(x > 0, 'binary64 positive domain') + e = x.numerator.bit_length()-x.denominator.bit_length() + if x < F(2)**e: + e -= 1 + require(-1022 <= e <= 1023, 'binary64 normal domain') + step = F(2)**(e-52) + y = x/step + q, r = divmod(y.numerator, y.denominator) + if 2*r > y.denominator or (2*r == y.denominator and q % 2): + q += 1 + answer = q*step + require(answer <= F(2)**1024-F(2)**971, 'binary64 finite rounding') + require(abs(answer-x) <= step/2, 'binary64 outward error bound') + return answer + + +def comparison_record(s): + require(type(s) is int and 0 < s < 2**53, 'exact integer-to-binary64 range') + x = F(s,SCALE) + fx, ft = nearest_binary64(x), nearest_binary64(TARGET) + return {'scaled_endpoint':s, 'exact_above':x>TARGET, + 'binary64_above':fx>ft, 'binary64_value':str(fx), + 'endpoint_rounding_error':str(fx-x), + 'exact_endpoint_minus_target':str(x-TARGET)} + + +def compact_invoice(m, L, count, z): + rec = m.invoice_record(L,count,z) + return {key:rec[key] for key in ( + 'R','z','alpha_grid_cell','alpha_bracket','scaled_kappa_interval', + 'stock','rank_mass','max_child_rank', + 'positive_lower_bracket_margin','positive_upper_bracket_margin')} + + +def make_case(m,L): + exact = m.boundary_record(L,TARGET) + R = exact['R'] + require(R == EXPECTED[L], 'claimed full-title threshold falsified') + left = compact_invoice(m,L,R,SEEDS[L][0]) + right = compact_invoice(m,L,R+1,SEEDS[L][1]) + s = left['scaled_kappa_interval'][0] + unext = right['scaled_kappa_interval'][1] + require(F(s,SCALE)>TARGET>F(unext,SCALE), 'strict adjacent scaled endpoints') + comparisons = [comparison_record(v) for v in ( + s,right['scaled_kappa_interval'][0],unext)] + require([a['exact_above'] for a in comparisons] == [True,False,False], + 'exact boundary comparisons') + require([a['binary64_above'] for a in comparisons] == [True,False,False], + 'binary64 boundary comparisons') + xl,xh = map(F,exact['real_helper_boundary']) + coarse = m.round_out(xl,xh,10**6) + return dict(L=L, exact=exact, + helper_boundary_outward_1e6=[str(x) for x in coarse], + invoice_at_R=left, invoice_at_R_plus_1=right, + comparisons_order=['lower(R)','lower(R+1)','upper(R+1)'], + comparison_evidence=comparisons) + + +def rounding_control(): + k = TARGET*SCALE + lower = k.numerator//k.denominator + require(lower == 1676855229071321, 'scaled target floor') + require(SHORT*SCALE == lower and lower < k < lower+1, + 'short and full targets have same integer endpoint cutoff') + s = lower+1 + rec = comparison_record(s) + require(rec['exact_above'] and not rec['binary64_above'], + 'float/Fraction disagreement control') + require(nearest_binary64(F(s,SCALE)) == nearest_binary64(TARGET), + 'control fails float strictness by equality') + require(comparison_record(s+1)['binary64_above'], 'next scaled integer passes float') + return dict(control='synthetic scaled integer, NOT an added invoice case', + exact_first_passing_scaled_integer=s, + binary64_first_passing_scaled_integer=s+1, + evidence=rec, binary64_target=str(nearest_binary64(TARGET)), + target_rounding_error=str(nearest_binary64(TARGET)-TARGET)) + + +def build(m, code, deps): + return dict(schema='h6-full-pr1424-appendix-v1', + target_id='author_PR1424_full_title', target_decimal=TARGET_TEXT, + target_fraction=str(TARGET), target_scale=SCALE, + retained_short_target=str(SHORT), full_minus_short=str(TARGET-SHORT), + original_code=code, unchanged_PR606_dependencies=deps, + author_source=author_binding(), + parameters=dict(n=30960,h=17,hist={'17':256,'15':560},data=[16], + hp=[1,7,8,1],virtual=False,bad=False,stages=[3,5,7]), + cases=[make_case(m,L) for L in (3,5,7)], + binary64_control=rounding_control(), + paper_ratio=dict(numerator_printed='0.006945535353', + denominator_printed='0.004515128332', + exact_ratio=str(F('0.006945535353')/F('0.004515128332')), + fully_paid_improvement_certified=False)) + + +def validate(got, expected): + require(got == expected, 'appendix evidence differs from exact recomputation') + + +def controls(m,evidence): + names = [] + def rejected(name,operation): + try: + operation() + except ValueError: + names.append(name) + else: + raise ValueError('Control accepted: '+name) + for name, mutate in ( + ('short target silently substituted',lambda x:x.update(target_decimal=str(SHORT))), + ('an extra fourth stage case',lambda x:x['cases'].append(deepcopy(x['cases'][0]))), + ('one endpoint forged',lambda x:x['cases'][0]['invoice_at_R']['scaled_kappa_interval'].__setitem__(0,0)), + ('R+1 falsely admitted',lambda x:x['cases'][0]['exact'].__setitem__('R',79618)), + ('one pressure margin forged',lambda x:x['cases'][0]['exact'].__setitem__('positive_pressure_margin_at_R','0'))): + bad=deepcopy(evidence); mutate(bad) + rejected(name,lambda:validate(bad,evidence)) + rejected('wrong positive grid cell',lambda:m.invoice_record(3,79617,SEEDS[3][0]+1)) + rejected('integer pressure tie unresolved',lambda:m.strict_allowance(F(3),F(3))) + rejected('straddled pressure interval unresolved',lambda:m.strict_allowance(F(299,100),F(301,100))) + rejected('one author-source byte changed',lambda:check_bytes( + (HERE/'author_source/price_h6.py').read_bytes()+b' ',AUTHOR_SHA,'mutated copy')) + rejected('binary64 nonpositive domain',lambda:nearest_binary64(F(0))) + # Halfway fixtures exercise both parity branches of nearest-even rounding. + require(nearest_binary64(F(1)+F(1,2**53)) == F(1), 'even tie rounds down') + require(nearest_binary64(F(1)+F(3,2**53)) == F(1)+F(1,2**51), 'odd tie rounds up') + return dict(rejected=names, positive=[ + 'nearest-even binary64 halfway fixtures', + 'same full-target synthetic integer distinguishes exact from float', + 'three exact adjacent pressure and endpoint certificates']) + + +def replay_source(m,bindings,evidence): + require(sys.float_info.radix == 2 and sys.float_info.mant_dig == 53 and + sys.float_info.rounds == 1, 'native binary64 nearest rounding required') + b = bindings.import_banked() + for case in evidence['cases']: + L = case['L']; R = case['exact']['R'] + base = b.base(m.N,m.H,m.HIST,L,m.DATA) + unit,q,pad = b.helper(base,m.HP,False) + local = m.row(L) + require(base['terms'] == local['terms'][:-len(unit)] and + (unit,q,pad) == (local['unit'],local['q'],local['p']), 'source skeleton') + result = b.threshold(m.N,m.H,m.HIST,L,m.DATA,m.HP,TARGET,False,False) + require(result['max_helpers'] == R, 'source threshold differs') + for key in ('invoice_at_R','invoice_at_R_plus_1'): + rec=case[key] + inv=b.invoice(m.N,m.H,m.HIST,L,m.DATA,m.HP,rec['R'],False) + require(inv['nominal_kappa_interval_scaled_1e18']==rec['scaled_kappa_interval'], + 'source adjacent endpoints differ') + require(inv['stock']==rec['stock'] and inv['deficit']==local['D'] and + inv['stock_replication_factor']==q and inv['helper_pad']==pad and + inv['max_child']==rec['max_child_rank'], 'source invoice packing') + for rec in case['comparison_evidence']: + s=rec['scaled_endpoint'] + require((s/1e18>float(TARGET_TEXT)) == rec['binary64_above'], 'native float comparison') + require(F.from_float(s/1e18)==F(rec['binary64_value']), 'native quotient rounding') + ctrl=evidence['binary64_control']; s=ctrl['exact_first_passing_scaled_integer'] + require(F.from_float(float(TARGET_TEXT))==F(ctrl['binary64_target']), 'native target rounding') + require(F(s)>TARGET*SCALE and not s/1e18>float(TARGET_TEXT), 'native disagreement control') + bindings.authenticate() + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--original',type=Path,default=HERE.parent/'h6_banked_invoice_audit') + parser.add_argument('--evidence',type=Path,default=HERE/'APPENDIX_EVIDENCE.json') + parser.add_argument('--source',action='store_true') + parser.add_argument('--output',type=Path,help='Write new evidence, never overwrite') + parser.add_argument('--controls-output',type=Path,help='Write new control receipt, never overwrite') + args=parser.parse_args() + m,bindings,code,deps=load_original(args.original.resolve()) + evidence=build(m,code,deps) + if not args.output: + validate(json.loads(args.evidence.read_text()),evidence) + result=controls(m,evidence) + if args.source: + replay_source(m,bindings,evidence) + require(author_binding()==evidence['author_source'], 'author source changed') + require(bindings.authenticate()==deps,'original dependency bytes changed') + # Publish only after every requested check; retain exclusive creation. + if args.output: + with args.output.open('x',encoding='utf-8',newline='\n') as f: + json.dump(evidence,f,sort_keys=True,indent=2); f.write('\n') + if args.controls_output: + with args.controls_output.open('x',encoding='utf-8',newline='\n') as f: + json.dump(result,f,sort_keys=True,indent=2); f.write('\n') + for case in evidence['cases']: + print('PASS full PR1424 L=%d R=%d: lower(R)>target>upper(R+1); exact pressure signs' % + (case['L'],case['exact']['R'])) + print('PASS %d rejection controls and %d positive controls' % + (len(result['rejected']),len(result['positive']))) + print('PASS Fraction and binary64 agree at all three boundaries, but differ at synthetic s=1676855229071322') + print('PASS source mode: 3 threshold calls, 6 invoices, native rounding checks' if args.source + else 'PASS rational mode: no upstream execution or floating nomination') + +if __name__ == '__main__': + main()