code wiki / _hdl_build / nx_pattern_emit11_register.nx

nx_pattern_emit11_register.nx source

↩ module page · 43 lines · 3331 B

1// nx_pattern_emit11_register.nx -- GOVERNED registration of the PREDICTOR_CODER emitter 2// (shape 16) + the census/classifier/warden sync. Engineer evidence = the five gate elfs 3// built THIS invocation all exit 0. license_tier: ORIGINAL 4import "nx_cap_register.nx" 5import "nx_capreg_librarian.nx" 6import "nx_syscalls.nx" 7 8func p11r_run(path: *u8) -> i64 { 9 let pid: i64 = sys_fork() 10 if pid == 0 { 11 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 12 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 13 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 14 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 15 sys_execve(path, argv, envp); sys_exit(127) 16 } 17 let st: *i64 = sys_mmap(16) as *i64 18 sys_wait4(pid, st, 0) 19 return st[0] 20} 21 22func main() -> i64 { 23 var allok: i64 = 1 24 if p11r_run("/tmp/nx_pattern_emit11_demo.elf" as *u8) != 0 { allok = 0 } 25 if p11r_run("/tmp/_pe_lpc2_test.elf" as *u8) != 0 { allok = 0 } 26 if p11r_run("/tmp/nx_pattern_library_test.elf" as *u8) != 0 { allok = 0 } 27 if p11r_run("/tmp/nx_pattern_classify_test.elf" as *u8) != 0 { allok = 0 } 28 if p11r_run("/tmp/nx_warden_build_test.elf" as *u8) != 0 { allok = 0 } 29 cr_w(1, "ENGINEER: emit11 demo + authored test + library + classifier + warden all-pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 30 let eng: i64 = ig_engineer(1, 1, 1, allok) 31 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 32 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 33 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 34 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 35 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 36 let idx1: i64 = cl_next_idx(lp, jp) 37 let ok1: i64 = cl_register_dual(lp, jp, idx1, 5, 38 2, "SELF PATTERN-EMIT11 PREDICTOR_CODER (shape 16; the team autonomy lever grown from the NV1 LPC rung -- the media-codec core no covered pattern could author, race-4 growth discipline: name the concepts the loss needed, emit them). pe11_author_predictor_coder(name,mod,test,order,vmax) authors a LOSSLESS predictor/residual coder: fixed linear predict o0..o3 (binomial coeffs, exact integer) + zigzag + restore() exact inverse + out-of-range reconstruction REFUSED -2 (the NV1 tamper-evidence doctrine, now a library concept). EMIT-TIME RAIL (PID discipline): emitter runs the full round-trip with its OWN math before writing -- non-bit-exact spec REFUSED; param rails order 0..3, vmax 16..65535 (refusals proven in demo). Test KATs computed at emit time (residuals, tamper push 8*vmax -> -2, n<=order -> -1). SYNCED same change: library census 16 + trait PLC_HAS_INVERSE(14) + classifier row IN_ARRAY+HAS_INVERSE before ACCUMULATOR (order policy KAT'd both ways) + warden dispatch row. GATES bash _pe11_run ALL GREEN: demo 3/3, AUTHORED test exit 0, library 5/5, classifier 23/23, classifier_sync 16/16/16 GREEN, warden 9/9 _wb_lpc ADMITTED-HANDS-OFF autonomy=875 (was 857). The Builder now authors media predictor/residual cores hands-off" as *u8) 39 if ok1 != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) } 40 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx1); cr_w(1, " REGISTERED -- PREDICTOR_CODER emitter\n" as *u8) 41 sys_exit(0) 42 return 0 43}