Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.microsoft.z3.Context Maven / Gradle / Ivy
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
Context.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
import static com.microsoft.z3.Constructor.of;
import com.microsoft.z3.enumerations.Z3_ast_print_mode;
import java.util.Map;
/**
* 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.
**/
@SuppressWarnings("unchecked")
public class Context implements AutoCloseable {
private long m_ctx;
static final Object creation_lock = new Object();
public Context () {
synchronized (creation_lock) {
m_ctx = Native.mkContextRc(0);
init();
}
}
protected Context (long m_ctx) {
synchronized (creation_lock) {
this.m_ctx = m_ctx;
init();
}
}
/**
* 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 use {@code Global.setParameter}
**/
public Context(Map settings) {
synchronized (creation_lock) {
long cfg = Native.mkConfig();
for (Map.Entry kv : settings.entrySet()) {
Native.setParamValue(cfg, kv.getKey(), kv.getValue());
}
m_ctx = Native.mkContextRc(cfg);
Native.delConfig(cfg);
init();
}
}
private void init() {
setPrintMode(Z3_ast_print_mode.Z3_PRINT_SMTLIB2_COMPLIANT);
Native.setInternalErrorHandler(m_ctx);
}
/**
* 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.
**/
public IntSymbol mkSymbol(int i)
{
return new IntSymbol(this, i);
}
/**
* Create a symbol using a string.
**/
public StringSymbol mkSymbol(String name)
{
return new StringSymbol(this, name);
}
/**
* Create an array of symbols.
**/
Symbol[] mkSymbols(String[] names)
{
if (names == null)
return new Symbol[0];
Symbol[] result = new Symbol[names.length];
for (int i = 0; i < names.length; ++i)
result[i] = mkSymbol(names[i]);
return result;
}
private BoolSort m_boolSort = null;
private IntSort m_intSort = null;
private RealSort m_realSort = null;
private SeqSort m_stringSort = null;
/**
* Retrieves the Boolean sort of the context.
**/
public BoolSort getBoolSort()
{
if (m_boolSort == null) {
m_boolSort = new BoolSort(this);
}
return m_boolSort;
}
/**
* Retrieves the Integer sort of the context.
**/
public IntSort getIntSort()
{
if (m_intSort == null) {
m_intSort = new IntSort(this);
}
return m_intSort;
}
/**
* Retrieves the Real sort of the context.
**/
public RealSort getRealSort()
{
if (m_realSort == null) {
m_realSort = new RealSort(this);
}
return m_realSort;
}
/**
* Create a new Boolean sort.
**/
public BoolSort mkBoolSort()
{
return new BoolSort(this);
}
/**
* Creates character sort object.
**/
public CharSort mkCharSort()
{
return new CharSort(this);
}
/**
* Retrieves the String sort of the context.
**/
public SeqSort getStringSort()
{
if (m_stringSort == null) {
m_stringSort = mkStringSort();
}
return m_stringSort;
}
/**
* Create a new uninterpreted sort.
**/
public UninterpretedSort mkUninterpretedSort(Symbol s)
{
checkContextMatch(s);
return new UninterpretedSort(this, s);
}
/**
* Create a new uninterpreted sort.
**/
public UninterpretedSort mkUninterpretedSort(String str)
{
return mkUninterpretedSort(mkSymbol(str));
}
/**
* Create a new integer sort.
**/
public IntSort mkIntSort()
{
return new IntSort(this);
}
/**
* Create a real sort.
**/
public RealSort mkRealSort()
{
return new RealSort(this);
}
/**
* Create a new bit-vector sort.
**/
public BitVecSort mkBitVecSort(int size)
{
return new BitVecSort(this, Native.mkBvSort(nCtx(), size));
}
/**
* Create a new array sort.
**/
public final ArraySort mkArraySort(D domain, R range)
{
checkContextMatch(domain);
checkContextMatch(range);
return new ArraySort<>(this, domain, range);
}
/**
* Create a new array sort.
**/
public final ArraySort mkArraySort(Sort[] domains, R range)
{
checkContextMatch(domains);
checkContextMatch(range);
return new ArraySort<>(this, domains, range);
}
/**
* Create a new string sort
**/
public SeqSort mkStringSort()
{
return new SeqSort<>(this, Native.mkStringSort(nCtx()));
}
/**
* Create a new sequence sort
**/
public final SeqSort mkSeqSort(R s)
{
return new SeqSort<>(this, Native.mkSeqSort(nCtx(), s.getNativeObject()));
}
/**
* Create a new regular expression sort
**/
public final ReSort mkReSort(R s)
{
return new ReSort<>(this, Native.mkReSort(nCtx(), s.getNativeObject()));
}
/**
* Create a new tuple sort.
**/
public TupleSort mkTupleSort(Symbol name, Symbol[] fieldNames,
Sort[] fieldSorts)
{
checkContextMatch(name);
checkContextMatch(fieldNames);
checkContextMatch(fieldSorts);
return new TupleSort(this, name, fieldNames.length, fieldNames,
fieldSorts);
}
/**
* Create a new enumeration sort.
**/
public final EnumSort mkEnumSort(Symbol name, Symbol... enumNames)
{
checkContextMatch(name);
checkContextMatch(enumNames);
return new EnumSort<>(this, name, enumNames);
}
/**
* Create a new enumeration sort.
**/
public final EnumSort mkEnumSort(String name, String... enumNames)
{
return new EnumSort<>(this, mkSymbol(name), mkSymbols(enumNames));
}
/**
* Create a new list sort.
**/
public final ListSort mkListSort(Symbol name, R elemSort)
{
checkContextMatch(name);
checkContextMatch(elemSort);
return new ListSort<>(this, name, elemSort);
}
/**
* Create a new list sort.
**/
public final ListSort mkListSort(String name, R elemSort)
{
checkContextMatch(elemSort);
return new ListSort<>(this, mkSymbol(name), elemSort);
}
/**
* Create a new finite domain sort.
**/
public final FiniteDomainSort mkFiniteDomainSort(Symbol name, long size)
{
checkContextMatch(name);
return new FiniteDomainSort<>(this, name, size);
}
/**
* Create a new finite domain sort.
**/
public final FiniteDomainSort mkFiniteDomainSort(String name, long size)
{
return new FiniteDomainSort<>(this, mkSymbol(name), size);
}
/**
* Create a datatype constructor.
* @param name constructor name
* @param recognizer name of recognizer function.
* @param fieldNames names of the constructor fields.
* @param sorts field sorts, 0 if the field sort refers to a recursive sort.
* @param 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.
**/
public final Constructor mkConstructor(Symbol name, Symbol recognizer,
Symbol[] fieldNames, Sort[] sorts, int[] sortRefs)
{
return of(this, name, recognizer, fieldNames, sorts, sortRefs);
}
/**
* Create a datatype constructor.
**/
public final Constructor mkConstructor(String name, String recognizer,
String[] fieldNames, Sort[] sorts, int[] sortRefs)
{
return of(this, mkSymbol(name), mkSymbol(recognizer), mkSymbols(fieldNames), sorts, sortRefs);
}
/**
* Create a new datatype sort.
**/
public final DatatypeSort mkDatatypeSort(Symbol name, Constructor[] constructors)
{
checkContextMatch(name);
checkContextMatch(constructors);
return new DatatypeSort<>(this, name, constructors);
}
/**
* Create a new datatype sort.
**/
public final DatatypeSort mkDatatypeSort(String name, Constructor[] constructors)
{
checkContextMatch(constructors);
return new DatatypeSort<>(this, mkSymbol(name), constructors);
}
/**
* Create mutually recursive datatypes.
* @param names names of datatype sorts
* @param c list of constructors, one list per sort.
**/
public DatatypeSort[] mkDatatypeSorts(Symbol[] names, Constructor[][] c)
{
checkContextMatch(names);
int n = names.length;
ConstructorList[] cla = new ConstructorList[n];
long[] n_constr = new long[n];
for (int i = 0; i < n; i++)
{
Constructor[] constructor = c[i];
checkContextMatch(constructor);
cla[i] = new ConstructorList<>(this, constructor);
n_constr[i] = cla[i].getNativeObject();
}
long[] n_res = new long[n];
Native.mkDatatypes(nCtx(), n, Symbol.arrayToNative(names), n_res,
n_constr);
DatatypeSort[] res = new DatatypeSort[n];
for (int i = 0; i < n; i++)
res[i] = new DatatypeSort<>(this, n_res[i]);
return res;
}
/**
* Create mutually recursive data-types.
**/
public DatatypeSort[] mkDatatypeSorts(String[] names, Constructor[][] c)
{
return mkDatatypeSorts(mkSymbols(names), c);
}
/**
* 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.
**/
public final Expr mkUpdateField(FuncDecl field, Expr t, Expr v)
throws Z3Exception
{
return (Expr) Expr.create(this,
Native.datatypeUpdateField
(nCtx(), field.getNativeObject(),
t.getNativeObject(), v.getNativeObject()));
}
/**
* Creates a new function declaration.
**/
public final FuncDecl mkFuncDecl(Symbol name, Sort[] domain, R range)
{
checkContextMatch(name);
checkContextMatch(domain);
checkContextMatch(range);
return new FuncDecl<>(this, name, domain, range);
}
public final FuncDecl mkPropagateFunction(Symbol name, Sort[] domain, R range)
{
checkContextMatch(name);
checkContextMatch(domain);
checkContextMatch(range);
long f = Native.solverPropagateDeclare(
this.nCtx(),
name.getNativeObject(),
AST.arrayLength(domain),
AST.arrayToNative(domain),
range.getNativeObject());
return new FuncDecl<>(this, f);
}
/**
* Creates a new function declaration.
**/
public final FuncDecl mkFuncDecl(Symbol name, Sort domain, R range)
{
checkContextMatch(name);
checkContextMatch(domain);
checkContextMatch(range);
Sort[] q = new Sort[] { domain };
return new FuncDecl<>(this, name, q, range);
}
/**
* Creates a new function declaration.
**/
public final FuncDecl mkFuncDecl(String name, Sort[] domain, R range)
{
checkContextMatch(domain);
checkContextMatch(range);
return new FuncDecl<>(this, mkSymbol(name), domain, range);
}
/**
* Creates a new function declaration.
**/
public final FuncDecl mkFuncDecl(String name, Sort domain, R range)
{
checkContextMatch(domain);
checkContextMatch(range);
Sort[] q = new Sort[] { domain };
return new FuncDecl<>(this, mkSymbol(name), q, range);
}
/**
* Creates a new recursive function declaration.
**/
public final FuncDecl mkRecFuncDecl(Symbol name, Sort[] domain, R range)
{
checkContextMatch(name);
checkContextMatch(domain);
checkContextMatch(range);
return new FuncDecl<>(this, name, domain, range, true);
}
/**
* 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.
*/
public final void AddRecDef(FuncDecl f, Expr>[] args, Expr body)
{
checkContextMatch(f);
checkContextMatch(args);
checkContextMatch(body);
long[] argsNative = AST.arrayToNative(args);
Native.addRecDef(nCtx(), f.getNativeObject(), args.length, argsNative, body.getNativeObject());
}
/**
* Creates a fresh function declaration with a name prefixed with
* {@code prefix}.
* @see #mkFuncDecl(String,Sort,Sort)
* @see #mkFuncDecl(String,Sort[],Sort)
**/
public final FuncDecl mkFreshFuncDecl(String prefix, Sort[] domain, R range)
{
checkContextMatch(domain);
checkContextMatch(range);
return new FuncDecl<>(this, prefix, domain, range);
}
/**
* Creates a new constant function declaration.
**/
public final FuncDecl mkConstDecl(Symbol name, R range)
{
checkContextMatch(name);
checkContextMatch(range);
return new FuncDecl<>(this, name, null, range);
}
/**
* Creates a new constant function declaration.
**/
public final FuncDecl mkConstDecl(String name, R range)
{
checkContextMatch(range);
return new FuncDecl<>(this, mkSymbol(name), null, range);
}
/**
* Creates a fresh constant function declaration with a name prefixed with
* {@code prefix}.
* @see #mkFuncDecl(String,Sort,Sort)
* @see #mkFuncDecl(String,Sort[],Sort)
**/
public final FuncDecl mkFreshConstDecl(String prefix, R range)
{
checkContextMatch(range);
return new FuncDecl<>(this, prefix, null, range);
}
/**
* Creates a new bound variable.
* @param index The de-Bruijn index of the variable
* @param ty The sort of the variable
**/
public final Expr mkBound(int index, R ty)
{
return (Expr) Expr.create(this,
Native.mkBound(nCtx(), index, ty.getNativeObject()));
}
/**
* Create a quantifier pattern.
**/
@SafeVarargs
public final Pattern mkPattern(Expr>... terms)
{
if (terms.length == 0)
throw new Z3Exception("Cannot create a pattern from zero terms");
long[] termsNative = AST.arrayToNative(terms);
return new Pattern(this, Native.mkPattern(nCtx(), terms.length,
termsNative));
}
/**
* Creates a new Constant of sort {@code range} and named
* {@code name}.
**/
public final Expr mkConst(Symbol name, R range)
{
checkContextMatch(name);
checkContextMatch(range);
return (Expr) Expr.create(
this,
Native.mkConst(nCtx(), name.getNativeObject(),
range.getNativeObject()));
}
/**
* Creates a new Constant of sort {@code range} and named
* {@code name}.
**/
public final Expr mkConst(String name, R range)
{
return mkConst(mkSymbol(name), range);
}
/**
* Creates a fresh Constant of sort {@code range} and a name
* prefixed with {@code prefix}.
**/
public final Expr mkFreshConst(String prefix, R range)
{
checkContextMatch(range);
return (Expr) Expr.create(this,
Native.mkFreshConst(nCtx(), prefix, range.getNativeObject()));
}
/**
* Creates a fresh constant from the FuncDecl {@code f}.
* @param f A decl of a 0-arity function
**/
public final Expr mkConst(FuncDecl f)
{
return mkApp(f, (Expr>[]) null);
}
/**
* Create a Boolean constant.
**/
public BoolExpr mkBoolConst(Symbol name)
{
return (BoolExpr) mkConst(name, getBoolSort());
}
/**
* Create a Boolean constant.
**/
public BoolExpr mkBoolConst(String name)
{
return (BoolExpr) mkConst(mkSymbol(name), getBoolSort());
}
/**
* Creates an integer constant.
**/
public IntExpr mkIntConst(Symbol name)
{
return (IntExpr) mkConst(name, getIntSort());
}
/**
* Creates an integer constant.
**/
public IntExpr mkIntConst(String name)
{
return (IntExpr) mkConst(name, getIntSort());
}
/**
* Creates a real constant.
**/
public RealExpr mkRealConst(Symbol name)
{
return (RealExpr) mkConst(name, getRealSort());
}
/**
* Creates a real constant.
**/
public RealExpr mkRealConst(String name)
{
return (RealExpr) mkConst(name, getRealSort());
}
/**
* Creates a bit-vector constant.
**/
public BitVecExpr mkBVConst(Symbol name, int size)
{
return (BitVecExpr) mkConst(name, mkBitVecSort(size));
}
/**
* Creates a bit-vector constant.
**/
public BitVecExpr mkBVConst(String name, int size)
{
return (BitVecExpr) mkConst(name, mkBitVecSort(size));
}
/**
* Create a new function application.
**/
@SafeVarargs
public final Expr mkApp(FuncDecl f, Expr>... args)
{
checkContextMatch(f);
checkContextMatch(args);
return Expr.create(this, f, args);
}
/**
* The true Term.
**/
public BoolExpr mkTrue()
{
return new BoolExpr(this, Native.mkTrue(nCtx()));
}
/**
* The false Term.
**/
public BoolExpr mkFalse()
{
return new BoolExpr(this, Native.mkFalse(nCtx()));
}
/**
* Creates a Boolean value.
**/
public BoolExpr mkBool(boolean value)
{
return value ? mkTrue() : mkFalse();
}
/**
* Creates the equality {@code x = y}
**/
public BoolExpr mkEq(Expr> x, Expr> y)
{
checkContextMatch(x);
checkContextMatch(y);
return new BoolExpr(this, Native.mkEq(nCtx(), x.getNativeObject(),
y.getNativeObject()));
}
/**
* Creates a {@code distinct} term.
**/
@SafeVarargs
public final BoolExpr mkDistinct(Expr>... args)
{
checkContextMatch(args);
return new BoolExpr(this, Native.mkDistinct(nCtx(), args.length,
AST.arrayToNative(args)));
}
/**
* Create an expression representing {@code not(a)}.
**/
public final BoolExpr mkNot(Expr a)
{
checkContextMatch(a);
return new BoolExpr(this, Native.mkNot(nCtx(), a.getNativeObject()));
}
/**
* Create an expression representing an if-then-else:
* {@code ite(t1, t2, t3)}.
* @param t1 An expression with Boolean sort
* @param t2 An expression
* @param t3 An expression with the same sort as {@code t2}
**/
public final Expr mkITE(Expr t1, Expr extends R> t2, Expr extends R> t3)
{
checkContextMatch(t1);
checkContextMatch(t2);
checkContextMatch(t3);
return (Expr) Expr.create(this, Native.mkIte(nCtx(), t1.getNativeObject(),
t2.getNativeObject(), t3.getNativeObject()));
}
/**
* Create an expression representing {@code t1 iff t2}.
**/
public BoolExpr mkIff(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkIff(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 -> t2}.
**/
public BoolExpr mkImplies(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkImplies(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 xor t2}.
**/
public BoolExpr mkXor(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkXor(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t[0] and t[1] and ...}.
**/
@SafeVarargs
public final BoolExpr mkAnd(Expr... t)
{
checkContextMatch(t);
return new BoolExpr(this, Native.mkAnd(nCtx(), t.length,
AST.arrayToNative(t)));
}
/**
* Create an expression representing {@code t[0] or t[1] or ...}.
**/
@SafeVarargs
public final BoolExpr mkOr(Expr... t)
{
checkContextMatch(t);
return new BoolExpr(this, Native.mkOr(nCtx(), t.length,
AST.arrayToNative(t)));
}
/**
* Create an expression representing {@code t[0] + t[1] + ...}.
**/
@SafeVarargs
public final ArithExpr mkAdd(Expr extends R>... t)
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkAdd(nCtx(), t.length, AST.arrayToNative(t)));
}
/**
* Create an expression representing {@code t[0] * t[1] * ...}.
**/
@SafeVarargs
public final ArithExpr mkMul(Expr extends R>... t)
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkMul(nCtx(), t.length, AST.arrayToNative(t)));
}
/**
* Create an expression representing {@code t[0] - t[1] - ...}.
**/
@SafeVarargs
public final ArithExpr mkSub(Expr extends R>... t)
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkSub(nCtx(), t.length, AST.arrayToNative(t)));
}
/**
* Create an expression representing {@code -t}.
**/
public final ArithExpr mkUnaryMinus(Expr t)
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkUnaryMinus(nCtx(), t.getNativeObject()));
}
/**
* Create an expression representing {@code t1 / t2}.
**/
public final ArithExpr mkDiv(Expr extends R> t1, Expr extends R> t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return (ArithExpr) Expr.create(this, Native.mkDiv(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 mod t2}.
* Remarks: The
* arguments must have int type.
**/
public IntExpr mkMod(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new IntExpr(this, Native.mkMod(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 rem t2}.
* Remarks: The
* arguments must have int type.
**/
public IntExpr mkRem(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new IntExpr(this, Native.mkRem(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 ^ t2}.
**/
public final ArithExpr mkPower(Expr extends R> t1,
Expr extends R> t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return (ArithExpr) Expr.create(
this,
Native.mkPower(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 < t2}
**/
public BoolExpr mkLt(Expr extends ArithSort> t1, Expr extends ArithSort> t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkLt(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 <= t2}
**/
public BoolExpr mkLe(Expr extends ArithSort> t1, Expr extends ArithSort> t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkLe(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 > t2}
**/
public BoolExpr mkGt(Expr extends ArithSort> t1, Expr extends ArithSort> t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkGt(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing {@code t1 >= t2}
**/
public BoolExpr mkGe(Expr extends ArithSort> t1, Expr extends ArithSort> t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkGe(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* 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 Term
* {@code k} and asserting
* {@code MakeInt2Real(k) <= t1 < MkInt2Real(k)+1}. The argument
* must be of integer sort.
**/
public RealExpr mkInt2Real(Expr t)
{
checkContextMatch(t);
return new RealExpr(this,
Native.mkInt2real(nCtx(), t.getNativeObject()));
}
/**
* 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.
**/
public IntExpr mkReal2Int(Expr t)
{
checkContextMatch(t);
return new IntExpr(this, Native.mkReal2int(nCtx(), t.getNativeObject()));
}
/**
* Creates an expression that checks whether a real number is an integer.
**/
public BoolExpr mkIsInteger(Expr t)
{
checkContextMatch(t);
return new BoolExpr(this, Native.mkIsInt(nCtx(), t.getNativeObject()));
}
/**
* Bitwise negation.
* Remarks: The argument must have a bit-vector
* sort.
**/
public BitVecExpr mkBVNot(Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkBvnot(nCtx(), t.getNativeObject()));
}
/**
* Take conjunction of bits in a vector, return vector of length 1.
*
* Remarks: The argument must have a bit-vector sort.
**/
public BitVecExpr mkBVRedAND(Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkBvredand(nCtx(),
t.getNativeObject()));
}
/**
* Take disjunction of bits in a vector, return vector of length 1.
*
* Remarks: The argument must have a bit-vector sort.
**/
public BitVecExpr mkBVRedOR(Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkBvredor(nCtx(),
t.getNativeObject()));
}
/**
* Bitwise conjunction.
* Remarks: The arguments must have a bit-vector
* sort.
**/
public BitVecExpr mkBVAND(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvand(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Bitwise disjunction.
* Remarks: The arguments must have a bit-vector
* sort.
**/
public BitVecExpr mkBVOR(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvor(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Bitwise XOR.
* Remarks: The arguments must have a bit-vector
* sort.
**/
public BitVecExpr mkBVXOR(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvxor(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Bitwise NAND.
* Remarks: The arguments must have a bit-vector
* sort.
**/
public BitVecExpr mkBVNAND(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvnand(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Bitwise NOR.
* Remarks: The arguments must have a bit-vector
* sort.
**/
public BitVecExpr mkBVNOR(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvnor(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Bitwise XNOR.
* Remarks: The arguments must have a bit-vector
* sort.
**/
public BitVecExpr mkBVXNOR(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvxnor(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Standard two's complement unary minus.
* Remarks: The arguments must have a
* bit-vector sort.
**/
public BitVecExpr mkBVNeg(Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkBvneg(nCtx(), t.getNativeObject()));
}
/**
* Two's complement addition.
* Remarks: The arguments must have the same
* bit-vector sort.
**/
public BitVecExpr mkBVAdd(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvadd(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Two's complement subtraction.
* Remarks: The arguments must have the same
* bit-vector sort.
**/
public BitVecExpr mkBVSub(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvsub(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Two's complement multiplication.
* Remarks: The arguments must have the
* same bit-vector sort.
**/
public BitVecExpr mkBVMul(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvmul(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Unsigned division.
* Remarks: It is defined as the floor of
* {@code t1/t2} if \c t2 is different from zero. If {@code t2} is
* zero, then the result is undefined. The arguments must have the same
* bit-vector sort.
**/
public BitVecExpr mkBVUDiv(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvudiv(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Signed division.
* Remarks: It is defined in the following way:
*
* - The \c floor of {@code t1/t2} if \c t2 is different from zero, and
* {@code t1*t2 >= 0}.
*
* - The \c ceiling of {@code t1/t2} if \c t2 is different from zero,
* and {@code t1*t2 < 0}.
*
* If {@code t2} is zero, then the result is undefined. The arguments
* must have the same bit-vector sort.
**/
public BitVecExpr mkBVSDiv(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvsdiv(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Unsigned remainder.
* Remarks: It is defined as
* {@code t1 - (t1 /u t2) * t2}, where {@code /u} represents
* unsigned division. If {@code t2} is zero, then the result is
* undefined. The arguments must have the same bit-vector sort.
**/
public BitVecExpr mkBVURem(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvurem(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Signed remainder.
* Remarks: It is defined as
* {@code t1 - (t1 /s t2) * t2}, where {@code /s} represents
* signed division. The most significant bit (sign) of the result is equal
* to the most significant bit of \c t1.
*
* If {@code t2} is zero, then the result is undefined. The arguments
* must have the same bit-vector sort.
**/
public BitVecExpr mkBVSRem(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvsrem(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Two's complement signed remainder (sign follows divisor).
* Remarks: If
* {@code t2} is zero, then the result is undefined. The arguments must
* have the same bit-vector sort.
**/
public BitVecExpr mkBVSMod(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvsmod(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Unsigned less-than
* Remarks: The arguments must have the same bit-vector
* sort.
**/
public BoolExpr mkBVULT(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvult(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Two's complement signed less-than
* Remarks: The arguments must have the
* same bit-vector sort.
**/
public BoolExpr mkBVSLT(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvslt(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Unsigned less-than or equal to.
* Remarks: The arguments must have the
* same bit-vector sort.
**/
public BoolExpr mkBVULE(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvule(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Two's complement signed less-than or equal to.
* Remarks: The arguments
* must have the same bit-vector sort.
**/
public BoolExpr mkBVSLE(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvsle(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Unsigned greater than or equal to.
* Remarks: The arguments must have the
* same bit-vector sort.
**/
public BoolExpr mkBVUGE(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvuge(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Two's complement signed greater than or equal to.
* Remarks: The arguments
* must have the same bit-vector sort.
**/
public BoolExpr mkBVSGE(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvsge(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Unsigned greater-than.
* Remarks: The arguments must have the same
* bit-vector sort.
**/
public BoolExpr mkBVUGT(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvugt(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Two's complement signed greater-than.
* Remarks: The arguments must have
* the same bit-vector sort.
**/
public BoolExpr mkBVSGT(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvsgt(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Bit-vector concatenation.
* Remarks: The arguments must have a bit-vector
* sort.
*
* @return The result is a bit-vector of size {@code n1+n2}, where
* {@code n1} ({@code n2}) is the size of {@code t1}
* ({@code t2}).
*
**/
public BitVecExpr mkConcat(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkConcat(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Bit-vector extraction.
* Remarks: Extract the bits {@code high}
* down to {@code low} from a bitvector of size {@code m} to
* yield a new bitvector of size {@code n}, where
* {@code n = high - low + 1}. The argument {@code t} must
* have a bit-vector sort.
**/
public BitVecExpr mkExtract(int high, int low, Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkExtract(nCtx(), high, low,
t.getNativeObject()));
}
/**
* Bit-vector sign extension.
* Remarks: Sign-extends the given bit-vector to
* the (signed) equivalent bitvector of size {@code m+i}, where \c m is
* the size of the given bit-vector. The argument {@code t} must
* have a bit-vector sort.
**/
public BitVecExpr mkSignExt(int i, Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkSignExt(nCtx(), i,
t.getNativeObject()));
}
/**
* Bit-vector zero extension.
* Remarks: Extend the given bit-vector with
* zeros to the (unsigned) equivalent bitvector of size {@code m+i},
* where \c m is the size of the given bit-vector. The argument {@code t}
* must have a bit-vector sort.
**/
public BitVecExpr mkZeroExt(int i, Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkZeroExt(nCtx(), i,
t.getNativeObject()));
}
/**
* Bit-vector repetition.
* Remarks: The argument {@code t} must
* have a bit-vector sort.
**/
public BitVecExpr mkRepeat(int i, Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkRepeat(nCtx(), i,
t.getNativeObject()));
}
/**
* Shift left.
* Remarks: It is equivalent to multiplication by
* {@code 2^x} where \c x is the value of {@code t2}.
*
* 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.
**/
public BitVecExpr mkBVSHL(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvshl(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Logical shift right
* Remarks: It is equivalent to unsigned division by
* {@code 2^x} where \c x is the value of {@code t2}.
*
* 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.
**/
public BitVecExpr mkBVLSHR(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvlshr(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* 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.
**/
public BitVecExpr mkBVASHR(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvashr(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Rotate Left.
* Remarks: Rotate bits of \c t to the left \c i times. The
* argument {@code t} must have a bit-vector sort.
**/
public BitVecExpr mkBVRotateLeft(int i, Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkRotateLeft(nCtx(), i,
t.getNativeObject()));
}
/**
* Rotate Right.
* Remarks: Rotate bits of \c t to the right \c i times. The
* argument {@code t} must have a bit-vector sort.
**/
public BitVecExpr mkBVRotateRight(int i, Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkRotateRight(nCtx(), i,
t.getNativeObject()));
}
/**
* Rotate Left.
* Remarks: Rotate bits of {@code t1} to the left
* {@code t2} times. The arguments must have the same bit-vector
* sort.
**/
public BitVecExpr mkBVRotateLeft(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkExtRotateLeft(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Rotate Right.
* Remarks: Rotate bits of {@code t1} to the
* right{@code t2} times. The arguments must have the same
* bit-vector sort.
**/
public BitVecExpr mkBVRotateRight(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkExtRotateRight(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create an {@code n} bit bit-vector from the integer argument
* {@code t}.
* 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.
**/
public BitVecExpr mkInt2BV(int n, Expr t)
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkInt2bv(nCtx(), n,
t.getNativeObject()));
}
/**
* Create an integer from the bit-vector argument {@code t}.
* 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
* {@code [0..2^N-1]}, where N are the number of bits in {@code t}.
* 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.
**/
public IntExpr mkBV2Int(Expr t, boolean signed)
{
checkContextMatch(t);
return new IntExpr(this, Native.mkBv2int(nCtx(), t.getNativeObject(),
(signed)));
}
/**
* Create a predicate that checks that the bit-wise addition does not
* overflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVAddNoOverflow(Expr t1, Expr t2,
boolean isSigned)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvaddNoOverflow(nCtx(), t1
.getNativeObject(), t2.getNativeObject(), (isSigned)));
}
/**
* Create a predicate that checks that the bit-wise addition does not
* underflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVAddNoUnderflow(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvaddNoUnderflow(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create a predicate that checks that the bit-wise subtraction does not
* overflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVSubNoOverflow(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvsubNoOverflow(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create a predicate that checks that the bit-wise subtraction does not
* underflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVSubNoUnderflow(Expr t1, Expr t2,
boolean isSigned)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvsubNoUnderflow(nCtx(), t1
.getNativeObject(), t2.getNativeObject(), (isSigned)));
}
/**
* Create a predicate that checks that the bit-wise signed division does not
* overflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVSDivNoOverflow(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvsdivNoOverflow(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create a predicate that checks that the bit-wise negation does not
* overflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVNegNoOverflow(Expr t)
{
checkContextMatch(t);
return new BoolExpr(this, Native.mkBvnegNoOverflow(nCtx(),
t.getNativeObject()));
}
/**
* Create a predicate that checks that the bit-wise multiplication does not
* overflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVMulNoOverflow(Expr t1, Expr t2,
boolean isSigned)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvmulNoOverflow(nCtx(), t1
.getNativeObject(), t2.getNativeObject(), (isSigned)));
}
/**
* Create a predicate that checks that the bit-wise multiplication does not
* underflow.
* Remarks: The arguments must be of bit-vector sort.
**/
public BoolExpr mkBVMulNoUnderflow(Expr t1, Expr t2)
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkBvmulNoUnderflow(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create an array constant.
**/
public final ArrayExpr mkArrayConst(Symbol name, D domain, R range)
{
return (ArrayExpr) mkConst(name, mkArraySort(domain, range));
}
/**
* Create an array constant.
**/
public final ArrayExpr mkArrayConst(String name, D domain, R range)
{
return (ArrayExpr) mkConst(mkSymbol(name), mkArraySort(domain, range));
}
/**
* Array read.
* Remarks: The argument {@code a} is the array and
* {@code i} is the index of the array that gets read.
*
* The node {@code a} must have an array sort
* {@code [domain -> range]}, and {@code i} must have the sort
* {@code domain}. The sort of the result is {@code range}.
*
* @see #mkArraySort(Sort[], R)
* @see #mkStore(Expr> a, Expr i, Expr v)
**/
public final Expr mkSelect(Expr> a, Expr i)
{
checkContextMatch(a);
checkContextMatch(i);
return (Expr) Expr.create(
this,
Native.mkSelect(nCtx(), a.getNativeObject(),
i.getNativeObject()));
}
/**
* Array read.
* Remarks: The argument {@code a} is the array and
* {@code args} are the indices of the array that gets read.
*
* The node {@code a} must have an array sort
* {@code [domains -> range]}, and {@code args} must have the sorts
* {@code domains}. The sort of the result is {@code range}.
*
* @see #mkArraySort(Sort[], R)
* @see #mkStore(Expr> a, Expr i, Expr v)
**/
public final Expr mkSelect(Expr> a, Expr>[] args)
{
checkContextMatch(a);
checkContextMatch(args);
return (Expr) Expr.create(
this,
Native.mkSelectN(nCtx(), a.getNativeObject(), args.length, AST.arrayToNative(args)));
}
/**
* Array update.
* Remarks: The node {@code a} must have an array sort
* {@code [domain -> range]}, {@code i} must have sort
* {@code domain}, {@code v} must have sort range. The sort of the
* result is {@code [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 to {@code a} (with respect to
* {@code select}) on all indices except for {@code i}, where it
* maps to {@code v} (and the {@code select} of {@code a}
* with respect to {@code i} may be a different value).
* @see #mkArraySort(Sort[], R)
* @see #mkSelect(Expr> a, Expr i)
**/
public final ArrayExpr mkStore(Expr> a, Expr i, Expr v)
{
checkContextMatch(a);
checkContextMatch(i);
checkContextMatch(v);
return new ArrayExpr<>(this, Native.mkStore(nCtx(), a.getNativeObject(),
i.getNativeObject(), v.getNativeObject()));
}
/**
* Array update.
* Remarks: The node {@code a} must have an array sort
* {@code [domains -> range]}, {@code i} must have sort
* {@code domain}, {@code v} must have sort range. The sort of the
* result is {@code [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 to {@code a} (with respect to
* {@code select}) on all indices except for {@code args}, where it
* maps to {@code v} (and the {@code select} of {@code a}
* with respect to {@code args} may be a different value).
* @see #mkArraySort(Sort[], R)
* @see #mkSelect(Expr> a, Expr i)
**/
public final ArrayExpr mkStore(Expr> a, Expr>[] args, Expr v)
{
checkContextMatch(a);
checkContextMatch(args);
checkContextMatch(v);
return new ArrayExpr<>(this, Native.mkStoreN(nCtx(), a.getNativeObject(),
args.length, AST.arrayToNative(args), v.getNativeObject()));
}
/**
* Create a constant array.
* Remarks: The resulting term is an array, such
* that a {@code select} on an arbitrary index produces the value
* {@code v}.
* @see #mkArraySort(Sort[], R)
* @see #mkSelect(Expr> a, Expr i)
*
**/
public final ArrayExpr mkConstArray(D domain, Expr v)
{
checkContextMatch(domain);
checkContextMatch(v);
return new ArrayExpr<>(this, Native.mkConstArray(nCtx(),
domain.getNativeObject(), v.getNativeObject()));
}
/**
* Maps f on the argument arrays.
* Remarks: Each element of
* {@code args} must be of an array sort
* {@code [domain_i -> range_i]}. The function declaration
* {@code f} must have type {@code range_1 .. range_n -> range}.
* {@code v} must have sort range. The sort of the result is
* {@code [domain_i -> range]}.
* @see #mkArraySort(Sort[], R)
* @see #mkSelect(Expr> a, Expr i)
* @see #mkStore(Expr