// ============================================================================ // ATTACK — A LEVEL-UNIFORM UPPER BOUND ON max VR (2026-08-26) // ============================================================================ // WHY THIS FILE EXISTS. `README.md` §Status names one thing as the blocker on // the all-x form of the X-limitation theorem: "the all-x form is open for want // of a level-uniform bound on max VR". `natal-cap-31-calm-vs-kill.md` boxes it // as the Loudness Ceiling Conjecture, max_t VR(t) < S̄²/(K·V̄) for every x ≥ 13, // supported at exactly four levels by EXHAUSTIVE ENUMERATION of the rotation // ensemble (2,310 / 30,030 / 510,510 / 9,699,690 rotations) and nowhere else. // This file attacks the bound and, on the way, audits what else the all-x form // needs that the Status sentence does not name. // // THE OBJECTS, EXACTLY AS THE ENUMERATORS DEFINE THEM (cap-31, cap-38). // Level x. Tile W = 30·∏_{7≤p≤x} p. Natal set ρ = {r ∈ [0,W) : r ≡ 11 or 17 // (mod 30), and r ≢ 0, −2 (mod p) for every 7 ≤ p ≤ x}; N̄ = |ρ|. // Scour primes qs = {q prime : x < q, q² ≤ W}; K = |qs|; H = Σ_q 2/q. // Class counts n_q(a) = #{r ∈ ρ : r ≡ a (mod q)}. // CLASS DEVIATION dev_q(a) = n_q(a) + n_q(a−2) − 2N̄/q. // PER-PRIME ROTATION VARIANCE V̄_q = (1/q)·Σ_{a mod q} dev_q(a)² ; // V̄ = Σ_q V̄_q. // LOUDNESS VR(t) = ( Σ_q dev_q(t mod q)² ) / V̄ , t ∈ [0,W). // max VR = max over the W rotations. Strike surplus D(t) = Σ_q dev_q(t mod q), // so Cauchy–Schwarz gives |D(t)| ≤ √(K·V̄·VR(t)) — cap-31's L2 — and the // per-level hypothesis carrying the X-limitation theorem is exactly // √(K·V̄·max VR) < S̄, i.e. max VR < S̄²/(K·V̄). // // WHAT THIS FILE ADDS, AS A ONE-LINE THEOREM. // (T1) ALIGNMENT BOUND. For every level x, // max_t VR(t) ≤ A(x) := ( Σ_q max_a dev_q(a)² ) / V̄ , // because VR(t) sums one class per prime and each summand is at most // that prime's own maximum. A(x) needs NO rotation sweep: it is K // independent per-prime maxima, O(N̄·K) work, so it is computable at // levels where the ensemble cannot be walked. It is loose by exactly the // amount by which no single rotation can maximise every prime at once. // (T2) V̄-FREE FORM. The theorem's hypothesis √(K·V̄·max VR) < S̄ is, after // multiplying out, K·max_t Σ_q dev_q(t mod q)² < S̄². So V̄ cancels and // a sufficient condition is K · Σ_q max_a dev_q(a)² < S̄² . This // removes V̄ — and with it any need for a LOWER bound on V̄ — from the // all-x problem. // (T3) The remaining need is an upper bound on max_a dev_q(a)², uniform in q // and in x. Three candidates are priced here, all three deterministic: // (a) TRIVIAL CLASS BOUND: n_q(a) ≤ 2⌈W/(30q)⌉ from the mod-30 comb // alone, so |dev_q(a)| ≤ max( (2/q)(2W/30 − N̄) + 4 , 2N̄/q ). // (b) MOMENT BOUND: max_a dev² ≤ (q·μ_{2m}(q))^{1/m} for every m ≥ 1, // μ_{2m}(q) = (1/q)Σ_a dev_q(a)^{2m}. Minimised over m ≤ 8. Gaussian // moments would give ≈ 2 ln q · V̄_q; this measures the truth. // (c) COMPLETED-SUM (FOURIER) CERTIFICATE. n_q(a) is a window count of a // DILATE of the natal comb: r = a + jq, j ∈ [0,L), L = ⌈W/q⌉, and // 1_ρ(a+jq) has the natal spectrum permuted by k ↦ q^{-1}k. So the // usual incomplete-sum bound needs a majorant invariant under that // permutation. |Ŝ(k)| = 2|cos(πu₃₀/5)|·∏_p f_p(u_p), u_m = k·y_m // mod m with y_m = (W/m)^{-1} mod m (the CRT twist wall-note §Door 2 // records an earlier file for dropping), f_p(0) = p−2 and // f_p(u) = 2|cos(2πu/p)| otherwise. Since u_p = 0 ⟺ p | k, the // majorant B(k) = 2·∏_{7≤p≤x} (p | k ? p−2 : 2) dominates |Ŝ(k)| // AND is invariant under k ↦ qk for q coprime to W. Hence, for every // scour q and every class a, // |n_q(a) − N̄/q| ≤ 1 + (1/W)·Σ_{k≠0} B(k)·min(L, W/(4|k|_W)), // using |Σ_{j Number.isFinite(v) ? v.toFixed(d) : String(v); const e2 = (v) => Number.isFinite(v) ? v.toExponential(3) : String(v); function primesUpTo(n){const s=new Uint8Array(n+1),o=[];for(let i=2;i<=n;i++){if(!s[i]){o.push(i);for(let j=i*i;j<=n;j+=i)s[j]=1;}}return o;} function inv(a,m){let r0=((a%m)+m)%m,r1=m,s0=1,s1=0; while(r1!==0){const q=Math.floor(r0/r1);[r0,r1]=[r1,r0-q*r1];[s0,s1]=[s1,s0-q*s1];} return ((s0%m)+m)%m;} // The four enumerated levels. Custody targets, taken from the EMBEDDED output // block of `natal-cap-38-loudness-driver.js` (its four level banners give W, N, // K, H, V̄; its PART B/summary give S̄ and max VR) and from // `natal-cap-31-calm-vs-kill.md` §Theorem 2. Every one is recomputed below and // the comparison is printed. // NOTE, and it cost a run: the first version of this table read V̄ = 15.03 / // 120.24 / 1146.19 at @11/@13/@17, taken from cap-31's "Var split D + X − // 2Cov" row. That row's first entry is Var(D), NOT V̄. Var(D) = Var(Σ_q dev_q) // carries the cross-prime covariances; V̄ = Σ_q Var_q does not. They agree to // about 0.2% here and are different objects. cap-38's banners are the right // source and this file reproduces them to the digit. const KNOWN = { 11:{maxVR:2.777, Vbar:15.07, Sbar:38.24, K:10, N:90}, 13:{maxVR:2.352, Vbar:119.58, Sbar:310.88, K:34, N:990}, 17:{maxVR:2.143, Vbar:1144.40, Sbar:3614.93, K:120, N:14850}, 19:{maxVR:2.293, Vbar:8944.60, Sbar:49238.76, K:435, N:252450}, }; const SWEEP_MAX_W = 1e7; // full rotation walk only where it is affordable const MOMENTS = 8; // μ_2 … μ_16 // ---------------------------------------------------------------- level build function buildLevel(x){ const basePs = primesUpTo(x).filter(p=>p>=7); const W = 30*basePs.reduce((a,b)=>a*b,1); let ind = new Uint8Array(W); for(let r=11;rmg)mg=g; prev=rho[i];} gaps.maxGap = mg;} const qs = primesUpTo(Math.floor(Math.sqrt(W))+1).filter(q=>q>x && q*q<=W); const H = qs.reduce((a,q)=>a+2/q,0); return {x, W, rho, N:cnt, gaps, maxGap:gaps.maxGap, qs, K:qs.length, H, basePs, y:qs[qs.length-1]}; } // ------------------------------------- per-prime class deviations and moments // Returns, per scour prime q: V̄_q = μ_2, M_q = max_a dev², maxAbs, the even // moments μ_{2m} up to m = MOMENTS, and (when asked) the dev² row for the sweep. function classStats(L, keepRows){ const {rho,N,gaps,maxGap,qs,K,y} = L; const n = new Int32Array(y+1); const Vq = new Float64Array(K), Mq = new Float64Array(K), maxAbs = new Float64Array(K); const mom = []; for(let m=0;mmaxGap){ for(let i=0;i=q)c-=q; n[c]++; } } else { for(let i=0;i=2 ? a-2 : a+q-2; const d = n[a]+n[a2]-mu, d2 = d*d; if(row) row[a]=d2; ss += d2; if(d2>M)M=d2; const ad=Math.abs(d); if(ad>ma)ma=ad; let pw = d2; for(let m=0;mvmax){vmax=v;targ=t;} } return {maxVR:vmax/Vbar, VR0:vsum[0]/Vbar, meanVR:tot/W/Vbar, targ}; } // ------------------------------------------------- S̄ by cap-38's exact identity // Σ_t S(t) = Σ_{r∈ρ} (P[r+W] − P[r]), P the prefix sum of g over u ∈ [−W+1,W−1], // g(u) = 1 iff u ≢ 0, −2 (mod q) for every scour q, index idx = u + W − 1. function meanS(L){ const {W,rho,N,qs} = L; const M = 2*W-1; const g = new Uint8Array(M); g.fill(1); for(const q of qs){ // u ≡ 0 (mod q): idx ≡ W−1 (mod q); u ≡ −2 (mod q): idx ≡ W−3 (mod q) let s0 = ((W-1)%q+q)%q; for(let i=s0;iinv((W/m)%m, m)); const tbl = mods.map((m,i)=>{ const t = new Float64Array(m); if(m===30){ for(let u=0;u<30;u++) t[u]=2*Math.abs(Math.cos(Math.PI*u/5)); } else { t[0]=m-2; for(let u=1;u{ const t = new Float64Array(m); if(m===30){ t.fill(2); } else { t[0]=m-2; for(let u=1;u0); let TOT2=0, TOT2s=0, s1=0, s2=0, s1s=0, s2s=0; const half = Math.floor(W/2); for(let k=1;k<=half;k++){ let B=1, S=1; for(let i=0;i=mods[i]) uu-=mods[i]; u[i]=uu; B *= bmaj[i][uu]; S *= tbl[i][uu]; } TOT2 += B/k; TOT2s += S/k; if(k<=KCUT){ s1+=B; s2+=B/k; s1s+=S; s2s+=S/k; P1[k]=s1; P2[k]=s2; P1s[k]=s1s; P2s[k]=s2s; } } const Cb = new Float64Array(K), Cs = new Float64Array(K); for(let j=0;jKCUT) kap=KCUT; if(kap<0) kap=0; Cb[j] = (2/W)*( Lw*P1[kap] + (W/4)*(TOT2 - P2[kap]) ) + 1; Cs[j] = (2/W)*( Lw*P1s[kap] + (W/4)*(TOT2s - P2s[kap]) ) + 1; } return {Cb, Cs, TOT2, TOT2s}; } // ============================================================================ // DRIVER // ============================================================================ const LEVELS = [11,13,17,19,23]; const ROWS = []; console.log('===== DEFINITIONS: dev_q(a) = n_q(a)+n_q(a−2) − 2N̄/q ; V̄_q = mean_a dev_q(a)² ;'); console.log(' VR(t) = Σ_q dev_q(t mod q)² / V̄ ; A(x) = Σ_q max_a dev_q(a)² / V̄ ≥ max_t VR(t).'); for(const x of LEVELS){ const t0 = Date.now(); const L = buildLevel(x); const keep = L.W <= SWEEP_MAX_W; const CS = classStats(L, keep); let Vbar=0, SumM=0, SumTriv=0, SumMom=0, SumCert=0; const Rq = new Float64Array(L.K), Rmom = new Float64Array(L.K); const kurt = new Float64Array(L.K); for(let j=0;j= CS.maxAbs[j]) certOK++; } const Sbar = meanS(L); const K = L.K; const thr = Sbar*Sbar/(K*Vbar); const sw = keep ? sweepMaxVR(L, CS.rows, Vbar) : null; const kn = KNOWN[x]; const ok=(a,b,tol)=>Math.abs(a-b)<=tol?'PASS':'FAIL'; console.log(`\n===== @${x}: W=${L.W} N̄=${L.N} K=${K} (${L.qs[0]}..${L.y}) H=${f(L.H,4)} lnW=${f(Math.log(L.W),3)} maxNatalGap=${L.maxGap}`); if(kn){ console.log(` CUSTODY vs cap-31/cap-38: N̄ ${L.N} [${kn.N} ${ok(L.N,kn.N,0)}] K ${K} [${kn.K} ${ok(K,kn.K,0)}] V̄ ${f(Vbar,2)} [${kn.Vbar} ${ok(Vbar,kn.Vbar,0.02)}] S̄ ${f(Sbar,2)} [${kn.Sbar} ${ok(Sbar,kn.Sbar,0.02)}]` + (sw?` maxVR ${f(sw.maxVR,3)} [${kn.maxVR} ${ok(sw.maxVR,kn.maxVR,0.002)}] VR(0) ${f(sw.VR0,3)} meanVR ${f(sw.meanVR,4)}`:' maxVR: NOT ENUMERATED (W beyond sweep)')); } else { console.log(` V̄ = ${f(Vbar,2)} S̄ = ${f(Sbar,2)} maxVR: NOT ENUMERATED (W beyond sweep)`); } console.log(` THRESHOLD S̄²/(K·V̄) = ${f(thr,2)}` + (sw?` enumerated max VR = ${f(sw.maxVR,3)} margin ×${f(thr/sw.maxVR,1)}`:'')); console.log(` (T1) ALIGNMENT BOUND A(x) = Σ_q max_a dev_q(a)² / V̄ = ${f(A,4)}` + (sw?` A ≥ maxVR ? ${A>=sw.maxVR?'PASS':'FAIL'} slack A/maxVR = ×${f(A/sw.maxVR,2)}`:'') + ` A/lnW = ${f(A/Math.log(L.W),4)}`); const Dcap = Math.sqrt(K*SumM); console.log(` (T2) V̄-FREE TEST K·Σ_q max_a dev² = ${e2(K*SumM)} vs S̄² = ${e2(Sbar*Sbar)} ${K*SumMmaxR){maxR=Rq[j];argR=L.qs[j];} } console.log(` PER-PRIME mean R_q = ${f(sR/K,3)} (mean 2 ln q = ${f(sL/K,3)}, ratio ${f((sR/K)/(sL/K),3)}) max R_q = ${f(maxR,3)} at q=${argR} (q itself = ${argR}, the trivial ceiling) mean μ4/μ2² = ${f(sK/K,3)}`); const sample=[0,1,2,Math.floor(K/4),Math.floor(K/2),K-2,K-1].filter((v,i,arr)=>v>=0&&v0?'positive':'NEGATIVE'}`); console.log(` Brun level check: #subsets of size ≤ 3 with signs, 2³·C(K,3) = ${e2(8*K*(K-1)*(K-2)/6)} vs W = ${e2(L.W)} ${8*K*(K-1)*(K-2)/6 < L.W ? 'level fits':'LEVEL EXCEEDED — the O(1)-per-subset remainder outruns the main term'}`); ROWS.push({x, lnW:Math.log(L.W), K, Vbar, Sbar, thr, A, maxVR: sw?sw.maxVR:NaN, direct:K*SumM, S2:Sbar*Sbar, mom:SumMom/Vbar, triv:K*SumTriv/(Sbar*Sbar), cert:K*SumCert/(Sbar*Sbar), meanR:sR/K, s_par}); console.log(` [level time ${(Date.now()-t0)/1000}s]`); } console.log('\n===== SUMMARY — the alignment bound against the threshold ====='); console.log(' x | lnW | K | V̄ | S̄ | threshold | enum maxVR | A(x) | A/lnW | margin thr/A | (T2) S̄²/(K·Σmax) | cert/S̄²'); for(const r of ROWS){ console.log(` ${String(r.x).padStart(2)} | ${f(r.lnW,3)} | ${String(r.K).padStart(5)} | ${f(r.Vbar,2).padStart(10)} | ${f(r.Sbar,2).padStart(10)} | ${f(r.thr,2).padStart(9)} | ${(Number.isFinite(r.maxVR)?f(r.maxVR,3):' — ').padStart(10)} | ${f(r.A,3).padStart(6)} | ${f(r.A/r.lnW,4).padStart(6)} | ${('×'+f(r.thr/r.A,1)).padStart(12)} | ${('×'+f(r.S2/r.direct,1)).padStart(17)} | ${e2(r.cert).padStart(9)}`); } console.log('\n growth of A(x) between consecutive levels, and of the threshold:'); for(let i=1;i