code wiki / (root) / nx_avatar_encode.nx

nx_avatar_encode.nx

buildroot/runtime/nx_avatar_encode.nx

6624 B171 linesdepth 8pulls 9 transitivereach 1 importersview sourcekind librarytopic avatar
docsdependenciesstructsconstsfunctions

about

nx_avatar_encode.nx -- full AVATAR encoder. Per Vampire-displacement roadmap Phase 2. Generates the hybrid FO-clauses-plus-SAT-problem that the full AVATAR loop consumes. For each multi-component input clause C with components C_1..C_n: Allocate fresh split atoms sp_1, sp_2, ..., sp_n (sequential from a caller-supplied base). Emit one FO clause per component, prefixed with the negation of that component's split atom: {~sp_i, C_i_lits...} (one per i in 1..n) Add one SAT clause to the SatFormula asserting that at least one component is selected: [sp_1, sp_2, ..., sp_n] (DIMACS positive lits) Single-component clauses pass through unchanged: no guard literals added, no SAT clauses contributed. Soundness: the guard literal ~sp_i in the FO clause is true when the SAT solver assigns sp_i=FALSE, making the clause trivially satisfied (no constraint on saturation). When sp_i=TRUE, the guard is false and saturation must close the component. The SAT coordination clause [sp_1..sp_n] forces at least one component per multi-component group to be active. API: nx_avatar_encode_to_sat(input, n_input, sp_base, fo_out, fo_cap, sat_formula, *next_sp_id) -> n_fo_emitted

dependencies 9 imports · 1 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_result.nx nx_unify.nx nx_resolution.nx nx_clause_components.nx nx_avatar_split.nx nx_sat_solver.nx nx_avatar_encode.nx nx_avatar_encode_test.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_result.nxnx_unify.nxnx_resolution.nxnx_clause_components.nxnx_avatar_split.nxnx_sat_solver.nx

imported by: nx_avatar_encode_test.nx

structs

none

consts

54const NX_AVATAR_SP_BASE_SYM: nx_int = 600000

functions

59func nx_avatar_sp_atom(sp_id: nx_int) -> *Term
called by 1: nx_avatar_neg_sp calls 1: nx_term_app
66func nx_avatar_neg_sp(sp_id: nx_int) -> *Literal
80func nx_avatar_encode_to_sat(input: *Clause, n_input: nx_int,