// Audit of research/transition-joint-budget.md sections 3.3-3.4: // the saturation (8), the derived short-window constraint (9), and the constants // feeding both. Exact rationals where the note is exact. No compute, no network. const g = (a, b) => b ? g(b, a % b) : (a < 0 ? -a : a); class Q { constructor(n, d = 1) { if (d < 0) { n = -n; d = -d; } const k = g(Math.abs(n), d) || 1; this.n = n / k; this.d = d / k; } mul(o) { return new Q(this.n * o.n, this.d * o.d); } div(o) { return new Q(this.n * o.d, this.d * o.n); } get v() { return this.n / this.d; } get s() { return this.d === 1 ? '' + this.n : this.n + '/' + this.d; } eq(o) { return this.n === o.n && this.d === o.d; } } const q = (n, d) => new Q(n, d); const wL = q(6, 25), wR = q(1, 20); console.log('=== 1. The side weights cross-check against the cutoff exponents ==='); console.log(' w_L = ' + wL.s + ' = ' + wL.v + ' w_R = ' + wR.s + ' = ' + wR.v); console.log(' these are exactly the V and Z exponents of global-cutoff-averaging.md section 2'); console.log(' (V = x^{6/25}, Z = x^{1/20}), so the two notes agree on the same two parameters.'); console.log('\n=== 2. (8) follows from the single-side lower bound, exactly ==='); // ||T_i||^2 >= (L_0 w_i eta / 64) x log^2 x => ||T_i|| >= sqrt(L_0 w_i eta/64) sqrt(x) log x // product >= (L_0 eta / 64) sqrt(w_L w_R) x log^2 x const prodConst = wL.mul(wR); console.log(' ||T_L|| ||T_R|| >= (L_0 eta/64) * sqrt(w_L w_R) * x log^2 x'); console.log(' sqrt(w_L w_R) = sqrt(' + prodConst.s + ') = ' + Math.sqrt(prodConst.v).toFixed(6)); console.log(' matches (8)\'s displayed L_0 sqrt(w_L w_R) eta x log^2 x / 64: STRUCTURE EXACT'); console.log('\n=== 3. The factor 64, and where it comes from ==='); // T = P + (Q - Ctilde), ||Q - Ctilde|| <= ||P||/2 eventually => ||T|| >= ||P||/2 => ||T||^2 >= ||P||^2/4. // With the prime lower coefficient 1/16 on ||P||^2: ||T||^2 >= (1/16)(1/4) = 1/64. const sixteen = q(1, 16), quarter = q(1, 4); console.log(' ||T|| >= ||P|| - ||Q - Ctilde|| >= ||P|| - ||P||/2 = ||P||/2 => ||T||^2 >= ||P||^2/4'); console.log(' prime lower coefficient 1/16, times 1/4 = ' + sixteen.mul(quarter).s + ' the notes 1/64: ' + (sixteen.mul(quarter).eq(q(1, 64)) ? 'EXACT' : 'DIFF')); console.log('\n=== 4. theta_eff <= 4B, exactly ==='); // M_{(D,S]} = M(.,S) - M(.,D), and (a-b)^2 <= 2a^2 + 2b^2, so with each side <= BN: console.log(' (a-b)^2 <= 2a^2 + 2b^2, each uniform square bound <= B N'); console.log(' => Sigma_{(D,S]}(N) <= 2BN + 2BN = 4BN the notes theta_eff = min(theta, 4B): EXACT'); // demonstrate the inequality is sharp in the constant 2 let worst = 0; // Seeded so the sampled sup is reproducible. Math.random() is unseeded, and this // value is printed to stdout: the rounding to 6 dp hides it (the ratio is 1 - eps^2/2 // near b = -a, so 200k samples round to 1.000000 with overwhelming probability), but // an unseeded draw reaching the artifact is exactly what the recipe rule forbids. // mulberry32, 32-bit, self-contained; no dependency. let _s = 0x9E3779B9 >>> 0; const rnd = () => { _s = (_s + 0x6D2B79F5) >>> 0; let t = _s; t = Math.imul(t ^ (t >>> 15), t | 1) >>> 0; t = (t ^ (t + Math.imul(t ^ (t >>> 7), t | 61))) >>> 0; return ((t ^ (t >>> 14)) >>> 0) / 4294967296; }; for (let i = 0; i < 200000; i++) { const a = rnd() * 2 - 1, b = rnd() * 2 - 1; worst = Math.max(worst, (a - b) * (a - b) / (2 * a * a + 2 * b * b)); } console.log(' sup over random (a,b) of (a-b)^2/(2a^2+2b^2) = ' + worst.toFixed(6) + ' (approaches 1 at b = -a, so the constant 4 cannot be lowered by this route)'); console.log('\n=== 5. (9): the eta cancels exactly - the structural point ==='); // nu(S)^2 <= 2 eta theta(S) x log^2 x => nu(S) <= sqrt(2 eta theta(S)) sqrt(x) log x // _S >= ||T_i|| >= sqrt(L_0 w_i eta/64) sqrt(x) log x // => sqrt(2 eta) * (1/L_i) int sqrt(theta) dS/S >= sqrt(L_0 w_i eta/64) // => (1/L_i) int sqrt(theta) dS/S >= sqrt(L_0 w_i eta / (64 * 2 eta)) = sqrt(L_0 w_i / 128) console.log(' LHS carries sqrt(2 eta); RHS carries sqrt(L_0 w_i eta/64).'); console.log(' dividing: sqrt(L_0 w_i eta / (64 * 2 eta)) = sqrt(L_0 w_i / 128) -- eta CANCELS'); console.log(' 64 * 2 = 128, matching (9): ' + (64 * 2 === 128 ? 'EXACT' : 'DIFF')); console.log(' so (9) is eta-free, which is why it constrains ANY short-window input and not'); console.log(' merely the small-fixed-eta regime the rest of section 3 works in.'); for (const [lab, w] of [['left ', wL], ['right', wR]]) console.log(' ' + lab + ' RHS = sqrt(L_0 * ' + w.s + '/128) = ' + Math.sqrt(w.v / 128).toFixed(6) + ' * sqrt(L_0)'); console.log('\n=== 6. NEW: (9) plus the cap forces a numerical floor on B ==='); // theta_eff <= 4B pointwise, so the average of sqrt(theta_eff) is at most sqrt(4B) = 2 sqrt(B). // (9) then forces 2 sqrt(B) >= sqrt(L_0 w_i / 128), i.e. B >= L_0 w_i / 512. console.log(' theta_eff <= 4B everywhere => (1/L_i) int sqrt(theta_eff) dS/S <= sqrt(4B) = 2 sqrt(B)'); console.log(' (9) then gives 2 sqrt(B) >= sqrt(L_0 w_i/128), i.e. B >= L_0 w_i / 512:'); for (const [lab, w] of [['left (w = 6/25)', wL], ['right (w = 1/20)', wR]]) { const fl = w.div(q(512)); console.log(' ' + lab + ' B >= L_0 * ' + fl.s + ' = ' + fl.v.toExponential(4) + ' * L_0'); } console.log(' check: (6/25)/512 = 3/6400 and (1/20)/512 = 1/10240 ' + (wL.div(q(512)).eq(q(3, 6400)) && wR.div(q(512)).eq(q(1, 10240)) ? 'EXACT' : 'DIFF')); console.log(' Reading: no uniform square bound (H) can have B below that floor. The'); console.log(' constraint is not merely on the integral of sqrt(theta) - it is a numerical'); console.log(' lower bound on the CONSTANT of any admissible short-window hypothesis.');