diff --git a/research/eisenstein-phase-cost-screen/README.md b/research/eisenstein-phase-cost-screen/README.md new file mode 100644 index 0000000000..288365822b --- /dev/null +++ b/research/eisenstein-phase-cost-screen/README.md @@ -0,0 +1,125 @@ +# Eisenstein phase-path cost screen + +**Outcome: certified necessary-condition screen — any Eisenstein-supplied +decoder that beats the selected complex supplier needs total copy cost +C <= 31 (bracket 31.0635… at s=7, window h=7); every *clean* support +alphabet costs exactly 40; the prize for any complex-only win is capped by +the selected assembly's bit side at kappa <= 0.001730427469823602 (+3.45%).** +No supplier was built and no kappa changed. + +## Question + +PR #831 reopened the F4/Eisenstein phase path: alternating F4 trace forms no +longer block phase compilation, because the alternating-compatible +quadratic-phase normal form handles nondegenerate alternating blocks. The +next question is economic: **if we build an Eisenstein supplier, does it beat +the current selected complex supplier?** This package answers the first half +of that question — the cost side — under the repo's inherited accounting. + +## What was checked (all exact, standard library only) + +1. **Geometry replay** (`research/eisenstein-clique-copy-bound/geometry.py`): + 240 roots of E8, order-three complex structure J, 40 nonorthogonal lines + (degree 27), full flat census + `{(0,0):1, (1,1):40, (2,2):240, (2,4):90, (3,5):360, (3,12):40, (4,40):1}`, + every line-spanned flat nonsingular, and a 7-clique exists — so any + pattern-legal decoder B satisfies B[Q,Q] = I_7 on a 7-clique, hence + `rank_F2(B) >= 7` unconditionally (no reliance on the archived minrank-10 + SAT). + +2. **Clean-class floor = 40.** Call an ordered flat pair (R, A) *clean* if + every cross pair of distinct lines is orthogonal. For clean pairs the + per-rectangle pairing-rank charge is exactly |R ∩ A|: the functionals + x ↦ ⟨x, t⟩ − ⟨Jt, Jt·x⟩ for t ∈ R ∩ A are independent on X_R by positive + definiteness of the real form and pairwise orthogonality of R ∩ A. The + verifier checks this on **all 7033 clean ordered pairs** (tight everywhere, + no census drift). Two independent sharp witnesses at total cost 40: + - **Frame partition:** the 40 lines split into ten pairwise-orthogonal + 4-line frames, each spanning all of E8; the block-diagonal decoder is + pattern-legal (F2 rank 10) and costs exactly 40. + - **Star decomposition:** the canonical pattern + B0 = (all-ones + orthogonality) mod 2 decomposes into 40 clean stars, + each of cost exactly 1. + +3. **Certified threshold screen.** For a supplier with window h and stage + count s (odd), the format-limits skeleton (`skel.profile`, k=1, + x = C/40 with v = 40 Eisenstein ports) gives a pressure whose root X must + exceed the selected complex saving + b = 67018507072324140917/40000000000000000000000. Because the copy slot + enters the profile as mass s·x at cap h, the beat condition is **linear in + C**, so the exact threshold is + `C*(s,h) = 40·((s−1) − F_0(b)) / (s·(m/h)^b)` with m = 1 + s(h−1). + The verifier certifies rational brackets on C*(s,h) for every h ∈ [7,40] + and every odd s (interval arithmetic from `cert.py`, outward-rounded, + ~1e-42 wide), confirms non-beat directly at each window's closure point, + and closes the tail with an exact rational increment bound + (binomial-series chord bound; exact partial sums to P = 200, exact + quadratic minimum beyond; the closed-form slot masses are cross-checked + against the engine at 25 points). Result: + + | window h | max integer threshold | argmax s | viable s range | + |---|---|---|---| + | 7 | 31 | 7 | 3..61 | + | 8 | 30 | 7–15 | 3..49 | + | 9 | 30 | 7–11 | 3..41 | + | 10 | 29 | 7–11 | 3..35 | + + Larger windows only hurt (s=9 dies at h ≥ 24). So **any beating supplier + needs C ≤ 31 at some s ≤ 61**, and with the minrank-10 window the bound + sharpens to C ≤ 29 at s ≤ 35. + +4. **Prize cap.** The selected assembly's bit side is + X_bit = 0.001733427039589844 (PR #1094 audit, `bit_lower`), *above* the + complex side b. Every screen argmax point clears X_bit, so any + complex-only improvement is capped by the bit side: + `kappa <= X_bit/(1+X_bit) = 1733427039589844234749/1001733427039589844234749 + = 0.001730427469823602`, i.e. **+3.45% over the selected record** + 0.001672660197076918 — the uniform prize regardless of how cheap the + decoder is. + +5. **Negative controls (4):** closed-form/direct cross-validation at eight + boundary points; doubling b flips the argmax beat verdict; a tampered + pattern changes the clean census; the naive consecutive-block partition is + illegal (the frame witness needs orthogonality) and a star without its + self-loop costs 0 (the star witness is not vacuously constant). + +## What this proves and what it does not + +**Proves (under the inherited accounting):** the old #620-style construction +(40 units) cannot improve kappa; any Eisenstein route that can must live in +the non-clean window C ∈ [22, 31] at s ≤ 61; and the entire prize is at most ++3.45%. + +**Does not prove:** that a C ≤ 31 non-clean decoder exists; that the +quadratic-phase normal form compiles such a decoder's labels without extra +frames; or any new kappa. The screen is a necessary condition, not a +construction and not a general decoder-optimality theorem. + +## Credit + +Built on `research/format-limits/scripts/{skel,cert}.py` (PR #801 format +ceilings), `research/eisenstein-clique-copy-bound/geometry.py` (E8 root +geometry and pairing-rank machinery), and the selected-record provenance in +`research/community-frontier1094-audit/` (PR #1094). Related results: PR #798 +(copy floor 22, all supports), PR #620 (40-unit construction), PR #831 +(alternating-phase interface). See SOURCES.json for pinned hashes. + +## Open next questions + +- **Does a pattern-legal 40×40 F2-valued decoder exist with total copy cost + C ≤ 31 whose support is not clean?** The screen shows the entire remaining + upside of the Eisenstein phase route lives in this window (C ∈ [22,31] at + s ≤ 61). Settling it either yields the first Eisenstein-supplied assembly + (kappa up to the bit cap 0.001730427469823602) or closes the route under + the current accounting. First step: enumerate minimal non-clean supports + (a nonorthogonal pair read by a common rectangle) and certify their minimum + copy cost with the same pairing-rank machinery. Not blocked. +- **Can the quadratic-phase normal form (PR #831) realize a candidate + decoder's phase labels on nondegenerate alternating blocks at the frame + level required by the assembly template?** PR #831 removed the interface + obstruction at the trace-form level, but no one has checked that a concrete + cheap decoder's labels compile without extra frames or adapters that would + break the C ≤ 31 budget. First step: take the cheapest abstract decoder + surviving the screen (if any) and run the f4-alternating-interface + compilation on its labels, charging every added frame. Blocked by the + non-clean window question. diff --git a/research/eisenstein-phase-cost-screen/SOURCES.json b/research/eisenstein-phase-cost-screen/SOURCES.json new file mode 100644 index 0000000000..fd7ac5841b --- /dev/null +++ b/research/eisenstein-phase-cost-screen/SOURCES.json @@ -0,0 +1,48 @@ +{ + "schema_version": 1, + "base_commit": "d78fe4bbb6f6b769e39586f8bb3ba8c31a31fd3a", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/INDEPENDENT1094.json", + "usage": "input", + "git_blob": "009a385e26858058a18188364078d162aa6f9519", + "sha256": "301fb8a0e4ab7e3c383ff974c54c08178283b2a3453c5282757f692a3c7a4bfd" + }, + { + "path": "research/eisenstein-clique-copy-bound/geometry.py", + "usage": "input", + "git_blob": "a92c16295d6fcf2a7ffeb7d38444613f939db6cb", + "sha256": "248df3fb820b5165ca485ad4d43f0271043498c45a59ac1edc310a124073644c" + }, + { + "path": "research/format-limits/scripts/cert.py", + "usage": "input", + "git_blob": "351fbd107c86a233a91eb915f88612c9f9ad6c26", + "sha256": "cab1c055cf4dbad6a89b4527e2ef3d138131b6742eaf21bd8b4338a9ee2febf4" + }, + { + "path": "research/format-limits/scripts/skel.py", + "usage": "input", + "git_blob": "e3c6c815b604dd41d3807c78917806ae4a5c08a7", + "sha256": "9cfbc1316389a46922765cdae85fdde2042f7681986d1c97a19174c4922ea29c" + } + ] +} diff --git a/research/eisenstein-phase-cost-screen/TASK.json b/research/eisenstein-phase-cost-screen/TASK.json new file mode 100644 index 0000000000..b2d8c6c629 --- /dev/null +++ b/research/eisenstein-phase-cost-screen/TASK.json @@ -0,0 +1,72 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 3, + "base_commit": "d78fe4bbb6f6b769e39586f8bb3ba8c31a31fd3a", + "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": [ + "research/complex-local-word-ceiling/README.md", + "research/complex-decoder-field-extension-seed44/README.md", + "research/complex-frame-pair-decoders/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.", + "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." + ], + "overlap_terms": [ + "rank shape", + "block climb", + "masked decoder", + "overcomplete", + "effective rank" + ] + }, + "scope_status": "unchanged", + "actual_scope": "Can a decoder deliver the local paid mass in fewer, larger-rank children (block frame climbs instead of rank-1 to rank-3 steps)?", + "scope_change_reason": null, + "bottleneck_link": "Rank-1 children are about half of recursive cost, so decoder copy cost is the lever this card targets. This package prices the Eisenstein (F4/Eisenstein-phase) decoder route under the inherited accounting: the certified necessary-condition screen says any beating supplier needs total copy cost C <= 31 at some stage count (sup bracket 31.0635 at s=7, window h=7; h=10 gives C <= 29 at s <= 35), while every clean support alphabet costs exactly 40 (two independent sharp witnesses). The route therefore survives only if a non-clean decoder with C <= 31 exists; the prize is capped by the selected assembly's bit side at kappa <= 1733427039589844234749/1001733427039589844234749 = 0.001730427469823602 (+3.45% over the selected 0.001672660197076918).", + "budget_minutes": 240, + "stop_rule": "Stop when (a) the certified threshold screen covers every legal window h in [7,40] and every odd stage count s (scan plus exact rational tail closure), (b) the clean-class floor 40 is proven with sharp witnesses, and (c) negative controls pass; or immediately if a candidate supplier beats the screen, or if the screen's assumptions are contradicted by an existing result.", + "outcome": "partial", + "evidence": "research/eisenstein-phase-cost-screen/verify.py passes in ~21s (Python 3.12, stdlib only, no randomness): Part A replays the 240-root geometry (40 lines, flat census 1/40/240/90/360/40/1, all line-spanned flats nonsingular, a 7-clique exists so any legal pattern has rank >= 7). Part B proves the clean-class floor: on all 7033 clean ordered flat pairs the per-rectangle charge equals |R cap A| (tight everywhere), and two independent pattern-legal witnesses cost exactly 40 (ten orthogonal 4-line frames; 40 clean stars). Part C certifies, for every window h in [7,40] and every odd s, closed-form rational brackets on the exact copy-cost threshold C*(s,h) (the beat condition is linear in C), with direct certified confirmation and an exact rational tail closure (binomial-series increment bound, exact partial sums to P=200, exact quadratic minimum beyond) covering all s beyond the closure point; sup over the screen is 31.063467310837773 at s=7 h=7, so any beating supplier needs C <= 31 at s <= 61 (h=7 row; h=10: C <= 29 at s <= 35). Part D shows every screen argmax point clears the selected bit side 0.001733427039589844, so the prize is capped at kappa <= 0.001730427469823602 (+3.45%). Part E: four negative controls (closed-form/direct cross-validation, doubled-b flip, tampered-pattern census change, naive-partition illegality and star self-loop sensitivity). Not done: no supplier was built; the non-clean window C in [22,31] is open; no kappa changed.", + "author": "Maximus Putnam (@Maximooch), with substantial Penguin (OpenAI) assistant assistance in mathematics, implementation, checking and writing", + "ai_assistance": "Penguin (OpenAI) coding/math agent: derived the closed-form threshold brackets and tail closure, wrote verify.py and this package, and ran all checks; every claim is backed by the exact verifier output. No other AI tools used.", + "open_questions": [ + { + "question": "Does a pattern-legal 40x40 F2-valued decoder exist with total copy cost C <= 31 whose support is NOT clean (i.e. some clean-class hypothesis fails), and does its full frame/restoration bill stay within the screen?", + "why_it_matters": "The screen is a necessary condition: the entire remaining upside of the Eisenstein phase route lives in the non-clean window C in [22,31] at s <= 61. Settling it either yields the first Eisenstein-supplied assembly (kappa up to the bit cap 0.001730427469823602) or closes the route under the current accounting.", + "first_step": "Extend the clean-class dichotomy: enumerate minimal non-clean supports (a nonorthogonal pair read by a common rectangle) and certify their minimum copy cost with the same pairing-rank machinery; if the minimum exceeds 31 the route is closed.", + "blocked_by": "nothing" + }, + { + "question": "Can the quadratic-phase normal form (PR #831) actually realize a candidate decoder's phase labels on nondegenerate alternating blocks at the frame level required by the assembly template?", + "why_it_matters": "PR #831 removed the interface obstruction at the trace-form level, but no one has checked that a concrete cheap decoder's labels compile through the alternating-compatible normal form without extra frames or adapters that would break the C <= 31 budget.", + "first_step": "Take the cheapest abstract decoder surviving the screen (if any) and run the f4-alternating-interface compilation on its labels, charging every added frame.", + "blocked_by": "the non-clean window question" + } + ] +} diff --git a/research/eisenstein-phase-cost-screen/VERIFY.json b/research/eisenstein-phase-cost-screen/VERIFY.json new file mode 100644 index 0000000000..c0801f1a94 --- /dev/null +++ b/research/eisenstein-phase-cost-screen/VERIFY.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/INDEPENDENT1094.json", + "research/eisenstein-clique-copy-bound/geometry.py", + "research/format-limits/scripts/cert.py", + "research/format-limits/scripts/skel.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Replays the E8 root geometry and flat census, proves the clean-class floor 40 with two sharp witnesses, certifies the Eisenstein copy-cost threshold screen over all windows h in [7,40] and all odd stage counts (closed-form rational brackets plus exact tail closure), checks the bit-side prize cap, and runs four negative controls; prints PASS_EISENSTEIN_PHASE_COST_SCREEN." + } + ] +} diff --git a/research/eisenstein-phase-cost-screen/verify.py b/research/eisenstein-phase-cost-screen/verify.py new file mode 100644 index 0000000000..cbd95c9c67 --- /dev/null +++ b/research/eisenstein-phase-cost-screen/verify.py @@ -0,0 +1,487 @@ +#!/usr/bin/env python3 +"""Exact verifier for the Eisenstein phase-path cost screen (standard library only). + +Scope: a necessary-condition screen and a clean-class floor for Eisenstein E8 +decoder copy cost, under the inherited format-limits accounting (#801) and the +abstract pairing-rank charge (#798). This is not a supplier, not a new kappa, +and not a general decoder-optimality theorem. + +Parts + A geometry replay: 240 roots, order-three J, 40 lines, flat census, + nonsingularity of every line-spanned flat, a 7-clique (window >= 7). + B clean-class ingredients: c = |R cap A| on every clean ordered flat pair; + two independent sharp witnesses at total cost 40 (frame partition and + star decomposition of the canonical pattern B0). + C certified threshold screen: for every window h in [7, 40] and every odd + stage count s, closed-form rational brackets U(s,h) on the exact copy-cost + threshold C*(s,h); a direct certified non-beat check at each window's + viability end s1(h); and an exact rational tail closure covering all + s >= s1(h) (increment bound plus an exact monotonicity polynomial). + D prize: the bit-side cap on any complex-only gain. + E negative controls, including closed-form/direct cross-validation. + +No randomness is used anywhere; every check is exact or an explicitly +outward-rounded rational interval enclosure (cert.py). +""" +import json +import sys +from fractions import Fraction as Fr + +sys.path.insert(0, 'research/format-limits/scripts') +sys.path.insert(0, 'research/eisenstein-clique-copy-bound') + +import cert +import geometry as G +import skel + + +def require(condition, message): + if not condition: + raise AssertionError(message) + + +# The selected complex-side saving b (PR1094 audit, complex_lower) and the +# selected record's kappa. Both are historical provenance pins. +B = Fr(67018507072324140917, 40000000000000000000000) +KAPPA_SELECTED = Fr(836330098538459, 500000000000000000) +# The selected assembly's bit side (PR1094 ASSEMBLY.json, bit_lower). +X_BIT = Fr(1733427039589844234749, 10 ** 24) + +XDEN = 40 # x = C / v with v = 40 Eisenstein ports +C_FLOOR = 22 # certified all-supports floor (#798) +C_STEP = Fr(9, 10) # D(s+2) - D(s) at C = 22: D(s) = (s-1) - s*x0, x0 = 22/40, + # so D(s+2) - D(s) = 2 - 2*x0 = 2 - 44/40 = 9/10. +H_MIN = 7 # unconditional window floor (7-clique forces rank >= 7) +H_MAX = 40 # B is 40 x 40 + + +def f2_rank(rows): + basis = {} + rank = 0 + for x in rows: + while x: + high = x.bit_length() - 1 + if high in basis: + x ^= basis[high] + else: + basis[high] = x + rank += 1 + break + return rank + + +def part_a(): + reps, images, adjacent, pairs, orbits = G.geometry() + require(len(reps) == 40 and len(images) == 40, 'line count') + require(all(m.bit_count() == 27 for m in adjacent), 'nonorthogonal degree') + flats = G.flats(reps, images) + census = {} + for mask, basis, _gens in flats: + key = (len(basis) // 2, mask.bit_count()) + census[key] = census.get(key, 0) + 1 + require(census == {(0, 0): 1, (1, 1): 40, (2, 2): 240, (2, 4): 90, + (3, 5): 360, (3, 12): 40, (4, 40): 1}, + 'flat census mismatch: %r' % (census,)) + for _mask, basis, _gens in flats: + require(G.pairing_rank(basis, basis) * 2 == len(basis), + 'degenerate flat span encountered') + # A 7-clique exists; the pattern forces B[Q,Q] = I_7, so rank B >= 7. + maximal = G.maximal_cliques(adjacent) + require(any(m.bit_count() == 7 for m in maximal), 'no 7-clique') + return reps, images, adjacent, flats + + +def clean_pairs_census(adjacent, flats): + """All ordered flat pairs (R, A) with every cross pair t!=s orthogonal. + + For such clean pairs the per-rectangle charge is exactly |R cap A|: + the functionals B(., t) = <., t> - , t in R cap A, are + K-independent on X_R by positive definiteness of the real form and + pairwise orthogonality of R cap A (each is a signed unit vector on the + orthogonal line t, and distinct such lines are orthogonal). + """ + checked = 0 + for r_mask, r_basis, _rg in flats: + for a_mask, a_basis, _ag in flats: + clean = True + t_iter = r_mask + while t_iter: + low = t_iter & -t_iter + t = low.bit_length() - 1 + t_iter ^= low + # t must be orthogonal to every OTHER line of A (including + # the other lines of R cap A); the diagonal t = s needs no + # check, so mask t's own bit off when present. + others = a_mask ^ low if a_mask & low else a_mask + if adjacent[t] & others: + clean = False + break + if not clean: + continue + cost = G.pairing_rank(r_basis, a_basis) + shared = (r_mask & a_mask).bit_count() + require(cost >= shared, + 'clean-class per-rectangle bound violated') + require(cost == shared, 'clean pair not tight') + checked += 1 + return checked + + +def part_b(reps, images, adjacent, flats): + """Clean-class ingredients and two sharp cost-40 witnesses.""" + checked = clean_pairs_census(adjacent, flats) + require(checked == 7033, 'clean ordered pair count %d' % checked) + + # Witness 1: partition of the 40 lines into ten pairwise-orthogonal, + # full-span 4-line frames; the block-diagonal decoder costs exactly 40. + orth = [((1 << 40) - 1) ^ adjacent[i] ^ (1 << i) for i in range(40)] + frames = [] + + def cover_search(uncovered): + if not uncovered: + return True + v = min((t for t in range(40) if (uncovered >> t) & 1), + key=lambda t: (orth[t] & uncovered).bit_count()) + cands = [t for t in range(40) if (orth[v] & uncovered) & (1 << t)] + for i in range(len(cands)): + for j in range(i + 1, len(cands)): + if not (orth[cands[i]] >> cands[j]) & 1: + continue + for k in range(j + 1, len(cands)): + a, b, c = cands[i], cands[j], cands[k] + if (orth[a] >> c) & 1 and (orth[b] >> c) & 1: + frame = (1 << v) | (1 << a) | (1 << b) | (1 << c) + frames.append(frame) + if cover_search(uncovered & ~frame): + return True + frames.pop() + return False + + require(cover_search((1 << 40) - 1), 'no frame partition found') + require(len(frames) == 10, 'frame partition size') + covered = 0 + for frame in frames: + covered |= frame + require(covered == (1 << 40) - 1, 'frames do not cover') + total = 0 + for frame in frames: + idx = [t for t in range(40) if (frame >> t) & 1] + require(all((orth[a] >> b) & 1 for a in idx for b in idx if a != b), + 'frame not pairwise orthogonal') + rows = [] + for t in idx: + rows += [reps[t], images[t]] + basis = G.echelon(tuple(rows)) + require(len(basis) == 8, 'frame span not full') + total += G.pairing_rank(basis, basis) + require(total == 40, 'frame-partition cost %d' % total) + block = [[0] * 40 for _ in range(40)] + for frame in frames: + idx = [t for t in range(40) if (frame >> t) & 1] + for t in idx: + for s in idx: + block[t][s] = 1 + for t in range(40): + for s in range(40): + if t != s and (adjacent[t] >> s) & 1: + require(block[t][s] == 0, 'witness pattern violation') + require(block[t][t] == 1, 'witness diagonal') + require(f2_rank([sum(block[t][s] << s for s in range(40)) + for t in range(40)]) == 10, 'witness rank') + + # Witness 2: the canonical pattern B0 = (I + orthogonality) mod 2 + # decomposes into 40 clean stars, each of cost exactly 1. + star_total = 0 + for t in range(40): + readers = [s for s in range(40) + if s == t or not (adjacent[s] >> t) & 1] + rows = [] + for s in readers: + rows += [reps[s], images[s]] + cost = G.pairing_rank(G.echelon(tuple(rows)), (reps[t], images[t])) + require(cost == 1, 'star cost %d at line %d' % (cost, t)) + star_total += cost + require(star_total == 40, 'star decomposition cost %d' % star_total) + return {'clean_ordered_pairs': checked, 'witnesses': ['frame', 'star'], + 'clean_floor': 40} + + +def threshold_brackets(s, h): + """Certified rational brackets on C*(s,h): beat(C) iff C < C*(s,h). + + F_C(b) = F_0(b) + s*x*((m/h)^b - 1) and D_C = (s-1) - s*x with x = C/40, + so the beat condition is linear in C and + C* = 40 * ((s-1) - F_0(b)) / (s * (m/h)^b). + """ + prof0, m, _d0 = skel.profile(s, h, 1, Fr(0)) + flo, fhi = cert.F_iv(prof0, m, B) + glo, ghi = cert.g_iv(h, m, B) + glow, ghigh = glo / h + 1, ghi / h + 1 # enclosures of (m/h)^b + require(glow <= ghigh, 'g enclosure order') + u_lo = Fr(XDEN) * (s - 1 - fhi) / (s * ghigh) # <= C* + u_hi = Fr(XDEN) * (s - 1 - flo) / (s * glow) # >= C* + require(u_lo <= u_hi, 'bracket order') + return u_lo, u_hi, m + + +def beat_direct(s, h, cost, bb=B): + """Certified direct test: X(s,h,x=cost/40) > bb.""" + prof, m, deficit = skel.profile(s, h, 1, Fr(cost, XDEN)) + if deficit <= 0: + return False + flo, fhi = cert.F_iv(prof, m, bb) + return fhi < deficit + + +def slot_masses(s, a, x0): + """Exact closed-form total slot mass at stage s (window h = a+1, k = 1). + + Slots (skel.profile, k=1): active mass 2*s*a at cap a; copy mass s*x0 at + cap h; idle: pair-0 tail mass 2a(s-3) at cap a(s-3); for p = 1..K-1 a + pre-stretch slot of mass 4pa at cap 2pa and a bridge slot of mass 2a at + cap h; for p = 1..K-2 a tail slot of mass 4a(K-1-p) at cap 2a(K-1-p). + Caps 2aj (j = 1..K-1) therefore carry mass 8aj (count 4), and cap h + carries the copy mass plus 2a(K-1) of bridge mass. Total: + 2as + s*x0 + 2a(K-1) + 8a*sum_{j=1..K-1} j = 4aK^2 + 2aK + (2K+1)x0. + (Cross-checked against skel.profile at s = 3, 5, 99.) + """ + big_k = (s - 1) // 2 + return 4 * a * big_k * big_k + 2 * a * big_k + (2 * big_k + 1) * x0 + + +def tail_increment(s, a, x0=Fr(22, XDEN)): + """Certified lower bound on F_x0(b; s+2) - F_x0(b; s). + + A slot of mass w and cap c contributes w*((m/c)^q - 1), m = m(s) = 1+as. + When s grows by 2, m grows by delta = 2a. With u = delta/m in (0,1) and + 0 < q < 1, the binomial series alternates with decreasing magnitudes, so + (1+u)^q - 1 >= q*u - q*(1-q)*u^2/2. + Since (m/c)^q >= 1 and the bracket is positive, + increment >= w * [q*delta/m - q*(1-q)*delta^2/(2*m^2)]. + Summing over slots (masses only grow with s; no slot is free since the + largest cap a(s-3) is below m for all s >= 3): + Inc(s) = Sigma(s) * [c1/m(s) - c2/m(s)^2], + c1 = 2ab, c2 = 2a^2*b*(1-b). + """ + m_now = 1 + a * s + c1 = 2 * a * B + c2 = 2 * a * a * B * (1 - B) + return slot_masses(s, a, x0) * (c1 / m_now - c2 / (m_now * m_now)) + + +def tail_step_bound(a, x0, big_k): + """Certified lower bound on the per-pair increment at stage K = (s-1)/2. + + Linear in K: w(K) >= 4aK*c1/(3a+1) - c2*(3/(2a) + 3*x0/(4a^2)), from + Sigma(K)/m(K) >= 4aK^2/(2aK+a+1) >= 4aK/(3a+1) (K >= 1) and + Sigma(K)/m(K)^2 <= 1/a + 1/(2a) + 3*x0/(4*a^2). + """ + c1 = 2 * a * B + c2 = 2 * a * a * B * (1 - B) + return Fr(4 * a) * big_k * c1 / (3 * a + 1) - c2 * (Fr(3, 2 * a) + Fr(3 * x0, 4 * a * a)) + + +def tail_closure_margin(a, x0, s1, margin1, p_max=200): + """Certified: the D - F gap stays nonpositive for every s >= s1. + + With margin1 an upper bound on the gap at s1 (margin1 <= 0 there), the + gap at s1 + 2P satisfies + gap <= margin1 + C_STEP*P - sum_{p=1..P} Inc_p, + so it suffices that Q(P) = sum Inc_p - margin1 - C_STEP*P > 0 for all + P >= 1. Exact rational partial sums for P <= p_max; beyond that the + exact linear per-pair step bound (increasing in K) is summed in closed + form and the resulting quadratic's real minimum is checked exactly. + """ + worst = None + w_sum = Fr(0) + for p in range(1, p_max + 1): + w_sum += tail_increment(s1 + 2 * (p - 1), a, x0) + value = w_sum - margin1 - C_STEP * p + if worst is None or value < worst[1]: + worst = (p, value) + require(worst[1] > 0, + 'tail closure fails at P=%d: %s' % (worst[0], worst[1])) + # Beyond p_max: Q(n) >= base' + lin*n + quad*n^2 - quad*n for n = P - p_max, + # with step(K) = alpha*K - beta a lower bound on the per-pair increment. + alpha = Fr(4 * a) * (2 * a * B) / (3 * a + 1) + beta = (2 * a * a * B * (1 - B)) * (Fr(3, 2 * a) + Fr(3 * x0, 4 * a * a)) + k_start = (s1 - 1) // 2 + p_max + base = w_sum - margin1 - C_STEP * p_max + lin = alpha * k_start - beta - C_STEP + quad = alpha / 2 + require(quad > 0, 'tail quadratic coefficient') + # Q(n) = quad*n^2 + (lin-quad)*n + base for integer n >= 1; its minimum + # over all real n bounds every integer value from above... conversely, + # positivity of the real minimum implies positivity at every integer n. + vmin = base - (lin - quad) * (lin - quad) / (4 * quad) + require(vmin > 0, 'tail beyond p_max fails at the quadratic minimum') + return worst + + +def part_c(): + # Cross-check the closed-form slot masses against the engine. + for h_check in (7, 10, 12, 20, 40): + a_check = h_check - 1 + for s_check in (3, 5, 9, 99, 201): + prof0, _m, _d = skel.profile(s_check, h_check, 1, Fr(22, XDEN)) + engine_mass = sum(z * cap for cap, z in prof0.items()) + require(engine_mass == slot_masses(s_check, a_check, Fr(22, XDEN)), + 'slot mass formula mismatch at s=%d h=%d' % (s_check, h_check)) + maps = {} + sup_hi = None + sup_arg = None + sup_bracket = None + for h in range(H_MIN, H_MAX + 1): + a = h - 1 + row = {} + s1 = None + s = 3 + while s <= 401: + u_lo, u_hi, m = threshold_brackets(s, h) + if u_hi <= C_FLOOR: + # Certified non-beat at C = 22 for this s (C* <= u_hi <= 22). + # Try to close the tail here; stages before the closure point + # are each certified non-beat by their own bracket, so the + # closure may start at any non-beat stage. + prof, m2, deficit = skel.profile(s, h, 1, Fr(C_FLOOR, XDEN)) + require(deficit > 0, 'deficit sign at closure candidate') + flo, fhi = cert.F_iv(prof, m2, B) + require(flo >= deficit, + 'bracket/direct disagreement at h=%d s=%d' % (h, s)) + margin1 = deficit - flo # <= 0: certified gap upper bound + try: + tail_closure_margin(a, Fr(22, XDEN), s, margin1) + s1 = s + break + except AssertionError: + pass # keep scanning; this s is + # still certified non-beat, closure starts later. + else: + t_hi = u_hi.__ceil__() - 1 + t_lo = u_lo.__ceil__() - 1 if u_lo > C_FLOOR else None + row[s] = (t_lo, t_hi) + if sup_hi is None or t_hi > sup_hi: + sup_hi = t_hi + sup_arg = (s, h) + sup_bracket = (u_lo, u_hi) + s += 2 + if s1 is None: + raise AssertionError('window %d never closes within scan' % h) + maps[h] = {'s1': s1, 'row': row} + require(sup_hi is not None, 'empty screen') + require(sup_bracket[1] > sup_bracket[0], 'degenerate sup bracket') + return maps, sup_hi, sup_arg, sup_bracket + + +def part_d(): + cap = X_BIT / (1 + X_BIT) + require(cap > KAPPA_SELECTED, 'bit cap below selected record') + # Every screen argmax point clears the bit side, so the cap binds there. + for s, h, cost in ((9, 10, 29), (3, 10, 25), (9, 8, 30), (9, 7, 31)): + result = skel.X(s, h, 1, Fr(cost, XDEN)) + require(result is not None and result['lo'] > X_BIT, + 'boundary point does not clear the bit side at %r' % ((s, h, cost),)) + gain = float(cap / KAPPA_SELECTED - 1) * 100 + return {'x_bit': str(X_BIT), 'kappa_cap': str(cap), + 'gain_percent': gain} + + +def part_e(sup_arg, sup_hi): + """Negative controls: tampered inputs must flip the verdicts.""" + s_arg, h_arg = sup_arg + # C1: closed form and direct root finding agree (certified implications; + # the brackets are ~1e-42 wide, far below any integer gap). + for s, h, cost in ((9, 10, 29), (9, 10, 30), (3, 10, 25), (3, 10, 26), + (7, 7, 31), (7, 7, 32), (15, 7, 27), (15, 7, 28)): + u_lo, u_hi, _m = threshold_brackets(s, h) + require(u_hi - u_lo < Fr(1, 10 ** 30), 'bracket not tight') + direct = beat_direct(s, h, cost) + if cost < u_lo: + require(direct, 'closed form says beat, direct disagrees') + if cost >= u_hi: + require(not direct, 'closed form says no-beat, direct disagrees') + # C2: doubling b must flip the argmax boundary beat to false. + require(beat_direct(s_arg, h_arg, sup_hi, B) is True, 'argmax must beat') + require(beat_direct(s_arg, h_arg, sup_hi, 2 * B) is False, + 'doubled b did not flip the beat verdict') + # C3: a tampered pattern must change the clean census. + reps, images, adjacent, flats = part_a() + tampered = list(adjacent) + for i in range(40): + done = False + for j in range(40): + if i != j and not (adjacent[i] >> j) & 1: + tampered[i] |= (1 << j) + tampered[j] |= (1 << i) + done = True + break + if done: + break + changed = clean_pairs_census(tampered, flats) + require(changed != 7033, 'tampered pattern left the clean census unchanged') + # C4: the star witness must depend on the exact pattern. Adding one + # nonorthogonality (i, j) removes i from star j's readers and j from + # star i's; if some single addition pushes a star cost above 1, the + # total-40 witness is genuinely geometry-dependent (existential control). + def star_cost(pattern, t): + readers = [s for s in range(40) + if s == t or not (pattern[s] >> t) & 1] + rows = [] + for s in readers: + rows += [reps[s], images[s]] + return G.pairing_rank(G.echelon(tuple(rows)), (reps[t], images[t])) + + def star_total(pattern): + return sum(star_cost(pattern, t) for t in range(40)) + + require(star_total(adjacent) == 40, 'true star total drifted') + # C4a: the frame witness needs orthogonality, not just any partition: + # the naive consecutive 4-blocks pattern must violate the zero-pattern. + naive = [[0] * 40 for _ in range(40)] + for start in range(0, 40, 4): + for t in range(start, start + 4): + for s in range(start, start + 4): + naive[t][s] = 1 + illegal = any(t != s and (adjacent[t] >> s) & 1 and naive[t][s] + for t in range(40) for s in range(40)) + require(illegal, 'naive partition pattern is legal; witness not structural') + # C4b: the star cost is not vacuously constant: removing the self-loop + # must drop the star cost to 0 (distinct F2-lines intersect trivially). + star_no_self = G.pairing_rank( + G.echelon(tuple(x for s in range(40) + if s != 0 and not (adjacent[s] >> 0) & 1 + for x in (reps[s], images[s]))), + (reps[0], images[0])) + require(star_no_self == 0, 'star without self-loop should cost 0') + + +def main(): + summary = {} + reps, images, adjacent, flats = part_a() + summary['geometry'] = {'lines': 40, 'flats': len(flats), + 'all_flats_nonsingular': True} + summary['clean_class'] = part_b(reps, images, adjacent, flats) + maps, sup_hi, sup_arg, sup_bracket = part_c() + summary['screen'] = { + 'window_range': [H_MIN, H_MAX], + 'sup_integer_threshold': sup_hi, + 'sup_arg': {'s': sup_arg[0], 'h': sup_arg[1]}, + 'sup_bracket': [str(sup_bracket[0]), str(sup_bracket[1])], + 'sup_bracket_decimal': [float(sup_bracket[0]), float(sup_bracket[1])], + 'viable_ends': {h: maps[h]['s1'] for h in (7, 8, 9, 10)}, + 'window_maxima': {h: max(t[1] for t in maps[h]['row'].values()) + for h in (7, 8, 9, 10)}, + } + summary['prize'] = part_d() + part_e(sup_arg, sup_hi) + summary['negative_controls'] = 4 + print(json.dumps(summary, indent=1)) + print('PASS_EISENSTEIN_PHASE_COST_SCREEN: ' + 'clean-class floor 40; certified necessary threshold <= %d ' + '(bracket %.6f..%.6f at s=%d h=%d); no new kappa' + % (sup_hi, float(sup_bracket[0]), float(sup_bracket[1]), + sup_arg[0], sup_arg[1])) + + +if __name__ == '__main__': + main()