File size: 5,634 Bytes
2955ecc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | """Adjudication checks for docs/math-model-fixes-2.md.
Re-runs xx_claude/newmodel.py over the v0.3 sweep under four variants and reports
what actually moves. Everything in math-model-fixes-2.md traces to output here.
python3 xx_claude/checkmodel.py
Variants:
A. baseline weights 2.5/2.2/0.85, bands 1/2/3, K_suppressor clause live
B. derived bands bands 2.20/3.05 (the check's option (c))
C. no K_suppressor clause newmodel.py:97 made never-true
D. pinned-band corner sweep weights swept across the axiom-feasible set, bands pinned 1/2/3
"""
import json, os, math, collections
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.chdir(REPO)
SRC = open('xx_claude/newmodel.py').read()
WLINE = "wF,wC,wN=2.5,2.2,0.85; BW,BM,BH=1.0,2.0,3.0"
KLINE = "elif Ksup<0.75 and Lam>=BW:"
assert WLINE in SRC and KLINE in SRC, "newmodel.py has changed; update the anchors"
BASE = 'xx_claude/results/sweep_v0_3_20260613_01'
SITES = {}
for d in sorted(os.listdir(BASE)):
p = os.path.join(BASE, d, 'sites_all.jsonl')
if os.path.exists(p):
SITES[d] = [json.loads(l).get('site', json.loads(l)) for l in open(p)]
def variant(wF=2.5, wC=2.2, wN=0.85, BW=1.0, BM=2.0, BH=3.0, ksup=True):
src = SRC.replace(WLINE, f"wF,wC,wN={wF},{wC},{wN}; BW,BM,BH={BW},{BM},{BH}")
if not ksup:
src = src.replace(KLINE, "elif False:")
ns = {'__name__': 'variant'}
exec(compile(src, 'variant', 'exec'), ns)
ev, W, C = ns['evaluate'], ns['WARN'], ns['CAUGHT']
out = {}
for d, ss in SITES.items():
rc = collections.Counter()
for s in ss:
rc[ev(s)['route']] += 1
n = len(ss)
out[d] = (sum(rc[x] for x in W) / n * 100, sum(rc[x] for x in C) / n * 100, n)
return out
def moved(a, b, tol=1e-9):
return [d for d in a if abs(a[d][0] - b[d][0]) > tol or abs(a[d][1] - b[d][1]) > tol]
def axioms_ok(wF, wC, wN, BW=1.0, BM=2.0, BH=3.0, e=1e-12):
return (wN < BW - e and BM - e <= wF < BH - e and BM - e <= wC < BH - e
and wF + wC >= BH - e and wF + wN >= BH - e and wC + wN >= BH - e)
A = variant()
B = variant(BM=2.20, BH=3.05)
C = variant(ksup=False)
# pinned-band feasible set: 2 < min(wF,wC) < 3, wN < 1, wN >= 3 - min(wF,wC)
LO = variant(wF=2.001, wC=2.001, wN=0.999)
HI = variant(wF=2.999, wC=2.999, wN=0.999)
print("=" * 100)
print("A/B/C. baseline vs derived bands (2.20/3.05) vs K_suppressor removed [warn% | caught%]")
print("=" * 100)
mB, mC = set(moved(A, B)), set(moved(A, C))
print(f"{'family':42s} {'n':>5s} {'baseline':>15s} {'derived bands':>15s} {'no K_supp':>15s}")
for d in sorted(SITES):
f = ('B' if d in mB else '') + ('C' if d in mC else '')
print(f"{d:42s} {A[d][2]:5d} {A[d][0]:6.2f}|{A[d][1]:6.2f} {B[d][0]:6.2f}|{B[d][1]:6.2f} "
f"{C[d][0]:6.2f}|{C[d][1]:6.2f} {f}")
hardneg = [d for d in mC if d.startswith(('hard_negatives', 'integrity'))]
print(f"\n derived bands move {len(mB)}/{len(SITES)} families; removing K_suppressor moves {len(mC)}/{len(SITES)}")
print(f" hard-negative or integrity families moved by removing K_suppressor: {len(hardneg)} {hardneg}")
print("\n" + "=" * 100)
print("D. is the axiom system scale-free? (the section-1 dispute)")
print("=" * 100)
print(" bands FLOATING with the weights -- the review's claim:")
for c in (0.5, 1.0, 2.0):
lam = 3.5932 * c
print(f" c={c:4.2f} w=({2.5*c:.2f},{2.2*c:.2f},{0.85*c:.2f}) bands={c:.1f}/{2*c:.1f}/{3*c:.1f} "
f"axioms={axioms_ok(2.5*c, 2.2*c, 0.85*c, c, 2*c, 3*c)} "
f"pi_id={2**(lam-2)/(1+2**(lam-2)):.4f}")
feas = [c / 10000 for c in range(9000, 14000) if axioms_ok(2.5 * c / 10000, 2.2 * c / 10000, 0.85 * c / 10000)]
print(f"\n bands PINNED at 1/2/3 -- math-model-fixes.md says 'no rescaling except identity satisfies")
print(f" the axioms'. FALSE: feasible pure-rescale factors c in [{min(feas):.4f}, {max(feas):.4f}]")
print(f"\n saturated pi_identity over the pinned-band feasible set (l_0=-2):")
print(f" inf Lambda_sat = 2+2+1 = 5 -> pi={2**3/(1+2**3):.4f} sup = 3+3+1 = 7 -> pi={2**5/(1+2**5):.4f}")
print(f" the check's quoted 0.874 needs w=(2,2,0.8); wN=0.8 >= 3-min(2,2)=1 is False -> INFEASIBLE")
print(f" (wN < 1 with wN >= 3-min(wF,wC) forces min(wF,wC) > 2 strictly)")
print(f"\n but saturation is where the axioms bind, and no sweep instance is there.")
print(f" routes across the SAME pinned-band feasible set:\n")
mD = set(moved(A, LO)) | set(moved(A, HI))
print(f"{'family':42s} {'min corner':>15s} {'declared':>15s} {'max corner':>15s}")
for d in sorted(SITES):
if d in mD:
print(f"{d:42s} {LO[d][0]:6.2f}|{LO[d][1]:6.2f} {A[d][0]:6.2f}|{A[d][1]:6.2f} "
f"{HI[d][0]:6.2f}|{HI[d][1]:6.2f}")
print(f"\n {len(mD)}/{len(SITES)} families move inside the feasible set.")
k = 'evasion.fabric_to_serving'
print(f" {k} evasion (100-caught): {100-HI[k][1]:.1f}% .. {100-LO[k][1]:.1f}% "
f"paper reports {100-A[k][1]:.1f}%")
print("\n" + "=" * 100)
print("E. what the saturation reading of axiom 4 costs")
print("=" * 100)
for nm, w, cut in (('fabric w_F=2.5', 2.5, 0.60), ('checkpt w_C=2.2', 2.2, 0.55)):
print(f" {nm}: alone reaches the 2-bit medium band at z >= {((2.0/w)+1)/2:.3f} (alpha=1), "
f"{((2.0/(w*0.92))+1)/2:.3f} (alpha=0.92)")
print(f" at the rule layer's own 'present' cutoff z={cut}: {w*(2*cut-1):.2f} bits")
print(f" both pathways at their own cutoffs: {2.5*0.2 + 2.2*0.1:.2f} bits -- below even the 1-bit weak band")
print(f" joint: w_F+w_C=4.7 vs the 3-bit high band -> mean score {((3/4.7)+1)/2:.4f}")
|