code wiki / _hdl_build / nx_eqsat_rule_proof_test.nx

nx_eqsat_rule_proof_test.nx

buildroot/runtime/_hdl_build/nx_eqsat_rule_proof_test.nx

4826 B98 linesdepth 8pulls 10 transitivereach 0 importersview sourcekind gate/prooftopic eqsat
docsdependenciesstructsconstsfunctions

about

nx_eqsat_rule_proof_test.nx -- SOVEREIGN soundness proof for the eqsat rewrite rules (algebraic-normal-form leg). Models nx_alu_divider_proof_test.nx: a machine-checked exhaustive small-width check, cross-checked by triangulation legs that all run through nx_gsim (independent of NishiLang `*`/`<<` codegen, because they go via the netlist). WORKED EXAMPLE: certify mul x 8 == shl x 3 BY PROOF (not by battery): build the LHS netlist (MUL x 8) and the RHS netlist (SHL x 3), sweep x over a representative width, and require both legs to equal a third independent oracle on EVERY vector. MIGRATED OFF A HAND-ROLLED VERDICT 2026-08-14, and it had NEVER BEEN COMPILED before that day -- nor had nx_eqsat.nx itself, which did not compile at all (a module const read 470 lines above its declaration). So this proof existed on disk, fully written, and had never once run. A NEGATIVE CONTROL WAS ADDED IN THE SAME PASS. The original asserted only that the sound pair AGREES on all 256 vectors. A triangulator that returned pass for everything would have scored full marks -- the gates-green-on-garbage class. The control sweeps an UNSOUND pair (mul x 8 vs shl x FOUR, off by one bit) through the same machinery and requires it to DISAGREE, so a pass on the sound pair now means the comparison can actually fail. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_gate_verdict.nx nx_alu_divider.nx nx_triangulate.nx nx_eqsat_rule_proof_test.nx

imports: nx_gate_verdict.nxnx_alu_divider.nxnx_triangulate.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ _mk div_const div_op2 nx_gsim_run nx_gsim_kind_supported nx_gsim_eval_cell nx_tri_pass_strict nx_tri_check gv_check gv_puts ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

24const PW: i64 = 8 // representative width: sweep x in [0, 2^PW)
25const PW_VECTORS: i64 = 256 // 2^PW -- named so the anti-vacuity tooth reads as arithmetic, not a magic literal

functions

28func _mk(vals: *i64, cells: *NxGsimCell, g: *NxGsim) -> i64
called by 1: main
32func main() -> i64