// Audit of research/left-divisor-signs.md sections 4-5, in exact rationals. // No compute, no network. Every figure below is re-derived from the note's own // parameters; nothing is imported except the two Lemma II constants. const g = (a, b) => b ? g(b, a % b) : (a < 0 ? -a : a); class Q { // exact rational 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; } add(o) { return new Q(this.n * o.d + o.n * this.d, this.d * o.d); } sub(o) { return new Q(this.n * o.d - o.n * this.d, this.d * o.d); } mul(o) { return new Q(this.n * o.n, this.d * o.d); } 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 ok = (x, y) => x.eq(y) ? 'EXACT' : 'DIFF (' + x.s + ' vs ' + y.s + ')'; // box: a = 8/25 + rho, b = 9/20 + sigma; top of the sector box rho = 6/25, sigma = 1/20 const A = r => q(8, 25).add(r), Bb = s => q(9, 20).add(s); const rhoTop = q(6, 25), sigTop = q(1, 20); const aTop = A(rhoTop), bTop = Bb(sigTop); console.log('=== 0. the box ==='); console.log(' a = 8/25 + rho, b = 9/20 + sigma; top (rho,sigma) = (6/25, 1/20)'); console.log(' a_top = ' + aTop.s + ' = ' + aTop.v + ' b_top = ' + bTop.s + ' = ' + bTop.v); console.log('\n=== 1. Grouped moment (14), section 4, in the notes (rho,sigma) coordinates ==='); const Zero = (r, s) => q(33, 50).add(r.mul(q(1, 2))); const Cross = (r, s) => q(167, 200).add(r.mul(q(1, 2))).add(s.mul(q(3, 2))); const Per = (r, s) => q(8, 25).add(r); console.log(' at rho=0, sigma=1/20 cross = ' + Cross(q(0), sigTop).s + ' claimed 91/100 ' + ok(Cross(q(0), sigTop), q(91, 100))); console.log(' at the top cross = ' + Cross(rhoTop, sigTop).s + ' claimed 103/100 ' + ok(Cross(rhoTop, sigTop), q(103, 100))); console.log(' zero at top = ' + Zero(rhoTop, sigTop).s + ' < 1, period at top = ' + Per(rhoTop, sigTop).s + ' < 1 => only cross can reach one: ' + (Zero(rhoTop, sigTop).v < 1 && Per(rhoTop, sigTop).v < 1 ? 'CONFIRMED' : 'FAILS')); console.log(' cross < 1 <=> rho + 3 sigma < 33/100 (display (1)): ' + ok(q(1).sub(q(167, 200)).mul(q(2)), q(33, 100))); console.log('\n=== 2. Lemma II, section 4 ==='); const E1 = (r, s) => q(77, 100).add(s).add(r.mul(q(1, 2))); const E2 = (r, s) => q(289, 400).add(r).add(s.mul(q(5, 4))); const E3 = (r, s) => q(109, 200).add(r).add(s.mul(q(1, 2))); console.log(' at the top: E1 = ' + E1(rhoTop, sigTop).s + ' = ' + E1(rhoTop, sigTop).v + ', E2 = ' + E2(rhoTop, sigTop).s + ' = ' + E2(rhoTop, sigTop).v + ', E3 = ' + E3(rhoTop, sigTop).s + ' = ' + E3(rhoTop, sigTop).v); console.log(' E1, E3 < 1 on the box: ' + (E1(rhoTop, sigTop).v < 1 && E3(rhoTop, sigTop).v < 1 ? 'CONFIRMED' : 'FAILS') + ' E2 at top = 41/40: ' + ok(E2(rhoTop, sigTop), q(41, 40))); console.log(' E2 < 1 <=> rho + 5 sigma/4 < 111/400 (display (2)): ' + ok(q(1).sub(q(289, 400)), q(111, 400))); console.log('\n=== 3. Where the two budgets cross, and the surviving set ==='); // (1) fails: rho >= 33/100 - 3 sigma ; (2) fails: rho >= 111/400 - 5 sigma/4 const t1 = s => q(33, 100).sub(s.mul(q(3))); const t2 = s => q(111, 400).sub(s.mul(q(5, 4))); const sCross = q(3, 100); console.log(' at sigma = 3/100: (1) gives rho < ' + t1(sCross).s + ', (2) gives rho < ' + t2(sCross).s + ' equal and = 6/25: ' + (t1(sCross).eq(t2(sCross)) && t1(sCross).eq(q(6, 25)) ? 'EXACT' : 'DIFF')); console.log(' => the deficit needs sigma >= 3/100, i.e. the right prime power q >= x^(3/100),'); console.log(' against its ceiling x^(1/20) = x^(5/100).'); console.log(' at sigma = 1/20: (1) fails from rho >= ' + t1(sigTop).s + ' (= 9/50, the old threshold),'); console.log(' (2) fails from rho >= ' + t2(sigTop).s + ' claimed 43/200 ' + ok(t2(sigTop), q(43, 200))); console.log(' both must fail, so the surviving range is rho in [43/200, 6/25] = [' + q(43, 200).v + ', ' + q(6, 25).v + '] matches "x^0.215 <= r <= x^0.24"'); const blockExp = E2(rhoTop, sigTop).v < Cross(rhoTop, sigTop).v ? E2(rhoTop, sigTop) : Cross(rhoTop, sigTop); console.log(' block exponent = min(cross, E2) at the top = ' + blockExp.s + ' ' + ok(blockExp, q(41, 40))); console.log(' deficit falls from ' + Cross(rhoTop, sigTop).sub(q(1)).s + ' to ' + blockExp.sub(q(1)).s + ' claimed 3/100 -> 1/40: ' + (Cross(rhoTop, sigTop).sub(q(1)).eq(q(3, 100)) && blockExp.sub(q(1)).eq(q(1, 40)) ? 'EXACT' : 'DIFF')); console.log(' moment currency doubles both: 3/50 and 1/20: ' + (q(3, 100).mul(q(2)).eq(q(3, 50)) && q(1, 40).mul(q(2)).eq(q(1, 20)) ? 'EXACT' : 'DIFF')); console.log('\n=== 4. NEW: the same budgets in (a,b) are much cleaner ==='); // substitute rho = a - 8/25, sigma = b - 9/20 and collect. const chk = (name, f, closed) => { let all = true; for (const [rn, rd, sn, sd] of [[0, 1, 0, 1], [6, 25, 1, 20], [1, 10, 1, 50], [3, 25, 7, 200]]) { const r = q(rn, rd), s = q(sn, sd), a = A(r), b = Bb(s); if (!f(r, s).eq(closed(a, b))) all = false; } console.log(' ' + name.padEnd(26) + (all ? 'IDENTITY HOLDS' : 'NOT AN IDENTITY')); }; chk('Zero = (1+a)/2', Zero, (a, b) => q(1).add(a).mul(q(1, 2))); chk('Cross = a/2 + 3b/2', Cross, (a, b) => a.mul(q(1, 2)).add(b.mul(q(3, 2)))); chk('Period = a', Per, (a, b) => a); chk('E3 = a + b/2', E3, (a, b) => a.add(b.mul(q(1, 2)))); chk('E1 = a/2 + b + 4/25', E1, (a, b) => a.mul(q(1, 2)).add(b).add(q(4, 25))); chk('E2 = a + 5b/4 - 4/25', E2, (a, b) => a.add(b.mul(q(5, 4))).sub(q(4, 25))); console.log(' In these coordinates the corner a = b = 1 is immediate:'); console.log(' Zero = ' + q(1).add(q(1)).mul(q(1, 2)).s + ', Cross = ' + q(1, 2).add(q(3, 2)).s + ', Period = 1 matching section 5\'s row "1 (zero), 2 (cross), 1 (period)"'); console.log(' and the swap rule is manifest: a<->b sends Cross to b/2 + 3a/2 and Zero to (1+b)/2,'); console.log(' exactly section 5\'s "(1+b)/2, b/2 + 3a/2, b". At the target box that is ' + bTop.mul(q(1, 2)).add(aTop.mul(q(3, 2))).s + ' = ' + bTop.mul(q(1, 2)).add(aTop.mul(q(3, 2))).v + ' claimed 109/100: ' + ok(bTop.mul(q(1, 2)).add(aTop.mul(q(3, 2))), q(109, 100))); console.log(' CAVEAT: the Lemma II forms are SECTOR-box formulas and must not be read at the'); console.log(' corner - E2(1,1) = ' + q(1).add(q(5, 4)).sub(q(4, 25)).s + ', whereas section 5 prices Lemma II at the corner as 15/8 by a different best split.'); console.log('\n=== 5. Section 5: the per-block ceiling arithmetic ==='); const need = (a, b) => a.add(b).sub(q(1)).mul(new Q(b.d, b.n)); // (a+b-1)/b const ceil = (a, b) => a.mul(new Q(b.d, 2 * b.n)); // a/(2b) for (const [lab, a, b] of [['target box', aTop, bTop], ['corner ', q(1), q(1)]]) { console.log(' ' + lab + ' a = ' + a.s + ', b = ' + b.s + ' requirement eta\' > ' + need(a, b).s + ' sqrt ceiling eta\' = ' + ceil(a, b).s); } console.log(' claimed 3/25 and 14/25 at the box, 1 and 1/2 at the corner: ' + (need(aTop, bTop).eq(q(3, 25)) && ceil(aTop, bTop).eq(q(14, 25)) && need(q(1), q(1)).eq(q(1)) && ceil(q(1), q(1)).eq(q(1, 2)) ? 'ALL EXACT' : 'DIFF')); console.log(' room at the box: ceiling/requirement = ' + (q(14, 25).v / q(3, 25).v).toFixed(4) + ' claimed "a factor 4.7": ' + (Math.abs(14 / 3 - 4.667) < 0.01 ? 'ok (14/3)' : 'check')); console.log(' corner needs twice the ceiling: 1 / (1/2) = 2 CONFIRMED'); console.log(' complete periods M/u at the box: x^(' + aTop.sub(bTop).s + ') claimed 3/50: ' + ok(aTop.sub(bTop), q(3, 50))); console.log(' u = M^(25/28): (14/25)*(25/28) = ' + q(14, 25).mul(q(25, 28)).s + ' = b: ' + ok(q(14, 25).mul(q(25, 28)), bTop)); console.log(' corner Weil total N sqrt u = x^(1 + 1/2) = x^(3/2) CONFIRMED');