3535import java .util .List ;
3636import java .util .Optional ;
3737import java .util .Set ;
38- import javax .annotation .Nonnull ;
3938import org .sosy_lab .common .ShutdownNotifier ;
4039import org .sosy_lab .common .UniqueIdGenerator ;
4140import org .sosy_lab .common .collect .PathCopyingPersistentTreeMap ;
@@ -55,7 +54,6 @@ abstract class CVC5AbstractProver<T> extends AbstractProverWithAllSat<T> {
5554 private final FormulaManager mgr ;
5655 protected final CVC5FormulaCreator creator ;
5756 private final int randomSeed ;
58- private final ImmutableSet <ProverOptions > options ;
5957 private final ImmutableMap <String , String > furtherOptionsMap ;
6058 protected Solver solver ; // final in incremental mode, non-final in non-incremental mode
6159 private boolean changedSinceLastSatQuery = false ;
@@ -79,24 +77,20 @@ protected CVC5AbstractProver(
7977
8078 mgr = pMgr ;
8179 creator = pFormulaCreator ;
82- options = ImmutableSet .copyOf (pOptions );
8380 furtherOptionsMap = pFurtherOptionsMap ;
8481 randomSeed = pRandomSeed ;
8582 incremental = !enableSL ;
8683 assertedTerms .add (PathCopyingPersistentTreeMap .of ());
8784
8885 if (incremental ) {
89- solver = getNewSolver (randomSeed , options , furtherOptionsMap );
86+ solver = getNewSolver ();
9087 }
9188 }
9289
93- protected Solver getNewSolver (
94- int randomSeed ,
95- Set <ProverOptions > pOptions ,
96- ImmutableMap <String , String > pFurtherOptionsMap ) {
90+ protected Solver getNewSolver () {
9791 Solver newSolver = new Solver (creator .getEnv ());
9892 try {
99- CVC5SolverContext .setSolverOptions (newSolver , randomSeed , pFurtherOptionsMap );
93+ CVC5SolverContext .setSolverOptions (newSolver , randomSeed , furtherOptionsMap );
10094 } catch (CVC5ApiRecoverableException e ) {
10195 // We've already used these options in CVC5SolverContext, so there should be no exception
10296 throw new AssertionError ("Unexpected exception" , e );
@@ -226,7 +220,7 @@ public boolean isUnsat() throws InterruptedException, SolverException {
226220 if (solver != null ) {
227221 solver .deletePointer (); // cleanup
228222 }
229- solver = getNewSolver (randomSeed , options , furtherOptionsMap );
223+ solver = getNewSolver ();
230224
231225 ImmutableSet <BooleanFormula > assertedFormulas = getAssertedFormulas ();
232226 if (enableSL ) {
@@ -237,8 +231,9 @@ public boolean isUnsat() throws InterruptedException, SolverException {
237231
238232 Result result ;
239233 try {
240- result = checkSat ();
241- } catch (CVC5ApiException e ) {
234+ result = solver .checkSat ();
235+ } catch (Exception e ) {
236+ // we actually only want to catch CVC5ApiException, but need to catch all.
242237 throw new SolverException ("CVC5 failed during satisfiability check" , e );
243238 } finally {
244239 /* Shutdown currently not possible in CVC5. */
@@ -247,10 +242,6 @@ public boolean isUnsat() throws InterruptedException, SolverException {
247242 return convertSatResult (result );
248243 }
249244
250- private Result checkSat () throws CVC5ApiException {
251- return solver .checkSat ();
252- }
253-
254245 private void declareHeap (ImmutableSet <BooleanFormula > pAssertedFormulas ) throws SolverException {
255246 // get heap sort from asserted terms
256247 final Multimap <Sort , Sort > heapSorts ;
@@ -278,9 +269,8 @@ private void declareHeap(ImmutableSet<BooleanFormula> pAssertedFormulas) throws
278269 solver .declareSepHeap (heapSort , elementSort );
279270 }
280271
281- @ Nonnull
282272 private Multimap <Sort , Sort > getHeapSorts (ImmutableSet <BooleanFormula > pAssertedFormulas )
283- throws CVC5ApiException , SolverException {
273+ throws CVC5ApiException {
284274 final Deque <Term > waitlist = new ArrayDeque <>();
285275 for (BooleanFormula f : pAssertedFormulas ) {
286276 waitlist .add (creator .extractInfo (f ));
0 commit comments