Allow the creation of the same stack again after closing (CVC5 does not
allow option changes after using any stack on that context, remember
what stack we made so that we don't have to change the options for the
same stack)
@@ -33,6 +33,9 @@ public final class CVC5SolverContext extends AbstractSolverContext {
private final int randomSeed;
private final AtomicBoolean isAnyStackAlive = new AtomicBoolean(false);
private boolean closed = false;
+ // CVC5 does not like changing options after a stack was used. We remember what the last stack was
+ // with this.
+ private boolean wasInterpolationStackBefore = false;
private CVC5SolverContext(
CVC5FormulaCreator creator,
@@ -155,9 +158,12 @@ public final class CVC5SolverContext extends AbstractSolverContext {
protected InterpolatingProverEnvironment<?> newProverEnvironmentWithInterpolation0(
Set<ProverOptions> pOptions) {
Preconditions.checkState(!closed, "solver context is already closed");
+ if (!wasInterpolationStackBefore) {
// Unsat Core and interpolation may not be active both at once!
solver.setOption("produce-unsat-cores", "false");
solver.setOption("produce-interpolants", "true");
+ wasInterpolationStackBefore = true;
+ }
return new CVC5InterpolatingProver(
creator,
shutdownNotifier,
