Class Solver
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd plugin to this solver.voidaddSygusAssume(Term term) Add a forumla to the set of Sygus assumptions.voidaddSygusConstraint(Term term) Add a forumla to the set of Sygus constraints.voidaddSygusInvConstraint(Term inv, Term pre, Term trans, Term post) Add a set of Sygus constraints to the current state that correspond to an invariant synthesis problem.voidassertFormula(Term term) Assert a formula.voidblockModel(BlockModelsMode mode) Block the current model.voidblockModelValues(Term[] terms) Block the current model values of (at least) the values in terms.checkSat()Check satisfiability.checkSatAssuming(Term assumption) Check satisfiability assuming the given formula.checkSatAssuming(Term[] assumptions) Check satisfiability assuming the given formulas.Try to find a solution for the synthesis conjecture corresponding to the current list of functions-to-synthesize, universal variables and constraints.Try to find a next solution for the synthesis conjecture corresponding to the current list of functions-to-synthesize, universal variables and constraints.voidclose()Free the native solver, seedeletePointer().declareDatatype(String symbol, DatatypeConstructorDecl[] ctors) Create datatype sort.declareFun(String symbol, Sort[] sorts, Sort sort) Declare n-ary function symbol.declareFun(String symbol, Sort[] sorts, Sort sort, boolean fresh) Declare n-ary function symbol.declareOracleFun(String symbol, Sort[] sorts, Sort sort, IOracle oracle) Declare an oracle function with reference to an implementation.declarePool(String symbol, Sort sort, Term[] initValue) Declare a symbolic pool of terms with the given initial value.voiddeclareSepHeap(Sort locSort, Sort dataSort) When using separation logic, this sets the location sort and the datatype sort to the given ones.declareSort(String symbol, int arity) Declare uninterpreted sort.declareSort(String symbol, int arity, boolean fresh) Declare uninterpreted sort.declareSygusVar(String symbol, Sort sort) Appendsymbolto the current list of universal variables.Define n-ary function in the current context.Define n-ary function.defineFunRec(Term fun, Term[] boundVars, Term term) Define recursive function in the current context.defineFunRec(Term fun, Term[] boundVars, Term term, boolean global) Define recursive function.defineFunRec(String symbol, Term[] boundVars, Sort sort, Term term) Define recursive function in the current context.defineFunRec(String symbol, Term[] boundVars, Sort sort, Term term, boolean global) Define recursive function.voiddefineFunsRec(Term[] funs, Term[][] boundVars, Term[] terms) Define recursive functions in the current context.voiddefineFunsRec(Term[] funs, Term[][] boundVars, Term[] terms, boolean global) Define recursive functions.voidFree the native resource associated with this pointer.booleanfindSynth(FindSynthTarget fst) Find a target term of interest using sygus enumeration, with no provided grammar.findSynth(FindSynthTarget fst, Grammar grammar) Find a target term of interest using sygus enumeration with a provided grammar.Try to find a next target term of interest using sygus enumeration.Get an abduct.Get an abduct.Get the next abduct.Term[]Get the list of asserted formulas.Get a difficulty estimate for an asserted formula.Get info from the solver.Get a string that contains information about all instantiations made by the quantifiers module.getInterpolant(Term conj) Get an interpolant.getInterpolant(Term conj, Grammar grammar) Get an interpolant.Get the next interpolant.Term[]Get a list of input literals that are entailed by the current set of assertions.Term[]Get a list of literals that are entailed by the current set of assertions.getLogic()Get the logic set the solver.Get the model SMT-LIB:( get-model )Requires to enable optionproduce-models.Term[]Get the domain elements of uninterpreted sort s in the current model.Get the value of a given option.getOptionInfo(String option) Get some information about the given option.String[]Get all option names that can be used withsetOption(String, String),getOption(String)andgetOptionInfo(String).longReturn the raw native pointer.Proof[]getProof()Get refutation proof for the most recent call to checkSat.Proof[]Get a proof associated with the most recent call to checkSat.Do quantifier elimination.Do partial quantifier elimination, which can be used for incrementally computing the result of a quantifier elimination.Get a snapshot of the current state of the statistic values of this solver.Term[]Get the list of sygus assumptions.Term[]Get the list of sygus constraints.getSynthSolution(Term term) Get the synthesis solution of the given term.Term[]getSynthSolutions(Term[] terms) Get the synthesis solutions of the given terms.Get the associated term manager instance.Get a timeout core, which computes a subset of the current assertions that cause a timeout.getTimeoutCoreAssuming(Term[] assumptions) Get a timeout core, which computes a subset of the given assumptions that cause a timeout when added to the current assertions.Term[]Get the set of unsat ("failed") assumptions.Term[]Get the unsatisfiable core.Term[]Get the lemmas used to derive unsatisfiability.Get the value of the given term in the current model.Term[]Get the values of the given terms in the current model.When using separation logic, obtain the term for the heap.When using separation logic, obtain the term for nil.Get a string representation of the version of this solver.inthashCode()Return a hash code value for this solver.booleanIs logic set? Returns whether we called setLogic yet for this solver.booleanThis returns false if the model value of free constantvwas not essential for showing the satisfiability of the last call tocheckSat()using the current model.voidpop()Pop a level from the assertion stack.voidpop(int nscopes) Pop (a) level(s) from the assertion stack.proofToString(Proof proof) Prints a proof into a string with a slected proof format mode.proofToString(Proof proof, ProofFormat format) Prints a proof into a string with a slected proof format mode.proofToString(Proof proof, ProofFormat format, Map assertionNames) Prints a proof into a string with a slected proof format mode.voidpush()Push a level to the assertion stack.voidpush(int nscopes) Push (a) level(s) to the assertion stack.voidRemove all assertions.voidSet info.voidSet logic.voidSet option.voidsetTerminator(ITerminator terminator) Connect a terminator to this solver, which is called periodically during queries to determine whether the current query should be terminated.Simplify a term or formula based on rewriting.Simplify a term or formula based on rewriting and (optionally) applying substitutions for solved variables.Synthesize n-ary function.Synthesize n-ary function following specified syntactic constraints.toString()Return a string representation of the pointer.protected StringtoString(long pointer) Return a string representation of the specified native pointer.
-
Field Details
-
pointer
protected long pointerThe raw native pointer value.
-
-
Constructor Details
-
Solver
Create solver instance.- Parameters:
tm- The associated term manager.
-
-
Method Details
-
close
public void close()Free the native solver, seedeletePointer().- Specified by:
closein interfaceAutoCloseable
-
toString
Return a string representation of the specified native pointer.Subclasses must implement this method to convert the native pointer into a meaningful string.
- Parameters:
pointer- the native pointer- Returns:
- a string representation of the pointer
-
equals
-
hashCode
public int hashCode()Return a hash code value for this solver. The hash code is derived from the underlying native pointer, which is whatequals(Object)compares, so that instances that are equal have the same hash code. -
getTermManager
Get the associated term manager instance.The returned object refers to the same term manager as the one this solver was created with: closing it releases that term manager and every object derived from it, including this solver, see
TermManager.close().- Returns:
- The term manager.
-
simplify
Simplify a term or formula based on rewriting.- Parameters:
t- The term to simplify.- Returns:
- The simplified term.
- Note:
- This function is experimental and may change in future versions.
-
simplify
Simplify a term or formula based on rewriting and (optionally) applying substitutions for solved variables. If applySubs is true, then for example, if `(= x 0)` was asserted to this solver, this method may replace occurrences of `x` with `0`.- Parameters:
t- The term to simplify.applySubs- Whether to apply substitutions for solved variables.- Returns:
- The simplified term.
- Note:
- This function is experimental and may change in future versions.
-
assertFormula
Assert a formula. SMT-LIB:( assert <term> )- Parameters:
term- The formula to assert.
-
checkSat
Check satisfiability. SMT-LIB:( check-sat )- Returns:
- The result of the satisfiability check.
-
checkSatAssuming
Check satisfiability assuming the given formula. SMT-LIB:( check-sat-assuming ( <prop_literal> ) )- Parameters:
assumption- The formula to assume.- Returns:
- The result of the satisfiability check.
-
checkSatAssuming
Check satisfiability assuming the given formulas. SMT-LIB:( check-sat-assuming ( <prop_literal>+ ) )- Parameters:
assumptions- The formulas to assume.- Returns:
- The result of the satisfiability check.
-
declareDatatype
Create datatype sort. SMT-LIB:( declare-datatype <symbol> <datatype_decl> )- Parameters:
symbol- The name of the datatype sort.ctors- The constructor declarations of the datatype sort.- Returns:
- The datatype sort.
-
declareFun
Declare n-ary function symbol. SMT-LIB:( declare-fun <symbol> ( <sort>* ) <sort> )- Parameters:
symbol- The name of the function.sorts- The sorts of the parameters to this function.sort- The sort of the return value of this function.- Returns:
- The function.
-
declareFun
Declare n-ary function symbol. SMT-LIB:( declare-fun <symbol> ( <sort>* ) <sort> )- Parameters:
symbol- The name of the function.sorts- The sorts of the parameters to this function.sort- The sort of the return value of this function.fresh- If true, then this method always returns a new Term. Otherwise, this method will always return the same Term for each call with the given sorts and symbol where fresh is false.- Returns:
- The function.
-
declareSort
Declare uninterpreted sort. SMT-LIB:( declare-sort <symbol> <numeral> )- Parameters:
symbol- The name of the sort.arity- The arity of the sort.- Returns:
- The sort.
- Throws:
CVC5ApiException- on error- Note:
- This corresponds to
TermManager.mkUninterpretedSort(java.lang.String)if arity = 0, and toTermManager.mkUninterpretedSortConstructorSort(int, java.lang.String)if arity > 0.
-
declareSort
Declare uninterpreted sort. SMT-LIB:( declare-sort <symbol> <numeral> )- Parameters:
symbol- The name of the sort.arity- The arity of the sort.fresh- If true, then this method always returns a new Sort. Otherwise, this method will always return the same Sort for each call with the given arity and symbol where fresh is false.- Returns:
- The sort.
- Throws:
CVC5ApiException- on error- Note:
- This corresponds to
TermManager.mkUninterpretedSort(java.lang.String)if arity = 0, and toTermManager.mkUninterpretedSortConstructorSort(int, java.lang.String)if arity > 0.
-
defineFun
Define n-ary function in the current context. SMT-LIB:( define-fun <function_def> )- Parameters:
symbol- The name of the function.boundVars- The parameters to this function.sort- The sort of the return value of this function.term- The function body.- Returns:
- The function.
-
defineFun
Define n-ary function. SMT-LIB:( define-fun <function_def> )- Parameters:
symbol- The name of the function.boundVars- The parameters to this function.sort- The sort of the return value of this function.term- The function body.global- Determines whether this definition is global (i.e., persists when popping the context).- Returns:
- The function.
-
defineFunRec
Define recursive function in the current context. SMT-LIB:( define-fun-rec <function_def> )- Parameters:
symbol- The name of the function.boundVars- The parameters to this function.sort- The sort of the return value of this function.term- The function body.- Returns:
- The function.
-
defineFunRec
Define recursive function. SMT-LIB:( define-fun-rec <function_def> )- Parameters:
symbol- The name of the function.boundVars- The parameters to this function.sort- The sort of the return value of this function.term- The function body.global- Determines whether this definition is global (i.e., persists when popping the context).- Returns:
- The function.
-
defineFunRec
Define recursive function in the current context. SMT-LIB:( define-fun-rec <function_def> )Create parameterfunwithTermManager.mkConst(Sort).- Parameters:
fun- The sorted function.boundVars- The parameters to this function.term- The function body.- Returns:
- The function.
-
defineFunRec
Define recursive function. SMT-LIB:( define-fun-rec <function_def> )Create parameterfunwithTermManager.mkConst(Sort).- Parameters:
fun- The sorted function.boundVars- The parameters to this function.term- The function body.global- Determines whether this definition is global (i.e., persists when popping the context).- Returns:
- The function.
-
defineFunsRec
Define recursive functions in the current context. SMT-LIB:( define-funs-rec ( <function_decl>^{n+1} ) ( <term>^{n+1} ) )Create elements of parameterfunswithTermManager.mkConst(Sort).- Parameters:
funs- The sorted functions.boundVars- The list of parameters to the functions.terms- The list of function bodies of the functions.
-
defineFunsRec
Define recursive functions. SMT-LIB:( define-funs-rec ( <function_decl>^{n+1} ) ( <term>^{n+1} ) )Create elements of parameterfunswithTermManager.mkConst(Sort).- Parameters:
funs- The sorted functions.boundVars- The list of parameters to the functions.terms- The list of function bodies of the functions.global- Determines whether this definition is global (i.e., persists when popping the context).
-
getLearnedLiterals
Get a list of input literals that are entailed by the current set of assertions. SMT-LIB:( get-learned-literals )- Returns:
- The list of learned literals.
- Note:
- This method is experimental and may change in future versions.
-
getLearnedLiterals
Get a list of literals that are entailed by the current set of assertions. SMT-LIB:( get-learned-literals :type )- Parameters:
type- The type of learned literals to return- Returns:
- The list of learned literals.
- Note:
- This method is experimental and may change in future versions.
-
getAssertions
Get the list of asserted formulas. SMT-LIB:( get-assertions )- Returns:
- The list of asserted formulas.
-
getInfo
Get info from the solver. SMT-LIB:( get-info <info_flag> )- Parameters:
flag- Theget-infoflag.- Returns:
- The info.
-
getOption
Get the value of a given option. SMT-LIB:( get-option <keyword> )- Parameters:
option- The option for which the value is queried.- Returns:
- A string representation of the option value.
-
getOptionNames
Get all option names that can be used withsetOption(String, String),getOption(String)andgetOptionInfo(String).- Returns:
- All option names.
-
getOptionInfo
Get some information about the given option. Check theOptionInfoclass for more details on which information is available.- Parameters:
option- The name of the option.- Returns:
- Information about the given option.
-
getUnsatAssumptions
Get the set of unsat ("failed") assumptions. SMT-LIB:( get-unsat-assumptions )Requires to enable optionproduce-unsat-assumptions.- Returns:
- The set of unsat assumptions.
-
getUnsatCore
Get the unsatisfiable core. SMT-LIB:(get-unsat-core)Requires to enable optionproduce-unsat-cores.- Returns:
- A set of terms representing the unsatisfiable core.
- Note:
- In contrast to SMT-LIB, cvc5's API does not distinguish between named and unnamed assertions when producing an unsatisfiable core. Additionally, the API allows this option to be called after a check with assumptions. A subset of those assumptions may be included in the unsatisfiable core returned by this method.
-
getUnsatCoreLemmas
Get the lemmas used to derive unsatisfiability. SMT-LIB:(get-unsat-core-lemmas)Requires the SAT proof unsat core mode, so to enable optionunsat-core-mode=sat-proof- Returns:
- A set of terms representing the lemmas used to derive unsatisfiability.
- Note:
- This method is experimental and may change in future versions.
-
getDifficulty
Get a difficulty estimate for an asserted formula. This method is intended to be called immediately after any response to a checkSat.- Returns:
- A map from (a subset of) the input assertions to a real value that. is an estimate of how difficult each assertion was to solve. Unmentioned assertions can be assumed to have zero difficulty.
- Note:
- This method is experimental and may change in future versions.
-
getTimeoutCore
Get a timeout core, which computes a subset of the current assertions that cause a timeout. Note it does not require being proceeded by a call to checkSat. SMT-LIB:(get-timeout-core)- Returns:
- The result of the timeout core computation. This is a pair
containing a result and a list of formulas. If the result is unknown
and the reason is timeout, then the list of formulas correspond to a
subset of the current assertions that cause a timeout in the specified
time
timeout-core-timeout. If the result is unsat, then the list of formulas correspond to an unsat core for the current assertions. If the computation was terminated by the connected terminator, the result is unknown with explanationUnknownExplanation.INTERRUPTED, and the list of formulas is empty. Otherwise, the result is sat, indicating that the current assertions are satisfiable, and the list of formulas is empty. This method may make multiple checks for satisfiability internally, each limited by the timeout value given bytimeout-core-timeout. - Note:
- This method is experimental and may change in future versions.
-
getTimeoutCoreAssuming
Get a timeout core, which computes a subset of the given assumptions that cause a timeout when added to the current assertions. Note it does not require being proceeded by a call to checkSat. SMT-LIB:(get-timeout-core)- Parameters:
assumptions- The formulas to assume.- Returns:
- The result of the timeout core computation. This is a pair
containing a result and a list of formulas. If the result is unknown
and the reason is timeout, then the list of formulas correspond to a
subset of assumptions that cause a timeout when added to the current
assertions in the specified time
timeout-core-timeout. If the result is unsat, then the list of formulas plus the current assertions correspond to an unsat core for the current assertions. If the computation was terminated by the connected terminator, the result is unknown with explanationUnknownExplanation.INTERRUPTED, and the list of formulas is empty. Otherwise, the result is sat, indicating that the given assumptions plus the current assertions are satisfiable, and the list of formulas is empty. This method may make multiple checks for satisfiability internally, each limited by the timeout value given bytimeout-core-timeout. - Note:
- This method is experimental and may change in future versions.
-
getProof
Get refutation proof for the most recent call to checkSat. SMT-LIB:( get-proof )Requires to enable optionproduce-proofs.- Returns:
- A vector of proof nodes. This is equivalent to getProof when c is FULL.
- Note:
- This method is experimental and may change in future versions.
-
getProof
Get a proof associated with the most recent call to checkSat. SMT-LIB:( get-proof :c)Requires to enable optionproduce-proofs.- Parameters:
c- The component of the proof to return- Returns:
- A vector of proof nodes.
- Note:
- This method is experimental and may change in future versions.
-
proofToString
Prints a proof into a string with a slected proof format mode. Other aspects of printing are taken from the solver options.- Parameters:
proof- A proof.- Returns:
- The proof printed in the current format.
- Note:
- This method is experimental and may change in future versions.
-
proofToString
Prints a proof into a string with a slected proof format mode. Other aspects of printing are taken from the solver options.- Parameters:
proof- A proof.format- The proof format used to print the proof. Must be `PROOF_FORMAT_NONE` if the proof is from a component other than `PROOF_COMPONENT_FULL`.- Returns:
- The proof printed in the current format.
- Note:
- This method is experimental and may change in future versions.
-
proofToString
Prints a proof into a string with a slected proof format mode. Other aspects of printing are taken from the solver options.- Parameters:
proof- A proof.format- The proof format used to print the proof. Must be `PROOF_FORMAT_NONE` if the proof is from a component other than `PROOF_COMPONENT_FULL`.assertionNames- Mapping between assertions and names, if they were given by the user. This is used by the Alethe proof format.- Returns:
- The proof printed in the current format.
- Note:
- This method is experimental and may change in future versions.
-
getValue
Get the value of the given term in the current model. SMT-LIB:( get-value ( <term> ) )- Parameters:
term- The term for which the value is queried.- Returns:
- The value of the given term.
-
getValue
Get the values of the given terms in the current model. SMT-LIB:( get-value ( <term>+ ) )- Parameters:
terms- The terms for which the value is queried.- Returns:
- The values of the given terms.
-
getModelDomainElements
Get the domain elements of uninterpreted sort s in the current model. The current model interpretssas the finite sort whose domain elements are given in the return value of this method.- Parameters:
s- The uninterpreted sort in question.- Returns:
- The domain elements of
sin the current model.
-
isModelCoreSymbol
This returns false if the model value of free constantvwas not essential for showing the satisfiability of the last call tocheckSat()using the current model. This method will only return false (for anyv) if the optionmodel-coreshas been set.- Parameters:
v- The term in question.- Returns:
- True if v is a model core symbol.
- Note:
- This method is experimental and may change in future versions.
-
getModel
Get the model SMT-LIB:( get-model )Requires to enable optionproduce-models.- Parameters:
sorts- The list of uninterpreted sorts that should be printed in the. model.vars- The list of free constants that should be printed in the. model. A subset of these may be printed based onisModelCoreSymbol(Term).- Returns:
- A string representing the model.
- Note:
- This method is experimental and may change in future versions.
-
getQuantifierElimination
Do quantifier elimination. SMT-LIB:( get-qe <q> )Quantifier Elimination is only complete for logics such as LRA, LIA and BV. The formulaqmust not contain free variables, i.e., variables constructed viaTermManager.mkVar(Sort)that are not bound by a quantifier inq. The symbolsy1...ynshould be free constants constructed viaTermManager.mkConst(Sort). An exception is thrown ifqcontains free variables.- Parameters:
q- A quantified formula of the form:Q x1...xn. P( x1...xn, y1...yn )whereP( x1...xn, y1...yn )is a quantifier-free formula.- Returns:
- A formula
retsuch that, given the current set of formulasAasserted to this solver: -( A && q )and( A && ret )are equivalent -retis quantifier-free formula containing only free constants iny1...yn. - Note:
- This method is experimental and may change in future versions.
-
getQuantifierEliminationDisjunct
Do partial quantifier elimination, which can be used for incrementally computing the result of a quantifier elimination. SMT-LIB:( get-qe-disjunct <q> )Quantifier Elimination is only complete for logics such as LRA, LIA and BV. The formulaqmust not contain free variables, i.e., variables constructed viaTermManager.mkVar(Sort)that are not bound by a quantifier inq. The symbolsy1...ynshould be free constants constructed viaTermManager.mkConst(Sort). An exception is thrown ifqcontains free variables.- Parameters:
q- A quantified formula of the form:Q x1...xn. P( x1...xn, y1...yn )whereP( x1...xn, y1...yn )is a quantifier-free formula.- Returns:
- A formula ret such that, given the current set of formulas A
asserted to this solver:
-
(A ^ q) => (A ^ ret)ifQis forall or(A ^ ret) => (A ^ q)ifQis exists, - ret is quantifier-free formula containing only free constants iny1...yn, - If Q is exists, letA && Q_nbe the formulaA && ~(ret && Q_1) && ... && ~(ret && Q_n)where for eachi=1,...n, formularet && Q_iis the result of callinggetQuantifierEliminationDisjunct(Term)forqwith the set of assertionsA && Q_{i-1}. Similarly, ifQis forall, then letA && Q_nbeA && (ret && Q_1) && ... && (ret&& Q_n)whereret && Q_iis the same as above. In either case, we have thatret && Q_jwill eventually be true or false, for some finitej. - Note:
- This method is experimental and may change in future versions.
-
declareSepHeap
When using separation logic, this sets the location sort and the datatype sort to the given ones. This method should be invoked exactly once, before any separation logic constraints are provided.- Parameters:
locSort- The location sort of the heap.dataSort- The data sort of the heap.- Note:
- This method is experimental and may change in future versions.
-
getValueSepHeap
When using separation logic, obtain the term for the heap.- Returns:
- The term for the heap.
- Note:
- This method is experimental and may change in future versions.
-
getValueSepNil
When using separation logic, obtain the term for nil.- Returns:
- The term for nil.
- Note:
- This method is experimental and may change in future versions.
-
declarePool
Declare a symbolic pool of terms with the given initial value. SMT-LIB:( declare-pool <symbol> <sort> ( <term>* ) )- Parameters:
symbol- The name of the pool.sort- The sort of the elements of the pool.initValue- The initial value of the pool.- Returns:
- The pool.
- Note:
- This method is experimental and may change in future versions.
-
declareOracleFun
Declare an oracle function with reference to an implementation. Oracle functions have a different semantics with respect to ordinary declared functions. In particular, for an input to be satisfiable, its oracle functions are implicitly universally quantified. This method is used in part for implementing this command:(declare-oracle-fun <sym> (<sort>*) <sort> <sym>)In particular, the above command is implemented by constructing a function over terms that wraps a call to binary sym via a text interface.- Parameters:
symbol- The name of the oraclesorts- The sorts of the parameters to this functionsort- The sort of the return value of this functionoracle- An object that implements the oracle interface.- Returns:
- The oracle function
- Note:
- This method is experimental and may change in future versions.
-
addPlugin
Add plugin to this solver. Its callbacks will be called throughout the lifetime of this solver.- Parameters:
p- The plugin to add to this solver.
-
setTerminator
Connect a terminator to this solver, which is called periodically during queries to determine whether the current query should be terminated. SeeITerminatorfor details.Only one terminator can be connected at a time, connecting a terminator disconnects the previously connected terminator.
- Parameters:
terminator- The terminator to connect, or null to disconnect the currently connected terminator.- Note:
- This method is experimental and may change in future versions.
-
pop
Pop a level from the assertion stack. SMT-LIB:( pop <numeral> )- Throws:
CVC5ApiException- on error
-
pop
Pop (a) level(s) from the assertion stack. SMT-LIB:( pop <numeral> )- Parameters:
nscopes- The number of levels to pop.- Throws:
CVC5ApiException- on error
-
getInterpolant
Get an interpolant.Given that
SMT-LIB:A->Bis valid, this function determines a termIover the shared variables ofAandB, such thatA->IandI->Bare valid.Ais the current set of assertions andBis the conjecture, given asconj.( get-interpolant <symbol> <conj> )- Parameters:
conj- The conjecture term.- Returns:
- The interpolant, if an interpolant exists, else the null term.
- Note:
- In SMT-LIB,
<symbol>assigns a symbol to the interpolant., Requires optionproduce-interpolantsto be set to a mode different fromnone., This method is experimental and may change in future versions.
-
getInterpolant
Get an interpolant.Given that
SMT-LIB:A->Bis valid, this function determines a termI, over the shared variables ofAandB, with respect to a given grammar, such thatA->IandI->Bare valid, if such a term exits.Ais the current set of assertions andBis the conjecture, given asconj.( get-interpolant <symbol> <conj> <g> )- Parameters:
conj- The conjecture term.grammar- The grammar for the interpolantI.- Returns:
- The interpolant, if an interpolant exists, else the null term.
- Note:
- In SMT-LIB,
<symbol>assigns a symbol to the interpolant., Requires optionproduce-interpolantsto be set to a mode different fromnone., This method is experimental and may change in future versions.
-
getInterpolantNext
Get the next interpolant. Can only be called immediately after a successful call toget-interpolantorget-interpolant-next. Is guaranteed to produce a syntactically different interpolant wrt the last returned interpolant if successful. SMT-LIB:(get-interpolant-next)Requires to enable incremental mode, and optionproduce-interpolantsto be set to a mode different fromnone.- Returns:
- A Term I such that
A->IandI->Bare valid, whereAis the current set of assertions andBis given in the input by conj on the last call to getInterpolant, or the null term if such a term cannot be found. - Note:
- This method is experimental and may change in future versions.
-
getAbduct
Get an abduct. SMT-LIB:( get-abduct <conj> )Requires enabling optionproduce-abducts.- Parameters:
conj- The conjecture term.- Returns:
- A term
Csuch thatA && Cis satisfiable, andA && ~B && Cis unsatisfiable, whereAis the current set of assertions andBis given in the input byconj, or the null term if such a term cannot be found. - Note:
- This method is experimental and may change in future versions.
-
getAbduct
Get an abduct. SMT-LIB:( get-abduct <conj> <g> )Requires enabling optionproduce-abducts.- Parameters:
conj- The conjecture term.grammar- The grammar for the abductC.- Returns:
- A term
Csuch thatA && Cis satisfiable, andA && ~B && Cis unsatisfiable, whereAis the current set of assertions andBis given in the input byconj, or the null term if such a term cannot be found. - Note:
- This method is experimental and may change in future versions.
-
getAbductNext
Get the next abduct. Can only be called immediately after a successful call to get-abduct or get-abduct-next. Is guaranteed to produce a syntactically different abduct wrt the last returned abduct if successful. SMT-LIB:( get-abduct-next )Requires enabling incremental mode and optionproduce-abducts.- Returns:
- A term C such that A^C is satisfiable, and A^~B^C is. unsatisfiable, where A is the current set of assertions and B is given in the input by conj in the last call to getAbduct, or the null term if such a term cannot be found.
- Note:
- This method is experimental and may change in future versions.
-
blockModel
Block the current model. Can be called only if immediately preceded by a SAT or INVALID query. SMT-LIB:( block-model )Requires enabling optionproduce-models.- Parameters:
mode- The mode to use for blocking.- Note:
- This method is experimental and may change in future versions.
-
blockModelValues
Block the current model values of (at least) the values in terms. Can be called only if immediately preceded by a SAT query. SMT-LIB:( block-model-values ( <terms>+ ) )Requires enabling optionproduce-models.- Parameters:
terms- The model values to block.- Note:
- This method is experimental and may change in future versions.
-
getInstantiations
Get a string that contains information about all instantiations made by the quantifiers module.- Returns:
- The string representing the information about all instantiations.
- Note:
- This method is experimental and may change in future versions.
-
push
Push a level to the assertion stack. SMT-LIB:( push <numeral> )- Throws:
CVC5ApiException- on error
-
push
Push (a) level(s) to the assertion stack. SMT-LIB:( push <numeral> )- Parameters:
nscopes- The number of levels to push.- Throws:
CVC5ApiException- on error
-
resetAssertions
public void resetAssertions()Remove all assertions. SMT-LIB:( reset-assertions ) -
setInfo
Set info. SMT-LIB:( set-info <attribute> )- Parameters:
keyword- The info flag.value- The value of the info flag.- Throws:
CVC5ApiException- on error
-
setLogic
Set logic. SMT-LIB:( set-logic <symbol> )- Parameters:
logic- The logic to set.- Throws:
CVC5ApiException- on error
-
isLogicSet
public boolean isLogicSet()Is logic set? Returns whether we called setLogic yet for this solver.- Returns:
- whether we called setLogic yet for this solver.
-
getLogic
Get the logic set the solver.- Returns:
- The logic used by the solver.
- Throws:
CVC5ApiException- on error- Note:
- Asserts isLogicSet().
-
setOption
Set option. SMT-LIB:( set-option <option> )- Parameters:
option- The option name.value- The option value.
-
declareSygusVar
Appendsymbolto the current list of universal variables. SyGuS v2:( declare-var <symbol> <sort> )- Parameters:
symbol- The name of the universal variable.sort- The sort of the universal variable.- Returns:
- The universal variable.
-
synthFun
Synthesize n-ary function. SyGuS v2:( synth-fun <symbol> ( <boundVars>* ) <sort> )- Parameters:
symbol- The name of the function.boundVars- The parameters to this function.sort- The sort of the return value of this function.- Returns:
- The function.
-
synthFun
Synthesize n-ary function following specified syntactic constraints. SyGuS v2:( synth-fun <symbol> ( <boundVars>* ) <sort> <g> )- Parameters:
symbol- The name of the function.boundVars- The parameters to this function.sort- The sort of the return value of this function.grammar- The syntactic constraints.- Returns:
- The function.
-
addSygusConstraint
Add a forumla to the set of Sygus constraints. SyGuS v2:( constraint <term> )- Parameters:
term- The formula to add as a constraint.
-
getSygusConstraints
Get the list of sygus constraints.- Returns:
- The list of sygus constraints.
-
addSygusAssume
Add a forumla to the set of Sygus assumptions. SyGuS v2:( assume <term> )- Parameters:
term- The formula to add as an assumption.
-
getSygusAssumptions
Get the list of sygus assumptions.- Returns:
- The list of sygus assumptions.
-
addSygusInvConstraint
Add a set of Sygus constraints to the current state that correspond to an invariant synthesis problem. SyGuS v2:( inv-constraint <inv> <pre> <trans> <post> )- Parameters:
inv- The function-to-synthesize.pre- The pre-condition.trans- The transition relation.post- The post-condition.
-
checkSynth
Try to find a solution for the synthesis conjecture corresponding to the current list of functions-to-synthesize, universal variables and constraints. SyGuS v2:( check-synth )- Returns:
- The result of the check, which is "solution" if the check found a. solution in which case solutions are available via getSynthSolutions, "no solution" if it was determined there is no solution, or "unknown" otherwise.
-
checkSynthNext
Try to find a next solution for the synthesis conjecture corresponding to the current list of functions-to-synthesize, universal variables and constraints. Must be called immediately after a successful call tocheck-synthorcheck-synth-next.- Returns:
- The result of the check, which is "solution" if the check found a solution in which case solutions are available via getSynthSolutions, "no solution" if it was determined there is no solution, or "unknown" otherwise.
- Note:
- Requires incremental mode.
SyGuS v2:
( check-synth-next )
-
getSynthSolution
Get the synthesis solution of the given term. This method should be called immediately after the solver answers unsat for sygus input.- Parameters:
term- The term for which the synthesis solution is queried.- Returns:
- The synthesis solution of the given term.
-
getSynthSolutions
Get the synthesis solutions of the given terms. This method should be called immediately after the solver answers unsat for sygus input.- Parameters:
terms- The terms for which the synthesis solutions is queried.- Returns:
- The synthesis solutions of the given terms.
-
findSynth
Find a target term of interest using sygus enumeration, with no provided grammar. The solver will infer which grammar to use in this call, which by default will be the grammars specified by the function(s)-to-synthesize in the current context. SyGuS v2:(find-synth :target)- Parameters:
fst- The identifier specifying what kind of term to find- Returns:
- The result of the find, which is the null term if this call failed.
- Note:
- This method is experimental and may change in future versions.
-
findSynth
Find a target term of interest using sygus enumeration with a provided grammar. SyGuS v2:(find-synth :target G)- Parameters:
fst- The identifier specifying what kind of term to findgrammar- The grammar for the term- Returns:
- The result of the find, which is the null term if this call failed.
- Note:
- This method is experimental and may change in future versions.
-
findSynthNext
Try to find a next target term of interest using sygus enumeration. Must be called immediately after a successful call to find-synth or find-synth-next. SyGuS v2:(find-synth-next)- Returns:
- The result of the find, which is the null term if this call failed.
- Note:
- This method is experimental and may change in future versions.
-
getStatistics
Get a snapshot of the current state of the statistic values of this solver. The returned object will not change when the solver is used again. Like every object derived from a term manager, it is released when that term manager is closed, seeTermManager.close().- Returns:
- A snapshot of the current state of the statistic values.
-
getVersion
Get a string representation of the version of this solver.- Returns:
- The version string.
-
getPointer
public long getPointer()Return the raw native pointer.Every native call obtains the pointers of the objects it uses through this method, so that using an object after its native resource has been released raises an exception instead of crashing the JVM.
- Returns:
- the pointer value
- Throws:
IllegalStateException- if the native resource of this object has been released, e.g., viadeletePointer()
-
deletePointer
public void deletePointer()Free the native resource associated with this pointer.Native resources are freed automatically once the Java object is no longer reachable. This method frees the native resource immediately instead; afterwards, using the object raises an
IllegalStateException. It must be called from the thread that is using the associated term manager. Calling it more than once has no further effect. -
toString
Return a string representation of the pointer.
-