/// <summary> /// Array update. /// </summary> /// <remarks> /// The node <c>a</c> must have an array sort <c>[domain -> range]</c>, /// <c>i</c> must have sort <c>domain</c>, /// <c>v</c> must have sort range. The sort of the result is <c>[domain -> range]</c>. /// 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 <c>a</c> /// (with respect to <c>select</c>) /// on all indices except for <c>i</c>, where it maps to <c>v</c> /// (and the <c>select</c> of <c>a</c> with /// respect to <c>i</c> may be a different value). /// <seealso cref="MkArraySort"/> /// <seealso cref="MkSelect"/> /// </remarks> public ArrayExpr MkStore(ArrayExpr a, Expr i, Expr v) { Contract.Requires(a != null); Contract.Requires(i != null); Contract.Requires(v != null); Contract.Ensures(Contract.Result<ArrayExpr>() != null); CheckContextMatch(a); CheckContextMatch(i); CheckContextMatch(v); return new ArrayExpr(this, Native.Z3_mk_store(nCtx, a.NativeObject, i.NativeObject, v.NativeObject)); }
/// <summary> /// Access the array default value. /// </summary> /// <remarks> /// Produces the default range value, for arrays that can be represented as /// finite maps with a default range value. /// </remarks> public Expr MkTermArray(ArrayExpr array) { Contract.Requires(array != null); Contract.Ensures(Contract.Result<Expr>() != null); CheckContextMatch(array); return Expr.Create(this, Native.Z3_mk_array_default(nCtx, array.NativeObject)); }
/// <summary> /// Check for subsetness of sets. /// </summary> public BoolExpr MkSetSubset(ArrayExpr arg1, ArrayExpr arg2) { Contract.Requires(arg1 != null); Contract.Requires(arg2 != null); Contract.Ensures(Contract.Result<Expr>() != null); CheckContextMatch(arg1); CheckContextMatch(arg2); return (BoolExpr) Expr.Create(this, Native.Z3_mk_set_subset(nCtx, arg1.NativeObject, arg2.NativeObject)); }
/// <summary> /// Array read. /// </summary> /// <remarks> /// The argument <c>a</c> is the array and <c>i</c> is the index /// of the array that gets read. /// /// The node <c>a</c> must have an array sort <c>[domain -> range]</c>, /// and <c>i</c> must have the sort <c>domain</c>. /// The sort of the result is <c>range</c>. /// <seealso cref="MkArraySort"/> /// <seealso cref="MkStore"/> /// </remarks> public Expr MkSelect(ArrayExpr a, Expr i) { Contract.Requires(a != null); Contract.Requires(i != null); Contract.Ensures(Contract.Result<Expr>() != null); CheckContextMatch(a); CheckContextMatch(i); return Expr.Create(this, Native.Z3_mk_select(nCtx, a.NativeObject, i.NativeObject)); }
/// <summary> /// Check for set membership. /// </summary> public BoolExpr MkSetMembership(Expr elem, ArrayExpr set) { Contract.Requires(elem != null); Contract.Requires(set != null); Contract.Ensures(Contract.Result<Expr>() != null); CheckContextMatch(elem); CheckContextMatch(set); return (BoolExpr) Expr.Create(this, Native.Z3_mk_set_member(nCtx, elem.NativeObject, set.NativeObject)); }
/// <summary> /// Remove an element from a set. /// </summary> public ArrayExpr MkSetDel(ArrayExpr set, Expr element) { Contract.Requires(set != null); Contract.Requires(element != null); Contract.Ensures(Contract.Result<Expr>() != null); CheckContextMatch(set); CheckContextMatch(element); return (ArrayExpr)Expr.Create(this, Native.Z3_mk_set_del(nCtx, set.NativeObject, element.NativeObject)); }
/// <summary> /// Take the complement of a set. /// </summary> public ArrayExpr MkSetComplement(ArrayExpr arg) { Contract.Requires(arg != null); Contract.Ensures(Contract.Result<Expr>() != null); CheckContextMatch(arg); return (ArrayExpr)Expr.Create(this, Native.Z3_mk_set_complement(nCtx, arg.NativeObject)); }
/// <summary> /// Create Extentionality index. Two arrays are equal if and only if they are equal on the index returned by MkArrayExt. /// </summary> public Expr MkArrayExt(ArrayExpr arg1, ArrayExpr arg2) { Contract.Requires(arg1 != null); Contract.Requires(arg2 != null); Contract.Ensures(Contract.Result<Expr>() != null); CheckContextMatch(arg1); CheckContextMatch(arg2); return Expr.Create(this, Native.Z3_mk_array_ext(nCtx, arg1.NativeObject, arg2.NativeObject)); }
/// <summary> /// Translates an ASTVector into a ArrayExpr[] /// </summary> public ArrayExpr[] ToArrayExprArray() { uint n = Size; ArrayExpr[] res = new ArrayExpr[n]; for (uint i = 0; i < n; i++) res[i] = (ArrayExpr)Expr.Create(this.Context, this[i].NativeObject); return res; }