cana.primes.primer module
Exact ON/OFF prime implicants via PySAT Primer-B.
Runs in-process. Wall-clock limits belong to callers (e.g.
high_k.timing.call_in_subprocess() in dev/high_k benches).
- cana.primes.primer.primer_on_off_primes(expr, *, max_primes=1000000)[source]
Exact ON/OFF primes via PySAT Primer-B on
fand~f.Builds a non-clausal
pysat.formulatree, enumerates all prime implicants withPrimer(implicates=False), and maps clausification IDs back to variable names. If either polarity would exceed max_primes, enumeration stops andValueErroris raised (no partial result).Runs in-process with no wall-clock limit; wrap externally if needed.
- Raises:
ImportError – if pysat (
python-sat) is not installed.ValueError – if ON or OFF prime count exceeds max_primes.
RecursionError – if parenthesis nesting exceeds
MAX_PRIMER_PAREN_DEPTH.
- Parameters:
expr (str)
max_primes (int)
- Return type:
Tuple[List[Dict[str, bool]], List[Dict[str, bool]]]