From 93be459cecb32de77b89a71cfe344a3435858903 Mon Sep 17 00:00:00 2001 From: stan Date: Mon, 12 Oct 2026 22:32:23 -0700 Subject: [PATCH 1/2] Research: certify center quarter factoring and its local invoice limit --- research/complex-center-quarter/CLAIM.md | 52 + research/complex-center-quarter/EXPECTED.json | 1006 +++++++++++++++++ research/complex-center-quarter/README.md | 227 ++++ research/complex-center-quarter/SOURCES.json | 68 ++ research/complex-center-quarter/VALIDATION.md | 74 ++ .../complex-center-quarter/check_blocks.py | 103 ++ .../complex-center-quarter/test_verify.py | 101 ++ research/complex-center-quarter/verify.py | 466 ++++++++ 8 files changed, 2097 insertions(+) create mode 100644 research/complex-center-quarter/CLAIM.md create mode 100644 research/complex-center-quarter/EXPECTED.json create mode 100644 research/complex-center-quarter/README.md create mode 100644 research/complex-center-quarter/SOURCES.json create mode 100644 research/complex-center-quarter/VALIDATION.md create mode 100644 research/complex-center-quarter/check_blocks.py create mode 100644 research/complex-center-quarter/test_verify.py create mode 100644 research/complex-center-quarter/verify.py diff --git a/research/complex-center-quarter/CLAIM.md b/research/complex-center-quarter/CLAIM.md new file mode 100644 index 0000000000..0500e44ad3 --- /dev/null +++ b/research/complex-center-quarter/CLAIM.md @@ -0,0 +1,52 @@ +# Local sprint claim + +- Contributor: @ssteeper, with substantial OpenAI Codex assistance. +- Track: complex supplier. OS-random assignment seed: **35** (one cryptographic + random byte, rejection sampling above 199, then reduction modulo 100). +- Exact base: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +- Selected result: #626, `660de893d27bb7abd1d5b01b1640207528a5c851`, on + #622/#623 and #543; selected kappa `51110230636731/31250000000000000`. +- Claim: factor the common quarter coefficient in the eight copied-center + scatter/gather blocks of the selected CK and JP8 local programs. Scale the + disposable center once at frame zero and use signed unit additions. Preserve + the paid center child and every private clear. No new kappa is proposed. +- Method: exact symbolic boundary maps on arbitrary persistent and private + inputs; explicit binary-Horner primitive recount; native frame/wrapper replay; + positive prefix bounds; missing-scale, sign, clear and frame controls. +- Seed diversification: `35 % 2 = 1` selects JP8 first; `35 % 8 = 3` selects + center 3 for the first local witness and adverse controls. Extend only to the + complete eight-center template and the identical CK interface, not a new + repository-wide search. +- Expected deliverable: a self-contained finite circuit research package with + a read-only reproduction command, exact receipt, source pins and proof. +- Expected finish: 2026-10-13 05:56 UTC (2026-10-12 22:56 America/Los_Angeles). + +## Selection and coordination + +Three narrow candidates were considered: + +1. Fixed-boundary JP8 B-frame reassignment: close to #698's CK-frame census, + and expensive to distinguish within this session. +2. Sharing JP8 cleanup coefficient work: active #722, #739 and #751 work + already covers equal magnitudes, dyadic rescaling and reverse Horner. +3. Factoring quarter coefficients in disposable copied centers: selected. + This changes a center scatter/gather block across multiple scalar macros, + while retaining all center children and using the original macro lowering. + +GitHub's pinned-issue query returned no issues. The only open ordinary issue was +#650 (Discussions), so no reservation issue or unrelated comment was created. +The initial overlap inspection covered all open PR metadata through #751, +including bodies mentioning centers, scalar lowering, cleanup and gathering. +#750 relocates a live CK cleanup scale; #696/#723/#734 change within-macro +coefficient lowering; #749 changes the compensation target basis; #745 audits +arbitrary private-center inputs. These are related but distinct. No pending +implementation or result is imported. The accepted review ledger ends at #626. + +Prior negatives inspected include #687's fixed K-triangle relocation census, +#651's delivery/hosting rigidity and #719's fixed-middle cleanup rank-two +obstruction. None concerns the scalar quarter factor in a private, already +paid center stream. This experiment changes no copied-information rank cost. + +## Result + +Pending bounded experiment and final overlap refresh. diff --git a/research/complex-center-quarter/EXPECTED.json b/research/complex-center-quarter/EXPECTED.json new file mode 100644 index 0000000000..1f76f98c25 --- /dev/null +++ b/research/complex-center-quarter/EXPECTED.json @@ -0,0 +1,1006 @@ +{ + "status": "PASS_COMPLEX_CENTER_QUARTER", + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "assignment_seed": 35, + "kappa": "unchanged", + "providers": { + "jp8": { + "programs": { + "forward": { + "original": { + "real_primitives": 257232, + "scalar_macros": 22693, + "prefix_l1": "4536094588619580433782972610869617/281474976710656", + "prefix_bits": 64 + }, + "factored": { + "real_primitives": 256368, + "scalar_macros": 22701, + "prefix_l1": "4536094588619580433782972610869617/281474976710656", + "prefix_bits": 64 + }, + "saved_real_primitives": 864, + "program_sha256": "f444558ab77002232c6f0c09af65cca16f8a188038d8c99e8b76ad6f49f28108", + "recipes": [ + { + "center": 0, + "reference_start": 13113, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 0, + 414, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 1, + "reference_start": 13145, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 1, + 415, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 2, + "reference_start": 13177, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 2, + 416, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 3, + "reference_start": 13209, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 3, + 417, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 4, + "reference_start": 13241, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 4, + 418, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 5, + "reference_start": 13273, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 5, + 419, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 6, + "reference_start": 13305, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 6, + 420, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 7, + "reference_start": 13337, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 7, + 421, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + } + ], + "blocks": [ + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "95a7cf99c5807694c068b3663cfeb15a6c21b2735c7995cb36d6519f44795f54" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "22f97f6f02b54cae1c3baee72768aa3061f70eadc3cc1681fc13edb9af7280b5" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "e33a7a7cc1d5aed1b4780c43700b712f57729022e44591980c977088dc8c2394" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "76f48bed99c624b4f7487e7f3119f1e9a87343d4346b05734d8d180aa379f4e1" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "a63e655cb1ac1eeb731f84ec780e56b38d4bed2d4f1d2a15d46ab99d1ed3ea25" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "0f72eeed52cdcea3ad1aa63043a5d6469fd851869a765c125964ed686a14d6e9" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "5d179423df5586266d22e3fcae4ddd0133dd87c3f79902aa024f09a6a95f76c1" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "7d32cfd46da6ade2f93a38e00d3f1bc258fb1f39b5d5d7765787b5daf4839aea" + } + ], + "full_scalar_replay": { + "input_columns": 724, + "persistent_outputs": 716, + "private_outputs": 8, + "dirty_helpers_restored": 492 + }, + "controls": [ + "omitted_quarter_scale", + "wrong_quarter_scale", + "wrong_tap_sign", + "omitted_terminal_clear", + "omitted_paid_center", + "omitted_source_copy", + "scale_before_recursive_scatter", + "omitted_coefficient_work_clear" + ] + }, + "backward": { + "original": { + "real_primitives": 257280, + "scalar_macros": 22693, + "prefix_l1": "16753412757380464429924108070201913461/8388608", + "prefix_bits": 101 + }, + "factored": { + "real_primitives": 256416, + "scalar_macros": 22701, + "prefix_l1": "16753412757380464429924108070201913461/8388608", + "prefix_bits": 101 + }, + "saved_real_primitives": 864, + "program_sha256": "b6351c51ccdffd3e48c6843c00cacd72aee3509131e110553db82eafabb8b58e", + "recipes": [ + { + "center": 0, + "reference_start": 13113, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 0, + 0, + 414, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 1, + "reference_start": 13145, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 1, + 0, + 415, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 2, + "reference_start": 13177, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 2, + 0, + 416, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 3, + "reference_start": 13209, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 3, + 0, + 417, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 4, + "reference_start": 13241, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 4, + 0, + 418, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 5, + "reference_start": 13273, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 5, + 0, + 419, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 6, + "reference_start": 13305, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 6, + 0, + 420, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 7, + "reference_start": 13337, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 7, + 0, + 421, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + } + ], + "blocks": [ + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "68c88f710431121577905588d841b5611ccc1066c300bf62a210ec0aafef041a" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "4c5b091e8284baf780830353aa3912800e6b483ee913a01056624445cebf8efc" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "a0347cd5bbdf97f270693f5b6221c1ec482fe2da82ac6bc768c40cdbd36afe04" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "8bde49aebd9cde92f6c55861c03b1cdef5f86145a13c10e2b04f487a3fc9a272" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "26603946b71268e5f83f319a5d9efccad1240ecee2c2471a527eb9e6fb2da425" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "98462c6c1a0fca0dc9a804d8da5370b3c7b485dce4f5d21593e130f67ef1ab34" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "78628ab9415dc820e2e2a220a887f908711089d1b2b4ed5bc8c4aac44b411155" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "d9395d9665036414d5784f788d70c81a9302f4eb84777fb0abcfc072b9343b79" + } + ], + "full_scalar_replay": { + "input_columns": 724, + "persistent_outputs": 716, + "private_outputs": 8, + "dirty_helpers_restored": 492 + }, + "controls": [ + "omitted_quarter_scale", + "wrong_quarter_scale", + "wrong_tap_sign", + "omitted_terminal_clear", + "omitted_paid_center", + "omitted_initial_dirty_center_clear", + "scale_after_recursive_gather", + "omitted_coefficient_work_clear" + ] + } + }, + "native": { + "status": "PASS_INDEPENDENT_LOCAL_SCALAR_FRAME_AND_WRAPPER_REPLAY", + "paid_profiles": { + "forward": { + "1": 2512, + "4": 160, + "8": 8, + "3": 448, + "2": 400, + "5": 70, + "6": 8 + }, + "backward": { + "1": 2512, + "4": 160, + "8": 8, + "3": 448, + "2": 400, + "5": 70, + "6": 8 + } + }, + "local": { + "forward": { + "all_exact_columns": 716, + "prefix_l1_upper": "4536094588619580433782972610869617/281474976710656", + "prefix_bits_upper": 64, + "charged_payload_bits": 192, + "private_work_erased": true + }, + "backward": { + "all_exact_columns": 716, + "prefix_l1_upper": "16753412757380464429924108070201913461/8388608", + "prefix_bits_upper": 101, + "charged_payload_bits": 192, + "private_work_erased": true + } + }, + "negative_controls_rejected": [ + "wrong_scale", + "missing_center", + "wrong_common_frame", + "wrong_child_rank", + "missing_pre_wrapper", + "missing_post_wrapper", + "wrapper_with_wrong_frame", + "wrapper_in_wrong_phase", + "wrapper_on_a_data_register", + "wrapper_on_a_target_register", + "wrapper_on_a_centre_register", + "hpe_pre_wrapper_resolved_to_full_recipe", + "hpe_post_wrapper_without_terminal_frame", + "hpe_post_wrapper_wrong_terminal_frame", + "hpe_tail_gate_at_full_frame", + "hpe_tail_climb_dropped", + "hpe_helper_exit_adapter_to_full", + "hpe_tail_gate_moved_into_full_cleanup", + "cold_hpe_pre_wrapper_replaced_by_identity_entry_adapter", + "cold_hpe_pre_wrapper_dropped", + "cold_hpe_post_wrapper_replaced_by_exit_adapter", + "cold_hpe_pre_wrapper_resolved_to_cold_full_convention", + "cold_hpe_wrapper_with_nonzero_entrance", + "cold_hpe_post_wrapper_wrong_terminal_frame", + "cold_hpe_premix_gate_before_pre_wrapper" + ] + }, + "complete_local_price": { + "compiler": 25934336, + "children": 3606, + "native_registers": 716, + "centres": 8, + "original": { + "scalar_worst_orientation": 257280, + "macro_bound": 22693, + "local_adapters": 437040, + "local_primitive_bound": 11334342462720 + }, + "factored": { + "scalar_worst_orientation": 256416, + "macro_bound": 22701, + "local_adapters": 437168, + "local_primitive_bound": 11337662056864 + }, + "adapter_allowance_increase": 128, + "bound_increase": 3319594144, + "scope": "Scalar circuit improves; literal generic local invoice worsens; no global invoice or kappa gain." + } + }, + "ck": { + "programs": { + "forward": { + "original": { + "real_primitives": 224938, + "scalar_macros": 21936, + "prefix_l1": "920709848294", + "prefix_bits": 40 + }, + "factored": { + "real_primitives": 224074, + "scalar_macros": 21944, + "prefix_l1": "920709848294", + "prefix_bits": 40 + }, + "saved_real_primitives": 864, + "program_sha256": "cf4204c8fd2f48298446029571a3e626d6f273bea4cb1b7bf99b218315e41187", + "recipes": [ + { + "center": 0, + "reference_start": 13057, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 0, + 430, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 1, + "reference_start": 13089, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 1, + 431, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 2, + "reference_start": 13121, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 2, + 432, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 3, + "reference_start": 13153, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 3, + 433, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 4, + "reference_start": 13185, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 4, + 434, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 5, + "reference_start": 13217, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 5, + 435, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 6, + "reference_start": 13249, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 6, + 436, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + }, + { + "center": 7, + "reference_start": 13281, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 7, + 437, + 0, + 8 + ], + "scale_frame": 0, + "scale_position": "after_child" + } + ], + "blocks": [ + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "95a7cf99c5807694c068b3663cfeb15a6c21b2735c7995cb36d6519f44795f54" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "22f97f6f02b54cae1c3baee72768aa3061f70eadc3cc1681fc13edb9af7280b5" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "e33a7a7cc1d5aed1b4780c43700b712f57729022e44591980c977088dc8c2394" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "76f48bed99c624b4f7487e7f3119f1e9a87343d4346b05734d8d180aa379f4e1" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "a63e655cb1ac1eeb731f84ec780e56b38d4bed2d4f1d2a15d46ab99d1ed3ea25" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "0f72eeed52cdcea3ad1aa63043a5d6469fd851869a765c125964ed686a14d6e9" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "5d179423df5586266d22e3fcae4ddd0133dd87c3f79902aa024f09a6a95f76c1" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 171, + "candidate_primitives_per_component": 117, + "recursive_input_digest": "7d32cfd46da6ade2f93a38e00d3f1bc258fb1f39b5d5d7765787b5daf4839aea" + } + ], + "full_scalar_replay": { + "input_columns": 724, + "persistent_outputs": 716, + "private_outputs": 8, + "dirty_helpers_restored": 492 + }, + "controls": [ + "omitted_quarter_scale", + "wrong_quarter_scale", + "wrong_tap_sign", + "omitted_terminal_clear", + "omitted_paid_center", + "omitted_source_copy", + "scale_before_recursive_scatter", + "omitted_coefficient_work_clear" + ] + }, + "backward": { + "original": { + "real_primitives": 224986, + "scalar_macros": 21936, + "prefix_l1": "146068000389976309073/32", + "prefix_bits": 62 + }, + "factored": { + "real_primitives": 224122, + "scalar_macros": 21944, + "prefix_l1": "146068000389976309073/32", + "prefix_bits": 62 + }, + "saved_real_primitives": 864, + "program_sha256": "cba12294dfc267042ee0e6b72ef6d7e01b4fb791ce4cdd07a05ad8364913e5ab", + "recipes": [ + { + "center": 0, + "reference_start": 13057, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 0, + 0, + 430, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 1, + "reference_start": 13089, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 1, + 0, + 431, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 2, + "reference_start": 13121, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 2, + 0, + 432, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 3, + "reference_start": 13153, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 3, + 0, + 433, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 4, + "reference_start": 13185, + "tap_count": 28, + "negative_taps": 0, + "paid_child": [ + "center", + 4, + 0, + 434, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 5, + "reference_start": 13217, + "tap_count": 28, + "negative_taps": 6, + "paid_child": [ + "center", + 5, + 0, + 435, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 6, + "reference_start": 13249, + "tap_count": 28, + "negative_taps": 8, + "paid_child": [ + "center", + 6, + 0, + 436, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + }, + { + "center": 7, + "reference_start": 13281, + "tap_count": 28, + "negative_taps": 14, + "paid_child": [ + "center", + 7, + 0, + 437, + 8 + ], + "scale_frame": 0, + "scale_position": "before_child" + } + ], + "blocks": [ + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "68c88f710431121577905588d841b5611ccc1066c300bf62a210ec0aafef041a" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "4c5b091e8284baf780830353aa3912800e6b483ee913a01056624445cebf8efc" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "a0347cd5bbdf97f270693f5b6221c1ec482fe2da82ac6bc768c40cdbd36afe04" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "8bde49aebd9cde92f6c55861c03b1cdef5f86145a13c10e2b04f487a3fc9a272" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "26603946b71268e5f83f319a5d9efccad1240ecee2c2471a527eb9e6fb2da425" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "98462c6c1a0fca0dc9a804d8da5370b3c7b485dce4f5d21593e130f67ef1ab34" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "78628ab9415dc820e2e2a220a887f908711089d1b2b4ed5bc8c4aac44b411155" + }, + { + "arbitrary_inputs": 31, + "reference_primitives_per_component": 174, + "candidate_primitives_per_component": 120, + "recursive_input_digest": "d9395d9665036414d5784f788d70c81a9302f4eb84777fb0abcfc072b9343b79" + } + ], + "full_scalar_replay": { + "input_columns": 724, + "persistent_outputs": 716, + "private_outputs": 8, + "dirty_helpers_restored": 492 + }, + "controls": [ + "omitted_quarter_scale", + "wrong_quarter_scale", + "wrong_tap_sign", + "omitted_terminal_clear", + "omitted_paid_center", + "omitted_initial_dirty_center_clear", + "scale_after_recursive_gather", + "omitted_coefficient_work_clear" + ] + } + }, + "native": { + "status": "PASS_INDEPENDENT_LOCAL_SCALAR_FRAME_AND_WRAPPER_REPLAY", + "paid_profiles": { + "forward": { + "1": 2596, + "2": 552, + "4": 160, + "8": 8, + "3": 304, + "5": 70, + "6": 8 + }, + "backward": { + "1": 2596, + "2": 552, + "4": 160, + "8": 8, + "3": 304, + "5": 70, + "6": 8 + } + }, + "local": { + "forward": { + "all_exact_columns": 716, + "prefix_l1_upper": "920709848294", + "prefix_bits_upper": 40, + "charged_payload_bits": 192, + "private_work_erased": true + }, + "backward": { + "all_exact_columns": 716, + "prefix_l1_upper": "146068000389976309073/32", + "prefix_bits_upper": 62, + "charged_payload_bits": 192, + "private_work_erased": true + } + }, + "negative_controls_rejected": [ + "wrong_scale", + "missing_center", + "wrong_common_frame", + "wrong_child_rank", + "missing_pre_wrapper", + "missing_post_wrapper", + "wrapper_with_wrong_frame", + "wrapper_in_wrong_phase", + "wrapper_on_a_data_register", + "wrapper_on_a_target_register", + "wrapper_on_a_centre_register", + "hpe_pre_wrapper_resolved_to_full_recipe", + "hpe_post_wrapper_without_terminal_frame", + "hpe_post_wrapper_wrong_terminal_frame", + "hpe_tail_gate_at_full_frame", + "hpe_tail_climb_dropped", + "hpe_helper_exit_adapter_to_full", + "hpe_tail_gate_moved_into_full_cleanup", + "cold_hpe_pre_wrapper_replaced_by_identity_entry_adapter", + "cold_hpe_pre_wrapper_dropped", + "cold_hpe_post_wrapper_replaced_by_exit_adapter", + "cold_hpe_pre_wrapper_resolved_to_cold_full_convention", + "cold_hpe_wrapper_with_nonzero_entrance", + "cold_hpe_post_wrapper_wrong_terminal_frame", + "cold_hpe_premix_gate_before_pre_wrapper" + ] + }, + "complete_local_price": { + "compiler": 25934336, + "children": 3698, + "native_registers": 716, + "centres": 8, + "original": { + "scalar_worst_orientation": 224986, + "macro_bound": 21936, + "local_adapters": 426400, + "local_primitive_bound": 11058401095386 + }, + "factored": { + "scalar_worst_orientation": 224122, + "macro_bound": 21944, + "local_adapters": 426528, + "local_primitive_bound": 11061720689530 + }, + "adapter_allowance_increase": 128, + "bound_increase": 3319594144, + "scope": "Scalar circuit improves; literal generic local invoice worsens; no global invoice or kappa gain." + } + } + } +} diff --git a/research/complex-center-quarter/README.md b/research/complex-center-quarter/README.md new file mode 100644 index 0000000000..80b08601a5 --- /dev/null +++ b/research/complex-center-quarter/README.md @@ -0,0 +1,227 @@ +# Factor the quarter in copied-center delivery + +**Finite complex-supplier circuit construction and cost audit; no new kappa.** + +The selected #626 CK and JP8 programs each scatter/gather through eight private +copied centers. Each center has 28 signed quarter-coefficient taps. Moving the +common factor `1/4` into one scale of that private center saves **864 real scalar +primitives per complete program**, under the retained binary-Horner lowering. +All copies, source reads, coefficient preparation, scales and clearing are paid. +The literal rewrite adds eight scalar macros, however, and its complete +conservative local invoice **increases by 3,319,594,144** because of the generic +per-macro adapter allowance. This is a scalar circuit saving with a verified +integration limit, not a net supplier-cost improvement. + +| Selected program | Original real primitives | Factored | Saving | +|---|---:|---:|---:| +| CK forward | 224,938 | 224,074 | 864 | +| CK inverse-transpose | 224,986 | 224,122 | 864 | +| JP8 forward | 257,232 | 256,368 | 864 | +| JP8 inverse-transpose | 257,280 | 256,416 | 864 | + +There are eight additional scalar macros per program, each a charged quarter +scale. No register, recursive child, frame transition, wrapper or restoration +is added. The exact positive prefix envelopes remain unchanged: CK uses 40/62 +bits and JP8 uses 64/101 bits in the two orientations, below the inherited +192-bit local allowance. These are operation counts, not measured runtime gains. + +## Reproduce + +From the repository root, with Python 3.11+ and no third-party dependencies: + +```sh +python3 -I -B research/complex-center-quarter/verify.py +python3 -I -B research/complex-center-quarter/check_blocks.py +``` + +The first command checks every source pin, rebuilds the four modified programs, +executes all changed blocks as literal primitives, replays all 724 formal input +columns of both original and modified scalar programs, and runs the unchanged +native frame/wrapper auditor on the candidates. It compares the complete result +against [EXPECTED.json](EXPECTED.json). Expected final line: + +```text +PASS_COMPLEX_CENTER_QUARTER programs=4 centers=32 saving=864_each columns=724 controls=32+50 invoice_delta=+3319594144 kappa=unchanged +``` + +The second command separately executes the 64 original/candidate block matrices +on an integer quarter grid and compares them against the gather/scatter formula: + +```text +PASS_CENTER_QUARTER_INTEGER blocks=64 matrix_entries=57600 clear_controls=32 +``` + +Both commands leave repository inputs unchanged. The first uses and removes a +temporary directory for the inherited auditor's generated receipts. A writable +system temporary directory is required; on restricted Windows installations, +`TEMP` and `TMP` can name a writable scratch directory. `--write-receipt PATH` +creates a new receipt and refuses to overwrite an existing file. Normal runs +always compare the committed receipt. The native subprocess uses `-I -B`, so +its required assertions remain enabled even under an optimized parent process. + +## Circuit identity and recursive boundary + +Let `C` be the private center, `s` its persistent source, and let the 28 taps +have signs `epsilon_j` in `{+1,-1}`. The exact native program has one paid +rank-eight center call between its center frame and frame zero. All taps are +at frame zero; the checker exhausts these conditions in both providers. + +Forward, the old and new blocks are: + +```text +old: clear C; copy s -> C; paid descent; y_j += epsilon_j*C/4; clear C +new: clear C; copy s -> C; paid descent; C /= 4; + y_j += epsilon_j*C; clear C +``` + +The paid descent receives exactly the old input. For every possible output of +that call, the target increments agree term by term. The source is unchanged, +arbitrary incoming target values are retained, and the private center is erased. + +Inverse-transpose, the blocks are: + +```text +old: clear C; C += epsilon_j*y_j/4; paid ascent; s -= C; clear C +new: clear C; C += epsilon_j*y_j; C /= 4; + paid ascent; s -= C; clear C +``` + +Here the center is zero before gathering, so dividing the completed sum by four +gives exactly the original recursive-call input. The persistent subtraction and +final clear are unchanged. The scale is **before the ascent and after the +descent**: no commutation with a recursive operator is assumed. A control moves +it across the call, preserves the scalar endpoint under identity interpretation, +and is rejected because the input to the recursive call changes. + +The reverse gather temporarily has four times the old center value. The full +positive-envelope recount includes this intermediate and the coefficient-work +stream and still produces the exact original global envelope. Endpoint equality +alone would not establish this precision statement. + +The primary block checker executes the original primitive lowering on every +formal input, including arbitrary incoming center and coefficient-work dirt. +There are 31 inputs per block. The full scalar replay includes all 716 native +register inputs and all eight private centers. Work clearing for the unchanged +macros follows the retained lowering, whose `clear W` is also checked explicitly +on each modified block. No clean-helper or clean-center premise is used. + +## Scalar cost and complete local invoice + +The retained emitter charges a nonzero dyadic addition with absolute coefficient +`a/b`, reduced and `b` a power of two, the following primitives per real component: + +```text +3 + (bit_length(a)-1) + popcount(a) + (bit_length(b)-1). +``` + +The three fixed operations are initial work clearing, signed accumulation and +final work clearing. The other terms pay Horner doublings/additions and halvings. +Thus a signed quarter addition costs six and a signed unit addition costs four. +One private quarter scale costs two. Each block saves `28*(6-4)-2 = 54` +primitives per real component. Eight blocks and two real components give +`8*54*2 = 864`. The forward block falls from 171 to 117 primitives per component; +the reverse block falls from 174 to 120. Their differences include every copy, +clear, subtraction and newly introduced scale. + +All non-scalar events remain equal as ordered lists. The independent native +auditor checks their incidence with the new scalar gates, the exact paid rank +histograms, wrapper ordering, helper restoration and the 192-bit bound. Each +provider's histogram matches its selected SPEC. + +The pinned `invoice_allcold.py` also charges a conservative adapter allowance +`A = 16*(macros + children + n + centers) + 64*m`, with `m=73`, compiler cost +`K = 64*(m+1)^3 = 25,934,336`, and local bound +`max(real_primitives) + A*K`. The checker independently reconstructs both +original bounds against SPEC, then prices the new program's actual macro count: + +| Provider | Original local bound | Literal factored local bound | +|---|---:|---:| +| CK | 11,058,401,095,386 | 11,061,720,689,530 | +| JP8 | 11,334,342,462,720 | 11,337,662,056,864 | + +The eight extra scale macros add 128 adapter allowances. Consequently the +bound changes by `128*K - 864 = +3,319,594,144` for each provider. Both remain +below the inherited `2^48` local cap, but the rewrite does **not** lower this +complete bound. This stops the experiment at a finite circuit construction +and scoped accounting result. A grouped center-microcircuit admission rule could +be a separate investigation; no such rule or saving is implemented or claimed +here. All recursive children and other inherited local charges are retained. +The global owner allocation, invoice and exponent assembly have not been rebuilt. + +## Pins, scope and completed coverage + +- Base commit: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +- Selected #626 source: `660de893d27bb7abd1d5b01b1640207528a5c851`. +- #622 construction: `f69477f4f6d3c7eb1f740b166881bffed4ffa9f6`. +- #623 dispatch: `e39a615ca601ce5d62abeb24f3fcdb8644ca1005`. +- #543 bit supplier: `2065fe4f72a914d907f1046603f5a36f17018535`. + +[SOURCES.json](SOURCES.json) pins all 14 consumed inputs. The selected record is +followed through its inventory to the #626 SPEC and original emitter/auditor. +Program and canonical-word payload hashes are checked against the selected +SPEC, and each individual program hash is checked as well. Compressed artifacts +are pinned by their exact decompressed payload, allowing gzip repackaging. + +OS assignment seed **35** selected the complex track, JP8 first and center 3 +for the initial witness/controls. The completed domain is all eight centers of +both selected providers in both orientations: 32 transformed blocks, all using +the same exact identity. The stopping rule is completion of that domain and +its validation. There is no randomized circuit search or optimality claim. +The [local claim](CLAIM.md) records three candidates and the overlap review. + +The 32 new block controls cover missing/wrong scaling, wrong tap signs, omitted +source copying, dirty-center initialization, terminal and coefficient-work +clearing, omitted paid children and scales moved across recursive calls. The +native auditors reject their 50 inherited controls. The separate integer checker +rejects 32 private-clear omissions. See [VALIDATION.md](VALIDATION.md) for the +additional frame, prefix, packaging and corruption checks actually run. + +This package imports no pending PR implementation. It adds a local replacement +to already emitted programs; production integration would require an admitted +emitter/typed construction step, refreshed program bindings, and a global +hosting/invoice/outer replay. The original all-size/compiler, common-label and +mutable-basis realization, pooled hosting, normalized residual, precision/tape, +exact recovery, bit-supplier and analytic assumptions remain. Finite exact +replay is not a Lean proof or a formal multiplication theorem. The selected +frontier and `upstream/` are unchanged. + +## Attribution and related work + +Prepared for **@ssteeper with substantial OpenAI Codex assistance** in research, +implementation, exact checks and writing. All work here was performed in one +agent session; no independent human review is claimed. New files are licensed +under the repository's Apache-2.0 license. + +Credit to icekylinx's copied-center, direct-delivery and primitive-emitter +lineage; Jeremy Kothe/AtomScout's #622 construction and CK/JP8 predecessors; +Chafik Boukhalfa's #626 package; DreamingOfClouds' cold-helper and native auditor +work; Dominik Scholz, Dugongue, Rohan Arun, eumemic and the cumulative sources +credited in the retained maintainer review and package notices. The unchanged +auditor itself retains its PR514/PR433 notices. + +Concurrent [#745](https://github.com/CrocSwap/integer-mult-bounds/pull/745) +(Sagar Thakrar) motivates explicit arbitrary private-center inputs and the +initial-clear control. [#750](https://github.com/CrocSwap/integer-mult-bounds/pull/750) +(Sagar Thakrar) relocates a live CK cleanup scale; this contribution factors a +disposable center at its recursive boundary. [#696](https://github.com/CrocSwap/integer-mult-bounds/pull/696), +[#723](https://github.com/CrocSwap/integer-mult-bounds/pull/723) and +[#734](https://github.com/CrocSwap/integer-mult-bounds/pull/734) lower individual +coefficients; [#722](https://github.com/CrocSwap/integer-mult-bounds/pull/722), +[#739](https://github.com/CrocSwap/integer-mult-bounds/pull/739) and +[#751](https://github.com/CrocSwap/integer-mult-bounds/pull/751) share or gather +cleanup work; [#749](https://github.com/CrocSwap/integer-mult-bounds/pull/749) +changes the compensation target basis. They are distinct and are credited as +concurrent context, not dependencies. No additive saving with them is claimed. + +The final refresh also found [#755](https://github.com/CrocSwap/integer-mult-bounds/pull/755) +by @taizaki69, pinned at `a1dd9f819102c40e0b5e4a75215cf69ee864f480`. +Its forward-center runs cover the same 224 JP8 taps using retained coefficient +work and #696's cheaper macro lowering. This overlap is explicitly credited; +no priority or stronger primitive-saving claim is made for forward JP8 centers. +This package adds the reverse gather's common-target factor, CK coverage, exact +recursive-input equality and a complete cost audit of the literal extra-scale +encoding. Coefficient work remains cleared after every addition. The observed +adapter increase is part of the result. [#769](https://github.com/CrocSwap/integer-mult-bounds/pull/769) +by @24kHandsome1201 reuses varying CK coefficient magnitudes in cleanup and +preconditioning; it does not cover these center blocks. Neither pending source +is imported. diff --git a/research/complex-center-quarter/SOURCES.json b/research/complex-center-quarter/SOURCES.json new file mode 100644 index 0000000000..ebddee64ac --- /dev/null +++ b/research/complex-center-quarter/SOURCES.json @@ -0,0 +1,68 @@ +{ + "format": "center-quarter-sources-v1", + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "reviewed_heads": { + "626": "660de893d27bb7abd1d5b01b1640207528a5c851", + "623": "e39a615ca601ce5d62abeb24f3fcdb8644ca1005", + "622": "f69477f4f6d3c7eb1f740b166881bffed4ffa9f6", + "543": "2065fe4f72a914d907f1046603f5a36f17018535" + }, + "files": { + "certificates/selected-result.json": { + "mode": "bytes", + "sha256": "b3bf402f31a69bde0629936a9b569bed48281568d7b16d5fba120b5311ea1f53" + }, + "research/complex-k492-owner-repair/data/SPEC.json": { + "mode": "bytes", + "sha256": "2a2577ac526535826fed9d5f7f83f6e2e0ec058a146c64f7286720b995fa2323" + }, + "research/community-k492-audit/SELECTED-SOURCE.json": { + "mode": "bytes", + "sha256": "36e9e421230c4cb7b6a537d76a4bdfb6f667730d383e56062d4e45957484ab9e" + }, + "research/complex-k492-owner-repair/code/hpe_audit_local.py": { + "mode": "bytes", + "sha256": "6bd9a1e279c9c9e4f3767d9f82e537b559292906feb2ddab02f380fb6523a810" + }, + "research/complex-k492-owner-repair/code/hpe_emit_local.py": { + "mode": "bytes", + "sha256": "7e4a6fbc38c8228157b6311457d1496bf460291393043932d2c365f004f77805" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/CANONICAL-WORD.json.gz": { + "mode": "decompressed", + "sha256": "fb4a8d14ed2a8048698bea6ae16f86163a1aa6c80f2eb622222eee5cdbce9b3b" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/LOCAL-PROGRAMS.json.gz": { + "mode": "decompressed", + "sha256": "efe45ce7fb025a6f53cc9eb54e951ac2211a5ed927e689a049e4f68ca680654b" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/LOCAL-CHECKS.json": { + "mode": "bytes", + "sha256": "0fad744aa863eedb288a9f87b1c23225a36b316b6275cc3b1bcedd42afe28a67" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/INDEPENDENT-LOCAL-REPLAY.json": { + "mode": "bytes", + "sha256": "cb2f99ed351925dd35434b73de16f4085884fe81a35a69e1c7ce2d5e96cb975b" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/ck/CANONICAL-WORD.json.gz": { + "mode": "decompressed", + "sha256": "9bbc75dede090cfd7a0a0252424ea9d9f6211e2350d2a801d4e4f2f0784167c7" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/ck/LOCAL-PROGRAMS.json.gz": { + "mode": "decompressed", + "sha256": "854f17274092263dc25e60367f4cd0d29f60a8446becd17cc1883ebed7a97900" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/ck/LOCAL-CHECKS.json": { + "mode": "bytes", + "sha256": "059c4e59142bdf5c19dc7c0afebcddfec28e6e60cbc7299b8bdcc624afbc0cbe" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/ck/INDEPENDENT-LOCAL-REPLAY.json": { + "mode": "bytes", + "sha256": "ecefb9e661301d8081522be68bbe6640e175c011eb1177f643383d193c6fb2f0" + }, + "research/complex-k492-owner-repair/code/invoice_allcold.py": { + "mode": "bytes", + "sha256": "141bd2fd58bbfb5b8d0fc8f56f61c45586d5608a5af3487c6b883dd987f998ec" + } + } +} diff --git a/research/complex-center-quarter/VALIDATION.md b/research/complex-center-quarter/VALIDATION.md new file mode 100644 index 0000000000..25b65f8075 --- /dev/null +++ b/research/complex-center-quarter/VALIDATION.md @@ -0,0 +1,74 @@ +# Validation record + +Executed locally on Windows with CPython 3.12.10 (64 bit), standard library +only, on 2026-10-12 America/Los_Angeles. Prepared by OpenAI Codex for @ssteeper; +no independent human review or external CI execution is claimed. + +## Mathematical checks + +```sh +python3 -I -B research/complex-center-quarter/verify.py +python3 -I -B research/complex-center-quarter/check_blocks.py +python3 -I -B research/complex-center-quarter/test_verify.py +python3 -I -B scripts/verify_selected_result.py +``` + +- The exact primitive construction checks all 32 original/replacement block + pairs, each on 31 arbitrary inputs including center and coefficient work. +- Complete macro replay checks all 724 formal inputs in both orientations of + both providers, for both original and factored programs. All 492 helpers + restore and all eight private centers clear. +- The unchanged native auditor accepts each candidate, reproduces the selected + paid profile and exact prefix bound, and rejects its 25 controls per provider. +- The 32 new block controls pass, including two endpoint-correct rewrites whose + inputs to recursive calls are wrong. This distinction is verified directly + in the focused tests. +- A separate integer-grid implementation checks 57,600 matrix entries in 64 + original/candidate blocks against direct gather/scatter formulas and rejects + 32 missing-clear controls. It shares source binding and rewrite code, but + imports neither the primitive interpreter nor its costing/prefix engine. +- Five focused tests pass: call-boundary sensitivity, arbitrary incoming center + dirt, endpoint-neutral precision inflation, coefficient-work alias/clearing, + and native rejection of the new quarter scale at the wrong frame in each + orientation. The last test executes the pinned native auditor in a subprocess + and checks the actual frame assertion. +- The original complete local invoices reproduce exactly from SPEC. The + factored programs add 128 generic adapter allowances, so each local bound + increases by `3,319,594,144`, while staying below `2^48`. No net supplier-cost + or exponent improvement is inferred from the scalar saving. +- The selected-record inventory check passes. All selected inputs and + `upstream/` remain unchanged. + +## Portability and failure detection + +The primary checker also passes under `python -I -O -B`; its native child +process explicitly uses `-I -B` so assertions stay enabled. A minimal checkout +containing only this package and its pinned inputs is copied into a path with +spaces and invoked from outside that checkout. All four compressed inputs are +repacked with a different gzip timestamp and compression level; the replay and +integer checker still pass. + +In that disposable checkout, changing a canonical-word payload is rejected by +the source pin. Changing the expected cost is rejected by complete receipt +comparison. The explicit receipt-output mode rejects an existing file and +preserves its bytes. Before/after SHA-256 snapshots confirm that the primary +command leaves package inputs unchanged. Scratch directories are confined to +the system temporary root and removed after use. + +The initial Windows sandbox temporary location could be created but was not +writable. Reproduction succeeded after setting `TEMP` and `TMP` to the writable +workspace scratch directory. This was an environment failure before native +execution, not a failed identity or an accepted mathematical result. + +## Scope limits + +The tests use the pinned emitted programs and native local checker. They do +not cold-regenerate the entire construction, rerun global owner/phase admission, +or implement a grouped center-microcircuit invoice. The 864-primitive saving is +for scalar work under the retained lowering. Literal generic local accounting +gets worse; the exact increase is part of the receipt and research result. + +Full `make verify`, `make frontier626-verify`, Lean, and remote Linux CI were +not run for this isolated research addition. The inherited all-size, physical, +precision/tape and analytic assumptions remain. This is finite exact evidence, +not formal verification of the multiplication theorem. diff --git a/research/complex-center-quarter/check_blocks.py b/research/complex-center-quarter/check_blocks.py new file mode 100644 index 0000000000..bdbbda9fe7 --- /dev/null +++ b/research/complex-center-quarter/check_blocks.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python3 +"""Separate integer-matrix check of the copied-center circuit identities. + +Does not use verify.py's primitive interpreter, prefix engine, or costing. +It imports only its deterministic rewrite and source binding. Apache-2.0. +Prepared for @ssteeper with substantial OpenAI Codex assistance. +""" + +import importlib.util +from pathlib import Path + + +HERE = Path(__file__).resolve().parent +spec = importlib.util.spec_from_file_location("quarter", HERE / "verify.py") +quarter = importlib.util.module_from_spec(spec) +spec.loader.exec_module(quarter) + + +def demand(condition, message): + if not condition: + raise ValueError(message) + + +def integer_boundary(block, backward): + """All coefficients are stored as integers in units of one quarter. + + The tested block has exactly one quarter factor on every dependency path; + divisibility checks make any attempted second factor observable. + """ + scalars = [e[1] for e in block if e[0] == "scalar"] + regs = sorted({tuple(op[1]) for op in scalars} | + {tuple(op[2]) for op in scalars if op[0] in ("copy", "add")}) + index = {r: i for i, r in enumerate(regs)} + size = len(regs) + matrix = [[4 * int(i == j) for j in range(size)] for i in range(size)] + for op in scalars: + target = index[tuple(op[1])] + if op[0] == "clear": + matrix[target] = [0] * size + elif op[0] == "copy": + matrix[target] = matrix[index[tuple(op[2])]].copy() + elif op[0] == "scale": + a, b = op[2:4] + demand(all(a * x % b == 0 for x in matrix[target]), "nonintegral quarter grid") + matrix[target] = [a * x // b for x in matrix[target]] + elif op[0] == "add": + source = index[tuple(op[2])] + a, b = op[3:5] + demand(all(a * x % b == 0 for x in matrix[source]), "nonintegral tap grid") + matrix[target] = [x + a * y // b for x, y in zip(matrix[target], matrix[source])] + else: + raise ValueError("unknown operation") + + # Direct gather/scatter specification, not a replay of the old block. + center = next(r for r in regs if r[0] == "C") + expected = [[4 * int(i == j) for j in range(size)] for i in range(size)] + expected[index[center]] = [0] * size + if backward: + send = next(op for op in scalars if op[0] == "add" and op[2] == list(center)) + recipient = index[tuple(send[1])] + taps = [op for op in scalars if op[0] == "add" and op[1] == list(center)] + for op in taps: + expected[recipient][index[tuple(op[2])]] -= op[3] + else: + copied = next(op for op in scalars if op[0] == "copy") + source = index[tuple(copied[2])] + taps = [op for op in scalars if op[0] == "add"] + for op in taps: + expected[index[tuple(op[1])]][source] += op[3] + demand(len(taps) == 28 and matrix == expected, "direct integer block specification") + return size * size + + +def main(): + quarter.check_sources() + entries = 0 + cases = 0 + controls = 0 + for name in quarter.PROVIDERS: + programs = quarter.read(quarter.ROOT / quarter.REPLAY / name / "LOCAL-PROGRAMS.json.gz") + for direction, events in programs.items(): + back = direction == "backward" + new, _ = quarter.transform(events, back) + start, _, blocks = quarter.center_blocks(events) + for k, old in enumerate(blocks): + candidate = new[start + 33*k:start + 33*(k+1)] + entries += integer_boundary(old, back) + integer_boundary(candidate, back) + cases += 2 + # The incoming private coordinate is included in the matrix. + # Only backward initial clears are indispensable: forward copy + # overwrites that dirt, so no false omission claim is made. + bad = candidate[1:] if back else candidate[:-1] + try: + integer_boundary(bad, back) + except ValueError: + controls += 1 + else: + raise ValueError("dirty/private clear omission accepted") + print(f"PASS_CENTER_QUARTER_INTEGER blocks={cases} matrix_entries={entries} clear_controls={controls}") + + +if __name__ == "__main__": + main() diff --git a/research/complex-center-quarter/test_verify.py b/research/complex-center-quarter/test_verify.py new file mode 100644 index 0000000000..52fb33451e --- /dev/null +++ b/research/complex-center-quarter/test_verify.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +"""Focused recursive-boundary, precision and frame rejection tests. + +Prepared for @ssteeper with substantial OpenAI Codex assistance. Apache-2.0. +""" + +import copy +import gzip +import importlib.util +import json +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest + + +HERE = Path(__file__).resolve().parent +spec = importlib.util.spec_from_file_location("quarter", HERE / "verify.py") +quarter = importlib.util.module_from_spec(spec) +spec.loader.exec_module(quarter) + + +class CircuitFailures(unittest.TestCase): + @classmethod + def setUpClass(cls): + quarter.check_sources() + directory = quarter.ROOT / quarter.REPLAY / "jp8" + cls.canonical = quarter.read(directory / "CANONICAL-WORD.json.gz") + cls.original = quarter.read(directory / "LOCAL-PROGRAMS.json.gz") + cls.candidate = {d: quarter.transform(es, d == "backward")[0] + for d, es in cls.original.items()} + + def blocks(self, direction): + start, _, old = quarter.center_blocks(self.original[direction]) + return old[3], copy.deepcopy(self.candidate[direction][start + 99:start + 132]) + + def test_crossing_child_is_not_just_an_endpoint_check(self): + for direction in ("forward", "backward"): + with self.subTest(direction=direction): + old, bad = self.blocks(direction) + si = next(i for i, e in enumerate(bad) if e[0] == "scalar" and e[1][0] == "scale") + scale = bad.pop(si) + ci = next(i for i, e in enumerate(bad) if e[0] == "center") + bad.insert(ci if direction == "forward" else ci + 1, scale) + original_rows, original_call, _ = quarter.block_map(old) + bad_rows, bad_call, _ = quarter.block_map(bad) + self.assertEqual(original_rows, bad_rows) + self.assertNotEqual(original_call, bad_call) + with self.assertRaisesRegex(ValueError, "recursive center input"): + quarter.check_block_pair(old, bad, direction == "backward") + + def test_dirty_center_clear_is_needed_in_reverse_gather(self): + _, block = self.blocks("backward") + correct, _, _ = quarter.block_map(block) + bad, _, _ = quarter.block_map(block[1:]) + dirt = ("C", 3) + self.assertTrue(all(dirt not in row for row in correct.values())) + self.assertTrue(any(dirt in row for r, row in bad.items() if r[0] == "L")) + + def test_endpoint_neutral_prefix_excursion_is_rejected(self): + old, _ = self.blocks("backward") + # Add a reversible overshoot after an actual nonzero accumulation. + bad = copy.deepcopy(old) + bad[2:2] = [["scalar", ["scale", ["C", 3], 2**200, 1], 0], + ["scalar", ["scale", ["C", 3], 1, 2**200], 0]] + self.assertEqual(quarter.block_map(old)[:2], quarter.block_map(bad)[:2]) + with self.assertRaisesRegex(ValueError, "192-bit"): + quarter.cost_prefix(bad) + + def test_coefficient_work_is_disjoint_and_cleared(self): + with self.assertRaisesRegex(ValueError, "alias"): + list(quarter.lower(["add", ["L", 1], ["W", 0], 1, 4])) + regs = (("L", 1), ("L", 2), quarter.W) + rows = {r: {r: quarter.Q(1)} for r in regs} + for primitive in quarter.lower(["add", ["L", 1], ["L", 2], -1, 4]): + quarter.apply_primitive(rows, primitive) + self.assertEqual(rows[quarter.W], {}) + self.assertEqual(rows[("L", 1)], {("L", 1): 1, ("L", 2): quarter.Q(-1, 4)}) + + def test_quarter_scale_at_wrong_frame_is_rejected_by_native_auditor(self): + for direction in ("forward", "backward"): + with self.subTest(direction=direction): + programs = copy.deepcopy(self.candidate) + scale = next(e for e in programs[direction] if e[0] == "scalar" + and e[1][:2] == ["scale", ["C", 3]]) + scale[2] = self.canonical["center_frames"][3] + with tempfile.TemporaryDirectory(prefix="center-frame-control-") as tmp: + out = Path(tmp).resolve() + self.assertTrue(out.is_relative_to(Path(tempfile.gettempdir()).resolve())) + for name, value in (("CANONICAL-WORD.json.gz", self.canonical), + ("LOCAL-PROGRAMS.json.gz", programs)): + (out / name).write_bytes(gzip.compress(json.dumps(value).encode(), mtime=0)) + proc = subprocess.run([sys.executable, "-I", "-B", str(quarter.ROOT / quarter.AUDITOR), str(out)], + capture_output=True, text=True, timeout=120) + self.assertNotEqual(proc.returncode, 0) + self.assertIn("assert private[r]==f", proc.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/research/complex-center-quarter/verify.py b/research/complex-center-quarter/verify.py new file mode 100644 index 0000000000..67c196fdef --- /dev/null +++ b/research/complex-center-quarter/verify.py @@ -0,0 +1,466 @@ +#!/usr/bin/env python3 +"""Factor copied-center quarter coefficients; exact, offline finite verification. + +Prepared for @ssteeper with substantial OpenAI Codex assistance. Apache-2.0. +The retained emitter and native auditor are credited in README.md. +""" + +import argparse +import copy +from fractions import Fraction as Q +import gzip +import hashlib +import json +from pathlib import Path +import subprocess +import sys +import tempfile + + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +BASE = "66849e1475c930fd7732b1a0067ffee7e1e95f60" +SELECTED = "certificates/selected-result.json" +SPEC = "research/complex-k492-owner-repair/data/SPEC.json" +INVENTORY = "research/community-k492-audit/SELECTED-SOURCE.json" +AUDITOR = "research/complex-k492-owner-repair/code/hpe_audit_local.py" +EMITTER = "research/complex-k492-owner-repair/code/hpe_emit_local.py" +INVOICE = "research/complex-k492-owner-repair/code/invoice_allcold.py" +REPLAY = "research/community-k492-audit/pr626/replay/mixed-global/base/providers" +PROVIDERS = ("jp8", "ck") # Seed 35 selects JP8 first. +W = ("W", 0) + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def digest(value): + return hashlib.sha256(json.dumps(value, sort_keys=True, separators=(",", ":"), + allow_nan=False).encode()).hexdigest() + + +def payload(path): + data = path.read_bytes() + return gzip.decompress(data) if path.suffix == ".gz" else data + + +def read(path): + return json.loads(payload(path)) + + +def check_sources(): + pins = read(HERE / "SOURCES.json") + require(pins["base_commit"] == BASE, "base pin") + for rel, pin in pins["files"].items(): + path = (ROOT / rel).resolve() + require(path.is_relative_to(ROOT) and path.is_file(), "invalid source path") + require(pin["mode"] in ("bytes", "decompressed"), "unknown source pin mode") + data = payload(path) if pin["mode"] == "decompressed" else path.read_bytes() + require(hashlib.sha256(data).hexdigest() == pin["sha256"], "source pin: " + rel) + selection = read(ROOT / SELECTED) + spec = read(ROOT / SPEC) + inventory = read(ROOT / INVENTORY) + require(selection["kappa"] == "51110230636731/31250000000000000", "selected kappa") + require(selection["source_manifest"] == INVENTORY, "selected inventory link") + require(selection["audited_source_head"] == pins["reviewed_heads"]["626"], "selected head") + for pr, head in pins["reviewed_heads"].items(): + require(selection["reviewed_dependency_heads"][pr] == head, "reviewed head: " + pr) + for rel in (SPEC, AUDITOR, EMITTER, INVOICE): + require(inventory["files"][rel] == pins["files"][rel]["sha256"], "inventory pin: " + rel) + for name in PROVIDERS: + desc = spec["providers"][name] + for filename in ("CANONICAL-WORD.json.gz", "LOCAL-PROGRAMS.json.gz"): + rel = f"{REPLAY}/{name}/{filename}" + require(desc["artifact_semantic_sha256"][filename] == pins["files"][rel]["sha256"], + "SPEC artifact binding") + programs = read(ROOT / REPLAY / name / "LOCAL-PROGRAMS.json.gz") + require({d: digest(es) for d, es in programs.items()} == desc["program_hashes"], + "SPEC program binding") + return spec + + +def center_blocks(events): + """Parse the complete selected center phase, refusing other event shapes.""" + start = events.index(["phase", "centers"]) + 1 + stop = next(i for i in range(start, len(events)) if events[i][0] == "phase") + phase = events[start:stop] + require(len(phase) == 8 * 32, "eight 32-event reference center blocks required") + return start, stop, [phase[i:i + 32] for i in range(0, len(phase), 32)] + + +def transform(events, backward): + start, stop, blocks = center_blocks(events) + replacement, recipes = [], [] + for k, block in enumerate(blocks): + center = ["C", k] + child_indices = [i for i, e in enumerate(block) if e[0] == "center"] + require(len(child_indices) == 1, "one paid center child") + ci = child_indices[0] + child = block[ci] + require(child[1] == k and child[4] == 8, "center index/rank") + require(child[2 if backward else 3] == 0, "center child meets zero frame") + require(ci == (29 if backward else 2), "reference center chronology") + require(block[-1] == ["scalar", ["clear", center], child[3]], "terminal center clear") + require(block[0] == ["scalar", ["clear", center], child[2]], "initial center clear") + if backward: + exit_add = block[-2] + require(exit_add[0] == "scalar" and exit_add[2] == child[3] + and exit_add[1][0] == "add" and exit_add[1][2:] == [center, -1, 1], + "backward center subtraction") + else: + require(block[1][0] == "scalar" and block[1][1][:2] == ["copy", center] + and block[1][2] == child[2], "forward center source copy") + changed = copy.deepcopy(block) + taps = changed[1:29] if backward else changed[3:31] + require(len(taps) == 28, "28 center taps") + for e in taps: + require(e[0] == "scalar" and e[2] == 0 and e[1][0] == "add", "zero-frame tap") + op = e[1] + require(op[1 if backward else 2] == center and op[3] in (-1, 1) and op[4] == 4, + "signed quarter coefficient") + other = op[2 if backward else 1] + require(other[0] == "L" and 112 <= other[1] < 224, "target port tap") + op[4] = 1 + insertion = ci if backward else ci + 1 + changed.insert(insertion, ["scalar", ["scale", center, 1, 4], 0]) + replacement.extend(changed) + recipes.append({"center": k, "reference_start": start + 32 * k, + "tap_count": 28, "negative_taps": sum(e[1][3] < 0 for e in taps), + "paid_child": child, "scale_frame": 0, + "scale_position": "before_child" if backward else "after_child"}) + result = copy.deepcopy(events[:start]) + replacement + copy.deepcopy(events[stop:]) + require([e for e in events if e[0] != "scalar"] == [e for e in result if e[0] != "scalar"], + "paid events or wrappers changed") + return result, recipes + + +def lower(op): + """Literal original binary-Horner lowering, one real component. + + Work is private and cleared after each add. No #696 or other pending + lowering is imported. Each yielded instruction costs one primitive. + """ + tag, target = op[0], tuple(op[1]) + if tag == "clear": + yield ("clear", target) + elif tag == "copy": + yield ("copy", target, tuple(op[2])) + elif tag == "scale": + q = Q(op[2], op[3]) + a, b = abs(q.numerator), q.denominator + require(a > 0 and a & (a - 1) == 0 and b & (b - 1) == 0, "dyadic unit scale") + for _ in range(abs(a.bit_length() - b.bit_length())): + yield ("double" if a > b else "half", target) + if q < 0: + yield ("negate", target) + else: + require(tag == "add", "unknown scalar operation") + source, q = tuple(op[2]), Q(op[3], op[4]) + require(source != target and W not in (source, target), "coefficient work alias") + a, b = abs(q.numerator), q.denominator + require(a > 0 and b & (b - 1) == 0, "nonzero dyadic addition") + yield ("clear", W) + # Leading digit is added to cleared work, exactly as priced by emitter. + bits = bin(a)[2:] + for i, bit in enumerate(bits): + if i: + yield ("double", W) + if bit == "1": + yield ("plus", W, source) + for _ in range(b.bit_length() - 1): + yield ("half", W) + yield ("plus" if q > 0 else "minus", target, W) + yield ("clear", W) + + +def cost_prefix(events): + """Triangle-inequality envelope, including Horner work, not just endpoints.""" + norms = {("L", r): Q(1) for r in range(716)} + norms.update({("C", k): Q(1) for k in range(8)}) + peak, primitives, macros = Q(1), 0, 0 + for e in events: + if e[0] != "scalar": + continue + op = e[1] + primitives += sum(1 for _ in lower(op)) + macros += 1 + tag, t = op[0], tuple(op[1]) + if tag == "clear": + norms[t] = Q(0) + elif tag == "copy": + norms[t] = norms[tuple(op[2])] + elif tag == "scale": + norms[t] *= abs(Q(op[2], op[3])) + else: + s, q = tuple(op[2]), Q(op[3], op[4]) + peak = max(peak, abs(q.numerator) * norms[s]) + norms[t] += abs(q) * norms[s] + peak = max(peak, norms[t]) + require(peak < 2 ** 192, "192-bit payload allowance") + return {"real_primitives": 2 * primitives, "scalar_macros": macros, + "prefix_l1": str(peak), "prefix_bits": peak.numerator.bit_length() - peak.denominator.bit_length() + 1} + + +def apply_primitive(rows, instruction): + tag, t = instruction[:2] + if tag == "clear": + rows[t] = {} + elif tag == "copy": + rows[t] = rows[instruction[2]].copy() + elif tag in ("double", "half", "negate"): + q = {"double": Q(2), "half": Q(1, 2), "negate": Q(-1)}[tag] + rows[t] = {j: q * x for j, x in rows[t].items()} + else: + require(tag in ("plus", "minus"), "unknown primitive") + source = instruction[2] + require(source != t, "aliased primitive") + sign = 1 if tag == "plus" else -1 + for j, x in rows[source].items(): + value = rows[t].get(j, Q(0)) + sign * x + if value: + rows[t][j] = value + else: + rows[t].pop(j, None) + + +def block_map(block): + regs = set() + for e in block: + if e[0] == "scalar": + op = e[1] + regs.add(tuple(op[1])) + if op[0] in ("copy", "add"): + regs.add(tuple(op[2])) + regs.add(W) + rows = {r: {r: Q(1)} for r in regs} + checkpoints, count = [], 0 + for e in block: + if e[0] == "center": + # Child treated as the same formal scalar interface on both sides. + # Equality of its input is checked, so the rewrite does not commute + # a scaling past an unknown recursive operation. + checkpoints.append(rows[("C", e[1])].copy()) + elif e[0] == "scalar": + for instruction in lower(e[1]): + apply_primitive(rows, instruction) + count += 1 + return rows, checkpoints, count + + +def check_block_pair(original, candidate, backward): + a, ac, ca = block_map(original) + b, bc, cb = block_map(candidate) + require(a == b, "arbitrary-input block boundary differs") + require(ac == bc, "recursive center input differs") + require(all(not row for reg, row in b.items() if reg[0] in ("C", "W")), "private output not erased") + require([e for e in original if e[0] != "scalar"] == [e for e in candidate if e[0] != "scalar"], + "paid center event differs") + require(ca - cb == 54, "complete per-component block saving") + return {"arbitrary_inputs": len(a), "reference_primitives_per_component": ca, + "candidate_primitives_per_component": cb, + "recursive_input_digest": digest([[str(j), str(x)] for j, x in sorted(bc[0].items())])} + + +def full_scalar_replay(events, backward): + """All 716 persistent and 8 private formal columns; no clean-input premise.""" + regs = [("L", r) for r in range(716)] + [("C", k) for k in range(8)] + rows = {r: {r: Q(1)} for r in regs} + for e in events: + if e[0] != "scalar": + continue + op, t = e[1], tuple(e[1][1]) + tag = op[0] + if tag == "clear": + rows[t] = {} + elif tag == "copy": + rows[t] = rows[tuple(op[2])].copy() + elif tag == "scale": + q = Q(op[2], op[3]) + rows[t] = {j: q * x for j, x in rows[t].items()} + else: + s, q = tuple(op[2]), Q(op[3], op[4]) + require(t != s, "macro alias") + for j, x in rows[s].items(): + value = rows[t].get(j, Q(0)) + q * x + if value: + rows[t][j] = value + else: + rows[t].pop(j, None) + for r in range(716): + expected = {("L", r): Q(1)} + if backward and r < 112: + expected[("L", r + 112)] = Q(-1) + elif not backward and 112 <= r < 224: + expected[("L", r - 112)] = Q(1) + require(rows[("L", r)] == expected, "full scalar boundary: " + str(r)) + require(all(not rows[("C", k)] for k in range(8)), "full private-center clearing") + return {"input_columns": 724, "persistent_outputs": 716, "private_outputs": 8, + "dirty_helpers_restored": 492} + + +def controls(reference, candidate, backward): + """Seed-selected center 3; each rejected defect has a mathematical cause.""" + start, _, blocks = center_blocks(reference) + old = blocks[3] + new = candidate[start + 33 * 3:start + 33 * 4] + rejected = [] + + def reject(label, mutate): + bad = copy.deepcopy(new) + mutate(bad) + try: + check_block_pair(old, bad, backward) + except (ValueError, KeyError): + rejected.append(label) + else: + raise ValueError("negative control accepted: " + label) + + si = next(i for i, e in enumerate(new) if e[0] == "scalar" and e[1][0] == "scale") + ti = next(i for i, e in enumerate(new) if e[0] == "scalar" and e[1][0] == "add") + reject("omitted_quarter_scale", lambda b: b.pop(si)) + reject("wrong_quarter_scale", lambda b: b[si][1].__setitem__(3, 2)) + reject("wrong_tap_sign", lambda b: b[ti][1].__setitem__(3, -b[ti][1][3])) + reject("omitted_terminal_clear", lambda b: b.pop()) + reject("omitted_paid_center", lambda b: b.pop(next(i for i, e in enumerate(b) if e[0] == "center"))) + if backward: + reject("omitted_initial_dirty_center_clear", lambda b: b.pop(0)) + # Endpoint is unchanged, but the call receives 4 times its specified input. + def after_child(b): + scale = b.pop(si) + ci = next(i for i, e in enumerate(b) if e[0] == "center") + b.insert(ci + 1, scale) + reject("scale_after_recursive_gather", after_child) + else: + reject("omitted_source_copy", lambda b: b.pop(1)) + def before_child(b): + scale = b.pop(si) + ci = next(i for i, e in enumerate(b) if e[0] == "center") + b.insert(ci, scale) + reject("scale_before_recursive_scatter", before_child) + # The final coefficient-work clear is required even when native endpoints + # have the correct values. Execute a literal dirty-work basis column. + tap = new[ti][1] + lowered = list(lower(tap)) + regs = {tuple(tap[1]), tuple(tap[2]), W} + a = {r: {r: Q(1)} for r in regs} + for op in lowered[:-1]: + apply_primitive(a, op) + require(a[W], "missing-work-clear control must leave a nonzero private row") + rejected.append("omitted_coefficient_work_clear") + return rejected + + +def run_native(canonical, programs): + """Run the pinned, unchanged frame/wrapper auditor with assertions enabled.""" + with tempfile.TemporaryDirectory(prefix="center-quarter-") as tmp: + out = Path(tmp).resolve() + require(out.is_relative_to(Path(tempfile.gettempdir()).resolve()) and out.name.startswith("center-quarter-"), + "native scratch directory must be inside the temporary root") + (out / "CANONICAL-WORD.json.gz").write_bytes(gzip.compress(json.dumps(canonical).encode(), mtime=0)) + (out / "LOCAL-PROGRAMS.json.gz").write_bytes(gzip.compress(json.dumps(programs).encode(), mtime=0)) + proc = subprocess.run([sys.executable, "-I", "-B", str(ROOT / AUDITOR), str(out)], + capture_output=True, text=True, timeout=240) + require(proc.returncode == 0, "native audit failed:\n" + proc.stdout + proc.stderr) + result = read(out / "INDEPENDENT-LOCAL-REPLAY.json") + return {"status": result["status"], "paid_profiles": result["paid_profiles"], + "local": result["local"], "negative_controls_rejected": result["negative_controls_rejected"]} + + +def price_local(canonical, programs, contract): + """Complete conservative local bound of the *literal* macro rewrite. + + The eight extra scales increase the generic adapter allowance. This is + deliberately recorded as a cost regression, not hidden behind scalar + savings. No global admission or a cheaper grouped-macro rule is assumed. + """ + children = sum(canonical["local_profile"].values()) + n = 2 * canonical["v"] + canonical["R"] + centres = len(canonical["centers"]) + m = 73 # The pinned invoice's fixed local compiler parameter. + compiler = 64 * (m + 1) ** 3 + prices = {"compiler": compiler, "children": children, "native_registers": n, "centres": centres} + for variant in ("original", "factored"): + macros = max(p[variant]["scalar_macros"] for p in programs.values()) + scalar = max(p[variant]["real_primitives"] for p in programs.values()) + adapters = 16 * (macros + children + n + centres) + 64 * m + prices[variant] = {"scalar_worst_orientation": scalar, "macro_bound": macros, + "local_adapters": adapters, "local_primitive_bound": scalar + adapters * compiler} + for key in ("compiler", "children"): + require(prices[key] == contract[key], "original complete contract: " + key) + for key in ("local_adapters", "local_primitive_bound"): + require(prices["original"][key] == contract[key], "original local invoice: " + key) + prices["adapter_allowance_increase"] = prices["factored"]["local_adapters"] - prices["original"]["local_adapters"] + prices["bound_increase"] = prices["factored"]["local_primitive_bound"] - prices["original"]["local_primitive_bound"] + require(prices["adapter_allowance_increase"] == 128 and prices["bound_increase"] == 3319594144, + "extra-macro cost must be charged") + require(prices["factored"]["local_primitive_bound"] < 2**48, "inherited local bound cap") + prices["scope"] = "Scalar circuit improves; literal generic local invoice worsens; no global invoice or kappa gain." + return prices + + +def verify(): + spec = check_sources() + result = {"status": "PASS_COMPLEX_CENTER_QUARTER", "base_commit": BASE, + "assignment_seed": 35, "kappa": "unchanged", "providers": {}} + for name in PROVIDERS: + directory = ROOT / REPLAY / name + canonical = read(directory / "CANONICAL-WORD.json.gz") + programs = read(directory / "LOCAL-PROGRAMS.json.gz") + local_checks = read(directory / "LOCAL-CHECKS.json") + inherited = read(directory / "INDEPENDENT-LOCAL-REPLAY.json") + changed, outputs = {}, {} + for direction in ("forward", "backward"): + events = programs[direction] + backward = direction == "backward" + modified, recipes = transform(events, backward) + start, _, blocks = center_blocks(events) + block_checks = [check_block_pair(old, modified[start + 33*k:start + 33*(k+1)], backward) + for k, old in enumerate(blocks)] + before, after = cost_prefix(events), cost_prefix(modified) + require(before["real_primitives"] == local_checks[direction]["real_component_primitive_bound"], + "reference cost binding") + require(before["prefix_l1"] == inherited["local"][direction]["prefix_l1_upper"], "reference prefix binding") + require(before["prefix_l1"] == after["prefix_l1"], "prefix envelope changed") + require(before["real_primitives"] - after["real_primitives"] == 864, "complete saving") + require(before["scalar_macros"] + 8 == after["scalar_macros"], "eight charged scales") + full_scalar_replay(events, backward) + scalar_check = full_scalar_replay(modified, backward) + changed[direction] = modified + outputs[direction] = {"original": before, "factored": after, "saved_real_primitives": 864, + "program_sha256": digest(modified), "recipes": recipes, + "blocks": block_checks, "full_scalar_replay": scalar_check, + "controls": controls(events, modified, backward)} + native = run_native(canonical, changed) + for direction in changed: + require(native["paid_profiles"][direction] == spec["providers"][name]["expected_profile"], "paid profile") + require(native["local"][direction]["prefix_l1_upper"] == outputs[direction]["factored"]["prefix_l1"], + "native prefix agreement") + local_price = price_local(canonical, outputs, spec["providers"][name]["complete_contract"]) + result["providers"][name] = {"programs": outputs, "native": native, "complete_local_price": local_price} + print("verified", name, "forward/backward: saving 864 each; native frames/wrappers pass", flush=True) + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write-receipt", type=Path, help="create a new receipt; refuses to overwrite") + args = parser.parse_args() + if args.write_receipt: + require(not args.write_receipt.exists(), "receipt output already exists") + result = verify() + if args.write_receipt: + with args.write_receipt.open("x", encoding="utf-8", newline="\n") as stream: + json.dump(result, stream, indent=2) + stream.write("\n") + else: + require(result == read(HERE / "EXPECTED.json"), "receipt mismatch") + print("PASS_COMPLEX_CENTER_QUARTER programs=4 centers=32 saving=864_each columns=724 controls=32+50 invoice_delta=+3319594144 kappa=unchanged") + + +if __name__ == "__main__": + try: + main() + except (ValueError, KeyError) as error: + raise SystemExit("FAIL: " + str(error)) from error From c6ae38d9f5a13c53dab623fd6947f08d92173287 Mon Sep 17 00:00:00 2001 From: stan Date: Mon, 12 Oct 2026 22:33:55 -0700 Subject: [PATCH 2/2] Record sprint result, overlap and PR handoff --- research/complex-center-quarter/CLAIM.md | 26 ++++++++++++++++++- research/complex-center-quarter/VALIDATION.md | 5 ++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/research/complex-center-quarter/CLAIM.md b/research/complex-center-quarter/CLAIM.md index 0500e44ad3..782016efd8 100644 --- a/research/complex-center-quarter/CLAIM.md +++ b/research/complex-center-quarter/CLAIM.md @@ -49,4 +49,28 @@ paid center stream. This experiment changes no copied-information rank cost. ## Result -Pending bounded experiment and final overlap refresh. +Completed 2026-10-13 05:33 UTC (2026-10-12 22:33 America/Los_Angeles). +Submitted as [PR #786](https://github.com/CrocSwap/integer-mult-bounds/pull/786). + +All eight centers of both selected providers in both orientations are covered. +Factoring the quarter saves 864 real scalar primitives per program. The complete +local accounting exposed a limitation: eight new scale macros add 128 generic +adapter allowances, increasing each conservative local bound by 3,319,594,144. +The experiment stops at this finite circuit construction and scoped cost audit; +there is no net supplier-cost or kappa improvement claim. + +The complete original/candidate scalar boundaries pass on 724 arbitrary inputs. +All 32 primitive block pairs, 32 new rejection controls, 50 inherited native +controls, 57,600 independent integer-matrix entries, 32 clear omissions and five +focused failure tests pass. Source/receipt corruption, portable minimal-checkout +and gzip-repackaging controls also pass. See VALIDATION.md for execution limits. + +Final overlap refresh: 602 open PRs through #783. Main still equals the exact +base. Concurrent #755 (`a1dd9f819102c40e0b5e4a75215cf69ee864f480`) is credited +for forward JP8 center coefficient reuse. This adds reverse gathering, CK +coverage, recursive-input equality and the extra-macro accounting limit while +retaining per-addition work clearing; no priority or stronger saving is claimed +for the shared forward taps. #769 concerns CK cleanup/preconditioning and #776 +fixed-order A/B frames. Neither overlaps the changed center circuit. No pending +source was imported. No pinned coordination issue was found, so this is the +single local claim/result update. diff --git a/research/complex-center-quarter/VALIDATION.md b/research/complex-center-quarter/VALIDATION.md index 25b65f8075..c266089d7c 100644 --- a/research/complex-center-quarter/VALIDATION.md +++ b/research/complex-center-quarter/VALIDATION.md @@ -49,8 +49,9 @@ repacked with a different gzip timestamp and compression level; the replay and integer checker still pass. In that disposable checkout, changing a canonical-word payload is rejected by -the source pin. Changing the expected cost is rejected by complete receipt -comparison. The explicit receipt-output mode rejects an existing file and +the source pin. A later check also rejects an altered pinned invoice source and +a receipt that omits the 128 new adapter allowances. Changing the expected cost +is rejected by complete receipt comparison. The explicit receipt-output mode rejects an existing file and preserves its bytes. Before/after SHA-256 snapshots confirm that the primary command leaves package inputs unchanged. Scratch directories are confined to the system temporary root and removed after use.