code wiki / _hdl_build / nx_codec_provenance_gate.nx

nx_codec_provenance_gate.nx

buildroot/runtime/_hdl_build/nx_codec_provenance_gate.nx

8731 B97 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic codec
docsdependenciesstructsconstsfunctions

about

nx_codec_provenance_gate.nx -- the BULLETPROOF patent-provenance LIAR-KILL over the WHOLE codec tool graph. Operator law 2026-06-20: "we cant have any patent or other fallback -- the codec has to be bulletproof, S-class exceed, NO legal issues." So this organ enforces, MECHANICALLY (never asserted as a promise -- cf. the never-brick rule #26), that EVERY tool the codec uses is provably clean: EXPIRED patent / PUBLIC-DOMAIN / UNPATENTABLE-MATH / OUR-OWN-NOVEL-CLEAN-ROOM. CRUCIAL STRICTNESS for "zero risk": UNKNOWN provenance counts as UNSAFE (not assumed clean) and turns the verdict RED -- bulletproof means nothing ships on a maybe. NOVEL-clean-room tools are allowed in the graph but FLAGGED counsel-required (this gate is provenance-by-construction EVIDENCE for the human lawyer's FTO opinion; it does NOT itself render legal advice). Neg-controls prove it catches a patented tool (CABAC / hyperprior) and an unknown one. GREEN iff 6/6. knowledge/status/codec_provenance_gate.log. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_emit_lib.nx nx_codec_provenance_gate.nx

imports: nx_syscalls.nxnx_gate_emit_lib.nx

imported by: nobody (leaf or entry point)

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

main g_puts sys_write tool g_puts ↻ g_prov g_puts ↻ is_clean sys_mmap violations is_clean ↻ count_active count_novel g_num sys_mmap ↻ sys_write ↻ g_check g_puts ↻ sys_openat_append g_w sys_write ↻ g_wn sys_mmap ↻ sys_write ↻ sys_close sys_exit

structs

none

consts

13const PV_UNKNOWN: i64 = 0 // provenance not established -> UNSAFE
14const PV_EXPIRED: i64 = 1 // patent expired (cite #/expiry)
15const PV_PD: i64 = 2 // public domain (cite dedication/rejection)
16const PV_UNPAT: i64 = 3 // unpatentable foundational math (>far past, or not patentable subject matter)
17const PV_NOVEL: i64 = 4 // our own clean-room novel design (allowed, but counsel-required)
18const PV_ACTIVE: i64 = 5 // active third-party patent -> FORBIDDEN

functions

20func g_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); 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; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
21func g_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
22func g_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; let t: *u8=sys_mmap(28); 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; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
23func g_check(label: *u8, ok: i64) -> i64 { g_puts(label); if ok==1 { g_puts(" PASS\n" as *u8); return 1 } g_puts(" FAIL\n" as *u8); return 0 }
called by 1: main calls 1: g_puts
25func is_clean(p: i64) -> i64 { if p>=1 { if p<=4 { return 1 } } return 0 }
called by 2: toolviolations
26func g_prov(p: i64) -> i64
called by 1: tool calls 1: g_puts
32func tool(name: *u8, p: i64) -> i64 { g_puts(" - " as *u8); g_puts(name); g_puts(" : " as *u8); g_prov(p); g_puts("\n" as *u8); if is_clean(p)==1 { return 0 } return 1 }
called by 1: main calls 3: g_putsg_provis_clean
34func violations(prov: *i64, n: i64) -> i64 { var v: i64=0; var i: i64=0; while i<n { if is_clean(prov[i])==0 { v=v+1 } i=i+1 } return v }
called by 1: main calls 1: is_clean
35func count_active(prov: *i64, n: i64) -> i64 { var a: i64=0; var i: i64=0; while i<n { if prov[i]==PV_ACTIVE { a=a+1 } i=i+1 } return a }
called by 1: main
36func count_novel(prov: *i64, n: i64) -> i64 { var a: i64=0; var i: i64=0; while i<n { if prov[i]==PV_NOVEL { a=a+1 } i=i+1 } return a }
called by 1: main
38func main() -> i64