code wiki / _hdl_build / nx_softtissue_mr_gate.nx

nx_softtissue_mr_gate.nx source

↩ module page · 524 lines · 28169 B

1// nx_softtissue_mr_gate.nx -- METAMORPHIC-RELATIONS SEAT for the soft-tissue solver 2// (metrology council seat 2, 2026-08-03). ORACLE-FREE BY CONSTRUCTION: every tooth below compares 3// the solver AGAINST ITSELF under a transformation whose effect on the output is known a priori. 4// No reference data, no capture session, no foreign engine, no third-party library -- the entire 5// seat is sovereign nishilang over nx_softbind/nx_softdyn. That is the whole point of this seat: 6// it is the only council member that can grade contact and soft tissue with nothing to compare to. 7// 8// WHY THIS SEAT EXISTS (corpus recon 2026-08-03): `metamorphic` appears in 21,459 estate files 9// ONLY as a CAPABILITY-ATTENUATION relation (nx_property_test.nx M1). `galilean` = 0 matches, 10// `time_reversal` = 0 matches. There was no physics metamorphic testing anywhere in the estate. 11// 12// ⚠A CORRECTION I OWE MY OWN EARLIER CLAIM: I told the operator this seat would use TIME-REVERSAL. 13// It must not. sd_step is semi-implicit (symplectic) Euler, whose exact inverse is the ADJOINT 14// method (position-then-velocity), not itself; with integer truncation on top, a reversal tooth 15// would fail on a CORRECT solver = a false RED. The invariant that actually catches the reported 16// foot-vs-bounce defect class is TIME-TRANSLATION invariance (T4), not time reversal. 17// ⇒ A PROPOSED TOOTH IS A HYPOTHESIS AND MUST SURVIVE THE SAME EXAMINATION IT IMPOSES. 18// 19// T0 FIDELITY the in-gate reference transcription is bit-identical to the SHIPPING solver 20// (without this, every mutant result below is unattributable) 21// T1 TRANSLATION Galilean/static: shift the whole frame by delta -> relative motion IDENTICAL 22// T2 AXIS-PERM x/y/z are the same physics -> same drive on any axis gives the SAME response 23// (sd_step's acc lines are triple-copied and index-shifted: the copy-paste site) 24// T3 REFLECTION negate the drive -> response negates EXACTLY (documents the CURRENT symmetry; 25// adopting Cai-2018 piecewise-asymmetric k_up/k_down MUST turn this tooth RED) 26// T4 TIME-TRANS same input history at a different absolute tick -> same response 27// (the free-running-clock defect class: nx_wasm_craft ph = MC_PH + 5 per tick) 28// T5 QUIESCENCE zero input -> exactly zero response, forever (the "she bounces at rest" class) 29// T6 FRAME-DEP CHARACTERISATION, not an invariance: damping is against the WORLD frame, so 30// uniform motion IS observable. Measures the lag and pins its magnitude. 31// T7 MONOTONIC a larger drive can never produce a smaller peak 32// T8 IMPULSE-REFL reflection through the impulse path (a different code path than T3's anchor) 33// T9/T10/T11 BITE each detector fires on its targeted crafted-bad engine, silent on the real one 34// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0 35import "nx_syscalls.nx" 36import "nx_softbind.nx" 37import "nx_gate_verdict.nx" 38 39// local mirrors of the solver's layout constants -- deliberately NOT re-exported names, so this 40// gate never silently tracks a redefinition of the thing it is auditing. 41const MR_STRIDE: i64 = 6 42const MR_Q8: i64 = 256 43const MR_G: i64 = 1024 44const MR_CAPC: i64 = 1000 45const MR_CAPK: i64 = 3600 46 47// engines under test 48const MR_ENG_REAL: i64 = 0 // the SHIPPING solver (sb_tick_pt -> sd_step) 49const MR_ENG_REF: i64 = 1 // faithful in-gate transcription (mutant base) 50const MR_ENG_AXIS: i64 = 2 // crafted-bad: y damping reads the X velocity 51const MR_ENG_ABS: i64 = 3 // crafted-bad: acceleration gains an absolute-position term 52const MR_ENG_CLOCK: i64 = 4 // crafted-bad: a free-running drive keyed to the ABSOLUTE tick 53 54// shipping chest band, firmness 0 (nx_softbind SB_K_CHEST_BASE / SB_C_CHEST_BASE / SB_MAXD_CHEST) 55const MR_K: i64 = 60 56const MR_C: i64 = 100 57const MR_MAXD: i64 = 2 58const MR_MAXD_FREE: i64 = 64 // clamp effectively disabled, for the frame-dependence measurement 59 60const MR_TICKS: i64 = 200 61const MR_IDLE: i64 = 137 // deliberately not a multiple of anything in the drive 62const MR_DELTA: i64 = 1000000 // frame shift for T1: ~15.6 km in model units 63const MR_DRIVE_A: i64 = 13 64const MR_DRIVE_M: i64 = 29 65const MR_DRIVE_H: i64 = 14 66const MR_CLK_A: i64 = 214 // mirrors nx_wasm_craft's ph*214 free-running cadence 67const MR_CLK_M: i64 = 64 68const MR_CLK_H: i64 = 32 69const MR_ABS_SHIFT: i64 = 8192 // absolute-position leak divisor for the ABS mutant 70const MR_SETTLE: i64 = 600 // ticks to reach steady state under constant-velocity drive 71const MR_WIN: i64 = 96 // measurement window for the steady-state lag 72const MR_V1Q8: i64 = 256 // anchor speed 1 model unit/tick, expressed in Q8 73 74// deterministic integer drive: bounded, sign-changing, aperiodic against the idle offset 75func mr_drive(t: i64) -> i64 { return ((t*MR_DRIVE_A) % MR_DRIVE_M) - MR_DRIVE_H } 76 77func mr_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } 78func mr_isqrt(v: i64) -> i64 { if v <= 0 { return 0 } var x: i64 = v; var y: i64 = (x+1)/2; while y < x { x = y; y = (x + v/x)/2 } return x } 79 80// ---- faithful transcription of sd_step (the MUTANT BASE; T0 proves it equals the shipping one) -- 81func mr_ref_core(st: *i64, idx: i64, ax: i64, ay: i64, az: i64, K: i64, C: i64, maxd: i64) -> i64 { 82 let b: i64 = idx*MR_STRIDE 83 let qx: i64 = ax*MR_Q8; let qy: i64 = ay*MR_Q8; let qz: i64 = az*MR_Q8 84 var kk: i64 = K; if kk > MR_CAPK { kk = MR_CAPK } 85 if kk < 0 { kk = 0 } 86 var cc: i64 = C; if cc > MR_CAPC { cc = MR_CAPC } 87 if cc < 0 { cc = 0 } 88 let accx: i64 = ((qx - st[b])*kk)/MR_G - (st[b+3]*cc)/MR_G 89 let accy: i64 = ((qy - st[b+1])*kk)/MR_G - (st[b+4]*cc)/MR_G 90 let accz: i64 = ((qz - st[b+2])*kk)/MR_G - (st[b+5]*cc)/MR_G 91 st[b+3] = st[b+3] + accx; st[b+4] = st[b+4] + accy; st[b+5] = st[b+5] + accz 92 st[b] = st[b] + st[b+3]; st[b+1] = st[b+1] + st[b+4]; st[b+2] = st[b+2] + st[b+5] 93 var dx: i64 = st[b] - qx; var dy: i64 = st[b+1] - qy; var dz: i64 = st[b+2] - qz 94 let lim: i64 = maxd*MR_Q8 95 let d2: i64 = dx*dx + dy*dy + dz*dz 96 if d2 > lim*lim { 97 var d: i64 = mr_isqrt(d2) 98 if d < 1 { d = 1 } 99 st[b] = qx + dx*lim/d; st[b+1] = qy + dy*lim/d; st[b+2] = qz + dz*lim/d 100 st[b+3] = st[b+3]/2; st[b+4] = st[b+4]/2; st[b+5] = st[b+5]/2 101 } 102 return 0 103} 104 105// ---- crafted-bad engine 1: the copy-paste bug the triple-repeated acc lines invite ------------- 106func mr_mut_axis_core(st: *i64, idx: i64, ax: i64, ay: i64, az: i64, K: i64, C: i64, maxd: i64) -> i64 { 107 let b: i64 = idx*MR_STRIDE 108 let qx: i64 = ax*MR_Q8; let qy: i64 = ay*MR_Q8; let qz: i64 = az*MR_Q8 109 var kk: i64 = K; if kk > MR_CAPK { kk = MR_CAPK } 110 if kk < 0 { kk = 0 } 111 var cc: i64 = C; if cc > MR_CAPC { cc = MR_CAPC } 112 if cc < 0 { cc = 0 } 113 let accx: i64 = ((qx - st[b])*kk)/MR_G - (st[b+3]*cc)/MR_G 114 // THE DEFECT: damps the Y axis with the X velocity (st[b+3] should be st[b+4]) 115 let accy: i64 = ((qy - st[b+1])*kk)/MR_G - (st[b+3]*cc)/MR_G 116 let accz: i64 = ((qz - st[b+2])*kk)/MR_G - (st[b+5]*cc)/MR_G 117 st[b+3] = st[b+3] + accx; st[b+4] = st[b+4] + accy; st[b+5] = st[b+5] + accz 118 st[b] = st[b] + st[b+3]; st[b+1] = st[b+1] + st[b+4]; st[b+2] = st[b+2] + st[b+5] 119 var dx: i64 = st[b] - qx; var dy: i64 = st[b+1] - qy; var dz: i64 = st[b+2] - qz 120 let lim: i64 = maxd*MR_Q8 121 let d2: i64 = dx*dx + dy*dy + dz*dz 122 if d2 > lim*lim { 123 var d: i64 = mr_isqrt(d2) 124 if d < 1 { d = 1 } 125 st[b] = qx + dx*lim/d; st[b+1] = qy + dy*lim/d; st[b+2] = qz + dz*lim/d 126 st[b+3] = st[b+3]/2; st[b+4] = st[b+4]/2; st[b+5] = st[b+5]/2 127 } 128 return 0 129} 130 131// ---- crafted-bad engine 2: acceleration leaks ABSOLUTE world position (frame-dependent term) --- 132func mr_mut_abs_core(st: *i64, idx: i64, ax: i64, ay: i64, az: i64, K: i64, C: i64, maxd: i64) -> i64 { 133 mr_ref_core(st, idx, ax, ay, az, K, C, maxd) 134 let b: i64 = idx*MR_STRIDE 135 st[b+3] = st[b+3] + st[b]/MR_ABS_SHIFT 136 st[b+4] = st[b+4] + st[b+1]/MR_ABS_SHIFT 137 st[b+5] = st[b+5] + st[b+2]/MR_ABS_SHIFT 138 return 0 139} 140 141// ---- crafted-bad engine 3: a FREE-RUNNING drive keyed to the absolute tick -------------------- 142// This is the shipping engine's real defect class in miniature: nx_wasm_craft advances 143// `ph = MC_PH + 5` every tick unconditionally, so its tissue drive is a function of wall-clock 144// ticks rather than of the character's input history. 145func mr_mut_clock_core(st: *i64, idx: i64, ax: i64, ay: i64, az: i64, K: i64, C: i64, maxd: i64, tk: i64) -> i64 { 146 mr_ref_core(st, idx, ax, ay, az, K, C, maxd) 147 let b: i64 = idx*MR_STRIDE 148 st[b+4] = st[b+4] + ((tk*MR_CLK_A) % MR_CLK_M) - MR_CLK_H 149 return 0 150} 151 152// ---- one dispatch: root position in, engine-selected step out -------------------------------- 153func mr_step(eng: i64, st: *i64, kind: i64, rx: i64, ry: i64, rz: i64, K: i64, C: i64, maxd: i64, tk: i64) -> i64 { 154 if eng == MR_ENG_REAL { return sb_tick_pt(st, 0, kind, rx, ry, rz, K, C, maxd) } 155 let ay: i64 = ry + sb_offy(kind) 156 if eng == MR_ENG_REF { return mr_ref_core(st, kind, rx, ay, rz, K, C, maxd) } 157 if eng == MR_ENG_AXIS { return mr_mut_axis_core(st, kind, rx, ay, rz, K, C, maxd) } 158 if eng == MR_ENG_ABS { return mr_mut_abs_core(st, kind, rx, ay, rz, K, C, maxd) } 159 return mr_mut_clock_core(st, kind, rx, ay, rz, K, C, maxd, tk) 160} 161 162// signed Q8 offset of a point from its anchor, per axis (axis 0=x,1=y,2=z) 163func mr_off(st: *i64, kind: i64, axis: i64, anchor: i64) -> i64 { 164 return st[kind*MR_STRIDE + axis] - anchor*MR_Q8 165} 166 167// ================= DETECTOR 1: TRANSLATION (Galilean, static frame shift) ====================== 168// Shift the ENTIRE frame -- seat and every anchor -- by MR_DELTA. Relative motion must be 169// bit-identical: physics cannot depend on where the world's origin was placed. 170func mr_det_trans(eng: i64, maxd: i64) -> i64 { 171 let sa: *i64 = sb_alloc(1) 172 let sb2: *i64 = sb_alloc(1) 173 sb_seat_mob(sa, 0, 0, 0, 0) 174 sb_seat_mob(sb2, 0, MR_DELTA, MR_DELTA, MR_DELTA) 175 var bad: i64 = 0 176 var t: i64 = 0 177 while t < MR_TICKS { 178 let d: i64 = mr_drive(t) 179 mr_step(eng, sa, SB_CHEST, d, d, d, MR_K, MR_C, maxd, t) 180 mr_step(eng, sb2, SB_CHEST, MR_DELTA + d, MR_DELTA + d, MR_DELTA + d, MR_K, MR_C, maxd, t) 181 let oa: i64 = mr_off(sa, SB_CHEST, 1, d + sb_offy(SB_CHEST)) 182 let ob: i64 = mr_off(sb2, SB_CHEST, 1, MR_DELTA + d + sb_offy(SB_CHEST)) 183 if oa != ob { bad = bad + 1 } 184 t = t + 1 185 } 186 return bad 187} 188 189// ================= DETECTOR 2: AXIS PERMUTATION ================================================ 190// x, y and z are the same physics with the same K/C/clamp. Drive the SAME numeric trajectory on 191// each axis in turn; the response along the driven axis must be bit-identical across all three. 192func mr_det_axis(eng: i64, maxd: i64) -> i64 { 193 let sx: *i64 = sb_alloc(1) 194 let sy: *i64 = sb_alloc(1) 195 let sz: *i64 = sb_alloc(1) 196 sb_seat_mob(sx, 0, 0, 0, 0) 197 sb_seat_mob(sy, 0, 0, 0, 0) 198 sb_seat_mob(sz, 0, 0, 0, 0) 199 var bad: i64 = 0 200 var t: i64 = 0 201 while t < MR_TICKS { 202 let d: i64 = mr_drive(t) 203 mr_step(eng, sx, SB_CHEST, d, 0, 0, MR_K, MR_C, maxd, t) 204 mr_step(eng, sy, SB_CHEST, 0, d, 0, MR_K, MR_C, maxd, t) 205 mr_step(eng, sz, SB_CHEST, 0, 0, d, MR_K, MR_C, maxd, t) 206 let ox: i64 = mr_off(sx, SB_CHEST, 0, d) 207 let oy: i64 = mr_off(sy, SB_CHEST, 1, d + sb_offy(SB_CHEST)) 208 let oz: i64 = mr_off(sz, SB_CHEST, 2, d) 209 if ox != oy { bad = bad + 1 } 210 if ox != oz { bad = bad + 1 } 211 t = t + 1 212 } 213 return bad 214} 215 216// ================= DETECTOR 3: TIME TRANSLATION ================================================ 217// The response must depend on the INPUT HISTORY, never on the absolute tick at which it arrives. 218// Rig E drives immediately; rig L sits at rest for MR_IDLE ticks, then receives the identical 219// drive. Their responses must agree tick-for-tick from the moment each one's drive begins. 220func mr_det_time(eng: i64, maxd: i64) -> i64 { 221 let se: *i64 = sb_alloc(1) 222 let sl: *i64 = sb_alloc(1) 223 sb_seat_mob(se, 0, 0, 0, 0) 224 sb_seat_mob(sl, 0, 0, 0, 0) 225 var t: i64 = 0 226 while t < MR_IDLE { 227 mr_step(eng, sl, SB_CHEST, 0, 0, 0, MR_K, MR_C, maxd, t) 228 t = t + 1 229 } 230 var bad: i64 = 0 231 t = 0 232 while t < MR_TICKS { 233 let d: i64 = mr_drive(t) 234 mr_step(eng, se, SB_CHEST, d, d, d, MR_K, MR_C, maxd, t) 235 mr_step(eng, sl, SB_CHEST, d, d, d, MR_K, MR_C, maxd, MR_IDLE + t) 236 let oe: i64 = mr_off(se, SB_CHEST, 1, d + sb_offy(SB_CHEST)) 237 let ol: i64 = mr_off(sl, SB_CHEST, 1, d + sb_offy(SB_CHEST)) 238 if oe != ol { bad = bad + 1 } 239 t = t + 1 240 } 241 return bad 242} 243 244func main() -> i64 { 245 let ctr: *i64 = gv_ctr() 246 gv_head("nx_softtissue_mr gate -- METAMORPHIC RELATIONS on the soft-tissue solver (oracle-free)" as *u8) 247 248 // ---------- language-semantics probe: signed integer division rounding --------------------- 249 // T3 and T8 assume (-a)/b == -(a/b). VERIFY the toolchain, never assume it (Rule 2). 250 let dpos: i64 = 7 / 2 251 let dneg: i64 = (0 - 7) / 2 252 gv_puts(" probe: 7/2=" as *u8); gv_num(dpos) 253 gv_puts(" (-7)/2=" as *u8); gv_num(dneg) 254 if dneg == (0 - dpos) { gv_puts(" -> truncates toward zero (sign-symmetric)\n" as *u8) } else { gv_puts(" -> FLOORS (NOT sign-symmetric: reflection teeth are invalid as written)\n" as *u8) } 255 256 // ---------- T0 FIDELITY: the mutant base must equal the shipping solver ------------------- 257 let f0: *i64 = sb_alloc(1) 258 let f1: *i64 = sb_alloc(1) 259 sb_seat_mob(f0, 0, 0, 0, 0) 260 sb_seat_mob(f1, 0, 0, 0, 0) 261 var fbad: i64 = 0 262 var t: i64 = 0 263 while t < MR_TICKS { 264 let d: i64 = mr_drive(t) 265 mr_step(MR_ENG_REAL, f0, SB_CHEST, d, d, d, MR_K, MR_C, MR_MAXD, t) 266 mr_step(MR_ENG_REF, f1, SB_CHEST, d, d, d, MR_K, MR_C, MR_MAXD, t) 267 let a: i64 = mr_off(f0, SB_CHEST, 1, d + sb_offy(SB_CHEST)) 268 let b: i64 = mr_off(f1, SB_CHEST, 1, d + sb_offy(SB_CHEST)) 269 if a != b { fbad = fbad + 1 } 270 t = t + 1 271 } 272 gv_puts(" measured: shipping-vs-reference mismatches=" as *u8); gv_num(fbad) 273 gv_puts(" over " as *u8); gv_num(MR_TICKS); gv_puts(" ticks\n" as *u8) 274 var t0: i64 = 0 275 if fbad == 0 { t0 = 1 } 276 gv_check("T0 FIDELITY in-gate reference is bit-identical to the SHIPPING solver" as *u8, t0, ctr) 277 278 // ---------- T1 / T2 / T4: the three invariances on the REAL engine ------------------------ 279 // ⚠ENVELOPE, LEARNED THE HARD WAY (first run, 2026-08-03): with the shipping chest clamp 280 // (maxd=2 model units) and this drive (+-14), every rig is CLAMP-SATURATED -- the detectors 281 // then measure the clamp and are BLIND to the integrator, which made the T9 bite VACUOUS. 282 // ⇒ A DETECTOR RUN OUTSIDE THE OPERATING ENVELOPE OF THE THING IT AUDITS MEASURES THE 283 // ENVELOPE, NOT THE THING. Each invariance is now asserted in BOTH regimes: FREE (the 284 // integrator is exposed) and CLAMPED (the shipping band, where the clamp dominates). 285 let vtr: i64 = mr_det_trans(MR_ENG_REAL, MR_MAXD_FREE) 286 let vax: i64 = mr_det_axis(MR_ENG_REAL, MR_MAXD_FREE) 287 let vti: i64 = mr_det_time(MR_ENG_REAL, MR_MAXD_FREE) 288 let ctr2: i64 = mr_det_trans(MR_ENG_REAL, MR_MAXD) 289 let cax2: i64 = mr_det_axis(MR_ENG_REAL, MR_MAXD) 290 let cti2: i64 = mr_det_time(MR_ENG_REAL, MR_MAXD) 291 gv_puts(" measured: REAL solver violations, FREE regime -- translation=" as *u8); gv_num(vtr) 292 gv_puts(" axis=" as *u8); gv_num(vax) 293 gv_puts(" time=" as *u8); gv_num(vti); gv_puts("\n" as *u8) 294 gv_puts(" measured: REAL solver violations, CLAMPED regime -- translation=" as *u8); gv_num(ctr2) 295 gv_puts(" axis=" as *u8); gv_num(cax2) 296 gv_puts(" time=" as *u8); gv_num(cti2); gv_puts("\n" as *u8) 297 var t1: i64 = 0 298 if vtr == 0 { if ctr2 == 0 { t1 = 1 } } 299 gv_check("T1 TRANSLATION invariance (both regimes): identical under a 1e6-unit frame shift" as *u8, t1, ctr) 300 var t2: i64 = 0 301 if vax == 0 { if cax2 == 0 { t2 = 1 } } 302 gv_check("T2 AXIS-PERMUTATION equivariance (both regimes): x/y/z respond identically" as *u8, t2, ctr) 303 var t4: i64 = 0 304 if vti == 0 { if cti2 == 0 { t4 = 1 } } 305 gv_check("T4 TIME-TRANSLATION invariance (both regimes): input history, not the tick count" as *u8, t4, ctr) 306 307 // ---------- T3 REFLECTION: negate the drive, the response must negate exactly -------------- 308 let rp: *i64 = sb_alloc(1) 309 let rn: *i64 = sb_alloc(1) 310 sb_seat_mob(rp, 0, 0, 0, 0) 311 sb_seat_mob(rn, 0, 0, 0, 0) 312 var rbad: i64 = 0 313 t = 0 314 while t < MR_TICKS { 315 let d: i64 = mr_drive(t) 316 mr_step(MR_ENG_REAL, rp, SB_CHEST, d, 0, 0, MR_K, MR_C, MR_MAXD, t) 317 mr_step(MR_ENG_REAL, rn, SB_CHEST, 0 - d, 0, 0, MR_K, MR_C, MR_MAXD, t) 318 let op: i64 = mr_off(rp, SB_CHEST, 0, d) 319 let on: i64 = mr_off(rn, SB_CHEST, 0, 0 - d) 320 if op != (0 - on) { rbad = rbad + 1 } 321 t = t + 1 322 } 323 gv_puts(" measured: reflection mismatches=" as *u8); gv_num(rbad); gv_puts("\n" as *u8) 324 var t3: i64 = 0 325 if rbad == 0 { t3 = 1 } 326 gv_check("T3 REFLECTION equivariance: solver is symmetric up/down TODAY (Cai-2018 must break it)" as *u8, t3, ctr) 327 328 // ---------- T5 QUIESCENCE: zero input, exactly zero response, forever ---------------------- 329 let sq: *i64 = sb_alloc(1) 330 sb_seat_mob(sq, 0, 0, 0, 0) 331 var qbad: i64 = 0 332 t = 0 333 while t < MR_TICKS*3 { 334 mr_step(MR_ENG_REAL, sq, SB_CHEST, 0, 0, 0, MR_K, MR_C, MR_MAXD, t) 335 if mr_off(sq, SB_CHEST, 1, sb_offy(SB_CHEST)) != 0 { qbad = qbad + 1 } 336 t = t + 1 337 } 338 let qe: i64 = sb_energy(sq, 0, SB_CHEST) 339 gv_puts(" measured: rest-state nonzero ticks=" as *u8); gv_num(qbad) 340 gv_puts(" final energy=" as *u8); gv_num(qe); gv_puts("\n" as *u8) 341 var t5: i64 = 0 342 if qbad == 0 { if qe == 0 { t5 = 1 } } 343 gv_check("T5 QUIESCENCE zero drive -> exactly zero displacement and zero energy" as *u8, t5, ctr) 344 345 // ⚠⚠LANDMINE NOTICE, LEFT DELIBERATELY IN THE DECLARING FILE (2026-08-03). A concurrent seat 346 // designed the Galilean fix (`sd_step_gal`, additive/zero-blast-radius, debt 1785785994) and 347 // banked the correct criticism of THIS tooth: **A TOOTH THAT ASSERTS THE MEASURED LAG BANKS THE 348 // BUG AS THE SPEC.** T6 below pins the CURRENT world-frame behaviour exactly, so the moment 349 // sd_step_gal lands and this gate is rebuilt, T6 WILL GO RED -- and that red is CORRECT, not a 350 // regression. DO NOT "fix" it by loosening the numbers. Replace it: assert the INVARIANT, i.e. 351 // that relative motion is unchanged under a uniform boost of anchor AND point (lag -> 0), which 352 // is the same shape as T1 translation but with a velocity offset instead of a position offset. 353 // Kept as-is only because the fix is another seat's in-flight work and racing it would collide. 354 // ---------- T6 FRAME-DEPENDENCE: a CHARACTERISATION, deliberately not an invariance -------- 355 // Damping in sd_step is -C*v where v is the point's ABSOLUTE velocity, so a body in uniform 356 // motion carries a permanent lag: uniform motion IS observable. That is a departure from 357 // Galilean invariance. This tooth does not pretend otherwise -- it MEASURES the lag, confirms 358 // it grows with speed, and pins the magnitude so a future change to the damping frame is seen. 359 let g1: *i64 = sb_alloc(1) 360 let g2: *i64 = sb_alloc(1) 361 sb_seat_mob(g1, 0, 0, 0, 0) 362 sb_seat_mob(g2, 0, 0, 0, 0) 363 var x1: i64 = 0 364 var x2: i64 = 0 365 t = 0 366 while t < MR_SETTLE { 367 x1 = x1 + 1 368 x2 = x2 + 2 369 mr_step(MR_ENG_REAL, g1, SB_CHEST, x1, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 370 mr_step(MR_ENG_REAL, g2, SB_CHEST, x2, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 371 t = t + 1 372 } 373 // ⚠THE MEASUREMENT-PHASE TRAP, caught by nx_mr_lagprobe (2026-08-03). The first run read the 374 // lag AFTER the integration step and got 171, against a closed form of C*v*Q8/K = 427 -- a 375 // 2.5x "discrepancy" that was entirely my instrument. sd_step forms its acceleration from the 376 // PRE-update separation; by the time the tick returns, the point has advanced by v while the 377 // anchor advanced by V, so the post-update reading is smaller by exactly one anchor step: 378 // post = pre - V => 171 = 427 - 256. 379 // At the true fixed point (pre=427, V=256): spring=(427*60)/1024=25 == damp=(256*100)/1024=25, 380 // so acc==0 exactly -- the solver is right and the closed form is right. Sampling the wrong 381 // PHASE of the same quantity is the identical error class as this lane's two-clocks defect. 382 // ⇒ ★A MODEL AND AN INSTRUMENT MUST AGREE ON *WHEN* THEY READ, NOT ONLY ON *WHAT*. 383 // Both phases are now measured directly, and the equilibrium condition is asserted EXACTLY 384 // (integer equality, no tolerance) rather than eyeballed against a printed prediction. 385 var pre1: i64 = 0 386 var pre2: i64 = 0 387 var post1: i64 = 0 388 var lo1: i64 = 0 389 var hi1: i64 = 0 390 var first: i64 = 1 391 t = 0 392 while t < MR_WIN { 393 x1 = x1 + 1 394 x2 = x2 + 2 395 pre1 = mr_abs(mr_off(g1, SB_CHEST, 0, x1)) 396 pre2 = mr_abs(mr_off(g2, SB_CHEST, 0, x2)) 397 mr_step(MR_ENG_REAL, g1, SB_CHEST, x1, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 398 mr_step(MR_ENG_REAL, g2, SB_CHEST, x2, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 399 post1 = mr_abs(mr_off(g1, SB_CHEST, 0, x1)) 400 if first == 1 { lo1 = pre1; hi1 = pre1; first = 0 } 401 if pre1 < lo1 { lo1 = pre1 } 402 if pre1 > hi1 { hi1 = pre1 } 403 t = t + 1 404 } 405 let spring1: i64 = (pre1*MR_K)/MR_G 406 let damp1: i64 = (MR_V1Q8*MR_C)/MR_G 407 gv_puts(" measured: PRE-update steady lag q8 -- v=1 is " as *u8); gv_num(pre1) 408 gv_puts(" (min " as *u8); gv_num(lo1); gv_puts(", max " as *u8); gv_num(hi1) 409 gv_puts("), v=2 is " as *u8); gv_num(pre2) 410 gv_puts("; POST-update at v=1 is " as *u8); gv_num(post1); gv_puts("\n" as *u8) 411 gv_puts(" equilibrium: spring=(pre*K)/G=" as *u8); gv_num(spring1) 412 gv_puts(" damp=(V*C)/G=" as *u8); gv_num(damp1) 413 gv_puts(" => acc=" as *u8); gv_num(spring1 - damp1); gv_puts("\n" as *u8) 414 var t6: i64 = 0 415 if pre1 > 0 { 416 if spring1 == damp1 { 417 if pre2 == 2*pre1 { 418 if post1 == pre1 - MR_V1Q8 { t6 = 1 } 419 } 420 } 421 } 422 gv_check("T6 FRAME-DEPENDENCE exact: world-frame damping, lag=C*v/K, doubles with v, post=pre-V" as *u8, t6, ctr) 423 424 // ---------- T7 MONOTONICITY: a bigger drive never yields a smaller peak -------------------- 425 let m1: *i64 = sb_alloc(1) 426 let m2: *i64 = sb_alloc(1) 427 sb_seat_mob(m1, 0, 0, 0, 0) 428 sb_seat_mob(m2, 0, 0, 0, 0) 429 var p1: i64 = 0 430 var p2: i64 = 0 431 t = 0 432 while t < MR_TICKS { 433 let d: i64 = mr_drive(t) 434 mr_step(MR_ENG_REAL, m1, SB_CHEST, d, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 435 mr_step(MR_ENG_REAL, m2, SB_CHEST, d*2, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 436 let a1: i64 = mr_abs(mr_off(m1, SB_CHEST, 0, d)) 437 let a2: i64 = mr_abs(mr_off(m2, SB_CHEST, 0, d*2)) 438 if a1 > p1 { p1 = a1 } 439 if a2 > p2 { p2 = a2 } 440 t = t + 1 441 } 442 gv_puts(" measured: peak at amplitude A=" as *u8); gv_num(p1) 443 gv_puts(" at 2A=" as *u8); gv_num(p2); gv_puts("\n" as *u8) 444 var t7: i64 = 0 445 if p2 >= p1 { if p1 > 0 { t7 = 1 } } 446 gv_check("T7 MONOTONICITY doubling the drive never shrinks the peak response" as *u8, t7, ctr) 447 448 // ---------- T8 IMPULSE REFLECTION: same symmetry through the impulse code path ------------- 449 let i1: *i64 = sb_alloc(1) 450 let i2: *i64 = sb_alloc(1) 451 sb_seat_mob(i1, 0, 0, 0, 0) 452 sb_seat_mob(i2, 0, 0, 0, 0) 453 sb_impulse_mob(i1, 0, 0, 300, 0) 454 sb_impulse_mob(i2, 0, 0, 0 - 300, 0) 455 var ibad: i64 = 0 456 var ipk: i64 = 0 457 t = 0 458 while t < MR_TICKS { 459 mr_step(MR_ENG_REAL, i1, SB_CHEST, 0, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 460 mr_step(MR_ENG_REAL, i2, SB_CHEST, 0, 0, 0, MR_K, MR_C, MR_MAXD_FREE, t) 461 let oa: i64 = mr_off(i1, SB_CHEST, 1, sb_offy(SB_CHEST)) 462 let ob: i64 = mr_off(i2, SB_CHEST, 1, sb_offy(SB_CHEST)) 463 if oa != (0 - ob) { ibad = ibad + 1 } 464 if mr_abs(oa) > ipk { ipk = mr_abs(oa) } 465 t = t + 1 466 } 467 gv_puts(" measured: impulse-reflection mismatches=" as *u8); gv_num(ibad) 468 gv_puts(" peak q8=" as *u8); gv_num(ipk); gv_puts("\n" as *u8) 469 var t8: i64 = 0 470 if ibad == 0 { if ipk > 0 { t8 = 1 } } 471 gv_check("T8 IMPULSE-REFLECTION a mirrored kick gives an exactly mirrored response" as *u8, t8, ctr) 472 473 // ---------- MUTATION MATRIX: which detector catches which defect class -------------------- 474 // ★A COUNCIL'S STRENGTH IS ARTIFACT DIVERSITY, NOT HEADCOUNT: three detectors are worth 475 // three votes only if they fail on DIFFERENT things. This matrix is that claim, measured. 476 let mt_ref_tr: i64 = mr_det_trans(MR_ENG_REF, MR_MAXD_FREE) 477 let mt_ref_ax: i64 = mr_det_axis(MR_ENG_REF, MR_MAXD_FREE) 478 let mt_ref_ti: i64 = mr_det_time(MR_ENG_REF, MR_MAXD_FREE) 479 let mt_ax_tr: i64 = mr_det_trans(MR_ENG_AXIS, MR_MAXD_FREE) 480 let mt_ax_ax: i64 = mr_det_axis(MR_ENG_AXIS, MR_MAXD_FREE) 481 let mt_ax_ti: i64 = mr_det_time(MR_ENG_AXIS, MR_MAXD_FREE) 482 let mt_ab_tr: i64 = mr_det_trans(MR_ENG_ABS, MR_MAXD_FREE) 483 let mt_ab_ax: i64 = mr_det_axis(MR_ENG_ABS, MR_MAXD_FREE) 484 let mt_ab_ti: i64 = mr_det_time(MR_ENG_ABS, MR_MAXD_FREE) 485 let mt_ck_tr: i64 = mr_det_trans(MR_ENG_CLOCK, MR_MAXD_FREE) 486 let mt_ck_ax: i64 = mr_det_axis(MR_ENG_CLOCK, MR_MAXD_FREE) 487 let mt_ck_ti: i64 = mr_det_time(MR_ENG_CLOCK, MR_MAXD_FREE) 488 gv_puts(" MUTATION MATRIX, FREE regime (violations; rows = engine, cols = translation/axis/time)\n" as *u8) 489 gv_puts(" reference : " as *u8); gv_num(mt_ref_tr); gv_puts(" / " as *u8); gv_num(mt_ref_ax); gv_puts(" / " as *u8); gv_num(mt_ref_ti); gv_puts("\n" as *u8) 490 gv_puts(" mut-axis : " as *u8); gv_num(mt_ax_tr); gv_puts(" / " as *u8); gv_num(mt_ax_ax); gv_puts(" / " as *u8); gv_num(mt_ax_ti); gv_puts("\n" as *u8) 491 gv_puts(" mut-abspos: " as *u8); gv_num(mt_ab_tr); gv_puts(" / " as *u8); gv_num(mt_ab_ax); gv_puts(" / " as *u8); gv_num(mt_ab_ti); gv_puts("\n" as *u8) 492 gv_puts(" mut-clock : " as *u8); gv_num(mt_ck_tr); gv_puts(" / " as *u8); gv_num(mt_ck_ax); gv_puts(" / " as *u8); gv_num(mt_ck_ti); gv_puts("\n" as *u8) 493 // The SAME matrix inside the shipping clamp, to document what the clamp HIDES. 494 let cm_ax_ax: i64 = mr_det_axis(MR_ENG_AXIS, MR_MAXD) 495 let cm_ab_tr: i64 = mr_det_trans(MR_ENG_ABS, MR_MAXD) 496 let cm_ck_ti: i64 = mr_det_time(MR_ENG_CLOCK, MR_MAXD) 497 gv_puts(" CLAMPED regime, targeted cells only -- axis-mutant/axis=" as *u8); gv_num(cm_ax_ax) 498 gv_puts(" abspos-mutant/translation=" as *u8); gv_num(cm_ab_tr) 499 gv_puts(" clock-mutant/time=" as *u8); gv_num(cm_ck_ti); gv_puts("\n" as *u8) 500 gv_puts(" (a zero here is the CLAMP MASKING a real defect, not the absence of one)\n" as *u8) 501 502 // ---------- T9/T10/T11 BITE: each detector must be able to FAIL --------------------------- 503 var b9bad: i64 = 0 504 if mt_ax_ax > 0 { b9bad = 1 } 505 var b9good: i64 = 0 506 if vax > 0 { b9good = 1 } 507 gv_bite("T9 BITE axis-permutation detector: fires on the swapped-velocity mutant" as *u8, b9bad, b9good, ctr) 508 509 var b10bad: i64 = 0 510 if mt_ab_tr > 0 { b10bad = 1 } 511 var b10good: i64 = 0 512 if vtr > 0 { b10good = 1 } 513 gv_bite("T10 BITE translation detector: fires on the absolute-position-leak mutant" as *u8, b10bad, b10good, ctr) 514 515 var b11bad: i64 = 0 516 if mt_ck_ti > 0 { b11bad = 1 } 517 var b11good: i64 = 0 518 if vti > 0 { b11good = 1 } 519 gv_bite("T11 BITE time-translation detector: fires on the free-running-clock mutant" as *u8, b11bad, b11good, ctr) 520 521 let rc: i64 = gv_verdict("SOFTTISSUE-MR-GATE" as *u8, ctr, 522 "oracle-free metamorphic seat: translation/axis/reflection/time-translation/quiescence hold; world-frame damping measured; every detector bite-proven" as *u8) 523 return rc 524}