Class AbstractProver<T>
- java.lang.Object
-
- org.sosy_lab.java_smt.basicimpl.AbstractProver<T>
-
- All Implemented Interfaces:
AutoCloseable,BasicProverEnvironment<T>
- Direct Known Subclasses:
AbstractProverWithAllSat
public abstract class AbstractProver<T> extends Object implements BasicProverEnvironment<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.sosy_lab.java_smt.api.BasicProverEnvironment
BasicProverEnvironment.AllSatCallback<R>
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanchangedSinceLastSatQueryprotected booleanclosedprotected booleanenableSLprotected booleangenerateAllSatprotected booleangenerateModelsprotected booleangenerateUnsatCores-
Fields inherited from interface org.sosy_lab.java_smt.api.BasicProverEnvironment
ASSUMPTION_SOLVING_NOT_SUPPORTED, NO_MODEL_HELP, UNSAT_CORE_NOT_SUPPORTED
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractProver(Set<SolverContext.ProverOptions> pOptions)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @Nullable TaddConstraint(BooleanFormula constraint)Add a constraint to the latest backtracking point.protected abstract @Nullable TaddConstraintImpl(BooleanFormula constraint)OptimizationProverEnvironment.OptStatuscheck()Performs an optimization-aware check and returns the optimization status.protected voidcheckEnableSeparationLogic()protected voidcheckGenerateAllSat()protected voidcheckGenerateModels()protected voidcheckGenerateUnsatCores()protected voidcheckGenerateUnsatCoresOverAssumptions()protected OptimizationProverEnvironment.OptStatuscheckImpl()Implementation of optimization-aware satisfiability-check.voidclose()Closes the prover environment.protected voidcloseAllEvaluators()protected ImmutableSet<T>getAssertedConstraintIds()protected ImmutableSet<BooleanFormula>getAssertedFormulas()protected abstract booleanhasPersistentModel()booleanisUnsat()Check whether the conjunction of all formulas on the stack is unsatisfiable.protected abstract booleanisUnsatImpl()voidpop()Remove one backtracking point/level from the current stack.protected abstract voidpopImpl()voidpush()Create a new backtracking point, i.e., a new level on the assertion stack.protected abstract voidpushImpl()protected <E extends Evaluator>
EregisterEvaluator(E pEvaluator)This method registers the Evaluator to be cleaned up before the next change on the prover stack.intsize()Get the number of backtracking points/levels on the current stack.protected voidunregisterEvaluator(Evaluator pEvaluator)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sosy_lab.java_smt.api.BasicProverEnvironment
allSat, getEvaluator, getModel, getModelAssignments, getStatistics, getUnsatCore, isUnsatWithAssumptions, push, registerUserPropagator, unsatCoreOverAssumptions
-
-
-
-
Field Detail
-
generateModels
protected final boolean generateModels
-
generateAllSat
protected final boolean generateAllSat
-
generateUnsatCores
protected final boolean generateUnsatCores
-
enableSL
protected final boolean enableSL
-
closed
protected boolean closed
-
changedSinceLastSatQuery
protected boolean changedSinceLastSatQuery
-
-
Constructor Detail
-
AbstractProver
protected AbstractProver(Set<SolverContext.ProverOptions> pOptions)
-
-
Method Detail
-
checkGenerateModels
protected final void checkGenerateModels()
-
checkGenerateAllSat
protected final void checkGenerateAllSat()
-
checkGenerateUnsatCores
protected final void checkGenerateUnsatCores()
-
checkGenerateUnsatCoresOverAssumptions
protected final void checkGenerateUnsatCoresOverAssumptions()
-
checkEnableSeparationLogic
protected final void checkEnableSeparationLogic()
-
hasPersistentModel
protected abstract boolean hasPersistentModel()
-
size
public int size()
Description copied from interface:BasicProverEnvironmentGet the number of backtracking points/levels on the current stack.Caution: This is the number of PUSH-operations, and not necessarily equal to the number of asserted formulas. On any level there can be an arbitrary number of asserted formulas. Even with size of 0, formulas can already be asserted (at bottom level).
- Specified by:
sizein interfaceBasicProverEnvironment<T>
-
push
public final void push() throws InterruptedExceptionDescription copied from interface:BasicProverEnvironmentCreate a new backtracking point, i.e., a new level on the assertion stack. Each level can hold several asserted formulas.If formulas are added before creating the first backtracking point, they can not be removed via a POP-operation.
- Specified by:
pushin interfaceBasicProverEnvironment<T>- Throws:
InterruptedException
-
pushImpl
protected abstract void pushImpl() throws InterruptedException- Throws:
InterruptedException
-
pop
public final void pop()
Description copied from interface:BasicProverEnvironmentRemove one backtracking point/level from the current stack. This removes the latest level including all of its formulas, i.e., all formulas that were added for this backtracking point.- Specified by:
popin interfaceBasicProverEnvironment<T>
-
popImpl
protected abstract void popImpl()
-
addConstraint
@CanIgnoreReturnValue public final @Nullable T addConstraint(BooleanFormula constraint) throws InterruptedException
Description copied from interface:BasicProverEnvironmentAdd a constraint to the latest backtracking point.- Specified by:
addConstraintin interfaceBasicProverEnvironment<T>- Throws:
InterruptedException
-
addConstraintImpl
protected abstract @Nullable T addConstraintImpl(BooleanFormula constraint) throws InterruptedException
- Throws:
InterruptedException
-
isUnsat
public final boolean isUnsat() throws SolverException, InterruptedExceptionCheck whether the conjunction of all formulas on the stack is unsatisfiable.- Specified by:
isUnsatin interfaceBasicProverEnvironment<T>- Throws:
SolverExceptionInterruptedException
-
isUnsatImpl
protected abstract boolean isUnsatImpl() throws SolverException, InterruptedException- Throws:
SolverExceptionInterruptedException
-
check
public final OptimizationProverEnvironment.OptStatus check() throws InterruptedException, SolverException
Performs an optimization-aware check and returns the optimization status.This method is the public entry point for optimization checks. It validates that the prover is open, resets internal change-tracking state, and delegates solver-specific work to
checkImpl(). Subclasses that implement optimization support must provide the actual checking logic incheckImpl().The signature of this method matches that of
OptimizationProverEnvironment.check(), to allow overrides in subclasses that implement bothBasicProverEnvironmentandOptimizationProverEnvironment.- Returns:
- the optimization status;
OptimizationProverEnvironment.OptStatus.OPTindicates a satisfiable/optimal result - Throws:
InterruptedExceptionSolverException
-
checkImpl
protected OptimizationProverEnvironment.OptStatus checkImpl() throws InterruptedException, SolverException
Implementation of optimization-aware satisfiability-check.- Throws:
InterruptedException- if the thread is interrupted during the checkSolverException- if the underlying solver reports an errorUnsupportedOperationException- if optimization is not supported by this prover
-
getAssertedFormulas
protected ImmutableSet<BooleanFormula> getAssertedFormulas()
-
getAssertedConstraintIds
protected ImmutableSet<T> getAssertedConstraintIds()
-
registerEvaluator
protected <E extends Evaluator> E registerEvaluator(E pEvaluator)
This method registers the Evaluator to be cleaned up before the next change on the prover stack.
-
unregisterEvaluator
protected void unregisterEvaluator(Evaluator pEvaluator)
-
closeAllEvaluators
protected void closeAllEvaluators()
-
close
public void close()
Description copied from interface:BasicProverEnvironmentCloses the prover environment. The object should be discarded, and should not be used after closing. The first call of this method will close the prover instance, further calls are ignored.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBasicProverEnvironment<T>
-
-