A promise resolving to:
- 'sat' if the assertions (plus assumptions) are satisfiable
- 'unsat' if they are unsatisfiable
- 'unknown' if Z3 cannot determine satisfiability
const solver = new Solver();
const x = Int.const('x');
solver.add(x.gt(0));
// Check without assumptions
await solver.check(); // 'sat'
// Check with temporary assumption (doesn't modify solver)
await solver.check(x.lt(0)); // 'unsat'
await solver.check(); // still 'sat' - assumption was temporary
unsatCore - Retrieve unsat core after checking with assumptions
Return a string describing why the last call to check returned 'unknown'.
A string explaining the reason, or an empty string if the last check didn't return unknown
Retrieve the unsat core after a check that returned 'unsat'.
The unsat core is a (typically small) subset of the assumptions that were sufficient to determine unsatisfiability. This is useful for understanding which assumptions are conflicting.
Note: To use unsat cores effectively, you should call check with assumptions (not just assertions added via add).
An AstVector containing the subset of assumptions that caused UNSAT
const solver = new Solver();
const x = Bool.const('x');
const y = Bool.const('y');
const z = Bool.const('z');
solver.add(x.or(y));
solver.add(x.or(z));
const result = await solver.check(x.not(), y.not(), z.not());
if (result === 'unsat') {
const core = solver.unsatCore();
// core will contain a minimal set of conflicting assumptions
console.log('UNSAT core size:', core.length());
}
check - Check with assumptions to use with unsat core
Check whether the assertions in the solver are consistent or not.
Optionally, you can provide additional boolean expressions as assumptions. These assumptions are temporary and only used for this check - they are not permanently added to the solver.