From b0eda846c34413dabd1e75402b8ad730f8940ff2 Mon Sep 17 00:00:00 2001 From: ToikY <27568617+ToikY@users.noreply.github.com> Date: Tue, 13 Oct 2026 09:18:09 -0700 Subject: [PATCH] Research: resynthesize R480 Q-node2 with 18 fewer ADDs Finite historical bit construction with independent all-column and native 5/9/11-stage checks. No new kappa; selected supplier unchanged. Prepared for ToikY with substantial OpenAI Codex assistance. --- research/r480-qnode-seed02/CLAIM.md | 39 + research/r480-qnode-seed02/EXPECTED.json | 117 ++ research/r480-qnode-seed02/NATIVE.json | 1197 ++++++++++++++++++++ research/r480-qnode-seed02/NOTICE.md | 33 + research/r480-qnode-seed02/PROOF.md | 183 +++ research/r480-qnode-seed02/README.md | 79 ++ research/r480-qnode-seed02/RECIPE.json | 1188 +++++++++++++++++++ research/r480-qnode-seed02/SOURCES.json | 122 ++ research/r480-qnode-seed02/VALIDATION.md | 119 ++ research/r480-qnode-seed02/independent.py | 322 ++++++ research/r480-qnode-seed02/native.py | 235 ++++ research/r480-qnode-seed02/search.py | 160 +++ research/r480-qnode-seed02/test_package.py | 81 ++ research/r480-qnode-seed02/verify.py | 235 ++++ 14 files changed, 4110 insertions(+) create mode 100644 research/r480-qnode-seed02/CLAIM.md create mode 100644 research/r480-qnode-seed02/EXPECTED.json create mode 100644 research/r480-qnode-seed02/NATIVE.json create mode 100644 research/r480-qnode-seed02/NOTICE.md create mode 100644 research/r480-qnode-seed02/PROOF.md create mode 100644 research/r480-qnode-seed02/README.md create mode 100644 research/r480-qnode-seed02/RECIPE.json create mode 100644 research/r480-qnode-seed02/SOURCES.json create mode 100644 research/r480-qnode-seed02/VALIDATION.md create mode 100644 research/r480-qnode-seed02/independent.py create mode 100644 research/r480-qnode-seed02/native.py create mode 100644 research/r480-qnode-seed02/search.py create mode 100644 research/r480-qnode-seed02/test_package.py create mode 100644 research/r480-qnode-seed02/verify.py diff --git a/research/r480-qnode-seed02/CLAIM.md b/research/r480-qnode-seed02/CLAIM.md new file mode 100644 index 0000000000..5fd0530bdc --- /dev/null +++ b/research/r480-qnode-seed02/CLAIM.md @@ -0,0 +1,39 @@ +# Bit supplier claim — seed 2 + +- Started 2026-10-13 08:55 PDT; planned finish by 09:55, final fifteen minutes reserved for verification and handoff. Finish sooner if complete. +- Fresh OS randomness: `secrets.randbelow(100)` returned **2**, assigning the bit-supplier track. +- Exact fetched base: `407d52ff15b2217b6e22bce44728b4c3907b6515`. +- Selected record and actual construction/review read: PR942 U8/T37, conditional kappa `0.001661960547713947`, unchanged PR589/555 bit supplier. This investigation uses a historical R480 word deliberately. +- Three candidates: (0) another R439 six-wire prefix pass (overlaps PR980); (1) an R480 six-wire quad (PR823 already supplies quad1 and the class has substantial precedent); (2) R480 twelve-source Q-node2. Seed `2 % 3` chooses the third; `2 % 10` chooses Q-node2. +- Exact scope: historical PR503/510 word, phase A events `[2250:2302]`, frame484, twelve arbitrary source registers. Replace this one 52-XOR common-frame block, then regenerate and charge its literal reverse cleanup. No extra wire, source copy, frame transition or recursive child is proposed. +- Method: bounded 1,000 seeded column-order Gauss-Jordan trajectories for the exact twelve-output F2 map; complete whole-word positive-prefix and native checks decide admission. This is a different twelve-source matrix from PR823's six-wire dirty-helper quad1, not a repeat with a different random seed. No unrestricted optimum claim. +- Optimistic budget before packaging: a preliminary exact 43-XOR word would save nine in A and nine in C, or eighteen per complete local word; all other operations and paid recursive profile retained. Precision could invalidate it. No exponent improvement follows from this finite arithmetic saving. +- Deliverable: one frozen exact recipe, executable bounded reproduction, independent full-column evidence, complete local/native bills and controls, proof/interface limits, source pins and attribution. If the candidate fails complete precision, record that failure distinctly and allow one bounded revision within this block. +- Coordination: open issues650 and913 are unrelated; no pinned sprint issue found. Local claim used. Refreshed recent PRs through985 and all-state R480/Q-node queries immediately before claiming. PR823 is the relevant historical comparator, PR980 concerns R439, PR978 R420 compensation; none changes this Q-node. Review ledger records PR503/510 and PR691 as incorporated. No separate reservation issue. +- Scope ownership: delegated work stays within this block; no edits to upstream, selected frontier, inherited generators or unrelated packages. +- Prepared for ToikY with substantial OpenAI Codex assistance, Apache-2.0; full predecessor credit and exact pins will be included. + +## Completed result and claim update + +The candidate and search were frozen by approximately 09:03 PDT, followed by +verification and packaging. Three preliminary orientation probes ran in order +Q2, Q1, Q8, each with a fresh `random.Random(2)` and 1,000 trajectories. Their +best lengths were 52 -> 43, 71 -> 41 and 62 -> 46. Only the seed-selected Q2 +was packaged and admitted; the other probes received no whole-word precision +or native validation. Final Q2 coverage is exactly 1,000 trajectories; no +further search or pivot was made. This disclosure avoids presenting the +orientation probes as admitted additional results. + +Completed: Q2 uses 43 XORs and literal cleanup saves 18 complete local ADDs. +Both independent Python implementations and retained native 5/9/11-stage +checks pass; the paid histogram and frame paths are unchanged, and both +complete payloads remain 102 bits within the 104-bit allowance. No new kappa, +optimum or hosted-parent invoice is claimed. See VALIDATION.md for executed +coverage and controls. + +Final overlap refresh through PR999 and all-state R480/Q-node searches found +no duplicate of this matrix. Related PR823 is credited. New PR986 and PR989 +concern R439; main `f4a7051883bc76dad7861b3f0caf7361ce86fe90` preserves all +21 consumed source blobs and the selected record. There is still no open +sprint coordination issue. This is the one local claim update with the result: +[reviewable contribution branch](https://github.com/ToikY/integer-mult-bounds/tree/codex/bit-supplier-seed02/research/r480-qnode-seed02). diff --git a/research/r480-qnode-seed02/EXPECTED.json b/research/r480-qnode-seed02/EXPECTED.json new file mode 100644 index 0000000000..a259260290 --- /dev/null +++ b/research/r480-qnode-seed02/EXPECTED.json @@ -0,0 +1,117 @@ +{ + "after": { + "adds": 33940, + "copies": 9, + "erasures": 9, + "formal_columns": 720, + "forward_positive_prefix": 176135, + "frame_paths_sha256": "2b384919c4b79258e608ceac2f71a9fa44d47d1b9e65c8fb55413de0388fd71a", + "inverse_positive_prefix": 3682548, + "payload_bits": 102, + "payload_upper": "4742570525118367822773353856000", + "scalar_stream_sha256": "f64831f5b9220db0d58e6b4aa9ba7ebb62d45d1bd414c7b791f908a6dca85b41", + "word_sha256": "29932aaf7435175372811fbd6d48902be00864cc07b313afa0cf2685db876ff8" + }, + "assignment_seed": 2, + "base_commit": "407d52ff15b2217b6e22bce44728b4c3907b6515", + "before": { + "adds": 33958, + "copies": 9, + "erasures": 9, + "formal_columns": 720, + "forward_positive_prefix": 176135, + "frame_paths_sha256": "2b384919c4b79258e608ceac2f71a9fa44d47d1b9e65c8fb55413de0388fd71a", + "inverse_positive_prefix": 3751204, + "payload_bits": 102, + "payload_upper": "4921056267806722187755121024000", + "scalar_stream_sha256": "510dc7d43ccee1b463e92fa84141c0bcf4cfdd878d7326117fda0d2b1fee1367", + "word_sha256": "8639e22008c24a5690dd250eba702fe5fca85ddd036dcbec20baba77b7e213ba" + }, + "controls": { + "deleted_candidate_gates_rejected": 43, + "identity_growth_rejected": true, + "stale_cleanup_endpoint_valid_adds": 33949, + "stale_cleanup_rejected_by_literal_contract": true, + "total": 45 + }, + "independent": { + "arbitrary_dirty_helpers": 480, + "arbitrary_targets": 120, + "columns_checked": 720, + "controls": [ + "all_43_single_gate_deletions", + "swapped_output_rows", + "arbitrary_dirty_helper_assumed_zero", + "arbitrary_source_assumed_zero", + "arbitrary_target_assumed_zero", + "missing_dirt_compensation_ADD", + "missing_cleanup_ADD", + "wrong_local_frame", + "missing_private_ERASE" + ], + "frame_paths_sha256": "2b384919c4b79258e608ceac2f71a9fa44d47d1b9e65c8fb55413de0388fd71a", + "local_Boolean_assignments": 4096, + "local_rows": [ + 4095, + 2390, + 3835, + 3831, + 1625, + 3935, + 3951, + 16, + 207, + 4, + 1023, + 1 + ], + "local_word_xor_saving": 18, + "original": { + "endpoint_sha256": "900eeb83e7b68ae3474e74bdb5fa3cb64668877289fe540aa691450aac683bcf", + "five_stage_payload_below_2pow104": true, + "five_stage_payload_bits": 102, + "five_stage_payload_upper": "4921056267806722187755121024000", + "native_records": 36916, + "native_records_sha256": "a2f1946752268e8914e2790fc3d2d5e6d287f73132cbea6c1dee6f9f3a2b372a", + "positive_forward": { + "adds": 33958, + "bits": 18, + "copies": 9, + "max_row_l1_upper": "176135" + }, + "positive_reverse": { + "adds": 33958, + "bits": 22, + "copies": 9, + "max_row_l1_upper": "3751204" + } + }, + "register_frame_paths_checked": 720, + "replacement": { + "endpoint_sha256": "900eeb83e7b68ae3474e74bdb5fa3cb64668877289fe540aa691450aac683bcf", + "five_stage_payload_below_2pow104": true, + "five_stage_payload_bits": 102, + "five_stage_payload_upper": "4742570525118367822773353856000", + "native_records": 36898, + "native_records_sha256": "88aa5165b44687782bec4bf0cf88083754f3b6897aa0ead75f103737d82f038d", + "positive_forward": { + "adds": 33940, + "bits": 18, + "copies": 9, + "max_row_l1_upper": "176135" + }, + "positive_reverse": { + "adds": 33940, + "bits": 22, + "copies": 9, + "max_row_l1_upper": "3682548" + } + }, + "source_sha256": "92e399e9a486b55229b5624632ac54f800dd9e022f2aee97f1e5f264bbc0ef5c", + "status": "PASS_INDEPENDENT_R480_QNODE2" + }, + "no_new_kappa": true, + "recipe_sha256": "cdbda3682cf215ed167418bfc1f53722ecac3e3421c546fbfd7d6abfa17f6d47", + "saved_adds": 18, + "status": "PASS_R480_QNODE_SEED02" +} diff --git a/research/r480-qnode-seed02/NATIVE.json b/research/r480-qnode-seed02/NATIVE.json new file mode 100644 index 0000000000..23c5edd6a5 --- /dev/null +++ b/research/r480-qnode-seed02/NATIVE.json @@ -0,0 +1,1197 @@ +{ + "comparisons": { + "11": { + "local_scalar_additions_saved": 18, + "payload_upper_nonincrease": true, + "payload_upper_original": "4921056267806722187755121024000", + "payload_upper_replacement": "4742570525118367822773353856000", + "same_local_paid_histogram": true + }, + "5": { + "local_scalar_additions_saved": 18, + "payload_upper_nonincrease": true, + "payload_upper_original": "4921056267806722187755121024000", + "payload_upper_replacement": "4742570525118367822773353856000", + "same_local_paid_histogram": true + }, + "9": { + "local_scalar_additions_saved": 18, + "payload_upper_nonincrease": true, + "payload_upper_original": "4921056267806722187755121024000", + "payload_upper_replacement": "4742570525118367822773353856000", + "same_local_paid_histogram": true + } + }, + "normalization": "Only seconds and local_scalar_stream removed from native JSON; all other fields retained.", + "schema": "r480-qnode2-native/1", + "word_content_sha256": { + "original": "8639e22008c24a5690dd250eba702fe5fca85ddd036dcbec20baba77b7e213ba", + "replacement": "29932aaf7435175372811fbd6d48902be00864cc07b313afa0cf2685db876ff8" + }, + "words": { + "original": { + "gram_stdout": "PASS e8ham Gram: 672 frames checked, all nondegenerate and positive definite; prime witnesses valid; max determinant bits 17; primes [2]; by dim {0: 1, 1: 120, 2: 180, 4: 70, 6: 180, 7: 120, 8: 1}", + "interface": { + "cleanup_gates": 2708, + "cleanup_source_gates": 577, + "phase_B_reads_of_sources": 120, + "source_destination_gates_A": 577, + "source_write_frame_dims": { + "4": 577 + }, + "sources_rewritten": 117, + "status": "PASS_PR425_INTERFACE_HYPOTHESES" + }, + "legality": { + "all_final_frames_pass": true, + "common_frame_ADDs": 33958, + "containment_pairs_checked": 2350, + "copies": 9, + "donor_intersections": 0, + "erasures": 9, + "max_inherited_integer_abs": 2, + "nested_MOVEs": 2940, + "new_frame_ids_collision": false, + "nondegeneracy_checked_by_separate_exact_bank_audit": true, + "old_max_frame_id": 671, + "paid_histogram": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "rank_mass": 5592, + "records": 36916, + "scope": "Independent chronological geometry/copy/source-owner audit. F2 all-column replay is in the separately freshly compiled transform receipt; address transform theorem and bank completion remain separate.", + "selected_helpers": 0, + "selected_pairs": 0, + "source_owner_intersections": 0, + "status": "PASS_INDEPENDENT_COHORT_LEGALITY_SOURCE_OWNERS_AND_LIFECYCLE" + }, + "relaxed_word_stdout": "labels: 120 distinct lines of norm 2 (pairwise |ip| <= 1), spanning rank 8\nlegality + exact F2 on all 720 columns: PASS (gates D/A/B/C = 120/2708/240/2708)\nrelaxed check: 1154 gates have a source register as destination; all 120 sources restored exactly\nnondegeneracy: 671 used frames, all Gram dets > 0 (positive-definite form); primes in dets: [2]\nhistogram {1: 6000, 2: 7200, 4: 1140, 6: 600, 7: 240, 8: 45, 14: 240, 18: 240} m 40 W 960 mass 38280 deficit 120 (4v-5L = 120 ) maxchild 18\nno envelope saving in [0.00128681343906332590, 0.00128681343906332590]\nbad envelope saving in [0.00128681343819851354, 0.00128681343819851354]", + "stages": { + "11": { + "bridge_additions": 2880, + "copied_center_original_source_immutable": true, + "formal_columns_checked": 1680, + "fresh_center_copies": 99, + "global_live_registers": 1680, + "independent_dirty_registers": 480, + "local_odd_scalar_additions": 33958, + "local_raw_H": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "local_registers": 720, + "local_scalar_additions": 33958, + "negative_controls": [ + { + "omit_bridge": 0, + "rejected": true + }, + { + "omit_bridge": 1, + "rejected": true + }, + { + "omit_bridge": 2, + "rejected": true + }, + { + "omit_bridge": 3, + "rejected": true + }, + { + "omit_bridge": 4, + "rejected": true + }, + { + "omit_bridge": 5, + "rejected": true + }, + { + "omit_bridge": 6, + "rejected": true + }, + { + "omit_bridge": 7, + "rejected": true + }, + { + "omit_bridge": 8, + "rejected": true + }, + { + "omit_bridge": 9, + "rejected": true + }, + { + "omit_bridge": 10, + "rejected": true + }, + { + "omit_bridge": 11, + "rejected": true + }, + { + "omit_bridge": 12, + "rejected": true + }, + { + "omit_bridge": 13, + "rejected": true + }, + { + "omit_bridge": 14, + "rejected": true + }, + { + "omit_bridge": 15, + "rejected": true + }, + { + "omit_bridge": 16, + "rejected": true + }, + { + "omit_bridge": 17, + "rejected": true + }, + { + "omit_bridge": 18, + "rejected": true + }, + { + "omit_bridge": 19, + "rejected": true + }, + { + "omit_bridge": 20, + "rejected": true + }, + { + "omit_bridge": 21, + "rejected": true + }, + { + "omit_bridge": 22, + "rejected": true + }, + { + "omit_bridge": 23, + "rejected": true + } + ], + "new_Q_categories": [ + 28, + 29 + ], + "payload_prefix_bits": 102, + "payload_prefix_upper": "4921056267806722187755121024000", + "reverse_fresh_center_copies": 45, + "scope": "All independent physical input columns over F2, including all arbitrary helper dirt, restored; external copied-center work closes to zero. New cohort scalar lift uses actual signed coefficients and computed cancellation-free bounds; unchanged source527 signed decoder remains separate defining evidence. Physical projector routing and paid rank/bank receipts are independently bound, not inferred from scalar check.", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "176135", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "3751204", + "reverse": true + } + ], + "signed_reverse_semantics": "Reverse ADD coefficient negated; reverse DISCARD is fresh COPY from recorded unchanged original center; reverse COPY is DISCARD. Each such block is inverse over every commutative coefficient ring, by elementary-shear induction.", + "stage_additions": 373538, + "stages": [ + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 0 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 1 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 2 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 3 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 4 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 5 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 6 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 7 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 8 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 9 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 10 + } + ], + "status": "PASS_NEW_COHORT249_ALL_BRIDGED_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL" + }, + "5": { + "bridge_additions": 720, + "copied_center_original_source_immutable": true, + "five_stage_additions": 169790, + "formal_columns_checked": 960, + "fresh_center_copies": 45, + "global_live_registers": 960, + "independent_dirty_registers": 480, + "local_odd_scalar_additions": 33958, + "local_raw_H": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "local_registers": 720, + "local_scalar_additions": 33958, + "negative_controls": [ + { + "omit_bridge": 0, + "rejected": true + }, + { + "omit_bridge": 1, + "rejected": true + }, + { + "omit_bridge": 2, + "rejected": true + }, + { + "omit_bridge": 3, + "rejected": true + }, + { + "omit_bridge": 4, + "rejected": true + }, + { + "omit_bridge": 5, + "rejected": true + } + ], + "new_Q_categories": [ + 28, + 29 + ], + "payload_prefix_bits": 102, + "payload_prefix_upper": "4921056267806722187755121024000", + "reverse_fresh_center_copies": 18, + "scope": "All independent physical input columns over F2, including all arbitrary helper dirt, restored; external copied-center work closes to zero. New cohort scalar lift uses actual signed coefficients and computed cancellation-free bounds; unchanged source527 signed decoder remains separate defining evidence. Physical projector routing and paid rank/bank receipts are independently bound, not inferred from scalar check.", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "176135", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "3751204", + "reverse": true + } + ], + "signed_reverse_semantics": "Reverse ADD coefficient negated; reverse DISCARD is fresh COPY from recorded unchanged original center; reverse COPY is DISCARD. Each such block is inverse over every commutative coefficient ring, by elementary-shear induction.", + "stages": [ + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 0 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 1 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 2 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 3 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 4 + } + ], + "status": "PASS_NEW_COHORT249_ALL_FIVE_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL" + }, + "9": { + "bridge_additions": 2160, + "copied_center_original_source_immutable": true, + "formal_columns_checked": 1440, + "fresh_center_copies": 81, + "global_live_registers": 1440, + "independent_dirty_registers": 480, + "local_odd_scalar_additions": 33958, + "local_raw_H": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "local_registers": 720, + "local_scalar_additions": 33958, + "negative_controls": [ + { + "omit_bridge": 0, + "rejected": true + }, + { + "omit_bridge": 1, + "rejected": true + }, + { + "omit_bridge": 2, + "rejected": true + }, + { + "omit_bridge": 3, + "rejected": true + }, + { + "omit_bridge": 4, + "rejected": true + }, + { + "omit_bridge": 5, + "rejected": true + }, + { + "omit_bridge": 6, + "rejected": true + }, + { + "omit_bridge": 7, + "rejected": true + }, + { + "omit_bridge": 8, + "rejected": true + }, + { + "omit_bridge": 9, + "rejected": true + }, + { + "omit_bridge": 10, + "rejected": true + }, + { + "omit_bridge": 11, + "rejected": true + }, + { + "omit_bridge": 12, + "rejected": true + }, + { + "omit_bridge": 13, + "rejected": true + }, + { + "omit_bridge": 14, + "rejected": true + }, + { + "omit_bridge": 15, + "rejected": true + }, + { + "omit_bridge": 16, + "rejected": true + }, + { + "omit_bridge": 17, + "rejected": true + } + ], + "new_Q_categories": [ + 28, + 29 + ], + "payload_prefix_bits": 102, + "payload_prefix_upper": "4921056267806722187755121024000", + "reverse_fresh_center_copies": 36, + "scope": "All independent physical input columns over F2, including all arbitrary helper dirt, restored; external copied-center work closes to zero. New cohort scalar lift uses actual signed coefficients and computed cancellation-free bounds; unchanged source527 signed decoder remains separate defining evidence. Physical projector routing and paid rank/bank receipts are independently bound, not inferred from scalar check.", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "176135", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "3751204", + "reverse": true + } + ], + "signed_reverse_semantics": "Reverse ADD coefficient negated; reverse DISCARD is fresh COPY from recorded unchanged original center; reverse COPY is DISCARD. Each such block is inverse over every commutative coefficient ring, by elementary-shear induction.", + "stage_additions": 305622, + "stages": [ + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 0 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 1 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 2 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 3 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 4 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 5 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 6 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": true, + "stage": 7 + }, + { + "fresh_copies": 9, + "scalar_additions": 33958, + "signed_inverse": false, + "stage": 8 + } + ], + "status": "PASS_NEW_COHORT249_ALL_BRIDGED_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL" + } + }, + "stock_immutable_source_checker_rejects": true + }, + "replacement": { + "gram_stdout": "PASS e8ham Gram: 672 frames checked, all nondegenerate and positive definite; prime witnesses valid; max determinant bits 17; primes [2]; by dim {0: 1, 1: 120, 2: 180, 4: 70, 6: 180, 7: 120, 8: 1}", + "interface": { + "cleanup_gates": 2699, + "cleanup_source_gates": 568, + "phase_B_reads_of_sources": 120, + "source_destination_gates_A": 568, + "source_write_frame_dims": { + "4": 568 + }, + "sources_rewritten": 117, + "status": "PASS_PR425_INTERFACE_HYPOTHESES" + }, + "legality": { + "all_final_frames_pass": true, + "common_frame_ADDs": 33940, + "containment_pairs_checked": 2350, + "copies": 9, + "donor_intersections": 0, + "erasures": 9, + "max_inherited_integer_abs": 2, + "nested_MOVEs": 2940, + "new_frame_ids_collision": false, + "nondegeneracy_checked_by_separate_exact_bank_audit": true, + "old_max_frame_id": 671, + "paid_histogram": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "rank_mass": 5592, + "records": 36898, + "scope": "Independent chronological geometry/copy/source-owner audit. F2 all-column replay is in the separately freshly compiled transform receipt; address transform theorem and bank completion remain separate.", + "selected_helpers": 0, + "selected_pairs": 0, + "source_owner_intersections": 0, + "status": "PASS_INDEPENDENT_COHORT_LEGALITY_SOURCE_OWNERS_AND_LIFECYCLE" + }, + "relaxed_word_stdout": "labels: 120 distinct lines of norm 2 (pairwise |ip| <= 1), spanning rank 8\nlegality + exact F2 on all 720 columns: PASS (gates D/A/B/C = 120/2699/240/2699)\nrelaxed check: 1136 gates have a source register as destination; all 120 sources restored exactly\nnondegeneracy: 671 used frames, all Gram dets > 0 (positive-definite form); primes in dets: [2]\nhistogram {1: 6000, 2: 7200, 4: 1140, 6: 600, 7: 240, 8: 45, 14: 240, 18: 240} m 40 W 960 mass 38280 deficit 120 (4v-5L = 120 ) maxchild 18\nno envelope saving in [0.00128681343906332590, 0.00128681343906332590]\nbad envelope saving in [0.00128681343819851354, 0.00128681343819851354]", + "stages": { + "11": { + "bridge_additions": 2880, + "copied_center_original_source_immutable": true, + "formal_columns_checked": 1680, + "fresh_center_copies": 99, + "global_live_registers": 1680, + "independent_dirty_registers": 480, + "local_odd_scalar_additions": 33940, + "local_raw_H": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "local_registers": 720, + "local_scalar_additions": 33940, + "negative_controls": [ + { + "omit_bridge": 0, + "rejected": true + }, + { + "omit_bridge": 1, + "rejected": true + }, + { + "omit_bridge": 2, + "rejected": true + }, + { + "omit_bridge": 3, + "rejected": true + }, + { + "omit_bridge": 4, + "rejected": true + }, + { + "omit_bridge": 5, + "rejected": true + }, + { + "omit_bridge": 6, + "rejected": true + }, + { + "omit_bridge": 7, + "rejected": true + }, + { + "omit_bridge": 8, + "rejected": true + }, + { + "omit_bridge": 9, + "rejected": true + }, + { + "omit_bridge": 10, + "rejected": true + }, + { + "omit_bridge": 11, + "rejected": true + }, + { + "omit_bridge": 12, + "rejected": true + }, + { + "omit_bridge": 13, + "rejected": true + }, + { + "omit_bridge": 14, + "rejected": true + }, + { + "omit_bridge": 15, + "rejected": true + }, + { + "omit_bridge": 16, + "rejected": true + }, + { + "omit_bridge": 17, + "rejected": true + }, + { + "omit_bridge": 18, + "rejected": true + }, + { + "omit_bridge": 19, + "rejected": true + }, + { + "omit_bridge": 20, + "rejected": true + }, + { + "omit_bridge": 21, + "rejected": true + }, + { + "omit_bridge": 22, + "rejected": true + }, + { + "omit_bridge": 23, + "rejected": true + } + ], + "new_Q_categories": [ + 28, + 29 + ], + "payload_prefix_bits": 102, + "payload_prefix_upper": "4742570525118367822773353856000", + "reverse_fresh_center_copies": 45, + "scope": "All independent physical input columns over F2, including all arbitrary helper dirt, restored; external copied-center work closes to zero. New cohort scalar lift uses actual signed coefficients and computed cancellation-free bounds; unchanged source527 signed decoder remains separate defining evidence. Physical projector routing and paid rank/bank receipts are independently bound, not inferred from scalar check.", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "176135", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "3682548", + "reverse": true + } + ], + "signed_reverse_semantics": "Reverse ADD coefficient negated; reverse DISCARD is fresh COPY from recorded unchanged original center; reverse COPY is DISCARD. Each such block is inverse over every commutative coefficient ring, by elementary-shear induction.", + "stage_additions": 373340, + "stages": [ + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 0 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 1 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 2 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 3 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 4 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 5 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 6 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 7 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 8 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 9 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 10 + } + ], + "status": "PASS_NEW_COHORT249_ALL_BRIDGED_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL" + }, + "5": { + "bridge_additions": 720, + "copied_center_original_source_immutable": true, + "five_stage_additions": 169700, + "formal_columns_checked": 960, + "fresh_center_copies": 45, + "global_live_registers": 960, + "independent_dirty_registers": 480, + "local_odd_scalar_additions": 33940, + "local_raw_H": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "local_registers": 720, + "local_scalar_additions": 33940, + "negative_controls": [ + { + "omit_bridge": 0, + "rejected": true + }, + { + "omit_bridge": 1, + "rejected": true + }, + { + "omit_bridge": 2, + "rejected": true + }, + { + "omit_bridge": 3, + "rejected": true + }, + { + "omit_bridge": 4, + "rejected": true + }, + { + "omit_bridge": 5, + "rejected": true + } + ], + "new_Q_categories": [ + 28, + 29 + ], + "payload_prefix_bits": 102, + "payload_prefix_upper": "4742570525118367822773353856000", + "reverse_fresh_center_copies": 18, + "scope": "All independent physical input columns over F2, including all arbitrary helper dirt, restored; external copied-center work closes to zero. New cohort scalar lift uses actual signed coefficients and computed cancellation-free bounds; unchanged source527 signed decoder remains separate defining evidence. Physical projector routing and paid rank/bank receipts are independently bound, not inferred from scalar check.", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "176135", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "3682548", + "reverse": true + } + ], + "signed_reverse_semantics": "Reverse ADD coefficient negated; reverse DISCARD is fresh COPY from recorded unchanged original center; reverse COPY is DISCARD. Each such block is inverse over every commutative coefficient ring, by elementary-shear induction.", + "stages": [ + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 0 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 1 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 2 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 3 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 4 + } + ], + "status": "PASS_NEW_COHORT249_ALL_FIVE_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL" + }, + "9": { + "bridge_additions": 2160, + "copied_center_original_source_immutable": true, + "formal_columns_checked": 1440, + "fresh_center_copies": 81, + "global_live_registers": 1440, + "independent_dirty_registers": 480, + "local_odd_scalar_additions": 33940, + "local_raw_H": [ + [ + 1, + 1200 + ], + [ + 2, + 1440 + ], + [ + 4, + 180 + ], + [ + 6, + 120 + ], + [ + 8, + 9 + ] + ], + "local_registers": 720, + "local_scalar_additions": 33940, + "negative_controls": [ + { + "omit_bridge": 0, + "rejected": true + }, + { + "omit_bridge": 1, + "rejected": true + }, + { + "omit_bridge": 2, + "rejected": true + }, + { + "omit_bridge": 3, + "rejected": true + }, + { + "omit_bridge": 4, + "rejected": true + }, + { + "omit_bridge": 5, + "rejected": true + }, + { + "omit_bridge": 6, + "rejected": true + }, + { + "omit_bridge": 7, + "rejected": true + }, + { + "omit_bridge": 8, + "rejected": true + }, + { + "omit_bridge": 9, + "rejected": true + }, + { + "omit_bridge": 10, + "rejected": true + }, + { + "omit_bridge": 11, + "rejected": true + }, + { + "omit_bridge": 12, + "rejected": true + }, + { + "omit_bridge": 13, + "rejected": true + }, + { + "omit_bridge": 14, + "rejected": true + }, + { + "omit_bridge": 15, + "rejected": true + }, + { + "omit_bridge": 16, + "rejected": true + }, + { + "omit_bridge": 17, + "rejected": true + } + ], + "new_Q_categories": [ + 28, + 29 + ], + "payload_prefix_bits": 102, + "payload_prefix_upper": "4742570525118367822773353856000", + "reverse_fresh_center_copies": 36, + "scope": "All independent physical input columns over F2, including all arbitrary helper dirt, restored; external copied-center work closes to zero. New cohort scalar lift uses actual signed coefficients and computed cancellation-free bounds; unchanged source527 signed decoder remains separate defining evidence. Physical projector routing and paid rank/bank receipts are independently bound, not inferred from scalar check.", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "176135", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "3682548", + "reverse": true + } + ], + "signed_reverse_semantics": "Reverse ADD coefficient negated; reverse DISCARD is fresh COPY from recorded unchanged original center; reverse COPY is DISCARD. Each such block is inverse over every commutative coefficient ring, by elementary-shear induction.", + "stage_additions": 305460, + "stages": [ + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 0 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 1 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 2 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 3 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 4 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 5 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 6 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": true, + "stage": 7 + }, + { + "fresh_copies": 9, + "scalar_additions": 33940, + "signed_inverse": false, + "stage": 8 + } + ], + "status": "PASS_NEW_COHORT249_ALL_BRIDGED_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL" + } + }, + "stock_immutable_source_checker_rejects": true + } + } +} diff --git a/research/r480-qnode-seed02/NOTICE.md b/research/r480-qnode-seed02/NOTICE.md new file mode 100644 index 0000000000..1eb233fbd0 --- /dev/null +++ b/research/r480-qnode-seed02/NOTICE.md @@ -0,0 +1,33 @@ +# Attribution and license + +Prepared for **ToikY** with substantial assistance from **OpenAI Codex**, +including bounded circuit search, implementation, exact replay, documentation +and separate AI review. The independent implementation is independent code, +not an independent human review. New material is licensed under the repository's +Apache-2.0 license. Existing source notices remain unchanged. + +The mathematical object is inherited from: + +- eumemic's [PR493](https://github.com/CrocSwap/integer-mult-bounds/pull/493), + E8 carrier skeleton and native verification framework. +- DreamingOfClouds's [PR503](https://github.com/CrocSwap/integer-mult-bounds/pull/503) + and [PR510](https://github.com/CrocSwap/integer-mult-bounds/pull/510), the + R480 word and nine-stage replay. Their exact source heads and the retained + word hash are recorded in `SOURCES.json`. +- Hao Yan's [PR823](https://github.com/CrocSwap/integer-mult-bounds/pull/823), + related R480 six-wire quad1 resynthesis. This submission instead changes + the twelve-source Q-node2 matrix. + +Bounded XOR resynthesis builds on the research approach represented by +Jeffrey Cox's PR754, Gareth Davidson's PR904/952 and Ross Richardson's PR936. +PR857/906/980 provide precedent for complete precision admission without +requiring local positive-envelope domination. No priority claim is made for +that general mechanism. + +`native.py` adapts Ross Richardson's retained PR925 harness, which credits +Ali Romman's PR688 work, together with the PR503/510 verification commands. +It runs the existing exporter, stage-cohort builder, legality and column +checkers, relaxed mutable-source checker, PR425 interface and Gram checker. +Credit for those inherited components includes Dylan Crow, Zhihao Chen, +DaysSky and the contributors named in the retained carrier-skeleton notice. +No imported checker has been edited. diff --git a/research/r480-qnode-seed02/PROOF.md b/research/r480-qnode-seed02/PROOF.md new file mode 100644 index 0000000000..5c5dd9ad62 --- /dev/null +++ b/research/r480-qnode-seed02/PROOF.md @@ -0,0 +1,183 @@ +# Fixed-output resynthesis of one historical R480 Q-node + +This is a finite bit-circuit construction, conditional on the inherited +mutable-source and native bit interfaces. It changes one historical PR503/510 +R480 block, not the selected PR589 supplier or PR942 exponent. All arithmetic +endpoint equalities below are over F2 unless explicitly described as positive +integer growth bounds. No full multiplication theorem is proved here. + +## Exact object and changed mechanism + +The source is the immutable R480 word in `SOURCES.json`, at base +`407d52ff15b2217b6e22bce44728b4c3907b6515`. Phase A events `[2250:2302]` +(zero based, upper endpoint excluded) form Q-node2 at frame484. Its ordered +source registers are + +```text +17, 25, 32, 43, 52, 58, 64, 77, 82, 90, 99, 104. +``` + +Every input is arbitrary. These are existing source registers, not clean +ancillas or freely initialized work. The old block has 52 one-source XORs. +Writing its twelve outputs as row bitmasks in the above input order gives + +```text +4095, 2390, 3835, 3831, 1625, 3935, +3951, 16, 207, 4, 1023, 1. +``` + +The new construction allows cancellation within a complete twelve-source +invertible F2 transform. This differs from preserving a positive integer +transfer, and from substituting the six-wire helper quad in PR823. It uses +the same common frame and the same twelve registers. `RECIPE.json` lists +all 43 new XORs with their actual global register identifiers. + +## Fixed outputs and complete restoration + +An elementary row operation `d ^= s` is its own inverse over F2. Gauss-Jordan +elimination reduces the source matrix M to I by a recorded chronological +sequence of these operations. Every required row swap is implemented by +three charged XORs; row labels are never silently permuted. Reversing that +sequence therefore implements M on the original, fixed output registers. +The verifier compares all twelve output rows, rather than only their span, +rank, output multiset or values on clean source inputs. + +For any surrounding linear context, substituting an equal matrix at the +same boundary preserves its F2 state. The local Boolean check also enumerates +all 4,096 inputs and the literal inverse. In the complete word, D and every +part of A outside the block remain unchanged; B, the nine retained totals, +scatter, frame definitions and source/final frame labels remain unchanged. +The new C is the literal full-frame reverse of the entire modified A. +Since B writes only targets, this is precisely the inherited cleanup rule. +It restores the mutable sources and all 480 arbitrary dirty helpers. + +The primary bitset interpreter and the separate support-set interpreter +check all 720 independent persistent input columns: 120 sources, 120 targets +and 480 helpers. In both forward and inverse scalar replay the endpoint is + +```text +(x, y, h) -> (x, y XOR x, h), +``` + +with every external copied-center temporary erased. Both interpreters enforce +immutable copied centers between COPY and ERASE. The inverse reverses ADDs +and interchanges COPY with ERASE, using the original center binding. All nine +copy lifetimes close. This is finite F2 evidence, not equality of the old and +new integer or real coefficient matrices. + +## Complete local price and frame obligations + +The source block is 52 XORs; the replacement is 43. Reverse cleanup therefore +costs 43 instead of 52 as well. The complete local bill is + +```text +33,958 - (52 - 43) - (52 - 43) = 33,940 ADDs. +``` + +The saving is eighteen, including restoration. No scratch register, COPY, +ERASE, source-access instruction or recursive call is introduced. Every +source use appears as a charged ADD operand. This is a primitive count, +not an elapsed-time improvement or a physical hosting invoice. + +All twelve source registers still visit frame484, and they do so within +the same uninterrupted block. The complete per-register frame paths are +identical, which preserves the nested climb bill. The sequence in which +different registers first move can change; equality of individual paths +does not assert byte equality of the interleaved MOVE stream. Exact frame +legality must be checked on the emitted candidate records. + +The native legality and column checks retain nine copies/erasures and the +paid local histogram + +```text +{1:1200, 2:1440, 4:180, 6:120, 8:9}. +``` + +The selected supplier and the recurrence moment receive no proposed change. +There is no claim that eighteen fewer scalar ADDs improve kappa. + +## Positive growth is a separate admission + +F2 equality alone gives no useful bound on the signed lift's intermediate +magnitudes. In independent local block-input coordinates the forward +cancellation-free maximum row sum actually rises from **25 to 99**. The +inverse value falls from **1,721 to 29**. Neither the old integer transfer +nor entrywise forward domination is preserved. A local-domination argument +would reject or fail to justify this candidate. + +The complete chronological word, including D, A, all copied-center work, +scatter, B and C, is evaluated separately in both directions. Its exact +positive scalar bounds are + +| Bound | Original | Replacement | +| --- | ---: | ---: | +| Forward F | 176,135 | 176,135 | +| Inverse B | 3,751,204 | 3,682,548 | +| `64 F^3 B^2` | 4,921,056,267,806,722,187,755,121,024,000 | 4,742,570,525,118,367,822,773,353,856,000 | + +Both payload bounds have bit length102 and are strictly below `2^104`. +The Python implementations independently reproduce them; the retained C++ +column checkers enforce that same complete inequality. Checking it is +essential: an additional repeated six-XOR identity cycle preserves every +F2 endpoint but can exceed the 104-bit cap. That endpoint-valid counterexample +is an explicit negative control. + +This comparison does not prove that every new intermediate is smaller, nor +does it supply a new hosted-parent chronological precision invoice. The local +bound, the finite multistage column checks and a global hosted invoice are +different obligations. Only the executed checks in `VALIDATION.md` are claimed. + +## Bounded search and what it establishes + +Assignment seed2 selected the bit track and this twelve-source object. The +frozen search uses Python `random.Random(2)` for exactly 1,000 trajectories, +starting from this single matrix each time. It shuffles pivot-column order, +keeps a nonzero diagonal pivot when possible, otherwise chooses a nonzero +unprocessed row, pays every three-XOR swap, and eliminates the other rows. +The first shortest encountered word is retained. No early restart, search +across source reorderings after the run, or favorable seed selection is used. +The separate preliminary Q-node1/8 orientation probes are disclosed in +`VALIDATION.md`; they are not part of this admitted result. + +Trial860 (zero based) gives the unique 43-XOR word encountered. The complete +length histogram and sequence of improvements are retained, and +`search.py` recomputes them exactly. This is a bounded witness search, not a +proof of a 43-XOR minimum, an exhaustive enumeration of all elimination +orders or a lower bound on arbitrary XOR circuits. + +## Failure detection and scope + +Every one of the 43 candidate-gate deletions changes the local map. Independent +controls additionally check fixed output ordering, arbitrary source/helper/ +target dirt, omitted compensation and cleanup gates, an incorrect frame and +an unclosed copied-center temporary. The growth control above separates +endpoint validity from precision admission. + +One subtle control retains the old 52-gate cleanup after installing the new +43-gate forward block. It still has the correct endpoint, because the two +local F2 matrices agree, but its complete bill is **33,949** and it violates +this construction's literal-inverse rule. It is rejected by the explicit +cleanup contract, not falsely reported as an endpoint failure. A correct +endpoint alone would not certify the claimed eighteen-ADD saving. + +The unchanged native checkers cover finite legality, source ownership, +copied-center lifecycle and 5/9/11-stage columns. Remaining obligations include +full hosted-parent/whole-owner reconstruction, revised supplier bindings and +invoice/outer assembly, and the inherited all-size/compiler, common-label/ +mutable-source realization, rounding/tape/recovery and analytic assumptions. +No unconditional multiplication result or formal proof of that theorem follows. + +## Credit + +The Q-node matrix and its original construction come from eumemic's PR493 +carrier skeleton and DreamingOfClouds's PR503/510 R480 adaptation. Hao Yan's +PR823 supplies related six-wire R480 resynthesis; the recipes are separate. +Jeffrey Cox's PR754 and Gareth Davidson/Ross Richardson's PR904/936/952 +provide bounded XOR-resynthesis precedent. PR857/906/980 demonstrate why +complete precision admission may be useful without local domination; no +priority claim is made for that general idea. Native checks retain Dylan +Crow, Zhihao Chen, DaysSky and the inherited contributors' notices. + +Prepared for ToikY with substantial OpenAI Codex assistance, including separate +implementation and mathematical review; no independent human review claimed. +Apache-2.0. diff --git a/research/r480-qnode-seed02/README.md b/research/r480-qnode-seed02/README.md new file mode 100644 index 0000000000..1924f4a8cf --- /dev/null +++ b/research/r480-qnode-seed02/README.md @@ -0,0 +1,79 @@ +# R480 Q-node2: 52 to 43 XORs, including paid reverse cleanup + +**Status: finite bit-supplier construction; no new kappa.** One twelve-source +block in the historical PR503/510 R480 word uses 43 rather than 52 XORs. +Rebuilding its literal reverse cleanup saves **18 ADDs per complete local +word: 33,958 to 33,940**. The 480 helpers, nine copies, register frame paths +and paid recursive histogram remain unchanged. + +The replacement preserves the fixed F2 outputs on arbitrary inputs. It does +not preserve the positive integer transfer: the local forward bound grows +from 25 to 99. Separate complete-word positive-prefix checks admit the +replacement within the inherited 104-bit allowance. This is a useful small +construction on a historical supplier, not an updated selected exponent. + +## Reproduce + +From the repository root, with Python 3.10 or newer and no Python dependencies: + +```sh +python3 -I -B research/r480-qnode-seed02/verify.py --replay-search +``` + +Expected final line: + +```text +PASS_R480_QNODE_SEED02 block=52->43 ADDs=33958->33940 columns=720 payload_bits=102 no_new_kappa +``` + +This verifies the pinned source closure, regenerates all 1,000 search trials, +checks every fixed output, runs two separately implemented whole-word +interpreters on all 720 persistent columns, checks exact positive bounds and +negative controls, and compares the complete receipt to `EXPECTED.json`. +The same command works under `python3 -I -O -B`; its checks use explicit +exceptions, not removable assertions. + +To export both complete canonical words without modifying inherited files, +add `--emit /absolute/path/to/a/new-directory`. Existing output directories +are refused. Regenerated gzip bytes need not match across compression +implementations; comparisons use the complete canonical JSON payload. + +Additional package regression checks: + +```sh +python3 -I -B research/r480-qnode-seed02/test_package.py +``` + +For the unchanged retained C++ legality, 5/9/11-stage column, mutable-source, +interface and Gram checks, use a C++17 compiler and Boost headers: + +```sh +BOOST_INCLUDE=/path/containing/boost CXX=c++ \ + python3 -I -B research/r480-qnode-seed02/native.py \ + --out /absolute/path/to/a/new-native-directory +``` + +The default Boost include root is `/usr/include`; it must contain +`boost/multiprecision/cpp_int.hpp`. See [VALIDATION.md](VALIDATION.md) for the +executed native results, environment and exact scope. The native wrapper +writes all raw logs and receipts into the new output directory and compares +the normalized mathematical results with `NATIVE.json`. + +## Evidence and limits + +- [RECIPE.json](RECIPE.json): the exact replacement, fixed matrix, search + domain, seed, full length histogram, improvement sequence and local bounds. +- [PROOF.md](PROOF.md): substitution argument, full local cost, precision + admission, controls, inherited assumptions and outstanding obligations. +- [EXPECTED.json](EXPECTED.json): two-implementation finite replay receipt. +- [SOURCES.json](SOURCES.json): 21 immutable input hashes and Git blobs at + base `407d52ff15b2217b6e22bce44728b4c3907b6515`. +- [CLAIM.md](CLAIM.md): assignment seed2, alternatives, overlap review and + completed search coverage. +- [NOTICE.md](NOTICE.md): predecessor attribution, license and AI disclosure. + +No lower bound or optimality claim is made for the 43-XOR word. The selected +PR942 U8/T37 record remains conditional kappa `0.001661960547713947`, using +the unchanged PR589/555 bit supplier at this base. A global hosted-parent +invoice, outer assembly and all-size realization are outside this result. +Finite certificate success is not a formal proof of the multiplication theorem. diff --git a/research/r480-qnode-seed02/RECIPE.json b/research/r480-qnode-seed02/RECIPE.json new file mode 100644 index 0000000000..327179cf92 --- /dev/null +++ b/research/r480-qnode-seed02/RECIPE.json @@ -0,0 +1,1188 @@ +{ + "base_commit": "407d52ff15b2217b6e22bce44728b4c3907b6515", + "complete_A_plus_literal_C_xor_saving": 18, + "fixed_output_f2_rows": [ + 4095, + 2390, + 3835, + 3831, + 1625, + 3935, + 3951, + 16, + 207, + 4, + 1023, + 1 + ], + "new_xor_count": 43, + "object": { + "frame": 484, + "phase": "A", + "registers_in_matrix_order": [ + 17, + 25, + 32, + 43, + 52, + 58, + 64, + 77, + 82, + 90, + 99, + 104 + ], + "slice_end_exclusive": 2302, + "slice_start_inclusive": 2250 + }, + "old_xor_count": 52, + "positive_local": { + "new_forward": { + "endpoint_matrix": [ + [ + 1, + 1, + 1, + 1, + 1, + 11, + 1, + 13, + 7, + 9, + 1, + 3 + ], + [ + 0, + 1, + 1, + 0, + 1, + 6, + 1, + 8, + 3, + 4, + 0, + 1 + ], + [ + 1, + 1, + 2, + 1, + 1, + 13, + 1, + 15, + 8, + 11, + 1, + 3 + ], + [ + 1, + 1, + 1, + 2, + 1, + 13, + 1, + 15, + 8, + 11, + 1, + 3 + ], + [ + 1, + 2, + 2, + 1, + 3, + 18, + 3, + 24, + 10, + 13, + 1, + 4 + ], + [ + 1, + 1, + 1, + 1, + 1, + 12, + 1, + 14, + 7, + 9, + 1, + 3 + ], + [ + 1, + 1, + 1, + 1, + 2, + 13, + 3, + 18, + 7, + 9, + 1, + 3 + ], + [ + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 6, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 1, + 2, + 16, + 3, + 21, + 10, + 12, + 2, + 4 + ], + [ + 0, + 0, + 1, + 0, + 0, + 4, + 0, + 4, + 2, + 4, + 0, + 0 + ], + [ + 1, + 1, + 1, + 1, + 1, + 13, + 1, + 15, + 9, + 11, + 2, + 4 + ], + [ + 1, + 2, + 2, + 2, + 2, + 22, + 2, + 26, + 14, + 18, + 2, + 6 + ] + ], + "endpoint_row_sums": [ + 50, + 26, + 58, + 58, + 82, + 52, + 60, + 11, + 74, + 15, + 60, + 99 + ], + "maximum_prefix_row_l1": 99 + }, + "new_inverse": { + "endpoint_matrix": [ + [ + 6, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1 + ], + [ + 11, + 5, + 1, + 1, + 3, + 1, + 1, + 0, + 1, + 0, + 2, + 1 + ], + [ + 12, + 4, + 2, + 0, + 4, + 0, + 2, + 0, + 2, + 1, + 2, + 0 + ], + [ + 12, + 4, + 1, + 1, + 4, + 0, + 2, + 0, + 2, + 1, + 2, + 0 + ], + [ + 6, + 4, + 0, + 0, + 4, + 0, + 2, + 1, + 0, + 0, + 0, + 0 + ], + [ + 4, + 2, + 0, + 0, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0 + ], + [ + 6, + 3, + 0, + 0, + 3, + 1, + 2, + 1, + 0, + 0, + 0, + 0 + ], + [ + 3, + 2, + 0, + 0, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + [ + 11, + 4, + 1, + 0, + 4, + 0, + 2, + 0, + 2, + 1, + 2, + 0 + ], + [ + 7, + 2, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 0 + ], + [ + 9, + 3, + 0, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 3, + 1 + ], + [ + 8, + 3, + 0, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 2, + 1 + ] + ], + "endpoint_row_sums": [ + 13, + 27, + 29, + 29, + 17, + 11, + 16, + 9, + 27, + 17, + 21, + 19 + ], + "maximum_prefix_row_l1": 29 + }, + "old_forward": { + "endpoint_matrix": [ + [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + [ + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1 + ], + [ + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1 + ], + [ + 1, + 2, + 2, + 1, + 3, + 2, + 3, + 2, + 2, + 1, + 1, + 2 + ], + [ + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1, + 2, + 3, + 3, + 4, + 1, + 1, + 1, + 1 + ], + [ + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 4, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 2, + 2, + 2, + 2 + ], + [ + 0, + 0, + 1, + 0, + 2, + 2, + 0, + 0, + 2, + 2, + 0, + 0 + ], + [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2 + ], + [ + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 4 + ] + ], + "endpoint_row_sums": [ + 12, + 6, + 14, + 14, + 22, + 14, + 20, + 9, + 18, + 9, + 14, + 25 + ], + "maximum_prefix_row_l1": 25 + }, + "old_inverse": { + "endpoint_matrix": [ + [ + 686, + 242, + 14, + 4, + 238, + 262, + 120, + 96, + 20, + 12, + 24, + 3 + ], + [ + 243, + 87, + 5, + 1, + 85, + 93, + 43, + 34, + 7, + 4, + 8, + 1 + ], + [ + 58, + 20, + 2, + 0, + 20, + 22, + 10, + 8, + 2, + 1, + 2, + 0 + ], + [ + 58, + 20, + 1, + 1, + 20, + 22, + 10, + 8, + 2, + 1, + 2, + 0 + ], + [ + 20, + 8, + 0, + 0, + 8, + 8, + 4, + 3, + 0, + 0, + 0, + 0 + ], + [ + 6, + 2, + 0, + 0, + 2, + 3, + 1, + 1, + 0, + 0, + 0, + 0 + ], + [ + 8, + 3, + 0, + 0, + 3, + 3, + 2, + 1, + 0, + 0, + 0, + 0 + ], + [ + 5, + 2, + 0, + 0, + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 0 + ], + [ + 57, + 20, + 1, + 0, + 20, + 22, + 10, + 8, + 2, + 1, + 2, + 0 + ], + [ + 29, + 10, + 1, + 0, + 10, + 11, + 5, + 4, + 1, + 1, + 1, + 0 + ], + [ + 101, + 35, + 2, + 1, + 34, + 38, + 17, + 14, + 3, + 2, + 5, + 1 + ], + [ + 100, + 35, + 2, + 1, + 34, + 38, + 17, + 14, + 3, + 2, + 4, + 1 + ] + ], + "endpoint_row_sums": [ + 1721, + 611, + 145, + 145, + 51, + 15, + 20, + 13, + 143, + 73, + 253, + 251 + ], + "maximum_prefix_row_l1": 1721 + }, + "scope": "Independent block-input columns only; not complete native prefix admission." + }, + "replacement_A_events": [ + [ + 484, + 58, + [ + 77 + ] + ], + [ + 484, + 64, + [ + 77 + ] + ], + [ + 484, + 52, + [ + 77 + ] + ], + [ + 484, + 90, + [ + 58 + ] + ], + [ + 484, + 64, + [ + 58 + ] + ], + [ + 484, + 25, + [ + 58 + ] + ], + [ + 484, + 82, + [ + 90 + ] + ], + [ + 484, + 32, + [ + 90 + ] + ], + [ + 484, + 43, + [ + 90 + ] + ], + [ + 484, + 90, + [ + 82 + ] + ], + [ + 484, + 104, + [ + 82 + ] + ], + [ + 484, + 99, + [ + 82 + ] + ], + [ + 484, + 32, + [ + 82 + ] + ], + [ + 484, + 25, + [ + 82 + ] + ], + [ + 484, + 43, + [ + 82 + ] + ], + [ + 484, + 99, + [ + 104 + ] + ], + [ + 484, + 25, + [ + 104 + ] + ], + [ + 484, + 17, + [ + 104 + ] + ], + [ + 484, + 82, + [ + 99 + ] + ], + [ + 484, + 104, + [ + 99 + ] + ], + [ + 484, + 17, + [ + 99 + ] + ], + [ + 484, + 77, + [ + 64 + ] + ], + [ + 484, + 82, + [ + 64 + ] + ], + [ + 484, + 52, + [ + 64 + ] + ], + [ + 484, + 77, + [ + 52 + ] + ], + [ + 484, + 82, + [ + 52 + ] + ], + [ + 484, + 64, + [ + 52 + ] + ], + [ + 484, + 25, + [ + 52 + ] + ], + [ + 484, + 90, + [ + 32 + ] + ], + [ + 484, + 25, + [ + 32 + ] + ], + [ + 484, + 104, + [ + 25 + ] + ], + [ + 484, + 52, + [ + 25 + ] + ], + [ + 484, + 17, + [ + 25 + ] + ], + [ + 484, + 104, + [ + 43 + ] + ], + [ + 484, + 17, + [ + 43 + ] + ], + [ + 484, + 58, + [ + 17 + ] + ], + [ + 484, + 82, + [ + 17 + ] + ], + [ + 484, + 104, + [ + 17 + ] + ], + [ + 484, + 99, + [ + 17 + ] + ], + [ + 484, + 64, + [ + 17 + ] + ], + [ + 484, + 52, + [ + 17 + ] + ], + [ + 484, + 32, + [ + 17 + ] + ], + [ + 484, + 43, + [ + 17 + ] + ] + ], + "schema": "r480-qnode-seed02/1", + "search": { + "best_length_occurrences": 1, + "distinct_best_words_encountered": 1, + "domain": "One 12x12 fixed-output F2 map; shuffled column order; keep diagonal pivot when nonzero, otherwise uniformly choose an unprocessed nonzero pivot row; three XORs per row swap; eliminate every other row in shuffled order; reverse elimination to synthesize.", + "first_best_trial_zero_based": 860, + "length_histogram": { + "43": 1, + "44": 2, + "45": 1, + "47": 4, + "48": 6, + "49": 6, + "50": 12, + "51": 17, + "52": 30, + "53": 27, + "54": 25, + "55": 29, + "56": 30, + "57": 43, + "58": 46, + "59": 49, + "60": 56, + "61": 44, + "62": 51, + "63": 61, + "64": 55, + "65": 49, + "66": 47, + "67": 53, + "68": 51, + "69": 40, + "70": 33, + "71": 30, + "72": 17, + "73": 19, + "74": 10, + "75": 15, + "76": 10, + "77": 6, + "78": 6, + "79": 9, + "80": 5, + "81": 1, + "82": 2, + "83": 1, + "84": 1 + }, + "optimality_claim": false, + "rng": "Python random.Random (MT19937)", + "seed": 2, + "stopping_rule": "Exactly 1000 trajectories; no early stop or restart.", + "strict_improvements": [ + { + "trial_zero_based": 0, + "xor_count": 60 + }, + { + "trial_zero_based": 1, + "xor_count": 54 + }, + { + "trial_zero_based": 4, + "xor_count": 52 + }, + { + "trial_zero_based": 5, + "xor_count": 50 + }, + { + "trial_zero_based": 18, + "xor_count": 48 + }, + { + "trial_zero_based": 216, + "xor_count": 47 + }, + { + "trial_zero_based": 283, + "xor_count": 44 + }, + { + "trial_zero_based": 860, + "xor_count": 43 + } + ], + "tie_rule": "Keep the first shortest encountered word.", + "trials_completed": 1000 + }, + "source": { + "path": "research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz", + "sha256": "92e399e9a486b55229b5624632ac54f800dd9e022f2aee97f1e5f264bbc0ef5c" + } +} diff --git a/research/r480-qnode-seed02/SOURCES.json b/research/r480-qnode-seed02/SOURCES.json new file mode 100644 index 0000000000..57218a7d2a --- /dev/null +++ b/research/r480-qnode-seed02/SOURCES.json @@ -0,0 +1,122 @@ +{ + "base_commit": "407d52ff15b2217b6e22bce44728b4c3907b6515", + "files": { + "research/e8-bit-carrier-skeleton/NOTICE.md": { + "git_blob": "5a0ecdcd2c7fad0488740a1da0f633b73b56a809", + "sha256": "5f4b7fcbf99f572be28b6da612ce775363908cdfc7810f7aca167be01c86e49a" + }, + "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_h.cpp": { + "git_blob": "00c5a3a5d81d083582f60f33dd2e7bea5049c37f", + "sha256": "d1297f9052be4f2496e1ff2a77e4db2c0cdbd7d460d489b4c03e50bf317238ce" + }, + "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_k.cpp": { + "git_blob": "42bb232fbec4de703e70cc13dc2f39a3b43a3a01", + "sha256": "1c344d18fcd494eeca93e259f10cafae7705780e6592f6dcb35b34752dab9bc2" + }, + "research/e8-bit-carrier-skeleton/code/bit/checkers/gram_frames.py": { + "git_blob": "b740d47295c02692260d7cc01874a49fe48f78ab", + "sha256": "223a5a07731fc315a90a3e48177796babc155c1d9985c7ae5017eff6af2a0608" + }, + "research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp": { + "git_blob": "82d69f7c5d044c9887c96b90c97f5639083ecd14", + "sha256": "aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63" + }, + "research/e8-bit-carrier-skeleton/code/bit/checkers/legality_h.cpp": { + "git_blob": "cb1233c7e96b1aa8bbf4d2e4165d75ab0dca64b9", + "sha256": "6c1ef2b24e57781d6951c172a1024fc4300e6fd392c9d6672079a7806ab663b3" + }, + "research/e8-bit-carrier-skeleton/code/bit/export_records.py": { + "git_blob": "3632d370486a02f5456f7643ced03f8c925b2350", + "sha256": "8a5999601f917dbb492bb9ae9a344611f18cc7cedc53dc3c76496a369e530eb3" + }, + "research/e8-bit-carrier-skeleton/code/bit/independent/checkword.py": { + "git_blob": "da4e0fe05067184d4dab1e130ae1384c1fa983f5", + "sha256": "11bf9620ca9db16d52d9fe806b814fc9ec9a89c4d7645354d1861d96f6e805ad" + }, + "research/e8-bit-carrier-skeleton/code/bit/independent/interface.py": { + "git_blob": "8beb87c39a07e389c8f83f32ab9d17f8097ed9b1", + "sha256": "2c63a039f97e3a11ce5a6b83302d4f5beda160c1db14164a5a9b0855aeb19d3c" + }, + "research/e8-bit-carrier-skeleton/code/bit/independent/relax.py": { + "git_blob": "a37e8b8176080d4a977bb48bd25f92f4a62b156b", + "sha256": "d6e9f58de3fa41f538516b6227c249d61fb30f0f6843027cc8a07a1a372fa6b6" + }, + "research/e8-bit-carrier-skeleton/code/bit/regression/stage_cohort.py": { + "git_blob": "f6d7afe3e623208c4207b6a683a1e3e49249e31c", + "sha256": "6c288f6f234b528c1a7c0a4adfb724e91e0fe6b18c8dffad96af3f973de1829a" + }, + "research/e8-bit-carrier-skeleton/code/pricing/moment.py": { + "git_blob": "7d697cb45203fe72d97037403d6da41f71f3b7fd", + "sha256": "81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482" + }, + "research/e8-bit-carrier-skeleton/code/pricing/prime_witnesses.py": { + "git_blob": "7f16d930302ae879c562dd58e085d9747fcac077", + "sha256": "98cd03bc9582e7bd0ab194c191ea8eea940539e510051443ab9fd3e572a364ab" + }, + "research/e8-bit-carrier-skeleton/code/skeleton/gen.py": { + "git_blob": "9811c127d41521e906462a75322a29f0e193629c", + "sha256": "7cdcf48078ed4beacd2e240aa8145e4aa6984558748d07659cb1b252786e073a" + }, + "research/e8-bit-carrier-skeleton/code/skeleton/wordkit.py": { + "git_blob": "7cc4e6d618d9d0166efe8be75a019b6aecee0582", + "sha256": "2b6c12d96f24a4e81f2c807827c2b74cf80037367fc8034e8c871dd5ce008351" + }, + "research/e8-bit-carrier-skeleton/portable-include/bits/stdc++.h": { + "git_blob": "fc5664e929d9a81d9b4926bee049a93330be86ec", + "sha256": "420094be2af295eed03a983dd66debbbe9cfb78d8252859f4498a615a0074b99" + }, + "research/e8-r480-dead-totals/MANIFEST.json": { + "git_blob": "49e38e028321635ca64d3ed4371a7c03017d757d", + "sha256": "aa26122b472a4d245f6c45929d19650b5000bdd26a7d454706466b9389922fc1" + }, + "research/e8-r480-dead-totals/NOTICE.md": { + "git_blob": "0f6e1f4c4dad3b24888b1e76c921fec5ad5fa01f", + "sha256": "90e0b76e6f7c15bda8d854ec5bc6e07e4553ec1f73c86b17c35bd77b0abc4438" + }, + "research/e8-r480-dead-totals/README.md": { + "git_blob": "aebd270eeff96603eb8365ebaf9c0bb96e6c3558", + "sha256": "8a2c494ffe729b903a87548a4ac68a56ceb81d45e4f786985f18c1091897fe2f" + }, + "research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz": { + "git_blob": "8e59c4b5380d522b1c1cb930029a71556b2fa65f", + "sha256": "92e399e9a486b55229b5624632ac54f800dd9e022f2aee97f1e5f264bbc0ef5c" + }, + "research/e8-r480-nine-stage/README.md": { + "git_blob": "733f58cea634a65fc19ee08d5d3997e7598227e2", + "sha256": "14ba6d703dde9429c82c546199affe855c147ccfd5012fc13da9f18cdf0b5dda" + } + }, + "predecessors": { + "pr503": "3f27147013fdd4fa0aed825cb47bff3376c452eb", + "pr510": "64edee18af02aab0c1696b677a0287dd0146381b", + "related_pr823": "83d547e30fed98682ffc6eacbeeaafa96cfb42fb" + }, + "required_files": [ + "research/e8-bit-carrier-skeleton/NOTICE.md", + "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_h.cpp", + "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_k.cpp", + "research/e8-bit-carrier-skeleton/code/bit/checkers/gram_frames.py", + "research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp", + "research/e8-bit-carrier-skeleton/code/bit/checkers/legality_h.cpp", + "research/e8-bit-carrier-skeleton/code/bit/export_records.py", + "research/e8-bit-carrier-skeleton/code/bit/independent/checkword.py", + "research/e8-bit-carrier-skeleton/code/bit/independent/interface.py", + "research/e8-bit-carrier-skeleton/code/bit/independent/relax.py", + "research/e8-bit-carrier-skeleton/code/bit/regression/stage_cohort.py", + "research/e8-bit-carrier-skeleton/code/pricing/moment.py", + "research/e8-bit-carrier-skeleton/code/pricing/prime_witnesses.py", + "research/e8-bit-carrier-skeleton/code/skeleton/gen.py", + "research/e8-bit-carrier-skeleton/code/skeleton/wordkit.py", + "research/e8-bit-carrier-skeleton/portable-include/bits/stdc++.h", + "research/e8-r480-dead-totals/MANIFEST.json", + "research/e8-r480-dead-totals/NOTICE.md", + "research/e8-r480-dead-totals/README.md", + "research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz", + "research/e8-r480-nine-stage/README.md" + ], + "selection_context": { + "kappa": "1661960547713947/1000000000000000000", + "scope": "Context only; no changed selected supplier or bound.", + "source_pr": 942 + } +} diff --git a/research/r480-qnode-seed02/VALIDATION.md b/research/r480-qnode-seed02/VALIDATION.md new file mode 100644 index 0000000000..68b1f9bb0d --- /dev/null +++ b/research/r480-qnode-seed02/VALIDATION.md @@ -0,0 +1,119 @@ +# Executed validation + +Base: `407d52ff15b2217b6e22bce44728b4c3907b6515`. +Assignment: fresh OS seed 2, bit-supplier track. Executed 2026-10-13. +Python environment: CPython 3.12.14, macOS 26.5.2 arm64. The package itself +requires only the Python standard library; native replay additionally uses +C++17 and Boost. These are finite mathematical and failure-mode checks, +not performance benchmarks or formal verification of the full theorem. + +## Python and independent checks — PASS + +- `python3 -I -B research/r480-qnode-seed02/verify.py --replay-search`: + all 1,000 frozen Q-node2 trajectories replayed; exact recipe and receipt + matched. The complete command also passed in an isolated minimal source + closure under `-I -O -B`, in a directory containing spaces. +- `python3 -I -B research/r480-qnode-seed02/test_package.py`: + **4 regression groups passed**, 7.536 seconds in this environment. Tests + cover fixed output labels, frame/register scope, non-integer/Boolean + metadata, source-byte corruption, removal of a pinned input from both + manifest lists, receipt type corruption and safe refusal to overwrite + existing output directories. The minimal-copy test confirms inherited + inputs are byte-identical after replay and compares decompressed exports. +- `independent.py`: all 4,096 local Boolean assignments and their inverse, + every one of 720 arbitrary persistent input columns, both chronological + positive-prefix directions and all 720 register frame paths. This separate + support-set implementation does not import the search or primary verifier. +- Independent reconstruction of every native record tuple matched the actual + unchanged exporter output for both words: 36,916 original records and + 36,898 replacement records. This comparison passed under `-I -O -B`. +- All 21 retained inputs matched both the SHA256 and Git blob at the exact + base commit. No inherited input, `upstream/`, selected record, generator + or global artifact was changed. +- `scripts/verify_selected_result.py`: PASS at the selected PR942 value. + The selected-result regression module's **25 tests passed** (0.687 seconds). + These protect selection bookkeeping; they do not prove this candidate's + mathematical admission. + +The two interpreters agree on complete ADD counts 33,958/33,940, F = 176,135 +for both, B = 3,751,204/3,682,548, and the exact payloads in `EXPECTED.json`. +Each payload has bit length 102 and is strictly below 2^104. Local positive +forward growth rises 25 -> 99; no entrywise positive-domination claim is made. + +## Negative controls — PASS + +There are **53 distinct adverse cases** across the Python checks: all 43 +single-gate deletions; eight additional independent controls (output swap, +source/helper/target incorrectly treated as zero, omitted compensation, +omitted cleanup, wrong frame, omitted ERASE); and two primary controls. +The overlapping gate-deletion coverage is not double-counted. + +The two primary controls deliberately preserve the F2 endpoint: + +1. Keeping the old cleanup after replacing A has 33,949 ADDs and fails the + literal-inverse contract. It is not an endpoint counterexample. +2. Repeated six-XOR identity cycles with matching reverse cleanup pass the + endpoint check but fail the complete 104-bit precision allowance. + +These controls distinguish endpoint validity, claimed cost and precision. + +## Native replay — PASS + +`native.py` ran both complete words through the unchanged retained checks. +`NATIVE.json` contains their complete receipts, removing only elapsed time +and a temporary scalar-stream path. + +- Legality, source ownership and copied-center lifecycle: PASS. +- 5/9/11 stages: **960/1,440/1,680 formal columns per word**, respectively; + **96 rejected bridge controls** across both words. +- **2,940 nested MOVEs, 9 COPYs, 9 ERASEs, rank mass 5,592** and histogram + `[[1,1200],[2,1440],[4,180],[6,120],[8,9]]` remain identical. +- Relaxed mutable-source 720-column checker and PR425 interface: PASS. + The stock immutable-source checker rejects both words as expected. +- Positive E8 Gram checks: all **672 frames per word** pass. +- The word hashes and complete positive bounds exactly match both Python + implementations. ADD saving is 18 at each checked stage count. + +Executed with Apple clang 21.0.0 (`clang-2100.1.1.101`), C++17 and Boost 1.87.0. +The Boost `version.hpp` SHA256 is +`de3c73716db521194a767801a45f78f466e83e06cbae476fa2492be39d820252`. +The first C++ `-O2` / normal Python receipt exactly matches the final C++ +`-O0` / `python3 -I -O -B` wrapper receipt. The wrapper defaults to `-O0` +and runs inherited assertion-based Python checkers without `-O`, using `-I` +to ignore `PYTHONOPTIMIZE`. Constants are `HDIM=8, NCOPY=9, VPORTS=120, +RHELP=480`, with `KPAIRS=4/5` for the 9/11-stage builds. A modified source +pin is rejected. Compiler warnings were limited to inherited Boost syntax. + +The README native command reproduces the final receipt; `--out` preserves +all compiler/checker logs and `ENVIRONMENT.json`. Initial compilation was +slow under the local restricted environment; it completed without changing +any retained checker or weakening its coverage. + +## Search coverage + +The final experiment is precisely 1,000 trajectories of the Q-node2 matrix, +`random.Random(2)`, with the first shortest word retained. Trial 860 uniquely +reached 43 XORs. The exact histogram and improvement sequence are frozen in +`RECIPE.json`; no optimality or exhaustive circuit-search claim is made. + +During orientation, three separate 1,000-trial probes were run, in order +Q-node2, Q-node1, Q-node8. Each reset `random.Random(2)` and used the same +elimination domain. Their preliminary lengths were 52 -> 43, 71 -> 41, 62 -> 46. +Only Q-node2 received full precision/native verification and is submitted. +The Q-node1/8 observations are disclosed exploratory work, not admitted +constructions or independently packaged results. The final command replays +Q-node2, not those two discarded probes. + +No repository-wide suite, selected cold replay, full hosting reconstruction, +outer assembly or formal theorem proof was run or claimed for this change. +No selected-construction file or inherited generator was edited. + +## Submission refresh + +Refreshed main `f4a7051883bc76dad7861b3f0caf7361ce86fe90` retains all 21 +source Git blobs and the selected record unchanged. Recent open PRs were +reviewed through #999, with all-state R480 and Q-node searches. #823 remains +the related six-wire R480 result; #980, #986 and #989 change R439 words. +None of those bodies describes this twelve-source R480 Q-node2 replacement. +No composition with their savings is claimed. The two open issues remain +unrelated to sprint coordination, so the local claim is used. diff --git a/research/r480-qnode-seed02/independent.py b/research/r480-qnode-seed02/independent.py new file mode 100644 index 0000000000..660eb37d52 --- /dev/null +++ b/research/r480-qnode-seed02/independent.py @@ -0,0 +1,322 @@ +#!/usr/bin/env python3 +"""Independent set-valued finite F2 verification of the R480 Q-node2 recipe. + +No search, primary verifier, exporter, or predecessor checker is imported. +The full-column check is finite linear algebra, not a proof of the conditional +multiplication theorem. Prepared for ToikY with substantial OpenAI Codex +assistance; Apache-2.0. Native record vocabulary follows Dylan Crow's PR249/ +PR266 exporter, and signed-prefix convention follows the retained PR503 checker. +""" +from __future__ import annotations + +import argparse +import copy +from fractions import Fraction +import gzip +import hashlib +import json +from pathlib import Path +import struct +import sys + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +SOURCE = ROOT / 'research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz' +SOURCE_SHA256 = '92e399e9a486b55229b5624632ac54f800dd9e022f2aee97f1e5f264bbc0ef5c' +WIRES = [17, 25, 32, 43, 52, 58, 64, 77, 82, 90, 99, 104] +OBJECT = {'phase': 'A', 'slice_start_inclusive': 2250, + 'slice_end_exclusive': 2302, 'frame': 484, + 'registers_in_matrix_order': WIRES} + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def digest(value): + return hashlib.sha256(json.dumps(value, sort_keys=True, + separators=(',', ':')).encode()).hexdigest() + + +def rows_after(gates, labels): + """Each row is a set of independently named input variables.""" + rows = {i: {i} for i in labels} + for _, d, sources in gates: + for s in sources: + rows[d] = rows[d].symmetric_difference(rows[s]) + return [sorted(rows[i]) for i in labels] + + +def check_local(old, new, advertised): + for event in new: + need(type(event) is list and len(event) == 3, 'recipe event shape') + f, d, ss = event + need(type(f) is int and f == 484, 'recipe common frame') + need(type(d) is int and d in WIRES, 'recipe destination') + need(type(ss) is list and len(ss) == 1, 'one source per recipe gate') + need(type(ss[0]) is int and ss[0] in WIRES and ss[0] != d, + 'recipe source or alias') + old_rows, new_rows = rows_after(old, WIRES), rows_after(new, WIRES) + need(old_rows == new_rows, 'twelve arbitrary-input rows changed') + masks = [sum(1 << WIRES.index(s) for s in r) for r in new_rows] + need(type(advertised) is list and all(type(x) is int for x in advertised) + and masks == advertised, 'advertised local matrix differs') + need(rows_after(new + list(reversed(new)), WIRES) == [[s] for s in WIRES], + 'literal reverse does not restore all input rows') + # A scalar truth-table implementation, distinct from the symbolic sets. + def execute(gates, assignment): + state = {s: (assignment >> i) & 1 for i, s in enumerate(WIRES)} + for _, d, ss in gates: + for s in ss: + state[d] ^= state[s] + return state + for assignment in range(1 << len(WIRES)): + want = execute(old, assignment) + actual = execute(new, assignment) + need(actual == want, f'Boolean assignment mismatch {assignment}') + for _, d, ss in reversed(new): + for s in ss: + actual[d] ^= actual[s] + need(actual == {s: (assignment >> i) & 1 for i, s in enumerate(WIRES)}, + f'Boolean inverse mismatch {assignment}') + return masks + + +def basis(vectors): + """Exact canonical rational row space; no producer rank routine.""" + result = [] + for vector in vectors: + row = [Fraction(x) for x in vector] + for pivot, b in result: + scale = row[pivot] + row = [x - scale*y for x, y in zip(row, b)] + pivot = next((j for j, x in enumerate(row) if x), None) + if pivot is None: + continue + scale = row[pivot] + row = [x/scale for x in row] + result = [(p, [x-b[pivot]*y for x, y in zip(b, row)]) for p, b in result] + result.append((pivot, row)) + result.sort(key=lambda item: item[0]) + return tuple(tuple(row) for _, row in result) + + +def frame_spaces(word): + return [basis(word['lines'][i] for i in frame) for frame in word['frames']] + + +def native_records(word, spaces): + """Build and validate explicit MOVE/ADD/COPY/ERASE records independently.""" + n, v = 720, 120 + need(word['v'] == v and word['R'] == 480 and word['h'] == 8, + 'R480 dimensions') + need(len(word['start']) == len(word['final']) == n, 'frame endpoint count') + frames = list(word['start']) + paths = [[f] for f in frames] + records = [] + nested = {} + def move(register, frame): + old = frames[register] + if old == frame: + return + pair = old, frame + if pair not in nested: + nested[pair] = (len(spaces[old]) < len(spaces[frame]) and + basis(spaces[old] + spaces[frame]) == spaces[frame]) + need(nested[pair], f'non-nested frame movement {register}: {old}->{frame}') + records.append((0, register, old, frame, + len(spaces[frame])-len(spaces[old]), 0)) + frames[register] = frame + paths[register].append(frame) + def phase(name, tag): + for f, d, ss in word[name]: + need(type(f) is int and 0 <= f < len(spaces), 'frame range') + operands = [d] + ss + need(all(type(r) is int and 0 <= r < n for r in operands) + and len(set(operands)) == len(operands), 'word register or alias') + if d < v or d >= 2*v: + need(not any(v <= s < 2*v for s in ss), 'target feeds restored bank') + if name == 'D': + need(f == 0 and v <= d < 2*v and all(s >= 2*v for s in ss), + 'dirty compensation interface') + if name == 'A': + need(not v <= d < 2*v, 'phase A writes target') + if name == 'B': + need(v <= d < 2*v, 'phase B does not write target') + for r in operands: + move(r, f) + for s in ss: + records.append((1, d, s, 1, f, tag)) + phase('D', 1) + phase('A', 2) + need(all(frames[r] == 0 for r in range(v, 2*v)), 'scatter target not at zero') + for k, centre in enumerate(word['ret']): + need(centre >= 2*v and len(spaces[frames[centre]]) == 8, + 'retained centre is not full-frame helper') + frame = frames[centre] + records.append((2, centre, n, frame, 0, len(spaces[frame]))) + for t, row in enumerate(word['scatter']): + if k in row: + records.append((1, v+t, n, 1, 0, 3)) + records.append((3, centre, n, frame, 0, 0)) + phase('B', 4) + phase('C', 5) + for r in range(n): + move(r, word['final'][r]) + need(frames == word['final'], 'final frame mismatch') + need(word['C'] == [[1, d, ss[:]] for _, d, ss in reversed(word['A'])], + 'cleanup is not the literal full-frame reverse') + return records, paths + + +def replay(records, reverse=False, positive=False, zero_input=None): + """All 720 independent columns; fresh copy is a snapshot, erase closes it. + + Reverse is the signed inverse's F2 reduction: reverse order, exchange COPY + and ERASE, retain ADD destination/source (its integer coefficient is -1). + Positive bounds drop coefficient signs and count all intermediate rows. + """ + n = 720 + state = [1 if positive else {r} for r in range(n)] + state.append(0 if positive else set()) + if zero_input is not None: + state[zero_input] = 0 if positive else set() + opened = None + maximum = 1 + adds = copies = 0 + for rec in reversed(records) if reverse else records: + op, a, b, c, frame, phase = rec + if reverse and op in (2, 3): + op = 5-op + if op == 0: + continue + if op == 1: + need(c == 1 and a != b and 0 <= a < n and 0 <= b <= n, + 'malformed ADD') + need(b != n or opened is not None, 'read closed copy') + need(a != opened, 'copied original centre mutated') + state[a] = state[a] + state[b] if positive else state[a] ^ state[b] + if positive: + maximum = max(maximum, state[a]) + adds += 1 + elif op == 2: + need(opened is None and b == n and 0 <= a < n, 'copy lifecycle') + state[n] = state[a] if positive else state[a].copy() + opened = a + copies += 1 + elif op == 3: + need(opened == a and b == n and state[n] == state[a], + 'erase source binding or copy modified') + state[n] = 0 if positive else set() + opened = None + else: + raise ValueError('unknown native opcode') + need(opened is None and not state[n], 'unclosed private copy') + if positive: + return {'max_row_l1_upper': str(maximum), 'bits': maximum.bit_length(), + 'adds': adds, 'copies': copies} + want = [{r} for r in range(n)] + for t in range(120): + want[120+t].add(t) + need(state[:n] == want, 'whole-word 720-column endpoint mismatch') + return digest([sorted(s) for s in state]) + + +def fails(call, name): + try: + call() + except (ValueError, KeyError, IndexError): + return name + raise ValueError('negative control unexpectedly accepted: ' + name) + + +def run(recipe_path=None, records_dir=None): + raw = SOURCE.read_bytes() + need(hashlib.sha256(raw).hexdigest() == SOURCE_SHA256, 'source SHA256 mismatch') + old = json.loads(gzip.decompress(raw)) + recipe = json.loads(Path(recipe_path or HERE / 'RECIPE.json').read_text()) + need(recipe['object'] == OBJECT, 'recipe object differs from claimed scope') + new_gates = recipe['replacement_A_events'] + need(len(new_gates) == 43, 'frozen recipe gate count') + local = old['A'][2250:2302] + masks = check_local(local, new_gates, recipe['fixed_output_f2_rows']) + new = copy.deepcopy(old) + new['A'][2250:2302] = copy.deepcopy(new_gates) + new['C'] = [[1, d, ss[:]] for _, d, ss in reversed(new['A'])] + spaces = frame_spaces(old) + before, old_paths = native_records(old, spaces) + after, new_paths = native_records(new, spaces) + need(old_paths == new_paths, 'one or more register frame paths changed') + receipts = {} + for name, records in [('original', before), ('replacement', after)]: + endpoints = [replay(records, reverse=rev) for rev in (False, True)] + need(endpoints[0] == endpoints[1], 'inverse F2 endpoint differs') + positive = [replay(records, reverse=rev, positive=True) for rev in (False, True)] + forward, backward = [int(p['max_row_l1_upper']) for p in positive] + payload = 64 * forward**3 * backward**2 + receipts[name] = {'endpoint_sha256': endpoints[0], + 'native_records': len(records), + 'native_records_sha256': hashlib.sha256(b''.join( + struct.pack('<6i', *r) for r in records)).hexdigest(), + 'positive_forward': positive[0], 'positive_reverse': positive[1], + 'five_stage_payload_upper': str(payload), + 'five_stage_payload_bits': payload.bit_length(), + 'five_stage_payload_below_2pow104': payload < 2**104} + if records_dir is not None: + exported = Path(records_dir) / name / 'records/249-records.bin' + data = exported.read_bytes() + need(len(data) % 24 == 0, 'native record stream alignment') + parsed = list(struct.iter_unpack('<6i', data)) + need(parsed == records, 'native exporter differs from independent records') + need(receipts['original']['positive_forward']['adds'] - + receipts['replacement']['positive_forward']['adds'] == 18, + 'complete-word saving differs from eighteen') + # Every one-gate deletion must change the finite twelve-input map. + want = rows_after(local, WIRES) + for i in range(len(new_gates)): + need(rows_after(new_gates[:i] + new_gates[i+1:], WIRES) != want, + f'vacuous local deletion control {i}') + controls = ['all_43_single_gate_deletions'] + swapped = want[:] + swapped[0], swapped[1] = swapped[1], swapped[0] + need(swapped != want, 'vacuous output permutation control') + controls.append('swapped_output_rows') + controls.append(fails(lambda: replay(after, zero_input=240), 'arbitrary_dirty_helper_assumed_zero')) + controls.append(fails(lambda: replay(after, zero_input=WIRES[0]), 'arbitrary_source_assumed_zero')) + controls.append(fails(lambda: replay(after, zero_input=120), 'arbitrary_target_assumed_zero')) + for phase, name in [(1, 'missing_dirt_compensation_ADD'), (5, 'missing_cleanup_ADD')]: + i = next(i for i, e in enumerate(after) if e[0] == 1 and e[5] == phase) + controls.append(fails(lambda i=i: replay(after[:i] + after[i+1:]), name)) + wrong = copy.deepcopy(new) + wrong['A'][2250][0] = 0 + controls.append(fails(lambda: native_records(wrong, spaces), 'wrong_local_frame')) + i = next(i for i, e in enumerate(after) if e[0] == 3) + controls.append(fails(lambda: replay(after[:i] + after[i+1:]), 'missing_private_ERASE')) + return {'status': 'PASS_INDEPENDENT_R480_QNODE2', 'source_sha256': SOURCE_SHA256, + 'columns_checked': 720, 'arbitrary_dirty_helpers': 480, + 'arbitrary_targets': 120, 'local_Boolean_assignments': 4096, + 'local_rows': masks, 'register_frame_paths_checked': 720, + 'frame_paths_sha256': digest(old_paths), 'local_word_xor_saving': 18, + 'original': receipts['original'], 'replacement': receipts['replacement'], + 'controls': controls} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--recipe', type=Path) + parser.add_argument('--records-dir', type=Path, + help='optional root containing original/replacement/records exports') + parser.add_argument('--json', action='store_true') + args = parser.parse_args() + result = run(args.recipe, args.records_dir) + if args.json: + print(json.dumps(result, indent=2, sort_keys=True)) + else: + print('PASS_INDEPENDENT_R480_QNODE2 columns=720 Boolean=4096 ' + 'frame_paths=720 saved=18 finite_F2_only') + + +if __name__ == '__main__': + main() diff --git a/research/r480-qnode-seed02/native.py b/research/r480-qnode-seed02/native.py new file mode 100644 index 0000000000..be4727400f --- /dev/null +++ b/research/r480-qnode-seed02/native.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python3 +"""Pinned native replay of the R480 Q-node2 replacement. + +Prepared for ToikY with substantial OpenAI Codex assistance. Apache-2.0. +Adapted from Ross Richardson's retained R439 harness (itself credits Ali Romman +PR688) and DreamingOfClouds's PR503/510 R480 verification commands. The +retained legality, transform, interface and Gram checkers remain unchanged. +""" +import argparse +import copy +import gzip +import hashlib +import json +import os +from pathlib import Path +import platform +import shlex +import subprocess +import sys +import tempfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PACKAGE = 'research/e8-bit-carrier-skeleton' +SOURCE = 'research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz' +NATIVE_INPUTS = [ + SOURCE, + PACKAGE + '/code/bit/export_records.py', + PACKAGE + '/code/bit/regression/stage_cohort.py', + PACKAGE + '/code/bit/checkers/legality_h.cpp', + PACKAGE + '/code/bit/checkers/columns_h.cpp', + PACKAGE + '/code/bit/checkers/columns_k.cpp', + PACKAGE + '/code/bit/checkers/json.hpp', + PACKAGE + '/portable-include/bits/stdc++.h', + PACKAGE + '/code/bit/independent/checkword.py', + PACKAGE + '/code/bit/independent/relax.py', + PACKAGE + '/code/bit/independent/interface.py', + PACKAGE + '/code/bit/checkers/gram_frames.py', + PACKAGE + '/code/pricing/prime_witnesses.py', + PACKAGE + '/code/pricing/moment.py', +] +# Frozen at base 407d52ff15b2217b6e22bce44728b4c3907b6515. +NATIVE_PINS = { + "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_h.cpp": "d1297f9052be4f2496e1ff2a77e4db2c0cdbd7d460d489b4c03e50bf317238ce", + "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_k.cpp": "1c344d18fcd494eeca93e259f10cafae7705780e6592f6dcb35b34752dab9bc2", + "research/e8-bit-carrier-skeleton/code/bit/checkers/gram_frames.py": "223a5a07731fc315a90a3e48177796babc155c1d9985c7ae5017eff6af2a0608", + "research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp": "aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63", + "research/e8-bit-carrier-skeleton/code/bit/checkers/legality_h.cpp": "6c1ef2b24e57781d6951c172a1024fc4300e6fd392c9d6672079a7806ab663b3", + "research/e8-bit-carrier-skeleton/code/bit/export_records.py": "8a5999601f917dbb492bb9ae9a344611f18cc7cedc53dc3c76496a369e530eb3", + "research/e8-bit-carrier-skeleton/code/bit/independent/checkword.py": "11bf9620ca9db16d52d9fe806b814fc9ec9a89c4d7645354d1861d96f6e805ad", + "research/e8-bit-carrier-skeleton/code/bit/independent/interface.py": "2c63a039f97e3a11ce5a6b83302d4f5beda160c1db14164a5a9b0855aeb19d3c", + "research/e8-bit-carrier-skeleton/code/bit/independent/relax.py": "d6e9f58de3fa41f538516b6227c249d61fb30f0f6843027cc8a07a1a372fa6b6", + "research/e8-bit-carrier-skeleton/code/bit/regression/stage_cohort.py": "6c288f6f234b528c1a7c0a4adfb724e91e0fe6b18c8dffad96af3f973de1829a", + "research/e8-bit-carrier-skeleton/code/pricing/moment.py": "81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482", + "research/e8-bit-carrier-skeleton/code/pricing/prime_witnesses.py": "98cd03bc9582e7bd0ab194c191ea8eea940539e510051443ab9fd3e572a364ab", + "research/e8-bit-carrier-skeleton/portable-include/bits/stdc++.h": "420094be2af295eed03a983dd66debbbe9cfb78d8252859f4498a615a0074b99", + "research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz": "92e399e9a486b55229b5624632ac54f800dd9e022f2aee97f1e5f264bbc0ef5c" +} + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':')).encode() + + +def check_sources(): + need(set(NATIVE_PINS) == set(NATIVE_INPUTS), 'incomplete native source pins') + for path, expected in NATIVE_PINS.items(): + need(hashlib.sha256((ROOT / path).read_bytes()).hexdigest() == expected, + 'native source hash mismatch: ' + path) + + +def words(out): + """Independent mechanical splice, including its literal inverse cleanup.""" + old = json.loads(gzip.decompress((ROOT / SOURCE).read_bytes())) + recipe = json.loads((HERE / 'RECIPE.json').read_text()) + need(old['v'] == 120 and old['R'] == 480 and len(old['ret']) == 9, + 'wrong baseline dimensions') + item = recipe['object'] + need(item['phase'] == 'A' and item['slice_start_inclusive'] == 2250 + and item['slice_end_exclusive'] == 2302 and item['frame'] == 484, + 'wrong replacement scope') + replacement = recipe['replacement_A_events'] + need(len(replacement) == 43, 'wrong replacement gate count') + registers = set(item['registers_in_matrix_order']) + need(len(registers) == 12 and all(type(r) is int and 0 <= r < 120 for r in registers), + 'wrong Q-node source registers') + for frame, dst, srcs in old['A'][2250:2302] + replacement: + need(frame == 484 and dst in registers and len(srcs) == 1 + and srcs[0] in registers and dst != srcs[0], 'wrong block operation') + full = old['C'][0][0] + need(old['C'] == [[full, dst, srcs] for _, dst, srcs in reversed(old['A'])], + 'baseline cleanup is not literal inverse') + new = copy.deepcopy(old) + new['A'][2250:2302] = replacement + new['C'] = [[full, dst, list(srcs)] for _, dst, srcs in reversed(new['A'])] + need(all(not (0 <= dst < 120 or dst >= 240) for _, dst, _ in old['B']), + 'phase B writes a source or helper') + result = {} + for name, word in [('original', old), ('replacement', new)]: + data = canonical(word) + (out / (name + '.json.gz')).write_bytes(gzip.compress(data, mtime=0)) + result[name] = hashlib.sha256(data).hexdigest() + return result + + +def run(out): + bit = ROOT / PACKAGE / 'code/bit' + checkers = bit / 'checkers' + pricing = ROOT / PACKAGE / 'code/pricing' + # -I explicitly ignores PYTHONOPTIMIZE: retained assertion-based checkers + # must run normally even when this wrapper is invoked with python -O. + python = [sys.executable, '-I', '-B'] + compiler = shlex.split(os.environ.get('CXX', 'c++')) + include = Path(os.environ.get('BOOST_INCLUDE', '/usr/include')).resolve() + need((include / 'boost/multiprecision/cpp_int.hpp').is_file(), + 'Set BOOST_INCLUDE to the directory containing boost/multiprecision/cpp_int.hpp') + flags = ['-O0', '-std=c++17', '-DHDIM=8', '-DNCOPY=9', '-DVPORTS=120', '-DRHELP=480', + '-I' + str(ROOT / PACKAGE / 'portable-include'), '-I' + str(checkers), '-I' + str(include)] + bindir = out / 'bin' + bindir.mkdir() + + def call(name, command, failure=None): + with (out / (name + '.log')).open('w') as log: + process = subprocess.run(list(map(str, command)), stdout=log, stderr=subprocess.STDOUT) + text = (out / (name + '.log')).read_text() + if failure is None: + need(process.returncode == 0, name + ' failed: ' + text[-2000:]) + else: + need(process.returncode != 0 and failure in text, name + ' failed to reject expected control') + return text.strip() + + call('compile-legality', compiler + flags + ['-o', bindir / 'legality', checkers / 'legality_h.cpp']) + call('compile-columns5', compiler + flags + ['-o', bindir / 'columns5', checkers / 'columns_h.cpp']) + for pairs in (4, 5): + call('compile-columns' + str(2 * pairs + 1), compiler + flags + ['-DKPAIRS=' + str(pairs), '-o', + bindir / ('columns' + str(2 * pairs + 1)), checkers / 'columns_k.cpp']) + call('relax', python + [bit / 'independent/relax.py', out / 'relaxed']) + results = {} + for name in ('original', 'replacement'): + base = out / name + records, cin, cout = (base / item for item in ('records', 'cin', 'cout')) + word = out / (name + '.json.gz') + call(name + '-export', python + [bit / 'export_records.py', word, records]) + call(name + '-cohort', python + [bit / 'regression/stage_cohort.py', records, records, cin, cout]) + call(name + '-legality', [bindir / 'legality', cin, cout, cout / 'legality.json']) + legality = json.loads((cout / 'legality.json').read_text()) + need(legality['status'] == 'PASS_INDEPENDENT_COHORT_LEGALITY_SOURCE_OWNERS_AND_LIFECYCLE', + 'Legality did not pass') + need(legality['copies'] == legality['erasures'] == 9, 'Wrong copy/erase count') + result = {'legality': legality, 'stages': {}} + for pairs in (2, 4, 5): + stages = str(2 * pairs + 1) + receipt = cout / ('columns' + stages + '.json') + call(name + '-columns' + stages, [bindir / ('columns' + stages), + cout / 'COHORT249-RECORDS.bin', receipt]) + data = json.loads(receipt.read_text()) + expected_status = ('PASS_NEW_COHORT249_ALL_FIVE_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL' if pairs == 2 + else 'PASS_NEW_COHORT249_ALL_BRIDGED_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL') + need(data['status'] == expected_status, 'Formal columns did not pass') + need(len(data['negative_controls']) == 6 * (pairs - 1) + and all(c['rejected'] is True for c in data['negative_controls']), 'A bridge control failed') + need(data['formal_columns_checked'] == 240 * pairs + 480, 'Wrong formal column count') + need(int(data['payload_prefix_upper']) < 2 ** 104, 'Payload limit failed') + need(data['local_raw_H'] == legality['paid_histogram'], 'Column and legality histograms disagree') + data.pop('seconds', None) + data.pop('local_scalar_stream', None) + result['stages'][stages] = data + print(name + ' stages=' + stages + ' payload_bits=' + str(data['payload_prefix_bits']), flush=True) + call(name + '-stock-negative', python + [bit / 'independent/checkword.py', word, pricing], + failure='x register written') + result['stock_immutable_source_checker_rejects'] = True + result['relaxed_word_stdout'] = call(name + '-relaxed', python + [out / 'relaxed/checkword_mut.py', word, pricing]) + call(name + '-interface', python + [bit / 'independent/interface.py', word, '--json', base / 'interface.json']) + result['interface'] = json.loads((base / 'interface.json').read_text()) + need(result['interface']['status'] == 'PASS_PR425_INTERFACE_HYPOTHESES', 'Interface did not pass') + result['gram_stdout'] = call(name + '-gram', python + [checkers / 'gram_frames.py', records, + '--gram', 'e8ham', '--h', '8', '--positive']) + results[name] = result + comparisons = {} + for stages in ('5', '9', '11'): + old, new = (results[name]['stages'][stages] for name in ('original', 'replacement')) + need(old['local_raw_H'] == new['local_raw_H'], 'Paid histogram changed') + need(old['local_scalar_additions'] - new['local_scalar_additions'] == 18, 'Wrong whole-word saving') + # F2 equality does not imply positive-envelope dominance. Record the + # measured values without imposing or claiming that stronger condition. + comparisons[stages] = { + 'same_local_paid_histogram': True, + 'local_scalar_additions_saved': 18, + 'payload_upper_original': old['payload_prefix_upper'], + 'payload_upper_replacement': new['payload_prefix_upper'], + 'payload_upper_nonincrease': int(new['payload_prefix_upper']) <= int(old['payload_prefix_upper']), + } + old_l, new_l = (results[name]['legality'] for name in ('original', 'replacement')) + need(old_l['common_frame_ADDs'] - new_l['common_frame_ADDs'] == 18, 'Legality saving differs') + need(old_l['rank_mass'] == new_l['rank_mass'] and old_l['nested_MOVEs'] == new_l['nested_MOVEs'], + 'Frame costs changed') + (out / 'ENVIRONMENT.json').write_text(json.dumps({ + 'python': sys.version, 'platform': platform.platform(), + 'compiler': subprocess.check_output(compiler + ['--version'], text=True), + 'boost_include': str(include), + 'compile_flags': flags, + 'boost_version_header_sha256': hashlib.sha256((include / 'boost/version.hpp').read_bytes()).hexdigest(), + }, sort_keys=True, indent=2) + '\n') + return {'words': results, 'comparisons': comparisons} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--out', type=Path, help='new output directory, preserving every log and receipt') + parser.add_argument('--write-certificate', action='store_true', help='write NATIVE.json after all checks pass') + args = parser.parse_args() + check_sources() + with tempfile.TemporaryDirectory(prefix='r480-qnode2-native-') as temporary: + out = args.out.resolve() if args.out else Path(temporary) / 'work' + out.mkdir(parents=True, exist_ok=False) + hashes = words(out) + receipt = {'schema': 'r480-qnode2-native/1', 'word_content_sha256': hashes, + 'normalization': 'Only seconds and local_scalar_stream removed from native JSON; all other fields retained.', + **run(out)} + data = json.dumps(receipt, sort_keys=True, indent=2) + '\n' + (out / 'NATIVE.json').write_text(data) + if args.write_certificate: + (HERE / 'NATIVE.json').write_text(data) + else: + need(canonical(receipt) == canonical(json.loads((HERE / 'NATIVE.json').read_text())), 'native certificate mismatch') + print('PASS_R480_QNODE2_NATIVE words=2 columns=960/1440/1680 bridge_controls=96 ADDs_saved=18 payload_lt_2^104') + + +if __name__ == '__main__': + main() diff --git a/research/r480-qnode-seed02/search.py b/research/r480-qnode-seed02/search.py new file mode 100644 index 0000000000..5d55edecab --- /dev/null +++ b/research/r480-qnode-seed02/search.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python3 +"""Reproduce one bounded fixed-output F2 resynthesis, never an optimum claim. + +Prepared for ToikY with substantial OpenAI Codex assistance. Apache-2.0. +The source word is DreamingOfClouds's PR503/510 R480 adaptation of eumemic's +PR493 carrier skeleton. Related bounded F2 synthesis precedents: PR904, +PR936 and PR952; PR823 resynthesizes a different, six-wire R480 quad. +This standalone Gauss-Jordan search is independently implemented here. +""" + +import argparse +from collections import Counter +import gzip +import hashlib +import json +from pathlib import Path +import random + + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +SOURCE = "research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz" +SOURCE_SHA256 = "92e399e9a486b55229b5624632ac54f800dd9e022f2aee97f1e5f264bbc0ef5c" +BASE = "407d52ff15b2217b6e22bce44728b4c3907b6515" +LO, HI, FRAME, SEED, TRIALS = 2250, 2302, 484, 2, 1000 +REGISTERS = [17, 25, 32, 43, 52, 58, 64, 77, 82, 90, 99, 104] + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def transfer(n, operations): + rows = [1 << i for i in range(n)] + for dst, src in operations: + require(0 <= dst < n and 0 <= src < n and dst != src, "illegal XOR") + rows[dst] ^= rows[src] + return rows + + +def positive(n, operations): + """Actual nonnegative coefficient matrix for cancellation-free replay. + + This is a local comparison in independent block-input columns; native + prefix admission uses the complete chronological word instead. + """ + rows = [[int(i == j) for j in range(n)] for i in range(n)] + maximum = 1 + for dst, src in operations: + rows[dst] = [a + b for a, b in zip(rows[dst], rows[src])] + maximum = max(maximum, sum(rows[dst])) + return {"endpoint_matrix": rows, "endpoint_row_sums": list(map(sum, rows)), + "maximum_prefix_row_l1": maximum} + + +def synthesize(rows): + """Exactly 1000 trajectories, including a random pivot only if necessary.""" + n = len(rows) + rng = random.Random(SEED) + best = None + first_best = None + histogram = Counter() + improvements = [] + best_words = set() + for trial in range(TRIALS): + reduced = list(rows) + operations = [] + columns = list(range(n)) + rng.shuffle(columns) + for position, col in enumerate(columns): + choices = [p for p in columns[position:] if (reduced[p] >> col) & 1] + pivot = col if (reduced[col] >> col) & 1 else rng.choice(choices) + if pivot != col: + for dst, src in ((col, pivot), (pivot, col), (col, pivot)): + reduced[dst] ^= reduced[src] + operations.append((dst, src)) + for dst in columns: + if dst != col and (reduced[dst] >> col) & 1: + reduced[dst] ^= reduced[col] + operations.append((dst, col)) + require(reduced == [1 << i for i in range(n)], "elimination failed") + candidate = list(reversed(operations)) + require(transfer(n, candidate) == rows, "fixed-output replay failed") + cost = len(candidate) + histogram[cost] += 1 + if best is None or cost < len(best): + best, first_best = candidate, trial + best_words = {tuple(candidate)} + improvements.append({"trial_zero_based": trial, "xor_count": cost}) + elif cost == len(best): + best_words.add(tuple(candidate)) + return best, { + "seed": SEED, "rng": "Python random.Random (MT19937)", + "trials_completed": TRIALS, + "stopping_rule": "Exactly 1000 trajectories; no early stop or restart.", + "domain": "One 12x12 fixed-output F2 map; shuffled column order; keep diagonal pivot when nonzero, otherwise uniformly choose an unprocessed nonzero pivot row; three XORs per row swap; eliminate every other row in shuffled order; reverse elimination to synthesize.", + "tie_rule": "Keep the first shortest encountered word.", + "first_best_trial_zero_based": first_best, + "best_length_occurrences": histogram[len(best)], + "distinct_best_words_encountered": len(best_words), + "length_histogram": {str(k): histogram[k] for k in sorted(histogram)}, + "strict_improvements": improvements, + "optimality_claim": False, + } + + +def receipt(): + raw = (ROOT / SOURCE).read_bytes() + require(hashlib.sha256(raw).hexdigest() == SOURCE_SHA256, "source hash mismatch") + word = json.loads(gzip.decompress(raw)) + block = word["A"][LO:HI] + actual_registers = sorted({r for _, dst, sources in block for r in [dst] + sources}) + require(actual_registers == REGISTERS, "source registers changed") + require(all(f == FRAME and len(s) == 1 for f, _, s in block), "source block changed") + index = {r: i for i, r in enumerate(REGISTERS)} + old = [(index[d], index[s[0]]) for _, d, s in block] + rows = transfer(len(REGISTERS), old) + best, search = synthesize(rows) + require(len(best) == 43, "frozen search result changed") + identity = [1 << i for i in range(len(REGISTERS))] + require(transfer(len(REGISTERS), best + list(reversed(old))) == identity, + "old/new composition is not identity") + return { + "schema": "r480-qnode-seed02/1", "base_commit": BASE, + "source": {"path": SOURCE, "sha256": SOURCE_SHA256}, + "object": {"phase": "A", "slice_start_inclusive": LO, + "slice_end_exclusive": HI, "frame": FRAME, + "registers_in_matrix_order": REGISTERS}, + "search": search, + "fixed_output_f2_rows": rows, + "old_xor_count": len(old), "new_xor_count": len(best), + "complete_A_plus_literal_C_xor_saving": 2 * (len(old) - len(best)), + "replacement_A_events": [[FRAME, REGISTERS[d], [REGISTERS[s]]] for d, s in best], + "positive_local": { + "scope": "Independent block-input columns only; not complete native prefix admission.", + "old_forward": positive(len(REGISTERS), old), + "new_forward": positive(len(REGISTERS), best), + "old_inverse": positive(len(REGISTERS), list(reversed(old))), + "new_inverse": positive(len(REGISTERS), list(reversed(best))), + }, + } + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write", type=Path, help="write a new receipt (refuse overwrite)") + args = parser.parse_args() + result = receipt() + encoded = json.dumps(result, sort_keys=True, indent=2) + "\n" + if args.write is not None: + with args.write.open("x") as output: + output.write(encoded) + else: + require((HERE / "RECIPE.json").read_text() == encoded, "recipe differs from exact reproduction") + print("PASS_R480_QNODE_SEED02_SEARCH trials=1000 old=52 new=43 A_plus_C_saved=18 no_optimality_claim") + + +if __name__ == "__main__": + main() diff --git a/research/r480-qnode-seed02/test_package.py b/research/r480-qnode-seed02/test_package.py new file mode 100644 index 0000000000..c23bc9008c --- /dev/null +++ b/research/r480-qnode-seed02/test_package.py @@ -0,0 +1,81 @@ +"""Portable source, recipe, output and finite-obligation fault tests.""" +import copy +import gzip +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest +sys.dont_write_bytecode=True +HERE=Path(__file__).resolve().parent +ROOT=HERE.parents[1] +sys.path.insert(0,str(HERE)) +import verify as V + + +class PackageTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.original=V.inputs() + cls.recipe=json.loads((HERE/'RECIPE.json').read_text()) + cls.candidate=V.build(cls.original,cls.recipe) + + def test_fixed_labels_and_frame_aliases(self): + for field,value in ((0,0),(0,True),(1,240)): + r=copy.deepcopy(self.recipe);r['replacement_A_events'][0][field]=value + with self.assertRaises(ValueError):V.build(self.original,r) + r=copy.deepcopy(self.recipe);r['replacement_A_events'][0][2]=[r['replacement_A_events'][0][1]] + with self.assertRaises(ValueError):V.build(self.original,r) + r=copy.deepcopy(self.recipe);r['object']['slice_start_inclusive']=2251 + with self.assertRaises(ValueError):V.build(self.original,r) + r=copy.deepcopy(self.recipe);r['fixed_output_f2_rows'][0],r['fixed_output_f2_rows'][1]=r['fixed_output_f2_rows'][1],r['fixed_output_f2_rows'][0] + with self.assertRaises(ValueError):V.build(self.original,r) + + def test_stale_cleanup_is_valid_but_differently_priced(self): + bad=copy.deepcopy(self.candidate);bad['C']=copy.deepcopy(self.original['C']) + self.assertEqual(V.replay(bad)['adds'],33949) + with self.assertRaisesRegex(ValueError,'literal cleanup'):V.word_contract(self.original,bad) + + def test_endpoint_valid_growth_and_every_gate_deletion(self): + r=V.controls(self.original,self.candidate,self.recipe) + self.assertEqual(r['deleted_candidate_gates_rejected'],43) + self.assertTrue(r['identity_growth_rejected']) + + def test_minimal_optimized_offline_copy_and_fail_closed_inputs(self): + with tempfile.TemporaryDirectory(prefix='r480 qnode portable ') as name: + temp=Path(name);root=temp/'repository with spaces';package=root/'research/r480-qnode-seed02' + shutil.copytree(HERE,package,ignore=shutil.ignore_patterns('__pycache__')) + pins=json.loads((HERE/'SOURCES.json').read_text()) + for relative in pins['required_files']: + target=root/relative;target.parent.mkdir(parents=True,exist_ok=True) + shutil.copyfile(ROOT/relative,target) + before={str(p.relative_to(root)):p.read_bytes() for p in root.rglob('*') if p.is_file()} + def run(script='verify.py',*args): + return subprocess.run([sys.executable,'-I','-O','-B',str(package/script),*map(str,args)], + cwd=root,text=True,capture_output=True,timeout=180) + emitted=temp/'new emitted words' + result=run('verify.py','--replay-search','--emit',emitted) + self.assertEqual(result.returncode,0,result.stdout+result.stderr) + result=run('independent.py') + self.assertEqual(result.returncode,0,result.stdout+result.stderr) + self.assertEqual(before,{str(p.relative_to(root)):p.read_bytes() for p in root.rglob('*') if p.is_file()}) + for label,word in (('original',self.original),('replacement',self.candidate)): + self.assertEqual(V.canonical(json.loads(gzip.decompress((emitted/(label+'.json.gz')).read_bytes()))),V.canonical(word)) + output_before={p.name:p.read_bytes() for p in emitted.iterdir()} + result=run('verify.py','--emit',emitted) + self.assertNotEqual(result.returncode,0);self.assertIn('output already exists',result.stderr) + self.assertEqual(output_before,{p.name:p.read_bytes() for p in emitted.iterdir()}) + source=root/V.WORD;raw=source.read_bytes();source.write_bytes(raw+b' ') + result=run();self.assertNotEqual(result.returncode,0);self.assertIn('source hash',result.stderr);source.write_bytes(raw) + source=package/'SOURCES.json';raw=source.read_bytes();bad=json.loads(raw) + key=next(iter(bad['files']));del bad['files'][key];bad['required_files'].remove(key) + source.write_text(json.dumps(bad));result=run() + self.assertNotEqual(result.returncode,0);self.assertIn('source inventory',result.stderr);source.write_bytes(raw) + source=package/'EXPECTED.json';bad=json.loads(source.read_bytes());bad['saved_adds']=18.0 + source.write_text(json.dumps(bad));result=run() + self.assertNotEqual(result.returncode,0);self.assertIn('receipt mismatch',result.stderr) + + +if __name__=='__main__':unittest.main(verbosity=2) diff --git a/research/r480-qnode-seed02/verify.py b/research/r480-qnode-seed02/verify.py new file mode 100644 index 0000000000..d905490a74 --- /dev/null +++ b/research/r480-qnode-seed02/verify.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python3 +"""Source-bound finite R480 Q-node construction; no new exponent. + +Prepared for ToikY with substantial OpenAI Codex assistance; Apache-2.0. +See NOTICE.md for the retained circuit, checker and synthesis lineage. +""" +import argparse +from collections import Counter +import copy +import gzip +import hashlib +import json +from pathlib import Path +import sys +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +sys.path.insert(0, str(HERE)) +WORD = 'research/e8-r480-dead-totals/data/bitE8mut-r480.json.gz' +BASE = '407d52ff15b2217b6e22bce44728b4c3907b6515' +REGS = [17,25,32,43,52,58,64,77,82,90,99,104] +REFERENCES = { + 'research/e8-r480-dead-totals/MANIFEST.json', + 'research/e8-r480-dead-totals/README.md', + 'research/e8-r480-dead-totals/NOTICE.md', + 'research/e8-r480-nine-stage/README.md', + 'research/e8-bit-carrier-skeleton/code/skeleton/wordkit.py', + 'research/e8-bit-carrier-skeleton/code/skeleton/gen.py', + 'research/e8-bit-carrier-skeleton/NOTICE.md', +} + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), allow_nan=False).encode() + + +def digest(value): + return hashlib.sha256(canonical(value)).hexdigest() + + +def inputs(): + from native import NATIVE_INPUTS + pins = json.loads((HERE / 'SOURCES.json').read_text()) + need(pins['base_commit'] == BASE, 'source base') + need(set(pins['files']) == set(pins['required_files']) == REFERENCES | set(NATIVE_INPUTS), 'source inventory') + need(WORD in pins['files'], 'word pin missing') + for name, pin in pins['files'].items(): + raw = (ROOT / name).read_bytes() + need(hashlib.sha256(raw).hexdigest() == pin['sha256'], 'source hash: '+name) + need(hashlib.sha1(b'blob '+str(len(raw)).encode()+b'\0'+raw).hexdigest() == pin['git_blob'], 'source blob: '+name) + need(hashlib.sha256((ROOT / WORD).read_bytes()).hexdigest() == + '92e399e9a486b55229b5624632ac54f800dd9e022f2aee97f1e5f264bbc0ef5c', 'fixed source hash') + return json.loads(gzip.decompress((ROOT / WORD).read_bytes())) + + +def local_rows(events): + rows = {r:1 << i for i,r in enumerate(REGS)} + for f,d,ss in events: + need(type(f) is int and f == 484 and type(d) is int and d in rows, + 'Q-node frame or target') + need(len(ss) == 1 and type(ss[0]) is int and ss[0] in rows and ss[0] != d, + 'Q-node source') + rows[d] ^= rows[ss[0]] + return [rows[r] for r in REGS] + + +def cleanup(word): + return [[1,d,list(ss)] for _,d,ss in reversed(word['A']+word['B']) if not 120 <= d < 240] + + +def build(original, recipe): + need(recipe['base_commit'] == BASE, 'recipe base') + need(canonical(recipe['object']) == canonical(dict(phase='A',slice_start_inclusive=2250, + slice_end_exclusive=2302,frame=484,registers_in_matrix_order=REGS)), 'recipe object') + old = original['A'][2250:2302] + new = recipe['replacement_A_events'] + need(len(old) == 52 and len(new) == 43, 'recipe length') + need(local_rows(old) == local_rows(new) == recipe['fixed_output_f2_rows'], 'local fixed outputs') + need({r for _,d,ss in new for r in [d]+ss} == set(REGS), 'frame visit coverage') + need(original['C'] == cleanup(original), 'inherited literal cleanup') + out = copy.deepcopy(original) + out['A'][2250:2302] = copy.deepcopy(new) + out['C'] = cleanup(out) + return out + + +def stream(word): + for section in ('D','A'): + for _,d,ss in word[section]: + for s in ss: yield ('add',d,s) + for index,center in enumerate(word['ret']): + yield ('copy',720,center) + for target,indices in enumerate(word['scatter']): + if index in indices: yield ('add',120+target,720) + yield ('erase',720,center) + for section in ('B','C'): + for _,d,ss in word[section]: + for s in ss: yield ('add',d,s) + + +def frame_paths(word): + paths = [[f] for f in word['start']] + for section in ('D','A','B','C'): + for f,d,ss in word[section]: + for r in [d]+ss: + if paths[r][-1] != f: paths[r].append(f) + for r,f in enumerate(word['final']): + if paths[r][-1] != f: paths[r].append(f) + return paths + + +def word_contract(original,candidate): + need(candidate['C'] == cleanup(candidate), 'literal cleanup differs') + need(all(original[k] == candidate[k] for k in original if k not in ('A','C')), 'unrelated field changed') + need(frame_paths(original) == frame_paths(candidate), 'frame paths changed') + + +def replay(word): + events = list(stream(word)); rows = [1 << i for i in range(720)]+[0] + opened = None + for tag,d,s in events: + if tag == 'add': + need(0 <= d < 720 and d != s and 0 <= s <= 720, 'scalar registers') + need(s != 720 or opened is not None, 'closed copy read') + need(d != opened, 'copied source modified') + rows[d] ^= rows[s] + elif tag == 'copy': + need(opened is None, 'overlapping copy'); opened = s; rows[d] = rows[s] + else: + need(opened == s, 'erase binding'); opened = None; rows[d] = 0 + need(opened is None and rows[720] == 0, 'copy closure') + expected = [(1 << i)^((1 << (i-120)) if 120 <= i < 240 else 0) for i in range(720)] + need(rows[:720] == expected, 'all-column endpoint') + bounds=[] + for reverse in (False,True): + norms=[1]*721; peak=1; opened=None + for tag,d,s in (reversed(events) if reverse else events): + if reverse and tag != 'add': tag='erase' if tag=='copy' else 'copy' + if tag == 'add': norms[d]+=norms[s]; peak=max(peak,norms[d]) + elif tag == 'copy': + need(opened is None,'prefix copy'); opened=s; norms[d]=norms[s] + else: + need(opened == s,'prefix erase');opened=None;norms[d]=0 + need(opened is None,'prefix closure');bounds.append(peak) + payload=64*bounds[0]**3*bounds[1]**2 + need(payload < 1 << 104, '104-bit native payload exceeded') + return dict(adds=sum(e[0]=='add' for e in events), copies=len(word['ret']), erasures=len(word['ret']), + formal_columns=720, forward_positive_prefix=bounds[0], inverse_positive_prefix=bounds[1], + payload_upper=str(payload),payload_bits=payload.bit_length(), + word_sha256=digest(word),scalar_stream_sha256=digest(events), + frame_paths_sha256=digest(frame_paths(word))) + + +def controls(original,candidate,recipe): + rejected=0 + for index in range(43): + changed=copy.deepcopy(recipe);changed['replacement_A_events'].pop(index) + # Check the mathematical map directly, without the fixed-length guard. + need(local_rows(changed['replacement_A_events']) != recipe['fixed_output_f2_rows'], 'vacuous deletion control') + rejected+=1 + bad=copy.deepcopy(candidate);bad['C']=copy.deepcopy(original['C']) + # Both old and new local maps are equal, so old cleanup is endpoint-valid! + try: word_contract(original,bad) + except ValueError as e: need('literal cleanup' in str(e), 'wrong stale cleanup rejection') + else: raise ValueError('stale cleanup accepted') + # This catches accounting/literal-interface drift rather than claiming a + # false endpoint failure. Literal cleanup is required for this construction. + stale=replay(bad) + need(stale['adds'] == 33949, 'stale cleanup bill') + rejected+=1 + bad=copy.deepcopy(candidate) + x,y=REGS[:2] + identity_cycle=[[484,d,[s]] for d,s in ((x,y),(y,x))*3] + need(local_rows(identity_cycle) == [1<43 ADDs=33958->33940 columns=720 payload_bits=102 no_new_kappa') + + +if __name__=='__main__':main()