mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 20:05:51 +00:00
Merge branch 'unstable' of https://git01.codeplex.com/z3 into ml-ng
This commit is contained in:
commit
ffd10675f4
117 changed files with 12229 additions and 4142 deletions
|
@ -227,10 +227,8 @@ namespace Microsoft.Z3
|
|||
internal override void IncRef(IntPtr o)
|
||||
{
|
||||
// Console.WriteLine("AST IncRef()");
|
||||
if (Context == null)
|
||||
throw new Z3Exception("inc() called on null context");
|
||||
if (o == IntPtr.Zero)
|
||||
throw new Z3Exception("inc() called on null AST");
|
||||
if (Context == null || o == IntPtr.Zero)
|
||||
return;
|
||||
Context.AST_DRQ.IncAndClear(Context, o);
|
||||
base.IncRef(o);
|
||||
}
|
||||
|
@ -238,10 +236,8 @@ namespace Microsoft.Z3
|
|||
internal override void DecRef(IntPtr o)
|
||||
{
|
||||
// Console.WriteLine("AST DecRef()");
|
||||
if (Context == null)
|
||||
throw new Z3Exception("dec() called on null context");
|
||||
if (o == IntPtr.Zero)
|
||||
throw new Z3Exception("dec() called on null AST");
|
||||
if (Context == null || o == IntPtr.Zero)
|
||||
return;
|
||||
Context.AST_DRQ.Add(o);
|
||||
base.DecRef(o);
|
||||
}
|
||||
|
|
|
@ -32,11 +32,6 @@ namespace Microsoft.Z3
|
|||
{
|
||||
#region Internal
|
||||
/// <summary> Constructor for ArithExpr </summary>
|
||||
internal protected ArithExpr(Context ctx)
|
||||
: base(ctx)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal ArithExpr(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
|
|
|
@ -32,11 +32,6 @@ namespace Microsoft.Z3
|
|||
{
|
||||
#region Internal
|
||||
/// <summary> Constructor for ArrayExpr </summary>
|
||||
internal protected ArrayExpr(Context ctx)
|
||||
: base(ctx)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal ArrayExpr(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace Microsoft.Z3
|
|||
|
||||
#region Internal
|
||||
/// <summary> Constructor for BitVecExpr </summary>
|
||||
internal protected BitVecExpr(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
|
||||
internal BitVecExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ namespace Microsoft.Z3
|
|||
{
|
||||
#region Internal
|
||||
/// <summary> Constructor for BoolExpr </summary>
|
||||
internal protected BoolExpr(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
|
||||
/// <summary> Constructor for BoolExpr </summary>
|
||||
internal BoolExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -3438,6 +3438,805 @@ namespace Microsoft.Z3
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Floating-Point Arithmetic
|
||||
|
||||
#region Rounding Modes
|
||||
#region RoundingMode Sort
|
||||
/// <summary>
|
||||
/// Create the floating-point RoundingMode sort.
|
||||
/// </summary>
|
||||
public FPRMSort MkFPRoundingModeSort()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMSort>() != null);
|
||||
return new FPRMSort(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Numerals
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.
|
||||
/// </summary>
|
||||
public FPRMExpr MkFPRoundNearestTiesToEven()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMExpr(this, Native.Z3_mk_fpa_round_nearest_ties_to_even(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRNE()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_rne(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRoundNearestTiesToAway()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_round_nearest_ties_to_away(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRNA()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_rna(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRoundTowardPositive()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_round_toward_positive(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRTP()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_rtp(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRoundTowardNegative()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_round_toward_negative(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRTN()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_rtn(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRoundTowardZero()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_round_toward_zero(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.
|
||||
/// </summary>
|
||||
public FPRMNum MkFPRTZ()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPRMNum(this, Native.Z3_mk_fpa_rtz(nCtx));
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region FloatingPoint Sorts
|
||||
/// <summary>
|
||||
/// Create a FloatingPoint sort.
|
||||
/// </summary>
|
||||
/// <param name="ebits">exponent bits in the FloatingPoint sort.</param>
|
||||
/// <param name="sbits">significand bits in the FloatingPoint sort.</param>
|
||||
public FPSort MkFPSort(uint ebits, uint sbits)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, ebits, sbits);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the half-precision (16-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSortHalf()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_half(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the half-precision (16-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSort16()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_16(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the single-precision (32-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSortSingle()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_single(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the single-precision (32-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSort32()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_32(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the double-precision (64-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSortDouble()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_double(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the double-precision (64-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSort64()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_64(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the quadruple-precision (128-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSortQuadruple()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_quadruple(nCtx));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the quadruple-precision (128-bit) FloatingPoint sort.
|
||||
/// </summary>
|
||||
public FPSort MkFPSort128()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPSort>() != null);
|
||||
return new FPSort(this, Native.Z3_mk_fpa_sort_128(nCtx));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Numerals
|
||||
/// <summary>
|
||||
/// Create a NaN of sort s.
|
||||
/// </summary>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFPNaN(FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_nan(nCtx, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a floating-point infinity of sort s.
|
||||
/// </summary>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
/// <param name="negative">indicates whether the result should be negative.</param>
|
||||
public FPNum MkFPInf(FPSort s, bool negative)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_inf(nCtx, s.NativeObject, negative ? 1 : 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a floating-point zero of sort s.
|
||||
/// </summary>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
/// <param name="negative">indicates whether the result should be negative.</param>
|
||||
public FPNum MkFPZero(FPSort s, bool negative)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_zero(nCtx, s.NativeObject, negative ? 1 : 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a float.
|
||||
/// </summary>
|
||||
/// <param name="v">numeral value.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFPNumeral(float v, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_numeral_float(nCtx, v, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a float.
|
||||
/// </summary>
|
||||
/// <param name="v">numeral value.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFPNumeral(double v, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_numeral_double(nCtx, v, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from an int.
|
||||
/// </summary>
|
||||
/// <param name="v">numeral value.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFPNumeral(int v, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_numeral_int(nCtx, v, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a sign bit and two integers.
|
||||
/// </summary>
|
||||
/// <param name="sgn">the sign.</param>
|
||||
/// <param name="sig">the significand.</param>
|
||||
/// <param name="exp">the exponent.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFPNumeral(bool sgn, uint sig, int exp, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_numeral_uint_int(nCtx, sgn ? 1 : 0, sig, exp, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a sign bit and two 64-bit integers.
|
||||
/// </summary>
|
||||
/// <param name="sgn">the sign.</param>
|
||||
/// <param name="sig">the significand.</param>
|
||||
/// <param name="exp">the exponent.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFPNumeral(bool sgn, UInt64 sig, Int64 exp, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return new FPNum(this, Native.Z3_mk_fpa_numeral_uint64_int64(nCtx, sgn ? 1 : 0, sig, exp, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a float.
|
||||
/// </summary>
|
||||
/// <param name="v">numeral value.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFP(float v, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return MkFPNumeral(v, s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a float.
|
||||
/// </summary>
|
||||
/// <param name="v">numeral value.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFP(double v, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return MkFPNumeral(v, s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from an int.
|
||||
/// </summary>
|
||||
/// <param name="v">numeral value.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFP(int v, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return MkFPNumeral(v, s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a sign bit and two integers.
|
||||
/// </summary>
|
||||
/// <param name="sgn">the sign.</param>
|
||||
/// <param name="exp">the exponent.</param>
|
||||
/// <param name="sig">the significand.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFP(bool sgn, int exp, uint sig, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return MkFPNumeral(sgn, sig, exp, s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a numeral of FloatingPoint sort from a sign bit and two 64-bit integers.
|
||||
/// </summary>
|
||||
/// <param name="sgn">the sign.</param>
|
||||
/// <param name="exp">the exponent.</param>
|
||||
/// <param name="sig">the significand.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPNum MkFP(bool sgn, Int64 exp, UInt64 sig, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
|
||||
return MkFPNumeral(sgn, sig, exp, s);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
/// <summary>
|
||||
/// Floating-point absolute value
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public FPExpr MkFPAbs(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_abs(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point negation
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public FPExpr MkFPNeg(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_neg(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point addition
|
||||
/// </summary>
|
||||
/// <param name="rm">rounding mode term</param>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public FPExpr MkFPAdd(FPRMExpr rm, FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_add(this.nCtx, rm.NativeObject, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point subtraction
|
||||
/// </summary>
|
||||
/// <param name="rm">rounding mode term</param>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public FPExpr MkFPSub(FPRMExpr rm, FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_sub(this.nCtx, rm.NativeObject, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point multiplication
|
||||
/// </summary>
|
||||
/// <param name="rm">rounding mode term</param>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public FPExpr MkFPMul(FPRMExpr rm, FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_mul(this.nCtx, rm.NativeObject, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point division
|
||||
/// </summary>
|
||||
/// <param name="rm">rounding mode term</param>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public FPExpr MkFPDiv(FPRMExpr rm, FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_div(this.nCtx, rm.NativeObject, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point fused multiply-add
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The result is round((t1 * t2) + t3)
|
||||
/// </remarks>
|
||||
/// <param name="rm">rounding mode term</param>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
/// <param name="t3">floating-point term</param>
|
||||
public FPExpr MkFPFMA(FPRMExpr rm, FPExpr t1, FPExpr t2, FPExpr t3)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_fma(this.nCtx, rm.NativeObject, t1.NativeObject, t2.NativeObject, t3.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point square root
|
||||
/// </summary>
|
||||
/// <param name="rm">rounding mode term</param>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public FPExpr MkFPSqrt(FPRMExpr rm, FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_sqrt(this.nCtx, rm.NativeObject, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point remainder
|
||||
/// </summary>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public FPExpr MkFPRem(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_rem(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point roundToIntegral. Rounds a floating-point number to
|
||||
/// the closest integer, again represented as a floating-point number.
|
||||
/// </summary>
|
||||
/// <param name="rm">term of RoundingMode sort</param>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public FPExpr MkFPRoundToIntegral(FPRMExpr rm, FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_round_to_integral(this.nCtx, rm.NativeObject, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minimum of floating-point numbers.
|
||||
/// </summary>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public FPExpr MkFPMin(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_min(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum of floating-point numbers.
|
||||
/// </summary>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public FPExpr MkFPMax(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPNum>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_max(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point less than or equal.
|
||||
/// </summary>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public BoolExpr MkFPLEq(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_leq(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point less than.
|
||||
/// </summary>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public BoolExpr MkFPLt(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_lt(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point greater than or equal.
|
||||
/// </summary>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public BoolExpr MkFPGEq(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_geq(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point greater than.
|
||||
/// </summary>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public BoolExpr MkFPGt(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_gt(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point equality.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that this is IEEE 754 equality (as opposed to standard =).
|
||||
/// </remarks>
|
||||
/// <param name="t1">floating-point term</param>
|
||||
/// <param name="t2">floating-point term</param>
|
||||
public BoolExpr MkFPEq(FPExpr t1, FPExpr t2)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_eq(this.nCtx, t1.NativeObject, t2.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicate indicating whether t is a normal floating-point number.
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public BoolExpr MkFPIsNormal(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_is_normal(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicate indicating whether t is a subnormal floating-point number.
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public BoolExpr MkFPIsSubnormal(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_is_subnormal(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicate indicating whether t is a floating-point number with zero value, i.e., +0 or -0.
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public BoolExpr MkFPIsZero(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_is_zero(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicate indicating whether t is a floating-point number representing +oo or -oo.
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public BoolExpr MkFPIsInfinite(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_is_infinite(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicate indicating whether t is a NaN.
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public BoolExpr MkFPIsNaN(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_is_nan(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicate indicating whether t is a negative floating-point number.
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public BoolExpr MkFPIsNegative(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_is_negative(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicate indicating whether t is a positive floating-point number.
|
||||
/// </summary>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public BoolExpr MkFPIsPositive(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||
return new BoolExpr(this, Native.Z3_mk_fpa_is_positive(this.nCtx, t.NativeObject));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Conversions to FloatingPoint terms
|
||||
/// <summary>
|
||||
/// Create an expression of FloatingPoint sort from three bit-vector expressions.
|
||||
/// </summary>
|
||||
/// <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.
|
||||
/// </remarks>
|
||||
/// <param name="sgn">bit-vector term (of size 1) representing the sign.</param>
|
||||
/// <param name="sig">bit-vector term representing the significand.</param>
|
||||
/// <param name="exp">bit-vector term representing the exponent.</param>
|
||||
public FPExpr MkFP(BitVecExpr sgn, BitVecExpr sig, BitVecExpr exp)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPExpr>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_fp(this.nCtx, sgn.NativeObject, sig.NativeObject, exp.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of a single IEEE 754-2008 bit-vector into a floating-point number.
|
||||
/// </summary>
|
||||
/// <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.
|
||||
/// </remarks>
|
||||
/// <param name="bv">bit-vector value (of size m).</param>
|
||||
/// <param name="s">FloatingPoint sort (ebits+sbits == m)</param>
|
||||
public FPExpr MkFPToFP(BitVecExpr bv, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPExpr>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_to_fp_bv(this.nCtx, bv.NativeObject, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of a FloatingPoint term into another term of different FloatingPoint sort.
|
||||
/// </summary>
|
||||
/// <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.
|
||||
/// </remarks>
|
||||
/// <param name="rm">RoundingMode term.</param>
|
||||
/// <param name="t">FloatingPoint term.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPExpr MkFPToFP(FPRMExpr rm, FPExpr t, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPExpr>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_to_fp_float(this.nCtx, rm.NativeObject, t.NativeObject, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of a term of real sort into a term of FloatingPoint sort.
|
||||
/// </summary>
|
||||
/// <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.
|
||||
/// </remarks>
|
||||
/// <param name="rm">RoundingMode term.</param>
|
||||
/// <param name="t">term of Real sort.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public FPExpr MkFPToFP(FPRMExpr rm, RealExpr t, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPExpr>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_to_fp_real(this.nCtx, rm.NativeObject, t.NativeObject, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of a 2's complement signed bit-vector term into a term of FloatingPoint sort.
|
||||
/// </summary>
|
||||
/// <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.
|
||||
/// </remarks>
|
||||
/// <param name="rm">RoundingMode term.</param>
|
||||
/// <param name="t">term of bit-vector sort.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
/// <param name="signed">flag indicating whether t is interpreted as signed or unsigned bit-vector.</param>
|
||||
public FPExpr MkFPToFP(FPRMExpr rm, BitVecExpr t, FPSort s, bool signed)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPExpr>() != null);
|
||||
if (signed)
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_to_fp_signed(this.nCtx, rm.NativeObject, t.NativeObject, s.NativeObject));
|
||||
else
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_to_fp_unsigned(this.nCtx, rm.NativeObject, t.NativeObject, s.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of a floating-point number to another FloatingPoint sort s.
|
||||
/// </summary>
|
||||
/// <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.
|
||||
/// </remarks>
|
||||
/// <param name="s">FloatingPoint sort</param>
|
||||
/// <param name="rm">floating-point rounding mode term</param>
|
||||
/// <param name="t">floating-point term</param>
|
||||
public FPExpr MkFPToFP(FPSort s, FPRMExpr rm, FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<FPExpr>() != null);
|
||||
return new FPExpr(this, Native.Z3_mk_fpa_to_fp_float(this.nCtx, s.NativeObject, rm.NativeObject, t.NativeObject));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Conversions from FloatingPoint terms
|
||||
/// <summary>
|
||||
/// Conversion of a floating-point term into a bit-vector.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Produces a term that represents the conversion of the floating-poiunt 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.
|
||||
/// </remarks>
|
||||
/// <param name="rm">RoundingMode term.</param>
|
||||
/// <param name="t">FloatingPoint term</param>
|
||||
/// <param name="sz">Size of the resulting bit-vector.</param>
|
||||
/// <param name="signed">Indicates whether the result is a signed or unsigned bit-vector.</param>
|
||||
public BitVecExpr MkFPToBV(FPRMExpr rm, FPExpr t, uint sz, bool signed)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BitVecExpr>() != null);
|
||||
if (signed)
|
||||
return new BitVecExpr(this, Native.Z3_mk_fpa_to_sbv(this.nCtx, rm.NativeObject, t.NativeObject, sz));
|
||||
else
|
||||
return new BitVecExpr(this, Native.Z3_mk_fpa_to_ubv(this.nCtx, rm.NativeObject, t.NativeObject, sz));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of a floating-point term into a real-numbered term.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Produces a term that represents the conversion of the floating-poiunt term t into a
|
||||
/// real number. Note that this type of conversion will often result in non-linear
|
||||
/// constraints over real terms.
|
||||
/// </remarks>
|
||||
/// <param name="t">FloatingPoint term</param>
|
||||
public RealExpr MkFPToReal(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<RealExpr>() != null);
|
||||
return new RealExpr(this, Native.Z3_mk_fpa_to_real(this.nCtx, t.NativeObject));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Z3-specific extensions
|
||||
/// <summary>
|
||||
/// Conversion of a floating-point term into a bit-vector term in IEEE 754-2008 format.
|
||||
/// </summary>
|
||||
/// <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 represenatation of
|
||||
/// that NaN.
|
||||
/// </remarks>
|
||||
/// <param name="t">FloatingPoint term.</param>
|
||||
public BitVecExpr MkFPToIEEEBV(FPExpr t)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BitVecExpr>() != null);
|
||||
return new BitVecExpr(this, Native.Z3_mk_fpa_to_ieee_bv(this.nCtx, t.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of a real-sorted significand and an integer-sorted exponent into a term of FloatingPoint sort.
|
||||
/// </summary>
|
||||
/// <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.
|
||||
/// </remarks>
|
||||
/// <param name="rm">RoundingMode term.</param>
|
||||
/// <param name="sig">Significand term of Real sort.</param>
|
||||
/// <param name="exp">Exponent term of Int sort.</param>
|
||||
/// <param name="s">FloatingPoint sort.</param>
|
||||
public BitVecExpr MkFPToFP(FPRMExpr rm, RealExpr sig, IntExpr exp, FPSort s)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<BitVecExpr>() != null);
|
||||
return new BitVecExpr(this, Native.Z3_mk_fpa_to_fp_real_int(this.nCtx, rm.NativeObject, sig.NativeObject, exp.NativeObject, s.NativeObject));
|
||||
}
|
||||
#endregion
|
||||
#endregion // Floating-point Arithmetic
|
||||
|
||||
#region Miscellaneous
|
||||
/// <summary>
|
||||
|
|
|
@ -32,11 +32,6 @@ namespace Microsoft.Z3
|
|||
{
|
||||
#region Internal
|
||||
/// <summary> Constructor for DatatypeExpr </summary>
|
||||
internal protected DatatypeExpr(Context ctx)
|
||||
: base(ctx)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal DatatypeExpr(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Microsoft.Z3
|
|||
|
||||
#region Internal
|
||||
internal EnumSort(Context ctx, Symbol name, Symbol[] enumNames)
|
||||
: base(ctx)
|
||||
: base(ctx, IntPtr.Zero)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
Contract.Requires(name != null);
|
||||
|
|
|
@ -1448,6 +1448,281 @@ namespace Microsoft.Z3
|
|||
/// Indicates whether the term is a less than predicate over a finite domain.
|
||||
/// </summary>
|
||||
public bool IsFiniteDomainLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FD_LT; } }
|
||||
#endregion
|
||||
|
||||
#region Floating-point terms
|
||||
/// <summary>
|
||||
/// Indicates whether the terms is of floating-point sort.
|
||||
/// </summary>
|
||||
public bool IsFP
|
||||
{
|
||||
get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_FLOATING_POINT_SORT; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the terms is of floating-point rounding mode sort.
|
||||
/// </summary>
|
||||
public bool IsFPRM
|
||||
{
|
||||
get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_ROUNDING_MODE_SORT; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point numeral
|
||||
/// </summary>
|
||||
public bool IsFPNumeral { get { return IsFP && IsNumeral; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point rounding mode numeral
|
||||
/// </summary>
|
||||
public bool IsFPRMNumeral { get { return IsFPRM && IsNumeral; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
/// </summary>
|
||||
public bool IsFPRMRoundNearestTiesToEven{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
/// </summary>
|
||||
public bool IsFPRMRoundNearestTiesToAway{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
/// </summary>
|
||||
public bool IsFPRMRoundTowardNegative{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
/// </summary>
|
||||
public bool IsFPRMRoundTowardPositive{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
/// </summary>
|
||||
public bool IsFPRMRoundTowardZero{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
/// </summary>
|
||||
public bool IsFPRMExprRNE{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
/// </summary>
|
||||
public bool IsFPRMExprRNA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
/// </summary>
|
||||
public bool IsFPRMExprRTN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
/// </summary>
|
||||
public bool IsFPRMExprRTP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
/// </summary>
|
||||
public bool IsFPRMExprRTZ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point rounding mode numeral
|
||||
/// </summary>
|
||||
public bool IsFPRMExpr {
|
||||
get {
|
||||
return IsApp &&
|
||||
(FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY||
|
||||
FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN ||
|
||||
FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE ||
|
||||
FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE ||
|
||||
FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point +oo
|
||||
/// </summary>
|
||||
public bool IsFPPlusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_INF; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point -oo
|
||||
/// </summary>
|
||||
public bool IsFPMinusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_INF; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point NaN
|
||||
/// </summary>
|
||||
public bool IsFPNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NAN; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point +zero
|
||||
/// </summary>
|
||||
public bool IsFPPlusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_ZERO; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point -zero
|
||||
/// </summary>
|
||||
public bool IsFPMinusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_ZERO; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point addition term
|
||||
/// </summary>
|
||||
public bool IsFPAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ADD; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point subtraction term
|
||||
/// </summary>
|
||||
public bool IsFPSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SUB; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point negation term
|
||||
/// </summary>
|
||||
public bool IsFPNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NEG; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point multiplication term
|
||||
/// </summary>
|
||||
public bool IsFPMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MUL; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point divison term
|
||||
/// </summary>
|
||||
public bool IsFPDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_DIV; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point remainder term
|
||||
/// </summary>
|
||||
public bool IsFPRem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_REM; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point term absolute value term
|
||||
/// </summary>
|
||||
public bool IsFPAbs { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ABS; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point minimum term
|
||||
/// </summary>
|
||||
public bool IsFPMin { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MIN; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point maximum term
|
||||
/// </summary>
|
||||
public bool IsFPMax { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MAX; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point fused multiply-add term
|
||||
/// </summary>
|
||||
public bool IsFPFMA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FMA; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point square root term
|
||||
/// </summary>
|
||||
public bool IsFPSqrt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SQRT; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point roundToIntegral term
|
||||
/// </summary>
|
||||
public bool IsFPRoundToIntegral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ROUND_TO_INTEGRAL; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point equality term
|
||||
/// </summary>
|
||||
public bool IsFPEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_EQ; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point less-than term
|
||||
/// </summary>
|
||||
public bool IsFPLt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LT; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point greater-than term
|
||||
/// </summary>
|
||||
public bool IsFPGt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GT; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point less-than or equal term
|
||||
/// </summary>
|
||||
public bool IsFPLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point greater-than or erqual term
|
||||
/// </summary>
|
||||
public bool IsFPGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point isNaN predicate term
|
||||
/// </summary>
|
||||
public bool IsFPisNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NAN; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point isInf predicate term
|
||||
/// </summary>
|
||||
public bool IsFPisInf { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_INF; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point isZero predicate term
|
||||
/// </summary>
|
||||
public bool IsFPisZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_ZERO; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point isNormal term
|
||||
/// </summary>
|
||||
public bool IsFPisNormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NORMAL; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point isSubnormal predicate term
|
||||
/// </summary>
|
||||
public bool IsFPisSubnormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_SUBNORMAL; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point isNegative predicate term
|
||||
/// </summary>
|
||||
public bool IsFPisNegative { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NEGATIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point isPositive predicate term
|
||||
/// </summary>
|
||||
public bool IsFPisPositive { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_POSITIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point constructor term
|
||||
/// </summary>
|
||||
public bool IsFPFP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FP; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point conversion term
|
||||
/// </summary>
|
||||
public bool IsFPToFp { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point conversion from unsigned bit-vector term
|
||||
/// </summary>
|
||||
public bool IsFPToFpUnsigned { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP_UNSIGNED; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point conversion to unsigned bit-vector term
|
||||
/// </summary>
|
||||
public bool IsFPToUBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_UBV; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point conversion to signed bit-vector term
|
||||
/// </summary>
|
||||
public bool IsFPToSBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_SBV; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point conversion to real term
|
||||
/// </summary>
|
||||
public bool IsFPToReal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_REAL; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is a floating-point conversion to IEEE-754 bit-vector term
|
||||
/// </summary>
|
||||
public bool IsFPToIEEEBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_IEEE_BV; } }
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
@ -1489,10 +1764,6 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Constructor for Expr
|
||||
/// </summary>
|
||||
internal protected Expr(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
|
||||
/// <summary>
|
||||
/// Constructor for Expr
|
||||
/// </summary>
|
||||
internal protected Expr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||
|
||||
#if DEBUG
|
||||
|
@ -1541,7 +1812,9 @@ namespace Microsoft.Z3
|
|||
{
|
||||
case Z3_sort_kind.Z3_INT_SORT: return new IntNum(ctx, obj);
|
||||
case Z3_sort_kind.Z3_REAL_SORT: return new RatNum(ctx, obj);
|
||||
case Z3_sort_kind.Z3_BV_SORT: return new BitVecNum(ctx, obj);
|
||||
case Z3_sort_kind.Z3_BV_SORT: return new BitVecNum(ctx, obj);
|
||||
case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPNum(ctx, obj);
|
||||
case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMNum(ctx, obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1552,7 +1825,9 @@ namespace Microsoft.Z3
|
|||
case Z3_sort_kind.Z3_REAL_SORT: return new RealExpr(ctx, obj);
|
||||
case Z3_sort_kind.Z3_BV_SORT: return new BitVecExpr(ctx, obj);
|
||||
case Z3_sort_kind.Z3_ARRAY_SORT: return new ArrayExpr(ctx, obj);
|
||||
case Z3_sort_kind.Z3_DATATYPE_SORT: return new DatatypeExpr(ctx, obj);
|
||||
case Z3_sort_kind.Z3_DATATYPE_SORT: return new DatatypeExpr(ctx, obj);
|
||||
case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPExpr(ctx, obj);
|
||||
case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMExpr(ctx, obj);
|
||||
}
|
||||
|
||||
return new Expr(ctx, obj);
|
||||
|
|
52
src/api/dotnet/FPExpr.cs
Normal file
52
src/api/dotnet/FPExpr.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPExpr.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Floating Point Expressions
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// FloatingPoint Expressions
|
||||
/// </summary>
|
||||
public class FPExpr : Expr
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of exponent bits.
|
||||
/// </summary>
|
||||
public uint EBits { get { return ((FPSort)Sort).EBits; } }
|
||||
|
||||
/// <summary>
|
||||
/// The number of significand bits.
|
||||
/// </summary>
|
||||
public uint SBits { get { return ((FPSort)Sort).EBits; } }
|
||||
|
||||
#region Internal
|
||||
/// <summary> Constructor for FPExpr </summary>
|
||||
internal FPExpr(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
103
src/api/dotnet/FPNum.cs
Normal file
103
src/api/dotnet/FPNum.cs
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPNum.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Floating Point Numerals
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// FloatiungPoint Numerals
|
||||
/// </summary>
|
||||
[ContractVerification(true)]
|
||||
public class FPNum : FPExpr
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the sign of a floating-point literal
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Remarks: returns true if the numeral is negative
|
||||
/// </remarks>
|
||||
public bool Sign
|
||||
{
|
||||
get
|
||||
{
|
||||
int res = 0;
|
||||
if (Native.Z3_fpa_get_numeral_sign(Context.nCtx, NativeObject, ref res) == 0)
|
||||
throw new Z3Exception("Sign is not a Boolean value");
|
||||
return res != 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The significand value of a floating-point numeral as a string
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The significand s is always 0 < s < 2.0; the resulting string is long
|
||||
/// enough to represent the real significand precisely.
|
||||
/// </remarks>
|
||||
public string Significand
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.Z3_fpa_get_numeral_significand_string(Context.nCtx, NativeObject);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the exponent value of a floating-point numeral as a string
|
||||
/// </summary>
|
||||
public string Exponent
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.Z3_fpa_get_numeral_exponent_string(Context.nCtx, NativeObject);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the exponent value of a floating-point numeral as a signed 64-bit integer
|
||||
/// </summary>
|
||||
public Int64 ExponentInt64
|
||||
{
|
||||
get
|
||||
{
|
||||
Int64 result = 0;
|
||||
if (Native.Z3_fpa_get_numeral_exponent_int64(Context.nCtx, NativeObject, ref result) == 0)
|
||||
throw new Z3Exception("Exponent is not a 64 bit integer");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#region Internal
|
||||
internal FPNum(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string representation of the numeral.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return Native.Z3_get_numeral_string(Context.nCtx, NativeObject);
|
||||
}
|
||||
}
|
||||
}
|
42
src/api/dotnet/FPRMExpr.cs
Normal file
42
src/api/dotnet/FPRMExpr.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPRMExpr.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Floating Point Expressions over Rounding Modes
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// FloatingPoint RoundingMode Expressions
|
||||
/// </summary>
|
||||
public class FPRMExpr : Expr
|
||||
{
|
||||
#region Internal
|
||||
/// <summary> Constructor for FPRMExpr </summary>
|
||||
internal FPRMExpr(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
100
src/api/dotnet/FPRMNum.cs
Normal file
100
src/api/dotnet/FPRMNum.cs
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPRMExpr.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Floating Point Rounding Mode Numerals
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// Floating-point rounding mode numerals
|
||||
/// </summary>
|
||||
public class FPRMNum : FPRMExpr
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
/// </summary>
|
||||
public bool isRoundNearestTiesToEven { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
/// </summary>
|
||||
public bool isRNE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
/// </summary>
|
||||
public bool isRoundNearestTiesToAway { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
/// </summary>
|
||||
public bool isRNA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
/// </summary>
|
||||
public bool isRoundTowardPositive { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
/// </summary>
|
||||
public bool isRTP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
/// </summary>
|
||||
public bool isRoundTowardNegative { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
/// </summary>
|
||||
public bool isRTN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
/// </summary>
|
||||
public bool isRoundTowardZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
/// </summary>
|
||||
public bool isRTZ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string representation of the numeral.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return Native.Z3_get_numeral_string(Context.nCtx, NativeObject);
|
||||
}
|
||||
|
||||
#region Internal
|
||||
/// <summary> Constructor for FPRMNum </summary>
|
||||
internal FPRMNum(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
43
src/api/dotnet/FPRMSort.cs
Normal file
43
src/api/dotnet/FPRMSort.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPRMSort.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Rounding Mode Sort
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// The FloatingPoint RoundingMode sort
|
||||
/// </summary>
|
||||
public class FPRMSort : Sort
|
||||
{
|
||||
#region Internal
|
||||
internal FPRMSort(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal FPRMSort(Context ctx)
|
||||
: base(ctx, Native.Z3_mk_fpa_rounding_mode_sort(ctx.nCtx))
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
52
src/api/dotnet/FPSort.cs
Normal file
52
src/api/dotnet/FPSort.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPSort.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Floating Point Sorts
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// FloatingPoint sort
|
||||
/// </summary>
|
||||
public class FPSort : Sort
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of exponent bits.
|
||||
/// </summary>
|
||||
public uint EBits { get { return Native.Z3_fpa_get_ebits(Context.nCtx, NativeObject); } }
|
||||
|
||||
/// <summary>
|
||||
/// The number of significand bits.
|
||||
/// </summary>
|
||||
public uint SBits { get { return Native.Z3_fpa_get_sbits(Context.nCtx, NativeObject); } }
|
||||
|
||||
#region Internal
|
||||
internal FPSort(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal FPSort(Context ctx, uint ebits, uint sbits)
|
||||
: base(ctx, Native.Z3_mk_fpa_sort(ctx.nCtx, ebits, sbits))
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*++
|
||||
Copyright (<c>) 2012 Microsoft Corporation
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
|
@ -32,11 +32,6 @@ namespace Microsoft.Z3
|
|||
{
|
||||
#region Internal
|
||||
/// <summary> Constructor for IntExpr </summary>
|
||||
internal protected IntExpr(Context ctx)
|
||||
: base(ctx)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal IntExpr(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
|
|
|
@ -113,9 +113,9 @@ namespace Microsoft.Z3
|
|||
}
|
||||
}
|
||||
|
||||
#region Internal
|
||||
#region Internal
|
||||
internal ListSort(Context ctx, Symbol name, Sort elemSort)
|
||||
: base(ctx)
|
||||
: base(ctx, IntPtr.Zero)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
Contract.Requires(name != null);
|
||||
|
|
|
@ -342,6 +342,12 @@
|
|||
<Compile Include="ConstructorList.cs" />
|
||||
<Compile Include="DatatypeExpr.cs" />
|
||||
<Compile Include="DatatypeSort.cs" />
|
||||
<Compile Include="FPExpr.cs" />
|
||||
<Compile Include="FPNum.cs" />
|
||||
<Compile Include="FPRMExpr.cs" />
|
||||
<Compile Include="FPRMNum.cs" />
|
||||
<Compile Include="FPRMSort.cs" />
|
||||
<Compile Include="FPSort.cs" />
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="IDecRefQueue.cs" />
|
||||
<Compile Include="Enumerations.cs" />
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace Microsoft.Z3
|
|||
#region Internal
|
||||
[ContractVerification(false)] // F: Clousot ForAll decompilation gets confused below. Setting verification off until I fixed the bug
|
||||
internal Quantifier(Context ctx, bool isForall, Sort[] sorts, Symbol[] names, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
|
||||
: base(ctx)
|
||||
: base(ctx, IntPtr.Zero)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
Contract.Requires(sorts != null);
|
||||
|
@ -203,7 +203,7 @@ namespace Microsoft.Z3
|
|||
|
||||
[ContractVerification(false)] // F: Clousot ForAll decompilation gets confused below. Setting verification off until I fixed the bug
|
||||
internal Quantifier(Context ctx, bool isForall, Expr[] bound, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
|
||||
: base(ctx)
|
||||
: base(ctx, IntPtr.Zero)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
Contract.Requires(body != null);
|
||||
|
|
|
@ -32,11 +32,6 @@ namespace Microsoft.Z3
|
|||
{
|
||||
#region Internal
|
||||
/// <summary> Constructor for RealExpr </summary>
|
||||
internal protected RealExpr(Context ctx)
|
||||
: base(ctx)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal RealExpr(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
|
|
|
@ -116,8 +116,7 @@ namespace Microsoft.Z3
|
|||
#region Internal
|
||||
/// <summary>
|
||||
/// Sort constructor
|
||||
/// </summary>
|
||||
internal protected Sort(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
|
||||
/// </summary>
|
||||
internal Sort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||
|
||||
#if DEBUG
|
||||
|
@ -146,6 +145,8 @@ namespace Microsoft.Z3
|
|||
case Z3_sort_kind.Z3_UNINTERPRETED_SORT: return new UninterpretedSort(ctx, obj);
|
||||
case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainSort(ctx, obj);
|
||||
case Z3_sort_kind.Z3_RELATION_SORT: return new RelationSort(ctx, obj);
|
||||
case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPSort(ctx, obj);
|
||||
case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMSort(ctx, obj);
|
||||
default:
|
||||
throw new Z3Exception("Unknown sort kind");
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Microsoft.Z3
|
|||
|
||||
#region Internal
|
||||
internal TupleSort(Context ctx, Symbol name, uint numFields, Symbol[] fieldNames, Sort[] fieldSorts)
|
||||
: base(ctx)
|
||||
: base(ctx, IntPtr.Zero)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
Contract.Requires(name != null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue