Skip to content
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
b8ccbe0
Revert "Revert changes supposed to be on a feature branch"
May 30, 2025
7422f4c
Reduce complexity of prover based shutdown getter
Jun 2, 2025
a43d183
Reduce complexity of prover based shutdown getter even more
Jun 2, 2025
5af69e6
Remove unnecessary comment in BitwuzlaTheoremProver
Jun 2, 2025
2b81ac8
Allow and use direct access to prover specific ShutdownNotifier
Jun 2, 2025
92f2f60
Add Int and BV test for context shutdown and prover reuse afterward
Jun 2, 2025
b048f56
Add default implementation of isUnsat() to centralize checks (closed,…
Jun 2, 2025
e73b889
Add more timeout/shutdown tests:
Jun 2, 2025
ba6c2bc
Add a model test that checks error when requesting a model for UNSAT …
Jun 2, 2025
28d5648
Remove unnecessary exceptions from test methods in TimeoutTest
Jun 2, 2025
5de5971
Format TimeoutTest
Jun 2, 2025
0f8e757
Add default handling for basic prover API like isUnsat(), getUnsatCor…
Jun 2, 2025
1b6f52b
Remove unnecessary final modifiers in AbstractProver
Jun 2, 2025
77ab3d6
Add more uniform handling of prerequisites of interpolation API
Jun 2, 2025
223624c
Add clarification JavaDoc for getShutdownManagerForProver()
Jun 2, 2025
55f8e08
Add clarification JavaDoc about needed options for unsatCoreOverAssum…
Jun 2, 2025
6613b21
Add more internal information about shutdown re-use for Z3 and Bitwuzla
Jun 2, 2025
843b0ee
Format JavaDoc
Jun 2, 2025
e6587bd
Add API for requesting new prover environments with a dedicated prove…
Jun 4, 2025
418bc8b
Remove old getter for created shutdown manager in the BasicProverEnvi…
Jun 4, 2025
c85042b
Add new prover environments with a dedicated prover shutdown notifier…
Jun 4, 2025
2fe5c2b
Add dedicated prover shutdown notifier to abstract provers
Jun 4, 2025
028ef5b
Add dedicated prover shutdown notifier to Bitwuzla
Jun 4, 2025
b122b50
Add dedicated prover shutdown notifier to ShutdownHook
Jun 4, 2025
b1ad38f
Add dedicated prover shutdown notifier to Boolector and remove unneed…
Jun 4, 2025
856d3b6
Add dedicated prover shutdown notifier to CVC4
Jun 4, 2025
3b16949
Add dedicated prover shutdown notifier to CVC5 implementation, but ma…
Jun 4, 2025
fa7dfb2
Add dedicated prover shutdown notifier to MathSAT5
Jun 4, 2025
37a58ee
Add dedicated prover shutdown notifier to OpenSMT2
Jun 4, 2025
3538fdc
Add dedicated prover shutdown notifier to Princess but make it not us…
Jun 4, 2025
9e6d0ba
Add dedicated prover shutdown notifier to SMTInterpol but make it not…
Jun 4, 2025
02bdda9
Add dedicated prover shutdown notifier to Yices2
Jun 4, 2025
30a74dd
Add dedicated prover shutdown notifier to Z3
Jun 4, 2025
1812dfc
Change TimeoutTest for the new way prover shutdown can be requested a…
Jun 4, 2025
17ec72e
Add default behavior/failure checks for getEvaluator()
Jun 4, 2025
5a20e6d
Add default behavior/failure checks for pop() for termination
Jun 11, 2025
0b95f11
Concat static string error msgs
Jun 11, 2025
1cd34dd
Add shutdown reason to exception msg for non-interrupted exception th…
Jun 11, 2025
c85c030
Add recovery of assertProverAPIThrowsInterruptedException from method…
Jun 11, 2025
407f52a
Remove redundant checks from BoolectorTheoremProver.java
Jun 11, 2025
384c7b1
Remove commented out old code
Jun 11, 2025
97c44b6
Add full shutdown/interrupt exception handling to Z3 model
Jun 11, 2025
cfa1cdb
Remove redundant checks and code from provers/solvers
Jun 11, 2025
799385c
Directly use shutdown exception text constant when checking for hidde…
Jun 25, 2025
b4fbc2f
Lazily eval shutdown msg when checking in non throwing methods
Jun 25, 2025
1f5c866
Reduce args for CVC5InterpolatingProver constructor
Jun 25, 2025
676aebb
Apply refaster patch
Jun 25, 2025
65407fb
Switch to lazy and self implemented shutdown state check
Jun 26, 2025
2e83b93
Centralize getInterpolant ID checking and also give back the mismatch…
Jun 26, 2025
ee5eee0
Centralize getInterpolant ID checking and also give back the mismatch…
Jun 26, 2025
c1dc784
Correctly reset assumptions for interpolation in the assumption wrapp…
Jun 26, 2025
41daa1f
Remove unneeded lazy handling of error msg
Jun 26, 2025
d06d41c
Extend TimeoutTest with checking for all prover API, including interp…
Jun 26, 2025
4a4cac8
Improve interpolation input error messages by including a null check …
Jun 30, 2025
0c683e8
Reduce query size for timeout test (was unnecessarily high)
Jun 30, 2025
79ba7d7
Rename shutdownManagers in tests to make their use/source more clear
Jun 30, 2025
295e01a
Make internal prover variables private and add setter and getter wher…
Jun 30, 2025
a9023f9
Remove unneeded lambda from Mathsat termination check
Jun 30, 2025
3ca9316
Add a sanity check in DebuggingBasicProverEnvironment for getModelAss…
Jun 30, 2025
9e63816
Mark implementation specifications with @implNote in SolverContext
Jun 30, 2025
ac5be00
Make JavaDoc clearer for SolverContext prover requests and their inte…
Jun 30, 2025
1d9ec5a
Improve JavaDoc of SolverContext in regard to shutdown of provers
Jun 30, 2025
e4bf4e8
Hide common Strings used in provers from users
Jun 30, 2025
f16f77d
Make common Strings used in provers static
Jun 30, 2025
1ab6955
Re-add default impl of getModelAssignments()
Jun 30, 2025
fc323b9
Re-throw exception when clearing assumptions, and it's not another ex…
Jul 1, 2025
1b268a3
Improve JavaDoc of constructor methods of new prover environments wit…
Jul 21, 2025
c4a7a65
Add warning for sneaky SolverExceptions in Model JavaDoc
Jul 29, 2025
b7da958
Throw sneaky SolverExceptions in Mathsat Model instead of confusing I…
Jul 29, 2025
50094eb
Add more sneaky throw warnings to API that may throw a SolverExceptio…
Jul 29, 2025
89837d5
Remove sneaky throw of SolverException from Mathsat native call
Jul 30, 2025
dbbdc31
Remove sneaky throw of SolverException from Z3 model and add Interrup…
Jul 30, 2025
b0e7b44
Add SolverException and InterruptedException to many calls related to…
Jul 30, 2025
0ca8d4f
Remove sneaky throws for Z3 specific code entirely
Jul 30, 2025
cd51b02
Add Solver- and InterruptedException to push() and addConstraint() API
Jul 30, 2025
898832d
Remove warnings about sneaky throws where they can't happen anymore
Jul 30, 2025
c900399
Format: remove warnings about sneaky throws where they can't happen a…
Jul 30, 2025
2166410
Rename exception variable to fit naming schema
Jul 30, 2025
64b21b3
Improve warning for sneaky throws in model iterator() as suggested by…
Jul 30, 2025
cd3ef20
Merge feature branch 481-mathsat5-returns-null-for-msat_model_create_…
Jul 31, 2025
477efd0
Remove special handling of interrupts for API that did not throw Inte…
Jul 31, 2025
ca14eff
Remove special handling of interrupts for API that did not throw Inte…
Jul 31, 2025
4b429db
Switch all expected exceptions after interrupt to InterruptedExceptio…
Jul 31, 2025
d447902
Remove toString() in lazy evaluation to be actually lazy in AbstractP…
Jul 31, 2025
22bc811
Move JavaDoc from throws to general info for prover environment creat…
Jul 31, 2025
a75ec8a
Use dummy ShutdownNotifier instead of null if there is no prover spec…
Jul 31, 2025
5f30d42
Remove null checks for prover based ShutdownNotifier when no longer n…
Aug 4, 2025
b8c9a06
Remove Z3 specific code for throwing checked exceptions as runtime ex…
Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/org/sosy_lab/java_smt/api/BasicProverEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
* provides only the common operations. In most cases, just use one of the two sub-interfaces
*/
public interface BasicProverEnvironment<T> extends AutoCloseable {
String NO_MODEL_HELP = "Model computation failed. Are the pushed formulae " + "satisfiable?";

String NO_MODEL_HELP = "Model computation failed. Are the pushed formulae satisfiable?";
String NO_UNSAT_CORE_HELP =
"UnsatCore computation failed. Are the pushed formulae " + "unsatisfiable?";

String STACK_CHANGED_HELP =
"Computation failed. The prover state has changed since the last " + "call to isUnsat().";

/**
* Push a backtracking point and add a formula to the current stack, asserting it. The return
Expand Down Expand Up @@ -107,11 +112,7 @@ default Evaluator getEvaluator() throws SolverException {
* <p>Note that if you need to iterate multiple times over the model it may be more efficient to
* use this method instead of {@link #getModel()} (depending on the solver).
*/
default ImmutableList<Model.ValueAssignment> getModelAssignments() throws SolverException {
try (Model model = getModel()) {
return model.asList();
}
}
ImmutableList<Model.ValueAssignment> getModelAssignments() throws SolverException;

/**
* Get an unsat core. This should be called only immediately after an {@link #isUnsat()} call that
Expand All @@ -121,7 +122,8 @@ default ImmutableList<Model.ValueAssignment> getModelAssignments() throws Solver

/**
* Returns an UNSAT core (if it exists, otherwise {@code Optional.empty()}), over the chosen
* assumptions. Does NOT require the {@link ProverOptions#GENERATE_UNSAT_CORE} option to work.
* assumptions. Does NOT require the {@link ProverOptions#GENERATE_UNSAT_CORE} option to work, but
* {@link ProverOptions#GENERATE_UNSAT_CORE_OVER_ASSUMPTIONS}.
*
* @param assumptions Selected assumptions
* @return Empty optional if the constraints with assumptions are satisfiable, subset of
Expand Down
70 changes: 70 additions & 0 deletions src/org/sosy_lab/java_smt/api/SolverContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.sosy_lab.java_smt.api;

import com.google.common.collect.ImmutableMap;
import org.sosy_lab.common.ShutdownNotifier;
import org.sosy_lab.java_smt.SolverContextFactory.Solvers;

/**
Expand Down Expand Up @@ -65,6 +66,28 @@ enum ProverOptions {
*/
ProverEnvironment newProverEnvironment(ProverOptions... options);

/**
* Create a fresh new {@link ProverEnvironment} which encapsulates an assertion stack and can be
* used to check formulas for unsatisfiability. Allows the shutdown of the prover instance
* returned with the given {@link ShutdownNotifier}, without stopping other provers of the context
* calling this (except for provers also connected via the given {@link ShutdownNotifier}).
*
* @param pProverShutdownNotifier a {@link ShutdownNotifier} that stops the prover returned by
* this method. The prover is not usable anymore after a shutdown has been requested and only
* ever returns {@link InterruptedException}s. The context can be used normally and new
* provers can be created and used. If a {@link ShutdownNotifier} has been given to the
* context that is used to call this method, both notifiers can be used to stop the prover
* returned by this method. Note that once a shutdown-request has been given to the contexts
* {@link ShutdownNotifier}, no prover can ever be used again on that context instance.
* Solvers that don't support isolated prover shutdown throw a {@link
* UnsupportedOperationException} for this method and {@link
* #newProverEnvironment(ProverOptions...)} should be used instead.
* @param options Options specified for the prover environment. All the options specified in
* {@link ProverOptions} are turned off by default.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far we've left it pretty open if a solver can be reused after a shutdown request. Should the JavaDoc for SolverContextFactory also be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. @kfriedberger do we want to put out a policy or just give out all info that we have and leave it to the users?

ProverEnvironment newProverEnvironment(
ShutdownNotifier pProverShutdownNotifier, ProverOptions... options);

/**
* Create a fresh new {@link InterpolatingProverEnvironment} which encapsulates an assertion stack
* and allows generating and retrieve interpolants for unsatisfiable formulas. If the SMT solver
Expand All @@ -76,6 +99,31 @@ enum ProverOptions {
*/
InterpolatingProverEnvironment<?> newProverEnvironmentWithInterpolation(ProverOptions... options);

/**
* Create a fresh new {@link InterpolatingProverEnvironment} which encapsulates an assertion stack
* and allows generating and retrieve interpolants for unsatisfiable formulas. If the SMT solver
* is able to handle satisfiability tests with assumptions please consider implementing the {@link
* InterpolatingProverEnvironment} interface, and return an Object of this type here. Allows the
* shutdown of the prover instance returned with the given {@link ShutdownNotifier}, without
* stopping other provers of the context calling this (except for provers also connected via the
* given {@link ShutdownNotifier}).
*
* @param pProverShutdownNotifier a {@link ShutdownNotifier} that stops the prover returned by
* this method. The prover is not usable anymore after a shutdown has been requested and only
* ever returns {@link InterruptedException}s. The context can be used normally and new
* provers can be created and used. If a {@link ShutdownNotifier} has been given to the
* context that is used to call this method, both notifiers can be used to stop the prover
* returned by this method. Note that once a shutdown-request has been given to the contexts
* {@link ShutdownNotifier}, no prover can ever be used again on that context instance.
* Solvers that don't support isolated prover shutdown throw a {@link
* UnsupportedOperationException} for this method and {@link
* #newProverEnvironment(ProverOptions...)} should be used instead.
* @param options Options specified for the prover environment. All the options specified in
* {@link ProverOptions} are turned off by default.
*/
InterpolatingProverEnvironment<?> newProverEnvironmentWithInterpolation(
ShutdownNotifier pProverShutdownNotifier, ProverOptions... options);

/**
* Create a fresh new {@link OptimizationProverEnvironment} which encapsulates an assertion stack
* and allows solving optimization queries.
Expand All @@ -85,6 +133,28 @@ enum ProverOptions {
*/
OptimizationProverEnvironment newOptimizationProverEnvironment(ProverOptions... options);

/**
* Create a fresh new {@link OptimizationProverEnvironment} which encapsulates an assertion stack
* and allows solving optimization queries. Allows the shutdown of the prover instance returned
* with the given {@link ShutdownNotifier}, without stopping other provers of the context calling
* this (except for provers also connected via the given {@link ShutdownNotifier}).
*
* @param pProverShutdownNotifier a {@link ShutdownNotifier} that stops the prover returned by
* this method. The prover is not usable anymore after a shutdown has been requested and only
* ever returns {@link InterruptedException}s. The context can be used normally and new
* provers can be created and used. If a {@link ShutdownNotifier} has been given to the
* context that is used to call this method, both notifiers can be used to stop the prover
* returned by this method. Note that once a shutdown-request has been given to the contexts
* {@link ShutdownNotifier}, no prover can ever be used again on that context instance.
* Solvers that don't support isolated prover shutdown throw a {@link
* UnsupportedOperationException} for this method and {@link
* #newProverEnvironment(ProverOptions...)} should be used instead.
* @param options Options specified for the prover environment. All the options specified in
* {@link ProverOptions} are turned off by default.
*/
OptimizationProverEnvironment newOptimizationProverEnvironment(
ShutdownNotifier pProverShutdownNotifier, ProverOptions... options);

/**
* Get version information out of the solver.
*
Expand Down
115 changes: 112 additions & 3 deletions src/org/sosy_lab/java_smt/basicimpl/AbstractProver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@
import com.google.common.collect.Multimap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.sosy_lab.common.ShutdownNotifier;
import org.sosy_lab.java_smt.api.BasicProverEnvironment;
import org.sosy_lab.java_smt.api.BooleanFormula;
import org.sosy_lab.java_smt.api.Evaluator;
import org.sosy_lab.java_smt.api.Model;
import org.sosy_lab.java_smt.api.SolverContext.ProverOptions;
import org.sosy_lab.java_smt.api.SolverException;

public abstract class AbstractProver<T> implements BasicProverEnvironment<T> {

Expand All @@ -35,6 +40,8 @@ public abstract class AbstractProver<T> implements BasicProverEnvironment<T> {
private final boolean generateUnsatCoresOverAssumptions;
protected final boolean enableSL;
protected boolean closed = false;
protected boolean wasLastSatCheckSat = false;
protected boolean stackChangedSinceLastQuery = false;

private final Set<Evaluator> evaluators = new LinkedHashSet<>();

Expand All @@ -47,7 +54,13 @@ public abstract class AbstractProver<T> implements BasicProverEnvironment<T> {

private static final String TEMPLATE = "Please set the prover option %s.";

protected AbstractProver(Set<ProverOptions> pOptions) {
protected final @Nullable ShutdownNotifier proverShutdownNotifier;
protected final ShutdownNotifier contextShutdownNotifier;

protected AbstractProver(
ShutdownNotifier pContextShutdownNotifier,
@Nullable ShutdownNotifier pProverShutdownNotifier,
Set<ProverOptions> pOptions) {
generateModels = pOptions.contains(ProverOptions.GENERATE_MODELS);
generateAllSat = pOptions.contains(ProverOptions.GENERATE_ALL_SAT);
generateUnsatCores = pOptions.contains(ProverOptions.GENERATE_UNSAT_CORE);
Expand All @@ -56,6 +69,23 @@ protected AbstractProver(Set<ProverOptions> pOptions) {
enableSL = pOptions.contains(ProverOptions.ENABLE_SEPARATION_LOGIC);

assertedFormulas.add(LinkedHashMultimap.create());

contextShutdownNotifier = pContextShutdownNotifier;
proverShutdownNotifier = pProverShutdownNotifier;
}

protected final void shutdownIfNecessary() throws InterruptedException {
contextShutdownNotifier.shutdownIfNecessary();
if (proverShutdownNotifier != null) {
proverShutdownNotifier.shutdownIfNecessary();
}
}

protected final boolean shouldShutdown() {
if (proverShutdownNotifier != null) {
return contextShutdownNotifier.shouldShutdown() || proverShutdownNotifier.shouldShutdown();
}
return contextShutdownNotifier.shouldShutdown();
}

protected final void checkGenerateModels() {
Expand All @@ -66,11 +96,11 @@ protected final void checkGenerateAllSat() {
Preconditions.checkState(generateAllSat, TEMPLATE, ProverOptions.GENERATE_ALL_SAT);
}

protected final void checkGenerateUnsatCores() {
private void checkGenerateUnsatCores() {
Preconditions.checkState(generateUnsatCores, TEMPLATE, ProverOptions.GENERATE_UNSAT_CORE);
}

protected final void checkGenerateUnsatCoresOverAssumptions() {
private void checkGenerateUnsatCoresOverAssumptions() {
Preconditions.checkState(
generateUnsatCoresOverAssumptions,
TEMPLATE,
Expand All @@ -87,10 +117,72 @@ public int size() {
return assertedFormulas.size() - 1;
}

@Override
public final boolean isUnsat() throws SolverException, InterruptedException {
checkState(!closed);
closeAllEvaluators();
shutdownIfNecessary();
wasLastSatCheckSat = !isUnsatImpl();
stackChangedSinceLastQuery = false;
return !wasLastSatCheckSat;
}

protected abstract boolean isUnsatImpl() throws SolverException, InterruptedException;

@Override
public List<BooleanFormula> getUnsatCore() {
checkState(!closed);
checkState(!shouldShutdown());
checkState(!wasLastSatCheckSat, NO_UNSAT_CORE_HELP);
checkState(!stackChangedSinceLastQuery, STACK_CHANGED_HELP);
checkGenerateUnsatCores();
return getUnsatCoreImpl();
}

protected abstract List<BooleanFormula> getUnsatCoreImpl();

@Override
public final Optional<List<BooleanFormula>> unsatCoreOverAssumptions(
Collection<BooleanFormula> assumptions) throws SolverException, InterruptedException {
checkState(!closed);
shutdownIfNecessary();
checkGenerateUnsatCoresOverAssumptions();
return unsatCoreOverAssumptionsImpl(assumptions);
}

protected abstract Optional<List<BooleanFormula>> unsatCoreOverAssumptionsImpl(
Collection<BooleanFormula> assumptions) throws SolverException, InterruptedException;

@Override
public final boolean isUnsatWithAssumptions(Collection<BooleanFormula> assumptions)
throws SolverException, InterruptedException {
checkState(!closed);
shutdownIfNecessary();
stackChangedSinceLastQuery = false;
return isUnsatWithAssumptionsImpl(assumptions);
}

protected abstract boolean isUnsatWithAssumptionsImpl(Collection<BooleanFormula> assumptions)
throws SolverException, InterruptedException;

@Override
public final Model getModel() throws SolverException {
checkState(!closed);
checkState(!shouldShutdown());
checkState(wasLastSatCheckSat, NO_MODEL_HELP);
checkState(!stackChangedSinceLastQuery, STACK_CHANGED_HELP);
checkGenerateModels();
return getModelImpl();
}

protected abstract Model getModelImpl() throws SolverException;

@Override
public final void push() throws InterruptedException {
checkState(!closed);
shutdownIfNecessary();
pushImpl();
stackChangedSinceLastQuery = true;
assertedFormulas.add(LinkedHashMultimap.create());
}

Expand All @@ -101,6 +193,9 @@ public final void pop() {
checkState(!closed);
checkState(assertedFormulas.size() > 1, "initial level must remain until close");
assertedFormulas.remove(assertedFormulas.size() - 1); // remove last
// TODO: technically only needed if the level removed was non empty.
stackChangedSinceLastQuery = true;
wasLastSatCheckSat = false;
popImpl();
}

Expand All @@ -110,8 +205,11 @@ public final void pop() {
@CanIgnoreReturnValue
public final @Nullable T addConstraint(BooleanFormula constraint) throws InterruptedException {
checkState(!closed);
shutdownIfNecessary();
T t = addConstraintImpl(constraint);
Iterables.getLast(assertedFormulas).put(constraint, t);
stackChangedSinceLastQuery = true;
wasLastSatCheckSat = false;
return t;
}

Expand Down Expand Up @@ -152,6 +250,17 @@ protected void closeAllEvaluators() {
evaluators.clear();
}

@Override
public ImmutableList<Model.ValueAssignment> getModelAssignments() throws SolverException {
Preconditions.checkState(!closed);
checkState(!shouldShutdown());
Preconditions.checkState(!stackChangedSinceLastQuery, STACK_CHANGED_HELP);
checkState(wasLastSatCheckSat);
try (Model model = getModel()) {
return model.asList();
}
}

@Override
public void close() {
assertedFormulas.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Deque;
import java.util.List;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.sosy_lab.common.ShutdownNotifier;
import org.sosy_lab.java_smt.api.BooleanFormula;
import org.sosy_lab.java_smt.api.BooleanFormulaManager;
Expand All @@ -28,16 +29,15 @@
*/
public abstract class AbstractProverWithAllSat<T> extends AbstractProver<T> {

protected final ShutdownNotifier shutdownNotifier;
private final BooleanFormulaManager bmgr;

protected AbstractProverWithAllSat(
Set<ProverOptions> pOptions,
BooleanFormulaManager pBmgr,
ShutdownNotifier pShutdownNotifier) {
super(pOptions);
ShutdownNotifier pContextShutdownNotifier,
@Nullable ShutdownNotifier pProverShutdownNotifier) {
super(pContextShutdownNotifier, pProverShutdownNotifier, pOptions);
bmgr = pBmgr;
shutdownNotifier = pShutdownNotifier;
}

@Override
Expand Down Expand Up @@ -68,7 +68,7 @@ private <R> void iterateOverAllModels(
AllSatCallback<R> callback, List<BooleanFormula> importantPredicates)
throws SolverException, InterruptedException {
while (!isUnsat()) {
shutdownNotifier.shutdownIfNecessary();
shutdownIfNecessary();

ImmutableList.Builder<BooleanFormula> valuesOfModel = ImmutableList.builder();
try (Evaluator evaluator = getEvaluatorWithoutChecks()) {
Expand All @@ -88,11 +88,11 @@ private <R> void iterateOverAllModels(

final ImmutableList<BooleanFormula> values = valuesOfModel.build();
callback.apply(values);
shutdownNotifier.shutdownIfNecessary();
shutdownIfNecessary();

BooleanFormula negatedModel = bmgr.not(bmgr.and(values));
addConstraint(negatedModel);
shutdownNotifier.shutdownIfNecessary();
shutdownIfNecessary();
}
}

Expand All @@ -113,7 +113,7 @@ private <R> void iterateOverAllPredicateCombinations(
Deque<BooleanFormula> valuesOfModel)
throws SolverException, InterruptedException {

shutdownNotifier.shutdownIfNecessary();
shutdownIfNecessary();

if (isUnsat()) {
return;
Expand Down
Loading