Skip to main content

recover_from_cnf

Function recover_from_cnf 

Source
pub fn recover_from_cnf(
    num_bool_vars: usize,
    clauses: &[Vec<Lit>],
) -> Option<ModpRecovery>
Expand description

Lift an opaque Boolean CNF onto ℤ/m. Recognize the canonical one-hot encoding of a mod-m linear system — each variable a group of m bits with an at-least-one clause and the full pairwise at-most-one, plus all-negative “forbidden combination” clauses pinning the congruences — and recover the system over ℤ/m. The modulus m is the group size; it may be prime (a field) or composite (a ring), and [fit_congruence] handles both. Returns None (declining, never guessing) unless every clause fits the pattern and every forbidden set is exactly the complement of a single congruence: then the recovered system is equisatisfiable to the CNF, so the modular solver’s verdict transfers (UNSAT certificate carries; a SAT model is re-checked against the clauses by the caller). The m = 2 case is the parity cut; this is that cut generalized to every modulus — the obstruction GF(2) is blind to, decided in polynomial time where resolution (CDCL, Z3, Kissat) needs 2^Ω(n).