code wiki / _hdl_build / nx_pow_register.nx
nx_pow_register.nx source
↩ module page · 51 lines · 4508 B
1// nx_pow_register.nx -- registers the team-authored POW rung via the Librarian.
2// ENGINEER evidence = team invariant test + oracle self-anchor gate + live-oracle
3// ULP gate, ALL re-run here; on pass it appends the gate rows to
4// knowledge/status/math_engine.log and dual-writes the capability via cl_next_idx.
5// license_tier: ORIGINAL
6import "nx_cap_register.nx"
7import "nx_capreg_librarian.nx"
8import "nx_syscalls.nx"
9
10func pwr_run(path: *u8) -> i64 {
11 let pid: i64 = sys_fork()
12 if pid == 0 {
13 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4)
14 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) }
15 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0
16 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0
17 sys_execve(path, argv, envp); sys_exit(127)
18 }
19 let st: *i64 = sys_mmap(16) as *i64
20 sys_wait4(pid, st, 0)
21 return st[0]
22}
23
24func main() -> i64 {
25 var allok: i64 = 1
26 if pwr_run("/tmp/_pe_f64pow_test.sov.elf" as *u8) != 0 { allok = 0 }
27 if pwr_run("/tmp/_bf_pow_gate_authored.sov.elf" as *u8) != 0 { allok = 0 }
28 if pwr_run("/tmp/_f64_pow_gate_authored.sov.elf" as *u8) != 0 { allok = 0 }
29 cr_w(1, "ENGINEER: pow invariants + oracle self-anchor + live-oracle ULP gate pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8)
30 if allok == 1 {
31 let lg: i64 = sys_openat_append("knowledge/status/math_engine.log" as *u8, 0x1a4)
32 if lg >= 0 {
33 cr_w(lg, "POWORACLE epoch=run-2026-06-10 module=_bf_pow_gate_authored eq-anchors=200x5-vs-blessed-mul-div-sqrt-identity ladder=24-rungs-incl-subnormal-floor-and-tie specials=26 verdict=GREEN oracle=nx_bigfloat120_pow(SOVEREIGN,exp-y-ln-x-120bit) domain=TOTAL lane=nx_sov_build_run\n" as *u8)
34 cr_w(lg, "POWGATE epoch=run-2026-06-10 module=_f64_pow_gate_authored vectors=1162 exact=1065 ulp1=97 worse=0 max-ulp=1 verdict=GREEN oracle=LIVE-bigfloat-pow(SOVEREIGN) authored-by=TEAM-MATH_KERNEL-POW spec=nx_mathspec_pow(no-python,no-minimax) scheme=dd-log2-exp2-exact-rational-L-P domain=TOTAL tamper-test=RED-then-GREEN honesty=RED-on-wrong-exp-recombine-then-derived-identity-fix-GREEN lane=nx_sov_build_run\n" as *u8)
35 sys_close(lg)
36 }
37 }
38 let eng: i64 = ig_engineer(1, 1, 1, allok)
39 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
40 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
41 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
42 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
43 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
44 let idx: i64 = cl_next_idx(lp, jp)
45 let ok: i64 = cl_register_dual(lp, jp, idx, 5,
46 2, "GEN F64-POW TEAM-AUTHORED, HARDEST ME1 KERNEL CLOSED (ME1 rung 6; DLMF ch4 -> 666 permil) -- the first DOUBLE-DOUBLE team kernel, zero borrowed tools, NO MINIMAX TABLES: nx_bigfloat120_pow (SOVEREIGN ORACLE: exp(y*ln|x|) at 120 bits, |v|<=1100 band analysis = 45-bit margin; full IEEE/C99 special matrix in bit logic; self-anchor = pow(x,2)/pow(x,-1)/pow(x,1/2) MUST EQUAL blessed fl(x*x)/fl(1/x)/sqrt(x) at 200 pts (correctly-rounded-equality trick) + 24-rung exact 2^n ladder incl subnormal floor + round-to-even tie + 26 specials) -> nx_mathspec_pow (SPEC EMITTER: 35 consts -- sqrt(3/2)/sqrt(3) cuts via bigfloat BINARY SEARCH (no bf sqrt needed), log2(1.5)/cp/ln2 32-bit hi/lo splits, L_j=3/(2j+3) and P_k=2*B_2k/(2k)! EXACT-RATIONAL Taylor replacing fdlibm minimax, (2k)! divided factor-by-factor under the div_small bound) -> pe6_author_pow (MATH_KERNEL template 4: dd via 32-bit raw masking Dekker splits no-FMA, fdlibm e_pow shape re-derived) -> TEAM authored _pe_f64pow (nx_f64_pow) -> GATE vs LIVE bigfloat-pow oracle: 1162 pts across dd-stress (x near 1, amplifying y), overflow/underflow seams, parity paths, subnormal x: exact=1065 ulp1=97 worse=0 max-ulp=1; tamper RED(worse=419,max=10449396)-then-GREEN. HONESTY: first build RED 342/402 worse -> probe proved dd-log2 BIT-PERFECT vs bigfloat truth -> bug isolated to exp recombination (extra z*t1p term) -> identity e^z=1+z-z*t1p/(t1p-2) re-derived from R(z) first principles -> single fix GREEN (no patch cascade). Scorecard overall 352->411 ON-LADDER. Composes CAPREG276/285/289/294/307" as *u8)
47 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) }
48 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED (team pow, dd sovereign loop)\n" as *u8)
49 sys_exit(0)
50 return 0
51}