public class ReusableStackInterpolatingProver<T> extends Object implements InterpolatingProverEnvironment<T>
| Constructor and Description |
|---|
ReusableStackInterpolatingProver(InterpolatingProverEnvironment<T> pDelegate) |
| Modifier and Type | Method and Description |
|---|---|
T |
addConstraint(BooleanFormula pConstraint)
Add constraint to the context.
|
void |
close()
Closes the prover environment.
|
BooleanFormula |
getInterpolant(List<T> pFormulasOfA)
Get an interpolant for two groups of formulas.
|
Model |
getModel()
Get a satisfying assignment.
|
ImmutableList<Model.ValueAssignment> |
getModelAssignments()
Get a list of satisfying assignments.
|
List<BooleanFormula> |
getSeqInterpolants(List<Set<T>> pPartitionedFormulas)
This method returns interpolants of an 'inductive sequence'.
|
List<BooleanFormula> |
getTreeInterpolants(List<Set<T>> pPartitionedFormulas,
int[] pStartOfSubTree)
Compute a sequence of interpolants.
|
boolean |
isUnsat()
Check whether the conjunction of all formulas on the stack is unsatisfiable.
|
boolean |
isUnsatWithAssumptions(Collection<BooleanFormula> pAssumptions)
Check whether the conjunction of all formulas on the stack together with the
list of assumptions is satisfiable.
|
void |
pop()
Remove one formula from the environment stack.
|
void |
push()
Create backtracking point.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpushclose, getModel, getModelAssignments, isUnsat, pop, pushpublic ReusableStackInterpolatingProver(InterpolatingProverEnvironment<T> pDelegate)
public T addConstraint(BooleanFormula pConstraint)
BasicProverEnvironmentaddConstraint in interface BasicProverEnvironment<T>public BooleanFormula getInterpolant(List<T> pFormulasOfA) throws SolverException, InterruptedException
InterpolatingProverEnvironmentBasicProverEnvironment.isUnsat() call
that returned true.
There is no direct guarantee that the interpolants returned are part of an inductive sequence', however this seems to work for most (all?) solvers as long as the same proof is used, i.e. all interpolants are computed after the same SAT-check.
getInterpolant in interface InterpolatingProverEnvironment<T>pFormulasOfA - A list of values returned by InterpolatingProverEnvironment.push(BooleanFormula).
All the corresponding formulas from group A, the remaining formulas form group B.SolverException - if interpolant cannot be computed,
for example because interpolation procedure is incompleteInterruptedExceptionpublic List<BooleanFormula> getSeqInterpolants(List<Set<T>> pPartitionedFormulas) throws SolverException, InterruptedException
InterpolatingProverEnvironmentThe stack must contain exactly the partitioned formulas, but any order is allowed. For an input of N partitions we return N-1 interpolants.
getSeqInterpolants in interface InterpolatingProverEnvironment<T>AND(I_i, P_i) => I_(i+1) is satisfied for all i,
where P_i is the conjunction of all formulas in partition i.SolverException - if interpolant cannot be computed,
for example because interpolation procedure is incompleteInterruptedExceptionpublic List<BooleanFormula> getTreeInterpolants(List<Set<T>> pPartitionedFormulas, int[] pStartOfSubTree) throws SolverException, InterruptedException
InterpolatingProverEnvironmentExample:
A D | | B E | / C | F H | / G arrayIndex = [0,1,2,3,4,5,6,7] // only for demonstration, not needed partition = [A,B,D,E,C,F,H,G] // post-order of tree startOfSubTree = [0,0,2,2,0,0,6,0] // index of left-most leaf of the current element
getTreeInterpolants in interface InterpolatingProverEnvironment<T>pPartitionedFormulas - of formulaspStartOfSubTree - The start of the subtree containing the formula at this index as root.SolverException - if interpolant cannot be computed,
for example because interpolation procedure is incompleteInterruptedExceptionpublic boolean isUnsatWithAssumptions(Collection<BooleanFormula> pAssumptions) throws SolverException, InterruptedException
InterpolatingProverEnvironmentisUnsatWithAssumptions in interface InterpolatingProverEnvironment<T>pAssumptions - A list of literals.SolverExceptionInterruptedExceptionpublic boolean isUnsat()
throws SolverException,
InterruptedException
BasicProverEnvironmentisUnsat in interface BasicProverEnvironment<T>SolverExceptionInterruptedExceptionpublic final void push()
BasicProverEnvironmentpush in interface BasicProverEnvironment<T>public void pop()
BasicProverEnvironmentpop in interface BasicProverEnvironment<T>public Model getModel() throws SolverException
BasicProverEnvironmentBasicProverEnvironment.isUnsat() call
that returned false.
A model might contain additional symbols with their evaluation,
if a solver uses its own temporary symbols.
There should be at least an value-assignment for each free symbol.getModel in interface BasicProverEnvironment<T>SolverExceptionpublic ImmutableList<Model.ValueAssignment> getModelAssignments() throws SolverException
BasicProverEnvironmentImmutableList.copyOf(getModel()),
but removes the need for calling Model.close().
Note that if you need to iterate multiple times over the model
it may be more efficient to use this method instead of BasicProverEnvironment.getModel()
(depending on the solver).
getModelAssignments in interface BasicProverEnvironment<T>SolverExceptionpublic void close()
BasicProverEnvironmentclose in interface AutoCloseableclose in interface BasicProverEnvironment<T>