code wiki / _hdl_build / nx_research_discover_phys_gate.nx

nx_research_discover_phys_gate.nx

buildroot/runtime/_hdl_build/nx_research_discover_phys_gate.nx

6349 B99 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic research
docsdependenciesstructsconstsfunctions

about

nx_research_discover_phys_gate.nx -- DISCOVERY in PHYSICS, completing the math+chem+physics symmetry (operator: "discover new capabilities through different math/chem/physics via simulations"). The physics reproduction gate (nx_research_phys_gate) replays elastic outcomes via the KNOWN closed-form swap formula. This gate DISCOVERS the outcome the way physics actually derives it: from the CONSERVATION LAWS alone. An elastic 1-D collision must conserve BOTH momentum and kinetic energy: m1*v1 + m2*v2 == m1*v1' + m2*v2' (momentum) m1*v1^2 + m2*v2^2 == m1*v1'^2 + m2*v2'^2 (kinetic energy) This 2-equation system has exactly two integer-velocity solutions: the TRIVIAL (no collision: v'=v) and the real exchange. The testing-team SEARCHES the integer velocity lattice and DISCOVERS the non-trivial solution -- never given the swap formula -- then an INDEPENDENT verifier rechecks both laws and confirms it equals the closed form. LIAR-KILL: the perfectly-inelastic outcome (the blocks stick) conserves momentum but VIOLATES kinetic energy, so it is REJECTED -- the verifier cannot be fooled. Exact integer, deterministic. GREEN iff 6/6. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_research_discover_phys_gate

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap g_w sys_write search_elastic conserves_both elastic_formula conserves_both ↻ veq2 g_n g_w ↻ sys_mmap ↻ sys_write ↻ g_row g_w ↻ sys_exit

structs

none

consts

none

functions

17func g_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 3: g_ng_rowmain calls 1: sys_write
18func g_n(v: i64) -> i64 { var m: i64=v; if m<0{g_w("-");m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1}; sys_write(1,o,k); return 0 }
called by 1: main calls 3: g_wsys_mmapsys_write
19func g_row(id: *u8, ok: i64, pass: *i64) -> i64 { g_w(" "); g_w(id); g_w(": "); if ok==1 { g_w("OK\n"); pass[0]=pass[0]+1 } else { g_w("FAIL\n") } return 0 }
called by 1: main calls 1: g_w
22func conserves_both(m1: i64, m2: i64, v1: i64, v2: i64, v1p: i64, v2p: i64) -> i64
called by 2: search_elasticmain
30func search_elastic(m1: i64, m2: i64, v1: i64, v2: i64, R: i64, out: *i64) -> i64
called by 1: main calls 1: conserves_both
44func elastic_formula(m1: i64, m2: i64, v1: i64, v2: i64, out: *i64) -> i64
called by 1: main
50func veq2(a: *i64, b: *i64) -> i64 { if a[0]!=b[0] { return 0 } if a[1]!=b[1] { return 0 } return 1 }
called by 1: main
52func main() -> i64