code wiki / _hdl_build / nx_softtissue_diss_gate.nx
nx_softtissue_diss_gate.nx source
↩ module page · 181 lines · 9392 B
1// nx_softtissue_diss_gate.nx -- THE DISSIPATION SEAT FOR THE VOLUMETRIC TIER (council seat 6).
2//
3// WHY THIS EXISTS. Debt 1785786068: both council seats built 2026-08-03 target the shipping
4// 3-point solver and the 2D ring; the sibling nx_softtissue_rot_gate v2 gave the volumetric tier
5// its metamorphic seat (all 24 proper rotations + translation, bit-exact). This file is the OTHER
6// seat. For soft tissue conservation is the wrong invariant -- the right ones are a DISSIPATION
7// INEQUALITY and an EXACT FIXED POINT.
8//
9// WHAT THE FIRST RUN MEASURED, AND WHY T4 IS BOUNDEDNESS AND NOT DECAY-TO-ZERO. The v1 tail
10// tooth demanded late-window maxima strictly decrease; it went GREEN on a 0.7% downtick of a
11// fluctuation that swings +/-6% -- a lucky window pair, not a measurement. The trajectory says
12// the truth: under standing gravity the cage decays hard from peak ~16.3M and then ORBITS a
13// persistent kinetic floor (~570-660K in ST_M_KIN units) with no decay trend for hundreds of
14// steps. At g=0 the fixed point is BIT-EXACT (T1) -- so the floor is not a velocity artifact;
15// it is gravity + constraint projection + damping cycling around the discrete equilibrium. The
16// continuum limit demands v -> 0; the discrete solver never settles. That defect is FILED as
17// debt 1785789772 with these numbers, and a decay-to-zero tooth waits for the fix -- pinning
18// today's floor into a band would bank the bug as the spec. What physics DOES require of a damped driven
19// system, defect or no defect, is that the settled regime is BOUNDED: the tail must never
20// re-approach the transient peak. That is T4 -- threshold-free (the peak is measured in-run),
21// and genuinely refutable (any energy pump that GROWS crosses it).
22//
23// WHY THE FIXED POINT IS EXACT AND NOT A BAND. Rest lengths (erl) and rest volumes (trv) are
24// captured at build from the SAME post-wall geometry the solver then reads, with the same isqrt
25// and the same st_div_r rounding. At g=0 with zero initial velocities every constraint reads
26// C=0, every correction is 0, damping of 0 is 0 -- so 300 steps must return the initial
27// positions BIT-FOR-BIT. If they do not, the build and the solver disagree about what "rest"
28// means, and that is a real defect, not tolerance noise.
29//
30// WHAT THIS GATE DELIBERATELY DOES NOT TEST.
31// - Time-segmentation (run(300) == run(150);run(150)): st_run is a bare substep loop with no
32// per-call state, so the relation cannot fail against today's source -- a tooth that cannot
33// fail is a voter with information content 0. It gets seated only if st_run ever grows entry
34// state.
35// - Galilean boost: st_substep damps ABSOLUTE point velocity (v = v - v*dmp/Q12 after the
36// position solve) -- the same ether-anchored class as the shipping tier's sd_step. But this
37// cage has PINNED particles (iw=0, velocity forced to 0 in the world frame every substep), so
38// the pins define a physical lab frame and a naive boost measures pin-tearing mixed with ether
39// drag -- a plausible number that measures nothing. The clean invariance test needs
40// anchor-boost support (the volumetric analog of sd_step_gal); FILED as debt 1785789784.
41// license_tier: ORIGINAL No hw writes (Rule 26).
42import "nx_syscalls.nx"
43import "nx_gate_verdict.nx"
44import "nx_softtissue.nx"
45
46const DG_DT_US: i64 = 4167
47const DG_ITERS: i64 = 2
48const DG_STEPS: i64 = 1440
49const DG_G: i64 = 4096
50// dissipation run: fine sampling through the transient, coarse through the long tail. The tail
51// starts at 240 -- the v1 trajectory shows the transient is fully over by ~80, so 240 is safely
52// inside the settled regime and everything after it must stay below the transient peak.
53const DG_TRANS: i64 = 240
54const DG_FINE_HOP: i64 = 10
55const DG_TAIL_HOP: i64 = 50
56
57// snapshot positions into one flat block: [0..n) x, [n..2n) y, [2n..3n) z
58func dg_snap(W: *i64) -> *i64 {
59 let n: i64 = W[ST_W_NP]
60 let S: *i64 = sys_mmap(n * 24) as *i64
61 let px: *i64 = W[ST_W_PX] as *i64
62 let py: *i64 = W[ST_W_PY] as *i64
63 let pz: *i64 = W[ST_W_PZ] as *i64
64 var i: i64 = 0
65 while i < n {
66 S[i] = px[i]
67 S[n + i] = py[i]
68 S[n + n + i] = pz[i]
69 i = i + 1
70 }
71 return S
72}
73
74// count position components differing from the snapshot; report the worst gap in cmm
75func dg_diff(W: *i64, S: *i64, worst: *i64) -> i64 {
76 let n: i64 = W[ST_W_NP]
77 let px: *i64 = W[ST_W_PX] as *i64
78 let py: *i64 = W[ST_W_PY] as *i64
79 let pz: *i64 = W[ST_W_PZ] as *i64
80 var bad: i64 = 0
81 worst[0] = 0
82 var i: i64 = 0
83 while i < n {
84 var d: i64 = px[i] - S[i]
85 if d < 0 { d = 0 - d }
86 if d != 0 { bad = bad + 1; if d > worst[0] { worst[0] = d } }
87 var e: i64 = py[i] - S[n + i]
88 if e < 0 { e = 0 - e }
89 if e != 0 { bad = bad + 1; if e > worst[0] { worst[0] = e } }
90 var f: i64 = pz[i] - S[n + n + i]
91 if f < 0 { f = 0 - f }
92 if f != 0 { bad = bad + 1; if f > worst[0] { worst[0] = f } }
93 i = i + 1
94 }
95 return bad
96}
97
98// kinetic proxy via the tier's own instrument (st_measure ST_M_KIN = sum |v| over particles)
99func dg_kin(W: *i64, M: *i64) -> i64 {
100 st_measure(W, M)
101 return M[ST_M_KIN]
102}
103
104func main(argc: i64, argv: *i64) -> i64 {
105 let ctr: *i64 = gv_ctr()
106 gv_head("nx_softtissue_diss_gate -- the volumetric tier must sit EXACTLY still at rest and STRICTLY dissipate under load" as *u8)
107 let worst: *i64 = sys_mmap(16) as *i64
108 let M: *i64 = sys_mmap(64) as *i64
109
110 // T1: EXACT FIXED POINT. Zero gravity, built-at-rest cage: 300 steps must change NOTHING.
111 let WA: *i64 = st_new(ST_PROF_LARGE_SOFT, 10)
112 let SA: *i64 = dg_snap(WA)
113 st_run(WA, 0, 0, 0, DG_STEPS, DG_DT_US, DG_ITERS)
114 let bad1: i64 = dg_diff(WA, SA, worst)
115 gv_puts(" fixed point: particles=" as *u8); gv_num(WA[ST_W_NP])
116 gv_puts(" mismatched-components=" as *u8); gv_num(bad1)
117 gv_puts(" worst-cmm=" as *u8); gv_num(worst[0])
118 gv_puts("\n" as *u8)
119 var t1: i64 = 0
120 if bad1 == 0 { t1 = 1 }
121 gv_check("T1 THE REST STATE IS AN EXACT FIXED POINT: at zero gravity the built cage reproduces its initial positions BIT-FOR-BIT after 300 steps -- rest capture and solver agree about what rest means, no band, no tolerance" as *u8, t1, ctr)
122
123 // DISSIPATION RUN: gravity on. Fine sampling through the transient, coarse through a long
124 // tail (to 1200 steps) so the floor's steadiness is measured, not assumed. Tail min/max
125 // characterize the floor for the ledger; tail max is what T4 bounds.
126 let WD: *i64 = st_new(ST_PROF_LARGE_SOFT, 10)
127 let SD: *i64 = dg_snap(WD)
128 var peak: i64 = 0
129 var tailmax: i64 = 0
130 var tailmin: i64 = 0
131 var fin: i64 = 0
132 var s: i64 = 0
133 while s < DG_STEPS {
134 var hop: i64 = DG_TAIL_HOP
135 if s < DG_TRANS { hop = DG_FINE_HOP }
136 st_run(WD, 0, 0 - DG_G, 0, hop, DG_DT_US, DG_ITERS)
137 s = s + hop
138 let k: i64 = dg_kin(WD, M)
139 if k > peak { peak = k }
140 if s > DG_TRANS {
141 if k > tailmax { tailmax = k }
142 if tailmin == 0 { tailmin = k }
143 if k < tailmin { tailmin = k }
144 }
145 fin = k
146 gv_puts(" step=" as *u8); gv_num(s)
147 gv_puts(" kin=" as *u8); gv_num(k)
148 gv_puts("\n" as *u8)
149 }
150 gv_puts(" peak-kin=" as *u8); gv_num(peak)
151 gv_puts(" tail-min=" as *u8); gv_num(tailmin)
152 gv_puts(" tail-max=" as *u8); gv_num(tailmax)
153 gv_puts(" final-kin=" as *u8); gv_num(fin)
154 gv_puts(" tail/peak-permil=" as *u8); gv_num(tailmax * 1000 / peak)
155 gv_puts("\n" as *u8)
156
157 // T2: the diff machinery can see motion -- the gravity run moved away from ITS OWN snapshot.
158 let bad2: i64 = dg_diff(WD, SD, worst)
159 gv_puts(" motion control: mismatched-components=" as *u8); gv_num(bad2)
160 gv_puts(" worst-cmm=" as *u8); gv_num(worst[0])
161 gv_puts("\n" as *u8)
162 var t2: i64 = 0
163 if bad2 > 0 { t2 = 1 }
164 gv_check("T2 THE DIFF CAN FAIL: under gravity the cage moves away from its snapshot and the same machinery T1 used reports it -- T1 is a measurement, not a dead comparator" as *u8, t2, ctr)
165
166 // T3: motion existed and STRICTLY decayed from its peak.
167 var t3: i64 = 0
168 if peak > 0 { if fin < peak { t3 = 1 } }
169 gv_check("T3 THE TRANSIENT DISSIPATES: kinetic activity was nonzero (the drop really happened) and the final sample sits STRICTLY below the peak -- a dissipation inequality in the tier's own instrument, threshold-free" as *u8, t3, ctr)
170
171 // T4: THE SETTLED REGIME IS BOUNDED. Every tail sample (steps 240-1440, 5x the horizon the
172 // floor was first seen on) must sit STRICTLY below the transient peak. A growing pump --
173 // true perpetual motion -- crosses this; the measured steady floor does not, and the floor
174 // itself is ledgered as a defect rather than banked here as a spec.
175 var t4: i64 = 0
176 if tailmax > 0 { if tailmax < peak { t4 = 1 } }
177 if tailmax == 0 { t4 = 1 }
178 gv_check("T4 NO RUNAWAY: over a 5x-extended tail the kinetic proxy never re-approaches the transient peak -- energy is not pumping upward; the persistent nonzero floor is a FILED defect, deliberately not banked into this tooth as a tolerance" as *u8, t4, ctr)
179
180 return gv_verdict("SOFTTISSUE-DISS-GATE" as *u8, ctr, "volumetric tier: exact rest fixed point + strict dissipation with a limit-cycle guard, controls in-run" as *u8)
181}