code wiki / _hdl_build / nx_math_arc_register.nx
nx_math_arc_register.nx source
↩ module page · 58 lines · 4847 B
1// nx_math_arc_register.nx -- registers the math-engine arc's team-ability rungs via the
2// Librarian (cl_next_idx + dual-write): MATH_KERNEL emitter + team-authored log,
3// the NIST scorecard organ, and the SOVEREIGN f64 oracle (py-debt retirement).
4// ENGINEER evidence = the gates re-run RIGHT HERE; refuses unless all exit 0.
5// license_tier: ORIGINAL
6import "nx_cap_register.nx"
7import "nx_capreg_librarian.nx"
8import "nx_syscalls.nx"
9
10func mar_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 mar_run("/tmp/_pe_f64log_test.sov.elf" as *u8) != 0 { allok = 0 }
27 if mar_run("/tmp/_f64_log_gate_authored.sov.elf" as *u8) != 0 { allok = 0 }
28 if mar_run("/tmp/_f64_soak_gate_authored.sov.elf" as *u8) != 0 { allok = 0 }
29 if mar_run("/tmp/nx_math_scorecard.sov.elf" as *u8) != 0 { allok = 0 }
30 cr_w(1, "ENGINEER: log-invariants + log-ULP + sovereign-oracle-soak + scorecard pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8)
31 let eng: i64 = ig_engineer(1, 1, 1, allok)
32 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
33 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
34 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
35 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
36 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
37
38 let i1: i64 = cl_next_idx(lp, jp)
39 let ok1: i64 = cl_register_dual(lp, jp, i1, 5,
40 2, "SELF PATTERN-EMIT-6 MATH_KERNEL (shape 11 -- first NEW shape past the 10/10 census; the math-engine autonomy lever) -- Builder authors f64 TRANSCENDENTALS from a data spec: LOG_REDUCE template (sqrt2 split -> s=f/(2+f) -> Horner in z -> k*ln2 hi/lo recombine), emitter holds STRUCTURE never constants; spec = oracle-generated table; emitted test KATs from ALGORITHM INVARIANTS (ln(1)=+0 exact). PROVEN: team authored _pe_f64log (nx_f64_log), invariants GREEN + Engineer ULP gate 196 vectors MAX-ULP=1 (exact 195) -- gate caught a REAL 2-ulp defect in the naive 2s*poly form -> exact-identity rewrite (2s = f - s*f) -> GREEN: the find->root-cause->rewrite loop ran on a TEAM-authored module. DLMF ch.4 now 2/9. Extends emit4(262)/emit5; composes CAPREG265/267" as *u8)
41 if ok1 != 1 { cr_w(1, "DUAL-WRITE-1 FAILED\n" as *u8); sys_exit(1) }
42 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, i1); cr_w(1, " MATH_KERNEL emitter + team log\n" as *u8)
43
44 let i2: i64 = cl_next_idx(lp, jp)
45 let ok2: i64 = cl_register_dual(lp, jp, i2, 4,
46 2, "CON MATH-SCORECARD (the NIST-exceed instrument) -- nx_math_scorecard: MECHANICAL DLMF/GAMS coverage from knowledge/status/math_engine.log GREEN gate rows; requirement table = DATA rows (17 tags: arith + DLMF ch4/5/7/10 + PERFRACE); verdict=NIST-EXCEED REQUIRES every class full AND a won perf race -- unreachable by assertion, only by gates. FIRST RUN (honest baseline): arith=1000 dlmf_ch4=222 ch5=0 ch7=0 ch10=0 perf=0 overall=176 verdict=ON-LADDER -> knowledge/status/math_scorecard.log. Wire into nx_prove_all + team_pulse as grader #8 = Conductor follow-on. Grows by adding rows+gates only" as *u8)
47 if ok2 != 1 { cr_w(1, "DUAL-WRITE-2 FAILED\n" as *u8); sys_exit(1) }
48 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, i2); cr_w(1, " NIST scorecard organ\n" as *u8)
49
50 let i3: i64 = cl_next_idx(lp, jp)
51 let ok3: i64 = cl_register_dual(lp, jp, i3, 5,
52 2, "GEN F64-ORACLE-SOVEREIGN + SOAK (ME0b; py-debt RETIRED for ME0; operator law no-py-no-sh) -- nx_f64_oracle_sov: pure-Nishi INDEPENDENT recompute of binary64 add/sub/mul/div/sqrt via two-word 120-bit exact significand + full-value RNE (structurally different from the impl's GRS shortcuts: 20/33/16 split product, two-word align/borrow subtract w/ sticky-epsilon, 60-bit-quotient division, 28-pair sqrt). GATE _f64_soak_gate_authored: ANCHOR 986/986 (sovereign oracle reproduces the hardware-IEEE-anchored KAT set = anchor transfer) + SOAK 200000/200000 impl-vs-oracle bit-exact on sovereign xorshift64* (fixed seed, re-runnable). ME0 vector regeneration is nishi-only now; remaining py debt (exp/log mpmath consts+vectors) FILED in NISHI_DEBT_LEDGER w/ named replacement ME3 nx_bigfloat. Composes CAPREG265" as *u8)
53 if ok3 != 1 { cr_w(1, "DUAL-WRITE-3 FAILED\n" as *u8); sys_exit(1) }
54 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, i3); cr_w(1, " sovereign f64 oracle + soak\n" as *u8)
55
56 sys_exit(0)
57 return 0
58}