code wiki / (root) / nx_congruence_closure.nx

nx_congruence_closure.nx

buildroot/runtime/nx_congruence_closure.nx

4482 B118 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_congruence_closure.nx -- UF (uninterpreted functions) decision procedure -- the foundational SMT theory. Per user 2026-05-14 unified-system request. This is the canonical SMT-LIB QF_UF decision procedure: given a set of equalities + a query equality, decide whether the query is implied. Algorithm: union-find over terms, with congruence propagation: if f(x) = f(y) needs to be added but x and y are in different classes, no congruence; if x and y are in same class, merge f(x) and f(y). Iterate until fixpoint. Simplified scalar form: caller supplies ground equalities between atomic IDs (treating function applications as distinct atoms); substrate's union-find decides equivalence.

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_result.nx nx_congruence_closure.nx nx_unified_solver_test.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_result.nx

imported by: nx_unified_solver_test.nx

structs

30struct CongClosure

consts

28const NX_CC_MAX_TERMS: nx_int = 1024
36const NX_CC_BYTES: nx_int = 24

functions

38func nx_cc_new() -> *CongClosure
called by 1: main calls 1: sys_mmap
47func nx_cc_add_term(c: *CongClosure) -> *NxResult
called by 1: main calls 2: nx_result_errnx_result_ok
57func nx_cc_find(c: *CongClosure, x: nx_int) -> nx_int
71func nx_cc_union(c: *CongClosure, x: nx_int, y: nx_int) -> *NxResult
91func nx_cc_equal(c: *CongClosure, x: nx_int, y: nx_int) -> *NxResult
106func nx_cc_propagate_congruence(c: *CongClosure,
118func nx_cc_n_terms(c: *CongClosure) -> nx_int { return c.n }
called by 1: main