public class SMTInterpol extends NoopScript
Script
interface to
interact with SMTInterpol.
Users should however stick to the
Script
interface which
provides most of the methods provided in this class.Modifier and Type | Class and Description |
---|---|
static class |
SMTInterpol.CheckType |
Script.LBool
mSolverSetup, mStackLevel
EMPTY_SORT_ARRAY, EMPTY_TERM_ARRAY, EXISTS, FORALL
Constructor and Description |
---|
SMTInterpol()
Default constructor using a default logger and no user termination
request.
|
SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger)
Construct SMTInterpol with a user-owned logger but without user
termination request.
|
SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger,
boolean ignored)
Deprecated.
Use a constructor version without the boolean parameter!
|
SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger,
boolean ignored,
TerminationRequest cancel)
Deprecated.
Use a constructor version without the boolean parameter.
|
SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger,
TerminationRequest cancel)
Construct SMTInterpol with a logger and a user termination
request.
|
SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.option.OptionMap options)
Construct SMTInterpol with an option map.
|
SMTInterpol(SMTInterpol other,
java.util.Map<java.lang.String,java.lang.Object> options,
de.uni_freiburg.informatik.ultimate.smtinterpol.option.OptionMap.CopyMode mode)
Copy the current context and modify some pre-theory options.
|
SMTInterpol(TerminationRequest cancel)
Default constructor using a default logger and a given user termination
request.
|
SMTInterpol(TerminationRequest cancel,
de.uni_freiburg.informatik.ultimate.smtinterpol.option.OptionMap options)
Construct SMTInterpol with a user termination request and a user created
option map.
|
Modifier and Type | Method and Description |
---|---|
Script.LBool |
assertTerm(Term term)
Assert a Boolean term into the solver.
|
java.lang.Iterable<Term[]> |
checkAllsat(Term[] input)
Perform an AllSAT computation over some important predicates.
|
Script.LBool |
checkSat()
Check for satisfiability of the current context.
|
Script.LBool |
checkSatAssuming(Term... assumptions)
Check for satisfiability of the current context under additional
assumptions.
|
void |
declareFun(java.lang.String fun,
Sort[] paramSorts,
Sort resultSort)
Declare a function symbol.
|
Term[] |
findImpliedEquality(Term[] x,
Term[] y)
Try to find an equality between
x and y that
is implied in the current satisfiable context. |
void |
flipDecisions()
Perform a restart and switch the decisions of all undecided literals.
|
void |
flipNamedLiteral(java.lang.String name)
Flip the truth value decision for a name literal.
|
Term[] |
getAssertions()
Get all assertions contained in the assertion stack.
|
Assignments |
getAssignment()
Get values for all named boolean terms in the model.
|
de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier |
getClausifier()
Access to the internal CNF transformer.
|
de.uni_freiburg.informatik.ultimate.smtinterpol.dpll.DPLLEngine |
getEngine()
Access to the internal DPLL engine.
|
java.lang.Object |
getInfo(java.lang.String info)
Get information from the solver.
|
Term[] |
getInterpolants(Term[] partition,
int[] startOfSubtree)
Compute a sequence of interpolants.
|
de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy |
getLogger()
Access to the logger used by SMTInterpol.
|
Model |
getModel()
Retrieve a complete model from the solver.
|
java.lang.Object |
getOption(java.lang.String opt)
Get the value of an option.
|
Term |
getProof()
Trigger a call to a proof processor.
|
Term[] |
getSatisfiedLiterals()
Get all literals currently set to true.
|
Term[] |
getUnsatAssumptions()
Get the unsatisfiable assumptions.
|
Term[] |
getUnsatCore()
Get the unsat core.
|
java.util.Map<Term,Term> |
getValue(Term[] terms)
Get values for some terms in the model.
|
boolean |
isTerminationRequested() |
void |
pop(int n)
Pop some levels from the assertion stack.
|
void |
push(int n)
Push some levels onto the assertion stack.
|
void |
reset()
Unset the logic and clear the assertion stack.
|
void |
resetAssertions()
Resets the assertion stack.
|
de.uni_freiburg.informatik.ultimate.smtinterpol.dpll.Clause |
retrieveProof()
Retrieve the proof in its internal format.
|
protected void |
setClausifier(de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier clausifier) |
protected void |
setEngine(de.uni_freiburg.informatik.ultimate.smtinterpol.dpll.DPLLEngine engine) |
void |
setInfo(java.lang.String info,
java.lang.Object value)
Set some information for the solver.
|
void |
setLogic(Logics logic)
Set the logic for the solver.
|
void |
setLogic(java.lang.String logic)
Set the logic for the solver.
|
void |
setOption(java.lang.String opt,
java.lang.Object value)
Set an option for the solver.
|
Term |
simplify(Term term)
Simplify a term.
|
annotate, binary, decimal, decimal, declareSort, defineFun, defineSort, echo, exit, getInterpolants, getTheory, hexadecimal, let, numeral, numeral, quantifier, sort, sort, sortVariables, string, term, term, variable
public SMTInterpol()
public SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger)
logger
- The logger owned by the caller.@Deprecated public SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger, boolean ignored)
logger
- The logger owned by the caller.ignored
- This parameter is ignored!public SMTInterpol(TerminationRequest cancel)
cancel
- User termination request to poll during checks.public SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger, TerminationRequest cancel)
logger
- The logger owned by the caller.cancel
- User termination request to poll during checks.public SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.option.OptionMap options)
options
- The option map used to handle all options.public SMTInterpol(TerminationRequest cancel, de.uni_freiburg.informatik.ultimate.smtinterpol.option.OptionMap options)
cancel
- User termination request to poll during checks.options
- Option map to handle options.@Deprecated public SMTInterpol(de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy logger, boolean ignored, TerminationRequest cancel)
logger
- The logger owned by the caller.ignored
- This option is ignored!cancel
- User termination request to poll during checks.public SMTInterpol(SMTInterpol other, java.util.Map<java.lang.String,java.lang.Object> options, de.uni_freiburg.informatik.ultimate.smtinterpol.option.OptionMap.CopyMode mode)
other
- The context to clone.options
- The options to set before setting the logic.mode
- What to do when copying existing options.public final void reset()
reset
in interface Script
reset
in class NoopScript
public final void resetAssertions()
Script
resetAssertions
in interface Script
resetAssertions
in class NoopScript
public void push(int n) throws SMTLIBException
Script
push
in interface Script
push
in class NoopScript
n
- The number of levels to push.SMTLIBException
- If logic is not set.public void pop(int n) throws SMTLIBException
Script
pop
in interface Script
pop
in class NoopScript
n
- The number of levels to pop.SMTLIBException
- If not enough stack levels are available.public Script.LBool checkSat() throws SMTLIBException
Script
Script.LBool.UNKNOWN
in case of
errors.checkSat
in interface Script
checkSat
in class NoopScript
SMTLIBException
- If the logic is not set.public Script.LBool checkSatAssuming(Term... assumptions) throws SMTLIBException
Script
Script.LBool.UNKNOWN
in case of
errors.checkSatAssuming
in interface Script
checkSatAssuming
in class NoopScript
assumptions
- Additional assumptions as Boolean constants (nullary
ApplicationTerms of sort Bool or their negations).SMTLIBException
- If the logic is not set.public void setLogic(java.lang.String logic) throws java.lang.UnsupportedOperationException, SMTLIBException
Script
Logics
enumeration.setLogic
in interface Script
setLogic
in class NoopScript
logic
- Name of the logic to set.java.lang.UnsupportedOperationException
- If the logic is not supported by
the solver.SMTLIBException
- If a logic is already set.public void setLogic(Logics logic) throws java.lang.UnsupportedOperationException, SMTLIBException
Script
setLogic
in interface Script
setLogic
in class NoopScript
logic
- Name of the logic to set.java.lang.UnsupportedOperationException
- If the logic is not supported by
the solver.SMTLIBException
- If a logic is already set.public Script.LBool assertTerm(Term term) throws SMTLIBException
Script
Script.LBool.UNKNOWN
.assertTerm
in interface Script
assertTerm
in class NoopScript
term
- The Boolean term to assert.SMTLIBException
- If the term is not Boolean or a named term
matches an already defined function.public Term[] getAssertions() throws SMTLIBException
Script
setOption
(":interactive-mode", true).getAssertions
in interface Script
getAssertions
in class NoopScript
SMTLIBException
- If interactive mode is not enabled.public Assignments getAssignment() throws SMTLIBException
Script
Script.checkSat()
did not return Script.LBool.UNSAT
. To
enable assignment production, call
setOption
(":produce-assignments",
true).getAssignment
in interface Script
getAssignment
in class NoopScript
Assignments
.SMTLIBException
- If assignment production is not enabled, or the
solver did not detect unsatisfiability.public java.lang.Object getInfo(java.lang.String info) throws java.lang.UnsupportedOperationException
Script
getInfo
in interface Script
getInfo
in class NoopScript
info
- Name of the info. Note that it has to start with
:.
java.lang.UnsupportedOperationException
- If the info is unsupported.public java.lang.Object getOption(java.lang.String opt) throws java.lang.UnsupportedOperationException
Script
getOption
in interface Script
getOption
in class NoopScript
opt
- Name of an option.java.lang.UnsupportedOperationException
- If option is unsupported.public Term getProof() throws SMTLIBException, java.lang.UnsupportedOperationException
Script
Script.checkSat()
returned Script.LBool.UNSAT
. To enable proof production, call
setOption
(":produce-proofs", true).getProof
in interface Script
getProof
in class NoopScript
SMTLIBException
- If proof production is not enabled or the solver
did not detect unsatisfiability.java.lang.UnsupportedOperationException
- If proof generation is unsupported.public Term[] getInterpolants(Term[] partition, int[] startOfSubtree)
Script
getInterpolants
in interface Script
getInterpolants
in class NoopScript
partition
- The array of formulas. This should contain either
top-level names or conjunction of top-level names.startOfSubtree
- The start of the subtree containing the formula at
this index as root.public Term[] getUnsatCore() throws SMTLIBException, java.lang.UnsupportedOperationException
Script
Script.checkSat()
returned
Script.LBool.UNSAT
. To enable unsat core production, call
setOption
(":produce-unsat-cores",
true).getUnsatCore
in interface Script
getUnsatCore
in class NoopScript
SMTLIBException
- If proof production is not enabled or the solver
did not detect unsatisfiability.java.lang.UnsupportedOperationException
- If unsat core computation is
unsupported.public Term[] getUnsatAssumptions() throws SMTLIBException, java.lang.UnsupportedOperationException
Script
Script.checkSatAssuming(Term...)
returned
Script.LBool.UNSAT
. To enable unsat assumption production, call
setOption
(":produce-unsat-assumptions", true).getUnsatAssumptions
in interface Script
getUnsatAssumptions
in class NoopScript
SMTLIBException
- If unsat assumption production is not enabled or
the solver did not detect unsatisfiability.java.lang.UnsupportedOperationException
- If unsat assumption computation is
unsupported.public java.util.Map<Term,Term> getValue(Term[] terms) throws SMTLIBException, java.lang.UnsupportedOperationException
Script
Script.checkSat()
did not return Script.LBool.UNSAT
. To enable model production, call
setOption
(":produce-models", true).getValue
in interface Script
getValue
in class NoopScript
terms
- an array of terms whose value should be computed.SMTLIBException
- If model production is not enabled or the solver
detected unsatisfiability.java.lang.UnsupportedOperationException
- If model computation is
unsupportedpublic Model getModel() throws SMTLIBException, java.lang.UnsupportedOperationException
Script
Script.checkSat()
returned Script.LBool.SAT
or (optionally)
Script.LBool.UNKNOWN
and no assertion stack command was issued after
this check.getModel
in interface Script
getModel
in class NoopScript
SMTLIBException
- Model production was not enabled.java.lang.UnsupportedOperationException
- The solver does not support this operation.public void setInfo(java.lang.String info, java.lang.Object value)
Script
setInfo
in interface Script
setInfo
in class NoopScript
info
- Name of the info. Note that it has to start with
:.
value
- Value for this info.public void setOption(java.lang.String opt, java.lang.Object value) throws java.lang.UnsupportedOperationException, SMTLIBException
Script
setOption
in interface Script
setOption
in class NoopScript
opt
- Name of the option. Note that it has to start with
:.
value
- Value for this option.java.lang.UnsupportedOperationException
- If the option is unsupported.SMTLIBException
- In case of type errors.public Term simplify(Term term) throws SMTLIBException
Script
simplify
in interface Script
simplify
in class NoopScript
term
- A (usually Boolean) term to simplify.SMTLIBException
- If an error occurred or unsupported.public void flipDecisions()
public void flipNamedLiteral(java.lang.String name) throws SMTLIBException
name
- The name used in the annotation for this literal.SMTLIBException
- If name not known.public de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier getClausifier()
public de.uni_freiburg.informatik.ultimate.smtinterpol.dpll.DPLLEngine getEngine()
public de.uni_freiburg.informatik.ultimate.smtinterpol.LogProxy getLogger()
protected void setEngine(de.uni_freiburg.informatik.ultimate.smtinterpol.dpll.DPLLEngine engine)
protected void setClausifier(de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier clausifier)
public de.uni_freiburg.informatik.ultimate.smtinterpol.dpll.Clause retrieveProof() throws SMTLIBException
getProof()
to retrieve the proof as a proof term.SMTLIBException
- If no proof is present or the proof is found to
to be incorrect.public Term[] getSatisfiedLiterals() throws SMTLIBException
SMTLIBException
- If the assertion stack is modified since the last
clean state.public java.lang.Iterable<Term[]> checkAllsat(Term[] input)
Script
checkAllsat
in interface Script
checkAllsat
in class NoopScript
input
- The important predicates. Must be Boolean.public Term[] findImpliedEquality(Term[] x, Term[] y) throws SMTLIBException, java.lang.UnsupportedOperationException
Script
x
and y
that
is implied in the current satisfiable context. If successful, this
method returns an array of parameters a,b,c
such that the
equality a*x = b*y + c
is implied by the current context.
Note that the x
array and the y
array must be
of equal length and of length at least 2.findImpliedEquality
in interface Script
findImpliedEquality
in class NoopScript
x
- The different incarnations of the lhs variable.y
- The different incarnations of the rhs variable.SMTLIBException
java.lang.UnsupportedOperationException
public void declareFun(java.lang.String fun, Sort[] paramSorts, Sort resultSort) throws SMTLIBException
Script
declareFun
in interface Script
declareFun
in class NoopScript
fun
- Name of the function symbol.paramSorts
- Sorts of the parameters.resultSort
- Sort of the result of an application of this function.SMTLIBException
- If the logic is not set, the logic is not an UF
logic but the function takes parameters, or a
function with this name already exists.public boolean isTerminationRequested()