From 2acae34be8b894b34fc3953088c7489c51059f2b Mon Sep 17 00:00:00 2001 From: Nick Petalas Date: Tue, 27 Oct 2026 16:18:37 +0000 Subject: [PATCH] feat(research): bound rounded error on the two PR5833 P104 words Apply PR5838's causal completed-operation bound, unchanged, to the budget (peak 96) and minimum (peak 2) words emitted by PR5833. Both accept the same 20-bit final guard, but the intermediate error envelope falls from 26.9B to below 0.978B and field norm plus error from below 2^17 B to below 97B and 3B. The PR5830 word reproduces PR5838's recorded 20-bit case under the same site convention. --- .../p104-gauge-word-rounded-guards/README.md | 119 ++++++++++ .../RESULT.json | 166 +++++++++++++ .../SOURCES.json | 72 ++++++ .../p104-gauge-word-rounded-guards/TASK.json | 94 ++++++++ .../VERIFY.json | 29 +++ .../p104-gauge-word-rounded-guards/verify.py | 224 ++++++++++++++++++ 6 files changed, 704 insertions(+) create mode 100644 research/p104-gauge-word-rounded-guards/README.md create mode 100644 research/p104-gauge-word-rounded-guards/RESULT.json create mode 100644 research/p104-gauge-word-rounded-guards/SOURCES.json create mode 100644 research/p104-gauge-word-rounded-guards/TASK.json create mode 100644 research/p104-gauge-word-rounded-guards/VERIFY.json create mode 100644 research/p104-gauge-word-rounded-guards/verify.py diff --git a/research/p104-gauge-word-rounded-guards/README.md b/research/p104-gauge-word-rounded-guards/README.md new file mode 100644 index 0000000000..129fa9813f --- /dev/null +++ b/research/p104-gauge-word-rounded-guards/README.md @@ -0,0 +1,119 @@ +# Rounded-error guards for the two PR5833 P104 words + +**Finite certificate; no new κ.** Ali Romman's PR5833 emitted two complete +P104 words with sharp ideal field amplification 96 (original scalar budget) +and 2 (minimum). PR5838 proved a 20-bit completed-operation guard for the +earlier PR5830 word, with peak 65,537. It also asked for the bound to be +recomputed for a later gauge tradeoff word. This package does that for both +PR5833 words, under PR5838's contract and its causal bound, used unchanged. + +| Word | Ideal peak | Causal guard | Final public error | Intermediate error | Field norm + error | +|---|---:|---:|---:|---:|---:| +| PR5830 (PR5838's result) | 65,537 | 20 | < 0.97754 B | < 26.903 B | < 65,563.91 B | +| PR5833 budget word | 96 | **20** | < 0.97746 B | **< 0.97746 B** | **< 96.978 B** | +| PR5833 minimum word | 2 | **20** | < 0.97746 B | **< 0.97746 B** | **< 2.978 B** | + +B bounds every initial field's Hilbert norm and u = 2^-guard. All bounds are +exact rationals in `RESULT.json`; the table rounds them up. + +What changes: + +- **The final guard stays at 20 bits.** At guard 19 the causal bound on both + new words is above 1.955 B, as on PR5830's word. Lowering amplification by + factors of about 683 and 32,768 does not lower the accepted final guard. +- **The intermediate error envelope falls from 26.9 B to below 0.978 B.** + On both new words the largest error bound at any instruction is the final + bound on public field 205. No intermediate field ever carries a larger + error bound than the outputs. +- **The field-magnitude envelope falls from below 2^17 B to below 97 B and + 3 B.** Read as fixed-point headroom (an inference, not a physical + representation proof), the integer part above B needs 7 bits on the budget + word and 2 bits on the minimum word, against 17 on PR5830's word, with the + same 20 fractional guard bits. + +The budget word keeps PR5833's original allowance (224,878 ≤ 224,880 scalar +primitives). Its precision envelope is therefore 10 integer bits narrower than +PR5830's word, at 24,332 more scalar primitives than PR5830's 200,546. That +is the tradeoff PR5833 asked to price; this package supplies only its error +side. + +## Contract and method + +Every physical `MOVE`, `ADD` and `SCALE` of the emitted word is a relative +defect site with PR5838's allowance: local ideal input norm plus actual prior +error feedback, times u. `COPY`, `INIT` and `CLEAR` are exact, as in PR5838. +The emitted PR5833 words already contain every entry, exit and lowered +`SCALE`, and neither word has an identity `SCALE`, so no site is virtual. +PR5838's `transfer.ideal` supplies the weights and checks every arbitrary-input +endpoint row. PR5838's `causal.bound` computes the forward bound with exact +signed coefficient rows and upward-rounded 96-bit dyadic defect bounds. Both +files are imported from `research/p104-gauge-error-covariance` without change. + +**Adapter control.** PR5838 runs its bound on a timeline that also numbers +exact virtual identities. Applied to PR5830's emitted word with all physical +`MOVE`/`ADD`/`SCALE` as sites, this adapter reproduces PR5838's recorded +20-bit case exactly. That covers all public and owned final coefficients, the +peak value and its field, and the 26,271 sites; only the peak's instruction +index differs. This shows the site convention matches. It is not a re-check +of PR5838. + +Four controls are rejected: a truncated budget word and a budget word with one +doubled `SCALE` coefficient both fail the endpoint check. Guard 19 is not +accepted. Omitting 1,000 sites changes the bound. + +## Reproduce + +From the repository root with CPython 3.12 and the standard library: + +```sh +python3.12 -I -W error -B research/p104-gauge-word-rounded-guards/verify.py +python3.12 -I -O -W error -B research/p104-gauge-word-rounded-guards/verify.py +python3.12 -B scripts/research_package.py --package research/p104-gauge-word-rounded-guards +``` + +Each prints `PASS_P104_GAUGE_WORD_ROUNDED_GUARDS` and takes about 17 seconds +locally. `--write` regenerates `RESULT.json`; the default mode requires the +committed receipt to equal the recomputation byte for byte. Sparse checkouts +need `research/p104-gauge-error-covariance` and +`research/p104-priced-amplification`. The six live inputs are pinned by Git +blob and SHA256 in `SOURCES.json`. + +## Limits + +- This is an upper bound under one worst-case contract. Sharpness at 20 bits + is **not** claimed for the new words. PR5838 shows that a MOVE/ADD-only + 19-bit trace survives every field-constant signed scalar gauge of its base + word. Whether PR5833's words lie in that gauge class was not checked here. +- Hardware rounding with stronger correlations may need fewer bits; PR5838's + contract allows independently adverse completed defects. +- No rounded native child, COPY/reset machine, signed-record range, tape or + descriptor cost is built or charged. The five framework assumptions remain. + No κ, selected-frontier or admission change follows. + +## Open next questions + +1. **Is 20 sharp on the PR5833 words?** Transport PR5838's family adversary + (`FAMILY-ADVERSARY.json`) to each word, or show the words are field-constant + signed scalar gauges of PR5838's base word. The first step is to map each + PR5833 instruction to its base-word event and gauge ratio. +2. **Does a narrower field envelope buy a cheaper physical word?** The budget + word needs 7 integer bits instead of 17. Price a fixed-point record at + 27 total bits against 37 in the actual tape/descriptor tariff, including + the extra 24,332 scalar primitives. Physical record widths are not yet bound. +3. **Can a gauge lower the final guard itself?** Both new words keep the final + public bound near 0.9775 B. That points at the output-side native MOVE/ADD + chain, not field amplification. The first step is the per-site share of + field 205's final bound. + +## Credit + +This package was produced by Nick Petalas. The completed-operation contract, +causal bound, transfer method and 20-bit PR5830 result are Ali Romman's PR5838 +(`research/p104-gauge-error-covariance`), which credits the PR5819/5826/5831 +transfer method and the PR5830/5824/5822/5812 gauge lineage. The two emitted +words and their sharp ideal peaks are Ali Romman's PR5833 +(`research/p104-priced-amplification`). All P104, native and compiler authors +retained in those packages' notices are credited through them. The new +contribution is the rounded-error guard and envelopes for the two PR5833 +words. Independent human and formal proof-kernel review are unclaimed. +Apache-2.0. diff --git a/research/p104-gauge-word-rounded-guards/RESULT.json b/research/p104-gauge-word-rounded-guards/RESULT.json new file mode 100644 index 0000000000..bfceced5d1 --- /dev/null +++ b/research/p104-gauge-word-rounded-guards/RESULT.json @@ -0,0 +1,166 @@ +{ + "adapter_control": "PR5830 word, every physical MOVE/ADD/SCALE a site: 20-bit causal case equals PR5838 RESULT.json causal_cases[guard=20] in every final coefficient, the peak value, its field and the 26271 defect sites. Only the peak instruction index differs, because PR5838 also numbers exact virtual identities.", + "claim": "Finite certificate: under PR5838's completed-operation relative-error contract and causal bound, both PR5833 words accept a 20-bit guard; intermediate error stays below 0.978B and field norm plus error below 97B (budget word) and 3B (minimum word).", + "rejected_controls": [ + "drop the last instruction of the budget word", + "double one SCALE coefficient of the budget word", + "accept guard 19 on the budget word", + "omit the last 1000 defect sites without changing the bound" + ], + "schema_version": 1, + "source_hashes": { + "research/p104-gauge-error-covariance/RESULT.json": "b8967e8aeca1d59addc8094526232bda4b144b8a85df319a043e82536d07be03", + "research/p104-gauge-error-covariance/causal.py": "779fc064fc26ecd2091552eb23761ffecaf8a689f8ff027853bc3e88d90e6256", + "research/p104-gauge-error-covariance/inputs/WORD.json.gz": "6a7467851c2a3bc8aee3a7018bcf15290848f040484cfbff5a97ca0773207e0a", + "research/p104-gauge-error-covariance/transfer.py": "618231ab4e144999a71622511bbd41c6a0fb32351c12340e65311084f4cf0a18", + "research/p104-priced-amplification/BUDGET-WORD.json.gz": "2d707ffa13d95182aa799097b2ef0a6a8bdad29814976c4e52f66af8d2e517ff", + "research/p104-priced-amplification/MINIMUM-WORD.json.gz": "5ecbb6533ea43dbbb4865d61d6953e4180c4ac796ee9a620c0f11f85cc82d549" + }, + "unit": "B, the bound on every initial field Hilbert norm; u = 2^-guard", + "words": { + "pr5830_gauge_word": { + "defect_sites": 26271, + "field_norm_plus_error_bound": "20778030171283507118687820528136407/316912650057057350374175801344", + "final_public_bound": "1268907899307767744718911294017839/1298074214633706907132624082305024", + "ideal_peak": "65537", + "identity_scale_sites": 0, + "instructions": 26351, + "intermediate_error_at": [ + 24580, + 349 + ], + "intermediate_error_bound": "8525824494139547215461035454679/316912650057057350374175801344", + "least_causal_guard": 20, + "operation_counts": { + "ADD": 21685, + "CLEAR": 29, + "COPY": 22, + "INIT": 29, + "MOVE": 3457, + "SCALE": 1129 + }, + "owned_fields": 12, + "public_fields": 770, + "rejected_final_public_bound": "317361194300804062733789640958015/162259276829213363391578010288128", + "rejected_guard": 19, + "scan": [ + { + "final_public_bound": "1268505349529775942440067171376851/5192296858534827628530496329220096", + "guard": 22, + "intermediate_error_bound": "4262490850044930134848577591973/633825300114114700748351602688" + }, + { + "final_public_bound": "2537279044886802426282421954976059/5192296858534827628530496329220096", + "guard": 21, + "intermediate_error_bound": "8525262622353040458504352712329/633825300114114700748351602688" + }, + { + "final_public_bound": "1268907899307767744718911294017839/1298074214633706907132624082305024", + "guard": 20, + "intermediate_error_bound": "8525824494139547215461035454679/316912650057057350374175801344" + }, + { + "final_public_bound": "317361194300804062733789640958015/162259276829213363391578010288128", + "guard": 19, + "intermediate_error_bound": "17053896693521503963650793986429/316912650057057350374175801344" + } + ] + }, + "pr5833_budget_word": { + "defect_sites": 27022, + "field_norm_plus_error_bound": "491734110945483183559404247863187/5070602400912917605986812821504", + "final_public_bound": "4956280457843093384670216998803/5070602400912917605986812821504", + "ideal_peak": "96", + "identity_scale_sites": 0, + "instructions": 27102, + "intermediate_error_at": [ + 26539, + 205 + ], + "intermediate_error_bound": "4956280457843093384670216998803/5070602400912917605986812821504", + "least_causal_guard": 20, + "operation_counts": { + "ADD": 21685, + "CLEAR": 29, + "COPY": 22, + "INIT": 29, + "MOVE": 3457, + "SCALE": 1880 + }, + "owned_fields": 12, + "public_fields": 770, + "rejected_final_public_bound": "9916780791124075418200791780253/5070602400912917605986812821504", + "rejected_guard": 19, + "scan": [ + { + "final_public_bound": "309668651851752592698620988495/1267650600228229401496703205376", + "guard": 22, + "intermediate_error_bound": "309668651851752592698620988495/1267650600228229401496703205376" + }, + { + "final_public_bound": "619403216486029567696652192465/1267650600228229401496703205376", + "guard": 21, + "intermediate_error_bound": "619403216486029567696652192465/1267650600228229401496703205376" + }, + { + "final_public_bound": "4956280457843093384670216998803/5070602400912917605986812821504", + "guard": 20, + "intermediate_error_bound": "4956280457843093384670216998803/5070602400912917605986812821504" + }, + { + "final_public_bound": "9916780791124075418200791780253/5070602400912917605986812821504", + "guard": 19, + "intermediate_error_bound": "9916780791124075418200791780253/5070602400912917605986812821504" + } + ] + }, + "pr5833_minimum_word": { + "defect_sites": 27027, + "field_norm_plus_error_bound": "117949169803671572367362214249/39614081257132168796771975168", + "final_public_bound": "38721007289407234773818263913/39614081257132168796771975168", + "ideal_peak": "2", + "identity_scale_sites": 0, + "instructions": 27107, + "intermediate_error_at": [ + 26540, + 205 + ], + "intermediate_error_bound": "38721007289407234773818263913/39614081257132168796771975168", + "least_causal_guard": 20, + "operation_counts": { + "ADD": 21685, + "CLEAR": 29, + "COPY": 22, + "INIT": 29, + "MOVE": 3457, + "SCALE": 1885 + }, + "owned_fields": 12, + "public_fields": 770, + "rejected_final_public_bound": "309899930218753983333898480473/158456325028528675187087900672", + "rejected_guard": 19, + "scan": [ + { + "final_public_bound": "38708647619431921159920415107/158456325028528675187087900672", + "guard": 22, + "intermediate_error_bound": "38708647619431921159920415107/158456325028528675187087900672" + }, + { + "final_public_bound": "77425534386359887694650009247/158456325028528675187087900672", + "guard": 21, + "intermediate_error_bound": "77425534386359887694650009247/158456325028528675187087900672" + }, + { + "final_public_bound": "38721007289407234773818263913/39614081257132168796771975168", + "guard": 20, + "intermediate_error_bound": "38721007289407234773818263913/39614081257132168796771975168" + }, + { + "final_public_bound": "309899930218753983333898480473/158456325028528675187087900672", + "guard": 19, + "intermediate_error_bound": "309899930218753983333898480473/158456325028528675187087900672" + } + ] + } + } +} diff --git a/research/p104-gauge-word-rounded-guards/SOURCES.json b/research/p104-gauge-word-rounded-guards/SOURCES.json new file mode 100644 index 0000000000..7b80520b03 --- /dev/null +++ b/research/p104-gauge-word-rounded-guards/SOURCES.json @@ -0,0 +1,72 @@ +{ + "schema_version": 1, + "base_commit": "19fdb086ea96af9a9f87936a2b888e10af4ed810", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "581f8d87008354eb5b869f7ed9de1317ad837ce8", + "sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "research/p104-gauge-error-covariance/README.md", + "usage": "provenance", + "git_blob": "6e32f5c58c390d32fa2d72f1bf72fcdf2151d4d6", + "sha256": "0c621274810b65505f86f574efabf2568f8fca74a509af9129b55173451bdadd" + }, + { + "path": "research/p104-gauge-error-covariance/PROOF.md", + "usage": "provenance", + "git_blob": "a063d07914fdb231deed44ec9f46867663704da3", + "sha256": "42a384aecb898734cb1f80576733e88938815e79244a99e5c69e766c0c3cbd64" + }, + { + "path": "research/p104-priced-amplification/README.md", + "usage": "provenance", + "git_blob": "6b0b14e9bfb2b6340a3583fc5bf54a09e3054206", + "sha256": "15cfbc92e2542ff9fe42f8cbf30a54ab9bf4b778ae5d4bbcc725438c064971ff" + }, + { + "path": "research/p104-gauge-error-covariance/causal.py", + "usage": "input", + "git_blob": "4e0b39a1122ff6e16a49461e07f33f38634596ca", + "sha256": "779fc064fc26ecd2091552eb23761ffecaf8a689f8ff027853bc3e88d90e6256" + }, + { + "path": "research/p104-gauge-error-covariance/transfer.py", + "usage": "input", + "git_blob": "5c50ea955278dcddf1127e83cbbbd3751fbcdc2d", + "sha256": "618231ab4e144999a71622511bbd41c6a0fb32351c12340e65311084f4cf0a18" + }, + { + "path": "research/p104-gauge-error-covariance/RESULT.json", + "usage": "input", + "git_blob": "001384efbb813cf507e991aa89cf79a9dd1ab190", + "sha256": "b8967e8aeca1d59addc8094526232bda4b144b8a85df319a043e82536d07be03" + }, + { + "path": "research/p104-gauge-error-covariance/inputs/WORD.json.gz", + "usage": "input", + "git_blob": "3b04755eef3733505d2a81b477215936dcb9564e", + "sha256": "6a7467851c2a3bc8aee3a7018bcf15290848f040484cfbff5a97ca0773207e0a" + }, + { + "path": "research/p104-priced-amplification/BUDGET-WORD.json.gz", + "usage": "input", + "git_blob": "b154eb8768f4f956ffd5d099993c4bd8f101a6cf", + "sha256": "2d707ffa13d95182aa799097b2ef0a6a8bdad29814976c4e52f66af8d2e517ff" + }, + { + "path": "research/p104-priced-amplification/MINIMUM-WORD.json.gz", + "usage": "input", + "git_blob": "075fbbca0e8548fc7b9048491f30debe5ddf48f3", + "sha256": "5ecbb6533ea43dbbb4865d61d6953e4180c4ac796ee9a620c0f11f85cc82d549" + } + ] +} diff --git a/research/p104-gauge-word-rounded-guards/TASK.json b/research/p104-gauge-word-rounded-guards/TASK.json new file mode 100644 index 0000000000..7dd56c4015 --- /dev/null +++ b/research/p104-gauge-word-rounded-guards/TASK.json @@ -0,0 +1,94 @@ +{ + "schema_version": 1, + "task_id": "selected-stock-envelope", + "priority_revision": 8, + "base_commit": "19fdb086ea96af9a9f87936a2b888e10af4ed810", + "original_card": { + "id": "selected-stock-envelope", + "question": "What explicit uniform stock envelope does the actual selected stopped producer supply at one bootstrap stage?", + "starting_points": [ + "research/selected-bootstrap-stock-audit/README.md", + "research/bootstrap-cutoff-time-space-split/README.md", + "certificates/selected-result.json", + "docs/research/community-efficient1000-review.md", + "research/stock-margin-chain/README.md" + ], + "methods": [ + "Derive a source-bound reserve recurrence at the actual selected atom widths, separating parent stock from completed inner borrowing.", + "Find an exact missing implication or counterexample to a proposed selected-stage stock envelope." + ], + "acceptance_gate": "Bind every coefficient and depth factor to the selected producer and state the width domain. Compare a proved envelope with the sufficient cutoff guard; a large numerical headroom or a historical m=120 coefficient is not a selected m=73 proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Resolve the current selected review, separate complex/ordinary BIT/admitted BIT/outer budgets, and compare the card against live handoffs before starting. Historical ceilings require exact source/model equivalence.", + "scope": "Source-binding orientation only; not a scientific replay or all-size proof. Materialize selected inputs if this checkout is sparse." + }, + "first_experiment": "Choose one actual selected producer/stage and derive its parent reserve and depth coefficient from source. Check whether newer handoffs already cover that exact obligation. Stop with the missing implementation lemma if it cannot be bounded; do not rerun #2972 cutoff/headroom arithmetic as a new contribution.", + "bottleneck_link": "This reduces a concrete inherited implementation obligation without confusing unchanged kappa arithmetic with a completed theorem.", + "allowed_variations": [ + "One stage or one explicit reserve/depth implication.", + "An independently checked same-domain proof repair, retaining all remaining assumptions." + ], + "scope_change_triggers": [ + "Importing the historical 57604 or 252 allowance without a selected-producer binding.", + "Calling a conditional fit lemma a full outer-proof adoption.", + "Replacing an actual selected stock coefficient with cutoff comparisons or a conditional fit inequality." + ], + "overlap_terms": [ + "selected stock", + "stock envelope", + "bootstrap cutoff", + "1956", + "1965", + "1990", + "2972", + "stock-margin-chain", + "actual_stock_coefficient" + ], + "existing_checks": [ + { + "scope": "Retained stock audit identifies missing actual selected-stage coefficients; later cutoff-chain arithmetic does not supply them.", + "evidence": "docs/research/research-family-status.md#revision-6-handoffs-source-archives-awaiting-independent-validation", + "remaining": "Derive one actual reserve/depth coefficient from the selected producer.", + "status": "reviewed", + "source_commit": "836b19bfa309ceafbc8ee32a15e8c4b10dde7e11", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Completed-operation rounded-error guard, intermediate error envelope and field-magnitude envelope for the two complete P104 words emitted by PR5833 (budget word, ideal peak 96; minimum word, ideal peak 2), under PR5838's relative-defect contract and causal bound.", + "scope_change_reason": "Open next question 2 of Ali Romman's PR5838 (research/p104-gauge-error-covariance), filed on this card, asks to recompute its bound for a later gauge tradeoff word. PR5833 (research/p104-priced-amplification) emitted two such words and leaves their rounded pricing open. This is the same precision implication on new source words, not a stock-coefficient derivation.", + "bottleneck_link": "Supplies the error side of PR5833's precision/time tradeoff: a narrower field envelope at the same 20-bit final guard. It does not bind a physical record width or change any supplier bill or kappa.", + "budget_minutes": 90, + "stop_rule": "Stop once both words have an exact accepted guard bracket, envelopes and controls, with the adapter matched to PR5838's recorded PR5830 case. Do not attempt the sharpness transport.", + "outcome": "completed", + "evidence": "verify.py imports PR5838's causal.py and transfer.py unchanged, recomputes all three words exactly and requires RESULT.json to match byte for byte; the PR5830 adapter control equals PR5838's recorded 20-bit case; four rejection controls.", + "author": "Nick Petalas", + "ai_assistance": "Independent human and formal proof-kernel review are unclaimed.", + "open_questions": [ + { + "question": "Is the 20-bit guard sharp on the PR5833 words?", + "why_it_matters": "This package proves only an upper bound; PR5838's gauge-invariant family obstruction would settle it if the words are gauges of its base word.", + "first_step": "Map each PR5833 instruction to its base-word event and gauge ratio, or transport FAMILY-ADVERSARY.json directly.", + "blocked_by": "Not attempted in this session." + }, + { + "question": "Does the narrower field envelope buy a cheaper physical word?", + "why_it_matters": "The budget word needs 7 integer bits instead of 17 above B at the same 20-bit guard, but costs 24,332 more scalar primitives than PR5830's word.", + "first_step": "Price fixed-point records of 27 versus 37 total bits in the actual tape/descriptor tariff.", + "blocked_by": "No physical record width or tape tariff is bound to these words." + }, + { + "question": "Can any gauge lower the final guard itself?", + "why_it_matters": "Both new words keep the final bound near 0.9775B, so amplification is not what binds the final guard.", + "first_step": "Decompose field 205's final bound into per-site shares.", + "blocked_by": "Nothing; outside this session's scope." + } + ] +} diff --git a/research/p104-gauge-word-rounded-guards/VERIFY.json b/research/p104-gauge-word-rounded-guards/VERIFY.json new file mode 100644 index 0000000000..aba94e1a77 --- /dev/null +++ b/research/p104-gauge-word-rounded-guards/VERIFY.json @@ -0,0 +1,29 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-gauge-error-covariance/RESULT.json", + "research/p104-gauge-error-covariance/causal.py", + "research/p104-gauge-error-covariance/inputs/WORD.json.gz", + "research/p104-gauge-error-covariance/transfer.py", + "research/p104-gauge-word-rounded-guards/RESULT.json", + "research/p104-priced-amplification/BUDGET-WORD.json.gz", + "research/p104-priced-amplification/MINIMUM-WORD.json.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "Authenticate six pinned inputs; import PR5838 causal.py/transfer.py unchanged; for the PR5830 and both PR5833 words, check endpoint rows, ideal peaks 65537/96/2 and the least accepted causal guard bracket (20 accepted, 19 rejected); PR5830 adapter equals PR5838's recorded 20-bit case; intermediate error < 0.978B and field norm plus error < 97B and < 3B on the PR5833 words; four rejection controls; committed RESULT.json equals the recomputation." + } + ] +} diff --git a/research/p104-gauge-word-rounded-guards/verify.py b/research/p104-gauge-word-rounded-guards/verify.py new file mode 100644 index 0000000000..e38955b1d4 --- /dev/null +++ b/research/p104-gauge-word-rounded-guards/verify.py @@ -0,0 +1,224 @@ +#!/usr/bin/env python3 +"""Completed-operation rounded-error guards for the two PR5833 P104 words. + +Applies PR5838's causal forward-defect bound (causal.py and transfer.py, +imported unchanged from research/p104-gauge-error-covariance) to the two +complete words emitted by PR5833 (research/p104-priced-amplification). +Every physical MOVE, ADD and SCALE instruction is a relative defect site, +as in PR5838's physical timeline after its exact virtual identities are +deleted. The PR5830 word is replayed under the same adapter and must equal +PR5838's recorded 20-bit causal case exactly. + +Default mode recomputes everything and compares with RESULT.json. +--write regenerates RESULT.json. Standard library only. +""" +from fractions import Fraction as F +from hashlib import sha256 +import argparse +import gzip +import importlib.util +import json +from pathlib import Path +import sys + +P = Path(__file__).resolve().parent +ROOT = P.parent.parent +COVARIANCE = 'research/p104-gauge-error-covariance' +AMPLIFICATION = 'research/p104-priced-amplification' +WORDS = ( + ('pr5830_gauge_word', f'{COVARIANCE}/inputs/WORD.json.gz'), + ('pr5833_budget_word', f'{AMPLIFICATION}/BUDGET-WORD.json.gz'), + ('pr5833_minimum_word', f'{AMPLIFICATION}/MINIMUM-WORD.json.gz'), +) +# Ideal amplification peaks published by PR5830/PR5838 and PR5833. +PUBLISHED_PEAKS = {'pr5830_gauge_word': 65537, 'pr5833_budget_word': 96, 'pr5833_minimum_word': 2} +TOP_GUARD = 22 + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def load_module(name, rel): + spec = importlib.util.spec_from_file_location(name, ROOT / rel) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +def authenticate(): + rows = json.loads((P / 'SOURCES.json').read_text())['files'] + inputs = [r for r in rows if r['usage'] == 'input'] + need(len(inputs) == 6, 'six live inputs pinned') + for r in inputs: + need(sha256((ROOT / r['path']).read_bytes()).hexdigest() == r['sha256'], 'source hash ' + r['path']) + return {r['path']: r['sha256'] for r in inputs} + + +def read_word(rel): + return json.loads(gzip.decompress((ROOT / rel).read_bytes())) + + +def defect_sites(word): + return {j for j, e in enumerate(word['program']) if e[0] in ('MOVE', 'ADD', 'SCALE')} + + +def guard_scan(causal, word, weights, sites): + """Causal cases from TOP_GUARD down to the first guard whose public bound reaches B.""" + cases = [] + for guard in range(TOP_GUARD, 0, -1): + case = causal.bound(word, weights, sites, guard) + cases.append(case) + if max(case['final'][:word['public']]) >= 1: + return cases + raise ValueError('no failing guard above zero') + + +def analyse(causal, transfer, word): + sites = defect_sites(word) + weights, ideal_peak = transfer.ideal(word, sites) + cases = guard_scan(causal, word, weights, sites) + need(len(cases) >= 2, 'top guard already fails') + accepted, rejected = cases[-2], cases[-1] + public = word['public'] + final_max = max(accepted['final'][:public]) + need(final_max < 1 <= max(rejected['final'][:public]), 'least accepted causal guard bracket') + need(all(v == 0 for v in accepted['final'][public:]), 'reset-owned fields return with zero error') + counts = {op: sum(1 for e in word['program'] if e[0] == op) for op in ('MOVE', 'ADD', 'SCALE', 'COPY', 'INIT', 'CLEAR')} + identity_scales = sum(1 for e in word['program'] if e[0] == 'SCALE' and F(e[-2]) == 1) + return { + 'instructions': len(word['program']), + 'public_fields': public, + 'owned_fields': word['owned_fields'], + 'operation_counts': counts, + 'identity_scale_sites': identity_scales, + 'defect_sites': len(sites), + 'ideal_peak': ideal_peak, + 'least_causal_guard': accepted['guard'], + 'final_public_bound': final_max, + 'intermediate_error_bound': accepted['peak'], + 'intermediate_error_at': accepted['peak_at'], + 'field_norm_plus_error_bound': ideal_peak + accepted['peak'], + 'rejected_guard': rejected['guard'], + 'rejected_final_public_bound': max(rejected['final'][:public]), + 'scan': [{'guard': c['guard'], 'final_public_bound': max(c['final'][:public]), 'intermediate_error_bound': c['peak']} for c in cases], + }, accepted + + +def encode(x): + if isinstance(x, F): + return str(x) + if isinstance(x, dict): + return {str(k): encode(v) for k, v in x.items()} + if isinstance(x, (list, tuple)): + return [encode(v) for v in x] + return x + + +def rejection(label, fn): + try: + fn() + except ValueError: + return label + raise ValueError('accepted control: ' + label) + + +def controls(causal, transfer, words): + out = [] + budget = words['pr5833_budget_word'] + sites = defect_sites(budget) + + def truncated(): + w = dict(budget) + w['program'] = budget['program'][:-1] + transfer.ideal(w, defect_sites(w)) + out.append(rejection('drop the last instruction of the budget word', truncated)) + + def doubled_scale(): + w = dict(budget) + program = [list(e) for e in budget['program']] + j = next(i for i, e in enumerate(program) if e[0] == 'SCALE') + program[j][-2] = str(2 * F(program[j][-2])) + w['program'] = program + transfer.ideal(w, defect_sites(w)) + out.append(rejection('double one SCALE coefficient of the budget word', doubled_scale)) + + weights, _ = transfer.ideal(budget, sites) + case19 = causal.bound(budget, weights, sites, 19) + out.append(rejection('accept guard 19 on the budget word', + lambda: need(max(case19['final'][:budget['public']]) < 1, 'guard 19 exceeds B'))) + fewer = set(sorted(sites)[:-1000]) + weights_fewer, _ = transfer.ideal(budget, fewer) + case_fewer = causal.bound(budget, weights_fewer, fewer, 20) + case_full = causal.bound(budget, weights, sites, 20) + out.append(rejection('omit the last 1000 defect sites without changing the bound', + lambda: need(case_fewer['final'] == case_full['final'], 'sites change the bound'))) + return out + + +def calculate(): + hashes = authenticate() + causal = load_module('p104_causal', f'{COVARIANCE}/causal.py') + transfer = load_module('p104_transfer', f'{COVARIANCE}/transfer.py') + words = {name: read_word(rel) for name, rel in WORDS} + results, accepted = {}, {} + for name, _ in WORDS: + results[name], accepted[name] = analyse(causal, transfer, words[name]) + need(results[name]['ideal_peak'] == PUBLISHED_PEAKS[name], 'published ideal peak ' + name) + + # Adapter control: PR5830's word under this site convention equals PR5838's + # recorded 20-bit causal case, field by field, exactly. + recorded = json.loads((ROOT / COVARIANCE / 'RESULT.json').read_text()) + need(recorded['causal_final_guard'] == 20, 'PR5838 recorded guard') + rec20 = next(c for c in recorded['causal_cases'] if c['guard'] == 20) + ours = accepted['pr5830_gauge_word'] + need(ours['guard'] == 20, 'PR5830 word least guard under this adapter') + need([str(v) for v in ours['final']] == rec20['final'], 'PR5830 final coefficients equal PR5838 record') + # PR5838's timeline also holds exact virtual identities, so only its + # instruction index differs; value, field and site count must agree. + need(str(ours['peak']) == rec20['peak'] and ours['peak_at'][1] == rec20['peak_at'][1], 'PR5830 peak equals PR5838 record') + need(rec20['sites'] == results['pr5830_gauge_word']['defect_sites'], 'PR5830 defect-site count equals PR5838 record') + + budget, minimum = results['pr5833_budget_word'], results['pr5833_minimum_word'] + for r in (budget, minimum): + need(r['least_causal_guard'] == 20, 'twenty-bit causal guard') + need(r['final_public_bound'] < F(978, 1000), 'final error below 0.978B') + need(r['intermediate_error_bound'] < F(978, 1000), 'intermediate error below 0.978B') + need(budget['field_norm_plus_error_bound'] < 97, 'budget word field norm plus error below 97B') + need(minimum['field_norm_plus_error_bound'] < 3, 'minimum word field norm plus error below 3B') + old = results['pr5830_gauge_word'] + need(old['intermediate_error_bound'] > 26 and old['field_norm_plus_error_bound'] < 2 ** 17, 'PR5838 displayed envelope') + + return { + 'schema_version': 1, + 'claim': 'Finite certificate: under PR5838\'s completed-operation relative-error contract and causal bound, both PR5833 words accept a 20-bit guard; intermediate error stays below 0.978B and field norm plus error below 97B (budget word) and 3B (minimum word).', + 'unit': 'B, the bound on every initial field Hilbert norm; u = 2^-guard', + 'source_hashes': hashes, + 'words': results, + 'adapter_control': 'PR5830 word, every physical MOVE/ADD/SCALE a site: 20-bit causal case equals PR5838 RESULT.json causal_cases[guard=20] in every final coefficient, the peak value, its field and the 26271 defect sites. Only the peak instruction index differs, because PR5838 also numbers exact virtual identities.', + 'rejected_controls': controls(causal, transfer, words), + } + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--write', action='store_true', help='regenerate RESULT.json') + args = parser.parse_args() + result = encode(calculate()) + text = json.dumps(result, indent=1, sort_keys=True) + '\n' + path = P / 'RESULT.json' + if args.write: + path.write_text(text) + else: + need(path.read_text() == text, 'committed RESULT.json matches recomputation') + for name, r in result['words'].items(): + print(f"{name}: peak={r['ideal_peak']} guard={r['least_causal_guard']} " + f"final<{float(F(r['final_public_bound'])):.6f}B inter<{float(F(r['intermediate_error_bound'])):.6f}B " + f"norm+err<{float(F(r['field_norm_plus_error_bound'])):.4f}B") + print('PASS_P104_GAUGE_WORD_ROUNDED_GUARDS') + + +if __name__ == '__main__': + main()