From 82553cf6f369459e18d00fb4e6bda808d5f10ce1 Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Fri, 20 Nov 2026 17:40:47 +1100 Subject: [PATCH] Prove a linear parity-mixing requirement for Gaussian rounders below half-unit outward slack --- .../PR-DESCRIPTION.md | 59 +++ .../gaussian-forward-parity-flux/PROOF.md | 273 ++++++++++++ .../gaussian-forward-parity-flux/README.md | 146 +++++++ .../gaussian-forward-parity-flux/RESULT.json | 121 ++++++ .../REVIEW-RESULT.json | 19 + .../gaussian-forward-parity-flux/REVIEW.md | 36 ++ .../gaussian-forward-parity-flux/SOURCES.json | 61 +++ .../gaussian-forward-parity-flux/TASK.json | 118 ++++++ .../gaussian-forward-parity-flux/VERIFY.json | 46 +++ .../review_original.py | 86 ++++ .../gaussian-forward-parity-flux/verify.py | 390 ++++++++++++++++++ 11 files changed, 1355 insertions(+) create mode 100644 research/gaussian-forward-parity-flux/PR-DESCRIPTION.md create mode 100644 research/gaussian-forward-parity-flux/PROOF.md create mode 100644 research/gaussian-forward-parity-flux/README.md create mode 100644 research/gaussian-forward-parity-flux/RESULT.json create mode 100644 research/gaussian-forward-parity-flux/REVIEW-RESULT.json create mode 100644 research/gaussian-forward-parity-flux/REVIEW.md create mode 100644 research/gaussian-forward-parity-flux/SOURCES.json create mode 100644 research/gaussian-forward-parity-flux/TASK.json create mode 100644 research/gaussian-forward-parity-flux/VERIFY.json create mode 100644 research/gaussian-forward-parity-flux/review_original.py create mode 100644 research/gaussian-forward-parity-flux/verify.py diff --git a/research/gaussian-forward-parity-flux/PR-DESCRIPTION.md b/research/gaussian-forward-parity-flux/PR-DESCRIPTION.md new file mode 100644 index 0000000000..a8e3f1a579 --- /dev/null +++ b/research/gaussian-forward-parity-flux/PR-DESCRIPTION.md @@ -0,0 +1,59 @@ +## Result + +Any total injective error-one Hadamard/Gaussian rounder with forward +radial slack below one half must change infinitely many inputs whose +ideal images are already integral. The proof gives a quantitative bound: +at slack at most 3/10, at least \(8m\) even-sum inputs of norm at most +\(4m+2\) must change, for every \(m\geq0\). + +In exact half-grid coordinates, an odd-width cube has equal input/output +color counts but eight inaccessible output corners. Each parity-changing +exit forces a nearby exact-valued input to change. If \(K_N\) counts +these changes by transformed output cube, the result is + +\[ +K_{N+2}-K_{N-2}\geq8 +\quad\text{when}\quad +\delta\frac{1-\delta^2}{1-2\delta}. +\tag{5} +\] +Then, for every integer \(m\geq0\), +\[ +K_{N_0-2+4m}\geq K_{N_0-2}+8m\geq8m. +\tag{6} +\] +At least \(8m\) changed even inputs consequently lie in the Euclidean ball +of radius \(N_0-1+4m\). + +Thus improving global forward slack below one half requires infinitely +many changes to points whose ideal images are already integral. Their +number grows at least linearly along the explicit sequence in (6). +A finite modification on that class cannot suffice. + +**Corollary 2 (the exact-on-integral subclass).** Every total injective +error-one rounder that leaves all integral ideal images unchanged has +forward radial supremum at least \(1/2\). The construction in +[CrocSwap/integer-mult-bounds#7569](https://github.com/CrocSwap/integer-mult-bounds/pull/7569), +at commit 26226aa52337e6e94bc0cdf3cf6b89d16bb42f5f, is a bijection in this +subclass with forward supremum \(1/2\). Using that explicitly cited upper +construction, the subclass optimum is exactly \(1/2\). +The lower theorem in this package is self-contained. + +**Example.** If \(\delta\leq3/10\), take \(N_0=3\): at least \(8m\) +changed even inputs have norm at most \(4m+2\), for every \(m\geq0\). +This applies to any global extension at the finite threshold +\(\sqrt{78}-\sqrt{73}<3/10\) from #7571/#7651. It neither constructs +such an extension nor rules it out. + +## 2. Exact lattice coordinates + +Integer matrix multiplication gives \(U^T=U\), \(U^2=I\), \(R^T=R\), +\(R^2=I\) and \(ER=U\). For \(s=(1,-1,-1,1)^T\), +\(R=I-ss^T/2\). + +Split the half-grid \(L_h=(\mathbb Z+1/2)^4\) into +\[ +A=\{t:\sum_i t_i\text{ is odd}\},\qquad +B=\{t:\sum_i t_i\text{ is even}\}. +\] +The sum is integral. These are exact bijections: + +| Map | Domain | Image | +| --- | --- | --- | +| \(U\) | \(Z_0\) | \(Z_0\) | +| \(R\) | \(Z_1\) | \(A\) | +| \(E^T\) | \(Z_1\) | \(B\) | +| \(E^T\) | \(Z_0\) | \(Z_0\) | + +For the first row, the coordinates of \(Hx\) have parity \(\sum x_i\), +\(\sum(Ux)_i=2x_0\), and \(U^2=I\). The last row follows because \(J\) +preserves \(Z_0\). For \(R\), \(s^Tx\) is odd on \(Z_1\), and +\(\sum(Rx)_i=\sum x_i\). Conversely, for \(t\in A\), \(s^Tt\) is odd +and \(Rt\in Z_1\). For \(E^T=UJ\), an odd-sum integer input becomes +half-integral with even coordinate sum. Conversely, if +\(t=(1/2,\ldots,1/2)+z\in B\), then \(z\in Z_0\) and +\(Ut=e_0+Uz\in Z_1\); \(J\) preserves that parity. + +For an odd input \(x\), put \(t=Rx\in A\). Equation (1) becomes +\[ +\|E^TF(x)-t\|\leq1,\qquad +\|E^TF(x)\|-\|t\|\leq\delta. +\tag{7} +\] +If \(F(x)\in Z_1\), its transformed output \(v\) lies in \(B\). +The difference \(v-t\) is integral, nonzero, and has norm at most one, +so \(v=t\pm e_i\). If \(F(x)\in Z_0\), its transformed output \(z\) +is integral. All coordinates of \(z-t\) are half-integral; (7) forces +each to be \(+1/2\) or \(-1/2\). + +For an even input \(e\), its integer output is either \(Ue\), or +\(Ue\pm e_i\in Z_1\). Thus, in the error-one class, preserving total +parity is equivalent to leaving all integral ideal images unchanged. + +## 3. Two finite cube facts + +Write \(A_N=A\cap C_N\), \(B_N=B\cap C_N\). Each coordinate has \(N+1\) +choices, and reflection of one coordinate reverses color. Therefore +\[ +|A_N|=|B_N|=(N+1)^4/2. +\tag{8} +\] +Exactly eight of the sixteen corners belong to \(B\); denote them by +\(Q_N\). A corner with \(k\) negative coordinates has sum \(N(2-k)\), +which is even exactly when \(k\) is even. + +**No odd-output escape.** A unit edge from \(t\in A_N\) to +\(B\setminus C_N\) changes one coordinate's magnitude from \(N/2\) to +\(N/2+1\). Its squared-radius increase is \(N+1\). As \(\|t\|\leq N\), +the radial increase is at least +\[ +b_N=\sqrt{N^2+N+1}-N>1/2. +\tag{9} +\] +The final inequality follows from +\((N+1/2)^2=N^2+N+1/40\), and squaring shows +\[ +\delta1-\delta^2. +\] +Thus (3) holds for every odd \(N\geq N_0\) under (5). Apply (4) at +\(N=N_0,N_0+4,\ldots,N_0+4(m-1)\) and telescope to get (6). +For a changed input counted by \(K_M\), +\[ +\|e\|=\|Ue\|\leq\|F(e)\|+1 +=\|E^TF(e)\|+1\leq M+1. +\] +This proves the input-ball count. + +At \(\delta=3/10\), the right side of (5) is \(91/40<3\). +Also \(\sqrt{78}-\sqrt{73}=5/(\sqrt{78}+\sqrt{73})<3/10\), since +the denominator exceeds \(17>50/3\). + +The theorem is a necessary condition, not a sufficient matching. +The linear count is not claimed sharp. It does not establish the +unrestricted forward optimum, a positive limiting density of changed +points, a physical time lower bound, or failure of all-lattice +attainment at the finite threshold. + +## 6. Gaussian transfer, novelty and credit + +For the ideal pair \(C_+\) in #6509, in real coordinates +\((\Re x,\Im x,\Re y,\Im y)\), signed permutations +\[ +S(a,b,c,d)=(a,-b,c,d),\quad L(a,b,c,d)=(a,c,-d,b) +\] +satisfy \(U=LC_+S\). Thus \(F_H(x)=L F_C(Sx)\) transfers error, +injectivity, forward slack, total parity and the class of integral ideal +images exactly. The cube count uses the stated transformed coordinates; +it is not a literal axis-aligned Gaussian input-cube assertion. + +This supplies a scoped obstruction for the forward-only question left +open in #7569 and the radius-independent Hall question in #7651. +The exact-sum optimum \(1/\sqrt2\) in #7696 and finite-iterate refinements +#7714/#7743 impose additional hypotheses. They do not settle this +unrestricted matching problem. + +The universal proof uses finite counting and exact orthogonal coordinates. +Executable checks corroborate local geometry, strict boundaries and a +finite unrestricted control; finite exhaustion is not the universality +argument. All five selected multiplication assumptions remain. No new +\(\kappa\), complete native caller, tape/storage tariff or multiplication +theorem is supplied. + +Credit Jerry Chen / @CubeJerry's #7569 for the half-grid coordinates and +upper construction; #7571 and Nick Petalas's #7651 for the unrestricted +finite Hall problem; Ali Romman's #6509 for the Gaussian pair and #7696 +for the distinct exact-sum result; Nick Petalas's #6619 and ywz65's #2589 +for the preceding radial obstruction questions. The new work is the +cube-corner count, its injective two-edge charge, and the linear forced +parity-mixing conclusion. Prepared with substantial OpenAI assistance; +no human or formal-kernel acceptance is claimed. diff --git a/research/gaussian-forward-parity-flux/README.md b/research/gaussian-forward-parity-flux/README.md new file mode 100644 index 0000000000..923f3ac612 --- /dev/null +++ b/research/gaussian-forward-parity-flux/README.md @@ -0,0 +1,146 @@ +# A parity-mixing requirement for smaller forward Gaussian rounding slack + +**Any total injective error-one rounder for the four-coordinate Hadamard +map that beats one half in forward radial slack must change infinitely +many inputs whose ideal images are already integral.** The required +changes satisfy an explicit linear count. For forward slack at most +3/10, at least \(8m\) even-sum inputs of norm at most \(4m+2\) must change, +for every integer \(m\geq0\). + +This is a universal necessary condition for the unrestricted all-lattice +problem. It rules out repairing only finitely many exact-valued inputs. +It does not settle the unrestricted optimum, construct a new rounder, +or supply a fixed-tape cost lower bound. + +## Exact result + +Let \(U=H_4/2\). A total injection \(F:\mathbb Z^4\to\mathbb Z^4\) +must satisfy, at every input, +\[ +\|F(x)-Ux\|_2\leq1,\qquad +\|F(x)\|_2-\|x\|_2\leq\delta<1/2. +\] +With \(E=\operatorname{diag}(1,1,1,-1)U\), let \(K_N\) count even-sum +inputs changed from their exact ideal images whose transformed outputs +\(E^TF(x)\) lie in \([-N/2,N/2]^4\). The theorem is +\[ +K_{N+2}-K_{N-2}\geq8 +\quad\hbox{if }N\geq3\hbox{ is odd and } +\delta= 8. The cutoff algebra and telescoping +then give the stated input-ball count. Strictness at the corner threshold +is essential. The theorem does not contradict finite matchings because +they need not contain all charged even inputs. + +`review_original.py` was written by the root without importing the +author's verifier. It reconstructs original odd integer inputs from +half-grid cubes, enumerates all sixteen nearest integer outputs, and +checks forward slack with integer inequalities. It checks 49,664 +two-edge charges, complete neighbor unions at N=3 and N=5, forbidden +escapes at one half, and a counterexample to using the unexpanded cube. +Its executed receipt is `REVIEW-RESULT.json`. + +The independent implementation shares the elementary mathematical +coordinates specified by the theorem; it is not a formal-kernel proof +or independent human acceptance. The primary finite matching is useful +corroboration, not the reason the universal theorem holds. + +The novelty boundary is appropriate: a linear necessary parity-mixing +count, not a proof of the unrestricted optimum, an infinite matching, +a positive-density theorem, a physical lower bound, or a selected-caller +assumption discharge. No new kappa is established. + +Reviewed for Jerry Chen / @CubeJerry with substantial OpenAI assistance. diff --git a/research/gaussian-forward-parity-flux/SOURCES.json b/research/gaussian-forward-parity-flux/SOURCES.json new file mode 100644 index 0000000000..3076108146 --- /dev/null +++ b/research/gaussian-forward-parity-flux/SOURCES.json @@ -0,0 +1,61 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "AGENTS.md", + "usage": "provenance", + "git_blob": "ff81117fca368042f6092964d1f54eb4e6e08fb9", + "sha256": "fece32cdec9c1572ddce354a0b623459cb2c4ca162125d36d36262a92e3caa83" + }, + { + "path": "CONTRIBUTING.md", + "usage": "provenance", + "git_blob": "5185786f2ec00f215019fb5777d70979429690a9", + "sha256": "fcd1a8d0e52342a23b8ffa9e905e85ccc539fb084145ef016dfc93cedfb3d924" + } + ], + "external_references": [ + { + "repository": "CubeJerry/integer-mult-bounds", + "head": "26226aa52337e6e94bc0cdf3cf6b89d16bb42f5f", + "path": "research/global-bilateral-half-gaussian-rounding/proof/PROOF.md", + "pr": 7569, + "role": "Cited half-grid coordinates and prior upper construction; lower theorem is self-contained; no runtime import." + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "head": "3c7c3e8000f592fd9adecb44008ff6d5ae5d453d", + "path": "research/sharp-finite-gaussian-outward-slack/PROOF.md", + "pr": 7571, + "role": "Prior unrestricted finite Hall question and signed-permutation Gaussian transfer; no runtime import." + }, + { + "repository": "petalas/integer-mult-bounds", + "head": "4bcd4ecd13647798baa7ee6b95dd5e48ef1319ed", + "path": "research/gaussian-outward-radius24", + "pr": 7651, + "role": "Prior radius-24 finite attainment and open radius-independent matching question; no runtime import." + }, + { + "repository": "aliromman/integer-mult-bounds", + "head": "d7be8d9131a948ea1d25833e96906ea3da979764", + "path": "research/gaussian-exact-sum-global-optimum", + "pr": 7696, + "role": "Overlap exclusion: distinct exact-sum optimum, not a mathematical premise." + } + ], + "runtime_inputs": "None outside the package; provenance is checked by the repository replay hook." +} diff --git a/research/gaussian-forward-parity-flux/TASK.json b/research/gaussian-forward-parity-flux/TASK.json new file mode 100644 index 0000000000..60c9bd31b4 --- /dev/null +++ b/research/gaussian-forward-parity-flux/TASK.json @@ -0,0 +1,118 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose one assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Prove a quantitative necessary parity-mixing condition for total injective error-one Hadamard/Gaussian rounding with forward radial slack below one half.", + "scope_change_reason": "Explicit assigned continuation of #7569's unrestricted forward-only question; #7651 already covers radius-24 attainment. This is a generic precision-interface obstruction, not the catalogue card's selected-caller assumption discharge.", + "bottleneck_link": "Relates to precision_tape and analytic_recovery by identifying an unavoidable change to exact-valued inputs in any proposed sub-half-unit rounder. No selected caller or tariff is established.", + "stop_rule": "Stop at a universal cube-cut/transport theorem. Do not extend finite radius tables or infer the unrestricted global optimum.", + "evidence": "PROOF.md supplies the universal counting argument; verify.py independently enumerates original-coordinate local neighborhoods and a finite unrestricted matching with negative/equality controls.", + "author": "Jerry Chen / @CubeJerry", + "ai_assistance": "Substantial OpenAI assistance; proof authoring and primary finite verification by an agent, with root cross-review recorded separately when completed. No human or formal-kernel acceptance.", + "outcome": "completed", + "open_questions": [ + { + "question": "Can a global error-one injection attain unrestricted forward slack sqrt(78)-sqrt(73)?", + "why_it_matters": "The radius-24 certificate supplies finite attainability; the present theorem specifies a necessary all-lattice parity-mixing mechanism.", + "first_step": "Construct or exclude a radius-independent injection that performs the forced cross-parity exchanges and satisfies every cube cut.", + "blocked_by": "The annular count is necessary only; it neither supplies all Hall inequalities nor constructs a matching." + }, + { + "question": "Can the forced parity mixing be implemented within one actual selected caller's numerical and ownership contracts?", + "why_it_matters": "A generic lattice rounder does not discharge precision_tape or analytic_recovery at a selected caller.", + "first_step": "Name an actual caller that tolerates changes at integral ideal images and record its algebraic identities, inverse, range, ownership and full cost.", + "blocked_by": "No such caller or complete physical budget is supplied by this package." + } + ], + "allocation": { + "wave": 1, + "track": 65, + "scope": "unrestricted Gaussian forward rounding; parity-mixing obstruction", + "source_pin": "26226aa52337e6e94bc0cdf3cf6b89d16bb42f5f" + }, + "overlap": { + "checked_utc": "2026-11-20T06:16:00Z", + "coverage": "Targeted live PR keyword searches and exact metadata for named predecessors; no exhaustive private/local-branch or Discussion coverage claimed.", + "queries": [ + "forward rounding", + "forward-only", + "Hadamard rounding", + "rounding parity-preserving", + "rounding integral images", + "rounding parity slack" + ], + "related_prs": [ + 7569, + 7571, + 7651, + 7652, + 7673, + 7696, + 7698, + 7699, + 7714, + 7743 + ], + "excluded_work": "No radius expansion, exact-sum optimum, finite-iterate optimum, or exact-period construction repeated." + } +} diff --git a/research/gaussian-forward-parity-flux/VERIFY.json b/research/gaussian-forward-parity-flux/VERIFY.json new file mode 100644 index 0000000000..ffa043e888 --- /dev/null +++ b/research/gaussian-forward-parity-flux/VERIFY.json @@ -0,0 +1,46 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "{package}/verify.py" + ], + "timeout_seconds": 60, + "checks": "Exact original-coordinate geometry, cube Hall cuts, equality boundaries, two-edge charge, cutoff algebra, and independent finite matching checks." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "-W", + "error", + "{package}/verify.py" + ], + "timeout_seconds": 60, + "checks": "Same finite mathematical and negative controls under optimization; verifier uses explicit exceptions, not assertions." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "{package}/review_original.py" + ], + "timeout_seconds": 30, + "checks": "Independent original-coordinate edge enumeration, exact radial inequalities and two-edge charging controls; no primary verifier imports." + } + ] +} diff --git a/research/gaussian-forward-parity-flux/review_original.py b/research/gaussian-forward-parity-flux/review_original.py new file mode 100644 index 0000000000..5ac562c187 --- /dev/null +++ b/research/gaussian-forward-parity-flux/review_original.py @@ -0,0 +1,86 @@ +"""Independent check in original integer coordinates; no verifier imports.""" +import itertools +import json + +H = ((1,1,1,1),(1,-1,1,-1),(1,1,-1,-1),(1,-1,-1,1)) +S = (1,-1,-1,1) + + +def require(condition, message): + if not condition: + raise RuntimeError(message) + + +def dot(a, b): + return sum(x*y for x,y in zip(a,b)) + + +def norm2(a): + return dot(a,a) + + +def transform2(y): + jy = (*y[:3], -y[3]) + return tuple(dot(row,jy) for row in H) + + +def radial(x, y, num, den): + a, b = norm2(y), norm2(x) + if a <= b: + return True + left = (a-b)*den*den-num*num + return left <= 0 or left*left <= 4*num*num*den*den*b + + +def run(): + require(all(dot(H[i],H[j]) == 4*(i==j) for i in range(4) for j in range(4)), "orthogonality") + receipts, charges, escape_counterexample = [], 0, False + for n in (3,5): + cube = list(itertools.product(range(-n,n+1,2),repeat=4)) + aa = [t for t in cube if sum(t)%4 == 2] + bb = {t for t in cube if sum(t)%4 == 0} + corners = {t for t in bb if all(abs(v)==n for v in t)} + require(len(aa)==len(bb) and len(corners)==8, "cube balance") + reached, excluded_escapes = set(), 0 + for t in aa: + numer = tuple(2*t[i]-S[i]*dot(S,t) for i in range(4)) + require(all(v%4==0 for v in numer), "inverse coordinate integrality") + x = tuple(v//4 for v in numer) + require(sum(x)%2==1 and 4*norm2(x)==norm2(t), "original odd input") + hx = tuple(dot(row,x) for row in H) + for bits in itertools.product((0,1),repeat=4): + y = tuple(hx[j]//2+bits[j] for j in range(4)) + require(sum((2*y[j]-hx[j])**2 for j in range(4))==4, "error-one choices") + z = transform2(y) + if sum(y)%2: + require(sorted(abs(z[j]-t[j]) for j in range(4))==[0,0,0,2], "unit edge") + if z not in bb: + require(not radial(x,y,1,2), "outward escape below half") + excluded_escapes += 1 + if radial(x,y,3,10): + require(z in bb and z not in corners, "forbidden corner or escape") + reached.add(z) + else: + e2 = tuple(dot(row,y) for row in H) + require(all(v%2==0 for v in e2), "charged input integrality") + e = tuple(v//2 for v in e2) + require(sum(e)%2==0 and e!=x, "distinct even charge") + for axis in range(4): + for sign in (-1,1): + out = list(y) + out[axis] += sign + v = transform2(tuple(out)) + require(max(abs(v[j]-t[j]) for j in range(4))<=2, "two-edge bound") + require(max(map(abs,v))<=n+2, "expanded cube") + escape_counterexample |= max(map(abs,v))>n + charges += 1 + require(reached == bb-corners, "complete finite neighbor union") + receipts.append({"N":n,"odd_inputs":len(aa),"available_neighbors":len(reached),"excluded_escapes":excluded_escapes}) + require(escape_counterexample, "same-cube negative control was vacuous") + require(not radial((1,0,0,0),(2,0,0,0),1,2), "radial rejection control") + return {"status":"PASS_INDEPENDENT_ORIGINAL_COORDINATES","cubes":receipts, + "two_edge_choices":charges,"same_cube_claim_rejected":True} + + +if __name__ == "__main__": + print(json.dumps(run(),sort_keys=True,indent=2)) diff --git a/research/gaussian-forward-parity-flux/verify.py b/research/gaussian-forward-parity-flux/verify.py new file mode 100644 index 0000000000..37008f0e95 --- /dev/null +++ b/research/gaussian-forward-parity-flux/verify.py @@ -0,0 +1,390 @@ +#!/usr/bin/env python3 +"""Exact finite corroboration of the written parity-flux theorem. + +The universal claim is proved in PROOF.md, not inferred from these cases. +No predecessor executable, floating point, network or external package is used. +""" +from collections import deque +from fractions import Fraction +from hashlib import sha256 +from itertools import product +import json + +H = ((1, 1, 1, 1), (1, -1, 1, -1), + (1, 1, -1, -1), (1, -1, -1, 1)) +J = (1, 1, 1, -1) +S = (1, -1, -1, 1) +UNITS = tuple(tuple(sign if i == j else 0 for i in range(4)) + for j in range(4) for sign in (-1, 1)) + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def add(x, y): + return tuple(a + b for a, b in zip(x, y)) + + +def norm2(x): + return sum(a * a for a in x) + + +def mv(matrix, x): + return tuple(sum(a * b for a, b in zip(row, x)) for row in matrix) + + +def divide(x, denominator): + require(all(a % denominator == 0 for a in x), "nonintegral division") + return tuple(a // denominator for a in x) + + +def ideal_even(x): + return divide(mv(H, x), 2) + + +def transformed_output2(y): + """2 E^T y, in original integer input/output coordinates.""" + return mv(H, tuple(a * b for a, b in zip(J, y))) + + +def original_odd_input(t2): + """R(t2/2), using 4x = 2t2 - s(s^T t2).""" + dot = sum(a * b for a, b in zip(S, t2)) + return divide(tuple(2 * a - b * dot for a, b in zip(t2, S)), 4) + + +def original_odd_output(v2): + """E(v2/2), using 4y = J H v2.""" + return divide(tuple(a * b for a, b in zip(J, mv(H, v2))), 4) + + +def gap_leq(m, n, p, q): + """Decide sqrt(m)-sqrt(n) <= p/q exactly, for m,n,p>=0,q>0.""" + require(min(m, n, p) >= 0 and q > 0, "invalid root comparison") + if m <= n: + return True + a = (m - n) * q * q - p * p + return a <= 0 or a * a <= 4 * p * p * q * q * n + + +def integer_neighbors(x): + """Enumerate the complete error-one neighborhood in original coordinates.""" + h = mv(H, x) + choices = [range(-(-(a - 2) // 2), (a + 2) // 2 + 1) for a in h] + return tuple(y for y in product(*choices) + if sum((2 * b - a) ** 2 for a, b in zip(h, y)) <= 4) + + +def color(t2): + require(all(a % 2 for a in t2), "not a half-grid point") + return sum(t2) % 4 // 2 # 1=A, 0=B. + + +def in_cube(t2, n): + return max(map(abs, t2)) <= n + + +def is_corner(t2, n): + return all(abs(a) == n for a in t2) + + +def check_coordinates(): + eye4 = tuple(tuple(4 if i == j else 0 for j in range(4)) for i in range(4)) + require(tuple(mv(H, col) for col in H) == eye4, "H orthogonality") + count = 0 + for x in product(range(-3, 4), repeat=4): + ns = integer_neighbors(x) + if sum(x) % 2: + require(len(ns) == 16, "odd neighbor count") + require(sum(sum(y) % 2 == 0 for y in ns) == 8, "odd/even split") + t2 = tuple(2 * a - s * sum(b * c for b, c in zip(S, x)) + for a, s in zip(x, S)) + require(color(t2) == 1 and original_odd_input(t2) == x, + "odd source coordinates") + for y in ns: + v2 = transformed_output2(y) + d = tuple(a - b for a, b in zip(v2, t2)) + if sum(y) % 2: + require(color(v2) == 0 and norm2(d) == 4 + and sum(a != 0 for a in d) == 1, "odd unit edge") + else: + require(all(abs(a) == 1 for a in d), "mixed corner edge") + else: + u = ideal_even(x) + require(len(ns) == 9 and u in ns and sum(u) % 2 == 0, + "even neighborhood") + require(all(y == u or sum(y) % 2 for y in ns), "even change parity") + count += 1 + # U=L C+ S in the original Gaussian coordinate convention. + c2 = ((1, -1, 1, 1), (1, 1, -1, 1), + (1, 1, 1, -1), (-1, 1, 1, 1)) + c_right = tuple(tuple(a * s for a, s in zip(row, (1, -1, 1, 1))) + for row in c2) + lhs = (c_right[0], c_right[2], + tuple(-a for a in c_right[3]), c_right[1]) + require(lhs == H, "Gaussian signed-permutation transfer") + return count + + +def check_cubes(): + receipts = [] + mixed_edges = 0 + narrow_annulus_witness = None + for n in (3, 5, 7, 9): + pts = tuple(product(range(-n, n + 1, 2), repeat=4)) + aa = tuple(t for t in pts if color(t) == 1) + bb = {t for t in pts if color(t) == 0} + corners = {t for t in bb if is_corner(t, n)} + require(len(aa) == len(bb) == (n + 1) ** 4 // 2, "color capacity") + require(len(corners) == 8, "corner count") + actual_neighbors = set() + outside_edges = 0 + equality_edges = 0 + for t2 in aa: + x = original_odd_input(t2) + require(norm2(t2) == 4 * norm2(x), "source norm transport") + for y in integer_neighbors(x): + if sum(y) % 2: + v2 = transformed_output2(y) + if gap_leq(norm2(y), norm2(x), 3, 10): + require(in_cube(v2, n), "unexpected cube escape") + require(v2 not in corners, "unexpected admitted corner") + actual_neighbors.add(v2) + if not in_cube(v2, n): + outside_edges += 1 + require(not gap_leq(norm2(y), norm2(x), 1, 2), + "escape at half-unit slack") + if v2 in corners: + equality_edges += 1 + require(norm2(y) == n * n + and norm2(x) == n * n - n + 1, + "corner equality boundary") + elif n <= 5: + # Every possible second image of the charged even input, + # still in original coordinates; no asserted cube formula + # is used to construct these cases. + e = ideal_even(y) + require(sum(e) % 2 == 0 and ideal_even(e) == y, + "charged exact even input") + for u in UNITS: + ye = add(y, u) + v2 = transformed_output2(ye) + d = tuple(a - b for a, b in zip(v2, t2)) + require(all(a in (-2, 0, 2) for a in d), + "two-edge coordinate bound") + require(in_cube(v2, n + 2), "two-edge annulus") + if (narrow_annulus_witness is None + and not in_cube(v2, n) + and gap_leq(norm2(y), norm2(x), 3, 10) + and gap_leq(norm2(ye), norm2(e), 3, 10)): + narrow_annulus_witness = { + "N": n, "odd_input": x, "even_output": y, + "charged_even_input": e, "charged_output": ye, + "t2": t2, "v2": v2} + mixed_edges += 1 + require(equality_edges == 32, "all equality edges must be retained") + require(len(actual_neighbors) <= len(aa) - 8, "Hall deficit") + receipts.append({"N": n, "A": len(aa), "B": len(bb), + "complete_delta_3_10_neighbors": len(actual_neighbors), + "Hall_deficit": len(aa) - len(actual_neighbors), + "escaping_unit_edges_rejected_at_half": outside_edges, + "corner_edges_at_exact_threshold": equality_edges}) + require(narrow_annulus_witness is not None, + "no control for erroneous same-cube charging") + return receipts, mixed_edges, narrow_annulus_witness + + +def hopcroft_karp(adjacency): + """Deterministic finite matching search, used only for a positive control.""" + left_match = [-1] * len(adjacency) + right_match = {} + inf = len(adjacency) + 1 + while True: + dist = [inf] * len(adjacency) + queue = deque() + for u, v in enumerate(left_match): + if v < 0: + dist[u] = 0 + queue.append(u) + found = False + while queue: + u = queue.popleft() + for v in adjacency[u]: + mate = right_match.get(v) + if mate is None: + found = True + elif dist[mate] == inf: + dist[mate] = dist[u] + 1 + queue.append(mate) + if not found: + break + + def dfs(u): + for v in adjacency[u]: + mate = right_match.get(v) + if mate is None or (dist[mate] == dist[u] + 1 and dfs(mate)): + left_match[u] = v + right_match[v] = u + return True + dist[u] = inf + return False + + gained = sum(dfs(u) for u, v in enumerate(left_match) if v < 0) + require(gained > 0, "matching progress") + return left_match + + +def verify_matching(inputs, outputs): + require(len(outputs) == len(inputs) == len(set(inputs)), "matching domain") + require(len(set(outputs)) == len(outputs), "duplicate output") + for x, y in zip(inputs, outputs): + require(sum((2 * b - a) ** 2 for a, b in zip(mv(H, x), y)) <= 4, + "non-error-one matching edge") + require(gap_leq(norm2(y), norm2(x), 3, 10), "outward slack violation") + + +def expect_reject(fn, label): + try: + fn() + except ValueError: + return label + raise ValueError("control was accepted: " + label) + + +def finite_unrestricted_control(): + radius = 5 + inputs = tuple(x for x in product(range(-radius, radius + 1), repeat=4) + if norm2(x) <= radius * radius) + output_ids = {} + outputs = [] + adjacency = [] + fixed_adjacency = [] + for x in inputs: + row = [] + fixed = [] + for y in integer_neighbors(x): + if gap_leq(norm2(y), norm2(x), 3, 10): + if y not in output_ids: + output_ids[y] = len(outputs) + outputs.append(y) + row.append(output_ids[y]) + if sum(x) % 2 or y == ideal_even(x): + fixed.append(output_ids[y]) + adjacency.append(row) + fixed_adjacency.append(fixed) + assignment = hopcroft_karp(adjacency) + require(all(v >= 0 for v in assignment), "unrestricted finite control failed") + matched = tuple(outputs[v] for v in assignment) + verify_matching(inputs, matched) # Separate from the matching algorithm. + held = hopcroft_karp(fixed_adjacency) + held_size = sum(v >= 0 for v in held) + require(held_size < len(inputs), "exact-input restriction control failed") + f = dict(zip(inputs, matched)) + changed = {e: transformed_output2(y) + for e, y in f.items() if sum(e) % 2 == 0 and y != ideal_even(e)} + k = {n: sum(in_cube(v, n) for v in changed.values()) for n in (1, 3, 5)} + odd_cube = tuple(original_odd_input(t) for t in + product(range(-3, 4, 2), repeat=4) if color(t) == 1) + # Certify the restricted maximum independently of the search algorithm: + # adjoin every even exact source whose fixed output could be used by + # an odd cube input. The resulting explicit Hall set has deficiency 8. + exact_sources = {ideal_even(y) for x in odd_cube for y in integer_neighbors(x) + if sum(y) % 2 == 0 + and gap_leq(norm2(y), norm2(x), 3, 10)} + hall_inputs = set(odd_cube) | exact_sources + input_ids = {x: i for i, x in enumerate(inputs)} + require(hall_inputs <= set(inputs), "Hall closure outside finite ball") + hall_outputs = {v for x in hall_inputs + for v in fixed_adjacency[input_ids[x]]} + require(len(hall_inputs) - len(hall_outputs) == 8, "restricted Hall witness") + require(held_size == len(inputs) - 8, + "restricted matching does not attain its certified Hall upper bound") + exits = [x for x in odd_cube if sum(f[x]) % 2 == 0] + for x in exits: + e = ideal_even(f[x]) + require(e in f and e in changed and in_cube(changed[e], 5), + "finite closure for parity charge") + q3 = sum(is_corner(v, 3) for v in changed.values()) + require(len(exits) - k[3] + q3 >= 8, "finite capacity charge") + require(len(exits) <= k[5] and q3 <= k[3] - k[1], + "finite annular charges") + require(k[5] - k[1] >= 8, "finite flux bound") + duplicate = list(matched) + duplicate[1] = duplicate[0] + nonlocal_edge = list(matched) + nonlocal_edge[0] = add(nonlocal_edge[0], (4, 0, 0, 0)) + controls = [ + expect_reject(lambda: verify_matching(inputs, duplicate), "duplicate output"), + expect_reject(lambda: verify_matching(inputs, nonlocal_edge), "nonlocal edge"), + ] + pairs = [[list(x), list(y)] for x, y in zip(inputs, matched)] + digest = sha256(json.dumps(pairs, separators=(",", ":")).encode()).hexdigest() + return {"radius": radius, "inputs": len(inputs), + "unrestricted_matching_size": len(inputs), + "matching_with_all_even_inputs_fixed": held_size, + "restricted_Hall_inputs": len(hall_inputs), + "restricted_Hall_neighbors": len(hall_outputs), + "changed_even_inputs": len(changed), + "K": k, "O_3": len(exits), "q_3": q3, + "matching_sha256": digest, + "scope": "Finite positive/negative control; not an infinite map.", + "rejected_controls": controls} + + +def check_thresholds(): + cases = 0 + for q in range(1, 31): + for p in range((q - 1) // 2 + 1): + delta = Fraction(p, q) + if delta >= Fraction(1, 2): + continue + for n in range(3, 82, 2): + # c_N > delta is equivalent to sqrt(N²-N+1) < N-delta. + direct = Fraction(n * n - n + 1) < (n - delta) ** 2 + cutoff = n * (1 - 2 * delta) > 1 - delta * delta + require(direct == cutoff, "cutoff equivalence") + cases += 1 + require(not gap_leq(78, 73, 0, 1) and gap_leq(78, 73, 3, 10), + "finite-threshold comparison") + require(not gap_leq(9, 7, 3, 10), "N=3 strict corner exclusion") + # Large symbolic cutoffs exercise arbitrary integer size without enumeration. + for bits in (8, 32, 128, 512, 2048): + den = 1 << bits + delta = Fraction(1, 2) - Fraction(1, den) + threshold = (1 - delta * delta) / (1 - 2 * delta) + n = max(3, threshold.numerator // threshold.denominator + 1) + n += 1 - n % 2 + require(n * (1 - 2 * delta) > 1 - delta * delta, "large onset") + return cases + + +def main(): + coordinates = check_coordinates() + cubes, edge_count, annulus = check_cubes() + finite = finite_unrestricted_control() + thresholds = check_thresholds() + receipt = { + "status": "PASS_GAUSSIAN_FORWARD_PARITY_FLUX", + "claim": "Written all-input theorem; finite corroboration only here.", + "coordinate_inputs": coordinates, "cubes": cubes, + "two_edge_choices": edge_count, + "same_cube_charge_counterexample": annulus, + "finite_unrestricted_control": finite, + "rational_cutoff_cases": thresholds, + "large_integer_cutoff_bit_sizes": [8, 32, 128, 512, 2048], + "boundary_controls": [ + "At delta=c_N, all 32 corner incoming edges are admitted.", + "At delta=1/2, corner exclusion fails; no lower bound above 1/2.", + "Using C_N instead of C_(N+2) for the two-edge charge fails.", + "A finite unrestricted error-one injection has forward slack <=3/10.", + "Holding its exact even inputs fixed prevents a complete matching." + ], + "no_new_kappa": True + } + print(json.dumps(receipt, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main()