From 84dafd984f41e9832ac7ab249e0b694ca4860234 Mon Sep 17 00:00:00 2001 From: d3lerium Date: Fri, 23 Oct 2026 08:41:19 +1100 Subject: [PATCH 1/2] Audit complete block cascade conditioning and schedule admission --- .../HANDOFF.md | 13 + .../ORIGINS.json | 47 ++ .../PROOF.md | 43 ++ .../README.md | 40 ++ .../RESULT.json | 98 ++++ .../SOURCES.json | 18 + .../TASK.json | 72 +++ .../VERIFY.json | 36 ++ .../inputs/pr4813-verify_schedule.py | 499 ++++++++++++++++++ .../inputs/pr4818-verify_schedule.py | 447 ++++++++++++++++ .../inputs/pr4819-verify_schedule.py | 454 ++++++++++++++++ .../inputs/pr4826-verify_ports.py | 207 ++++++++ .../inputs/pr4826-verify_schedule.py | 319 +++++++++++ .../verify.py | 125 +++++ 14 files changed, 2418 insertions(+) create mode 100644 research/complex-block-schedule-admission-audit/HANDOFF.md create mode 100644 research/complex-block-schedule-admission-audit/ORIGINS.json create mode 100644 research/complex-block-schedule-admission-audit/PROOF.md create mode 100644 research/complex-block-schedule-admission-audit/README.md create mode 100644 research/complex-block-schedule-admission-audit/RESULT.json create mode 100644 research/complex-block-schedule-admission-audit/SOURCES.json create mode 100644 research/complex-block-schedule-admission-audit/TASK.json create mode 100644 research/complex-block-schedule-admission-audit/VERIFY.json create mode 100644 research/complex-block-schedule-admission-audit/inputs/pr4813-verify_schedule.py create mode 100644 research/complex-block-schedule-admission-audit/inputs/pr4818-verify_schedule.py create mode 100644 research/complex-block-schedule-admission-audit/inputs/pr4819-verify_schedule.py create mode 100644 research/complex-block-schedule-admission-audit/inputs/pr4826-verify_ports.py create mode 100644 research/complex-block-schedule-admission-audit/inputs/pr4826-verify_schedule.py create mode 100644 research/complex-block-schedule-admission-audit/verify.py diff --git a/research/complex-block-schedule-admission-audit/HANDOFF.md b/research/complex-block-schedule-admission-audit/HANDOFF.md new file mode 100644 index 0000000000..c14439ced7 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/HANDOFF.md @@ -0,0 +1,13 @@ +# Handoff: actual shared-register realization before κ accounting + +Status: exact finite endpoint conditioning correction and one sector misuse witness complete locally; publication coordinated by parent. No new κ. + +The most promising distinct constructive test is #4813's first two overlapping native ports, because its local two-/three-call operators come from the documented #4743 interface. Compose those two ports on the actual current five-bank state, track every independent original input, and compare with the alleged observations. Either emit the necessary preservation/restoration work and price it, or exhibit the first failed bank substitution. Do not repeat the full rank solve on ideal observations. For #4826 a genuine three-call port is an earlier missing gate; its valid residual identity alone uses a two-call prefix plus a three-call operator. + +Keep the source heads in ORIGINS.json frozen; refresh new PRs and discussions before taking this handoff. Reuse #4828's distinct two-bank conditioning theorem where applicable, and this package's full-cascade factor3 only on its stated model. A successful physical word must supply its raw inverse transpose, disjoint productive census and complete bill. A favourable caller moment and funded κ then remain separate milestones. + +Proposed public footer after replacing artifact with the publication URL: + +```json +{"schema":"integer-mult-coordination/v1","kind":"HANDOFF","task":"complex-rank-shape-decoder","scope":"Emit first two overlapping native ports of frozen PR4813 on actual shared banks, with all preservation and restoration priced","base":"624de9dc66858af0945e5f8a0942488d62280d43","expiry":null,"artifact":null} +``` diff --git a/research/complex-block-schedule-admission-audit/ORIGINS.json b/research/complex-block-schedule-admission-audit/ORIGINS.json new file mode 100644 index 0000000000..31bcd0e39b --- /dev/null +++ b/research/complex-block-schedule-admission-audit/ORIGINS.json @@ -0,0 +1,47 @@ +[ + { + "pr": 4813, + "head": "f982ecc06826e7087e69b9468d3ff52589fd0822", + "source_path": "research/complex-block3-five-in-fourteen/verify_schedule.py", + "path": "inputs/pr4813-verify_schedule.py", + "sha256": "6216fd67f1a762303f0eed0e37b90ea0c72cf8e0cb7db70b1b27b2001ac20069", + "git_blob": "17a8439633effba74fff63a8fe4c332b8d709d80", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/f982ecc06826e7087e69b9468d3ff52589fd0822/research/complex-block3-five-in-fourteen/verify_schedule.py" + }, + { + "pr": 4818, + "head": "fd29d065bbe12f5be5af02fdf5a8b4d86dda3381", + "source_path": "research/complex-block4-three-in-ten/verify_schedule.py", + "path": "inputs/pr4818-verify_schedule.py", + "sha256": "7fab42730ebb5e1cd88dc369df526a002e91a70dc99cdbf4a7c0133fefa7e33d", + "git_blob": "8f9a2ef3cdba4c83be7a4d931c1070fef73ba896", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/fd29d065bbe12f5be5af02fdf5a8b4d86dda3381/research/complex-block4-three-in-ten/verify_schedule.py" + }, + { + "pr": 4819, + "head": "a7b42c2f8ffe5a18d305ca4dda5729d2f1d72ea8", + "source_path": "research/complex-block4-thirteen-in-fortyone/verify_schedule.py", + "path": "inputs/pr4819-verify_schedule.py", + "sha256": "4ddb2d11a4da6a05db3f06a400bd74059ce1448142df028e82a09d50eca06567", + "git_blob": "e22dd9afd88837705cba14195f6c9acb4a97c6e7", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/a7b42c2f8ffe5a18d305ca4dda5729d2f1d72ea8/research/complex-block4-thirteen-in-fortyone/verify_schedule.py" + }, + { + "pr": 4826, + "head": "d7b53d3992e658f0dd49d0207ba33bbc39272bac", + "source_path": "research/complex-block5-three-in-nine/verify_schedule.py", + "path": "inputs/pr4826-verify_schedule.py", + "sha256": "de0256a33d4007615b8dc0ab4c45ce3582bfb2cf963b499f84b0362935c96c4e", + "git_blob": "ea1511ae49f4e9b9d58033d7d69056227bf4b53f", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/d7b53d3992e658f0dd49d0207ba33bbc39272bac/research/complex-block5-three-in-nine/verify_schedule.py" + }, + { + "pr": 4826, + "head": "d7b53d3992e658f0dd49d0207ba33bbc39272bac", + "source_path": "research/complex-block5-three-in-nine/verify_ports.py", + "path": "inputs/pr4826-verify_ports.py", + "sha256": "bd874188e6d32cb692a345186c563e8f23d92918871ac2780a3b3502dda79a86", + "git_blob": "a455b4d5466614de2c528996b523fd0bb6b3bc90", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/d7b53d3992e658f0dd49d0207ba33bbc39272bac/research/complex-block5-three-in-nine/verify_ports.py" + } +] diff --git a/research/complex-block-schedule-admission-audit/PROOF.md b/research/complex-block-schedule-admission-audit/PROOF.md new file mode 100644 index 0000000000..587ba1b667 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/PROOF.md @@ -0,0 +1,43 @@ +# Exact scope and mathematical checks + +## 1. A sharp bound for the literal full cascade + +Let V=(C^n)^W, and let X_s be the address permutation x -> x xor s. In each of the three source models, + + M = I + U/2, (Uz)_k = X_(s_k) z_((k+1) mod W). + +The source shift lists are (1,2,4) for W=3,n=16 and W=3,n=32, and (1,2,...,13) for W=13,n=16. U is a permutation, hence unitary. The triangle and reverse triangle inequalities give + + ||Mz|| <= (3/2)||z||, ||Mz|| >= (1/2)||z||. + +Thus M is invertible, ||M||<=3/2, ||M^-1||<=2 and cond_2(M)<=3. This is an endpoint norm ceiling, **not** a paid-call or κ ceiling. + +Both inequalities are attained. The all-ones vector has Uv=v. For the lower extreme, take the address character h(x)=(-1)^(x_0) and block signs a_0=1, a_(k+1)=-(-1)^(s_k bit0) a_k. Because W is odd and the xor of all shifts has bit zero set (7,1,7 in the three cases), this recurrence closes around the cycle. Then z_k=a_k h satisfies Uz=-z. Hence Mv=(3/2)v and Mz=(1/2)z. Exact norms are 3/2 and inverse norm2, so the sharp condition number is3. + +For both three-cycles the low signs are (1,1,-1). For the thirteen-cycle they are (1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1). These are literal integer witnesses on the actual finite address spaces; RESULT.json records them. The checker verifies the permutation bijection and both eigenvector equations independently, after comparing every source coupler to the specified permutation matrix. It also compares every entry of #4826's actually assembled 96-square M. + +The small loop norm 2^-W controls a Schur complement I +/- (product G_k) after elimination. Elimination/back substitution also acts on the full vector; its norms cannot be discarded. Therefore (1+2^-W)/(1-2^-W) is not a valid bound for cond(M). This refutes9/7 and8193/8191 as **full-cascade** bounds while preserving invertibility and the weaker bound16. No condition claim is made here for #4813's different observation model or for the overdetermined O_full matrices. + +## 2. Explicit block-3 sector misuse witness + +Use the exact operators in #4813 `verify_schedule.py:198-235`. They satisfy + + B = M0 C2 + 2 K a, H K a = K/2. + +For a plus-swap-sector input, C2 x = T A x; thus H(B-M0 T A)x=Kx. This implication requires Tx=x. For arbitrary input e_1, exact evaluation instead gives + + [H(B-M0 T A)-K]_(0,1) = -(1+i)/4. + +The checker also verifies Te_1 != e_1. This is a counterexample to applying that fixed plus-sector rule to all inputs. It is **not** a disproof of sector splitting with its copies, recombination, calls and storage charged, nor of another all-input decoder. #4813's test suite supplies known sector signs and forms ideal Kx+Ex observations directly. It does not emit a full shared-bank word that maintains those independent original inputs across overlapping ports. Dense Gaussian elimination followed by K on the recovered x is an algebraic recovery check; its operation price needs a separate admissible realization. + +## 3. Positive block-5 check and remaining realization boundary + +#4826's `verify_ports.py:149-168` defines F=C0(P+2Q)C0 and J=C4 C3 C2 N. It computes R=JF-2K but supplies no assertion that R has the claimed form M0 C4 C3 C2. This audit computes + + M0 = R (C4 C3 C2)^*, + +checks one nonzero in every row and column, and checks M0(C4 C3 C2)=R exactly. This finite identity succeeds and should be retained. The test does not establish an all-width tensor identity or make the three calls in J include the two calls already needed for F. + +The schedule constructor (`verify_schedule.py:155-216`) sets K=C4C3C2C1C0, picks G_k=X_(2^k)/2, sets E_k=KG_k, and inserts K,E_k into O_primary. The count s=9 is assigned independently. Full rank and exact recovery show that these **postulated observations** determine targets. They do not demonstrate three paid calls per port, ownership-safe chronological composition, a true raw inverse transpose, or priced physical implementation. #4818 and #4819 use the same distinction between assigned call counts and assembled target-containing observations. No universal impossibility of their call shapes is inferred. + +The source tests also do not discharge arbitrary tensor width, field/phase lifting, control/movement/storage, finite precision at internal cuts, complete recursive profile, compiler reserve or outer transfer. The printed unit exponent formula cannot be imported as a complete integer multiplication κ until those obligations are bound to a real word. Passing a lower-bound capacity inequality only removes one necessary obstruction; it does not synthesize the word. diff --git a/research/complex-block-schedule-admission-audit/README.md b/research/complex-block-schedule-admission-audit/README.md new file mode 100644 index 0000000000..d997446424 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/README.md @@ -0,0 +1,40 @@ +# Complete block cascade conditioning and admission audit + +The literal cyclic matrices in hexapode's #4818, #4819 and #4826 have exact Euclidean condition number **3**, with norm **3/2** and inverse norm **2**. Their stated bounds 9/7, 8193/8191 and 9/7 respectively apply to loop closure factors, not the whole cascade. The corrected bound is still below 16; this finding does **not** make the observation systems singular or prove their proposed call counts impossible. + +A second exact check exhibits the arbitrary-input failure of applying #4813's plus-swap-sector cancellation to a general bank. On input e_1 the output-coordinate-zero error is -(1+i)/4. A third check positively confirms #4826's residual identity at the literal 32-coordinate width, although its verifier computes the residual without asserting its monomial factorization. This preserves a valid algebraic starting point. + +No new exponent saving is established. A rank computation on an observation matrix containing K does not produce a chronological paid-call realization of that matrix. The proposed complete unit still needs that realization, an all-input owner inventory, raw inverse transpose, all-width justification, finite work/precision bills, and compiler/outer transfer. See [PROOF.md](PROOF.md) and [HANDOFF.md](HANDOFF.md). + +## Source and overlap scope + +Canonical base: `624de9dc66858af0945e5f8a0942488d62280d43`, priority revision 7. Exact audited heads: + +| PR | Head | Coverage | +|---|---|---| +| #4813 | `f982ecc06826e7087e69b9468d3ff52589fd0822` | Native block-3 operators, sector misuse witness, assembly/accounting boundary | +| #4818 | `fd29d065bbe12f5be5af02fdf5a8b4d86dda3381` | Literal 48-square cyclic model and claimed bound | +| #4819 | `a7b42c2f8ffe5a18d305ca4dda5729d2f1d72ea8` | Literal 208-square cyclic model and claimed bound | +| #4826 | `d7b53d3992e658f0dd49d0207ba33bbc39272bac` | Literal 96-square cyclic model, residual identity, assembly/accounting boundary | + +Five unchanged Python source files are retained in `inputs/`; their original paths, immutable URLs, Git blob IDs and SHA256 hashes are in ORIGINS.json. They are self-contained retained inputs, not dependencies on unmerged Git objects. SOURCES.json binds the task/selected provenance at canonical base. The verifier authenticates retained inputs before loading any code. It uses source matrix constructors plus an independent permutation-cycle action and exact integer/rational witnesses; it does not claim a wholly independent reconstruction of every source Clifford primitive. + +Bounded live GitHub PR-body queries for `4826`, `4819 audit`, `4818 audit`, `4813 audit`, and `"condition" "cascade"` found these proposals and neighbouring #4828/#4835. All four proposal comment timelines were empty at inspection. #4828 (`299b6092a3a4f6c617dd509cda2d590932d8be1e`) proves sharp conditioning for #4743's **two-bank port** and explicitly excludes complete-cascade conditioning. #4835 concerns the address-algebra finite-test kernel. Neither is reproduced here. Unpublished work, exhaustive discussion coverage and novelty are not established; refresh these heads before publication. Root agents coordinate the ongoing Discussion/handoff check. + +## Reproduction + +```sh +python3 -I -B research/complex-block-schedule-admission-audit/verify.py +python3 -I -O -B research/complex-block-schedule-admission-audit/verify.py +python3 -B scripts/research_package.py --package research/complex-block-schedule-admission-audit +``` + +Expected: `PASS_COMPLEX_BLOCK_SCHEDULE_ADMISSION_AUDIT`. RESULT.json records exact witnesses. `--write-result` explicitly regenerates that receipt. Ordinary checks are read-only. Checks stay active under optimized Python. The predecessor constructors contain assertions; this audit's independent comparison and rejection predicates use explicit exceptions. No original complete native suite, Lean, full phase proof, compiler, hosted CI or independent human review is claimed. + +## Open next questions + +1. Emit one actual shared-register chronological word for #4813's five banks, starting with the first two overlapping ports. Identify which input to port two is still the original bank and charge every preservation/restoration operation. This is the smallest discriminating test of the alleged 14-call schedule. +2. For #4826, emit one actual three-call two-bank primitive realizing the stated rank-five K block, including dirty companion output, or replace the claimed interface. Dense insertion of K into an observation matrix is not that witness. +3. If a whole word is obtained, derive the full norm/rounding bill using the corrected factor 3 and all internal cuts, then price the complete recursive caller. Endpoint conditioning alone cannot fund a κ improvement. + +Prepared for Chris R / Clear1nsight with substantial OpenAI Codex assistance. Apache-2.0. Credit hexapode for the audited packages; Dugongue #4743, Yiyang / Lyy-iiis #4710, lee-phys #4688 and Jacob Alan Sussman #4628 for their predecessor construction/bound work, retained by citation. Nick Petalas #4828 distinguishes the earlier complete-port conditioning problem. The permutation-cycle norm proof is elementary; no claim of a new general spectral method is made. diff --git a/research/complex-block-schedule-admission-audit/RESULT.json b/research/complex-block-schedule-admission-audit/RESULT.json new file mode 100644 index 0000000000..dde81ac35e --- /dev/null +++ b/research/complex-block-schedule-admission-audit/RESULT.json @@ -0,0 +1,98 @@ +{ + "block3_plus_sector_misuse": { + "difference": [ + "-1/4", + "-1/4" + ], + "input_basis_column": 1, + "row": 0 + }, + "block5_residual_identity": "finite width-one confirmed", + "cascade_condition": { + "4818": { + "character_bit": 1, + "condition_number": "3", + "dimension": 48, + "inverse_norm_squared": "4", + "low_block_signs": [ + 1, + 1, + -1 + ], + "norm_squared": "9/4", + "rejected_bound": "9/7", + "shifts": [ + 1, + 2, + 4 + ], + "xor": 7 + }, + "4819": { + "character_bit": 1, + "condition_number": "3", + "dimension": 208, + "inverse_norm_squared": "4", + "low_block_signs": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 1 + ], + "norm_squared": "9/4", + "rejected_bound": "8193/8191", + "shifts": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "xor": 1 + }, + "4826": { + "character_bit": 1, + "condition_number": "3", + "dimension": 96, + "inverse_norm_squared": "4", + "low_block_signs": [ + 1, + 1, + -1 + ], + "norm_squared": "9/4", + "rejected_bound": "9/7", + "shifts": [ + 1, + 2, + 4 + ], + "xor": 7 + } + }, + "controls": [ + "false cascade bound rejected", + "wrong extremal vector rejected", + "source hashes checked" + ], + "new_kappa": false, + "scope": "finite literal matrices plus written permutation-cycle norm proof; no call optimum or complete multiplier", + "status": "PASS_COMPLEX_BLOCK_SCHEDULE_ADMISSION_AUDIT" +} diff --git a/research/complex-block-schedule-admission-audit/SOURCES.json b/research/complex-block-schedule-admission-audit/SOURCES.json new file mode 100644 index 0000000000..80f74a60e2 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "624de9dc66858af0945e5f8a0942488d62280d43", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395", + "sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + } + ] +} diff --git a/research/complex-block-schedule-admission-audit/TASK.json b/research/complex-block-schedule-admission-audit/TASK.json new file mode 100644 index 0000000000..546854a093 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/TASK.json @@ -0,0 +1,72 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 7, + "base_commit": "624de9dc66858af0945e5f8a0942488d62280d43", + "original_card": { + "id": "complex-rank-shape-decoder", + "question": "Can a decoder deliver the local paid mass in fewer, larger-rank children (block frame climbs instead of rank-1 to rank-3 steps)?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/complex-decoder-field-extension-seed44/README.md", + "research/complex-frame-pair-decoders/README.md", + "research/selected-k8-unrestricted-ends/README.md", + "research/eisenstein-reduction-copy-floor/README.md" + ], + "methods": [ + "Find one exact small decoding identity whose frame path climbs in blocks, and price its complete per-call profile.", + "Bound the best effective child rank achievable for one fixed support alphabet, including copies, frames and restoration." + ], + "acceptance_gate": "A per-call local profile, with all copied information, frames and restoration counted, whose ceiling exceeds the selected word's by at least 5%; masked or overcomplete supports must change an assumption of the eight-term all-pairs bound. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin. Ideal budget: rank-16 delivery is 2.31x (levers.py).", + "bottleneck_link": "Rank-1 children are about half of recursive cost; the selected word's effective child rank is about 3.9. Larger-rank delivery lowers recursive cost per unit of paid mass.", + "allowed_variations": [ + "One masked, overcomplete or block decoder family with exact labels and supports.", + "A scoped lower bound on effective rank for one alphabet.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Repacking idle remainders of an unchanged word (covered by the packing ceiling).", + "Repeating the eight-term all-pairs search inside its proved scope.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "Searching below C=40 in the #2017 Eisenstein binary scalar-rectangle or fixed-support block-linear additive pairing model; specify a changed premise instead. This bound does not cover every complex decoder.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "rank shape", + "block climb", + "masked decoder", + "overcomplete", + "effective rank" + ] + }, + "scope_status": "changed", + "actual_scope": "Exact full-cascade conditioning and admission audit of PR4813,4818,4819,4826", + "scope_change_reason": "Assigned independent audit of new changed-construction claims before frontier work; distinguish postulated observations from paid realization.", + "bottleneck_link": "Reject unsupported admission while retaining valid component algebra and a constructive shared-bank handoff.", + "budget_minutes": 60, + "stop_rule": "Stop after exact source-bound counterexamples and a priced-realization obligation map; do not reproduce dense target solves as a contribution.", + "outcome": "negative-result", + "evidence": "PROOF.md; RESULT.json; five hash-bound literal source files; exact extremal vectors and non-sector witness.", + "author": "Chris R / Clear1nsight", + "ai_assistance": "Substantial OpenAI Codex assistance.", + "open_questions": [ + { + "question": "Can the first two overlapping PR4813 ports be composed on actual shared banks at their claimed cost?", + "why_it_matters": "The existence of local invertible ports and ideal target observations does not establish a complete paid word.", + "first_step": "Emit the chronological two-port word with independent input ownership and every restoration call.", + "blocked_by": "No shared-bank chronological witness in audited source." + } + ] +} diff --git a/research/complex-block-schedule-admission-audit/VERIFY.json b/research/complex-block-schedule-admission-audit/VERIFY.json new file mode 100644 index 0000000000..b399625beb --- /dev/null +++ b/research/complex-block-schedule-admission-audit/VERIFY.json @@ -0,0 +1,36 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/complex-block-schedule-admission-audit/inputs/pr4813-verify_schedule.py", + "research/complex-block-schedule-admission-audit/inputs/pr4818-verify_schedule.py", + "research/complex-block-schedule-admission-audit/inputs/pr4819-verify_schedule.py", + "research/complex-block-schedule-admission-audit/inputs/pr4826-verify_schedule.py", + "research/complex-block-schedule-admission-audit/inputs/pr4826-verify_ports.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact source-bound condition3 witnesses, finite residual positive check, non-sector counterexample and rejection predicates" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Same scientific predicates remain active under optimized Python" + } + ] +} diff --git a/research/complex-block-schedule-admission-audit/inputs/pr4813-verify_schedule.py b/research/complex-block-schedule-admission-audit/inputs/pr4813-verify_schedule.py new file mode 100644 index 0000000000..17a8439633 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/inputs/pr4813-verify_schedule.py @@ -0,0 +1,499 @@ +#!/usr/bin/env python3 +"""Algebraic Verification of the 5-in-14 Block-3 Unit Schedule. + +Synthesizes: + 1. Finite Geometry of Sp_6(F_2): 14 rank-one Lagrangian neighbors partition + under the 768-element stabilizer into orbits of sizes [1, 1, 12] (PR #4743). + 2. Full-Input Native Ports (PR #4743): + - Two-call port U_2 = [[A, 0], [F, A]] (2 paid calls, condition number <= 16). + - Three-call port U_3 = [[A, 0], [B, D]] (3 paid calls, condition number <= 16). + - Residual identity B = D L A = M C_2 + 2 K a. + 3. Swap-Sector Completion: + - On T x_i = sigma_i x_i: u_i - sigma_i M T t_i = D x_{i+1} + 2 K a x_i. + - Scaling by H = (1/2) out_pauli^dagger yields v_i = K x_i + E x_{i+1}. + - Coupler G = K^-1 E satisfies G^dagger G = (1/4) I, ||G|| = 1/2. + 4. 5-Array Chaining Schedule in 14 Calls: + - 4 Three-Call Ports on (x1,x2), (x2,x3), (x3,x4), (x4,x5) -> 12 calls (orbit 12). + - 1 Two-Call Port on (x5,x1) -> 2 calls (the two size-1 orbits). + - Total paid calls = 4 * 3 + 2 = 14 calls (ZERO SLACK). + 5. Recovery of All 5 Canonical Targets K x_1, ..., K x_5: + - Proves exact solvability of the 5-array linear system over Q(i). + - Verifies reconstruction on both swap sectors and arbitrary combinations. + +Standard library only (fractions, itertools, json). Exact Q(i) arithmetic. +""" + +from __future__ import annotations +import json +import time +from fractions import Fraction +from itertools import product + + +# ============================================================================== +# SECTION 1: Exact Gaussian Rational Arithmetic +# ============================================================================== + +def q(real=0, imag=0): + return (Fraction(real), Fraction(imag)) + +ZERO, ONE, I = q(), q(1), q(0, 1) +I_POWERS = (ONE, I, q(-1), q(0, -1)) + +def add(x, y): return (x[0] + y[0], x[1] + y[1]) +def sub(x, y): return (x[0] - y[0], x[1] - y[1]) +def mul(x, y): return (x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]) + +def div(x, y): + denom = y[0] ** 2 + y[1] ** 2 + if denom == 0: + raise ZeroDivisionError("division by zero in Q(i)") + return ((x[0] * y[0] + x[1] * y[1]) / denom, (x[1] * y[0] - x[0] * y[1]) / denom) + +def scale(c, a): + return tuple(tuple(mul(c, v) for v in row) for row in a) + +def plus(a, b): + return tuple(tuple(add(x, y) for x, y in zip(ar, br)) for ar, br in zip(a, b)) + +def mm(a, b): + n = len(a) + p = len(b[0]) + k_dim = len(b) + out = [[ZERO for _ in range(p)] for _ in range(n)] + for r in range(n): + for k in range(k_dim): + if a[r][k] == ZERO: + continue + for c in range(p): + if b[k][c] != ZERO: + out[r][c] = add(out[r][c], mul(a[r][k], b[k][c])) + return tuple(tuple(row) for row in out) + +def mv(mat, vec): + n = len(mat) + k_dim = len(vec) + out = [ZERO for _ in range(n)] + for r in range(n): + for k in range(k_dim): + if mat[r][k] != ZERO and vec[k] != ZERO: + out[r] = add(out[r], mul(mat[r][k], vec[k])) + return tuple(out) + +def ident(n=8): + return tuple(tuple(ONE if r == c else ZERO for c in range(n)) for r in range(n)) + +def adjoint(a): + return tuple(tuple((a[c][r][0], -a[c][r][1]) for c in range(len(a))) for r in range(len(a[0]))) + +def monomial(permutation, phases=None): + if phases is None: + phases = [0] * len(permutation) + n = len(permutation) + return tuple( + tuple(I_POWERS[phases[c] % 4] if r == permutation[c] else ZERO for c in range(n)) + for r in range(n) + ) + +def pauli(x, z): + return monomial( + [j ^ x for j in range(8)], + [(x & z).bit_count() + 2 * (j & z).bit_count() for j in range(8)] + ) + +def c_letter(bit): + return plus( + scale(q(Fraction(1, 2), Fraction(1, 2)), ident()), + scale(q(Fraction(1, 2), Fraction(-1, 2)), pauli(1 << bit, 0)) + ) + +def s_letter(mask): + return monomial(list(range(8)), [(j & mask).bit_count() for j in range(8)]) + +def word(*letters): + out = ident(len(letters[0])) + for letter in letters: + out = mm(out, letter) + return out + + +# ============================================================================== +# SECTION 2: Finite Geometry in Sp_6(F_2) (PR #4743) +# ============================================================================== + +def lin(cols, v): + s = 0 + for i, c in enumerate(cols): + if (v >> i) & 1: + s ^= c + return s + +def rank_f2(vs): + piv = {} + for v in vs: + while v: + k = v.bit_length() - 1 + if k in piv: + v ^= piv[k] + else: + piv[k] = v + break + return len(piv) + +def space_f2(vs): + return tuple(sorted({lin(vs, k) for k in range(1 << len(vs))})) + +def verify_finite_geometry(): + gl = [a for a in product(range(1, 8), repeat=3) if rank_f2(a) == 3] + base = space_f2((9, 16, 32)) + hs = [] + stab = [] + neighbors = set() + + for a in gl: + inv = [next(x for x in range(8) if lin(a, x) == 1 << i) for i in range(3)] + it = [sum(((inv[j] >> i) & 1) << j for j in range(3)) for i in range(3)] + for mask in range(64): + q_vec = [((mask >> i) & 1) << i for i in range(3)] + for z, (i, j) in enumerate([(0, 1), (0, 2), (1, 2)], 3): + if (mask >> z) & 1: + q_vec[i] ^= 1 << j + q_vec[j] ^= 1 << i + def h(v): + x = v & 7 + z = v >> 3 + return lin(a, x) | (lin(it, z ^ lin(q_vec, x)) << 3) + cols = tuple(h(1 << j) for j in range(6)) + hs.append(cols) + sub = space_f2(tuple(lin(cols, z) for z in (9, 16, 32))) + neighbors.add(sub) + if sub == base: + stab.append(cols) + + unseen = set(neighbors) + orbits = [] + while unseen: + s = next(iter(unseen)) + orb = {tuple(sorted(lin(h_col, v) for v in s)) for h_col in stab} + unseen -= orb + orbits.append(len(orb)) + + orbit_profile = sorted(orbits) + assert len(neighbors) == 14, "Lagrangian neighbors count must be 14" + assert len(stab) == 768, "Common stabilizer order must be 768" + assert orbit_profile == [1, 1, 12], "Stabilizer orbits must partition into [1, 1, 12]" + return { + "GL3_order": len(gl), + "symplectic_group_order": len(hs), + "rank_one_neighbors": len(neighbors), + "stabilizer_order": len(stab), + "stabilizer_orbits": orbit_profile, + } + + +# ============================================================================== +# SECTION 3: Operators & Full-Input Triangular Ports (PR #4743) +# ============================================================================== + +def load_operators(): + I_8 = ident(8) + C0, C1, C2 = (c_letter(j) for j in range(3)) + U = monomial([0, 5, 2, 7, 4, 1, 6, 3]) + V = monomial([0, 2, 1, 3, 4, 6, 5, 7]) + S = s_letter(7) + + P = word(S, U, S) + Q = word(S, V, S) + L = plus(P, scale(q(2), Q)) + + K = word(C0, C1, C2) + a = pauli(1, 3) # Y0 Z1 + W = pauli(0, 5) # Z0 Z2 + J = word(pauli(0, 2), V, C2) # Z1 V01 C2 (1 paid call) + M = monomial([2, 0, 3, 1, 4, 6, 5, 7], [0, 0, 2, 2, 1, 3, 3, 1]) + + A = C0 + D = word(J, W, C0) + B = word(D, L, A) + F = word(A, L, A) + T = monomial([((x & 1) << 2) | (x & 2) | ((x & 4) >> 2) for x in range(8)]) + + out_pauli = word(K, a, adjoint(K)) + H = scale(q(Fraction(1, 2)), adjoint(out_pauli)) + E = word(H, D) + G = word(adjoint(K), E) + + # Core identities + assert word(D, L, A) == B, "B = D L A" + assert B == plus(word(M, C2), scale(q(2), word(K, a))), "B = M C2 + 2 K a" + assert word(H, K, a) == scale(q(Fraction(1, 2)), K), "H K a = (1/2) K" + assert word(adjoint(G), G) == scale(q(Fraction(1, 4)), I_8), "G^dagger G = (1/4) I" + + return { + "I": I_8, "C0": C0, "C1": C1, "C2": C2, "K": K, + "A": A, "D": D, "B": B, "F": F, "T": T, "M": M, "W": W, "J": J, + "H": H, "E": E, "G": G, "out_pauli": out_pauli + } + + +# ============================================================================== +# SECTION 4: 5-Array 14-Call Schedule & Full Target Recovery +# ============================================================================== + +def gaussian_elimination_q(matrix, rhs_vectors): + """Gaussian elimination over Q(i) to solve M x = rhs for multiple rhs vectors.""" + n_rows = len(matrix) + n_cols = len(matrix[0]) + n_rhs = len(rhs_vectors) + + # Augmented matrix: [M | RHS] + aug = [list(matrix[r]) + [rhs_vectors[k][r] for k in range(n_rhs)] for r in range(n_rows)] + + pivots = [] + curr_row = 0 + for col in range(n_cols): + # Find pivot + sel = None + for r in range(curr_row, n_rows): + if aug[r][col] != ZERO: + sel = r + break + if sel is None: + continue + + aug[curr_row], aug[sel] = aug[sel], aug[curr_row] + p_val = aug[curr_row][col] + # Scale pivot row to 1 + aug[curr_row] = [div(val, p_val) for val in aug[curr_row]] + + # Eliminate in all other rows + for r in range(n_rows): + if r != curr_row and aug[r][col] != ZERO: + coeff = aug[r][col] + aug[r] = [sub(aug[r][c], mul(coeff, aug[curr_row][c])) for c in range(len(aug[r]))] + + pivots.append((curr_row, col)) + curr_row += 1 + + rank = len(pivots) + return rank, aug, pivots + + +def run_5in14_verification(): + print("=" * 80) + print("5-IN-14 BLOCK-3 UNIT SCHEDULE VERIFICATION OVER Q(i)") + print("=" * 80) + + # Part 1: Finite Geometry + print("\n[Part 1: Sp_6(F_2) 14-Neighbor Geometry]") + geo = verify_finite_geometry() + print(f" Rank-1 Lagrangian Neighbors: {geo['rank_one_neighbors']}") + print(f" Common Stabilizer Group Order: {geo['stabilizer_order']}") + print(f" Stabilizer Orbit Sizes: {geo['stabilizer_orbits']} (Orbits: 1, 1, 12)") + print(" -> Corresponds EXACTLY to 12 calls (4 x 3-call ports) + 2 calls (1 x 2-call port) = 14!") + + # Part 2: Native Port Properties + print("\n[Part 2: Full-Input Native Triangular Ports (PR #4743)]") + ops = load_operators() + I = ops["I"] + K, A, D, B, F, T = ops["K"], ops["A"], ops["D"], ops["B"], ops["F"], ops["T"] + E, G, H, M = ops["E"], ops["G"], ops["H"], ops["M"] + + print(" Two-Call Port U_2 = [[A, 0], [F, A]]: 2 paid calls, condition number <= 16 [VERIFIED]") + print(" Three-Call Port U_3 = [[A, 0], [B, D]]: 3 paid calls, condition number <= 16 [VERIFIED]") + print(" Residual Identity: B = D L A = M C_2 + 2 K a [VERIFIED]") + print(" Swap Sector Closure: C2 x = sigma T C0 x -> Residual subtraction is FREE [VERIFIED]") + print(f" Coupler Operator G = K^-1 E: G^dagger G = (1/4) I, ||G|| = 1/2 [VERIFIED]") + + # Part 3: Chaining Schedule over 5 Arrays (Calls 1..14) + print("\n[Part 3: 14-Call Schedule on 5 Arrays (x1, x2, x3, x4, x5)]") + print(" Schedule Architecture:") + print(" - Port 1 (Calls 1, 2, 3): U_3 on (x1, x2) -> v_1 = K x1 + E x2, t_1 = A x1") + print(" - Port 2 (Calls 4, 5, 6): U_3 on (x2, x3) -> v_2 = K x2 + E x3, t_2 = A x2") + print(" - Port 3 (Calls 7, 8, 9): U_3 on (x3, x4) -> v_3 = K x3 + E x4, t_3 = A x3") + print(" - Port 4 (Calls 10, 11, 12): U_3 on (x4, x5) -> v_4 = K x4 + E x5, t_4 = A x4") + print(" - Port 5 (Calls 13, 14): U_2 on (x5, x1) -> s_1 = A x1 + F x5, t_5 = A x5") + print(" - Free Subtraction: w_5 = s_1 - t_1 = F x5") + print(" Total Paid Calls: 3 + 3 + 3 + 3 + 2 = 14 Calls (ZERO SLACK: 14 * 80 = 5 * 224 = 1120).") + + # Part 4: Constructing the Exact 5-Array Multi-Port Operator + print("\n[Part 4: Exact Multi-Port Matrix Construction & Rank Analysis]") + # Input dimension: 5 arrays * 8 coordinates = 40 dimensions + # Build linear observation rows: + # v1 (8 rows): K x1 + E x2 + # v2 (8 rows): K x2 + E x3 + # v3 (8 rows): K x3 + E x4 + # v4 (8 rows): K x4 + E x5 + # w5 (8 rows): F x5 + # t1..t5 (40 rows): A x1, A x2, A x3, A x4, A x5 + # Total observations: 80 rows in 40 unknown variables. + + matrix_rows = [] + # 1. v1 = K x1 + E x2 + for r in range(8): + row = [ZERO] * 40 + for c in range(8): + row[0 + c] = K[r][c] + row[8 + c] = E[r][c] + matrix_rows.append(row) + + # 2. v2 = K x2 + E x3 + for r in range(8): + row = [ZERO] * 40 + for c in range(8): + row[8 + c] = K[r][c] + row[16 + c] = E[r][c] + matrix_rows.append(row) + + # 3. v3 = K x3 + E x4 + for r in range(8): + row = [ZERO] * 40 + for c in range(8): + row[16 + c] = K[r][c] + row[24 + c] = E[r][c] + matrix_rows.append(row) + + # 4. v4 = K x4 + E x5 + for r in range(8): + row = [ZERO] * 40 + for c in range(8): + row[24 + c] = K[r][c] + row[32 + c] = E[r][c] + matrix_rows.append(row) + + # 5. w5 = F x5 + for r in range(8): + row = [ZERO] * 40 + for c in range(8): + row[32 + c] = F[r][c] + matrix_rows.append(row) + + # 6..10. t_k = A x_k + for k in range(5): + for r in range(8): + row = [ZERO] * 40 + for c in range(8): + row[k * 8 + c] = A[r][c] + matrix_rows.append(row) + + # Verify Rank of the Observation System + rank, _, pivots = gaussian_elimination_q(matrix_rows, []) + print(f" Observation Rows: {len(matrix_rows)}") + print(f" Input Dimensionality: 40 (5 arrays x 8 coordinates)") + print(f" Observation Matrix Rank: {rank} / 40 (FULL INJECTIVE RANK!)") + assert rank == 40, "Observation matrix must have full rank 40" + + # Part 5: Exact Target Reconstruction & Sector Inversion + print("\n[Part 5: Exact Recovery of All 5 Canonical Targets K x_1..K x_5]") + # Test on arbitrary input vectors across both swap sectors + # Create test vectors for 5 arrays: + test_cases = [ + ("All Positive Swap Sectors (sigma = +1 for all 5 arrays)", [1, 1, 1, 1, 1]), + ("Mixed Swap Sectors (+1, -1, +1, -1, +1)", [1, -1, 1, -1, 1]), + ("All Negative Swap Sectors (sigma = -1 for all 5 arrays)", [-1, -1, -1, -1, -1]), + ] + + for label, sigmas in test_cases: + # Form sector projectors + projectors = [scale(q(Fraction(1, 2)), plus(I, scale(q(s), T))) for s in sigmas] + # Choose concrete test inputs x_k = E_sigma_k * base_vector + x_inputs = [] + for k in range(5): + base_vec = tuple(q(1 if i == k else 0) for i in range(8)) + vec = mv(projectors[k], base_vec) + # Ensure non-trivial vector + if all(v == ZERO for v in vec): + base_vec = tuple(q(1 if i == ((k + 1) % 8) else 0) for i in range(8)) + vec = mv(projectors[k], base_vec) + x_inputs.append(vec) + + # Expected canonical targets: K x_k + expected_targets = [mv(K, x_inputs[k]) for k in range(5)] + + # Simulate the physical outputs from the 14-call schedule: + # Ports 1..4: + v_obs = [] + for k in range(4): + # Port on (x_k, x_{k+1}): + # Raw second output: u = D x_{k+1} + B x_k + # Since B x_k = sigma_k M T A x_k + 2 K a x_k: + # Subtraction: u - sigma_k M T (A x_k) = D x_{k+1} + 2 K a x_k + # Scaling by H: v_k = K x_k + E x_{k+1} + term1 = mv(K, x_inputs[k]) + term2 = mv(E, x_inputs[k + 1]) + vk = tuple(add(term1[i], term2[i]) for i in range(8)) + v_obs.append(vk) + + # Port 5 (2-call port on (x5, x1)): + # Raw second output: s_1 = A x1 + F x5 + # Subtraction: w5 = s_1 - A x1 = F x5 + w5_obs = mv(F, x_inputs[4]) + + # Retained t_k = A x_k + t_obs = [mv(A, x_inputs[k]) for k in range(5)] + + # Combine all physical observations into single 80-dim vector: + all_obs = [] + for vk in v_obs: all_obs.extend(vk) + all_obs.extend(w5_obs) + for tk in t_obs: all_obs.extend(tk) + + # Solve for x = (x1, x2, x3, x4, x5) using the observation matrix: + # Solves M x_rec = all_obs + _, aug, _ = gaussian_elimination_q(matrix_rows, [all_obs]) + recovered_x_flat = [aug[r][-1] for r in range(40)] + + # Group into 5 arrays: + recovered_x = [tuple(recovered_x_flat[k * 8 : (k + 1) * 8]) for k in range(5)] + + # Compute recovered targets: K x_rec + recovered_targets = [mv(K, recovered_x[k]) for k in range(5)] + + # Verify exact equality with expected targets: + max_error = 0 + for k in range(5): + for i in range(8): + diff = sub(recovered_targets[k][i], expected_targets[k][i]) + err = abs(diff[0]) + abs(diff[1]) + if err > max_error: + max_error = err + + print(f" Test: {label}") + print(f" Max Reconstruction Error across all 5 arrays: {max_error} [EXACT RECOVERY!]") + assert max_error == 0, f"Target reconstruction failed for {label}" + + print("-" * 80) + print("Key Mathematical Findings:") + print(" 1. The 14 Lagrangian rank-one neighbors in Sp_6(F_2) partition under the 768-element") + print(" stabilizer into orbits of sizes 1, 1, and 12.") + print(" 2. The size-12 orbit exactly powers four 3-call full-input triangular ports (12 calls).") + print(" 3. The two size-1 orbits power one 2-call triangular port (2 calls).") + print(" 4. Total paid calls = 12 + 2 = 14 calls, matching the PR #4628 lower bound 14W/5") + print(" and clearing the PR #4710 deficit 960 with ZERO SLACK (14 * 80 = 5 * 224 = 1120).") + print(" 5. The resulting cyclic/cascade observation matrix has full injective rank 40,") + print(" recovering all 5 canonical targets K x_1, ..., K x_5 with condition number <= 16.") + print("=" * 80) + + +def main(): + import io, contextlib + f = io.StringIO() + with contextlib.redirect_stdout(f): + run_5in14_verification() + result = { + "arrays": 5, + "condition_number_bound": 16, + "max_reconstruction_error": 0, + "new_kappa": False, + "observation_matrix_rank": 40, + "paid_calls": 14, + "stabilizer_orbits": [1, 1, 12], + "status": "PASS_FIVE_IN_FOURTEEN_SCHEDULE", + "total_state_dimension": 40, + "zero_slack_identity": "14 * 80 == 5 * 224 == 1120" + } + print(json.dumps(result, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/complex-block-schedule-admission-audit/inputs/pr4818-verify_schedule.py b/research/complex-block-schedule-admission-audit/inputs/pr4818-verify_schedule.py new file mode 100644 index 0000000000..8f9a2ef3cd --- /dev/null +++ b/research/complex-block-schedule-admission-audit/inputs/pr4818-verify_schedule.py @@ -0,0 +1,447 @@ +#!/usr/bin/env python3 +"""Exact Synthesis & Verification of the 3-Array 10-Call Cascade Schedule on V = C^16. + +Proves the viability of breaking the kappa > 0.10 milestone via: + - W = 3 arrays in s = 10 calls at block size m = 4. + - State space: (C^16)^3 = 48 dimensions over Q(i). + - Target operator: K = C_3 C_2 C_1 C_0 on C^16. + - Saving: kappa = ln(m*W/s) / ln(m) = 1 - ln(10/3) / ln(4) = ln(1.2) / ln(4) = 0.131517... (13.15% > 10%). + - Total demand: 3 * 86,592 = 259,776 ranks. + - Total capacity: 10 * 27,456 = 274,560 ranks. + - Gross surplus: +14,784 ranks (94.62% required efficiency). + +Cascade Schedule: + - Port 1 (3 calls on x1, x2): v1 = K x1 + E1 x2, t1 = C0 x1 + - Port 2 (3 calls on x2, x3): v2 = K x2 + E2 x3, t2 = C0 x2 + - Port 3 (4 calls on x3, x1): closing the 3-cycle loop (v3 = K x3 + E3 x1, t3 = C0 x3) + - Total paid calls = 3 + 3 + 4 = 10 calls. + +Standard library only (fractions.Fraction, math, random). Exact Q(i) arithmetic. +""" + +from __future__ import annotations +import math +import random +from fractions import Fraction +from typing import Dict, List, Tuple + + +# ============================================================================== +# SECTION 1: Exact Gaussian Rational Arithmetic over Q(i) +# ============================================================================== + +def q(real=0, imag=0) -> Tuple[Fraction, Fraction]: + return (Fraction(real), Fraction(imag)) + +ZERO, ONE, I = q(), q(1), q(0, 1) + +def add(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0] + y[0], x[1] + y[1]) + +def sub(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0] - y[0], x[1] - y[1]) + +def mul(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]) + +def conj(x: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0], -x[1]) + +def div(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + denom = y[0] ** 2 + y[1] ** 2 + if denom == 0: + raise ZeroDivisionError("division by zero in Q(i)") + return ((x[0] * y[0] + x[1] * y[1]) / denom, (x[1] * y[0] - x[0] * y[1]) / denom) + +def scale_m(c: Tuple[Fraction, Fraction], mat: List[List[Tuple[Fraction, Fraction]]]): + return [[mul(c, val) for val in row] for row in mat] + +def mm(a: List[List[Tuple[Fraction, Fraction]]], b: List[List[Tuple[Fraction, Fraction]]]): + n = len(a) + p = len(b[0]) + k_dim = len(b) + out = [[ZERO for _ in range(p)] for _ in range(n)] + for r in range(n): + for k in range(k_dim): + if a[r][k] == ZERO: + continue + for c in range(p): + if b[k][c] != ZERO: + out[r][c] = add(out[r][c], mul(a[r][k], b[k][c])) + return out + +def mv(mat: List[List[Tuple[Fraction, Fraction]]], vec: List[Tuple[Fraction, Fraction]]): + n = len(mat) + k_dim = len(vec) + out = [ZERO for _ in range(n)] + for r in range(n): + s = ZERO + for c in range(k_dim): + if mat[r][c] != ZERO and vec[c] != ZERO: + s = add(s, mul(mat[r][c], vec[c])) + out[r] = s + return out + +def ident(n=16): + return [[ONE if r == c else ZERO for c in range(n)] for r in range(n)] + +def adjoint(a: List[List[Tuple[Fraction, Fraction]]]): + return [[conj(a[c][r]) for c in range(len(a))] for r in range(len(a[0]))] + + +# ============================================================================== +# SECTION 2: Operators on V = C^16 (Block m = 4) +# ============================================================================== + +def shift_mat(v: int, n=16): + out = [[ZERO for _ in range(n)] for _ in range(n)] + for x in range(n): + out[x ^ v][x] = ONE + return out + +def c_letter(bit: int, n=16): + """C_v = a I + b X_v with a = (1+i)/2, b = (1-i)/2.""" + sh = shift_mat(1 << bit, n) + a_coef = q(Fraction(1, 2), Fraction(1, 2)) + b_coef = q(Fraction(1, 2), Fraction(-1, 2)) + id_n = ident(n) + out = [[ZERO for _ in range(n)] for _ in range(n)] + for r in range(n): + for c in range(n): + out[r][c] = add(mul(a_coef, id_n[r][c]), mul(b_coef, sh[r][c])) + return out + +def build_operators_m4(): + """Constructs the canonical operators on C^16 for block m = 4.""" + I16 = ident(16) + C0 = c_letter(0) + C1 = c_letter(1) + C2 = c_letter(2) + C3 = c_letter(3) + + # Canonical 4-call target operator K = C_3 C_2 C_1 C_0 + K = mm(C3, mm(C2, mm(C1, C0))) + + # Verify exact unitarity: K K^dagger = I_16 + K_adj = adjoint(K) + assert mm(K, K_adj) == I16, "K must be exact unitary on C^16" + + # Contractive couplers G_k with G_k^dagger G_k = (1/4) I_16 (||G_k|| = 1/2) + half = q(Fraction(1, 2)) + G1 = scale_m(half, shift_mat(1, 16)) + G2 = scale_m(half, shift_mat(2, 16)) + G3 = scale_m(half, shift_mat(4, 16)) + + # E_k = K G_k + E1 = mm(K, G1) + E2 = mm(K, G2) + E3 = mm(K, G3) + + return { + "I16": I16, "C0": C0, "C1": C1, "C2": C2, "C3": C3, "K": K, + "G1": G1, "G2": G2, "G3": G3, "E1": E1, "E2": E2, "E3": E3 + } + + +# ============================================================================== +# SECTION 3: Exact Gaussian Elimination Solver over Q(i) +# ============================================================================== + +def solve_linear_system(A: List[List[Tuple[Fraction, Fraction]]], b: List[Tuple[Fraction, Fraction]]): + """Solves A x = b over Q(i) via exact Gaussian elimination with partial pivoting.""" + n = len(A) + aug = [list(A[r]) + [b[r]] for r in range(n)] + + for col in range(n): + piv = -1 + for row in range(col, n): + if aug[row][col] != ZERO: + piv = row + break + if piv == -1: + raise ValueError(f"Matrix is singular at column {col}") + + if piv != col: + aug[col], aug[piv] = aug[piv], aug[col] + + piv_val = aug[col][col] + for c in range(col, n + 1): + aug[col][c] = div(aug[col][c], piv_val) + + for r in range(n): + if r != col and aug[r][col] != ZERO: + factor = aug[r][col] + for c in range(col, n + 1): + aug[r][c] = sub(aug[r][c], mul(factor, aug[col][c])) + + return [aug[r][n] for r in range(n)] + +def matrix_rank_q(mat: List[List[Tuple[Fraction, Fraction]]]) -> int: + """Computes exact column rank of a rectangular matrix over Q(i).""" + aug = [list(row) for row in mat] + n_rows = len(aug) + n_cols = len(aug[0]) + piv_cols = 0 + row = 0 + + for col in range(n_cols): + piv = -1 + for r in range(row, n_rows): + if aug[r][col] != ZERO: + piv = r + break + if piv == -1: + continue + if piv != row: + aug[row], aug[piv] = aug[piv], aug[row] + piv_val = aug[row][col] + for c in range(col, n_cols): + aug[row][c] = div(aug[row][c], piv_val) + for r in range(n_rows): + if r != row and aug[r][col] != ZERO: + factor = aug[r][col] + for c in range(col, n_cols): + aug[r][c] = sub(aug[r][c], mul(factor, aug[row][c])) + row += 1 + piv_cols += 1 + if row == n_rows: + break + + return piv_cols + + +# ============================================================================== +# SECTION 4: Cascade Synthesis & Verification +# ============================================================================== + +def run_3in10_synthesis(): + print("=" * 80) + print("3-ARRAY 10-CALL CASCADE SCHEDULE SYNTHESIS ON V = C^16 (m = 4)") + print("=" * 80) + + # 1. Theoretical Accounting & Capacity Match + m = 4 + W = 3 + s = 10 + n = 16 + demand_per_array = 86592 + cap_per_call = 27456 + + total_demand = W * demand_per_array # 3 * 86,592 = 259,776 + total_capacity = s * cap_per_call # 10 * 27,456 = 274,560 + surplus_ranks = total_capacity - total_demand # +14,784 + efficiency = (total_demand / total_capacity) * 100 + # Saving formula: kappa = ln(m*W / s) / ln(m) = 1 - ln(s/W) / ln(m) + saving_ceiling = math.log(m * W / s) / math.log(m) # = 1 - ln(10/3)/ln(4) = 0.131517 + assert abs(saving_ceiling - 0.131517) < 1e-4 + + print("1. Capacity & Deficit Ledger:") + print(f" - Target demand (3 arrays): 3 * {demand_per_array:,} = {total_demand:,} ranks") + print(f" - Total capacity (10 calls): 10 * {cap_per_call:,} = {total_capacity:,} ranks") + print(f" - Gross surplus capacity: +{surplus_ranks:,} ranks") + print(f" - Required efficiency: {efficiency:.2f}% (surplus provides headroom)") + print(f" - Saving exponent: kappa = {saving_ceiling:.5f} ({saving_ceiling*100:.2f}% > 10%!)") + print("-" * 80) + + # 2. Build Operators + ops = build_operators_m4() + K = ops["K"] + G1, G2, G3 = ops["G1"], ops["G2"], ops["G3"] + E1, E2, E3 = ops["E1"], ops["E2"], ops["E3"] + C0 = ops["C0"] + I16 = ops["I16"] + + # 3. Construct the 48x48 Cascade Matrix M_cascade + # M_cascade maps target vector Y = (K x1, K x2, K x3)^T to primary observations V = (v1, v2, v3)^T: + # [ I_16 G1 0 ] [ y1 ] [ v1 ] + # [ 0 I_16 G2 ] [ y2 ] = [ v2 ] + # [ G3 0 I_16 ] [ y3 ] [ v3 ] + M_cascade = [[ZERO for _ in range(48)] for _ in range(48)] + for r in range(16): + for c in range(16): + # Row block 0: I16, G1, 0 + M_cascade[r][c] = I16[r][c] + M_cascade[r][16 + c] = G1[r][c] + # Row block 1: 0, I16, G2 + M_cascade[16 + r][16 + c] = I16[r][c] + M_cascade[16 + r][32 + c] = G2[r][c] + # Row block 2: G3, 0, I16 + M_cascade[32 + r][c] = G3[r][c] + M_cascade[32 + r][32 + c] = I16[r][c] + + # Also construct triangular unrolling variant (G3 = 0, where Port 3 finishes x3 directly) + M_triangular = [[ZERO for _ in range(48)] for _ in range(48)] + for r in range(16): + for c in range(16): + M_triangular[r][c] = I16[r][c] + M_triangular[r][16 + c] = G1[r][c] + M_triangular[16 + r][16 + c] = I16[r][c] + M_triangular[16 + r][32 + c] = G2[r][c] + M_triangular[32 + r][32 + c] = I16[r][c] + + # 4. Construct Full Observation Matrix O (96x48) over Q(i) + # Primary rows (48x48): V = [K, E1, 0; 0, K, E2; E3, 0, K] * X + # Auxiliary rows (48x48): T = [C0, 0, 0; 0, C0, 0; 0, 0, C0] * X + O_primary = [[ZERO for _ in range(48)] for _ in range(48)] + O_full = [[ZERO for _ in range(48)] for _ in range(96)] + + for r in range(16): + for c in range(16): + # O_primary + O_primary[r][c] = K[r][c] + O_primary[r][16 + c] = E1[r][c] + O_primary[16 + r][16 + c] = K[r][c] + O_primary[16 + r][32 + c] = E2[r][c] + O_primary[32 + r][c] = E3[r][c] + O_primary[32 + r][32 + c] = K[r][c] + + # O_full: Top 48 rows = O_primary + O_full[r][c] = K[r][c] + O_full[r][16 + c] = E1[r][c] + O_full[16 + r][16 + c] = K[r][c] + O_full[16 + r][32 + c] = E2[r][c] + O_full[32 + r][c] = E3[r][c] + O_full[32 + r][32 + c] = K[r][c] + + # O_full: Bottom 48 rows = C0 on each array + O_full[48 + r][c] = C0[r][c] + O_full[64 + r][16 + c] = C0[r][c] + O_full[80 + r][32 + c] = C0[r][c] + + # 5. Rank and Invertibility Verifications over Q(i) + print("2. Observation Matrix Rank Analysis over Q(i):") + rank_M = matrix_rank_q(M_cascade) + rank_M_tri = matrix_rank_q(M_triangular) + rank_O_prim = matrix_rank_q(O_primary) + rank_O_full = matrix_rank_q(O_full) + + print(f" - Rank of M_cascade (48x48 cyclic coupler): {rank_M} / 48 (FULL RANK)") + print(f" - Rank of M_triangular (48x48 unrolled coupler): {rank_M_tri} / 48 (FULL RANK)") + print(f" - Rank of O_primary (48x48 primary observation): {rank_O_prim} / 48 (FULL RANK)") + print(f" - Rank of O_full (96x48 total observation): {rank_O_full} / 48 (FULL RANK)") + + assert rank_M == 48, "M_cascade must have full rank 48" + assert rank_M_tri == 48, "M_triangular must have full rank 48" + assert rank_O_prim == 48, "O_primary must have full rank 48" + assert rank_O_full == 48, "O_full must have full rank 48" + print("-" * 80) + + # 6. Condition Number & Spectral Bounds + # Coupler norms: ||G1|| = ||G2|| = ||G3|| = 1/2. + # 3-cycle loop gain: ||G3 G1 G2|| <= (1/2)^3 = 1/8 = 0.125 << 1. + loop_gain = 0.125 + cond_bound_neumann = (1.0 + loop_gain) / (1.0 - loop_gain) # 9/7 approx 1.2857 + print("3. Contraction & Condition Number Bounds:") + print(f" - Intermediate coupler norms: ||G_1|| = ||G_2|| = ||G_3|| = 1/2") + print(f" - 3-cycle loop gain: ||G_3 G_1 G_2|| <= (1/2)^3 = {loop_gain} << 1") + print(f" - Theoretical condition bound (Neumann): kappa(M_cascade) <= {cond_bound_neumann:.4f} <= 16") + print(" - Invertibility is guaranteed for all inputs without singularity.") + print("-" * 80) + + # 7. Exact Target Recovery Simulation + print("4. Exact Simulation & Target Recovery Tests:") + random.seed(4628) + + test_cases = [] + + # Test Suite A: All 48 Canonical Basis Vectors + print(" - Testing all 48 canonical basis vectors e_1, ..., e_48...") + for idx in range(48): + v = [ZERO] * 48 + v[idx] = ONE + test_cases.append((f"Canonical basis e_{idx}", v[:16], v[16:32], v[32:])) + + # Test Suite B: Random Gaussian Rational Inputs + print(" - Testing random Gaussian rational inputs over Q(i)...") + for test_idx in range(10): + x1 = [q(random.randint(-20, 20), random.randint(-20, 20)) for _ in range(16)] + x2 = [q(random.randint(-20, 20), random.randint(-20, 20)) for _ in range(16)] + x3 = [q(random.randint(-20, 20), random.randint(-20, 20)) for _ in range(16)] + test_cases.append((f"Random Gaussian Q(i) #{test_idx+1}", x1, x2, x3)) + + # Run Simulation on All Test Cases + total_reconstructed = 0 + max_error = 0 + + for name, x1, x2, x3 in test_cases: + X = x1 + x2 + x3 + + # Ground truth canonical targets + y1_true = mv(K, x1) + y2_true = mv(K, x2) + y3_true = mv(K, x3) + Y_true = y1_true + y2_true + y3_true + + # Schedule execution: Compute primary observations V = (v1, v2, v3) + # Port 1: v1 = K x1 + E1 x2 + v1 = [add(k_val, e_val) for k_val, e_val in zip(y1_true, mv(E1, x2))] + # Port 2: v2 = K x2 + E2 x3 + v2 = [add(k_val, e_val) for k_val, e_val in zip(y2_true, mv(E2, x3))] + # Port 3: v3 = K x3 + E3 x1 + v3 = [add(k_val, e_val) for k_val, e_val in zip(y3_true, mv(E3, x1))] + V = v1 + v2 + v3 + + # Target Recovery: Solve M_cascade * Y_rec = V + Y_rec = solve_linear_system(M_cascade, V) + + # Verify exact equality in Q(i) + errors = sum(1 for yr, yt in zip(Y_rec, Y_true) if yr != yt) + assert errors == 0, f"Reconstruction failed on {name} with {errors} errors" + total_reconstructed += 1 + + print(f" --> Successfully verified {total_reconstructed} test cases with ZERO reconstruction error!") + print("=" * 80) + print("ALL 3-ARRAY 10-CALL CASCADE VERIFICATIONS PASSED (kappa = 13.15% certified).") + print("=" * 80) + + return { + "status": "PASS_3IN10_CASCADE_SCHEDULE", + "block_m": m, + "W_arrays": W, + "s_calls": s, + "saving_kappa": saving_ceiling, + "saving_pct": f"{saving_ceiling * 100:.2f}%", + "target_demand": total_demand, + "call_capacity": total_capacity, + "gross_surplus": surplus_ranks, + "required_efficiency": f"{efficiency:.2f}%", + "loop_gain": loop_gain, + "condition_bound": cond_bound_neumann, + "rank_M_cascade": rank_M, + "rank_O_primary": rank_O_prim, + "rank_O_full": rank_O_full, + "total_test_cases_verified": total_reconstructed, + "exact_zero_error": True, + } + + +def main(): + import io, contextlib, json + f = io.StringIO() + with contextlib.redirect_stdout(f): + res = run_3in10_synthesis() + result = { + "W_arrays": res["W_arrays"], + "block_m": res["block_m"], + "call_capacity": res["call_capacity"], + "condition_bound": res["condition_bound"], + "exact_zero_error": res["exact_zero_error"], + "gross_surplus": res["gross_surplus"], + "loop_gain": res["loop_gain"], + "new_kappa": True, + "rank_M_cascade": res["rank_M_cascade"], + "rank_O_full": res["rank_O_full"], + "rank_O_primary": res["rank_O_primary"], + "required_efficiency": res["required_efficiency"], + "s_calls": res["s_calls"], + "saving_kappa": res["saving_kappa"], + "saving_pct": res["saving_pct"], + "status": res["status"], + "target_demand": res["target_demand"], + "total_test_cases_verified": res["total_test_cases_verified"] + } + print(json.dumps(result, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/complex-block-schedule-admission-audit/inputs/pr4819-verify_schedule.py b/research/complex-block-schedule-admission-audit/inputs/pr4819-verify_schedule.py new file mode 100644 index 0000000000..e22dd9afd8 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/inputs/pr4819-verify_schedule.py @@ -0,0 +1,454 @@ +#!/usr/bin/env python3 +"""Exact Synthesis & Verification of the 13-Array 41-Call Boundary Schedule on V = C^16. + +Proves the viability of the theoretical maximum boundary schedule for Block m = 4: + - W = 13 arrays in s = 41 calls at block size m = 4 (state space: (C^16)^13 = 208 dimensions). + - Target operator: K = C_3 C_2 C_1 C_0 on C^16. + - Zero-slack capacity match: + Demand: 13 * 86,592 = 1,125,696 ranks + Capacity: 41 * 27,456 = 1,125,696 ranks + Net surplus / slack: 0 ranks (100.000% capacity efficiency) + - Asymptotic integer multiplication exponent ceiling: + kappa = 1 - ln(41/13) / ln(4) = 0.1714417... (17.14% > 10% milestone) + - Unique port call partition: + n_4 = 2 (4-call ports), n_3 = 11 (3-call ports) + 2 * 4 + 11 * 3 = 41 calls across 13 ports + - 13-cycle loop contraction: + ||L_13|| = ||G_12 ... G_0|| <= (1/2)^13 = 1/8,192 approx 0.00012207 + - Cascade condition number: + kappa(M_cascade) <= (1 + 1/8192) / (1 - 1/8192) = 8193 / 8191 approx 1.000244 << 16 + +Standard library only (fractions.Fraction, math, random, time). Exact Q(i) arithmetic. +""" + +from __future__ import annotations +import math +import random +import time +from fractions import Fraction +from typing import Dict, List, Tuple, Any + + +# ============================================================================== +# SECTION 1: Exact Gaussian Rational Arithmetic over Q(i) +# ============================================================================== + +def q(real=0, imag=0) -> Tuple[Fraction, Fraction]: + return (Fraction(real), Fraction(imag)) + +ZERO, ONE, I = q(), q(1), q(0, 1) + +def add(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0] + y[0], x[1] + y[1]) + +def sub(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0] - y[0], x[1] - y[1]) + +def mul(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0]) + +def conj(x: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + return (x[0], -x[1]) + +def div(x: Tuple[Fraction, Fraction], y: Tuple[Fraction, Fraction]) -> Tuple[Fraction, Fraction]: + denom = y[0] ** 2 + y[1] ** 2 + if denom == 0: + raise ZeroDivisionError("division by zero in Q(i)") + return ((x[0] * y[0] + x[1] * y[1]) / denom, (x[1] * y[0] - x[0] * y[1]) / denom) + +def scale_m(c: Tuple[Fraction, Fraction], mat: List[List[Tuple[Fraction, Fraction]]]): + return [[mul(c, val) for val in row] for row in mat] + +def mm(a: List[List[Tuple[Fraction, Fraction]]], b: List[List[Tuple[Fraction, Fraction]]]): + n = len(a) + p = len(b[0]) + k_dim = len(b) + out = [[ZERO for _ in range(p)] for _ in range(n)] + for r in range(n): + for k in range(k_dim): + if a[r][k] == ZERO: + continue + for c in range(p): + if b[k][c] != ZERO: + out[r][c] = add(out[r][c], mul(a[r][k], b[k][c])) + return out + +def mv(mat: List[List[Tuple[Fraction, Fraction]]], vec: List[Tuple[Fraction, Fraction]]): + n = len(mat) + k_dim = len(vec) + out = [ZERO for _ in range(n)] + for r in range(n): + s = ZERO + for c in range(k_dim): + if mat[r][c] != ZERO and vec[c] != ZERO: + s = add(s, mul(mat[r][c], vec[c])) + out[r] = s + return out + +def ident(n=16): + return [[ONE if r == c else ZERO for c in range(n)] for r in range(n)] + +def adjoint(a: List[List[Tuple[Fraction, Fraction]]]): + return [[conj(a[c][r]) for c in range(len(a))] for r in range(len(a[0]))] + +def invert_mat_16(A: List[List[Tuple[Fraction, Fraction]]]) -> List[List[Tuple[Fraction, Fraction]]]: + """Inverts a 16x16 matrix over Q(i) using exact Gaussian elimination.""" + n = len(A) + aug = [list(A[r]) + [ONE if r == c else ZERO for c in range(n)] for r in range(n)] + for col in range(n): + piv = -1 + for row in range(col, n): + if aug[row][col] != ZERO: + piv = row + break + if piv == -1: + raise ValueError(f"Matrix is singular at column {col}") + if piv != col: + aug[col], aug[piv] = aug[piv], aug[col] + piv_val = aug[col][col] + for c in range(col, 2 * n): + aug[col][c] = div(aug[col][c], piv_val) + for r in range(n): + if r != col and aug[r][col] != ZERO: + factor = aug[r][col] + for c in range(col, 2 * n): + aug[r][c] = sub(aug[r][c], mul(factor, aug[col][c])) + return [[aug[r][n + c] for c in range(n)] for r in range(n)] + + +# ============================================================================== +# SECTION 2: Block m = 4 Operators on V = C^16 +# ============================================================================== + +def shift_mat(v: int, n=16): + out = [[ZERO for _ in range(n)] for _ in range(n)] + for x in range(n): + out[x ^ v][x] = ONE + return out + +def c_letter(bit: int, n=16): + """C_v = a I + b X_v with a = (1+i)/2, b = (1-i)/2.""" + sh = shift_mat(1 << bit, n) + a_coef = q(Fraction(1, 2), Fraction(1, 2)) + b_coef = q(Fraction(1, 2), Fraction(-1, 2)) + id_n = ident(n) + out = [[ZERO for _ in range(n)] for _ in range(n)] + for r in range(n): + for c in range(n): + out[r][c] = add(mul(a_coef, id_n[r][c]), mul(b_coef, sh[r][c])) + return out + +def build_operators_m4(): + """Constructs the canonical operators on C^16 for block m = 4 and 13 couplers.""" + I16 = ident(16) + C0 = c_letter(0) + C1 = c_letter(1) + C2 = c_letter(2) + C3 = c_letter(3) + + # Canonical 4-call target operator K = C_3 C_2 C_1 C_0 + K = mm(C3, mm(C2, mm(C1, C0))) + + # Verify exact unitarity: K K^dagger = I_16 + K_adj = adjoint(K) + assert mm(K, K_adj) == I16, "K must be exact unitary on C^16" + + # 13 Contractive couplers G_k with G_k^dagger G_k = (1/4) I_16 (||G_k|| = 1/2) + half = q(Fraction(1, 2)) + couplers = [scale_m(half, shift_mat((k % 15) + 1, 16)) for k in range(13)] + + # Verify exact contractivity ||G_k|| = 1/2 + quarter_I = scale_m(q(Fraction(1, 4)), I16) + for k, Gk in enumerate(couplers): + Gk_adj = adjoint(Gk) + assert mm(Gk_adj, Gk) == quarter_I, f"Coupler G_{k} must satisfy G^dagger G = (1/4) I_16" + + # E_k = K G_k + E_ops = [mm(K, Gk) for Gk in couplers] + + return { + "I16": I16, "C0": C0, "C1": C1, "C2": C2, "C3": C3, "K": K, + "couplers": couplers, "E_ops": E_ops + } + + +# ============================================================================== +# SECTION 3: Fast Block Back-Substitution Engine for the 208x208 System +# ============================================================================== + +class Cascade13in41Engine: + """Exact solver for the 208-dimensional block cyclic cascade system M_cascade Y = V. + + System structure (13 blocks of 16x16): + y_0 + G_0 y_1 = v_0 + y_1 + G_1 y_2 = v_1 + ... + y_11 + G_11 y_12 = v_11 + y_12 + G_12 y_0 = v_12 + + Complexity: O(16^3) precomputation for inverting P_13 = I_16 + L_13, + then O(13 * 16^2) per vector solve. + """ + + def __init__(self, couplers: List[List[List[Tuple[Fraction, Fraction]]]]): + self.W = 13 + self.n = 16 + self.couplers = couplers + self.I16 = ident(16) + + # Prefix products: Pi[j] = G_0 * G_1 * ... * G_{j-1} + self.Pi = [self.I16] + for k in range(12): + self.Pi.append(mm(self.Pi[-1], self.couplers[k])) + + # 13-cycle loop operator: L_13 = G_12 * Pi[12] = G_12 * G_0 * ... * G_11 + self.L13 = mm(self.couplers[12], self.Pi[12]) + + # Loop matrix P_13 = I_16 + L_13 + self.P13 = [[add(self.I16[r][c], self.L13[r][c]) for c in range(16)] for r in range(16)] + + # Precompute exact inverse P_13^{-1} + self.P13_inv = invert_mat_16(self.P13) + + # Verify exact inversion + prod = mm(self.P13, self.P13_inv) + assert prod == self.I16, "P_13_inv * P_13 must equal I_16" + + def solve(self, V_blocks: List[List[Tuple[Fraction, Fraction]]]) -> List[List[Tuple[Fraction, Fraction]]]: + """Solves M_cascade Y = V for Y given V (each consisting of 13 blocks of length 16).""" + assert len(V_blocks) == 13 + + # Compute alternating cumulative term: sum_{j=0}^{11} (-1)^j Pi[j] v_j + term = [ZERO for _ in range(16)] + for j in range(12): + pv = mv(self.Pi[j], V_blocks[j]) + sign = 1 if j % 2 == 0 else -1 + for i in range(16): + if sign == 1: + term[i] = add(term[i], pv[i]) + else: + term[i] = sub(term[i], pv[i]) + + # RHS for y_12: v_12 - G_12 * term + G12_term = mv(self.couplers[12], term) + rhs12 = [sub(V_blocks[12][i], G12_term[i]) for i in range(16)] + + # Solve y_12 = P_13^{-1} * rhs12 + y12 = mv(self.P13_inv, rhs12) + + # Back-substitution: y_k = v_k - G_k y_{k+1} for k = 11 down to 0 + Y_rec = [None] * 13 + Y_rec[12] = y12 + for k in range(11, -1, -1): + Gky = mv(self.couplers[k], Y_rec[k + 1]) + Y_rec[k] = [sub(V_blocks[k][i], Gky[i]) for i in range(16)] + + return Y_rec + + def forward_multiply(self, Y_blocks: List[List[Tuple[Fraction, Fraction]]]) -> List[List[Tuple[Fraction, Fraction]]]: + """Applies M_cascade to Y to produce V.""" + V = [None] * 13 + for k in range(12): + Gky = mv(self.couplers[k], Y_blocks[k + 1]) + V[k] = [add(Y_blocks[k][i], Gky[i]) for i in range(16)] + G12y0 = mv(self.couplers[12], Y_blocks[0]) + V[12] = [add(Y_blocks[12][i], G12y0[i]) for i in range(16)] + return V + + +# ============================================================================== +# SECTION 4: Comprehensive Verification & Test Suite +# ============================================================================== + +def run_13in41_verification() -> Dict[str, Any]: + print("=" * 80) + print("13-ARRAY 41-CALL CASCADE SCHEDULE SYNTHESIS ON V = C^16 (m = 4)") + print("Theoretical Maximum Boundary Schedule (100.000% Efficiency)") + print("=" * 80) + + # 1. Theoretical Accounting & Capacity Match + m = 4 + W = 13 + s = 41 + n = 16 + demand_per_array = 86592 + cap_per_call = 27456 + + total_demand = W * demand_per_array # 13 * 86,592 = 1,125,696 + total_capacity = s * cap_per_call # 41 * 27,456 = 1,125,696 + surplus_ranks = total_capacity - total_demand # 0 + efficiency = (total_demand / total_capacity) * 100 + + saving_ceiling = 1.0 - math.log(s / W) / math.log(m) # 1 - ln(41/13)/ln(4) = 0.1714417 + assert abs(saving_ceiling - 0.1714417) < 1e-4 + + print("1. Capacity & Deficit Ledger:") + print(f" - Target demand (13 arrays): 13 * {demand_per_array:,} = {total_demand:,} ranks") + print(f" - Total capacity (41 calls): 41 * {cap_per_call:,} = {total_capacity:,} ranks") + print(f" - Net surplus capacity: {surplus_ranks:,} ranks (EXACT ZERO SLACK)") + print(f" - Capacity efficiency: {efficiency:.5f}% (Theoretical Boundary Optimum)") + print(f" - Saving exponent: kappa = {saving_ceiling:.5f} ({saving_ceiling*100:.2f}% > 10%!)") + print("-" * 80) + + # 2. Integer Port Decomposition + # Primitive 3-call and 4-call ports: + # 3 * n_3 + 4 * n_4 = 41 and n_3 + n_4 = 13 + n_4 = s - 3 * W # 41 - 39 = 2 + n_3 = W - n_4 # 13 - 2 = 11 + assert n_4 == 2 and n_3 == 11 + assert 4 * n_4 + 3 * n_3 == 41 + + print("2. Primitive Port Partition Analysis:") + print(f" - 4-call primitive ports: n_4 = {n_4} (calls = {n_4 * 4})") + print(f" - 3-call primitive ports: n_3 = {n_3} (calls = {n_3 * 3})") + print(f" - Total paid calls: {n_4 * 4} + {n_3 * 3} = {s} calls across {W} ports") + print("-" * 80) + + # 3. Spectral Bounds & 13-Cycle Contraction + loop_gain = (1.0 / 2.0) ** 13 # (1/2)^13 = 1/8192 approx 0.00012207 + loop_gain_exact = Fraction(1, 8192) + cond_bound = (1.0 + float(loop_gain_exact)) / (1.0 - float(loop_gain_exact)) # 8193/8191 approx 1.000244 + + print("3. Spectral Bounds & 13-Cycle Contraction:") + print(f" - Intermediate coupler norms: ||G_k|| = 1/2 for all k = 0..12") + print(f" - 13-cycle loop gain: ||L_13|| <= (1/2)^13 = {loop_gain_exact} approx {loop_gain:.8f}") + print(f" - Cascade condition number: kappa(M_cascade) <= {cond_bound:.6f} <= 16 (Essentially Identity!)") + print("-" * 80) + + # 4. Construct Operators and Engine + t_ops0 = time.time() + ops = build_operators_m4() + K = ops["K"] + couplers = ops["couplers"] + E_ops = ops["E_ops"] + engine = Cascade13in41Engine(couplers) + t_ops = time.time() - t_ops0 + print(f"4. Cascade Engine Initialization: {t_ops:.4f}s") + print(f" - Inverted P_13 (16x16) over Q(i) with exact zero residual.") + print("-" * 80) + + # 5. Test Suite A: All 208 Canonical Basis Vectors + print("5. Test Suite A: Reconstructing all 208 Canonical Basis Vectors over Q(i)...") + t_basis0 = time.time() + basis_verified = 0 + + for idx in range(208): + blk = idx // 16 + offset = idx % 16 + V = [[ZERO] * 16 for _ in range(13)] + V[blk][offset] = ONE + + # Solve M_cascade * Y = V + Y = engine.solve(V) + + # Forward verification: M_cascade * Y == V + V_check = engine.forward_multiply(Y) + for b in range(13): + assert V_check[b] == V[b], f"Basis verification failed at basis {idx}, block {b}" + basis_verified += 1 + + t_basis = time.time() - t_basis0 + print(f" --> Successfully verified all {basis_verified}/208 canonical basis vectors in {t_basis:.3f}s!") + print(f" --> Exact Full Rank Certified: rank(M_cascade) = 208 / 208 over Q(i).") + print("-" * 80) + + # 6. Test Suite B: Random Gaussian Rational Array Targets + print("6. Test Suite B: Target Operator Recovery with Random Inputs over Q(i)...") + random.seed(4113) + random_tests_verified = 0 + t_rand0 = time.time() + + for test_idx in range(25): + # Generate random input arrays X_0, ..., X_12 in Q(i)^16 + X_arrays = [ + [q(random.randint(-15, 15), random.randint(-15, 15)) for _ in range(16)] + for _ in range(13) + ] + + # Target outputs: Y_true[k] = K X_k + Y_true = [mv(K, X_arrays[k]) for k in range(13)] + + # Schedule execution: Compute primary observations V_k + # v_k = K X_k + E_k X_{k+1} for k = 0..11 + # v_12 = K X_12 + E_12 X_0 + V_obs = [] + for k in range(12): + Ek_next = mv(E_ops[k], X_arrays[k + 1]) + V_obs.append([add(Y_true[k][i], Ek_next[i]) for i in range(16)]) + E12_X0 = mv(E_ops[12], X_arrays[0]) + V_obs.append([add(Y_true[12][i], E12_X0[i]) for i in range(16)]) + + # Solve for recovered targets Y_rec via engine + Y_rec = engine.solve(V_obs) + + # Assert exact equality: Y_rec == Y_true + for k in range(13): + for i in range(16): + assert Y_rec[k][i] == Y_true[k][i], ( + f"Mismatch on random test {test_idx}, array {k}, dim {i}: " + f"rec={Y_rec[k][i]} != true={Y_true[k][i]}" + ) + random_tests_verified += 1 + + t_rand = time.time() - t_rand0 + print(f" --> Successfully verified {random_tests_verified} random Gaussian rational test cases in {t_rand:.3f}s!") + print(f" --> Exact zero error on all recovered target vectors.") + print("=" * 80) + print("ALL 13-ARRAY 41-CALL SCHEDULE VERIFICATIONS PASSED (kappa = 17.14% certified).") + print("=" * 80) + + return { + "status": "PASS_13IN41_BOUNDARY_SCHEDULE", + "block_m": m, + "W_arrays": W, + "s_calls": s, + "state_dimension": W * n, + "saving_kappa": saving_ceiling, + "saving_pct": f"{saving_ceiling * 100:.2f}%", + "target_demand": total_demand, + "call_capacity": total_capacity, + "net_surplus_slack": surplus_ranks, + "capacity_efficiency": f"{efficiency:.5f}%", + "port_partition_n4": n_4, + "port_partition_n3": n_3, + "contraction_loop_gain": f"1/8192 approx {loop_gain:.8f}", + "cascade_condition_bound": cond_bound, + "rank_M_cascade": 208, + "canonical_basis_vectors_verified": basis_verified, + "random_test_cases_verified": random_tests_verified, + "exact_zero_error": True, + } + + +def main(): + import io, contextlib, json + f = io.StringIO() + with contextlib.redirect_stdout(f): + res = run_13in41_verification() + result = { + "W_arrays": res["W_arrays"], + "block_m": res["block_m"], + "call_capacity": res["call_capacity"], + "canonical_basis_vectors_verified": res["canonical_basis_vectors_verified"], + "capacity_efficiency": res["capacity_efficiency"], + "cascade_condition_bound": res["cascade_condition_bound"], + "contraction_loop_gain": res["contraction_loop_gain"], + "exact_zero_error": res["exact_zero_error"], + "net_surplus_slack": res["net_surplus_slack"], + "new_kappa": True, + "port_partition_n3": res["port_partition_n3"], + "port_partition_n4": res["port_partition_n4"], + "random_test_cases_verified": res["random_test_cases_verified"], + "rank_M_cascade": res["rank_M_cascade"], + "s_calls": res["s_calls"], + "saving_kappa": res["saving_kappa"], + "saving_pct": res["saving_pct"], + "state_dimension": res["state_dimension"], + "status": res["status"], + "target_demand": res["target_demand"] + } + print(json.dumps(result, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/complex-block-schedule-admission-audit/inputs/pr4826-verify_ports.py b/research/complex-block-schedule-admission-audit/inputs/pr4826-verify_ports.py new file mode 100644 index 0000000000..a455b4d546 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/inputs/pr4826-verify_ports.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python3 +"""Construction and Algebraic Verification of Block-5 (m=5) Port Primitives on V = C^32. + +Pushing the conditional integer multiplication frontier to kappa = 31.74%: + At block m=5, a 3-array 9-call schedule (W=3, s=9) achieves: + kappa = 1 - ln(9/3) / ln(5) = 1 - ln(3) / ln(5) = 0.31739... (31.74%!). + +Verifies: + 1. Coordinate swap involution T = SWAP(0, 4) satisfying T C_0 T = C_4 on C^32. + 2. Phase operator S e_x = i^popcount(x) e_x and conjugated letters: + - P = S U S, where U = CNOT(0 -> 4) + - Q = S V_01 S = Z_all V_01, where V_01 = SWAP(0, 1) + - Ratio R = P^-1 Q has exact order 4 (R^4 = I) + - Uniform all-width inverse identity (I + 2R)(I - 2R + 4R^2 - 8R^3) = -15 I. + 3. Exact Block-5 Residual Identity: + - Free monomial factor N acting on address space + - Three-call operator J = C_4 C_3 C_2 N + - P-branch: J (C_0 P C_0) = M C_4 C_3 C_2 + - Q-branch: J (C_0 Q C_0) = K, where K = C_4 C_3 C_2 C_1 C_0 is the canonical target + - Combined identity: J F = M C_4 C_3 C_2 + 2 K, where M is an exact free monomial. + 4. Block-5 3-Call Primitive Coupler: + - Coupler G = (1/2) X satisfies ||G|| = 1/2 and G K = K G. + 5. 3-Array 9-Call Schedule Budget: + - 3 ports of 3 calls each = 9 calls (saving 6 calls over classical 15). + - Sussman lower bound at m=5 (PR #4628): s >= 2.99172 W => s >= 8.975 => s_min = 9. + - Zero slack against the theoretical integer bound! + +Standard library only (fractions, math, json). Exact Q(i) arithmetic. +""" + +from __future__ import annotations +import json +import math +import time +from fractions import Fraction +from typing import Dict, List, Tuple + + +def q(real=0, imag=0) -> Tuple[Fraction, Fraction]: + return (Fraction(real), Fraction(imag)) + +ZERO, ONE, I = q(), q(1), q(0, 1) + +def add(x, y): return (x[0] + y[0], x[1] + y[1]) +def sub(x, y): return (x[0] - y[0], x[1] - y[1]) +def mul(x, y): return (x[0]*y[0] - x[1]*y[1], x[0]*y[1] + x[1]*y[0]) +def conj(x): return (x[0], -x[1]) +def div(x, y): + d = y[0]**2 + y[1]**2 + return ((x[0]*y[0] + x[1]*y[1])/d, (x[1]*y[0] - x[0]*y[1])/d) + +def scale_m(c, mat): return [[mul(c, v) for v in row] for row in mat] +def plus_m(a, b): return [[add(a[r][c], b[r][c]) for c in range(len(a[0]))] for r in range(len(a))] +def minus_m(a, b): return [[sub(a[r][c], b[r][c]) for c in range(len(a[0]))] for r in range(len(a))] + +def mm(a, b): + n, p, k_dim = len(a), len(b[0]), len(b) + out = [[ZERO for _ in range(p)] for _ in range(n)] + for r in range(n): + for k in range(k_dim): + if a[r][k] == ZERO: continue + for c in range(p): + if b[k][c] != ZERO: + out[r][c] = add(out[r][c], mul(a[r][k], b[k][c])) + return out + +def ident(n=32): return [[ONE if r == c else ZERO for c in range(n)] for r in range(n)] + +def shift_mat(v: int, n=32): + out = [[ZERO for _ in range(n)] for _ in range(n)] + for x in range(n): out[x ^ v][x] = ONE + return out + +def c_letter(bit: int, n=32): + sh = shift_mat(1 << bit, n) + id_n = ident(n) + a_coef = q(Fraction(1, 2), Fraction(1, 2)) + b_coef = q(Fraction(1, 2), Fraction(-1, 2)) + out = [[ZERO for _ in range(n)] for _ in range(n)] + for r in range(n): + for c in range(n): + out[r][c] = add(mul(a_coef, id_n[r][c]), mul(b_coef, sh[r][c])) + return out + + +def run_ports_verification() -> Dict: + I32 = ident(32) + C0 = c_letter(0, 32) + C1 = c_letter(1, 32) + C2 = c_letter(2, 32) + C3 = c_letter(3, 32) + C4 = c_letter(4, 32) + + # Canonical Target: K = C4 C3 C2 C1 C0 + K = mm(C4, mm(C3, mm(C2, mm(C1, C0)))) + + # Verify Unitarity of K + K_dag = [[conj(K[c][r]) for c in range(32)] for r in range(32)] + K_prod = mm(K_dag, K) + assert all(K_prod[r][c] == I32[r][c] for r in range(32) for c in range(32)), "K must be unitary" + + # Coordinate Swap Involution T = SWAP(0, 4) + T = [[ZERO for _ in range(32)] for _ in range(32)] + for x in range(32): + b0 = x & 1 + b4 = (x >> 4) & 1 + y = (x & ~(1 | 16)) | (b4 | (b0 << 4)) + T[y][x] = ONE + + T_dag = [[conj(T[c][r]) for c in range(32)] for r in range(32)] + assert mm(T, T) == I32, "T must be an involution" + assert mm(T, mm(C0, T)) == C4, "T C0 T must equal C4" + + # S gate on C^32 + i_powers = [ONE, I, q(-1), q(0, -1)] + S = [[ZERO for _ in range(32)] for _ in range(32)] + for x in range(32): + pop = bin(x).count('1') % 4 + S[x][x] = i_powers[pop] + + S_dag = [[conj(S[c][r]) for c in range(32)] for r in range(32)] + + # CNOT(0 -> 4) + U = [[ZERO for _ in range(32)] for _ in range(32)] + for x in range(32): + b0 = x & 1 + y = x ^ (b0 << 4) + U[y][x] = ONE + + # SWAP(0, 1) + V01 = [[ZERO for _ in range(32)] for _ in range(32)] + for x in range(32): + b0 = x & 1 + b1 = (x >> 1) & 1 + y = (x & ~3) | (b0 << 1) | b1 + V01[y][x] = ONE + + # Conjugated letters P = S U S_dag, Q = S V01 S_dag + P = mm(S, mm(U, S_dag)) + Q = mm(S, mm(V01, S_dag)) + + # Ratio R = P^-1 Q + P_inv = [[conj(P[c][r]) for c in range(32)] for r in range(32)] + R = mm(P_inv, Q) + R2 = mm(R, R) + R4 = mm(R2, R2) + assert all(R4[r][c] == I32[r][c] for r in range(32) for c in range(32)), "R must have order 4 (R^4 = I)" + + # Two-call prefix F = C0 (P + 2 Q) C0 + P_plus_2Q = plus_m(P, scale_m(q(2), Q)) + F = mm(C0, mm(P_plus_2Q, C0)) + + # Three-call operator J = C4 C3 C2 N + N = [[ZERO for _ in range(32)] for _ in range(32)] + for x in range(32): + b0 = x & 1 + b1 = (x >> 1) & 1 + y = (x & ~3) | (b1) | (b0 << 1) + N[y][x] = ONE + + J = mm(C4, mm(C3, mm(C2, N))) + + # Verify Residual Identity: J F = M C4 C3 C2 + 2 K + JF = mm(J, F) + # Check that (JF - 2K) has the form M C4 C3 C2 + C432 = mm(C4, mm(C3, C2)) + two_K = scale_m(q(2), K) + residual = minus_m(JF, two_K) + + # Intermediate Coupler Norm Bound + # G = (1/2) X0 + X0 = shift_mat(1, 32) + G = scale_m(q(Fraction(1, 2)), X0) + G_dag = [[conj(G[c][r]) for c in range(32)] for r in range(32)] + GG = mm(G_dag, G) + quarter_I = scale_m(q(Fraction(1, 4)), I32) + assert all(GG[r][c] == quarter_I[r][c] for r in range(32) for c in range(32)), "||G|| must be exactly 1/2" + + saving_kappa = 1.0 - math.log(3.0) / math.log(5.0) + + return { + "status": "PASS_BLOCK5_THREE_IN_NINE_PORTS", + "block_size": 5, + "arrays": 3, + "paid_calls": 9, + "uncoupled_naive_calls": 15, + "saved_calls": 6, + "exponent_saving_kappa": saving_kappa, + "new_kappa": True, + "order_R": 4, + "coupler_norm": 0.5, + "loop_gain_3cycle": 0.125, + "condition_number_bound": 1.2857142857142858, + "sussman_lower_bound_ratio": 2.99172, + "schedule_call_ratio": 3.0, + "lower_bound_satisfied": True, + "exact_zero_error": True, + } + + +def main(): + res = run_ports_verification() + print(json.dumps(res, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/complex-block-schedule-admission-audit/inputs/pr4826-verify_schedule.py b/research/complex-block-schedule-admission-audit/inputs/pr4826-verify_schedule.py new file mode 100644 index 0000000000..ea1511ae49 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/inputs/pr4826-verify_schedule.py @@ -0,0 +1,319 @@ +#!/usr/bin/env python3 +"""Exact Synthesis & Algebraic Verification of the 3-Array 9-Call Schedule on Block m=5 (V = C^32). + +Breaking into the Block m=5 frontier to achieve saving exponent: + kappa = 1 - ln(9/3) / ln(5) = 1 - ln(3) / ln(5) ≈ 0.31739... (31.74%!). + +Theoretical Framework: + 1. Jacob Alan Sussman's lower bound theorem (PR #4628): + - At m=5, s >= 2.99172 W. + - For W=3 arrays, minimum required calls: ceil(3 * 2.99172) = ceil(8.975) = 9 calls! + - '3 in 9 at m=5' is explicitly identified in PR #4628 as open and mathematically allowed. + - Naive classical calls: 3 arrays * 5 calls/array = 15 calls. + - Saving: 15 - 9 = 6 calls (40.0% reduction in paid calls). + 2. Block-5 Primitives on V = C^32: + - Canonical rank-5 target K = C_4 C_3 C_2 C_1 C_0 on C^32 (dim = 32). + - Coordinate swap involution T = SWAP(0, 4) satisfying T C_0 T = C_4. + - Conjugated phase operators P = S U S, Q = S V_01 S = Z_all V_01. + - Ratio R = P^-1 Q has exact order 4: R^4 = I_32, with uniform inverse (I+2R)(I-2R+4R^2-8R^3) = -15 I_32. + - Exact residual identity: J F = M C_4 C_3 C_2 + 2 K, where J = C_4 C_3 C_2 N uses 3 paid calls, + and N and M are exact free monomial matrices. + 3. 3-Array 9-Call Symmetric Partition: + - 3 independent registers (x1, x2, x3) on C^32 (total state dimension 3 * 32 = 96). + - Symmetric budget of 3 calls per port (3 + 3 + 3 = 9 calls): + * Port 1 (3 calls on x1, x2): v1 = K x1 + E1 x2, t1 = C0 x1 + * Port 2 (3 calls on x2, x3): v2 = K x2 + E2 x3, t2 = C0 x2 + * Port 3 (3 calls on x3, x1): v3 = K x3 + E3 x1, t3 = C0 x3 + 4. Contractive Couplers & Strictly Bounded Condition Number: + - Intermediate couplers G_k = K^-1 E_k = (1/2) X_k satisfy G_k^dagger G_k = (1/4) I_32 (||G_k|| = 1/2). + - 3-cycle loop operator L_3 = G1 G2 G3 = (1/8) X_012 satisfies L_3^dagger L_3 = (1/64) I_32. + - Loop gain: ||L_3|| = (1/2)^3 = 1/8 = 0.125 << 1. + - Condition number bound: kappa <= (1 + 1/8) / (1 - 1/8) = 9/7 ≈ 1.2857 <= 16. + 5. Exact Algebraic Invertibility: + - M_cascade (96x96 cyclic matrix) has exact rank 96 / 96 over Q(i). + - O_primary (96x96 primary observation) has exact rank 96 / 96 over Q(i). + - O_full (192x96 total observation) has exact rank 96 / 96 over Q(i). + - Target reconstruction error = 0 across canonical basis, random inputs, and swap sectors. + +Standard library only (fractions.Fraction, math, random, json, time). Exact Q(i) arithmetic. +""" + +from __future__ import annotations +import json +import math +import random +import time +from fractions import Fraction +from typing import Dict, List, Tuple + + +def q(real=0, imag=0) -> Tuple[Fraction, Fraction]: + return (Fraction(real), Fraction(imag)) + +ZERO, ONE, I = q(), q(1), q(0, 1) + +def add(x, y): return (x[0] + y[0], x[1] + y[1]) +def sub(x, y): return (x[0] - y[0], x[1] - y[1]) +def mul(x, y): return (x[0]*y[0] - x[1]*y[1], x[0]*y[1] + x[1]*y[0]) +def conj(x): return (x[0], -x[1]) +def div(x, y): + d = y[0]**2 + y[1]**2 + return ((x[0]*y[0] + x[1]*y[1])/d, (x[1]*y[0] - x[0]*y[1])/d) + +def scale_m(c, mat): return [[mul(c, v) for v in row] for row in mat] +def plus_m(a, b): return [[add(a[r][c], b[r][c]) for c in range(len(a[0]))] for r in range(len(a))] +def minus_m(a, b): return [[sub(a[r][c], b[r][c]) for c in range(len(a[0]))] for r in range(len(a))] + +def mm(a, b): + n, p, k_dim = len(a), len(b[0]), len(b) + out = [[ZERO for _ in range(p)] for _ in range(n)] + for r in range(n): + for k in range(k_dim): + if a[r][k] == ZERO: continue + for c in range(p): + if b[k][c] != ZERO: + out[r][c] = add(out[r][c], mul(a[r][k], b[k][c])) + return out + +def mv(mat, vec): + n, k_dim = len(mat), len(vec) + out = [ZERO for _ in range(n)] + for r in range(n): + s = ZERO + for c in range(k_dim): + if mat[r][c] != ZERO and vec[c] != ZERO: + s = add(s, mul(mat[r][c], vec[c])) + out[r] = s + return out + +def ident(n=32): return [[ONE if r == c else ZERO for c in range(n)] for r in range(n)] + +def shift_mat(v: int, n=32): + out = [[ZERO for _ in range(n)] for _ in range(n)] + for x in range(n): out[x ^ v][x] = ONE + return out + +def c_letter(bit: int, n=32): + sh = shift_mat(1 << bit, n) + id_n = ident(n) + a_coef = q(Fraction(1, 2), Fraction(1, 2)) + b_coef = q(Fraction(1, 2), Fraction(-1, 2)) + out = [[ZERO for _ in range(n)] for _ in range(n)] + for r in range(n): + for c in range(n): + out[r][c] = add(mul(a_coef, id_n[r][c]), mul(b_coef, sh[r][c])) + return out + +def solve_linear_system_q(A: List[List[Tuple[Fraction, Fraction]]], b: List[Tuple[Fraction, Fraction]]): + n = len(A) + aug = [list(A[r]) + [b[r]] for r in range(n)] + for col in range(n): + piv = -1 + for row in range(col, n): + if aug[row][col] != ZERO: + piv = row + break + if piv == -1: raise ValueError(f"Singular system at column {col}") + if piv != col: aug[col], aug[piv] = aug[piv], aug[col] + piv_val = aug[col][col] + for c in range(col, n + 1): aug[col][c] = div(aug[col][c], piv_val) + for r in range(n): + if r != col and aug[r][col] != ZERO: + factor = aug[r][col] + for c in range(col, n + 1): + aug[r][c] = sub(aug[r][c], mul(factor, aug[col][c])) + return [aug[r][n] for r in range(n)] + +def matrix_rank_q(mat: List[List[Tuple[Fraction, Fraction]]]) -> int: + m, n = len(mat), len(mat[0]) + aug = [list(row) for row in mat] + rank = 0 + for col in range(n): + piv = -1 + for row in range(rank, m): + if aug[row][col] != ZERO: + piv = row + break + if piv == -1: continue + if piv != rank: aug[rank], aug[piv] = aug[piv], aug[rank] + piv_val = aug[rank][col] + for c in range(col, n): aug[rank][c] = div(aug[rank][c], piv_val) + for r in range(m): + if r != rank and aug[r][col] != ZERO: + factor = aug[r][col] + for c in range(col, n): + aug[r][c] = sub(aug[r][c], mul(factor, aug[rank][c])) + rank += 1 + if rank == m: break + return rank + + +def run_3in9_schedule_verification() -> Dict: + m = 5 + W = 3 + s = 9 + naive_calls = 15 + saved_calls = 6 + saving_kappa = 1.0 - math.log(3.0) / math.log(5.0) + + I32 = ident(32) + C0 = c_letter(0, 32) + C1 = c_letter(1, 32) + C2 = c_letter(2, 32) + C3 = c_letter(3, 32) + C4 = c_letter(4, 32) + + # Canonical Target: K = C4 C3 C2 C1 C0 + K = mm(C4, mm(C3, mm(C2, mm(C1, C0)))) + + # Intermediate Couplers on axes 0, 1, 2 + half = q(Fraction(1, 2)) + G1 = scale_m(half, shift_mat(1, 32)) + G2 = scale_m(half, shift_mat(2, 32)) + G3 = scale_m(half, shift_mat(4, 32)) + + E1 = mm(K, G1) + E2 = mm(K, G2) + E3 = mm(K, G3) + + # Construct M_cascade (96 x 96) + ZERO_32 = [[ZERO for _ in range(32)] for _ in range(32)] + M_cascade = [[ZERO for _ in range(96)] for _ in range(96)] + for r in range(32): + for c in range(32): + M_cascade[0 + r][0 + c] = I32[r][c] + M_cascade[0 + r][32 + c] = G1[r][c] + M_cascade[32 + r][32 + c] = I32[r][c] + M_cascade[32 + r][64 + c] = G2[r][c] + M_cascade[64 + r][0 + c] = G3[r][c] + M_cascade[64 + r][64 + c] = I32[r][c] + + # Construct O_primary (96 x 96) + O_primary = [[ZERO for _ in range(96)] for _ in range(96)] + for r in range(32): + for c in range(32): + O_primary[0 + r][0 + c] = K[r][c] + O_primary[0 + r][32 + c] = E1[r][c] + O_primary[32 + r][32 + c] = K[r][c] + O_primary[32 + r][64 + c] = E2[r][c] + O_primary[64 + r][0 + c] = E3[r][c] + O_primary[64 + r][64 + c] = K[r][c] + + # Construct O_full (192 x 96) + O_full = [[ZERO for _ in range(96)] for _ in range(192)] + for r in range(96): + for c in range(96): + O_full[r][c] = O_primary[r][c] + for r in range(32): + for c in range(32): + O_full[96 + r][0 + c] = C0[r][c] + O_full[128 + r][32 + c] = C0[r][c] + O_full[160 + r][64 + c] = C0[r][c] + + # 1. Exact Matrix Ranks over Q(i) + rank_M = matrix_rank_q(M_cascade) + rank_O_prim = matrix_rank_q(O_primary) + rank_O_full = matrix_rank_q(O_full) + + assert rank_M == 96, f"M_cascade rank mismatch: {rank_M} != 96" + assert rank_O_prim == 96, f"O_primary rank mismatch: {rank_O_prim} != 96" + assert rank_O_full == 96, f"O_full rank mismatch: {rank_O_full} != 96" + + # 2. Contraction & Condition Bounds + loop_gain = Fraction(1, 8) + cond_bound_neumann = float((1 + loop_gain) / (1 - loop_gain)) # 9/7 ≈ 1.2857 + + # 3. Target Recovery Tests + test_cases = [] + # Test canonical basis vectors + for idx in [0, 1, 2, 3, 4, 31, 32, 33, 64, 95]: + reg = idx // 32 + base = idx % 32 + x = [[ZERO for _ in range(32)] for _ in range(3)] + x[reg][base] = ONE + test_cases.append((f"basis_{idx}", x[0], x[1], x[2])) + + # Test random Gaussian rational inputs + random.seed(4628) + for t in range(6): + x1 = [q(random.randint(-5, 5), random.randint(-5, 5)) for _ in range(32)] + x2 = [q(random.randint(-5, 5), random.randint(-5, 5)) for _ in range(32)] + x3 = [q(random.randint(-5, 5), random.randint(-5, 5)) for _ in range(32)] + test_cases.append((f"random_{t}", x1, x2, x3)) + + # Test swap sectors + T = [[ZERO for _ in range(32)] for _ in range(32)] + for x in range(32): + b0 = x & 1 + b4 = (x >> 4) & 1 + y = (x & ~(1 | 16)) | (b4 | (b0 << 4)) + T[y][x] = ONE + + for sigma in [(1, 1, 1), (-1, 1, -1), (1, -1, -1), (-1, -1, 1)]: + x_base = [q(random.randint(-3, 3), random.randint(-3, 3)) for _ in range(32)] + Tx = mv(T, x_base) + x1 = [add(x_base[i], scale_m(q(sigma[0]), [Tx])[0][i]) for i in range(32)] + x2 = [add(x_base[i], scale_m(q(sigma[1]), [Tx])[0][i]) for i in range(32)] + x3 = [add(x_base[i], scale_m(q(sigma[2]), [Tx])[0][i]) for i in range(32)] + test_cases.append((f"swap_sector_{sigma}", x1, x2, x3)) + + total_verified = 0 + for name, x1, x2, x3 in test_cases: + y1_true = mv(K, x1) + y2_true = mv(K, x2) + y3_true = mv(K, x3) + Y_true = y1_true + y2_true + y3_true + + # Primary observations + v1 = [add(k_v, e_v) for k_v, e_v in zip(y1_true, mv(E1, x2))] + v2 = [add(k_v, e_v) for k_v, e_v in zip(y2_true, mv(E2, x3))] + v3 = [add(k_v, e_v) for k_v, e_v in zip(y3_true, mv(E3, x1))] + V = v1 + v2 + v3 + + # Direct linear solve over Q(i) + Y_rec = solve_linear_system_q(M_cascade, V) + for yr, yt in zip(Y_rec, Y_true): + assert yr == yt, f"M_cascade recovery error on {name}" + + # State recovery from primary observation + X_rec = solve_linear_system_q(O_primary, V) + X_true = x1 + x2 + x3 + for xr, xt in zip(X_rec, X_true): + assert xr == xt, f"O_primary recovery error on {name}" + + # Target verification from recovered state + for k in range(3): + x_rec_k = X_rec[k * 32 : (k + 1) * 32] + y_rec_k = mv(K, x_rec_k) + y_true_k = Y_true[k * 32 : (k + 1) * 32] + assert y_rec_k == y_true_k, f"Target mismatch on array {k+1} in {name}" + + total_verified += 1 + + return { + "status": "PASS_BLOCK5_3IN9_CASCADE_SCHEDULE", + "block_m": m, + "W_arrays": W, + "s_calls": s, + "naive_calls": naive_calls, + "saved_calls": saved_calls, + "saving_kappa": saving_kappa, + "saving_pct": f"{saving_kappa * 100:.2f}%", + "loop_gain": float(loop_gain), + "condition_bound": cond_bound_neumann, + "rank_M_cascade": rank_M, + "rank_O_primary": rank_O_prim, + "rank_O_full": rank_O_full, + "total_test_cases_verified": total_verified, + "exact_zero_error": True, + "new_kappa": True, + } + + +def main(): + res = run_3in9_schedule_verification() + print(json.dumps(res, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/complex-block-schedule-admission-audit/verify.py b/research/complex-block-schedule-admission-audit/verify.py new file mode 100644 index 0000000000..eb741a8771 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/verify.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +"""Exact finite source-bound cascade audit. Apache-2.0, Clear1nsight with Codex.""" +import ast +from fractions import Fraction as F +import hashlib +import json +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parent + +def require(ok, message): + if not ok: + raise ValueError(message) + +def load(name): + path = ROOT / name + raw = path.read_bytes() + row = next(r for r in json.loads((ROOT/'ORIGINS.json').read_text()) if r['path'] == name) + require(hashlib.sha256(raw).hexdigest() == row['sha256'], 'source bytes differ: '+name) + ns = {'__name__': 'frozen_source'} + exec(compile(raw, str(path), 'exec'), ns) + return ns + +def source_prefix(ns, filename, function, stop_variable): + """Execute only literal source construction, stopping before expensive rank/test suite.""" + tree = ast.parse((ROOT/filename).read_bytes()) + fn = next(n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name == function) + prefix=[] + for stmt in fn.body: + if isinstance(stmt, ast.Assign) and any(isinstance(t, ast.Name) and t.id == stop_variable for t in stmt.targets): + break + prefix.append(stmt) + else: + raise ValueError('source construction boundary missing') + prefix.append(ast.Return(value=ast.Call(func=ast.Name(id='locals',ctx=ast.Load()),args=[],keywords=[]))) + fn.body = prefix + mod=ast.fix_missing_locations(ast.Module(body=[fn],type_ignores=[])) + exec(compile(mod,filename,'exec'),ns) + return ns[function]() + +def expected_couplers(n, shifts): + return [[[(F(1,2) if r == c^s else F(0), F(0)) for c in range(n)] for r in range(n)] for s in shifts] + +def apply_U(v,n,shifts): + w=len(shifts) + return [v[((k+1)%w)*n+(r^shifts[k])] for k in range(w) for r in range(n)] + +def norm2(v): return sum(x*x for x in v) + +def audit_cycle(n,shifts,declared): + w=len(shifts); total=0 + for s in shifts: total ^= s + require(w%2 == 1 and total != 0,'attaining-sector premise') + bit=total & -total + char=[(-1 if (x&bit) else 1) for x in range(n)] + signs=[1] + for s in shifts[:-1]: signs.append(-signs[-1]*(-1 if s&bit else 1)) + low=[a*x for a in signs for x in char] + high=[1]*(w*n) + require(apply_U(low,n,shifts)==[-x for x in low],'minus eigenvector') + require(apply_U(high,n,shifts)==high,'plus eigenvector') + Ucols=[((k+1)%w)*n+(r^shifts[k]) for k in range(w) for r in range(n)] + require(sorted(Ucols)==list(range(w*n)),'U must be permutation') + low_image=[x+F(y,2) for x,y in zip(low,apply_U(low,n,shifts))] + high_image=[x+F(y,2) for x,y in zip(high,apply_U(high,n,shifts))] + lo=norm2(low_image)/norm2(low);hi=norm2(high_image)/norm2(high) + require(lo==F(1,4) and hi==F(9,4),'exact extremal norm witnesses') + require(hi/lo > declared*declared,'claimed full-cascade bound not refuted') + # Negative controls: sign omission and false bound must actually reject. + require(apply_U(high,n,shifts)!=[-x for x in high],'invalid minus vector accepted') + require(F(3)>declared,'invalid condition certificate accepted') + return {'dimension':w*n,'shifts':shifts,'xor':total,'low_block_signs':signs, + 'character_bit':bit,'norm_squared':'9/4','inverse_norm_squared':'4', + 'condition_number':'3','rejected_bound':str(declared)} + +def run(): + a=load('inputs/pr4818-verify_schedule.py')['build_operators_m4']() + b=load('inputs/pr4819-verify_schedule.py')['build_operators_m4']() + cns=load('inputs/pr4826-verify_schedule.py') + c=source_prefix(cns,'inputs/pr4826-verify_schedule.py','run_3in9_schedule_verification','rank_M') + require([a[k]for k in ['G1','G2','G3']]==expected_couplers(16,[1,2,4]),'4818 literal couplers') + require(b['couplers']==expected_couplers(16,list(range(1,14))),'4819 literal couplers') + require([c[k]for k in ['G1','G2','G3']]==expected_couplers(32,[1,2,4]),'4826 literal couplers') + cases={'4818':audit_cycle(16,[1,2,4],F(9,7)), + '4819':audit_cycle(16,list(range(1,14)),F(8193,8191)), + '4826':audit_cycle(32,[1,2,4],F(9,7))} + # Confirm #4826's actually assembled M, not just its couplers. + M=c['M_cascade'];n=32;shifts=[1,2,4] + for r in range(96): + for col in range(96): + wanted=F(int(r==col))+F(int(col==((r//n+1)%3)*n+((r%n)^shifts[r//n])),2) + require(M[r][col]==(wanted,F(0)),'4826 actual cascade mismatch') + # #4826 residual claim is TRUE at this width, although its verifier does not assert it. + pns=load('inputs/pr4826-verify_ports.py') + p=source_prefix(pns,'inputs/pr4826-verify_ports.py','run_ports_verification','saving_kappa') + mm=pns['mm'];conj=pns['conj'];zero=pns['ZERO'];C=p['C432'] + Cd=[[conj(C[col][r])for col in range(32)]for r in range(32)] + mono=mm(p['residual'],Cd) + require(all(sum(x!=zero for x in row)==1 for row in mono),'residual left multiplier not monomial') + require(all(sum(mono[r][col]!=zero for r in range(32))==1 for col in range(32)),'residual multiplier column') + require(all(z==zero or z[0]*z[0]+z[1]*z[1]==1 for row in mono for z in row),'residual multiplier phases') + require(mm(mono,C)==p['residual'],'residual identity') + # #4813 sector cancellation is not an arbitrary-input cancellation. + d=load('inputs/pr4813-verify_schedule.py');ops=d['load_operators']() + actual=d['word'](ops['H'],d['plus'](ops['B'],d['scale'](d['q'](-1),d['word'](ops['M'],ops['T'],ops['A'])))) + diff=d['plus'](actual,d['scale'](d['q'](-1),ops['K'])) + witness=next((r,col,v)for r,row in enumerate(diff)for col,v in enumerate(row)if v!=d['ZERO']) + # Source test assumes a swap sign for an entire bank; generic e_col does not satisfy it. + r,col,v=witness + require(any(ops['T'][j][col] != (d['ONE'] if j==col else d['ZERO'])for j in range(8)),'not a non-sector witness') + return {'status':'PASS_COMPLEX_BLOCK_SCHEDULE_ADMISSION_AUDIT','new_kappa':False, + 'cascade_condition':cases,'block5_residual_identity':'finite width-one confirmed', + 'block3_plus_sector_misuse':{'row':r,'input_basis_column':col,'difference':[str(v[0]),str(v[1])]}, + 'controls': ['false cascade bound rejected','wrong extremal vector rejected','source hashes checked'], + 'scope':'finite literal matrices plus written permutation-cycle norm proof; no call optimum or complete multiplier'} + +if __name__=='__main__': + result=run() + encoded=json.dumps(result,sort_keys=True,indent=2)+'\n' + if '--write-result' in sys.argv: + (ROOT/'RESULT.json').write_text(encoded) + else: + require(encoded==(ROOT/'RESULT.json').read_text(),'receipt mismatch') + print(result['status']) From acd3384454083d4eb673343eb7762877d43e5394 Mon Sep 17 00:00:00 2001 From: d3lerium Date: Fri, 23 Oct 2026 08:43:37 +1100 Subject: [PATCH 2/2] Bind all cascade implementations and reject corrupted exported inputs --- .../HANDOFF.md | 2 +- .../PR-DRAFT.md | 37 +++++++++++++++++++ .../PROOF.md | 4 +- .../README.md | 2 +- .../VERIFY.json | 10 +++++ .../mutation_check.py | 36 ++++++++++++++++++ .../verify.py | 36 +++++++++++++----- 7 files changed, 113 insertions(+), 14 deletions(-) create mode 100644 research/complex-block-schedule-admission-audit/PR-DRAFT.md create mode 100644 research/complex-block-schedule-admission-audit/mutation_check.py diff --git a/research/complex-block-schedule-admission-audit/HANDOFF.md b/research/complex-block-schedule-admission-audit/HANDOFF.md index c14439ced7..e2bf470e43 100644 --- a/research/complex-block-schedule-admission-audit/HANDOFF.md +++ b/research/complex-block-schedule-admission-audit/HANDOFF.md @@ -1,6 +1,6 @@ # Handoff: actual shared-register realization before κ accounting -Status: exact finite endpoint conditioning correction and one sector misuse witness complete locally; publication coordinated by parent. No new κ. +Status: exact finite endpoint conditioning correction and one conditional-rule misuse witness complete locally; publication coordinated by parent. No new κ. The most promising distinct constructive test is #4813's first two overlapping native ports, because its local two-/three-call operators come from the documented #4743 interface. Compose those two ports on the actual current five-bank state, track every independent original input, and compare with the alleged observations. Either emit the necessary preservation/restoration work and price it, or exhibit the first failed bank substitution. Do not repeat the full rank solve on ideal observations. For #4826 a genuine three-call port is an earlier missing gate; its valid residual identity alone uses a two-call prefix plus a three-call operator. diff --git a/research/complex-block-schedule-admission-audit/PR-DRAFT.md b/research/complex-block-schedule-admission-audit/PR-DRAFT.md new file mode 100644 index 0000000000..9db9527163 --- /dev/null +++ b/research/complex-block-schedule-admission-audit/PR-DRAFT.md @@ -0,0 +1,37 @@ +## Change and mathematical scope + +Exact finite audit and elementary norm proof: the complete cyclic observation matrices proposed in #4818, #4819 and #4826 have sharp Euclidean condition number **3** (norm3/2 and inverse norm2). Their reported9/7 and8193/8191 bounds control a loop closure factor; they do not bound the complete cascade. Invertibility and the weaker bound16 survive. + +The package also gives a concrete counterexample to using #4813's conditional plus-swap-sector cancellation on a general input: e1 produces coordinate-zero error−(1+i)/4. This describes a conditional-rule misuse, not a claim that the source asserts the conditional identity without its premise. A positive exact check confirms #4826's monomial residual factorization at its literal32-coordinate width. + +Only `research/complex-block-schedule-admission-audit/` is added. No paid-call optimum, new κ or selected-frontier change follows. Actual chronological call realization, all-input ownership and restoration, raw inverse transpose, all-width lift, finite work/precision, complete caller and compiler/outer transfer remain open. Source matrix construction and injective recovery are not a priced physical word. + +## Task and overlap + +Base `624de9dc66858af0945e5f8a0942488d62280d43`; task `complex-rank-shape-decoder`, priority revision7. Scope changed by explicit assignment to auditing newly proposed small-unit schedules before using their headline savings. + +Audited heads: #4813 `f982ecc06826e7087e69b9468d3ff52589fd0822`; #4818 `fd29d065bbe12f5be5af02fdf5a8b4d86dda3381`; #4819 `a7b42c2f8ffe5a18d305ca4dda5729d2f1d72ea8`; #4826 `d7b53d3992e658f0dd49d0207ba33bbc39272bac`. Five unchanged source files are retained, with original Git blobs, exact hashes and immutable URLs in ORIGINS.json; no unmerged Git object is required at runtime. + +Bounded live PR-body queries and all four comment timelines were checked; no comments were present. #4828's exact sharp conditioning result concerns #4743's two-bank port and explicitly excludes these cascades. #4835 concerns a characteristic-zero finite-test kernel. This work checks different concrete matrices. The heads and canonical main were refreshed unchanged at2026-10-22 21:42 UTC. This is not exhaustive novelty or unpublished-work coverage; refresh discussions before taking the handoff. + +## Validation + +```sh +python3 -I -B research/complex-block-schedule-admission-audit/verify.py +python3 -I -O -B research/complex-block-schedule-admission-audit/verify.py +python3 -I -B research/complex-block-schedule-admission-audit/mutation_check.py +python3 -B scripts/research_package.py --package research/complex-block-schedule-admission-audit +python3 -B scripts/check_research_commit.py --package research/complex-block-schedule-admission-audit --check-source-history +``` + +Local environment: Python3.12.3, Linux. Exact eigenvector witnesses attain both norm bounds. Every entry of the48- and96-square assembled matrices and all208 columns of the thirteen-bank forward method are compared to an independently evaluated permutation cycle. Source constructors are reused and disclosed; source bytes are authenticated before execution, and AST prefixes use those same authenticated bytes. The source's complete rank/test suites are not replayed. + +Actual separate-process mutations reject a changed retained-source byte and a false `new_kappa` receipt in a temporary Git-free export under optimized Python. The scientific checker uses explicit exceptions. No Lean, all-size native replay, complete compiler, selected-frontier scientific replay, hosted CI or independent human review is claimed. + +## Credit + +Prepared for Chris R / Clear1nsight with substantial OpenAI Codex assistance, Apache-2.0. Credit hexapode for the audited proposals; Dugongue #4743, Yiyang/Lyy-iiis #4710, lee-phys #4688 and Jacob Alan Sussman #4628 for the retained construction/bound lineage. Nick Petalas #4828 addresses the distinct complete-port conditioning question. The norm method is elementary; the result is its exact application to these literal source matrices. + +## Open next questions + +See `HANDOFF.md` and README. The smallest constructive next test is the chronological composition of #4813's first two overlapping native ports on actual shared banks, tracking all original inputs and charging preservation/restoration. For #4826 the earlier missing witness is a real three-call two-bank primitive containing the proposed rank-five target, with its dirty companion output and costs. A successful word then needs complete-caller pricing and funded compiler/outer transfer. diff --git a/research/complex-block-schedule-admission-audit/PROOF.md b/research/complex-block-schedule-admission-audit/PROOF.md index 587ba1b667..0ce3fc5eda 100644 --- a/research/complex-block-schedule-admission-audit/PROOF.md +++ b/research/complex-block-schedule-admission-audit/PROOF.md @@ -14,7 +14,7 @@ Thus M is invertible, ||M||<=3/2, ||M^-1||<=2 and cond_2(M)<=3. This is an endpo Both inequalities are attained. The all-ones vector has Uv=v. For the lower extreme, take the address character h(x)=(-1)^(x_0) and block signs a_0=1, a_(k+1)=-(-1)^(s_k bit0) a_k. Because W is odd and the xor of all shifts has bit zero set (7,1,7 in the three cases), this recurrence closes around the cycle. Then z_k=a_k h satisfies Uz=-z. Hence Mv=(3/2)v and Mz=(1/2)z. Exact norms are 3/2 and inverse norm2, so the sharp condition number is3. -For both three-cycles the low signs are (1,1,-1). For the thirteen-cycle they are (1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1). These are literal integer witnesses on the actual finite address spaces; RESULT.json records them. The checker verifies the permutation bijection and both eigenvector equations independently, after comparing every source coupler to the specified permutation matrix. It also compares every entry of #4826's actually assembled 96-square M. +For both three-cycles the low signs are (1,1,-1). For the thirteen-cycle they are (1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1). These are literal integer witnesses on the actual finite address spaces; RESULT.json records them. The checker verifies the permutation bijection and both eigenvector equations independently, after comparing every source coupler to the specified permutation matrix. It also compares every entry of #4818's assembled 48-square and #4826's assembled 96-square matrices, and all 208 input columns of #4819's actual forward method. The small loop norm 2^-W controls a Schur complement I +/- (product G_k) after elimination. Elimination/back substitution also acts on the full vector; its norms cannot be discarded. Therefore (1+2^-W)/(1-2^-W) is not a valid bound for cond(M). This refutes9/7 and8193/8191 as **full-cascade** bounds while preserving invertibility and the weaker bound16. No condition claim is made here for #4813's different observation model or for the overdetermined O_full matrices. @@ -28,7 +28,7 @@ For a plus-swap-sector input, C2 x = T A x; thus H(B-M0 T A)x=Kx. This implicati [H(B-M0 T A)-K]_(0,1) = -(1+i)/4. -The checker also verifies Te_1 != e_1. This is a counterexample to applying that fixed plus-sector rule to all inputs. It is **not** a disproof of sector splitting with its copies, recombination, calls and storage charged, nor of another all-input decoder. #4813's test suite supplies known sector signs and forms ideal Kx+Ex observations directly. It does not emit a full shared-bank word that maintains those independent original inputs across overlapping ports. Dense Gaussian elimination followed by K on the recovered x is an algebraic recovery check; its operation price needs a separate admissible realization. +The checker also verifies Te_1 != e_1. This is a counterexample to the hypothetical misuse of that conditional plus-sector rule on all inputs. It does not assert that the source states this conditional identity without its sector premise; the source admission gap is its absent complete shared-bank word. It is **not** a disproof of sector splitting with its copies, recombination, calls and storage charged, nor of another all-input decoder. #4813's test suite supplies known sector signs and forms ideal Kx+Ex observations directly. It does not emit a full shared-bank word that maintains those independent original inputs across overlapping ports. Dense Gaussian elimination followed by K on the recovered x is an algebraic recovery check; its operation price needs a separate admissible realization. ## 3. Positive block-5 check and remaining realization boundary diff --git a/research/complex-block-schedule-admission-audit/README.md b/research/complex-block-schedule-admission-audit/README.md index d997446424..e9122a8cbb 100644 --- a/research/complex-block-schedule-admission-audit/README.md +++ b/research/complex-block-schedule-admission-audit/README.md @@ -29,7 +29,7 @@ python3 -I -O -B research/complex-block-schedule-admission-audit/verify.py python3 -B scripts/research_package.py --package research/complex-block-schedule-admission-audit ``` -Expected: `PASS_COMPLEX_BLOCK_SCHEDULE_ADMISSION_AUDIT`. RESULT.json records exact witnesses. `--write-result` explicitly regenerates that receipt. Ordinary checks are read-only. Checks stay active under optimized Python. The predecessor constructors contain assertions; this audit's independent comparison and rejection predicates use explicit exceptions. No original complete native suite, Lean, full phase proof, compiler, hosted CI or independent human review is claimed. +Expected: `PASS_COMPLEX_BLOCK_SCHEDULE_ADMISSION_AUDIT`. RESULT.json records exact witnesses. `--write-result` explicitly regenerates that receipt. Ordinary checks are read-only. `mutation_check.py` copies the package to a temporary Git-free directory, runs optimized Python with no tools on PATH, corrupts a retained source byte and then the scientific receipt in separate subprocesses, and requires both mutations to be rejected. Original package bytes remain untouched. Checks stay active under optimized Python. The predecessor constructors contain assertions; this audit's independent comparison and rejection predicates use explicit exceptions. No original complete native suite, Lean, full phase proof, compiler, hosted CI or independent human review is claimed. ## Open next questions diff --git a/research/complex-block-schedule-admission-audit/VERIFY.json b/research/complex-block-schedule-admission-audit/VERIFY.json index b399625beb..5ff1f64cc0 100644 --- a/research/complex-block-schedule-admission-audit/VERIFY.json +++ b/research/complex-block-schedule-admission-audit/VERIFY.json @@ -31,6 +31,16 @@ ], "timeout_seconds": 120, "checks": "Same scientific predicates remain active under optimized Python" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/mutation_check.py" + ], + "timeout_seconds": 120, + "checks": "Actual exported source-byte and scientific receipt corruption must reject in separate optimized Git-free subprocesses" } ] } diff --git a/research/complex-block-schedule-admission-audit/mutation_check.py b/research/complex-block-schedule-admission-audit/mutation_check.py new file mode 100644 index 0000000000..320900b84c --- /dev/null +++ b/research/complex-block-schedule-admission-audit/mutation_check.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +"""Actual isolated exported-byte rejection controls, Apache-2.0.""" +import json +import os +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile + +ROOT=Path(__file__).resolve().parent + +def require(ok,why): + if not ok: raise ValueError(why) + +with tempfile.TemporaryDirectory(prefix='cascade-audit-controls-') as temp: + dst=Path(temp)/'package' + shutil.copytree(ROOT,dst,ignore=shutil.ignore_patterns('__pycache__')) + cmd=[sys.executable,'-I','-O','-B',str(dst/'verify.py')] + env=dict(os.environ,PATH='/nonexistent') + def run(): return subprocess.run(cmd,cwd=temp,env=env,capture_output=True,text=True,timeout=120) + baseline=run() + require(baseline.returncode==0,'Git-free optimized baseline failed: '+baseline.stderr) + source=dst/'inputs/pr4826-verify_ports.py';original=source.read_bytes() + source.write_bytes(original+b'\n') + changed=run() + require(changed.returncode!=0 and 'source bytes differ' in changed.stderr,'source-byte mutation accepted') + source.write_bytes(original) + receipt=dst/'RESULT.json';original_receipt=receipt.read_bytes() + data=json.loads(original_receipt);data['new_kappa']=True + receipt.write_text(json.dumps(data,sort_keys=True,indent=2)+'\n') + changed=run() + require(changed.returncode!=0 and 'receipt mismatch' in changed.stderr,'scientific receipt mutation accepted') + receipt.write_bytes(original_receipt) + require(source.read_bytes()==original and receipt.read_bytes()==original_receipt,'failed restoration') +print('PASS_CASCADE_AUDIT_EXPORT_MUTATIONS source_corruption=REJECT receipt_corruption=REJECT git_free_optimized=PASS') diff --git a/research/complex-block-schedule-admission-audit/verify.py b/research/complex-block-schedule-admission-audit/verify.py index eb741a8771..3edc250c43 100644 --- a/research/complex-block-schedule-admission-audit/verify.py +++ b/research/complex-block-schedule-admission-audit/verify.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 """Exact finite source-bound cascade audit. Apache-2.0, Clear1nsight with Codex.""" import ast +import contextlib +import io from fractions import Fraction as F import hashlib import json @@ -18,13 +20,13 @@ def load(name): raw = path.read_bytes() row = next(r for r in json.loads((ROOT/'ORIGINS.json').read_text()) if r['path'] == name) require(hashlib.sha256(raw).hexdigest() == row['sha256'], 'source bytes differ: '+name) - ns = {'__name__': 'frozen_source'} + ns = {'__name__': 'frozen_source', '__authenticated_source_bytes__': raw} exec(compile(raw, str(path), 'exec'), ns) return ns def source_prefix(ns, filename, function, stop_variable): """Execute only literal source construction, stopping before expensive rank/test suite.""" - tree = ast.parse((ROOT/filename).read_bytes()) + tree = ast.parse(ns['__authenticated_source_bytes__']) fn = next(n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name == function) prefix=[] for stmt in fn.body: @@ -75,8 +77,12 @@ def audit_cycle(n,shifts,declared): 'condition_number':'3','rejected_bound':str(declared)} def run(): - a=load('inputs/pr4818-verify_schedule.py')['build_operators_m4']() - b=load('inputs/pr4819-verify_schedule.py')['build_operators_m4']() + ans=load('inputs/pr4818-verify_schedule.py') + a=ans['build_operators_m4']() + with contextlib.redirect_stdout(io.StringIO()): + literal_a=source_prefix(ans,'inputs/pr4818-verify_schedule.py','run_3in10_synthesis','rank_M') + bns=load('inputs/pr4819-verify_schedule.py') + b=bns['build_operators_m4']() cns=load('inputs/pr4826-verify_schedule.py') c=source_prefix(cns,'inputs/pr4826-verify_schedule.py','run_3in9_schedule_verification','rank_M') require([a[k]for k in ['G1','G2','G3']]==expected_couplers(16,[1,2,4]),'4818 literal couplers') @@ -85,12 +91,22 @@ def run(): cases={'4818':audit_cycle(16,[1,2,4],F(9,7)), '4819':audit_cycle(16,list(range(1,14)),F(8193,8191)), '4826':audit_cycle(32,[1,2,4],F(9,7))} - # Confirm #4826's actually assembled M, not just its couplers. - M=c['M_cascade'];n=32;shifts=[1,2,4] - for r in range(96): - for col in range(96): - wanted=F(int(r==col))+F(int(col==((r//n+1)%3)*n+((r%n)^shifts[r//n])),2) - require(M[r][col]==(wanted,F(0)),'4826 actual cascade mismatch') + # Compare both assembled matrices to the independent permutation model. + for M,n,shifts in [(literal_a['M_cascade'],16,[1,2,4]),(c['M_cascade'],32,[1,2,4])]: + dim=len(M) + for r in range(dim): + for col in range(dim): + wanted=F(int(r==col))+F(int(col==((r//n+1)%3)*n+((r%n)^shifts[r//n])),2) + require(M[r][col]==(wanted,F(0)),'actual assembled cascade mismatch') + # #4819 supplies a forward method rather than materializing M: replay all columns. + engine=bns['Cascade13in41Engine'](b['couplers']) + for col in range(208): + blocks=[[(F(int(k*16+r==col)),F(0)) for r in range(16)] for k in range(13)] + got=engine.forward_multiply(blocks) + for k in range(13): + for r in range(16): + wanted=F(int(k*16+r==col))+F(int(((k+1)%13)*16+(r^(k+1))==col),2) + require(got[k][r]==(wanted,F(0)),'4819 actual forward cascade mismatch') # #4826 residual claim is TRUE at this width, although its verifier does not assert it. pns=load('inputs/pr4826-verify_ports.py') p=source_prefix(pns,'inputs/pr4826-verify_ports.py','run_ports_verification','saving_kappa')