code wiki / _hdl_build / nx_gramdec_gate.nx

nx_gramdec_gate.nx

buildroot/runtime/_hdl_build/nx_gramdec_gate.nx

9861 B231 linesdepth 11pulls 22 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_gramdec_gate.nx -- NB10 gate: grammar-constrained decode (nx_gramdec_lib) teeth. T1-T8 = automaton ruler teeth (no model). T9 = LIVE no-op equivalence: on an already-grammatical greedy generation the constrained decode must be BIT-EXACT (prefix) with nsv_generate, zero rejections, accept-stop. T10 = LIVE mask-fires (anti-vacuity + escape): an else-if-baited prompt must (a) make the UNCONSTRAINED model emit `else if` (proves the bait bites -- the vacuity guard), (b) under the mask produce grammar-VALID output with >=1 rejection and NO `else if`. MUTATION PROOF (rung 5): flip GD_NEG_ALLOW_ELSEIF=1 in nx_gramdec_lib.nx, rebuild, run -> T3 accepts the else-if text and T10 sees the escape -> verdict=RED exit 1. Restore -> GREEN. argv: [model.gguf] [probe] (default model /home/elderwesto/nx_stage/nx_15b_model.gguf; "probe" prints raw outputs for tooth calibration instead of judging). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_gramdec_lib.nx nx_gramdec_gate.nx

imports: nx_gramdec_lib.nx

imported by: nobody (leaf or entry point)

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

main gg_w gg_tooth gg_w ↻ gg_wn gg_w ↻ gg_val gg_slen gd_validate gd_reset gd_mem gd_step gd_isws gd_isid gd_word_end gd_word_in gd_isdig gd_accepting gd_mem ↻ gg_cat gd_validate ↻ nsv_init_i8 nsv_init sys_now_ms sys_mmap sys_clock_gettime_mono nsv_log sys_write nf_pool nx_pool_new nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ nx_chan_new sys_mmap ↻ _nx_chan_cell sys_thread_create nx_thread_spawn nx_thread_spawn_fn sys_mmap ↻

structs

none

consts

14const GG_MAXNEW: i64 = 120
15const GG_OCAP: i64 = 4000

functions

17func gg_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 3: gg_wngg_toothmain
18func gg_wn(v: i64) -> i64
called by 2: gg_toothmain calls 1: gg_w
31func gg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: gg_findgg_val
32func gg_cat(b: *u8, off: i64, s: *u8) -> i64
38func gg_find(hay: *u8, hn: i64, needle: *u8, from: i64) -> i64
called by 1: main calls 1: gg_slen
55func gg_tooth(name: *u8, got: i64) -> i64
called by 1: main calls 2: gg_wgg_wn
65func gg_val(s: *u8) -> i64 { let n: i64 = gg_slen(s); return gd_validate(s, n) }
called by 1: main calls 2: gg_slengd_validate
68func gg_prompt_clean(pb: *u8) -> i64
called by 1: main calls 1: gg_cat
80func gg_prompt_bait(pb: *u8) -> i64
called by 1: main calls 1: gg_cat
95func gg_gen(which: i64, tx: *u8, mt: *i64) -> i64
called by 1: main calls 2: gdx_generatensv_generate
114func main(argc: i64, argv: *i64) -> i64