Package com.microsoft.z3
Class Context
java.lang.Object
com.microsoft.z3.Context
- All Implemented Interfaces:
AutoCloseable
The main interaction with Z3 happens via the Context.
For applications that spawn an unbounded number of contexts,
the proper use is within a try-with-resources
scope so that the Context object gets garbage collected in
a predictable way. Contexts maintain all data-structures
related to terms and formulas that are created relative
to them.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R extends Sort>
voidBind a definition to a recursive function declaration.Create a probe that evaluates totruewhen the valuep1andp2evaluate totrue.Create a tactic that appliest1to a Goal and thent2to every subgoal produced byt1benchmarkToSMTString(String name, String logic, String status, String attributes, Expr<BoolSort>[] assumptions, Expr<BoolSort> formula) Convert a benchmark into an SMT-LIB formatted string.charFromBv(BitVecExpr bv) Create a character from a bit-vector (code point).Create a bit-vector (code point) from character.Create an integer (code point) from character.voidclose()Disposes of the context.Create a tactic that appliest1to a given goal if the probepevaluates to true andt2otherwise.constProbe(double val) Create a probe that always evaluates toval.Create a probe that evaluates totruewhen the value returned byp1is equal to the value returned byp2fail()Create a tactic always fails.Create a tactic that fails if the probepevaluates to false.Create a tactic that fails if the goal is not trivially satisfiable (i.e., empty) or trivially unsatisfiable (i.e., contains `false').Create a probe that evaluates totruewhen the value returned byp1is greater than or equal the value returned byp2IDecRefQueue<com.microsoft.z3.ASTMap>Retrieves the Boolean sort of the context.Retrieves the Integer sort of the context.intThe number of supported Probes.intThe number of supported tactics.getProbeDescription(String name) Returns a string containing a description of the probe with the given name.String[]The names of all supported Probes.Retrieves the Real sort of the context.Retrieves parameter descriptions for simplifier.Retrieves the String sort of the context.getTacticDescription(String name) Returns a string containing a description of the tactic with the given name.String[]The names of all supported tactics.Create a probe that evaluates totruewhen the value returned byp1is greater than the value returned byp2voidInterrupt the execution of a Z3 procedure.intToString(Expr<IntSort> e) Convert an integer expression to a string.Create a probe that evaluates totruewhen the value returned byp1is less than or equal the value returned byp2Create a probe that evaluates totruewhen the value returned byp1is less than the value returned byp2Create an expression representingt[0] + t[1] + ....mkAllcharRe(R s) Create regular expression that accepts all characters Corresponds to re.allcharfinal BoolExprCreate an expression representingt[0] and t[1] and ....Create a new function application.mkArrayConst(Symbol name, D domain, R range) Create an array constant.mkArrayConst(String name, D domain, R range) Create an array constant.mkArrayExt(Expr<ArraySort<D, R>> arg1, Expr<ArraySort<D, R>> arg2) Create Extentionality index.mkArraySort(Sort[] domains, R range) Create a new array sort.mkArraySort(D domain, R range) Create a new array sort.Retrieve sequence of length one at index.Create an at-least-k constraint.Create an at-most-k constraint.mkBitVecSort(int size) Create a new bit-vector sort.mkBool(boolean value) Creates a Boolean value.mkBoolConst(Symbol name) Create a Boolean constant.mkBoolConst(String name) Create a Boolean constant.Create a new Boolean sort.mkBound(int index, R ty) Creates a new bound variable.mkBV(int v, int size) Create a bit-vector numeral.mkBV(long v, int size) Create a bit-vector numeral.Create a bit-vector numeral.mkBV2Int(Expr<BitVecSort> t, boolean signed) Create an integer from the bit-vector argumentt.mkBVAdd(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement addition.mkBVAddNoOverflow(Expr<BitVecSort> t1, Expr<BitVecSort> t2, boolean isSigned) Create a predicate that checks that the bit-wise addition does not overflow.mkBVAddNoUnderflow(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Create a predicate that checks that the bit-wise addition does not underflow.mkBVAND(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Bitwise conjunction.mkBVASHR(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Arithmetic shift right Remarks: It is like logical shift right except that the most significant bits of the result always copy the most significant bit of the second argument.Creates a bit-vector constant.Creates a bit-vector constant.mkBVLSHR(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Logical shift right Remarks: It is equivalent to unsigned division by2^xwhere \c x is the value oft2.mkBVMul(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement multiplication.mkBVMulNoOverflow(Expr<BitVecSort> t1, Expr<BitVecSort> t2, boolean isSigned) Create a predicate that checks that the bit-wise multiplication does not overflow.mkBVMulNoUnderflow(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Create a predicate that checks that the bit-wise multiplication does not underflow.mkBVNAND(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Bitwise NAND.mkBVNeg(Expr<BitVecSort> t) Standard two's complement unary minus.Create a predicate that checks that the bit-wise negation does not overflow.mkBVNOR(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Bitwise NOR.mkBVNot(Expr<BitVecSort> t) Bitwise negation.mkBVOR(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Bitwise disjunction.mkBVRedAND(Expr<BitVecSort> t) Take conjunction of bits in a vector, return vector of length 1.mkBVRedOR(Expr<BitVecSort> t) Take disjunction of bits in a vector, return vector of length 1.mkBVRotateLeft(int i, Expr<BitVecSort> t) Rotate Left.mkBVRotateLeft(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Rotate Left.mkBVRotateRight(int i, Expr<BitVecSort> t) Rotate Right.mkBVRotateRight(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Rotate Right.mkBVSDiv(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Signed division.mkBVSDivNoOverflow(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Create a predicate that checks that the bit-wise signed division does not overflow.mkBVSGE(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement signed greater than or equal to.mkBVSGT(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement signed greater-than.mkBVSHL(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Shift left.mkBVSLE(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement signed less-than or equal to.mkBVSLT(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement signed less-than Remarks: The arguments must have the same bit-vector sort.mkBVSMod(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement signed remainder (sign follows divisor).mkBVSRem(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Signed remainder.mkBVSub(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Two's complement subtraction.mkBVSubNoOverflow(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Create a predicate that checks that the bit-wise subtraction does not overflow.mkBVSubNoUnderflow(Expr<BitVecSort> t1, Expr<BitVecSort> t2, boolean isSigned) Create a predicate that checks that the bit-wise subtraction does not underflow.mkBVUDiv(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Unsigned division.mkBVUGE(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Unsigned greater than or equal to.mkBVUGT(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Unsigned greater-than.mkBVULE(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Unsigned less-than or equal to.mkBVULT(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Unsigned less-than Remarks: The arguments must have the same bit-vector sort.mkBVURem(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Unsigned remainder.mkBVXNOR(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Bitwise XNOR.mkBVXOR(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Bitwise XOR.Create less than or equal to between two characters.Creates character sort object.mkComplement(Expr<ReSort<R>> re) Create the complement regular expression.mkConcat(Expr<BitVecSort> t1, Expr<BitVecSort> t2) Bit-vector concatenation.Concatenate sequences.Create the concatenation of regular languages.Creates a fresh constant from the FuncDeclf.Creates a new Constant of sortrangeand namedname.Creates a new Constant of sortrangeand namedname.mkConstArray(D domain, Expr<R> v) Create a constant array.mkConstDecl(Symbol name, R range) Creates a new constant function declaration.mkConstDecl(String name, R range) Creates a new constant function declaration.<R> Constructor<R>mkConstructor(Symbol name, Symbol recognizer, Symbol[] fieldNames, Sort[] sorts, int[] sortRefs) Create a datatype constructor.<R> Constructor<R>mkConstructor(String name, String recognizer, String[] fieldNames, Sort[] sorts, int[] sortRefs) Create a datatype constructor.mkContains(Expr<SeqSort<R>> s1, Expr<SeqSort<R>> s2) Check for sequence containment of s2 in s1.<R> DatatypeSort<R>mkDatatypeSort(Symbol name, Constructor<R>[] constructors) Create a new datatype sort.<R> DatatypeSort<R>mkDatatypeSort(String name, Constructor<R>[] constructors) Create a new datatype sort.mkDatatypeSorts(Symbol[] names, Constructor<Object>[][] c) Create mutually recursive datatypes.mkDatatypeSorts(String[] names, Constructor<Object>[][] c) Create mutually recursive data-types.Create a difference regular expression.final BoolExprmkDistinct(Expr<?>... args) Creates adistinctterm.Create an expression representingt1 / t2.mkEmptyRe(R s) Create the empty regular expression.mkEmptySeq(R s) Create the empty sequence.mkEmptySet(D domain) Create an empty set.<R> EnumSort<R>mkEnumSort(Symbol name, Symbol... enumNames) Create a new enumeration sort.<R> EnumSort<R>mkEnumSort(String name, String... enumNames) Create a new enumeration sort.Creates the equalityx = ymkExists(Expr<?>[] boundConstants, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Creates an existential quantifier using a list of constants that will form the set of bound variables.mkExists(Sort[] sorts, Symbol[] names, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Creates an existential quantifier using de-Bruijn indexed variables.mkExtract(int high, int low, Expr<BitVecSort> t) Bit-vector extraction.Extract subsequence.mkFalse()The false Term.<R> FiniteDomainSort<R>mkFiniteDomainSort(Symbol name, long size) Create a new finite domain sort.<R> FiniteDomainSort<R>mkFiniteDomainSort(String name, long size) Create a new finite domain sort.Create a Fixedpoint context.mkForall(Expr<?>[] boundConstants, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Creates a universal quantifier using a list of constants that will form the set of bound variables.mkForall(Sort[] sorts, Symbol[] names, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Create a universal Quantifier.Create a numeral of FloatingPoint sort from a sign bit and two integers.Create a numeral of FloatingPoint sort from a sign bit and two 64-bit integers.Create a numeral of FloatingPoint sort from a double.Create a numeral of FloatingPoint sort from a float.Create a numeral of FloatingPoint sort from an int.mkFP(Expr<BitVecSort> sgn, Expr<BitVecSort> sig, Expr<BitVecSort> exp) Create an expression of FloatingPoint sort from three bit-vector expressions.Floating-point absolute valueFloating-point additionFloating-point divisionFloating-point equality.Floating-point fused multiply-addFloating-point greater than or equal.Floating-point greater than.Create a floating-point infinity of sort s.mkFPIsInfinite(Expr<FPSort> t) Predicate indicating whether t is a floating-point number representing +oo or -oo.Predicate indicating whether t is a NaN.mkFPIsNegative(Expr<FPSort> t) Predicate indicating whether t is a negative floating-point number.mkFPIsNormal(Expr<FPSort> t) Predicate indicating whether t is a normal floating-point number.\mkFPIsPositive(Expr<FPSort> t) Predicate indicating whether t is a positive floating-point number.Predicate indicating whether t is a subnormal floating-point number.\mkFPIsZero(Expr<FPSort> t) Predicate indicating whether t is a floating-point number with zero value, i.e., +0 or -0.Floating-point less than or equal.Floating-point less than.Maximum of floating-point numbers.Minimum of floating-point numbers.Floating-point multiplicationCreate a NaN of sort s.Floating-point negationmkFPNumeral(boolean sgn, int exp, int sig, FPSort s) Create a numeral of FloatingPoint sort from a sign bit and two integers.mkFPNumeral(boolean sgn, long exp, long sig, FPSort s) Create a numeral of FloatingPoint sort from a sign bit and two 64-bit integers.mkFPNumeral(double v, FPSort s) Create a numeral of FloatingPoint sort from a double.mkFPNumeral(float v, FPSort s) Create a numeral of FloatingPoint sort from a float.mkFPNumeral(int v, FPSort s) Create a numeral of FloatingPoint sort from an int.Floating-point remaindermkFPRNA()Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.mkFPRNE()Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.Create the floating-point RoundingMode sort.Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.mkFPRoundToIntegral(Expr<FPRMSort> rm, Expr<FPSort> t) Floating-point roundToIntegral.Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.mkFPRTN()Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.mkFPRTP()Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.mkFPRTZ()Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.mkFPSort(int ebits, int sbits) Create a FloatingPoint sort.Create the quadruple-precision (128-bit) FloatingPoint sort.Create the half-precision (16-bit) FloatingPoint sort.Create the single-precision (32-bit) FloatingPoint sort.Create the double-precision (64-bit) FloatingPoint sort.Create the double-precision (64-bit) FloatingPoint sort.Create the half-precision (16-bit) FloatingPoint sort.Create the quadruple-precision (128-bit) FloatingPoint sort.Create the single-precision (32-bit) FloatingPoint sort.Floating-point square rootFloating-point subtractionConversion of a floating-point term into a bit-vector.mkFPToFP(Expr<BitVecSort> bv, FPSort s) Conversion of a single IEEE 754-2008 bit-vector into a floating-point number.Conversion of a 2's complement signed bit-vector term into a term of FloatingPoint sort.Conversion of a real-sorted significand and an integer-sorted exponent into a term of FloatingPoint sort.Conversion of a FloatingPoint term into another term of different FloatingPoint sort.Conversion of a term of real sort into a term of FloatingPoint sort.Conversion of a floating-point number to another FloatingPoint sort s.mkFPToIEEEBV(Expr<FPSort> t) Conversion of a floating-point term into a bit-vector term in IEEE 754-2008 format.mkFPToReal(Expr<FPSort> t) Conversion of a floating-point term into a real-numbered term.Create a floating-point zero of sort s.mkFreshConst(String prefix, R range) Creates a fresh Constant of sortrangeand a name prefixed withprefix.mkFreshConstDecl(String prefix, R range) Creates a fresh constant function declaration with a name prefixed withprefix.mkFreshFuncDecl(String prefix, Sort[] domain, R range) Creates a fresh function declaration with a name prefixed withprefix.mkFullRe(R s) Create the full regular expression.mkFullSet(D domain) Create the full set.mkFuncDecl(Symbol name, Sort[] domain, R range) Creates a new function declaration.mkFuncDecl(Symbol name, Sort domain, R range) Creates a new function declaration.mkFuncDecl(String name, Sort[] domain, R range) Creates a new function declaration.mkFuncDecl(String name, Sort domain, R range) Creates a new function declaration.Create an expression representingt1 >= t2mkGoal(boolean models, boolean unsatCores, boolean proofs) Creates a new Goal.Create an expression representingt1 > t2Create an expression representingt1 iff t2.Create an expression representingt1 -> t2.Extract index of sub-string starting at offset.Check for regular expression membership.mkInt(int v) Create an integer numeral.mkInt(long v) Create an integer numeral.Create an integer numeral.Create annbit bit-vector from the integer argumentt.mkInt2Real(Expr<IntSort> t) Coerce an integer to a real.mkIntConst(Symbol name) Creates an integer constant.mkIntConst(String name) Creates an integer constant.mkIntersect(Expr<ReSort<R>>... t) Create the intersection of regular languages.Create a new integer sort.Create a check if the character is a digit.mkIsInteger(Expr<RealSort> t) Creates an expression that checks whether a real number is an integer.Create an expression representing an if-then-else:ite(t1, t2, t3).Create a lambda expression.Create a lambda expression.Create an expression representingt1 <= t2Retrieve the length of a given sequence.mkLinearOrder(R sort, int index) Creates or a linear order.mkListSort(Symbol name, R elemSort) Create a new list sort.mkListSort(String name, R elemSort) Create a new list sort.Take the lower-bounded Kleene star of a regular expression.Take the lower and upper-bounded Kleene star of a regular expression.Create an expression representingt1 < t2Maps f on the argument arrays.Create an expression representingt1 mod t2.Create an expression representingt[0] * t[1] * ....Create an expression representingnot(a).Retrieve element at index.mkNumeral(int v, R ty) Create a Term of a given sort.mkNumeral(long v, R ty) Create a Term of a given sort.Create a Term of a given sort.Create a Optimize context.Create the optional regular expression.final BoolExprCreate an expression representingt[0] or t[1] or ....mkParams()Creates a new ParameterSet.mkPartialOrder(R sort, int index) Creates or a partial order.final PatternCreate a quantifier pattern.Create a pseudo-Boolean equal constraint.Create a pseudo-Boolean greater-or-equal constraint.Create a pseudo-Boolean less-or-equal constraint.Take the Kleene plus of a regular expression.Create an expression representingt1 ^ t2.Create power regular expression.mkPrefixOf(Expr<SeqSort<R>> s1, Expr<SeqSort<R>> s2) Check for sequence prefix.Creates a new Probe.mkQuantifier(boolean universal, Expr<?>[] boundConstants, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Create a QuantifiermkQuantifier(boolean universal, Sort[] sorts, Symbol[] names, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Create a Quantifier.Create a range expression.mkReal(int v) Create a real numeral.mkReal(int num, int den) Create a real from a fraction.mkReal(long v) Create a real numeral.Create a real numeral.mkReal2Int(Expr<RealSort> t) Coerce a real to an integer.mkRealConst(Symbol name) Creates a real constant.mkRealConst(String name) Creates a real constant.Create a real sort.mkRecFuncDecl(Symbol name, Sort[] domain, R range) Creates a new recursive function declaration.Create an expression representingt1 rem t2.mkRepeat(int i, Expr<BitVecSort> t) Bit-vector repetition.Replace the first occurrence of src by dst in s.mkReSort(R s) Create a new regular expression sortArray read.Array read.mkSeqSort(R s) Create a new sequence sortAdd an element to the set.mkSetComplement(Expr<ArraySort<D, BoolSort>> arg) Take the complement of a set.Remove an element from a set.Take the difference between two sets.mkSetIntersection(Expr<ArraySort<D, BoolSort>>... args) Take the intersection of a list of sets.mkSetMembership(Expr<D> elem, Expr<ArraySort<D, BoolSort>> set) Check for set membership.mkSetSort(D ty) Create a set type.Check for subsetness of sets.mkSetUnion(Expr<ArraySort<D, BoolSort>>... args) Take the union of a list of sets.mkSignExt(int i, Expr<BitVecSort> t) Bit-vector sign extension.Creates a new (incremental) solver.mkSolver()Creates a new (incremental) solver.Creates a new (incremental) solver.Creates a solver that is implemented using the given tactic.Creates a new (incremental) solver.Take the Kleene star of a regular expression.Array update.Array update.Create a string constant.MkStringLe(SeqSort<CharSort> s1, SeqSort<CharSort> s2) Check if the string s1 is lexicographically less or equal to s2.MkStringLt(SeqSort<CharSort> s1, SeqSort<CharSort> s2) Check if the string s1 is lexicographically strictly less than s2.Create a new string sortCreate an expression representingt[0] - t[1] - ....mkSuffixOf(Expr<SeqSort<R>> s1, Expr<SeqSort<R>> s2) Check for sequence suffix.mkSymbol(int i) Creates a new symbol using an integer.Create a symbol using a string.Creates a new Tactic.mkTermArray(Expr<ArraySort<D, R>> array) Access the array default value.Convert a regular expression that accepts sequence s.mkTrue()The true Term.mkTupleSort(Symbol name, Symbol[] fieldNames, Sort[] fieldSorts) Create a new tuple sort.mkUnaryMinus(Expr<R> t) Create an expression representing-t.Create a new uninterpreted sort.Create a new uninterpreted sort.Create the union of regular languages.Create the singleton sequence.mkUpdateField(FuncDecl<F> field, Expr<R> t, Expr<F> v) Update a datatype field at expression t with value v.Create an expression representingt1 xor t2.mkZeroExt(int i, Expr<BitVecSort> t) Bit-vector zero extension.longnCtx()Create a probe that evaluates totruewhen the valuepdoes not evaluate totrue.Create a probe that evaluates totruewhen the valuep1orp2evaluate totrue.Create a tactic that first appliest1to a Goal and if it fails then returns the result oft2applied to the Goal.parAndThen(Tactic t1, Tactic t2) Create a tactic that appliest1to a given goal and thent2to every subgoal produced byt1.Create a tactic that applies the given tactics in parallel until one of them succeeds (i.e., the first that doesn't fail).BoolExpr[]parseSMTLIB2File(String fileName, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl<?>[] decls) Parse the given file using the SMT-LIB2 parser.BoolExpr[]parseSMTLIB2String(String str, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl<?>[] decls) Parse the given string using the SMT-LIB2 parser.Create a tactic that keeps applyingtuntil the goal is not modified anymore or the maximum number of iterationsmaxis reached.Convert an signed bitvector expression to a string.voidsetPrintMode(Z3_ast_print_mode value) Selects the format used for pretty-printing expressions.Return a string describing all available parameters toExpr.Simplify.skip()Create a tactic that just returns the given goal.stringToInt(Expr<SeqSort<CharSort>> e) Convert an integer expression to a string.Create a tactic that appliest1to a Goal and thent2to every subgoal produced byt1Remarks: Shorthand forAndThen.Create a tactic that appliestto a goal formsmilliseconds.Convert an unsigned bitvector expression to a string.longUnwraps an AST.voidupdateParamValue(String id, String value) Update a mutable configuration parameter.usingParams(Tactic t, Params p) Create a tactic that appliestusing the given set of parametersp.Create a tactic that appliestto a given goal if the probepevaluates to true.Create a tactic that appliestusing the given set of parametersp.wrapAST(long nativeObject) Wraps an AST.
-
Constructor Details
-
Context
public Context() -
Context
protected Context(long m_ctx) -
Context
Constructor. Remarks: The following parameters can be set: - proof (Boolean) Enable proof generation - debug_ref_count (Boolean) Enable debug support for Z3_ast reference counting - trace (Boolean) Tracing support for VCC - trace_file_name (String) Trace out file for VCC traces - timeout (unsigned) default timeout (in milliseconds) used for solvers - well_sorted_check type checker - auto_config use heuristics to automatically select solver and configure it - model model generation for solvers, this parameter can be overwritten when creating a solver - model_validate validate models produced by solvers - unsat_core unsat-core generation for solvers, this parameter can be overwritten when creating a solver Note that in previous versions of Z3, this constructor was also used to set global and module parameters. For this purpose we should now useGlobal.setParameter
-
-
Method Details
-
mkSymbol
Creates a new symbol using an integer. Remarks: Not all integers can be passed to this function. The legal range of unsigned integers is 0 to 2^30-1. -
mkSymbol
Create a symbol using a string. -
getBoolSort
Retrieves the Boolean sort of the context. -
getIntSort
Retrieves the Integer sort of the context. -
getRealSort
Retrieves the Real sort of the context. -
mkBoolSort
Create a new Boolean sort. -
mkCharSort
Creates character sort object. -
getStringSort
Retrieves the String sort of the context. -
mkUninterpretedSort
Create a new uninterpreted sort. -
mkUninterpretedSort
Create a new uninterpreted sort. -
mkIntSort
Create a new integer sort. -
mkRealSort
Create a real sort. -
mkBitVecSort
Create a new bit-vector sort. -
mkArraySort
Create a new array sort. -
mkArraySort
Create a new array sort. -
mkStringSort
Create a new string sort -
mkSeqSort
Create a new sequence sort -
mkReSort
Create a new regular expression sort -
mkTupleSort
Create a new tuple sort. -
mkEnumSort
Create a new enumeration sort. -
mkEnumSort
Create a new enumeration sort. -
mkListSort
Create a new list sort. -
mkListSort
Create a new list sort. -
mkFiniteDomainSort
Create a new finite domain sort. -
mkFiniteDomainSort
Create a new finite domain sort. -
mkConstructor
public <R> Constructor<R> mkConstructor(Symbol name, Symbol recognizer, Symbol[] fieldNames, Sort[] sorts, int[] sortRefs) Create a datatype constructor.- Parameters:
name- constructor namerecognizer- name of recognizer function.fieldNames- names of the constructor fields.sorts- field sorts, 0 if the field sort refers to a recursive sort.sortRefs- reference to datatype sort that is an argument to the constructor; if the corresponding sort reference is 0, then the value in sort_refs should be an index referring to one of the recursive datatypes that is declared.
-
mkConstructor
public <R> Constructor<R> mkConstructor(String name, String recognizer, String[] fieldNames, Sort[] sorts, int[] sortRefs) Create a datatype constructor. -
mkDatatypeSort
Create a new datatype sort. -
mkDatatypeSort
Create a new datatype sort. -
mkDatatypeSorts
Create mutually recursive datatypes.- Parameters:
names- names of datatype sortsc- list of constructors, one list per sort.
-
mkDatatypeSorts
Create mutually recursive data-types. -
mkUpdateField
public <F extends Sort,R extends Sort> Expr<R> mkUpdateField(FuncDecl<F> field, Expr<R> t, Expr<F> v) throws Z3Exception Update a datatype field at expression t with value v. The function performs a record update at t. The field that is passed in as argument is updated with value v, the remaining fields of t are unchanged.- Throws:
Z3Exception
-
mkFuncDecl
Creates a new function declaration. -
mkFuncDecl
Creates a new function declaration. -
mkFuncDecl
Creates a new function declaration. -
mkFuncDecl
Creates a new function declaration. -
mkRecFuncDecl
Creates a new recursive function declaration. -
AddRecDef
Bind a definition to a recursive function declaration. The function must have previously been created using MkRecFuncDecl. The body may contain recursive uses of the function or other mutually recursive functions. -
mkFreshFuncDecl
Creates a fresh function declaration with a name prefixed withprefix. -
mkConstDecl
Creates a new constant function declaration. -
mkConstDecl
Creates a new constant function declaration. -
mkFreshConstDecl
Creates a fresh constant function declaration with a name prefixed withprefix. -
mkBound
Creates a new bound variable.- Parameters:
index- The de-Bruijn index of the variablety- The sort of the variable
-
mkPattern
Create a quantifier pattern. -
mkConst
Creates a new Constant of sortrangeand namedname. -
mkConst
Creates a new Constant of sortrangeand namedname. -
mkFreshConst
Creates a fresh Constant of sortrangeand a name prefixed withprefix. -
mkConst
Creates a fresh constant from the FuncDeclf.- Parameters:
f- A decl of a 0-arity function
-
mkBoolConst
Create a Boolean constant. -
mkBoolConst
Create a Boolean constant. -
mkIntConst
Creates an integer constant. -
mkIntConst
Creates an integer constant. -
mkRealConst
Creates a real constant. -
mkRealConst
Creates a real constant. -
mkBVConst
Creates a bit-vector constant. -
mkBVConst
Creates a bit-vector constant. -
mkApp
Create a new function application. -
mkTrue
The true Term. -
mkFalse
The false Term. -
mkBool
Creates a Boolean value. -
mkEq
Creates the equalityx = y -
mkDistinct
Creates adistinctterm. -
mkNot
Create an expression representingnot(a). -
mkITE
public <R extends Sort> Expr<R> mkITE(Expr<BoolSort> t1, Expr<? extends R> t2, Expr<? extends R> t3) Create an expression representing an if-then-else:ite(t1, t2, t3).- Parameters:
t1- An expression with Boolean sortt2- An expressiont3- An expression with the same sort ast2
-
mkIff
Create an expression representingt1 iff t2. -
mkImplies
Create an expression representingt1 -> t2. -
mkXor
Create an expression representingt1 xor t2. -
mkAnd
Create an expression representingt[0] and t[1] and .... -
mkOr
Create an expression representingt[0] or t[1] or .... -
mkAdd
Create an expression representingt[0] + t[1] + .... -
mkMul
Create an expression representingt[0] * t[1] * .... -
mkSub
Create an expression representingt[0] - t[1] - .... -
mkUnaryMinus
Create an expression representing-t. -
mkDiv
Create an expression representingt1 / t2. -
mkMod
Create an expression representingt1 mod t2. Remarks: The arguments must have int type. -
mkRem
Create an expression representingt1 rem t2. Remarks: The arguments must have int type. -
mkPower
Create an expression representingt1 ^ t2. -
mkLt
Create an expression representingt1 < t2 -
mkLe
Create an expression representingt1 <= t2 -
mkGt
Create an expression representingt1 > t2 -
mkGe
Create an expression representingt1 >= t2 -
mkInt2Real
Coerce an integer to a real. Remarks: There is also a converse operation exposed. It follows the semantics prescribed by the SMT-LIB standard. You can take the floor of a real by creating an auxiliary integer Termkand assertingMakeInt2Real(k) <= t1 < MkInt2Real(k)+1. The argument must be of integer sort. -
mkReal2Int
Coerce a real to an integer. Remarks: The semantics of this function follows the SMT-LIB standard for the function to_int. The argument must be of real sort. -
mkIsInteger
Creates an expression that checks whether a real number is an integer. -
mkBVNot
Bitwise negation. Remarks: The argument must have a bit-vector sort. -
mkBVRedAND
Take conjunction of bits in a vector, return vector of length 1. Remarks: The argument must have a bit-vector sort. -
mkBVRedOR
Take disjunction of bits in a vector, return vector of length 1. Remarks: The argument must have a bit-vector sort. -
mkBVAND
Bitwise conjunction. Remarks: The arguments must have a bit-vector sort. -
mkBVOR
Bitwise disjunction. Remarks: The arguments must have a bit-vector sort. -
mkBVXOR
Bitwise XOR. Remarks: The arguments must have a bit-vector sort. -
mkBVNAND
Bitwise NAND. Remarks: The arguments must have a bit-vector sort. -
mkBVNOR
Bitwise NOR. Remarks: The arguments must have a bit-vector sort. -
mkBVXNOR
Bitwise XNOR. Remarks: The arguments must have a bit-vector sort. -
mkBVNeg
Standard two's complement unary minus. Remarks: The arguments must have a bit-vector sort. -
mkBVAdd
Two's complement addition. Remarks: The arguments must have the same bit-vector sort. -
mkBVSub
Two's complement subtraction. Remarks: The arguments must have the same bit-vector sort. -
mkBVMul
Two's complement multiplication. Remarks: The arguments must have the same bit-vector sort. -
mkBVUDiv
Unsigned division. Remarks: It is defined as the floor oft1/t2if \c t2 is different from zero. Ift2is zero, then the result is undefined. The arguments must have the same bit-vector sort. -
mkBVSDiv
Signed division. Remarks: It is defined in the following way: - The \c floor oft1/t2if \c t2 is different from zero, andt1*t2 >= 0. - The \c ceiling oft1/t2if \c t2 is different from zero, andt1*t2 < 0. Ift2is zero, then the result is undefined. The arguments must have the same bit-vector sort. -
mkBVURem
Unsigned remainder. Remarks: It is defined ast1 - (t1 /u t2) * t2, where/urepresents unsigned division. Ift2is zero, then the result is undefined. The arguments must have the same bit-vector sort. -
mkBVSRem
Signed remainder. Remarks: It is defined ast1 - (t1 /s t2) * t2, where/srepresents signed division. The most significant bit (sign) of the result is equal to the most significant bit of \c t1. Ift2is zero, then the result is undefined. The arguments must have the same bit-vector sort. -
mkBVSMod
Two's complement signed remainder (sign follows divisor). Remarks: Ift2is zero, then the result is undefined. The arguments must have the same bit-vector sort. -
mkBVULT
Unsigned less-than Remarks: The arguments must have the same bit-vector sort. -
mkBVSLT
Two's complement signed less-than Remarks: The arguments must have the same bit-vector sort. -
mkBVULE
Unsigned less-than or equal to. Remarks: The arguments must have the same bit-vector sort. -
mkBVSLE
Two's complement signed less-than or equal to. Remarks: The arguments must have the same bit-vector sort. -
mkBVUGE
Unsigned greater than or equal to. Remarks: The arguments must have the same bit-vector sort. -
mkBVSGE
Two's complement signed greater than or equal to. Remarks: The arguments must have the same bit-vector sort. -
mkBVUGT
Unsigned greater-than. Remarks: The arguments must have the same bit-vector sort. -
mkBVSGT
Two's complement signed greater-than. Remarks: The arguments must have the same bit-vector sort. -
mkConcat
Bit-vector concatenation. Remarks: The arguments must have a bit-vector sort.- Returns:
- The result is a bit-vector of size
n1+n2, wheren1(n2) is the size oft1(t2).
-
mkExtract
Bit-vector extraction. Remarks: Extract the bitshighdown tolowfrom a bitvector of sizemto yield a new bitvector of sizen, wheren = high - low + 1. The argumenttmust have a bit-vector sort. -
mkSignExt
Bit-vector sign extension. Remarks: Sign-extends the given bit-vector to the (signed) equivalent bitvector of sizem+i, where \c m is the size of the given bit-vector. The argumenttmust have a bit-vector sort. -
mkZeroExt
Bit-vector zero extension. Remarks: Extend the given bit-vector with zeros to the (unsigned) equivalent bitvector of sizem+i, where \c m is the size of the given bit-vector. The argumenttmust have a bit-vector sort. -
mkRepeat
Bit-vector repetition. Remarks: The argumenttmust have a bit-vector sort. -
mkBVSHL
Shift left. Remarks: It is equivalent to multiplication by2^xwhere \c x is the value oft2. NB. The semantics of shift operations varies between environments. This definition does not necessarily capture directly the semantics of the programming language or assembly architecture you are modeling. The arguments must have a bit-vector sort. -
mkBVLSHR
Logical shift right Remarks: It is equivalent to unsigned division by2^xwhere \c x is the value oft2. NB. The semantics of shift operations varies between environments. This definition does not necessarily capture directly the semantics of the programming language or assembly architecture you are modeling. The arguments must have a bit-vector sort. -
mkBVASHR
Arithmetic shift right Remarks: It is like logical shift right except that the most significant bits of the result always copy the most significant bit of the second argument. NB. The semantics of shift operations varies between environments. This definition does not necessarily capture directly the semantics of the programming language or assembly architecture you are modeling. The arguments must have a bit-vector sort. -
mkBVRotateLeft
Rotate Left. Remarks: Rotate bits of \c t to the left \c i times. The argumenttmust have a bit-vector sort. -
mkBVRotateRight
Rotate Right. Remarks: Rotate bits of \c t to the right \c i times. The argumenttmust have a bit-vector sort. -
mkBVRotateLeft
Rotate Left. Remarks: Rotate bits oft1to the leftt2times. The arguments must have the same bit-vector sort. -
mkBVRotateRight
Rotate Right. Remarks: Rotate bits oft1to the rightt2times. The arguments must have the same bit-vector sort. -
mkInt2BV
Create annbit bit-vector from the integer argumentt. Remarks: NB. This function is essentially treated as uninterpreted. So you cannot expect Z3 to precisely reflect the semantics of this function when solving constraints with this function. The argument must be of integer sort. -
mkBV2Int
Create an integer from the bit-vector argumentt. Remarks: If \c is_signed is false, then the bit-vector \c t1 is treated as unsigned. So the result is non-negative and in the range[0..2^N-1], where N are the number of bits int. If \c is_signed is true, \c t1 is treated as a signed bit-vector. NB. This function is essentially treated as uninterpreted. So you cannot expect Z3 to precisely reflect the semantics of this function when solving constraints with this function. The argument must be of bit-vector sort. -
mkBVAddNoOverflow
Create a predicate that checks that the bit-wise addition does not overflow. Remarks: The arguments must be of bit-vector sort. -
mkBVAddNoUnderflow
Create a predicate that checks that the bit-wise addition does not underflow. Remarks: The arguments must be of bit-vector sort. -
mkBVSubNoOverflow
Create a predicate that checks that the bit-wise subtraction does not overflow. Remarks: The arguments must be of bit-vector sort. -
mkBVSubNoUnderflow
Create a predicate that checks that the bit-wise subtraction does not underflow. Remarks: The arguments must be of bit-vector sort. -
mkBVSDivNoOverflow
Create a predicate that checks that the bit-wise signed division does not overflow. Remarks: The arguments must be of bit-vector sort. -
mkBVNegNoOverflow
Create a predicate that checks that the bit-wise negation does not overflow. Remarks: The arguments must be of bit-vector sort. -
mkBVMulNoOverflow
Create a predicate that checks that the bit-wise multiplication does not overflow. Remarks: The arguments must be of bit-vector sort. -
mkBVMulNoUnderflow
Create a predicate that checks that the bit-wise multiplication does not underflow. Remarks: The arguments must be of bit-vector sort. -
mkArrayConst
Create an array constant. -
mkArrayConst
Create an array constant. -
mkSelect
Array read. Remarks: The argumentais the array andiis the index of the array that gets read. The nodeamust have an array sort[domain -> range], andimust have the sortdomain. The sort of the result isrange. -
mkSelect
Array read. Remarks: The argumentais the array andargsare the indices of the array that gets read. The nodeamust have an array sort[domains -> range], andargsmust have the sortsdomains. The sort of the result isrange. -
mkStore
public <D extends Sort,R extends Sort> ArrayExpr<D,R> mkStore(Expr<ArraySort<D, R>> a, Expr<D> i, Expr<R> v) Array update. Remarks: The nodeamust have an array sort[domain -> range],imust have sortdomain,vmust have sort range. The sort of the result is[domain -> range]. The semantics of this function is given by the theory of arrays described in the SMT-LIB standard. See http://smtlib.org for more details. The result of this function is an array that is equal toa(with respect toselect) on all indices except fori, where it maps tov(and theselectofawith respect toimay be a different value). -
mkStore
public <R extends Sort> ArrayExpr<Sort,R> mkStore(Expr<ArraySort<Sort, R>> a, Expr<?>[] args, Expr<R> v) Array update. Remarks: The nodeamust have an array sort[domains -> range],imust have sortdomain,vmust have sort range. The sort of the result is[domains -> range]. The semantics of this function is given by the theory of arrays described in the SMT-LIB standard. See http://smtlib.org for more details. The result of this function is an array that is equal toa(with respect toselect) on all indices except forargs, where it maps tov(and theselectofawith respect toargsmay be a different value). -
mkConstArray
Create a constant array. Remarks: The resulting term is an array, such that aselecton an arbitrary index produces the valuev. -
mkMap
@SafeVarargs public final <D extends Sort,R1 extends Sort, ArrayExpr<D,R2 extends Sort> R2> mkMap(FuncDecl<R2> f, Expr<ArraySort<D, R1>>... args) Maps f on the argument arrays. Remarks: Each element ofargsmust be of an array sort[domain_i -> range_i]. The function declarationfmust have typerange_1 .. range_n -> range.vmust have sort range. The sort of the result is[domain_i -> range]. -
mkTermArray
Access the array default value. Remarks: Produces the default range value, for arrays that can be represented as finite maps with a default range value. -
mkArrayExt
public <D extends Sort,R extends Sort> Expr<D> mkArrayExt(Expr<ArraySort<D, R>> arg1, Expr<ArraySort<D, R>> arg2) Create Extentionality index. Two arrays are equal if and only if they are equal on the index returned by MkArrayExt. -
mkSetSort
Create a set type. -
mkEmptySet
Create an empty set. -
mkFullSet
Create the full set. -
mkSetAdd
public <D extends Sort> ArrayExpr<D,BoolSort> mkSetAdd(Expr<ArraySort<D, BoolSort>> set, Expr<D> element) Add an element to the set. -
mkSetDel
public <D extends Sort> ArrayExpr<D,BoolSort> mkSetDel(Expr<ArraySort<D, BoolSort>> set, Expr<D> element) Remove an element from a set. -
mkSetUnion
@SafeVarargs public final <D extends Sort> ArrayExpr<D,BoolSort> mkSetUnion(Expr<ArraySort<D, BoolSort>>... args) Take the union of a list of sets. -
mkSetIntersection
@SafeVarargs public final <D extends Sort> ArrayExpr<D,BoolSort> mkSetIntersection(Expr<ArraySort<D, BoolSort>>... args) Take the intersection of a list of sets. -
mkSetDifference
public <D extends Sort> ArrayExpr<D,BoolSort> mkSetDifference(Expr<ArraySort<D, BoolSort>> arg1, Expr<ArraySort<D, BoolSort>> arg2) Take the difference between two sets. -
mkSetComplement
Take the complement of a set. -
mkSetMembership
Check for set membership. -
mkSetSubset
public <D extends Sort> BoolExpr mkSetSubset(Expr<ArraySort<D, BoolSort>> arg1, Expr<ArraySort<D, BoolSort>> arg2) Check for subsetness of sets. -
mkEmptySeq
Create the empty sequence. -
mkUnit
Create the singleton sequence. -
mkString
Create a string constant. -
intToString
Convert an integer expression to a string. -
ubvToString
Convert an unsigned bitvector expression to a string. -
sbvToString
Convert an signed bitvector expression to a string. -
stringToInt
Convert an integer expression to a string. -
mkConcat
Concatenate sequences. -
mkLength
Retrieve the length of a given sequence. -
mkPrefixOf
Check for sequence prefix. -
mkSuffixOf
Check for sequence suffix. -
mkContains
Check for sequence containment of s2 in s1. -
MkStringLt
Check if the string s1 is lexicographically strictly less than s2. -
MkStringLe
Check if the string s1 is lexicographically less or equal to s2. -
mkAt
Retrieve sequence of length one at index. -
mkNth
Retrieve element at index. -
mkExtract
public <R extends Sort> SeqExpr<R> mkExtract(Expr<SeqSort<R>> s, Expr<IntSort> offset, Expr<IntSort> length) Extract subsequence. -
mkIndexOf
public <R extends Sort> IntExpr mkIndexOf(Expr<SeqSort<R>> s, Expr<SeqSort<R>> substr, Expr<IntSort> offset) Extract index of sub-string starting at offset. -
mkReplace
public <R extends Sort> SeqExpr<R> mkReplace(Expr<SeqSort<R>> s, Expr<SeqSort<R>> src, Expr<SeqSort<R>> dst) Replace the first occurrence of src by dst in s. -
mkToRe
Convert a regular expression that accepts sequence s. -
mkInRe
Check for regular expression membership. -
mkStar
Take the Kleene star of a regular expression. -
mkPower
Create power regular expression. -
mkLoop
Take the lower and upper-bounded Kleene star of a regular expression. -
mkLoop
Take the lower-bounded Kleene star of a regular expression. -
mkPlus
Take the Kleene plus of a regular expression. -
mkOption
Create the optional regular expression. -
mkComplement
Create the complement regular expression. -
mkConcat
Create the concatenation of regular languages. -
mkUnion
Create the union of regular languages. -
mkIntersect
Create the intersection of regular languages. -
mkDiff
Create a difference regular expression. -
mkEmptyRe
Create the empty regular expression. Coresponds to re.none -
mkFullRe
Create the full regular expression. Corresponds to re.all -
mkAllcharRe
Create regular expression that accepts all characters Corresponds to re.allchar -
mkRange
Create a range expression. -
mkCharLe
Create less than or equal to between two characters. -
charToInt
Create an integer (code point) from character. -
charToBv
Create a bit-vector (code point) from character. -
charFromBv
Create a character from a bit-vector (code point). -
mkIsDigit
Create a check if the character is a digit. -
mkAtMost
Create an at-most-k constraint. -
mkAtLeast
Create an at-least-k constraint. -
mkPBLe
Create a pseudo-Boolean less-or-equal constraint. -
mkPBGe
Create a pseudo-Boolean greater-or-equal constraint. -
mkPBEq
Create a pseudo-Boolean equal constraint. -
mkNumeral
Create a Term of a given sort.- Parameters:
v- A string representing the term value in decimal notation. If the given sort is a real, then the Term can be a rational, that is, a string of the form[num]* / [num]*.ty- The sort of the numeral. In the current implementation, the given sort can be an int, real, or bit-vectors of arbitrary size.- Returns:
- A Term with value
vand sortty
-
mkNumeral
Create a Term of a given sort. This function can be used to create numerals that fit in a machine integer. It is slightly faster thanMakeNumeralsince it is not necessary to parse a string.- Parameters:
v- Value of the numeralty- Sort of the numeral- Returns:
- A Term with value
vand typety
-
mkNumeral
Create a Term of a given sort. This function can be used to create numerals that fit in a machine integer. It is slightly faster thanMakeNumeralsince it is not necessary to parse a string.- Parameters:
v- Value of the numeralty- Sort of the numeral- Returns:
- A Term with value
vand typety
-
mkReal
Create a real from a fraction.- Parameters:
num- numerator of rational.den- denominator of rational.- Returns:
- A Term with value
num/denand sort Real - See Also:
-
mkReal
Create a real numeral.- Parameters:
v- A string representing the Term value in decimal notation.- Returns:
- A Term with value
vand sort Real
-
mkReal
Create a real numeral.- Parameters:
v- value of the numeral.- Returns:
- A Term with value
vand sort Real
-
mkReal
Create a real numeral.- Parameters:
v- value of the numeral.- Returns:
- A Term with value
vand sort Real
-
mkInt
Create an integer numeral.- Parameters:
v- A string representing the Term value in decimal notation.
-
mkInt
Create an integer numeral.- Parameters:
v- value of the numeral.- Returns:
- A Term with value
vand sort Integer
-
mkInt
Create an integer numeral.- Parameters:
v- value of the numeral.- Returns:
- A Term with value
vand sort Integer
-
mkBV
Create a bit-vector numeral.- Parameters:
v- A string representing the value in decimal notation.size- the size of the bit-vector
-
mkBV
Create a bit-vector numeral.- Parameters:
v- value of the numeral.size- the size of the bit-vector
-
mkBV
Create a bit-vector numeral.- Parameters:
v- value of the numeral. *size- the size of the bit-vector
-
mkForall
public Quantifier mkForall(Sort[] sorts, Symbol[] names, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Create a universal Quantifier.- Parameters:
sorts- the sorts of the bound variables.names- names of the bound variablesbody- the body of the quantifier.weight- quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. By default, pass the weight 0.patterns- array containing the patterns created usingMkPattern.noPatterns- array containing the anti-patterns created usingMkPattern.quantifierID- optional symbol to track quantifier.skolemID- optional symbol to track skolem constants.- Returns:
- Creates a forall formula, where
weightis the weight,patternsis an array of patterns,sortsis an array with the sorts of the bound variables,namesis an array with the 'names' of the bound variables, andbodyis the body of the quantifier. Quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. Note that the bound variables are de-Bruijn indices created usingmkBound(int, R). Z3 applies the convention that the last element innamesandsortsrefers to the variable with index 0, the second to last element ofnamesandsortsrefers to the variable with index 1, etc.
-
mkForall
public Quantifier mkForall(Expr<?>[] boundConstants, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Creates a universal quantifier using a list of constants that will form the set of bound variables. -
mkExists
public Quantifier mkExists(Sort[] sorts, Symbol[] names, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Creates an existential quantifier using de-Bruijn indexed variables. -
mkExists
public Quantifier mkExists(Expr<?>[] boundConstants, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Creates an existential quantifier using a list of constants that will form the set of bound variables. -
mkQuantifier
public Quantifier mkQuantifier(boolean universal, Sort[] sorts, Symbol[] names, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Create a Quantifier. -
mkQuantifier
public Quantifier mkQuantifier(boolean universal, Expr<?>[] boundConstants, Expr<BoolSort> body, int weight, Pattern[] patterns, Expr<?>[] noPatterns, Symbol quantifierID, Symbol skolemID) Create a Quantifier -
mkLambda
Create a lambda expression.sortsis an array with the sorts of the bound variables,namesis an array with the 'names' of the bound variables, andbodyis the body of the lambda. Note that the bound variables are de-Bruijn indices created usingmkBound(int, R)Z3 applies the convention that the last element innamesandsortsrefers to the variable with index 0, the second to last element ofnamesandsortsrefers to the variable with index 1, etc.- Parameters:
sorts- the sorts of the bound variables.names- names of the bound variables.body- the body of the quantifier.
-
mkLambda
Create a lambda expression. Creates a lambda expression using a list of constants that will form the set of bound variables. -
setPrintMode
Selects the format used for pretty-printing expressions. Remarks: The default mode for pretty printing expressions is to produce SMT-LIB style output where common subexpressions are printed at each occurrence. The mode is called Z3_PRINT_SMTLIB_FULL. To print shared common subexpressions only once, use the Z3_PRINT_LOW_LEVEL mode. To print in way that conforms to SMT-LIB standards and uses let expressions to share common sub-expressions use Z3_PRINT_SMTLIB_COMPLIANT. -
benchmarkToSMTString
public String benchmarkToSMTString(String name, String logic, String status, String attributes, Expr<BoolSort>[] assumptions, Expr<BoolSort> formula) Convert a benchmark into an SMT-LIB formatted string.- Parameters:
name- Name of the benchmark. The argument is optional.logic- The benchmark logic.status- The status string (sat, unsat, or unknown)attributes- Other attributes, such as source, difficulty or category.assumptions- Auxiliary assumptions.formula- Formula to be checked for consistency in conjunction with assumptions.- Returns:
- A string representation of the benchmark.
-
parseSMTLIB2String
public BoolExpr[] parseSMTLIB2String(String str, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl<?>[] decls) Parse the given string using the SMT-LIB2 parser.- Returns:
- A conjunction of assertions. If the string contains push/pop commands, the set of assertions returned are the ones in the last scope level.
-
parseSMTLIB2File
public BoolExpr[] parseSMTLIB2File(String fileName, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl<?>[] decls) Parse the given file using the SMT-LIB2 parser. -
mkGoal
Creates a new Goal. Remarks: Note that the Context must have been created with proof generation support ifproofsis set to true here.- Parameters:
models- Indicates whether model generation should be enabled.unsatCores- Indicates whether unsat core generation should be enabled.proofs- Indicates whether proof generation should be enabled.
-
mkParams
Creates a new ParameterSet. -
getNumTactics
public int getNumTactics()The number of supported tactics. -
getTacticNames
The names of all supported tactics. -
getTacticDescription
Returns a string containing a description of the tactic with the given name. -
mkTactic
Creates a new Tactic. -
andThen
Create a tactic that appliest1to a Goal and thent2to every subgoal produced byt1 -
then
Create a tactic that appliest1to a Goal and thent2to every subgoal produced byt1Remarks: Shorthand forAndThen. -
orElse
Create a tactic that first appliest1to a Goal and if it fails then returns the result oft2applied to the Goal. -
tryFor
Create a tactic that appliestto a goal formsmilliseconds. Remarks: Iftdoes not terminate withinmsmilliseconds, then it fails. -
when
Create a tactic that appliestto a given goal if the probepevaluates to true. Remarks: Ifpevaluates to false, then the new tactic behaves like theskiptactic. -
cond
Create a tactic that appliest1to a given goal if the probepevaluates to true andt2otherwise. -
repeat
Create a tactic that keeps applyingtuntil the goal is not modified anymore or the maximum number of iterationsmaxis reached. -
skip
Create a tactic that just returns the given goal. -
fail
Create a tactic always fails. -
failIf
Create a tactic that fails if the probepevaluates to false. -
failIfNotDecided
Create a tactic that fails if the goal is not trivially satisfiable (i.e., empty) or trivially unsatisfiable (i.e., contains `false'). -
usingParams
Create a tactic that appliestusing the given set of parametersp. -
with
Create a tactic that appliestusing the given set of parametersp. Remarks: Alias forUsingParams -
parOr
Create a tactic that applies the given tactics in parallel until one of them succeeds (i.e., the first that doesn't fail). -
parAndThen
Create a tactic that appliest1to a given goal and thent2to every subgoal produced byt1. The subgoals are processed in parallel. -
interrupt
public void interrupt()Interrupt the execution of a Z3 procedure. Remarks: This procedure can be used to interrupt: solvers, simplifiers and tactics. -
getNumProbes
public int getNumProbes()The number of supported Probes. -
getProbeNames
The names of all supported Probes. -
getProbeDescription
Returns a string containing a description of the probe with the given name. -
mkProbe
Creates a new Probe. -
constProbe
Create a probe that always evaluates toval. -
lt
Create a probe that evaluates totruewhen the value returned byp1is less than the value returned byp2 -
gt
Create a probe that evaluates totruewhen the value returned byp1is greater than the value returned byp2 -
le
Create a probe that evaluates totruewhen the value returned byp1is less than or equal the value returned byp2 -
ge
Create a probe that evaluates totruewhen the value returned byp1is greater than or equal the value returned byp2 -
eq
Create a probe that evaluates totruewhen the value returned byp1is equal to the value returned byp2 -
and
Create a probe that evaluates totruewhen the valuep1andp2evaluate totrue. -
or
Create a probe that evaluates totruewhen the valuep1orp2evaluate totrue. -
not
Create a probe that evaluates totruewhen the valuepdoes not evaluate totrue. -
mkSolver
Creates a new (incremental) solver. Remarks: This solver also uses a set of builtin tactics for handling the first check-sat command, and check-sat commands that take more than a given number of milliseconds to be solved. -
mkSolver
Creates a new (incremental) solver. Remarks: This solver also uses a set of builtin tactics for handling the first check-sat command, and check-sat commands that take more than a given number of milliseconds to be solved. -
mkSolver
Creates a new (incremental) solver.- See Also:
-
mkSimpleSolver
Creates a new (incremental) solver. -
mkSolver
Creates a solver that is implemented using the given tactic. Remarks: The solver supports the commandsPushandPop, but it will always solve each check from scratch. -
mkFixedpoint
Create a Fixedpoint context. -
mkOptimize
Create a Optimize context. -
mkFPRoundingModeSort
Create the floating-point RoundingMode sort.- Throws:
Z3Exception
-
mkFPRoundNearestTiesToEven
Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.- Throws:
Z3Exception
-
mkFPRNE
Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.- Throws:
Z3Exception
-
mkFPRoundNearestTiesToAway
Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.- Throws:
Z3Exception
-
mkFPRNA
Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.- Throws:
Z3Exception
-
mkFPRoundTowardPositive
Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.- Throws:
Z3Exception
-
mkFPRTP
Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.- Throws:
Z3Exception
-
mkFPRoundTowardNegative
Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.- Throws:
Z3Exception
-
mkFPRTN
Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.- Throws:
Z3Exception
-
mkFPRoundTowardZero
Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.- Throws:
Z3Exception
-
mkFPRTZ
Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.- Throws:
Z3Exception
-
mkFPSort
Create a FloatingPoint sort.- Parameters:
ebits- exponent bits in the FloatingPoint sort.sbits- significand bits in the FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSortHalf
Create the half-precision (16-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSort16
Create the half-precision (16-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSortSingle
Create the single-precision (32-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSort32
Create the single-precision (32-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSortDouble
Create the double-precision (64-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSort64
Create the double-precision (64-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSortQuadruple
Create the quadruple-precision (128-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPSort128
Create the quadruple-precision (128-bit) FloatingPoint sort.- Throws:
Z3Exception
-
mkFPNaN
Create a NaN of sort s.- Parameters:
s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFPInf
Create a floating-point infinity of sort s.- Parameters:
s- FloatingPoint sort.negative- indicates whether the result should be negative.- Throws:
Z3Exception
-
mkFPZero
Create a floating-point zero of sort s.- Parameters:
s- FloatingPoint sort.negative- indicates whether the result should be negative.- Throws:
Z3Exception
-
mkFPNumeral
Create a numeral of FloatingPoint sort from a float.- Parameters:
v- numeral value.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFPNumeral
Create a numeral of FloatingPoint sort from a double.- Parameters:
v- numeral value.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFPNumeral
Create a numeral of FloatingPoint sort from an int.- Parameters:
v- numeral value.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFPNumeral
Create a numeral of FloatingPoint sort from a sign bit and two integers.- Parameters:
sgn- the sign.exp- the exponent.sig- the significand.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFPNumeral
Create a numeral of FloatingPoint sort from a sign bit and two 64-bit integers.- Parameters:
sgn- the sign.exp- the exponent.sig- the significand.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFP
Create a numeral of FloatingPoint sort from a float.- Parameters:
v- numeral value.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFP
Create a numeral of FloatingPoint sort from a double.- Parameters:
v- numeral value.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFP
Create a numeral of FloatingPoint sort from an int.- Parameters:
v- numeral value.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFP
Create a numeral of FloatingPoint sort from a sign bit and two integers.- Parameters:
sgn- the sign.exp- the exponent.sig- the significand.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFP
Create a numeral of FloatingPoint sort from a sign bit and two 64-bit integers.- Parameters:
sgn- the sign.exp- the exponent.sig- the significand.s- FloatingPoint sort.- Throws:
Z3Exception
-
mkFPAbs
Floating-point absolute value- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPNeg
Floating-point negation- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPAdd
Floating-point addition- Parameters:
rm- rounding mode termt1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPSub
Floating-point subtraction- Parameters:
rm- rounding mode termt1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPMul
Floating-point multiplication- Parameters:
rm- rounding mode termt1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPDiv
Floating-point division- Parameters:
rm- rounding mode termt1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPFMA
Floating-point fused multiply-add- Parameters:
rm- rounding mode termt1- floating-point termt2- floating-point termt3- floating-point term Remarks: The result is round((t1 * t2) + t3)- Throws:
Z3Exception
-
mkFPSqrt
Floating-point square root- Parameters:
rm- rounding mode termt- floating-point term- Throws:
Z3Exception
-
mkFPRem
Floating-point remainder- Parameters:
t1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPRoundToIntegral
Floating-point roundToIntegral. Rounds a floating-point number to the closest integer, again represented as a floating-point number.- Parameters:
rm- term of RoundingMode sortt- floating-point term- Throws:
Z3Exception
-
mkFPMin
Minimum of floating-point numbers.- Parameters:
t1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPMax
Maximum of floating-point numbers.- Parameters:
t1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPLEq
Floating-point less than or equal.- Parameters:
t1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPLt
Floating-point less than.- Parameters:
t1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPGEq
Floating-point greater than or equal.- Parameters:
t1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPGt
Floating-point greater than.- Parameters:
t1- floating-point termt2- floating-point term- Throws:
Z3Exception
-
mkFPEq
Floating-point equality.- Parameters:
t1- floating-point termt2- floating-point term Remarks: Note that this is IEEE 754 equality (as opposed to standard =).- Throws:
Z3Exception
-
mkFPIsNormal
Predicate indicating whether t is a normal floating-point number.\- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPIsSubnormal
Predicate indicating whether t is a subnormal floating-point number.\- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPIsZero
Predicate indicating whether t is a floating-point number with zero value, i.e., +0 or -0.- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPIsInfinite
Predicate indicating whether t is a floating-point number representing +oo or -oo.- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPIsNaN
Predicate indicating whether t is a NaN.- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPIsNegative
Predicate indicating whether t is a negative floating-point number.- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFPIsPositive
Predicate indicating whether t is a positive floating-point number.- Parameters:
t- floating-point term- Throws:
Z3Exception
-
mkFP
Create an expression of FloatingPoint sort from three bit-vector expressions.- Parameters:
sgn- bit-vector term (of size 1) representing the sign.sig- bit-vector term representing the significand.exp- bit-vector term representing the exponent. Remarks: This is the operator named `fp' in the SMT FP theory definition. Note that sgn is required to be a bit-vector of size 1. Significand and exponent are required to be greater than 1 and 2 respectively. The FloatingPoint sort of the resulting expression is automatically determined from the bit-vector sizes of the arguments.- Throws:
Z3Exception
-
mkFPToFP
Conversion of a single IEEE 754-2008 bit-vector into a floating-point number.- Parameters:
bv- bit-vector value (of size m).s- FloatingPoint sort (ebits+sbits == m) Remarks: Produces a term that represents the conversion of a bit-vector term bv to a floating-point term of sort s. The bit-vector size of bv (m) must be equal to ebits+sbits of s. The format of the bit-vector is as defined by the IEEE 754-2008 interchange format.- Throws:
Z3Exception
-
mkFPToFP
Conversion of a FloatingPoint term into another term of different FloatingPoint sort.- Parameters:
rm- RoundingMode term.t- FloatingPoint term.s- FloatingPoint sort. Remarks: Produces a term that represents the conversion of a floating-point term t to a floating-point term of sort s. If necessary, the result will be rounded according to rounding mode rm.- Throws:
Z3Exception
-
mkFPToFP
Conversion of a term of real sort into a term of FloatingPoint sort.- Parameters:
rm- RoundingMode term.t- term of Real sort.s- FloatingPoint sort. Remarks: Produces a term that represents the conversion of term t of real sort into a floating-point term of sort s. If necessary, the result will be rounded according to rounding mode rm.- Throws:
Z3Exception
-
mkFPToFP
Conversion of a 2's complement signed bit-vector term into a term of FloatingPoint sort.- Parameters:
rm- RoundingMode term.t- term of bit-vector sort.s- FloatingPoint sort.signed- flag indicating whether t is interpreted as signed or unsigned bit-vector. Remarks: Produces a term that represents the conversion of the bit-vector term t into a floating-point term of sort s. The bit-vector t is taken to be in signed 2's complement format (when signed==true, otherwise unsigned). If necessary, the result will be rounded according to rounding mode rm.- Throws:
Z3Exception
-
mkFPToFP
Conversion of a floating-point number to another FloatingPoint sort s.- Parameters:
s- FloatingPoint sortrm- floating-point rounding mode termt- floating-point term Remarks: Produces a term that represents the conversion of a floating-point term t to a different FloatingPoint sort s. If necessary, rounding according to rm is applied.- Throws:
Z3Exception
-
mkFPToBV
Conversion of a floating-point term into a bit-vector.- Parameters:
rm- RoundingMode term.t- FloatingPoint termsz- Size of the resulting bit-vector.signed- Indicates whether the result is a signed or unsigned bit-vector. Remarks: Produces a term that represents the conversion of the floating-point term t into a bit-vector term of size sz in 2's complement format (signed when signed==true). If necessary, the result will be rounded according to rounding mode rm.- Throws:
Z3Exception
-
mkFPToReal
Conversion of a floating-point term into a real-numbered term.- Parameters:
t- FloatingPoint term Remarks: Produces a term that represents the conversion of the floating-point term t into a real number. Note that this type of conversion will often result in non-linear constraints over real terms.- Throws:
Z3Exception
-
mkFPToIEEEBV
Conversion of a floating-point term into a bit-vector term in IEEE 754-2008 format.- Parameters:
t- FloatingPoint term. Remarks: The size of the resulting bit-vector is automatically determined. Note that IEEE 754-2008 allows multiple different representations of NaN. This conversion knows only one NaN and it will always produce the same bit-vector representation of that NaN.- Throws:
Z3Exception
-
mkFPToFP
Conversion of a real-sorted significand and an integer-sorted exponent into a term of FloatingPoint sort.- Parameters:
rm- RoundingMode term.exp- Exponent term of Int sort.sig- Significand term of Real sort.s- FloatingPoint sort. Remarks: Produces a term that represents the conversion of sig * 2^exp into a floating-point term of sort s. If necessary, the result will be rounded according to rounding mode rm.- Throws:
Z3Exception
-
mkLinearOrder
Creates or a linear order.- Parameters:
index- The index of the order.sort- The sort of the order.
-
mkPartialOrder
Creates or a partial order.- Parameters:
index- The index of the order.sort- The sort of the order.
-
wrapAST
Wraps an AST. Remarks: This function is used for transitions between native and managed objects. Note thatnativeObjectmust be a native object obtained from Z3 (e.g., throughUnwrapAST) and that it must have a correct reference count.- Parameters:
nativeObject- The native pointer to wrap.- See Also:
-
unwrapAST
Unwraps an AST. Remarks: This function is used for transitions between native and managed objects. It returns the native pointer to the AST. Note that AST objects are reference counted and unwrapping an AST disables automatic reference counting, i.e., all references to the IntPtr that is returned must be handled externally and through native calls (see e.g.,- Parameters:
a- The AST to unwrap.- See Also:
-
SimplifyHelp
Return a string describing all available parameters toExpr.Simplify. -
getSimplifyParameterDescriptions
Retrieves parameter descriptions for simplifier. -
updateParamValue
Update a mutable configuration parameter. Remarks: The list of all configuration parameters can be obtained using the Z3 executable:z3.exe -ini?Only a few configuration parameters are mutable once the context is created. An exception is thrown when trying to modify an immutable parameter. -
nCtx
public long nCtx() -
getConstructorDRQ
-
getConstructorListDRQ
-
getASTDRQ
-
getASTMapDRQ
-
getASTVectorDRQ
-
getApplyResultDRQ
-
getFuncEntryDRQ
-
getFuncInterpDRQ
-
getGoalDRQ
-
getModelDRQ
-
getParamsDRQ
-
getParamDescrsDRQ
-
getProbeDRQ
-
getSolverDRQ
-
getStatisticsDRQ
-
getTacticDRQ
-
getFixedpointDRQ
-
getOptimizeDRQ
-
close
public void close()Disposes of the context.- Specified by:
closein interfaceAutoCloseable
-