code wiki / _hdl_build / nx_sinhcosh_register.nx
nx_sinhcosh_register.nx source
↩ module page · 52 lines · 4770 B
1// nx_sinhcosh_register.nx -- registers the team-authored SINH+COSH rung via the
2// Librarian. ENGINEER evidence = team invariant test + oracle self-anchor gate
3// + live-oracle ULP gate, ALL re-run here; on pass it appends SINHGATE+COSHGATE
4// rows (DLMF ch4 -> FULL) 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 shr_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 shr_run("/tmp/_pe_f64sinhcosh_test.sov.elf" as *u8) != 0 { allok = 0 }
27 if shr_run("/tmp/_bf_sinhcosh_gate_authored.sov.elf" as *u8) != 0 { allok = 0 }
28 if shr_run("/tmp/_f64_sinhcosh_gate_authored.sov.elf" as *u8) != 0 { allok = 0 }
29 cr_w(1, "ENGINEER: sinh/cosh 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, "SINHCOSHORACLE epoch=run-2026-06-10 module=_bf_sinhcosh_gate_authored double-angle=150/150 pythagorean=60/60-strip exp-tie-vs-blessed=100/100-2ulp specials=PASS verdict=GREEN oracle=nx_bigfloat120_sinh(SOVEREIGN,pow-organ-exp-core,taylor-below-1) domain=TOTAL lane=nx_sov_build_run\n" as *u8)
34 cr_w(lg, "SINHGATE epoch=run-2026-06-10 module=_f64_sinhcosh_gate_authored vectors=339 exact=337 ulp1=2 worse=0 max-ulp=1 verdict=GREEN oracle=LIVE-bigfloat-sinh(SOVEREIGN) authored-by=TEAM-MATH_KERNEL-SINHCOSH spec=nx_mathspec_sinhcosh(no-python,no-minimax) scheme=exp-dd-core+taylor-below-1+refined-dd-reciprocal domain=TOTAL tamper-test=RED-then-GREEN lane=nx_sov_build_run\n" as *u8)
35 cr_w(lg, "COSHGATE epoch=run-2026-06-10 module=_f64_sinhcosh_gate_authored vectors=339 exact=335 ulp1=4 worse=0 max-ulp=1 verdict=GREEN oracle=LIVE-bigfloat-cosh(SOVEREIGN) authored-by=TEAM-MATH_KERNEL-SINHCOSH spec=nx_mathspec_sinhcosh(no-python,no-minimax) domain=TOTAL tamper-test=RED-then-GREEN lane=nx_sov_build_run\n" as *u8)
36 sys_close(lg)
37 }
38 }
39 let eng: i64 = ig_engineer(1, 1, 1, allok)
40 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
41 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
42 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
43 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
44 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
45 let idx: i64 = cl_next_idx(lp, jp)
46 let ok: i64 = cl_register_dual(lp, jp, idx, 5,
47 2, "GEN F64-SINH+COSH TEAM-AUTHORED, DLMF CH4 COMPLETE AT 1000 PERMIL (ME1 rungs 8+9) -- exp/log/sin/cos/tan/atan/pow/sinh/cosh ALL max-ulp=1, all team-authored from sovereign bigfloat specs, ZERO minimax ZERO python end to end: nx_bigfloat120_sinh oracle (cosh=(E+1/E)/2 via the pow organ exp core; sinh same for x>=1 + EXACT-FACTORIAL Taylor below 1 where 120-bit exp difference would cancel catastrophically; self-anchor = cancellation-free double-angle identities 150/150 full-domain + pythagorean strip 60/60 + 2ulp tie to the BLESSED bf_exp_f64 organ 100/100) -> nx_mathspec_sinhcosh (36 consts: ln2 hi/lo + Bernoulli P_k reused from the pow families + 1/(2k+1)! and 1/(2k)! factor-by-factor) -> pe6_author_sinhcosh (MATH_KERNEL template 6: SHARED exp-dd core (ln2 reduce exact 11bx21b, Bernoulli form assembled to dd), three-branch: Taylor / (E-+I)/2 with refined dd reciprocal / 2^(n-1) exact assembly w/ natural overflow at the true ~710.476 cut) -> TEAM authored _pe_f64sinhcosh -> GATE vs LIVE oracle GREEN FIRST RUN: sinh 339pts exact=337 worse=0 max=1, cosh exact=335 worse=0 max=1 (best exact-rate of any ME1 kernel); tamper ln2_h RED(worse=172x2,max=10240000)-then-GREEN. Gate-authoring lesson: 0x4086300000000000 is 710.0 not 710.5 (raw-literal arithmetic slips live in GATES too; oracle was right). Scorecard ch4 777->1000 FULL, overall 470->588 ON-LADDER. NEXT: ME2 gamma/lgamma (ch5) + erf/erfc (ch7) on a bigfloat gamma oracle. Composes CAPREG294/307/335/360" as *u8)
48 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) }
49 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED (team sinh+cosh, ch4 FULL)\n" as *u8)
50 sys_exit(0)
51 return 0
52}