diff --git a/research/binary-dual-polar-cut-ceiling/PROOF.md b/research/binary-dual-polar-cut-ceiling/PROOF.md new file mode 100644 index 0000000000..e454ef4a2a --- /dev/null +++ b/research/binary-dual-polar-cut-ceiling/PROOF.md @@ -0,0 +1,178 @@ +# The exact binary dual-polar cut ratio at every rank + +This contribution was produced by Nick Petalas. Apache-2.0. + +## Statement and scope + +Let X be the Lagrangian subspaces of a nondegenerate alternating space of +dimension 2m over F2, where m is any positive integer. Put +d(L,M)=m-dim(L intersection M). Let A_i be the zero-one distance-i matrix, +k_i its row sum and T_i=A_i/k_i. A distance-i pair means a uniformly +chosen ordered pair at that distance. For S contained in X, define + + p_i(S) = Pr[exactly one endpoint of a distance-i pair belongs to S]. + +For every nonempty proper S, + + p_m(S) / p_1(S) <= K_m = 2 - 2^(1-m). (1) + +Point cuts S_v={L : v belongs to L}, for v nonzero, attain equality. Thus +K_m is the exact Boolean-cut optimum for every m. The unique nonconstant +adjacency eigenspace maximizing the spectral quotient is the first one. +This does not classify all attaining Boolean sets. + +Theorem 6 of Jacob Sussman's PR #4628, in +`author-evidence/induction-across-block-sizes.md`, explicitly leaves the +all-rank spectral comparison open after finite computations through rank 12. +The new step here is its universal proof. The graph, spectral-comparison +method, point-cut witness and coordinate-family interpretation are credited +predecessor context. No predecessor scientific executable is replayed. + +This limits a stated certificate family. It is neither a word lower bound +of K_m calls per array nor an obstruction to every kept-subspace certificate. +It supplies no physical program, new kappa or supplier admission. + +## 1. Intersection numbers + +Every neighbor of L is obtained by choosing a hyperplane H of L and one of +the two other Lagrangians over H in the symplectic plane H-perp/H. Hence +k_1=2(2^m-1). Fix another vertex Z and put R=L intersection Z, of dimension +m-i. There are 2^i-1 hyperplanes H of L containing R. Over each such H, +one alternative gains one dimension of intersection with Z and the other +keeps the intersection dimension. Indeed the pairing from Z to H has rank +i-1, so Z intersection H-perp has dimension m-i+1 and determines exactly +one alternative line over H. + +There are 2^m-2^i hyperplanes not containing R. The pairing from Z to H +then has rank i. Thus Z intersection H-perp=R, and either alternative +intersects Z in H intersection R, losing one dimension. Consequently + + c_i = 2^i-1, a_i = 2^i-1, + b_i = 2^(i+1)(2^(m-i)-1). (2) + +Here c_i,a_i,b_i count neighbors at distances i-1,i,i+1 from Z. The graph +is connected since c_i>0 whenever i>0. Transverse Lagrangians exist, so +its diameter is m. Double counting edges between distance spheres gives +k_i c_i=k_(i-1)b_(i-1), and in particular + + k_m = 2^(m(m+1)/2). (3) + +The distance matrices satisfy + + A_1 A_i = b_(i-1) A_(i-1) + a_i A_i + c_(i+1) A_(i+1), (4) + +with terms outside 0..m omitted. Since c_i>0 for 1<=i<=m, each A_i is +a degree-i polynomial in A_1. These m+1 matrices are linearly independent +because their supports are disjoint. At i=m, (4) gives a degree-(m+1) +polynomial annihilating A_1. Its minimal polynomial therefore has degree +m+1. Since A_1 is real symmetric, it has exactly m+1 distinct eigenvalues. + +## 2. Factored distance eigenvalues + +For 0<=j<=m define + + theta_j = 2^(m-j+1)-2^j-1, + F_j(z) = product_(r=1..m-j)(1+2^r z) + product_(r=0..j-1)(1-2^r z). + +Write P_i(j) for the coefficient of z^i in F_j. Empty products are one. +The telescoping products give the polynomial identity + + (1-z)(1+2z) F_j(2z) + = (1+2^(m-j+1)z)(1-2^j z) F_j(z). (5) + +This is a polynomial identity, with no division by a possibly zero factor. +Comparing coefficients and using (2) yields + + theta_j P_i(j) + = b_(i-1)P_(i-1)(j) + a_i P_i(j) + + c_(i+1)P_(i+1)(j), (6) + +again omitting outside terms. This includes the terminal equation i=m. +The initial value P_0(j)=1 and (4) uniquely determine every distance +eigenvalue from an adjacency eigenvalue. Equation (6) says each theta_j +is a root of the degree-(m+1) annihilating polynomial just constructed. +They are strictly decreasing, so they give its complete list of roots. +On the theta_j eigenspace, A_i has eigenvalue P_i(j). + +The leading coefficient of F_j and (3) give + + u_1(j) = theta_j / [2(2^m-1)], + u_m(j) = (-1)^j 2^(-j(m-j+1)), (7) + +the eigenvalues of T_1 and T_m. Indeed the leading-coefficient exponent +is `(m-j)(m-j+1)/2 + j(j-1)/2`; subtracting `m(m+1)/2` +gives `-j(m-j+1)`. + +The distance-regular graph spectrum is classical. Lee and Tanaka, +[SIGMA 14 (2018), 009, section 3](https://doi.org/10.3842/SIGMA.2018.009), +record the general intersection numbers and adjacency eigenvalues. The +binary factor/recurrence argument above makes the proof self-contained; +it does not extrapolate a finite table. + +## 3. Uniform maximization + +For j>=1, u_1(j)<1. The proposed bound satisfies + + K_m (1-u_1(j)) + = 2 - 2^(1-j) + (2^j-1)2^(-m). (8) + +At j=1, both (8) and 1-u_m(j) equal 1+2^(-m), so the quotient is K_m. +If j>=2, then m>=2 and + + j(m-j+1)-m = (j-1)(m-j) >= 0. + +Thus `1-u_m(j) <= 1+2^(-m) <= 5/4`, whereas (8) is strictly greater +than 3/2. The quotient is strictly less than K_m in every remaining +nonconstant sector. For m=1 there is only j=1. We have proved + + max_(1<=j<=m) (1-u_m(j))/(1-u_1(j)) = K_m. (9) + +This argument holds for every positive m, independently of the checker's +finite rank limits. + +## 4. Boolean cuts and sharpness + +Use the uniform inner product on functions on X. Decompose f=1_S into +mutually orthogonal adjacency eigenspaces, f=sum_j f_j. Symmetry and +regularity give + + p_i(S) = 2 + = 2 sum_(j>=1)(1-u_i(j)) ||f_j||^2. + +Apply (9) term by term. Connectedness gives p_1(S)>0 for every nontrivial +S, proving (1). A directed-exit convention multiplies both probabilities +by the same constant, leaving the ratio unchanged. + +The credited point-cut witness works at every rank. Each Lagrangian +contains 2^m-1 nonzero points, and the symplectic group is transitive on +the 2^(2m)-1 nonzero points. Thus the fraction containing a fixed point is +alpha=1/(2^m+1). Two transverse Lagrangians cannot both contain that point, +so p_m(S_v)=2alpha. From a Lagrangian containing v, exactly 2^(m-1) +hyperplanes omit v, and both alternatives over each such hyperplane omit +v. The conditional edge-exit probability is 2^m/[2(2^m-1)]. Edge reversal +therefore gives + + p_1(S_v) = 2alpha * 2^(m-1)/(2^m-1). + +The ratio is `(2^m-1)/2^(m-1)=K_m`, proving sharpness. At m=1, distance +one and distance m coincide, as the formula requires. + +## 5. Certificate consequence and limits + +A coordinate family assigns Y_L=span{e_x : x belongs to S(L)} in one +fixed finite coordinate basis, with constant dimension. Its directed +defect `dim(Y_L)-dim(Y_L intersection Y_M)` is a sum of Boolean-cut +exits over coordinates. Averaging over each distance relation turns this +into a sum of half the disagreement probabilities above. Consequently +the opposite-to-edge average-defect ratio is at most K_m whenever the +denominator is positive. Nonnegative sums obey the same ceiling. The +coordinates indexed by nonzero points, with membership v in L, give a +constant-dimension family attaining it. + +This is PR4628's coordinate-family application with the missing all-rank +premise supplied. It does not bound arbitrary noncoordinate subspaces, +temporal cuts, changed free-letter models or general physical circuits. +Supplier realization, ownership/restoration, compiler, precision/tape and +analytic recovery remain separate. No predecessor scientific replay, +selected cold replay, Lean build or Docker run is claimed. diff --git a/research/binary-dual-polar-cut-ceiling/README.md b/research/binary-dual-polar-cut-ceiling/README.md new file mode 100644 index 0000000000..cad7e0d1ea --- /dev/null +++ b/research/binary-dual-polar-cut-ceiling/README.md @@ -0,0 +1,131 @@ +# The sharp binary dual-polar cut ceiling at every rank + +This contribution was produced by Nick Petalas. Apache-2.0. +Independent human and formal proof-kernel review are unclaimed. + +Claim type: scoped written proof with exact finite corroboration. +For the graph of Lagrangian subspaces of a binary symplectic space of +dimension 2m, the exact ratio of opposite-pair cut disagreement to +edge-pair cut disagreement is + + max_S p_m(S)/p_1(S) = 2 - 2^(1-m), for every integer m>=1. + +Point cuts attain it. The first nonconstant eigenspace uniquely maximizes +the corresponding spectral quotient. A factored distance-eigenvalue +polynomial proves the missing uniform maximization in Jacob Sussman's +[PR4628](https://github.com/CrocSwap/integer-mult-bounds/pull/4628), +Theorem 6 of its induction note. That note gives finite evidence through +rank 12 and explicitly leaves the all-rank comparison open. Its finite +results, point-cut witness and coordinate-family interpretation retain +predecessor credit. This contribution supplies the new all-rank proof, +without running predecessor scientific programs. + +The resulting ceiling for constant-dimension coordinate certificates and +their nonnegative sums holds at every rank. It does not exclude general +noncoordinate certificates or prove a call-count bound for arbitrary +physical circuits. No new kappa or selected-frontier change is claimed. +The complete argument is in [PROOF.md](PROOF.md). + +## Evidence and reproduction + +The standalone standard-library checker generates all its scientific +fixtures. It compares 1,224 factored polynomials with 40,424 independent +intersection-recurrence equations through rank 48, then checks all 8,256 +nonconstant spectral quotients through rank 128. Its separate geometric +oracle constructs the 3, 15 and 135 Lagrangians at ranks one through three +from literal binary symplectic spans and checks every pair's intersection +numbers. It enumerates all 6 and 32,766 nontrivial Boolean cuts at ranks +one and two, and checks 81 attaining point cuts across the three graphs. +The rank-two census has 170 attaining nontrivial subsets; no all-rank +classification is inferred from that count. + +Fifteen controls reject altered polynomial coefficients, a changed edge +eigenvalue, smaller false ceilings and invalid checker domains. Explicit +exceptions keep the same checks active under optimized Python. Finite +checks corroborate the written proof; they are not its universal argument. + +From the repository root with the local CPython 3.12.15 interpreter: + +```sh +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/binary-dual-polar-cut-ceiling/verify.py +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -O -W error -B research/binary-dual-polar-cut-ceiling/verify.py +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/binary-dual-polar-cut-ceiling +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/binary-dual-polar-cut-ceiling --check-source-history --check-modes +``` + +Any CPython 3.12 executable may replace that path. The direct marker is +`PASS_BINARY_DUAL_POLAR_CUT_CEILING`. Each run prints its computed counts +and a generated receipt binding all six package files by SHA256. It writes +no files. Both registered checks have a 120-second limit. Direct replay +also works from a Git-free package export with no predecessor files. + +## Scope, sources and credit + +The `complex-rank-shape-decoder` card explicitly changes to a certificate +limitation, rather than a physical supplier optimization. This helps delimit +what stronger lower-bound searches must change. It does not improve the +complete signed invoice. Canonical base is +`e54523517d0f03e58352e647c403a5af3e525a57`, priority revision eight. The +catalogue's #5599 context is historical; selected #7000 remains unchanged. +[TASK.json](TASK.json) records the scope change, evidence and next question. +[SOURCES.json](SOURCES.json) pins the exact predecessor induction note, +catalogue and selected record as historical provenance. None is a runtime +scientific input, and no predecessor file is copied or modified. + +Credit Jacob Sussman, `jacobalansussman`, for PR4628's question, finite +evidence, point-cut count and coordinate-certificate application, and eumemic, +Swapnil Jain and the native/kept-subspace contributors credited there. +Dual-polar distance-regular spectra and spectral Dirichlet-form comparison +are classical. [Lee and Tanaka, SIGMA 14 (2018), 009](https://doi.org/10.3842/SIGMA.2018.009) +provide standard background; the proof here derives the binary formulas +directly. No global literature-priority claim is made. + +The [advance claim](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19601539) +followed live PR/Discussion, account-history, local-reservation and +main/merged distinctive-term searches. The overlap cache covers 846 open +PRs and 7,482 Discussion records at its recorded timestamps, with incomplete +sparse local-note coverage. Distinctive searches also inspect main's README +and PROOF files. Unpublished work and arbitrary historical code remain +coverage limits. + +## Limitations and unrun obligations + +The theorem covers binary symplectic dual-polar graphs and their stated +cut/coordinate-certificate model. It does not classify every equality cut, +extend to other fields, construct a word or supply a physical consumer. +Native realization, legal access, ownership/restoration, stock, compiler, +precision/tape, analytic recovery and a complete supplier invoice remain +unproved here. All five selected framework assumptions remain. Selected +cold replay, Lean, Docker, independent human and formal proof-kernel review +are unrun or unclaimed. + +## Open next questions + +Which Boolean cuts attain equality at rank at least three? The proof +restricts their indicators to the constant and first adjacency eigenspaces, +but does not classify the resulting zero-one functions. Start with the +135-vertex rank-three graph. A complete census or a structural classification +would identify every sharp coordinate certificate; neither is supplied here. + +## Code constraints + +Every function is shorter than sixty physical lines. Loops have fixed +fixture bounds: rank at most 128 for scalar spectra, rank at most 48 for +polynomial checks, dimension at most six for literal geometry, at most +315 intermediate isotropic spaces and at most 32,766 cuts per graph. No +recursion, subprocess, network operation, callback registration or dynamic +code is used. Immutable tuples hold geometric spans; no shared mutable +cache exists. Explicit exceptions enforce all scientific checks. + +Power of Ten rule 3 deviation: CPython and Fraction allocate during this +bounded exact offline check. At most 135 vertices and 18,225 pair cells +are retained for one graph; the largest enumerated subset family is +streamed. Polynomial degrees are bounded by 48 in the replay, and spectral +powers by 4,160 bits. Six regular package files of at most 128 KiB each +are read only for receipt hashes. These bounds constrain live mathematical +state, not interpreter internals. Rule 9's managed references and standard +iterator dispatch have fixed known targets and finite fixture sizes. Both +warning-strict registered modes and in-memory syntax checks supply the +available diagnostics. A fixed-allocation native implementation or external +static analysis is not claimed; revisit it only if this checker becomes +a resource bottleneck. diff --git a/research/binary-dual-polar-cut-ceiling/SOURCES.json b/research/binary-dual-polar-cut-ceiling/SOURCES.json new file mode 100644 index 0000000000..a6fa3b46e5 --- /dev/null +++ b/research/binary-dual-polar-cut-ceiling/SOURCES.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "research/complex-small-m-lower-bounds/author-evidence/induction-across-block-sizes.md", + "usage": "provenance", + "git_blob": "9343bbd87a8e2d2b5b2b8fbca34da04033d95ce7", + "sha256": "0c2f6f5a07f1deccfa2b838c6d29bc6d86567069569890c37c820b03f7d888ef" + } + ] +} diff --git a/research/binary-dual-polar-cut-ceiling/TASK.json b/research/binary-dual-polar-cut-ceiling/TASK.json new file mode 100644 index 0000000000..86b9d0bc82 --- /dev/null +++ b/research/binary-dual-polar-cut-ceiling/TASK.json @@ -0,0 +1,115 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "complex-rank-shape-decoder", + "question": "Can a legal decoder or coframe change improve the full signed moment, including changed helper targets?", + "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", + "docs/research/recursive-invoice-preflight.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": "A source-bound arbitrary-input identity and legal producer/consumer boundary with the complete paid and productive target invoice, including restoration, ownership, native alignment and extra charges. Price under the actual current model; historical ceiling.py assumptions must be established before use. A favorable optimistic relaxation keeps a route open but is not a completed supplier. A scoped local result remains useful; expansion requires the family-level budget gate.", + "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": "Price one complete changed itinerary with both paid and productive histograms. Check #5693/#5698 for overlap and their exact hypotheses before another coframe search. Use the signed invoice preflight where its boundary contract agrees; an inconclusive concave comparison is not a power crossing. Stop if an optimistic complete budget fails at the chosen target or native delivery remains unspecified.", + "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": [ + "coframe", + "signed moment", + "5693", + "5698" + ], + "existing_checks": [ + { + "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 the exact all-rank Boolean-cut ceiling 2-2^(1-m) on binary symplectic dual-polar graphs.", + "scope_change_reason": "The selected decoder/caller card is narrowed to an explicit open certificate limitation in PR4628, Theorem 6 of its induction note. This is original proof work, not a supplier audit or a physical decoder.", + "bottleneck_link": "This side result closes the all-rank gap in a coordinate-certificate ceiling. Stronger lower-bound searches must change the certificate family; this does not improve the complete supplier invoice.", + "budget_minutes": 60, + "stop_rule": "Stop after the first checked all-rank proof and package it; do not expand to other fields, graph families or physical constructions.", + "outcome": "completed", + "evidence": "PROOF.md gives the all-rank proof. verify.py checks 1224 factored polynomials, 40424 recurrence equations, 8256 spectral quotients, literal geometric graphs, complete rank-one/two cut censuses, 81 point cuts and 15 controls.", + "author": "Nick Petalas", + "ai_assistance": "Independent human and formal proof-kernel review are unclaimed.", + "open_questions": [ + { + "question": "Which Boolean cuts attain equality at rank at least three?", + "why_it_matters": "The proof identifies the unique maximizing eigenspace but does not classify its zero-one functions. Such a classification would describe every sharp coordinate certificate.", + "first_step": "Study Boolean indicators in the sum of the constant and theta_1 eigenspaces, starting with the 135-vertex rank-three graph.", + "blocked_by": "No classification argument or complete Boolean census is supplied." + } + ], + "source_question": "https://github.com/CrocSwap/integer-mult-bounds/pull/4628", + "claim_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19601539", + "environment": { + "python": "CPython 3.12.15", + "dependencies": "standard library only" + }, + "limitations": [ + "Binary symplectic dual-polar graphs only.", + "No classification of equality cuts.", + "No physical word, selected caller, new kappa or supplier admission.", + "Independent human and formal proof-kernel review are unclaimed." + ], + "overlap": { + "open_pr_records": 846, + "discussion_records": 7482, + "open_fetched_at": "2026-11-13T22:40:07.559362+00:00", + "discussion_fetched_at": "2026-11-13T22:41:44.182087+00:00", + "local_note_coverage": "232 working notes; 9948 HEAD note paths omitted by sparse checkout. Distinctive main README/PROOF and merged/open PR searches supplement the cache. Unpublished work is not covered.", + "recent_own_pr_bodies_checked": 118, + "recent_source_reuse": "No PR4628, dual-polar or cutceil reference occurs in the 118 own PR bodies created since 2026-11-06T22:36:00Z." + }, + "finite_evidence": { + "proof": "PROOF.md", + "verifier": "verify.py", + "polynomials": 1224, + "coefficient_rows": 40424, + "nonconstant_spectral_ratios": 8256, + "literal_graph_vertices": [ + 3, + 15, + 135 + ], + "complete_nontrivial_cut_censuses": [ + 6, + 32766 + ], + "point_cut_fixtures": 81, + "rejecting_controls": 15 + }, + "claim_type": "scoped written proof with exact finite corroboration" +} diff --git a/research/binary-dual-polar-cut-ceiling/VERIFY.json b/research/binary-dual-polar-cut-ceiling/VERIFY.json new file mode 100644 index 0000000000..a97b6bce2a --- /dev/null +++ b/research/binary-dual-polar-cut-ceiling/VERIFY.json @@ -0,0 +1,34 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact factor/recurrence agreement, all-sector ceilings, literal finite symplectic graphs, complete small cut censuses, sharp point cuts and rejecting controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "The same checks with assertions disabled; every scientific condition uses explicit exceptions." + } + ] +} diff --git a/research/binary-dual-polar-cut-ceiling/verify.py b/research/binary-dual-polar-cut-ceiling/verify.py new file mode 100644 index 0000000000..6b18d5d1b2 --- /dev/null +++ b/research/binary-dual-polar-cut-ceiling/verify.py @@ -0,0 +1,258 @@ +#!/usr/bin/env python3 +"""All-rank binary dual-polar cut theorem: exact finite corroboration. + +Produced by Nick Petalas. Apache-2.0. +""" + +from fractions import Fraction +import hashlib +import json +from pathlib import Path +import sys + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def domain(m, j): + require(type(m) is int and 1 <= m <= 128, "checker rank must be 1..128") + require(type(j) is int and 0 <= j <= m, "checker sector must be 0..rank") + + +def intersection(m, i): + return (1 << i) - 1, (1 << i) - 1, (1 << (m + 1)) - (1 << (i + 1)) + + +def theta(m, j): + domain(m, j) + return (1 << (m - j + 1)) - (1 << j) - 1 + + +def polynomial(m, j): + domain(m, j) + coefficients = [1] + factors = [1 << r for r in range(1, m - j + 1)] + factors += [-(1 << r) for r in range(j)] + for factor in factors: + updated = [0] * (len(coefficients) + 1) + for i, value in enumerate(coefficients): + updated[i] += value + updated[i + 1] += factor * value + coefficients = updated + return tuple(coefficients) + + +def check_coefficients(m, eigenvalue, coefficients): + require(len(coefficients) == m + 1, "polynomial degree") + require(coefficients[0] == 1, "constant coefficient") + for i in range(m + 1): + _, a_i, _ = intersection(m, i) + left = eigenvalue * coefficients[i] + right = a_i * coefficients[i] + if i > 0: + _, _, b_previous = intersection(m, i - 1) + right += b_previous * coefficients[i - 1] + if i < m: + c_next, _, _ = intersection(m, i + 1) + right += c_next * coefficients[i + 1] + require(left == right, "distance eigenvalue recurrence") + + +def spectral_ratio(m, j): + domain(m, j) + require(j != 0, "constant sector has zero denominator") + degree = 2 * ((1 << m) - 1) + opposite = Fraction((-1) ** j, 1 << (j * (m - j + 1))) + return (1 - opposite) / (1 - Fraction(theta(m, j), degree)) + + +def algebra_checks(): + coefficient_rows = 0 + polynomials = 0 + for m in range(1, 49): + for j in range(m + 1): + coefficients = polynomial(m, j) + check_coefficients(m, theta(m, j), coefficients) + exponent = m * (m + 1) // 2 - j * (m - j + 1) + require(coefficients[-1] == (-1) ** j * (1 << exponent), "top coefficient") + coefficient_rows += m + 1 + polynomials += 1 + ratios = 0 + for m in range(1, 129): + ceiling = Fraction((1 << m) - 1, 1 << (m - 1)) + require(all(theta(m, j) > theta(m, j + 1) for j in range(m)), "distinct roots") + for j in range(1, m + 1): + ratio = spectral_ratio(m, j) + require(ratio <= ceiling, "spectral ceiling") + require((ratio == ceiling) == (j == 1), "unique maximizing sector") + ratios += 1 + return {"polynomials": polynomials, "coefficient_rows": coefficient_rows, + "nonconstant_spectral_ratios": ratios} + + +def pairing(x, y, m): + low = (1 << m) - 1 + return (((x & low) & (y >> m)).bit_count() + + ((y & low) & (x >> m)).bit_count()) % 2 + + +def lagrangians(m): + require(type(m) is int and 1 <= m <= 3, "geometric fixture rank must be 1..3") + layer = {(0,)} + for dimension in range(m): + updated = set() + for space in sorted(layer): + for vector in range(1, 1 << (2 * m)): + if vector in space or any(pairing(vector, x, m) for x in space): + continue + extended = tuple(sorted((*space, *(x ^ vector for x in space)))) + require(len(extended) == 1 << (dimension + 1), "span dimension") + updated.add(extended) + require(len(updated) <= 315, "bounded isotropic layer") + layer = updated + return tuple(sorted(layer)) + + +def graph(spaces, m): + size = len(spaces) + distances = [] + for left in spaces: + row = [] + for right in spaces: + common = len(set(left).intersection(right)) + require(common > 0 and common & (common - 1) == 0, "intersection dimension") + row.append(m - (common.bit_length() - 1)) + distances.append(tuple(row)) + masks = tuple(tuple(sum(1 << v for v in range(size) if distances[u][v] == i) + for u in range(size)) for i in range(m + 1)) + return tuple(distances), masks + + +def check_geometry(distances, masks, m): + size = len(distances) + degrees = [1] + for i in range(1, m + 1): + c_i, _, _ = intersection(m, i) + _, _, b_previous = intersection(m, i - 1) + quotient, remainder = divmod(degrees[-1] * b_previous, c_i) + require(remainder == 0, "sphere integrality") + degrees.append(quotient) + require(sum(degrees) == size, "geometric vertex count") + for u in range(size): + require([mask[u].bit_count() for mask in masks] == degrees, "sphere sizes") + for v in range(size): + i = distances[u][v] + counts = [0] * (m + 1) + for w in range(size): + if masks[1][v] >> w & 1: + counts[distances[u][w]] += 1 + expected = [0] * (m + 1) + c_i, a_i, b_i = intersection(m, i) + expected[i] = a_i + if i > 0: + expected[i - 1] = c_i + if i < m: + expected[i + 1] = b_i + require(counts == expected, "literal geometric intersection array") + require(degrees[-1] == 1 << (m * (m + 1) // 2), "opposite valency") + return size * size + + +def exits(subset, neighbors): + complement = ((1 << len(neighbors)) - 1) ^ subset + return sum((row & complement).bit_count() for v, row in enumerate(neighbors) + if subset >> v & 1) + + +def cut_ratio(subset, masks, m): + edge_exits = exits(subset, masks[1]) + require(edge_exits > 0, "nontrivial connected cut") + opposite_exits = exits(subset, masks[m]) + return Fraction(opposite_exits * masks[1][0].bit_count(), + edge_exits * masks[m][0].bit_count()) + + +def geometric_checks(): + reports = [] + for m in range(1, 4): + spaces = lagrangians(m) + distances, masks = graph(spaces, m) + cells = check_geometry(distances, masks, m) + ceiling = Fraction((1 << m) - 1, 1 << (m - 1)) + point_cuts = 0 + for point in range(1, 1 << (2 * m)): + subset = sum(1 << v for v, space in enumerate(spaces) if point in space) + require(cut_ratio(subset, masks, m) == ceiling, "attaining point cut") + point_cuts += 1 + all_cuts = 0 + attaining_cuts = 0 + if m <= 2: + for subset in range(1, (1 << len(spaces)) - 1): + ratio = cut_ratio(subset, masks, m) + require(ratio <= ceiling, "literal Boolean-cut ceiling") + attaining_cuts += ratio == ceiling + all_cuts += 1 + reports.append({"rank": m, "vertices": len(spaces), "pair_cells": cells, + "point_cuts": point_cuts, "all_nontrivial_cuts": all_cuts, + "attaining_enumerated_cuts": attaining_cuts}) + return reports + + +def controls(): + rejected = 0 + for m, j, position in ((3, 1, 0), (4, 2, 1), (3, 2, 3)): + changed = list(polynomial(m, j)) + changed[position] += 1 + try: + check_coefficients(m, theta(m, j), changed) + except ValueError: + rejected += 1 + else: + raise ValueError("polynomial mutant survived") + try: + check_coefficients(4, theta(4, 1) + 1, polynomial(4, 1)) + except ValueError: + rejected += 1 + else: + raise ValueError("edge eigenvalue mutant survived") + for m in (2, 3, 17, 128): + false_ceiling = Fraction((1 << m) - 2, 1 << (m - 1)) + require(spectral_ratio(m, 1) > false_ceiling, "false smaller ceiling") + rejected += 1 + invalid = ((0, 0), (129, 1), (3, -1), (3, 4), (True, 1), (3, False), (2.0, 1)) + for m, j in invalid: + try: + polynomial(m, j) + except ValueError: + rejected += 1 + else: + raise ValueError("invalid checker input survived") + require(rejected == 15, "complete control count") + return rejected + + +def package_hashes(): + package = Path(__file__).resolve().parent + names = ("PROOF.md", "README.md", "SOURCES.json", "TASK.json", "VERIFY.json", "verify.py") + hashes = {} + for name in names: + path = package / name + require(path.is_file() and not path.is_symlink(), "regular package file") + require(path.stat().st_size <= 131072, "bounded package file") + hashes[name] = hashlib.sha256(path.read_bytes()).hexdigest() + return hashes + + +def main(): + require(len(sys.argv) == 1, "no command-line arguments accepted") + report = {"claim_type": "scoped written proof with exact finite corroboration", + "algebra": algebra_checks(), "geometry": geometric_checks(), + "rejecting_controls": controls(), "sha256": package_hashes()} + print(json.dumps(report, sort_keys=True)) + print("PASS_BINARY_DUAL_POLAR_CUT_CEILING") + + +if __name__ == "__main__": + main()