code wiki / (root) / nx_pure_lit.nx

nx_pure_lit.nx

buildroot/runtime/nx_pure_lit.nx

4282 B116 linesdepth 6pulls 6 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_pure_lit.nx -- pure-literal elimination preprocessing. A predicate symbol is "pure" if it appears with only one polarity across the entire clause set. Clauses containing a pure literal can be vacuously satisfied -- there's no clause that could ever contradict them, so removing them preserves UNSAT-equivalence. Standard SAT-solver preprocessing (Davis-Putnam 1960 lineage) extended to first-order: the predicate symbol is the unit of purity, not the literal. A clause containing ANY pure-positive literal of pred p (or ANY pure-negative literal of pred p) is dropped. Iterating to fixpoint can cascade: dropping clauses may make other predicates become pure. API: nx_pure_lit_eliminate(input, n_input, out, *out_n) -- one pass. Caller iterates to fixpoint if desired. Bits-up nx_int.

dependencies 6 imports · 1 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_result.nx nx_unify.nx nx_resolution.nx nx_pure_lit.nx nx_pure_lit_test.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_result.nxnx_unify.nxnx_resolution.nx

imported by: nx_pure_lit_test.nx

structs

none

consts

33const NX_PURE_MAX_PREDS: nx_int = 1024
37const NX_PURE_POS_BIT: nx_int = 1
38const NX_PURE_NEG_BIT: nx_int = 2

functions

43func nx_pure_collect(clauses: *Clause, n: nx_int, polarities: *nx_int)
71func nx_pure_clause_has_pure_lit(c: *Clause, polarities: *nx_int) -> nx_int
97func nx_pure_lit_eliminate(input: *Clause, n_input: nx_int,