nx_patent_check.nx
buildroot/runtime/nx_patent_check.nx
about
nx_patent_check.nx -- offline patent-encumbrance gate.
Per user directive 2026-05-14: "add the patent information/table to
nishi library for offline referencing". This primitive reads
nxc2/specs/nx_patent_table.txt (TSV: algorithm_id, patent_status,
patent_ref, filed_year, expiry_year, notes) and answers per-algo
safety queries.
Status enum:
NX_PAT_UNKNOWN = 0 default deny (no row in table)
NX_PAT_ACTIVE = 1 patent in force -- UNSAFE; refuse
NX_PAT_EXPIRED = 2 was patented; now safe
NX_PAT_PD = 3 never patented; always safe
Safe predicate: status >= NX_PAT_EXPIRED (i.e., PD or EXPIRED).
Composes with nx_provenance: license filter (#2) blocks tainted
source text; patent filter (#3) blocks encumbered algorithm
IDEAS. Together they close the IP-exposure surface.
genealogy_id: substrate_patent_gate_2026_05_14
lineage_id: ip_compliance_filter
dependencies 4 imports · 3 importers
imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_str.nx
imported by: nx_patent_check_test.nxnx_self_audit.nxnx_sovereign_qed_audit.nx
structs
| 50 | struct NxPatentRecord |
| 58 | struct NxPatentTable |
consts
| 35 | const NX_PAT_UNKNOWN: nx_int = 0 |
| 36 | const NX_PAT_ACTIVE: nx_int = 1 |
| 37 | const NX_PAT_EXPIRED: nx_int = 2 |
| 38 | const NX_PAT_PD: nx_int = 3 |
| 42 | const NX_PAT_SAFE_MIN: nx_int = 2 |
| 44 | const NX_PAT_MAX_RECORDS: nx_int = 1024 |
| 45 | const NX_PAT_ALGO_ID_CAP: nx_size = 96 |
| 46 | const NX_PAT_STATUS_CAP: nx_size = 16 |
| 56 | const NX_PAT_REC_BYTES: nx_size = 24 |
functions
| 66 | func nx_pat_status_from_str(s: *u8) -> nx_int |
| 77 | func nx_pat_parse_line(buf: *u8, lo: nx_int, hi: nx_int, |
| 156 | func nx_patent_load(path: *u8) -> *NxPatentTable |
| 194 | func nx_patent_check(t: *NxPatentTable, algo_id: *u8) -> nx_int |
| 208 | func nx_patent_is_safe(t: *NxPatentTable, algo_id: *u8) -> nx_int |
| 215 | func nx_patent_n_records(t: *NxPatentTable) -> nx_int { return t.n } |
| 217 | func nx_patent_n_by_status(t: *NxPatentTable, status: nx_int) -> nx_int |