Skip to content

Commit 4282733

Browse files
committed
Redirect to the wrapped kissat.
1 parent f0e9200 commit 4282733

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

nnf/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
__all__ = ('NNF', 'Internal', 'And', 'Or', 'Var', 'Aux', 'Builder',
3434
'all_models', 'complete_models', 'decision', 'true', 'false',
35-
'dsharp', 'dimacs', 'amc', 'tseitin', 'operators')
35+
'dsharp', 'dimacs', 'amc', 'kissat', 'tseitin', 'operators')
3636

3737

3838
def all_models(names: 't.Iterable[Name]') -> t.Iterator[Model]:
@@ -264,10 +264,9 @@ def satisfiable(
264264

265265
if cnf:
266266
return self._cnf_satisfiable()
267-
268-
# todo: use a better fallback
269-
return any(self.satisfied_by(model)
270-
for model in all_models(self.vars()))
267+
else:
268+
from nnf import tseitin
269+
return tseitin.to_CNF(self)._cnf_satisfiable()
271270

272271
def _satisfiable_decomposable(self) -> bool:
273272
"""Checks satisfiability of decomposable sentences.
@@ -596,6 +595,11 @@ def to_CNF(self) -> 'And[Or[Var]]':
596595
return tseitin.to_CNF(self)
597596

598597
def _cnf_satisfiable(self) -> bool:
598+
"""Call a SAT solver (kissat) on the presumed CNF theory."""
599+
from nnf import kissat
600+
return kissat.solve(self) is not None
601+
602+
def _cnf_satisfiable_native(self) -> bool:
599603
"""A naive DPLL SAT solver."""
600604
def DPLL(clauses: t.FrozenSet[t.FrozenSet[Var]]) -> bool:
601605
if not clauses:

0 commit comments

Comments
 (0)