diff --git a/reviews/d2_joint_mass_schur_20261006/NOTE.md b/reviews/d2_joint_mass_schur_20261006/NOTE.md new file mode 100644 index 000000000..196406624 --- /dev/null +++ b/reviews/d2_joint_mass_schur_20261006/NOTE.md @@ -0,0 +1,267 @@ +# D2: the sharp joint-mass Schur floor reduces to one scalar minimum + +Object: D2-JOINT-MASS-SCHUR-20261006-r6. +Dylan Roy — delegated AI work. Actual author: OpenAI / GPT-6 Astra Pro, +`canonical-joint-mass-schur-20261006-r6`, pickup Math-#328/6016666735. +**NEW AUTHOR-SIDE MATHEMATICAL CANDIDATE; independent source review pending.** +Scientific effect NONE; organizational-independence credit 0. Prior sources and +reviews are exposed. No earlier source, review, status, premise or flag changes. + +## 1. What is additional, and what is not + +#326 is the primary source for the common moment floors under squared-radius +mass lower bounds. #328 gives the conservative upper-moment-free Schur bound. +Part B of #328 comment6008747995 gives a better bound from an independent lower +input pair; comment6016072968 reviews that exact observation, and separate PR371 +is its source-publication route. None of those verdicts reviews this note. + +The question left outside those scopes is the *joint* constraint: the smallest +second moment and smallest fourth-moment gap need not occur in one law. Here the +exact lower envelope of the feasible moment pairs is computed. This reduces the +optimal all-direction Schur constant over the full prescribed probability-law +class to a compact one-variable minimum and supplies an attaining law. A concrete +example has an exact algebraic minimizer and a rational outward certificate. + +The residual square identity is elementary variance decomposition, not a claim +of inventing a general inequality. No global literature novelty is asserted. +This is not a consolidation of the earlier packets or a prerequisite for their +integration. It is not a Gaussian/Palm covariance identification or field result. + +## 2. Probability class and exact scalar expressions + +Fix real numbers p,q>0, P=p+q<=1, and distinct u,v>0. Let Y be a nonnegative +measurable random variable on a probability space satisfying + + Prob(Y=u)>=p, Prob(Y=v)>=q, E[Y^2]=a>0,g>=g0>0. +For x=s^2 and t in the closed interval [0,1/4], define + + D0=x(g+x), D1=g(g+4x)/4, N=xg(g+2x), + D(t)=(1-4t)D0+4tD1, S(t)=N/D(t), + F0(x,g)=g(g+2x)/(g+x), + F1(x,g)=4x(g+2x)/(g+4x). (2.3) + +These are the exact existing D2Schur numerator/denominator expressions after +m2=s,m4=g+s^2. They are scalar expressions. Their identification with an actual +conditional covariance is not supplied by this note. All denominators below +are positive in the stated domain; no totalized division at zero is used. + +## 3. Exact feasible lower variance curve + +Suppose 0=0 and its second moment is finite. Put +z=(s-a)/w. Expansion of the nonnegative square integral gives + + integral (y-z)^2 d rho + = E[Y^2]-pu^2-qv^2-(s-a)^2/w >=0. (3.1) + +Consequently + + g >= h(s):=pu^2+qv^2+(s-a)^2/w-s^2 + =g0+(P/w)(s-c)^2, s>=a. (3.2) + +For the last equality use pu^2+qv^2=g0+a^2/P and w=1-P. +Thus s>=a>0 and g>=g0>0 follow without using an earlier result as an assumption. + +For EVERY finite s>=a equality in (3.2) is realized by the probability law + + mu_s=p delta_u+q delta_v+w delta_((s-a)/w). (3.3) + +The residual radius is nonnegative. Repeated atom locations simply combine +masses and still satisfy (2.1). Equality in (3.1) means rho is concentrated at z, +because a nonnegative integrable square has integral zero only when it vanishes +rho-almost everywhere. This is also a characterization of lower-envelope laws. +The construction has finite moments of every order. + +At s=a, h(a)=g0+wa^2/P>g0; at s=c, h(c)=g0 but c>a. Thus when w>0 no law attains +both s=a and g=g0. This joint obstruction concerns s and g, not the already +separate g and Delta extremizers in #326/#328. + +If P=1, rho has mass zero, mu=p delta_u+q delta_v, s=a=c and g=g0. Formula (3.2) +with division by w is NOT used. This case is retained separately throughout. + +## 4. Exact sharp all-direction lower constant + +Both endpoints D0,D1 and N are positive. Since D(t) is a convex interpolation, + + min_(0<=t<=1/4) S(t) + =N/max(D0,D1)=min(F0(s^2,g),F1(s^2,g)). (4.1) + +The minimum is attained at t=0 when D0>=D1, and at t=1/4 when D1>=D0. +Equality of the denominators makes every t equivalent. Endpoint inclusion is +material; no bound is asserted outside [0,1/4]. + +Both Fi are STRICTLY increasing in each positive coordinate. For X>=x>0, +G>=g>0, the exact differences (including zero increments) are + + F0(X,g)-F0(x,g)=g^2(X-x)/((g+X)(g+x)); + F0(x,G)-F0(x,g)=(G-g)+x^2(G-g)/((G+x)(g+x)); + F1(X,g)-F1(x,g)=2(X-x)+2g^2(X-x)/((g+4X)(g+4x)); + F1(x,G)-F1(x,g)=8x^2(G-g)/((G+4x)(g+4x)). (4.2) + +These are the credited Part B identities, included explicitly. Every denominator +is positive and a strictly positive increment makes each displayed difference +strictly positive. Therefore (3.2) and (4.1) give, for each law with mean s, + + S(t)>=Phi(s):=min(F0(s^2,h(s)),F1(s^2,h(s))). (4.3) + +Every value Phi(s), s>=a, is attained by (3.3) and a suitable endpoint t. For +s>=c, both s^2 and h(s) are nondecreasing in s, so each endpoint value, hence +Phi(s), is nondecreasing. Phi is continuous on [a,c], a nonempty compact +interval. Its minimum is attained. It follows that + + C(p,q,u,v):=min_(a<=s<=c) Phi(s) (4.4) + = inf over ALL laws (2.1) AND all t in [0,1/4] of S(t). + +This is an EXACT SHARP constant for the declared class, not merely a lower +bound obtained by sampling s. An extremizer is mu_(s_star) from (3.3), with +s_star any minimizer in (4.4) and t its maximizing-denominator endpoint. + +For X with specified individual nonzero atoms b1,b2, b1^2=u!=v=b2^2, the same +infimum holds: choose p delta_b1+q delta_b2+w delta_sqrt((s_star-a)/w). +No sign symmetry or independence is necessary. For the broader squared-radius +class any signs may be chosen without changing the scalar moments. + +When P=1 the exact constant is min(F0(a^2,g0),F1(a^2,g0)); the preceding +one-variable interval collapses to a point, without division by w. + +## 5. Strict improvement over independent lower inputs + +For 0=a^2 and h(s)>=g0, but these cannot both be +equalities: equality of s^2 requires s=a whereas equality of h requires s=c>a. +By (4.2), BOTH Fi(s^2,h(s))>Fi(a^2,g0). Each is therefore greater than B, so +Phi(s)>B everywhere on the compact interval. Taking its attained minimum gives + + C(p,q,u,v)>B>=min(g0,2a^2), when 00 scales +s by k, g by k^2 and C by k^2, equivalently degree four under X->lambda X. + +## 6. A fully certified sharp example + +Take p=q=1/4,u=1,v=4. Then P=w=1/2, a=5/4,c=5/2,g0=9/8 and + + h(s)=9/8+(s-5/2)^2, 5/4<=s<=5/2. + +Write f0(s)=F0(s^2,h(s)), f1(s)=F1(s^2,h(s)). Direct simplification gives + + f0=(8s^2-40s+59)(24s^2-40s+59)/(8(16s^2-40s+59)), + f1=4s^2(24s^2-40s+59)/(40s^2-40s+59). + +Their derivatives are + + f0'(s)=P5(s)/(16s^2-40s+59)^2, + f1'(s)=8s R4(s)/(40s^2-40s+59)^2, + P5=768s^5-5440s^4+18464s^3-36320s^2+37524s-17405, + R4=960s^4-2240s^3+4432s^2-4720s+3481. (6.1) + +The denominators are positive because they are positive multiples of the +positive endpoint-ratio denominators in (2.3). + +### 6.1 Exact sign certificate, not sampled derivatives + +Put z=(s-5/4)/(5/4), so z in [0,1]. For a degree-n polynomial write +sum_(j=0..n) b_j binomial(n,j) z^j(1-z)^(n-j). The EXACT Bernstein coefficients +of P5 on this interval, from low index to high, are + + (-2125, -8351/4, -10127/4, -5639/2, -2626, 405). + +All are negative except the last. For 0=0, equals405 at +r=0 and tends to minus infinity. Since r decreases as z increases, P5 has +exactly ONE zero s_star in (5/4,5/2), is negative before it and positive after +it. This elementary sign proof does not assume P5 itself is increasing. + +The exact degree-four Bernstein coefficients of R4 are + + (9899/4, 14099/4, 35311/6, 10806, 21881), + +all strictly positive. The basis is nonnegative and sums to one, so R4>0 on the +whole interval. Hence f0 has its unique minimum at s_star and f1 is increasing. +Furthermore f0(5/2) 1 or u <= 0 or v <= 0 or u == v: + raise ValueError('require p,q>0, p+q<=1 and distinct positive u,v') + P = p + q + w = 1 - P + a = p * u + q * v + c = a / P + g0 = p * q * (u - v) ** 2 / P + return P, w, a, c, g0 + + +def variance_floor(s, p, q, u, v): + s = F(s) + P, w, a, c, g0 = parameters(p, q, u, v) + if s < a or (w == 0 and s != a): + raise ValueError('mean incompatible with required masses') + if w == 0: + return g0 + return g0 + (P / w) * (s - c) ** 2 + + +def attaining_squared_law(s, p, q, u, v): + s, p, q, u, v = map(F, (s, p, q, u, v)) + _, w, a, _, _ = parameters(p, q, u, v) + variance_floor(s, p, q, u, v) + if w == 0: + return [(u, p), (v, q)] + return [(u, p), (v, q), ((s - a) / w, w)] + + +def endpoints(x, g): + x, g = F(x), F(g) + if x <= 0 or g <= 0: + raise ValueError('positive scalar inputs required') + return g * (g + 2 * x) / (g + x), 4 * x * (g + 2 * x) / (g + 4 * x) + + +def schur(s, g, t): + s, g, t = map(F, (s, g, t)) + if s <= 0 or g <= 0 or not 0 <= t <= F(1, 4): + raise ValueError('require s,g>0 and 0<=t<=1/4') + x = s * s + D0 = x * (g + x) + D1 = g * (g + 4 * x) / 4 + D = (1 - 4 * t) * D0 + 4 * t * D1 + return x * g * (g + 2 * x) / D + + +def evaluate(coefficients, x): + out = F(0) + for coefficient in reversed(coefficients): + out = out * x + coefficient + return out + + +def bernstein(coefficients, lo, hi): + """Exact degree-n Bernstein coefficients after s=lo+(hi-lo)t.""" + lo, hi = F(lo), F(hi) + if not lo < hi: + raise ValueError('ordered nonempty interval required') + n = len(coefficients) - 1 + power = [sum(F(coefficients[k]) * comb(k, j) * lo ** (k-j) * + (hi-lo) ** j for k in range(j, n+1)) for j in range(n+1)] + return [sum(power[j] * F(comb(i,j), comb(n,j)) for j in range(i+1)) + for i in range(n+1)] + + +def _decimal(n, digits): + scale = 10 ** digits + return str(n // scale) + '.' + str(n % scale).zfill(digits) + + +def outward_decimal(lo, hi, digits=12): + if lo < 0 or hi < lo: + raise ValueError('nonnegative ordered bounds required') + scale = 10 ** digits + down = lo.numerator * scale // lo.denominator + up = (hi.numerator * scale + hi.denominator - 1) // hi.denominator + return [_decimal(down, digits), _decimal(up, digits)] + + +def certify_example(steps=80): + """Certify the minimum in the NOTE example, using only rational arithmetic. + + The NOTE proves that the signs of the Bernstein coefficients imply one + root of P, and that R>0. Bisection then encloses that unique root. The + rational rectangle evaluation uses the proved monotonicity of endpoint0. + """ + if type(steps) is not int or not 8 <= steps <= 512: + raise ValueError('steps must be an integer in [8,512]') + lo, hi = F(5,4), F(5,2) + bP, bR = bernstein(POLY_P,lo,hi), bernstein(POLY_R,lo,hi) + if not (all(x < 0 for x in bP[:-1]) and bP[-1] > 0 and all(x > 0 for x in bR)): + raise ArithmeticError('polynomial sign certificate failed') + for _ in range(steps): + mid = (lo + hi) / 2 + value = evaluate(POLY_P, mid) + if value == 0: + raise ArithmeticError('exact rational root requires a separate bracket') + if value < 0: + lo = mid + else: + hi = mid + if not (evaluate(POLY_P,lo) < 0 < evaluate(POLY_P,hi)): + raise ArithmeticError('root bracket failed') + g_lower = F(9,8) + (hi-F(5,2))**2 + g_upper = F(9,8) + (lo-F(5,2))**2 + lower = endpoints(lo*lo,g_lower)[0] + upper = endpoints(hi*hi,g_upper)[0] + other_branch_min = endpoints(F(25,16), F(43,16))[1] + if not 0 < lower < upper < other_branch_min: + raise ArithmeticError('branch comparison failed') + return { + 'schema_version': 1, + 'scientific_effect': 'NONE', + 'independently_reviewed': False, + 'scope': 'sharp real scalar infimum for p=q=1/4, u=1, v=4; not a field certificate', + 'bisection_steps': steps, + 'P_low_to_high': list(POLY_P), + 'R_low_to_high': list(POLY_R), + 'P_Bernstein_on_5over4_5over2': list(map(str,bP)), + 'R_Bernstein_on_5over4_5over2': list(map(str,bR)), + 'minimizer_rational_interval': list(map(str,(lo,hi))), + 'minimizer_decimal_outer': outward_decimal(lo,hi), + 'schur_rational_interval': list(map(str,(lower,upper))), + 'schur_decimal_outer': outward_decimal(lower,upper), + 'other_branch_minimum': str(other_branch_min), + 'independent_lower_input_bound': '153/86', + 'conservative_bound': '9/8', + 'attainment': 'X law: (1/4) delta_1 + (1/4) delta_2 + (1/2) delta_sqrt(2*s_star-5/2); t=0', + } + + +def render_certificate(): + return json.dumps(certify_example(),sort_keys=True,indent=2)+'\n' + + +if __name__ == '__main__': + import argparse + argparse.ArgumentParser(description=__doc__).parse_args() + print(render_certificate(),end='') diff --git a/tests/test_d2_joint_mass_schur.py b/tests/test_d2_joint_mass_schur.py new file mode 100644 index 000000000..411981b89 --- /dev/null +++ b/tests/test_d2_joint_mass_schur.py @@ -0,0 +1,178 @@ +"""Exact finite controls for the joint-mass scalar reduction, not a field proof.""" +from fractions import Fraction as F +import hashlib +import importlib.util +import json +from pathlib import Path +import unittest + +ROOT = Path(__file__).resolve().parents[1] +PACKET = ROOT / 'reviews' / 'd2_joint_mass_schur_20261006' + + +def poly_mul(a, b): + out = [F(0)] * (len(a) + len(b) - 1) + for i, x in enumerate(a): + for j, y in enumerate(b): + out[i + j] += x * y + return out + + +def poly_sub(a, b): + out = [F(0)] * max(len(a), len(b)) + for i, x in enumerate(a): out[i] += x + for i, x in enumerate(b): out[i] -= x + while len(out) > 1 and out[-1] == 0: out.pop() + return out + + +def poly_der(a): + return [i * a[i] for i in range(1, len(a))] + + +class JointMassTests(unittest.TestCase): + def setUp(self): + path = PACKET / 'joint_mass.py' + self.assertTrue(path.is_file(), 'missing joint-mass implementation') + spec = importlib.util.spec_from_file_location('joint_mass_under_test', path) + self.j = importlib.util.module_from_spec(spec) + spec.loader.exec_module(self.j) + + def test_residual_square_identity(self): + for p, q in [(F(1,4), F(1,4)), (F(1,5), F(2,5)), (F(1,3),F(1,6))]: + for u, v in [(F(1),F(4)),(F(1,3),F(3)),(F(2),F(5,2))]: + P=p+q; w=1-P; a=p*u+q*v + for z in [F(0),F(1,2),F(2),F(5)]: + s=a+w*z + g=p*u*u+q*v*v+w*z*z-s*s + self.assertEqual(g, self.j.variance_floor(s,p,q,u,v)) + # Splitting residual mass increases variance by w Var(residual). + eps=F(1,4) + if z>=eps: + actual=p*u*u+q*v*v+w*((z-eps)**2+(z+eps)**2)/2-s*s + self.assertEqual(actual-g,w*eps**2) + + def test_attaining_laws(self): + for p,q in [(F(1,4),F(1,4)),(F(1,7),F(2,7))]: + for u,v in [(F(1),F(4)),(F(1,2),F(3))]: + a=p*u+q*v; c=a/(p+q) + for k in range(9): + s=a+(c-a)*F(k,8) + law=self.j.attaining_squared_law(s,p,q,u,v) + self.assertEqual(sum(m for _,m in law),1) + self.assertTrue(all(y>=0 and m>=0 for y,m in law)) + self.assertEqual(sum(y*m for y,m in law),s) + self.assertEqual(sum(y*y*m for y,m in law)-s*s, + self.j.variance_floor(s,p,q,u,v)) + + def test_endpoint_reduction(self): + for s in [F(1,3),F(1),F(5,4),F(5,2),F(7)]: + for g in [F(1,7),F(9,8),F(3),F(15)]: + e0,e1=self.j.endpoints(s*s,g) + self.assertEqual(self.j.schur(s,g,F(0)),e0) + self.assertEqual(self.j.schur(s,g,F(1,4)),e1) + for k in range(17): + self.assertGreaterEqual(self.j.schur(s,g,F(k,64)),min(e0,e1)) + + def test_strict_box_improvement(self): + p=q=F(1,4); u=F(1);v=F(4); a=F(5,4);c=F(5,2) + box=min(self.j.endpoints(a*a,F(9,8))) + self.assertEqual(box,F(153,86)) + for k in range(33): + s=a+(c-a)*F(k,32) + joint=min(self.j.endpoints(s*s,self.j.variance_floor(s,p,q,u,v))) + self.assertGreater(joint,box) + + def test_mass_one_boundary(self): + p=F(1,3);q=F(2,3);u=F(1);v=F(4);a=p*u+q*v + self.assertEqual(self.j.variance_floor(a,p,q,u,v),F(2)) + self.assertEqual(self.j.attaining_squared_law(a,p,q,u,v),[(u,p),(v,q)]) + with self.assertRaises(ValueError): self.j.variance_floor(a+1,p,q,u,v) + + def test_invalid_domains(self): + for vals in [(0,F(1,4),1,4),(F(1,2),F(3,4),1,4), + (F(1,4),F(1,4),0,4),(F(1,4),F(1,4),1,1)]: + with self.assertRaises(ValueError): self.j.parameters(*map(F,vals)) + with self.assertRaises(ValueError): self.j.variance_floor(F(1),F(1,4),F(1,4),F(1),F(4)) + with self.assertRaises(ValueError): self.j.schur(F(1),F(1),F(-1)) + with self.assertRaises(ValueError): self.j.schur(F(1),F(1),F(1,3)) + with self.assertRaises(ValueError): self.j.endpoints(F(0),F(1)) + + def test_homogeneity_and_swap(self): + p=F(1,4);q=F(1,3);u=F(1);v=F(4);s=F(2) + g=self.j.variance_floor(s,p,q,u,v) + self.assertEqual(g,self.j.variance_floor(s,q,p,v,u)) + for k in [F(1,2),F(2),F(7)]: + scaled=self.j.variance_floor(k*s,p,q,k*u,k*v) + self.assertEqual(scaled,k*k*g) + for t in [F(0),F(1,8),F(1,4)]: + self.assertEqual(self.j.schur(k*s,scaled,t),k*k*self.j.schur(s,g,t)) + + def test_derivative_coefficients(self): + # Independent coefficient operations derive both rational derivatives. + n0=poly_mul([59,-40,8],[59,-40,24]);d0=[472,-320,128] + diff0=poly_sub(poly_mul(poly_der(n0),d0),poly_mul(n0,poly_der(d0))) + self.assertEqual(diff0,[64*x for x in self.j.POLY_P]) + n1=[0,0,236,-160,96];d1=[59,-40,40] + diff1=poly_sub(poly_mul(poly_der(n1),d1),poly_mul(n1,poly_der(d1))) + self.assertEqual(diff1,[0]+[8*x for x in self.j.POLY_R]) + + def test_bernstein_and_unique_root(self): + b0=self.j.bernstein(self.j.POLY_P,F(5,4),F(5,2)) + b1=self.j.bernstein(self.j.POLY_R,F(5,4),F(5,2)) + self.assertEqual(b0,list(map(F,[-2125,F(-8351,4),F(-10127,4),F(-5639,2),-2626,405]))) + self.assertEqual(b1,[F(9899,4),F(14099,4),F(35311,6),F(10806),F(21881)]) + self.assertTrue(all(x<0 for x in b0[:-1]) and b0[-1]>0) + self.assertTrue(all(x>0 for x in b1)) + for k in range(17): + t=F(k,16); s=F(5,4)+F(5,4)*t + for coeff,b in [(self.j.POLY_P,b0),(self.j.POLY_R,b1)]: + from math import comb + n=len(b)-1 + self.assertEqual(self.j.evaluate(coeff,s),sum(b[j]*comb(n,j)*t**j*(1-t)**(n-j) for j in range(n+1))) + + def test_certified_example(self): + c=self.j.certify_example() + lo,hi=map(F,c['minimizer_rational_interval']) + L,U=map(F,c['schur_rational_interval']) + self.assertLess(lo,hi) + self.assertLess(self.j.evaluate(self.j.POLY_P,lo),0) + self.assertGreater(self.j.evaluate(self.j.POLY_P,hi),0) + self.assertLess(F(2464780131951,10**12),lo) + self.assertLess(hi,F(2464780131952,10**12)) + self.assertLess(F(2076345574173,10**12),L) + self.assertLess(U,F(2076345574174,10**12)) + gl=F(9,8)+(hi-F(5,2))**2;gu=F(9,8)+(lo-F(5,2))**2 + self.assertEqual(L,self.j.endpoints(lo*lo,gl)[0]) + self.assertEqual(U,self.j.endpoints(hi*hi,gu)[0]) + self.assertLessEqual(F(c['schur_decimal_outer'][0]),L) + self.assertGreaterEqual(F(c['schur_decimal_outer'][1]),U) + self.assertLessEqual(F(c['minimizer_decimal_outer'][0]),lo) + self.assertGreaterEqual(F(c['minimizer_decimal_outer'][1]),hi) + self.assertGreater(L,F(2)) + self.assertLess(U,min(self.j.endpoints(F(25,16),F(43,16)))) + self.assertEqual(c['scientific_effect'],'NONE') + self.assertFalse(c['independently_reviewed']) + + def test_source_inventory(self): + path=PACKET/'SOURCES.json' + self.assertTrue(path.is_file(),'missing source inventory') + data=json.loads(path.read_text()) + expected={str((PACKET/name).relative_to(ROOT)) for name in ['NOTE.md','joint_mass.py','RESULTS.json']} + expected.add(str(Path(__file__).relative_to(ROOT))) + self.assertEqual({r['path'] for r in data['files']},expected) + self.assertEqual(len(data['files']),4) + for record in data['files']: + b=(ROOT/record['path']).read_bytes() + self.assertEqual(len(b),record['bytes']) + self.assertEqual(hashlib.sha256(b).hexdigest(),record['sha256']) + self.assertEqual(data['scientific_effect'],'NONE') + + def test_results_reproduction(self): + path=PACKET/'RESULTS.json' + self.assertTrue(path.is_file(),'missing reference output') + self.assertEqual(path.read_text(),self.j.render_certificate()) + + +if __name__=='__main__': + unittest.main(verbosity=2)