API reference

Solver

A solver holds assertions, options, and a logic. It answers satisfiability queries and gives models, unsat cores, interpolants, abducts, quantifier elimination, synthesis, and proofs. The results and proofs it returns stay valid after the solver is destroyed; see ownership and errors.

getOptionInfo returns an OptionInfo. Its fields are the keys of the dict that Python returns: name, aliases, setByUser, category, type, current, default, minimum, maximum, and modes. It prints as Python prints the dict. See the base API.

Solver

A cvc5 solver.

Wrapper class for Solver.

69 of the 69 mirrored methods of Solver are generated.

Method Summary Binding Mojo
getTermManager Get the associated term manager instance. override ✓
mkSkolem Create a skolem. alias ✓
getNumIndicesForSkolemId Get the number of indices for a skolem id. alias ✓
simplify Simplify a term or formula based on rewriting and (optionally) applying substitutions for solved variables. auto ✓
assertFormula Assert a formula auto ✓
checkSat Check satisfiability. auto ✓
mkGrammar Create a SyGuS grammar. auto ✓
declareSygusVar Append symbol to the current list of universal variables. auto ✓
addSygusConstraint Add a formula to the set of SyGuS constraints. auto ✓
getSygusConstraints Get the list of sygus constraints. auto ✓
addSygusAssume Add a formula to the set of Sygus assumptions. auto ✓
getSygusAssumptions Get the list of sygus assumptions. auto ✓
addSygusInvConstraint Add a set of SyGuS constraints to the current state that correspond to an invariant synthesis problem. auto ✓
synthFun Synthesize n-ary function following specified syntactic constraints. overloaded ✓
checkSynth Try to find a solution for the synthesis conjecture corresponding to the current list of functions-to-synthesize, universal variables and constraints. auto ✓
checkSynthNext Try to find a next solution for the synthesis conjecture corresponding to the current list of functions-to-synthesize, universal variables and constraints. auto ✓
getSynthSolution Get the synthesis solution of the given term. auto ✓
getSynthSolutions Get the synthesis solutions of the given terms. auto ✓
findSynth Find a target term of interest using sygus enumeration with a provided grammar. overloaded ✓
findSynthNext Try to find a next solution for the synthesis conjecture corresponding to the current list of functions-to-synthesize, universal variables and constraints. auto ✓
checkSatAssuming Check satisfiability assuming the given formula. auto ✓
declareDatatype Create datatype sort. auto ✓
declareFun Declare n-ary function symbol. auto ✓
declareSort Declare uninterpreted sort. auto ✓
defineFun Define n-ary function. auto ✓
defineFunRec Define recursive functions. overloaded ✓
defineFunsRec Define recursive functions. auto ✓
getProof Get a proof associated with the most recent call to checkSat. auto ✓
proofToString Prints proof into a string with a selected proof format mode. auto ✓
getLearnedLiterals Get a list of literals that are entailed by the current set of assertions auto ✓
getAssertions Get the list of asserted formulas. auto ✓
getInfo Get info from the solver. auto ✓
getOption Get the value of a given option. auto ✓
getOptionNames Get all option names that can be used with Solver.setOption(), Solver.getOption() and Solver.getOptionInfo(). auto ✓
getOptionInfo Get some information about the given option. manual ✓
getUnsatAssumptions Get the set of unsat ("failed") assumptions. auto ✓
getUnsatCore Get the unsatisfiable core. auto ✓
getUnsatCoreLemmas Get the lemmas used to derive unsatisfiability. auto ✓
getDifficulty Get a difficulty estimate for an asserted formula. auto ✓
getTimeoutCore Get a timeout core, which computes a subset of the current assertions that cause a timeout. auto ✓
getTimeoutCoreAssuming Get a timeout core, which computes a subset of the given assumptions that cause a timeout when added to the current assertions. auto ✓
getValue Get the value of the given term or list of terms in the current model. overloaded ✓
getModelDomainElements Get the domain elements of uninterpreted sort s in the current model. auto ✓
isModelCoreSymbol This returns False if the model value of free constant v was not essential for showing the satisfiability of the last call to checkSat using the current model. auto ✓
getQuantifierElimination Do quantifier elimination. auto ✓
getQuantifierEliminationDisjunct Do partial quantifier elimination, which can be used for incrementally computing the result of a quantifier elimination. auto ✓
getModel Get the model auto ✓
getValueSepHeap When using separation logic, obtain the term for the heap. auto ✓
getValueSepNil When using separation logic, obtain the term for nil. auto ✓
declareSepHeap When using separation logic, this sets the location sort and the datatype sort to the given ones. auto ✓
declarePool Declare a symbolic pool of terms with the given initial value. auto ✓
addPlugin Add plugin to this solver. manual ✓
pop Pop nscopes level(s) from the assertion stack. auto ✓
push Push nscopes level(s) to the assertion stack. auto ✓
resetAssertions Remove all assertions. auto ✓
setInfo Set info. auto ✓
setLogic Set logic. auto ✓
isLogicSet Is logic set? auto ✓
getLogic Get the logic set the solver. auto ✓
setOption Set option. auto ✓
getInterpolant Get an interpolant. overloaded ✓
getInterpolantNext Get the next interpolant. auto ✓
getAbduct Get an abduct. overloaded ✓
getAbductNext Get the next abduct. auto ✓
blockModel Block the current model. auto ✓
blockModelValues Block the current model values of (at least) the values in terms. auto ✓
getInstantiations Return a string that contains information about all instantiations made by the quantifiers module. auto ✓
getStatistics Return a snapshot of the current state of the statistic values of this solver. auto ✓
getVersion Return a string representation of the version of this solver. auto ✓

Solver.getTermManager

Mojo declaration:

def getTermManager(self) raises -> TermManager

Upstream Python signature:

Solver.getTermManager()

Get the associated term manager instance.

Returns

The term manager instance.

Binding: Bound to cvc5_get_tm by bindgen/overrides.toml.

Solver.mkSkolem

Mojo declaration:

def mkSkolem(self, id: SkolemId, *indices: Term) raises -> Term
def mkSkolem(self, id: SkolemId, indices: List[Term]) raises -> Term

Upstream Python signature:

Solver.mkSkolem(id, *indices)

Create a skolem.

Parameters

  • id: The skolem id.
  • indices: The indices for the skolem.

Returns

The skolem with the given id and indices.

Binding: Same as TermManager.mkSkolem.

Solver.getNumIndicesForSkolemId

Mojo declaration:

def getNumIndicesForSkolemId(self, id: SkolemId) raises -> Int

Upstream Python signature:

Solver.getNumIndicesForSkolemId(id)

Get the number of indices for a skolem id.

Parameters

  • id: The skolem id.

Returns

The number of indice for a skolem with the given id.

Binding: Same as TermManager.getNumIndicesForSkolemId.

Solver.simplify

Mojo declaration:

def simplify(self, t: Term, applySubs: Bool = False) raises -> Term

Upstream Python signature:

Solver.simplify(t: Term, applySubs = False)

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.

Warning

This function is experimental and may change in future versions.

Parameters

  • t: The term to simplify.
  • applySubs: Whether to apply substitutions for solved variables.

Returns

The simplified term.

Binding: Generated from cvc5_simplify.

Solver.assertFormula

Mojo declaration:

def assertFormula(self, term: Term) raises

Upstream Python signature:

Solver.assertFormula(term: Term)

Assert a formula

SMT-LIB:

( assert <term> )

Parameters

  • term: The formula to assert.

Binding: Generated from cvc5_assert_formula.

Solver.checkSat

Mojo declaration:

def checkSat(self) raises -> Result

Upstream Python signature:

Solver.checkSat()

Check satisfiability.

SMT-LIB:

( check-sat )

Returns

The result of the satisfiability check.

Binding: Generated from cvc5_check_sat.

Solver.mkGrammar

Mojo declaration:

def mkGrammar(self, boundVars: List[Term], ntSymbols: List[Term]) raises -> Grammar

Upstream Python signature:

Solver.mkGrammar(boundVars, ntSymbols)

Create a SyGuS grammar. The first non-terminal is treated as the starting non-terminal, so the order of non-terminals matters.

Parameters

  • boundVars: The parameters to corresponding synth-fun/synth-inv.
  • ntSymbols: The pre-declaration of the non-terminal symbols.

Returns

The grammar.

Binding: Generated from cvc5_mk_grammar.

Solver.declareSygusVar

Mojo declaration:

def declareSygusVar(self, symbol: String, sort: Sort) raises -> Term

Upstream Python signature:

Solver.declareSygusVar(symbol: str, sort: Sort)

Append symbol to the current list of universal variables.

SyGuS v2:

( declare-var <symbol> <sort> )

Parameters

  • sort: The sort of the universal variable.
  • symbol: The name of the universal variable.

Returns

The universal variable.

Binding: Generated from cvc5_declare_sygus_var.

Solver.addSygusConstraint

Mojo declaration:

def addSygusConstraint(self, t: Term) raises

Upstream Python signature:

Solver.addSygusConstraint(t: Term)

Add a formula to the set of SyGuS constraints.

SyGuS v2:

( constraint <term> )

Parameters

  • term: The formula to add as a constraint.

Binding: Generated from cvc5_add_sygus_constraint.

Solver.getSygusConstraints

Mojo declaration:

def getSygusConstraints(self) raises -> List[Term]

Upstream Python signature:

Solver.getSygusConstraints()

Get the list of sygus constraints.

Returns

The list of sygus constraints.

Binding: Generated from cvc5_get_sygus_constraints.

Solver.addSygusAssume

Mojo declaration:

def addSygusAssume(self, t: Term) raises

Upstream Python signature:

Solver.addSygusAssume(t: Term)

Add a formula to the set of Sygus assumptions.

SyGuS v2:

( assume <term> )

Parameters

  • term: The formuula to add as an assumption.

Binding: Generated from cvc5_add_sygus_assume.

Solver.getSygusAssumptions

Mojo declaration:

def getSygusAssumptions(self) raises -> List[Term]

Upstream Python signature:

Solver.getSygusAssumptions()

Get the list of sygus assumptions.

Returns

The list of sygus assumptions.

Binding: Generated from cvc5_get_sygus_assumptions.

Solver.addSygusInvConstraint

Mojo declaration:

def addSygusInvConstraint(self, inv_f: Term, pre_f: Term, trans_f: Term, post_f: Term) raises

Upstream Python signature:

Solver.addSygusInvConstraint(inv_f: Term, pre_f: Term, trans_f: Term, post_f: Term)

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.

Binding: Generated from cvc5_add_sygus_inv_constraint.

Solver.synthFun

Mojo declaration:

def synthFun(self, symbol: String, bound_vars: List[Term], sort: Sort) raises -> Term
def synthFun(self, symbol: String, bound_vars: List[Term], sort: Sort, grammar: Grammar) raises -> Term

Upstream Python signature:

Solver.synthFun(symbol: str, bound_vars, sort: Sort, grammar: Grammar = None)

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.

Binding: Generated as overloads from cvc5_synth_fun, cvc5_synth_fun_with_grammar.

Solver.checkSynth

Mojo declaration:

def checkSynth(self) raises -> SynthResult

Upstream Python signature:

Solver.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.

Binding: Generated from cvc5_check_synth.

Solver.checkSynthNext

Mojo declaration:

def checkSynthNext(self) raises -> SynthResult

Upstream Python signature:

Solver.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 to check-synth or check-synth-next. Requires incremental mode.

SyGuS v2:

( check-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.

Binding: Generated from cvc5_check_synth_next.

Solver.getSynthSolution

Mojo declaration:

def getSynthSolution(self, term: Term) raises -> Term

Upstream Python signature:

Solver.getSynthSolution(term: Term)

Get the synthesis solution of the given term. This function 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.

Binding: Generated from cvc5_get_synth_solution.

Solver.getSynthSolutions

Mojo declaration:

def getSynthSolutions(self, terms: List[Term]) raises -> List[Term]

Upstream Python signature:

Solver.getSynthSolutions(terms: list)

Get the synthesis solutions of the given terms. This function 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.

Binding: Generated from cvc5_get_synth_solutions.

Solver.findSynth

Mojo declaration:

def findSynth(self, fst: FindSynthTarget) raises -> Term
def findSynth(self, fst: FindSynthTarget, grammar: Grammar) raises -> Term

Upstream Python signature:

Solver.findSynth(fst, grammar: Grammar = None)

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 find.
  • grammar: The grammar for the term.

Returns

The result of the find, which is the null term if this call failed.

Binding: Generated as overloads from cvc5_find_synth, cvc5_find_synth_with_grammar.

Solver.findSynthNext

Mojo declaration:

def findSynthNext(self) raises -> Term

Upstream Python signature:

Solver.findSynthNext()

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 to check-synth or check-synth-next. Requires incremental mode.

SyGuS v2:

( find-synth-next )

Returns

The result of the find, which is the null term if this call failed.

Binding: Generated from cvc5_find_synth_next.

Solver.checkSatAssuming

Mojo declaration:

def checkSatAssuming(self, *assumptions: Term) raises -> Result
def checkSatAssuming(self, assumptions: List[Term]) raises -> Result

Upstream Python signature:

Solver.checkSatAssuming(*assumptions)

Check satisfiability assuming the given formula.

SMT-LIB:

( check-sat-assuming ( <prop_literal> ) )

Parameters

  • assumptions: The formulas to assume.

Returns

The result of the satisfiability check.

Binding: Generated from cvc5_check_sat_assuming.

Solver.declareDatatype

Mojo declaration:

def declareDatatype(self, symbol: String, *ctors: DatatypeConstructorDecl) raises -> Sort
def declareDatatype(self, symbol: String, ctors: List[DatatypeConstructorDecl]) raises -> Sort

Upstream Python signature:

Solver.declareDatatype(symbol: str, *ctors)

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.

Binding: Generated from cvc5_declare_dt.

Solver.declareFun

Mojo declaration:

def declareFun(self, symbol: String, sorts: List[Sort], sort: Sort, fresh: Bool = True) raises -> Term

Upstream Python signature:

Solver.declareFun(symbol: str, sorts: list, sort: Sort, fresh = True)

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.

Binding: Generated from cvc5_declare_fun.

Solver.declareSort

Mojo declaration:

def declareSort(self, symbol: String, arity: Int, fresh: Bool = True) raises -> Sort
def declareSort(self, symbol: String, arity: IntLiteral, fresh: Bool = True) raises -> Sort

Upstream Python signature:

Solver.declareSort(symbol: str, arity: int, fresh = True)

Declare uninterpreted sort.

SMT-LIB:

( declare-sort <symbol> <numeral> )

Note

This corresponds to TermManager.mkUninterpretedSort() if arity = 0, and to TermManager.mkUninterpretedSortConstructorSort() if arity > 0.

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.

Binding: Generated from cvc5_declare_sort.

Solver.defineFun

Mojo declaration:

def defineFun(self, symbol: String, bound_vars: List[Term], sort: Sort, term: Term, glbl: Bool = False) raises -> Term

Upstream Python signature:

Solver.defineFun(symbol: str, bound_vars: list, sort: Sort, term: Term, glbl = False)

Define n-ary function.

SMT-LIB:

( define-fun <function_def> )

Parameters

  • symbol: The name of the function.
  • bound_vars: The parameters to this function.
  • sort: The sort of the return value of this function.
  • term: The function body.
  • glbl: Determines whether this definition is global (i.e. persists when popping the context).

Returns

The function.

Binding: Generated from cvc5_define_fun.

Solver.defineFunRec

Mojo declaration:

def defineFunRec(self, symbol: String, bound_vars: List[Term], sort: Sort, t: Term, glbl: Bool = False) raises -> Term
def defineFunRec(self, fun: Term, bound_vars: List[Term], term: Term, glbl: Bool = False) raises -> Term

Upstream Python signature:

Solver.defineFunRec(sym_or_fun, bound_vars, sort_or_term, t = None, glbl = False)

Define recursive functions.

Supports the following arguments:

  • Term defineFunRec(str symbol, List[Term] bound_vars, Sort sort, Term term, bool glbl)
  • Term defineFunRec(Term fun, List[Term] bound_vars, Term term, bool glbl)

SMT-LIB:

( define-funs-rec ( <function_decl>^n ) ( <term>^n ) )

Create elements of parameter funs with mkConst().

Parameters

  • funs: The sorted functions.
  • bound_vars: 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).

Returns

The function.

Binding: Generated as overloads from cvc5_define_fun_rec, cvc5_define_fun_rec_from_const.

Solver.defineFunsRec

Mojo declaration:

def defineFunsRec(self, funs: List[Term], bound_vars: List[List[Term]], terms: List[Term], glb: Bool = False) raises

Upstream Python signature:

Solver.defineFunsRec(funs, bound_vars, terms, glb = False)

Define recursive functions.

SMT-LIB:

( define-funs-rec ( <function_decl>^n ) ( <term>^n ) )

Create elements of parameter funs with mkConst().

Parameters

  • funs: The sorted functions.
  • bound_vars: The list of parameters to the functions.
  • terms: The list of function bodies of the functions.
  • glb: Determines whether this definition is global (i.e. persists when popping the context).

Binding: Generated from cvc5_define_funs_rec.

Solver.getProof

Mojo declaration:

def getProof(self, c: ProofComponent = ProofComponent.FULL) raises -> List[Proof]

Upstream Python signature:

Solver.getProof(c = ProofComponent.FULL)

Get a proof associated with the most recent call to checkSat.

SMT-LIB:

(get-proof :c)

Requires to enable option produce-proofs.

Warning

This function is experimental and may change in future versions.

Parameters

  • c: The component of the proof to return.

Returns

A vector of proof nodes.

Binding: Generated from cvc5_get_proof.

Solver.proofToString

Mojo declaration:

def proofToString(self, proof: Proof, format: ProofFormat = ProofFormat.DEFAULT, assertionNames: Dict[Term, String] = Dict[Term, String]()) raises -> String

Upstream Python signature:

Solver.proofToString(proof, format = ProofFormat.DEFAULT, assertionNames = {})

Prints proof into a string with a selected proof format mode. Other aspects of printing are taken from the solver options.

Warning

This function is experimental and may change in future versions.

Parameters

  • proof: A proof, usually obtained from getProof().
  • format: The proof format used to print the proof. Must be "None" if the proof is not a full proof.
  • 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.

Binding: Generated from cvc5_proof_to_string.

Solver.getLearnedLiterals

Mojo declaration:

def getLearnedLiterals(self, type_: LearnedLitType = LearnedLitType.INPUT) raises -> List[Term]

Upstream Python signature:

Solver.getLearnedLiterals(type = LearnedLitType.INPUT)

Get a list of literals that are entailed by the current set of assertions

SMT-LIB:

( get-learned-literals )

Warning

This function is experimental and may change in future versions.

Parameters

  • type: The type of learned literals to return

Returns

The list of literals.

Binding: Generated from cvc5_get_learned_literals.

Solver.getAssertions

Mojo declaration:

def getAssertions(self) raises -> List[Term]

Upstream Python signature:

Solver.getAssertions()

Get the list of asserted formulas.

SMT-LIB:

( get-assertions )

Returns

The list of asserted formulas.

Binding: Generated from cvc5_get_assertions.

Solver.getInfo

Mojo declaration:

def getInfo(self, flag: String) raises -> String

Upstream Python signature:

Solver.getInfo(flag: str)

Get info from the solver.

SMT-LIB:

( get-info <info_flag> )

Parameters

  • flag: The info flag.

Returns

The info.

Binding: Generated from cvc5_get_info.

Solver.getOption

Mojo declaration:

def getOption(self, option: String) raises -> String

Upstream Python signature:

Solver.getOption(option: str)

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.

Binding: Generated from cvc5_get_option.

Solver.getOptionNames

Mojo declaration:

def getOptionNames(self) raises -> List[String]

Upstream Python signature:

Solver.getOptionNames()

Get all option names that can be used with Solver.setOption(), Solver.getOption() and Solver.getOptionInfo().

Returns

All option names.

Binding: Generated from cvc5_get_option_names.

Solver.getOptionInfo

Mojo declaration:

def getOptionInfo(self, option: String) raises -> OptionInfo

Upstream Python signature:

Solver.getOptionInfo(option: str)

Get some information about the given option. Returns the information provided by the C++ OptionInfo as a dictionary.

Returns

Information about the given option.

Binding: Hand-written using cvc5_get_option_info.

Solver.getUnsatAssumptions

Mojo declaration:

def getUnsatAssumptions(self) raises -> List[Term]

Upstream Python signature:

Solver.getUnsatAssumptions()

Get the set of unsat ("failed") assumptions.

SMT-LIB:

( get-unsat-assumptions )

Requires to enable option :ref:produce-unsat-assumptions <lbl-option-produce-unsat-assumptions>.

Returns

The set of unsat assumptions.

Binding: Generated from cvc5_get_unsat_assumptions.

Solver.getUnsatCore

Mojo declaration:

def getUnsatCore(self) raises -> List[Term]

Upstream Python signature:

Solver.getUnsatCore()

Get the unsatisfiable core.

SMT-LIB:

(get-unsat-core)

Requires to enable option :ref:produce-unsat-cores <lbl-option-produce-unsat-cores>.

Note

In contrast to SMT-LIB, the 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.

Returns

A set of terms representing the unsatisfiable core.

Binding: Generated from cvc5_get_unsat_core.

Solver.getUnsatCoreLemmas

Mojo declaration:

def getUnsatCoreLemmas(self) raises -> List[Term]

Upstream Python signature:

Solver.getUnsatCoreLemmas()

Get the lemmas used to derive unsatisfiability.

SMT-LIB:

(get-unsat-core-lemmas)

Requires the SAT proof unsat core mode, so to enable option unsat-cores-mode=sat-proof.

Warning

This function is experimental and may change in future versions.

Returns

A set of terms representing the lemmas used to derive unsatisfiability.

Binding: Generated from cvc5_get_unsat_core_lemmas.

Solver.getDifficulty

Mojo declaration:

def getDifficulty(self) raises -> Dict[Term, Term]

Upstream Python signature:

Solver.getDifficulty()

Get a difficulty estimate for an asserted formula. This function is intended to be called immediately after any response to a Solver.checkSat() call.

Warning

This function is experimental and may change in future versions.

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 solver. Unmentioned assertions can be assumed to have zero difficulty.

Binding: Generated from cvc5_get_difficulty.

Solver.getTimeoutCore

Mojo declaration:

def getTimeoutCore(self) raises -> Tuple[Result, List[Term]]

Upstream Python signature:

Solver.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.

This function may make multiple checks for satisfiability internally, each limited by the timeout value given by timeout-core-timeout.

(get-timeout-core)

Warning

This function is experimental and may change in future versions.

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. Otherwise, the result is sat, indicating that the current assertions are satisfiable, and the list of formulas is empty.

Binding: Generated from cvc5_get_timeout_core.

Solver.getTimeoutCoreAssuming

Mojo declaration:

def getTimeoutCoreAssuming(self, *assumptions: Term) raises -> Tuple[Result, List[Term]]
def getTimeoutCoreAssuming(self, assumptions: List[Term]) raises -> Tuple[Result, List[Term]]

Upstream Python signature:

Solver.getTimeoutCoreAssuming(*assumptions)

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.

This function may make multiple checks for satisfiability internally, each limited by the timeout value given by timeout-core-timeout.

(get-timeout-core)

Warning

This function is experimental and may change in future versions.

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. Otherwise, the result is sat, indicating that the given assumptions plus the current assertions are satisfiable, and the list of formulas is empty.

Binding: Generated from cvc5_get_timeout_core_assuming.

Solver.getValue

Mojo declaration:

def getValue(self, term: Term) raises -> Term
def getValue(self, terms: List[Term]) raises -> List[Term]

Upstream Python signature:

Solver.getValue(term_or_list)

Get the value of the given term or list of terms in the current model.

SMT-LIB:

( get-value ( <term>* ) )

Parameters

  • term_or_list: The term or list of terms for which the value is queried.

Returns

The value or list of values of the given term or list of terms.

Binding: Generated as overloads from cvc5_get_value, cvc5_get_values.

Solver.getModelDomainElements

Mojo declaration:

def getModelDomainElements(self, s: Sort) raises -> List[Term]

Upstream Python signature:

Solver.getModelDomainElements(s: Sort)

Get the domain elements of uninterpreted sort s in the current model. The current model interprets s as 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 s in the current model.

Binding: Generated from cvc5_get_model_domain_elements.

Solver.isModelCoreSymbol

Mojo declaration:

def isModelCoreSymbol(self, v: Term) raises -> Bool

Upstream Python signature:

Solver.isModelCoreSymbol(v: Term)

This returns False if the model value of free constant v was not essential for showing the satisfiability of the last call to checkSat using the current model. This function will only return false (for any v) if the model-cores option has been set.

Warning

This function is experimental and may change in future versions.

Parameters

  • v: The term in question.

Returns

True if v is a model core symbol.

Binding: Generated from cvc5_is_model_core_symbol.

Solver.getQuantifierElimination

Mojo declaration:

def getQuantifierElimination(self, term: Term) raises -> Term

Upstream Python signature:

Solver.getQuantifierElimination(term: Term)

Do quantifier elimination.

SMT-LIB:

( get-qe <q> )

Requires a logic that supports quantifier elimination. Currently, the only logics supported by quantifier elimination are LRA and LIA.

Warning

This function is experimental and may change in future versions.

Parameters

  • q: A quantified formula of the form Q\bar{x_1}\dots Q\bar{x}_n. P( x_1 \dots x_i, y_1 \dots y_j) where Q\bar{x} is a set of quantified variables of the form Q x_1...x_k and P( x_1...x_i, y_1...y_j ) is a quantifier-free formula

Returns

A formula \phi such that, given the current set of formulas A asserted to this solver:

  • (A \wedge q) (A \wedge \phi) are equivalent
  • \phi is quantifier-free formula containing only free variables in y_1...y_n.

Binding: Generated from cvc5_get_quantifier_elimination.

Solver.getQuantifierEliminationDisjunct

Mojo declaration:

def getQuantifierEliminationDisjunct(self, term: Term) raises -> Term

Upstream Python signature:

Solver.getQuantifierEliminationDisjunct(term: Term)

Do partial quantifier elimination, which can be used for incrementally computing the result of a quantifier elimination.

SMT-LIB:

( get-qe-disjunct <q> )

Requires a logic that supports quantifier elimination. Currently, the only logics supported by quantifier elimination are LRA and LIA.

Warning

This function is experimental and may change in future versions.

Parameters

  • q: A quantified formula of the form Q\bar{x_1} ... Q\bar{x_n}. P( x_1...x_i, y_1...y_j) where Q\bar{x} is a set of quantified variables of the form Q x_1...x_k and P( x_1...x_i, y_1...y_j ) is a quantifier-free formula.

Returns

A formula \phi such that, given the current set of formulas A asserted to this solver:

  • (A \wedge q \implies A \wedge \phi) if Q is \forall, and (A \wedge \phi \implies A \wedge q) if Q is \exists
  • \phi is quantifier-free formula containing only free variables in y_1...y_n
  • If Q is \exists, let (A \wedge Q_n) be the formula (A \wedge \neg (\phi \wedge Q_1) \wedge ... \wedge \neg (\phi \wedge Q_n)) where for each i = 1...n, formula (\phi \wedge Q_i) is the result of calling getQuantifierEliminationDisjunct() for q with the set of assertions (A \wedge Q_{i-1}). Similarly, if Q is \forall, then let (A \wedge Q_n) be (A \wedge (\phi \wedge Q_1) \wedge ... \wedge (\phi \wedge Q_n)) where (\phi \wedge Q_i) is the same as above. In either case, we have that (\phi \wedge Q_j) will eventually be true or false, for some finite j.

Binding: Generated from cvc5_get_quantifier_elimination_disjunct.

Solver.getModel

Mojo declaration:

def getModel(self, sorts: List[Sort], consts: List[Term]) raises -> String

Upstream Python signature:

Solver.getModel(sorts, consts)

Get the model

SMT-LIB:

(get-model)

Requires to enable option produce-models.

Warning

This function is experimental and may change in future versions.

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 on Solver.isModelCoreSymbol().

Returns

A string representing the model.

Binding: Generated from cvc5_get_model.

Solver.getValueSepHeap

Mojo declaration:

def getValueSepHeap(self) raises -> Term

Upstream Python signature:

Solver.getValueSepHeap()

When using separation logic, obtain the term for the heap.

Warning

This function is experimental and may change in future versions.

Returns

The term for the heap.

Binding: Generated from cvc5_get_value_sep_heap.

Solver.getValueSepNil

Mojo declaration:

def getValueSepNil(self) raises -> Term

Upstream Python signature:

Solver.getValueSepNil()

When using separation logic, obtain the term for nil.

Warning

This function is experimental and may change in future versions.

Returns

The term for nil.

Binding: Generated from cvc5_get_value_sep_nil.

Solver.declareSepHeap

Mojo declaration:

def declareSepHeap(self, locType: Sort, dataType: Sort) raises

Upstream Python signature:

Solver.declareSepHeap(locType: Sort, dataType: Sort)

When using separation logic, this sets the location sort and the datatype sort to the given ones. This function should be invoked exactly once, before any separation logic constraints are provided.

Warning

This function is experimental and may change in future versions.

Parameters

  • locSort: The location sort of the heap.
  • dataSort: The data sort of the heap.

Binding: Generated from cvc5_declare_sep_heap.

Solver.declarePool

Mojo declaration:

def declarePool(self, symbol: String, sort: Sort, initValue: List[Term]) raises -> Term

Upstream Python signature:

Solver.declarePool(symbol: str, sort: Sort, initValue)

Declare a symbolic pool of terms with the given initial value.

SMT-LIB:

( declare-pool <symbol> <sort> ( <term>* ) )

Warning

This function is experimental and may change in future versions.

Parameters

  • symbol: The name of the pool.
  • sort: The sort of the elements of the pool.
  • initValue: The initial value of the pool.

Binding: Generated from cvc5_declare_pool.

Solver.addPlugin

Mojo declaration:

def addPlugin[P: Plugin](self, plugin: ArcPointer[P]) raises

Upstream Python signature:

Solver.addPlugin(p: Plugin)

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.

Binding: Hand-written using cvc5_add_plugin.

Solver.pop

Mojo declaration:

def pop(self, nscopes: Int = 1) raises
def pop(self, nscopes: IntLiteral) raises

Upstream Python signature:

Solver.pop(nscopes = 1)

Pop nscopes level(s) from the assertion stack.

SMT-LIB:

( pop <numeral> )

Parameters

  • nscopes: The number of levels to pop.

Binding: Generated from cvc5_pop.

Solver.push

Mojo declaration:

def push(self, nscopes: Int = 1) raises
def push(self, nscopes: IntLiteral) raises

Upstream Python signature:

Solver.push(nscopes = 1)

Push nscopes level(s) to the assertion stack.

SMT-LIB:

( push <numeral> )

Parameters

  • nscopes: The number of levels to push.

Binding: Generated from cvc5_push.

Solver.resetAssertions

Mojo declaration:

def resetAssertions(self) raises

Upstream Python signature:

Solver.resetAssertions()

Remove all assertions.

SMT-LIB:

( reset-assertions )

Binding: Generated from cvc5_reset_assertions.

Solver.setInfo

Mojo declaration:

def setInfo(self, keyword: String, value: String) raises

Upstream Python signature:

Solver.setInfo(keyword: str, value: str)

Set info.

SMT-LIB:

( set-info <attribute> )

Parameters

  • keyword: The info flag.
  • value: The value of the info flag.

Binding: Generated from cvc5_set_info.

Solver.setLogic

Mojo declaration:

def setLogic(self, logic: String) raises

Upstream Python signature:

Solver.setLogic(logic: str)

Set logic.

SMT-LIB:

( set-logic <symbol> )

Parameters

  • logic: The logic to set.

Binding: Generated from cvc5_set_logic.

Solver.isLogicSet

Mojo declaration:

def isLogicSet(self) raises -> Bool

Upstream Python signature:

Solver.isLogicSet()

Is logic set? Returns whether we called setLogic yet for this solver.

Returns

whether we called setLogic yet for this solver.

Binding: Generated from cvc5_is_logic_set.

Solver.getLogic

Mojo declaration:

def getLogic(self) raises -> String

Upstream Python signature:

Solver.getLogic()

Get the logic set the solver.

Note

Asserts isLogicSet().

Returns

The logic used by the solver.

Binding: Generated from cvc5_get_logic.

Solver.setOption

Mojo declaration:

def setOption(self, option: String, value: String) raises

Upstream Python signature:

Solver.setOption(option: str, value: str)

Set option.

SMT-LIB:

( set-option <option> )

Parameters

  • option: The option name.
  • value: The option value.

Binding: Generated from cvc5_set_option.

Solver.getInterpolant

Mojo declaration:

def getInterpolant(self, conj: Term) raises -> Term
def getInterpolant(self, conj: Term, grammar: Grammar) raises -> Term

Upstream Python signature:

Solver.getInterpolant(conj: Term, grammar: Grammar = None)

Get an interpolant. Assuming that A \rightarrow B is valid, this function determines a term I over the shared variables of A and B, optionally with respect to a a given grammar, such that A \rightarrow I and I \rightarrow B are valid, if such a term exits. A is the current set of assertions and B is the conjecture, given as conj.

SMT-LIB:

( get-interpolant <symbol> <conj> )
( get-interpolant <symbol> <conj> <grammar> )

Note

In SMT-LIB, <symbol> assigns a symbol to the

interpolant.

Note

Requires option

produce-interpolants to be set to a mode different from none.

Warning

This function is experimental and may change in future versions.

Parameters

  • conj: The conjecture term.
  • grammar: A grammar for the interpolant.

Returns

The interpolant, if such a term exists.

Binding: Generated as overloads from cvc5_get_interpolant, cvc5_get_interpolant_with_grammar.

Solver.getInterpolantNext

Mojo declaration:

def getInterpolantNext(self) raises -> Term

Upstream Python signature:

Solver.getInterpolantNext()

Get the next interpolant.

Can only be called immediately after a successful call to Solver.getInterpolant() or Solver.getInterpolantNext(). 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 option produce-interpolants to be set to a mode different from none.

Warning

This function is experimental and may change in future versions.

Parameters

  • output: The term where the result will be stored.

Returns

True iff an interpolant was found.

Binding: Generated from cvc5_get_interpolant_next.

Solver.getAbduct

Mojo declaration:

def getAbduct(self, conj: Term) raises -> Term
def getAbduct(self, conj: Term, grammar: Grammar) raises -> Term

Upstream Python signature:

Solver.getAbduct(conj: Term, grammar: Grammar = None)

Get an abduct.

SMT-LIB:

( get-abduct <conj> )
( get-abduct <conj> <grammar> )

Requires to enable option produce-abducts.

Warning

This function is experimental and may change in future versions.

Parameters

  • conj: The conjecture term.
  • grammar: A grammar for the abduct.

Returns

The abduct. See Solver::getAbduct for details.

Binding: Generated as overloads from cvc5_get_abduct, cvc5_get_abduct_with_grammar.

Solver.getAbductNext

Mojo declaration:

def getAbductNext(self) raises -> Term

Upstream Python signature:

Solver.getAbductNext()

Get the next abduct.

Can only be called immediately after a successful call to Solver.getAbduct() or Solver.getAbductNext(). Is guaranteed to produce a syntactically different abduct wrt the last returned abduct if successful.

SMT-LIB:

( get-abduct-next )

Requires to enable incremental mode, and option produce-abducts.

Warning

This function is experimental and may change in future versions.

Parameters

  • output: The term where the result will be stored.

Returns

True iff an abduct was found.

Binding: Generated from cvc5_get_abduct_next.

Solver.blockModel

Mojo declaration:

def blockModel(self, mode: BlockModelsMode) raises

Upstream Python signature:

Solver.blockModel(mode)

Block the current model. Can be called only if immediately preceded by a SAT or INVALID query.

SMT-LIB:

(block-model)

Requires enabling option produce-models to a mode other than none.

Warning

This function is experimental and may change in future versions.

Parameters

  • mode: The mode to use for blocking

Binding: Generated from cvc5_block_model.

Solver.blockModelValues

Mojo declaration:

def blockModelValues(self, terms: List[Term]) raises

Upstream Python signature:

Solver.blockModelValues(terms)

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 option produce-models.

Warning

This function is experimental and may change in future versions.

Binding: Generated from cvc5_block_model_values.

Solver.getInstantiations

Mojo declaration:

def getInstantiations(self) raises -> String

Upstream Python signature:

Solver.getInstantiations()

Return a string that contains information about all instantiations made by the quantifiers module.

Warning

This function is experimental and may change in future versions.

Binding: Generated from cvc5_get_instantiations.

Solver.getStatistics

Mojo declaration:

def getStatistics(self) raises -> Statistics

Upstream Python signature:

Solver.getStatistics()

Return a snapshot of the current state of the statistic values of this solver. The returned object is completely decoupled from the solver and will not change when the solver is used again.

Binding: Generated from cvc5_get_statistics.

Solver.getVersion

Mojo declaration:

def getVersion(self) raises -> String

Upstream Python signature:

Solver.getVersion()

Return a string representation of the version of this solver.

Binding: Generated from cvc5_get_version.

65 Python methods not mirrored
  • getBooleanSort: Not mirrored: deprecated in cvc5.
  • getIntegerSort: Not mirrored: deprecated in cvc5.
  • getRealSort: Not mirrored: deprecated in cvc5.
  • getRegExpSort: Not mirrored: deprecated in cvc5.
  • getRoundingModeSort: Not mirrored: deprecated in cvc5.
  • getStringSort: Not mirrored: deprecated in cvc5.
  • mkArraySort: Not mirrored: deprecated in cvc5.
  • mkBitVectorSort: Not mirrored: deprecated in cvc5.
  • mkFloatingPointSort: Not mirrored: deprecated in cvc5.
  • mkFiniteFieldSort: Not mirrored: deprecated in cvc5.
  • mkDatatypeSort: Not mirrored: deprecated in cvc5.
  • mkDatatypeSorts: Not mirrored: deprecated in cvc5.
  • mkFunctionSort: Not mirrored: deprecated in cvc5.
  • mkParamSort: Not mirrored: deprecated in cvc5.
  • mkPredicateSort: Not mirrored: deprecated in cvc5.
  • mkRecordSort: Not mirrored: deprecated in cvc5.
  • mkSetSort: Not mirrored: deprecated in cvc5.
  • mkBagSort: Not mirrored: deprecated in cvc5.
  • mkSequenceSort: Not mirrored: deprecated in cvc5.
  • mkAbstractSort: Not mirrored: deprecated in cvc5.
  • mkUninterpretedSort: Not mirrored: deprecated in cvc5.
  • mkUnresolvedDatatypeSort: Not mirrored: deprecated in cvc5.
  • mkUninterpretedSortConstructorSort: Not mirrored: deprecated in cvc5.
  • mkTupleSort: Not mirrored: deprecated in cvc5.
  • mkNullableSort: Not mirrored: deprecated in cvc5.
  • mkTerm: Not mirrored: deprecated in cvc5.
  • mkTuple: Not mirrored: deprecated in cvc5.
  • mkNullableSome: Not mirrored: deprecated in cvc5.
  • mkNullableVal: Not mirrored: deprecated in cvc5.
  • mkNullableIsNull: Not mirrored: deprecated in cvc5.
  • mkNullableIsSome: Not mirrored: deprecated in cvc5.
  • mkNullableNull: Not mirrored: deprecated in cvc5.
  • mkNullableLift: Not mirrored: deprecated in cvc5.
  • mkOp: Not mirrored: deprecated in cvc5.
  • mkTrue: Not mirrored: deprecated in cvc5.
  • mkFalse: Not mirrored: deprecated in cvc5.
  • mkBoolean: Not mirrored: deprecated in cvc5.
  • mkPi: Not mirrored: deprecated in cvc5.
  • mkInteger: Not mirrored: deprecated in cvc5.
  • mkReal: Not mirrored: deprecated in cvc5.
  • mkRegexpAll: Not mirrored: deprecated in cvc5.
  • mkRegexpAllchar: Not mirrored: deprecated in cvc5.
  • mkRegexpNone: Not mirrored: deprecated in cvc5.
  • mkEmptySet: Not mirrored: deprecated in cvc5.
  • mkEmptyBag: Not mirrored: deprecated in cvc5.
  • mkSepEmp: Not mirrored: deprecated in cvc5.
  • mkSepNil: Not mirrored: deprecated in cvc5.
  • mkString: Not mirrored: deprecated in cvc5.
  • mkEmptySequence: Not mirrored: deprecated in cvc5.
  • mkUniverseSet: Not mirrored: deprecated in cvc5.
  • mkBitVector: Not mirrored: deprecated in cvc5.
  • mkFiniteFieldElem: Not mirrored: deprecated in cvc5.
  • mkConstArray: Not mirrored: deprecated in cvc5.
  • mkFloatingPointPosInf: Not mirrored: deprecated in cvc5.
  • mkFloatingPointNegInf: Not mirrored: deprecated in cvc5.
  • mkFloatingPointNaN: Not mirrored: deprecated in cvc5.
  • mkFloatingPointPosZero: Not mirrored: deprecated in cvc5.
  • mkFloatingPointNegZero: Not mirrored: deprecated in cvc5.
  • mkRoundingMode: Not mirrored: deprecated in cvc5.
  • mkFloatingPoint: Not mirrored: deprecated in cvc5.
  • mkCardinalityConstraint: Not mirrored: deprecated in cvc5.
  • mkConst: Not mirrored: deprecated in cvc5.
  • mkVar: Not mirrored: deprecated in cvc5.
  • mkDatatypeConstructorDecl: Not mirrored: deprecated in cvc5.
  • mkDatatypeDecl: Not mirrored: deprecated in cvc5.

C-only extensions

These methods extend the Python base API with C functionality.

Solver.declareOracleFun

def declareOracleFun[O: Oracle](self, symbol: String, sorts: List[Sort], sort: Sort, oracle: ArcPointer[O]) raises -> Term

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 function 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.

Warning

This function is experimental and may change in future versions.

Parameters

  • cvc5: The solver instance.
  • symbol: The name of the oracle
  • size: The number of domain sorts of the oracle function.
  • sorts: The domain sorts.
  • sort: The sort of the return value of this function.
  • state: The state data for the oracle function, may be NULL.
  • fun: The function that implements the oracle function, taking a an array of term arguments and its size and a void pointer to optionally capture any state data the function may need.

Returns

The oracle function.

Binding: Hand-written using cvc5_declare_oracle_fun.

cvc5_mojo v1.4.1.1 for Mojo 1.2 and cvc5 1.4.1 · Apache License 2.0 with LLVM Exceptions · Source on GitHub