mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 02:45:51 +00:00
FPA API: numerals, .NET and Java
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
3391c9c44c
commit
ee0ec7fe3a
16 changed files with 770 additions and 175 deletions
|
@ -2865,90 +2865,90 @@ public class Context extends IDisposable
|
|||
* Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public FPRMExpr mkFPRoundNearestTiesToEven() throws Z3Exception
|
||||
public FPRMNum mkFPRoundNearestTiesToEven() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRoundNearestTiesToEven(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRoundNearestTiesToEven(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRNE() throws Z3Exception
|
||||
public FPRMNum mkFPRNE() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRne(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRne(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRoundNearestTiesToAway() throws Z3Exception
|
||||
public FPRMNum mkFPRoundNearestTiesToAway() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRoundNearestTiesToAway(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRoundNearestTiesToAway(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRNA() throws Z3Exception
|
||||
public FPRMNum mkFPRNA() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRna(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRna(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRoundTowardPositive() throws Z3Exception
|
||||
public FPRMNum mkFPRoundTowardPositive() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRoundTowardPositive(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRoundTowardPositive(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the RoundTowardPositive rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRTP() throws Z3Exception
|
||||
public FPRMNum mkFPRTP() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRtp(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRtp(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRoundTowardNegative() throws Z3Exception
|
||||
public FPRMNum mkFPRoundTowardNegative() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRoundTowardNegative(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRoundTowardNegative(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the RoundTowardNegative rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRTN() throws Z3Exception
|
||||
public FPRMNum mkFPRTN() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRtn(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRtn(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRoundTowardZero() throws Z3Exception
|
||||
public FPRMNum mkFPRoundTowardZero() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRoundTowardZero(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRoundTowardZero(nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a numeral of RoundingMode sort which represents the RoundTowardZero rounding mode.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FPRMExpr mkFPRTZ() throws Z3Exception
|
||||
public FPRMNum mkFPRTZ() throws Z3Exception
|
||||
{
|
||||
return new FPRMExpr(this, Native.mkFpaRtz(nCtx()));
|
||||
return new FPRMNum(this, Native.mkFpaRtz(nCtx()));
|
||||
}
|
||||
|
||||
/** FloatingPoint Sorts **/
|
||||
|
|
|
@ -1714,98 +1714,105 @@ public class Expr extends AST
|
|||
* Indicates whether the terms is of floating-point sort.
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFP() throws Z3Exception { return Z3_sort_kind.fromInt(Native.getSortKind(getContext().nCtx(), Native.getSort(getContext().nCtx(), getNativeObject()))) == Z3_sort_kind.Z3_FLOATING_POINT_SORT; }
|
||||
public boolean isFP() throws Z3Exception { return Z3_sort_kind.fromInt(Native.getSortKind(getContext().nCtx(), Native.getSort(getContext().nCtx(), getNativeObject()))) == Z3_sort_kind.Z3_FLOATING_POINT_SORT; }
|
||||
|
||||
/**
|
||||
* Indicates whether the terms is of floating-point rounding mode sort.
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRM() throws Z3Exception { return Z3_sort_kind.fromInt(Native.getSortKind(getContext().nCtx(), Native.getSort(getContext().nCtx(), getNativeObject()))) == Z3_sort_kind.Z3_ROUNDING_MODE_SORT; }
|
||||
public boolean isFPRM() throws Z3Exception { return Z3_sort_kind.fromInt(Native.getSortKind(getContext().nCtx(), Native.getSort(getContext().nCtx(), getNativeObject()))) == Z3_sort_kind.Z3_ROUNDING_MODE_SORT; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point numeral
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPNumeral() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_NUM; }
|
||||
public boolean isFPNumeral() throws Z3Exception { return isFP() && isNumeral(); }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point rounding mode numeral
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isFPRMNumeral() throws Z3Exception { return isFPRM() && isNumeral(); }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRoundNearestTiesToEven() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; }
|
||||
public boolean isFPRMNumRoundNearestTiesToEven() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRoundNearestTiesToAway() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; }
|
||||
public boolean isFPRMNumRoundNearestTiesToAway() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRoundTowardNegative() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; }
|
||||
public boolean isFPRMNumRoundTowardNegative() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRoundTowardPositive() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; }
|
||||
public boolean isFPRMNumRoundTowardPositive() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRoundTowardZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; }
|
||||
public boolean isFPRMNumRoundTowardZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRNE() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; }
|
||||
public boolean isFPRMNumRNE() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRNA() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; }
|
||||
public boolean isFPRMNumRNA() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRTN() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; }
|
||||
public boolean isFPRMNumRTN() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRTP() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; }
|
||||
public boolean isFPRMNumRTP() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNumRTZ() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; }
|
||||
public boolean isFPRMNumRTZ() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point rounding mode numeral
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRMNum() throws Z3Exception {
|
||||
public boolean isFPRMNum() throws Z3Exception {
|
||||
return isApp() &&
|
||||
(getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY ||
|
||||
getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN ||
|
||||
|
@ -1819,42 +1826,42 @@ public class Expr extends AST
|
|||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPPlusInfinity() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_PLUS_INF; }
|
||||
public boolean isFPPlusInfinity() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_PLUS_INF; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point -oo
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPMinusInfinity() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MINUS_INF; }
|
||||
public boolean isFPMinusInfinity() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MINUS_INF; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point NaN
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPNaN() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_NAN; }
|
||||
public boolean isFPNaN() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_NAN; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point +zero
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPPlusZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_PLUS_ZERO; }
|
||||
public boolean isFPPlusZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_PLUS_ZERO; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point -zero
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPMinusZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MINUS_ZERO; }
|
||||
public boolean isFPMinusZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MINUS_ZERO; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point addition term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPAdd() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_ADD; }
|
||||
public boolean isFPAdd() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_ADD; }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1862,211 +1869,210 @@ public class Expr extends AST
|
|||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPSub() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_SUB; }
|
||||
public boolean isFPSub() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_SUB; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point negation term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPNeg() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_NEG; }
|
||||
public boolean isFPNeg() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_NEG; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point multiplication term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPMul() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MUL; }
|
||||
public boolean isFPMul() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MUL; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point divison term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPDiv() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_DIV; }
|
||||
public boolean isFPDiv() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_DIV; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point remainder term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRem() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_REM; }
|
||||
public boolean isFPRem() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_REM; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point term absolute value term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPAbs() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_ABS; }
|
||||
public boolean isFPAbs() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_ABS; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point minimum term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPMin() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MIN; }
|
||||
public boolean isFPMin() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MIN; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point maximum term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPMax() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MAX; }
|
||||
public boolean isFPMax() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_MAX; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point fused multiply-add term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPFMA() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_FMA; }
|
||||
public boolean isFPFMA() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_FMA; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point square root term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPSqrt() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_SQRT; }
|
||||
public boolean isFPSqrt() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_SQRT; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point roundToIntegral term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPRoundToIntegral() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_ROUND_TO_INTEGRAL; }
|
||||
public boolean isFPRoundToIntegral() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_ROUND_TO_INTEGRAL; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point equality term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPEq() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_EQ; }
|
||||
public boolean isFPEq() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_EQ; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point less-than term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPLt() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_LT; }
|
||||
public boolean isFPLt() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_LT; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point greater-than term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPGt() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_GT; }
|
||||
public boolean isFPGt() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_GT; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point less-than or equal term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPLe() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_LE; }
|
||||
public boolean isFPLe() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_LE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point greater-than or erqual term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPGe() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_GE; }
|
||||
public boolean isFPGe() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_GE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point isNaN predicate term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPisNaN() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_NAN; }
|
||||
public boolean isFPisNaN() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_NAN; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point isInf predicate term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPisInf() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_INF; }
|
||||
public boolean isFPisInf() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_INF; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point isZero predicate term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPisZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_ZERO; }
|
||||
public boolean isFPisZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_ZERO; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point isNormal term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPisNormal() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_NORMAL; }
|
||||
public boolean isFPisNormal() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_NORMAL; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point isSubnormal predicate term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPisSubnormal() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_SUBNORMAL; }
|
||||
public boolean isFPisSubnormal() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_SUBNORMAL; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point isNegative predicate term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPisNegative() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_NEGATIVE; }
|
||||
public boolean isFPisNegative() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_NEGATIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point isPositive predicate term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPisPositive() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_POSITIVE; }
|
||||
public boolean isFPisPositive() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_IS_POSITIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point constructor term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPFP() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_FP; }
|
||||
public boolean isFPFP() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_FP; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point conversion term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPToFp() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_FP; }
|
||||
public boolean isFPToFp() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_FP; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point conversion from unsigned bit-vector term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPToFpUnsigned() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_FP_UNSIGNED; }
|
||||
public boolean isFPToFpUnsigned() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_FP_UNSIGNED; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point conversion to unsigned bit-vector term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPToUBV() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_UBV; }
|
||||
public boolean isFPToUBV() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_UBV; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point conversion to signed bit-vector term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPToSBV() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_SBV; }
|
||||
public boolean isFPToSBV() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_SBV; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point conversion to real term
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPToReal() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_REAL; }
|
||||
|
||||
public boolean isFPToReal() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_REAL; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is a floating-point conversion to IEEE-754 bit-vector term1
|
||||
* @return
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean IsFPToIEEEBV() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_IEEE_BV; }
|
||||
public boolean isFPToIEEEBV() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_TO_IEEE_BV; }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -2140,6 +2146,8 @@ public class Expr extends AST
|
|||
return new BitVecNum(ctx, obj);
|
||||
case Z3_FLOATING_POINT_SORT:
|
||||
return new FPNum(ctx, obj);
|
||||
case Z3_ROUNDING_MODE_SORT:
|
||||
return new FPRMNum(ctx, obj);
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
|
41
src/api/java/FPExpr.java
Normal file
41
src/api/java/FPExpr.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPExpr.java
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
package com.microsoft.z3;
|
||||
|
||||
/**
|
||||
* FloatingPoint Expressions
|
||||
*/
|
||||
public class FPExpr extends Expr
|
||||
{
|
||||
/**
|
||||
* The number of exponent bits.
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public int getEBits() throws Z3Exception { return ((FPSort)getSort()).getEBits(); }
|
||||
|
||||
/**
|
||||
* The number of significand bits.
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public int getSBits() throws Z3Exception { return ((FPSort)getSort()).getSBits(); }
|
||||
|
||||
public FPExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
}
|
86
src/api/java/FPNum.java
Normal file
86
src/api/java/FPNum.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPNum.java
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
package com.microsoft.z3;
|
||||
|
||||
/**
|
||||
* FloatingPoint Numerals
|
||||
*/
|
||||
public class FPNum extends FPExpr
|
||||
{
|
||||
/**
|
||||
* Retrieves the sign of a floating-point literal
|
||||
* Remarks: returns true if the numeral is negative
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean getSign() throws Z3Exception {
|
||||
Native.IntPtr res = new Native.IntPtr();
|
||||
if (Native.fpaGetNumeralSign(getContext().nCtx(), getNativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Sign is not a Boolean value");
|
||||
return res.value != 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The significand value of a floating-point numeral as a string
|
||||
* Remarks: The significand s is always 0 < s < 2.0; the resulting string is long
|
||||
* enough to represent the real significand precisely.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public String getSignificand() throws Z3Exception {
|
||||
return Native.fpaGetNumeralSignificandString(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the exponent value of a floating-point numeral as a string
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public String getExponent() throws Z3Exception {
|
||||
return Native.fpaGetNumeralExponentString(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the exponent value of a floating-point numeral as a signed 64-bit integer
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public long getExponentInt64() throws Z3Exception {
|
||||
Native.LongPtr res = new Native.LongPtr();
|
||||
if (Native.fpaGetNumeralExponentInt64(getContext().nCtx(), getNativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Exponent is not a 64 bit integer");
|
||||
return res.value;
|
||||
}
|
||||
|
||||
public FPNum(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the numeral.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Native.getNumeralString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
29
src/api/java/FPRMExpr.java
Normal file
29
src/api/java/FPRMExpr.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPRMExpr.java
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
package com.microsoft.z3;
|
||||
|
||||
/**
|
||||
* FloatingPoint RoundingMode Expressions
|
||||
*/
|
||||
public class FPRMExpr extends Expr
|
||||
{
|
||||
public FPRMExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
}
|
90
src/api/java/FPRMNum.java
Normal file
90
src/api/java/FPRMNum.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPRMNum.java
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.Z3_decl_kind;
|
||||
|
||||
/**
|
||||
* FloatingPoint RoundingMode Numerals
|
||||
*/
|
||||
public class FPRMNum extends FPRMExpr {
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
* @throws Z3Exception
|
||||
* **/
|
||||
public boolean isRoundNearestTiesToEven() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRNE() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRoundNearestTiesToAway() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRNA() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRoundTowardPositive() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardPositive
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRTP() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRoundTowardNegative() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardNegative
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRTN() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRoundTowardZero() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; }
|
||||
|
||||
/**
|
||||
* Indicates whether the term is the floating-point rounding numeral roundTowardZero
|
||||
* @throws Z3Exception
|
||||
*/
|
||||
public boolean isRTZ() throws Z3Exception { return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; }
|
||||
|
||||
public FPRMNum(Context ctx, long obj) throws Z3Exception {
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
}
|
35
src/api/java/FPRMSort.java
Normal file
35
src/api/java/FPRMSort.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPRMExpr.java
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
package com.microsoft.z3;
|
||||
|
||||
/**
|
||||
* The FloatingPoint RoundingMode sort
|
||||
**/
|
||||
public class FPRMSort extends Sort
|
||||
{
|
||||
|
||||
public FPRMSort(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFpaRoundingModeSort(ctx.nCtx()));
|
||||
}
|
||||
|
||||
public FPRMSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
}
|
49
src/api/java/FPSort.java
Normal file
49
src/api/java/FPSort.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FPSort.java
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-06-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
package com.microsoft.z3;
|
||||
|
||||
/**
|
||||
* A FloatingPoint sort
|
||||
**/
|
||||
public class FPSort extends Sort
|
||||
{
|
||||
|
||||
public FPSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
public FPSort(Context ctx, int ebits, int sbits) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFpaSort(ctx.nCtx(), ebits, sbits));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of exponent bits.
|
||||
*/
|
||||
public int getEBits() throws Z3Exception {
|
||||
return Native.fpaGetEbits(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of significand bits.
|
||||
*/
|
||||
public int getSBits() throws Z3Exception {
|
||||
return Native.fpaGetEbits(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue