3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00

pull unstable

Signed-off-by: Nikolaj Bjorner <nbjorner@hotmail.com>
This commit is contained in:
Nikolaj Bjorner 2015-04-01 14:57:11 -07:00
commit 52619b9dbb
337 changed files with 24943 additions and 30606 deletions

View file

@ -301,7 +301,7 @@ extern "C" {
Z3_CATCH_RETURN(-1);
}
char const * Z3_API Z3_get_symbol_string(Z3_context c, Z3_symbol s) {
Z3_API char const * Z3_get_symbol_string(Z3_context c, Z3_symbol s) {
Z3_TRY;
LOG_Z3_get_symbol_string(c, s);
RESET_ERROR_CODE();
@ -649,6 +649,12 @@ extern "C" {
else if (fid == mk_c(c)->get_datalog_fid() && k == datalog::DL_FINITE_SORT) {
return Z3_FINITE_DOMAIN_SORT;
}
else if (fid == mk_c(c)->get_fpa_fid() && k == FLOATING_POINT_SORT) {
return Z3_FLOATING_POINT_SORT;
}
else if (fid == mk_c(c)->get_fpa_fid() && k == ROUNDING_MODE_SORT) {
return Z3_ROUNDING_MODE_SORT;
}
else {
return Z3_UNKNOWN_SORT;
}
@ -818,7 +824,7 @@ extern "C" {
Z3_CATCH_RETURN(0);
}
char const * Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a) {
Z3_API char const * Z3_ast_to_string(Z3_context c, Z3_ast a) {
Z3_TRY;
LOG_Z3_ast_to_string(c, a);
RESET_ERROR_CODE();
@ -861,11 +867,11 @@ extern "C" {
Z3_CATCH_RETURN(0);
}
char const * Z3_API Z3_sort_to_string(Z3_context c, Z3_sort s) {
Z3_API char const * Z3_sort_to_string(Z3_context c, Z3_sort s) {
return Z3_ast_to_string(c, reinterpret_cast<Z3_ast>(s));
}
char const * Z3_API Z3_func_decl_to_string(Z3_context c, Z3_func_decl f) {
Z3_API char const * Z3_func_decl_to_string(Z3_context c, Z3_func_decl f) {
return Z3_ast_to_string(c, reinterpret_cast<Z3_ast>(f));
}
@ -1114,6 +1120,62 @@ extern "C" {
return Z3_OP_UNINTERPRETED;
}
}
if (mk_c(c)->get_fpa_fid() == _d->get_family_id()) {
switch (_d->get_decl_kind()) {
case OP_FPA_RM_NEAREST_TIES_TO_EVEN: return Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN;
case OP_FPA_RM_NEAREST_TIES_TO_AWAY: return Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY;
case OP_FPA_RM_TOWARD_POSITIVE: return Z3_OP_FPA_RM_TOWARD_POSITIVE;
case OP_FPA_RM_TOWARD_NEGATIVE: return Z3_OP_FPA_RM_TOWARD_NEGATIVE;
case OP_FPA_RM_TOWARD_ZERO: return Z3_OP_FPA_RM_TOWARD_ZERO;
case OP_FPA_NUM: return Z3_OP_FPA_NUM;
case OP_FPA_PLUS_INF: return Z3_OP_FPA_PLUS_INF;
case OP_FPA_MINUS_INF: return Z3_OP_FPA_MINUS_INF;
case OP_FPA_NAN: return Z3_OP_FPA_NAN;
case OP_FPA_MINUS_ZERO: return Z3_OP_FPA_MINUS_ZERO;
case OP_FPA_PLUS_ZERO: return Z3_OP_FPA_PLUS_ZERO;
case OP_FPA_ADD: return Z3_OP_FPA_ADD;
case OP_FPA_SUB: return Z3_OP_FPA_SUB;
case OP_FPA_NEG: return Z3_OP_FPA_NEG;
case OP_FPA_MUL: return Z3_OP_FPA_MUL;
case OP_FPA_DIV: return Z3_OP_FPA_DIV;
case OP_FPA_REM: return Z3_OP_FPA_REM;
case OP_FPA_ABS: return Z3_OP_FPA_ABS;
case OP_FPA_MIN: return Z3_OP_FPA_MIN;
case OP_FPA_MAX: return Z3_OP_FPA_MAX;
case OP_FPA_FMA: return Z3_OP_FPA_FMA;
case OP_FPA_SQRT: return Z3_OP_FPA_SQRT;
case OP_FPA_EQ: return Z3_OP_FPA_EQ;
case OP_FPA_ROUND_TO_INTEGRAL: return Z3_OP_FPA_ROUND_TO_INTEGRAL;
case OP_FPA_LT: return Z3_OP_FPA_LT;
case OP_FPA_GT: return Z3_OP_FPA_GT;
case OP_FPA_LE: return Z3_OP_FPA_LE;
case OP_FPA_GE: return Z3_OP_FPA_GE;
case OP_FPA_IS_NAN: return Z3_OP_FPA_IS_NAN;
case OP_FPA_IS_INF: return Z3_OP_FPA_IS_INF;
case OP_FPA_IS_ZERO: return Z3_OP_FPA_IS_ZERO;
case OP_FPA_IS_NORMAL: return Z3_OP_FPA_IS_NORMAL;
case OP_FPA_IS_SUBNORMAL: return Z3_OP_FPA_IS_SUBNORMAL;
case OP_FPA_IS_NEGATIVE: return Z3_OP_FPA_IS_NEGATIVE;
case OP_FPA_IS_POSITIVE: return Z3_OP_FPA_IS_POSITIVE;
case OP_FPA_FP: return Z3_OP_FPA_FP;
case OP_FPA_TO_FP: return Z3_OP_FPA_TO_FP;
case OP_FPA_TO_FP_UNSIGNED: return Z3_OP_FPA_TO_FP_UNSIGNED;
case OP_FPA_TO_UBV: return Z3_OP_FPA_TO_UBV;
case OP_FPA_TO_SBV: return Z3_OP_FPA_TO_SBV;
case OP_FPA_TO_REAL: return Z3_OP_FPA_TO_REAL;
case OP_FPA_TO_IEEE_BV: return Z3_OP_FPA_TO_IEEE_BV;
case OP_FPA_INTERNAL_BVWRAP:
case OP_FPA_INTERNAL_BVUNWRAP:
case OP_FPA_INTERNAL_TO_UBV_UNSPECIFIED:
case OP_FPA_INTERNAL_TO_SBV_UNSPECIFIED:
case OP_FPA_INTERNAL_TO_REAL_UNSPECIFIED:
return Z3_OP_UNINTERPRETED;
default:
UNREACHABLE();
return Z3_OP_UNINTERPRETED;
}
}
if (mk_c(c)->m().get_label_family_id() == _d->get_family_id()) {
switch(_d->get_decl_kind()) {

View file

@ -88,6 +88,8 @@ namespace api {
m_arith_util(m()),
m_bv_util(m()),
m_datalog_util(m()),
m_fpa_util(m()),
m_dtutil(m()),
m_last_result(m()),
m_ast_trail(m()),
m_replay_stack() {
@ -113,6 +115,7 @@ namespace api {
m_array_fid = m().mk_family_id("array");
m_dt_fid = m().mk_family_id("datatype");
m_datalog_fid = m().mk_family_id("datalog_relation");
m_fpa_fid = m().mk_family_id("fpa");
m_dt_plugin = static_cast<datatype_decl_plugin*>(m().get_plugin(m_dt_fid));
if (!m_user_ref_count) {
@ -547,12 +550,12 @@ extern "C" {
}
}
char const * Z3_API Z3_get_error_msg(Z3_error_code err) {
Z3_API char const * Z3_get_error_msg(Z3_error_code err) {
LOG_Z3_get_error_msg(err);
return _get_error_msg_ex(0, err);
}
char const * Z3_API Z3_get_error_msg_ex(Z3_context c, Z3_error_code err) {
Z3_API char const * Z3_get_error_msg_ex(Z3_context c, Z3_error_code err) {
LOG_Z3_get_error_msg_ex(c, err);
return _get_error_msg_ex(c, err);
}
@ -576,7 +579,7 @@ extern "C" {
};
ast_manager & Z3_API Z3_get_manager(__in Z3_context c) {
Z3_API ast_manager& Z3_get_manager(__in Z3_context c) {
return mk_c(c)->m();
}

View file

@ -27,6 +27,7 @@ Revision History:
#include"bv_decl_plugin.h"
#include"datatype_decl_plugin.h"
#include"dl_decl_plugin.h"
#include"fpa_decl_plugin.h"
#include"smt_kernel.h"
#include"smt_params.h"
#include"event_handler.h"
@ -56,6 +57,8 @@ namespace api {
arith_util m_arith_util;
bv_util m_bv_util;
datalog::dl_decl_util m_datalog_util;
fpa_util m_fpa_util;
datatype_util m_dtutil;
// Support for old solver API
smt_params m_fparams;
@ -76,6 +79,7 @@ namespace api {
family_id m_dt_fid;
family_id m_datalog_fid;
family_id m_pb_fid;
family_id m_fpa_fid;
datatype_decl_plugin * m_dt_plugin;
std::string m_string_buffer; // temporary buffer used to cache strings sent to the "external" world.
@ -116,6 +120,8 @@ namespace api {
arith_util & autil() { return m_arith_util; }
bv_util & bvutil() { return m_bv_util; }
datalog::dl_decl_util & datalog_util() { return m_datalog_util; }
fpa_util & fpautil() { return m_fpa_util; }
datatype_util& dtutil() { return m_dtutil; }
family_id get_basic_fid() const { return m_basic_fid; }
family_id get_array_fid() const { return m_array_fid; }
family_id get_arith_fid() const { return m_arith_fid; }
@ -123,6 +129,7 @@ namespace api {
family_id get_dt_fid() const { return m_dt_fid; }
family_id get_datalog_fid() const { return m_datalog_fid; }
family_id get_pb_fid() const { return m_pb_fid; }
family_id get_fpa_fid() const { return m_fpa_fid; }
datatype_decl_plugin * get_dt_plugin() const { return m_dt_plugin; }
Z3_error_code get_error_code() const { return m_error_code; }

View file

@ -36,7 +36,7 @@ extern "C" {
RESET_ERROR_CODE();
mk_c(c)->reset_last_result();
ast_manager& m = mk_c(c)->m();
datatype_util dt_util(m);
datatype_util& dt_util = mk_c(c)->dtutil();
sort_ref_vector tuples(m);
sort* tuple;
@ -102,7 +102,7 @@ extern "C" {
RESET_ERROR_CODE();
mk_c(c)->reset_last_result();
ast_manager& m = mk_c(c)->m();
datatype_util dt_util(m);
datatype_util& dt_util = mk_c(c)->dtutil();
sort_ref_vector sorts(m);
sort* e;
@ -451,7 +451,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
sort * _t = to_sort(t);
datatype_util dt_util(mk_c(c)->m());
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
@ -470,7 +470,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
sort * _t = to_sort(t);
datatype_util dt_util(mk_c(c)->m());
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
@ -499,7 +499,7 @@ extern "C" {
LOG_Z3_get_datatype_sort_recognizer(c, t, idx);
RESET_ERROR_CODE();
sort * _t = to_sort(t);
datatype_util dt_util(mk_c(c)->m());
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
@ -508,7 +508,7 @@ extern "C" {
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(_t);
if (!decls || idx >= decls->size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(0);
}
func_decl* decl = (*decls)[idx];
decl = dt_util.get_constructor_recognizer(decl);
@ -522,7 +522,7 @@ extern "C" {
LOG_Z3_get_datatype_sort_constructor_accessor(c, t, idx_c, idx_a);
RESET_ERROR_CODE();
sort * _t = to_sort(t);
datatype_util dt_util(mk_c(c)->m());
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
@ -531,7 +531,7 @@ extern "C" {
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(_t);
if (!decls || idx_c >= decls->size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
return 0;
}
func_decl* decl = (*decls)[idx_c];
if (decl->get_arity() <= idx_a) {
@ -555,7 +555,7 @@ extern "C" {
LOG_Z3_get_tuple_sort_mk_decl(c, t);
RESET_ERROR_CODE();
sort * tuple = to_sort(t);
datatype_util dt_util(mk_c(c)->m());
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(tuple) || dt_util.is_recursive(tuple) || dt_util.get_datatype_num_constructors(tuple) != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
@ -570,7 +570,7 @@ extern "C" {
LOG_Z3_get_tuple_sort_num_fields(c, t);
RESET_ERROR_CODE();
sort * tuple = to_sort(t);
datatype_util dt_util(mk_c(c)->m());
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(tuple) || dt_util.is_recursive(tuple) || dt_util.get_datatype_num_constructors(tuple) != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
@ -593,7 +593,7 @@ extern "C" {
LOG_Z3_get_tuple_sort_field_decl(c, t, i);
RESET_ERROR_CODE();
sort * tuple = to_sort(t);
datatype_util dt_util(mk_c(c)->m());
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(tuple) || dt_util.is_recursive(tuple) || dt_util.get_datatype_num_constructors(tuple) != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);

842
src/api/api_fpa.cpp Normal file
View file

@ -0,0 +1,842 @@
/*++
Copyright (c) 2013 Microsoft Corporation
Module Name:
api_fpa.cpp
Abstract:
Additional APIs for floating-point arithmetic (FP).
Author:
Christoph M. Wintersteiger (cwinter) 2013-06-05
Notes:
--*/
#include<iostream>
#include"z3.h"
#include"api_log_macros.h"
#include"api_context.h"
#include"fpa_decl_plugin.h"
extern "C" {
Z3_sort Z3_API Z3_mk_fpa_rounding_mode_sort(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_rounding_mode_sort(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
sort * s = ctx->fpautil().mk_rm_sort();
mk_c(c)->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_round_nearest_ties_to_even(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_round_nearest_ties_to_even(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_nearest_ties_to_even();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_rne(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_rne(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_nearest_ties_to_even();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_round_nearest_ties_to_away(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_round_nearest_ties_to_away(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_nearest_ties_to_away();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_rna(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_rna(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_nearest_ties_to_away();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_positive(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_round_toward_positive(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_toward_positive();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_rtp(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_rtp(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_toward_positive();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_negative(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_round_toward_negative(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_toward_negative();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_rtn(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_rtn(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_toward_negative();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_zero(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_round_toward_zero(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_toward_zero();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_rtz(Z3_context c) {
Z3_TRY;
LOG_Z3_mk_fpa_rtz(c);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_toward_zero();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_sort Z3_API Z3_mk_fpa_sort(Z3_context c, unsigned ebits, unsigned sbits) {
Z3_TRY;
LOG_Z3_mk_fpa_sort(c, ebits, sbits);
RESET_ERROR_CODE();
if (ebits < 2 || sbits < 3) {
SET_ERROR_CODE(Z3_INVALID_ARG);
}
api::context * ctx = mk_c(c);
sort * s = ctx->fpautil().mk_float_sort(ebits, sbits);
ctx->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
}
Z3_sort Z3_API Z3_mk_fpa_sort_half(Z3_context c) {
return Z3_mk_fpa_sort(c, 5, 11);
}
Z3_sort Z3_API Z3_mk_fpa_sort_16(Z3_context c) {
return Z3_mk_fpa_sort(c, 5, 11);
}
Z3_sort Z3_API Z3_mk_fpa_sort_single(Z3_context c) {
return Z3_mk_fpa_sort(c, 8, 24);
}
Z3_sort Z3_API Z3_mk_fpa_sort_32(Z3_context c) {
return Z3_mk_fpa_sort(c, 8, 24);
}
Z3_sort Z3_API Z3_mk_fpa_sort_double(Z3_context c) {
return Z3_mk_fpa_sort(c, 11, 53);
}
Z3_sort Z3_API Z3_mk_fpa_sort_64(Z3_context c) {
return Z3_mk_fpa_sort(c, 11, 53);
}
Z3_sort Z3_API Z3_mk_fpa_sort_quadruple(Z3_context c) {
return Z3_mk_fpa_sort(c, 15, 113);
}
Z3_sort Z3_API Z3_mk_fpa_sort_128(Z3_context c) {
return Z3_mk_fpa_sort(c, 15, 113);
}
Z3_ast Z3_API Z3_mk_fpa_nan(Z3_context c, Z3_sort s) {
Z3_TRY;
LOG_Z3_mk_fpa_nan(c, s);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_nan(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_inf(Z3_context c, Z3_sort s, Z3_bool negative) {
Z3_TRY;
LOG_Z3_mk_fpa_inf(c, s, negative);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = negative != 0 ? ctx->fpautil().mk_ninf(to_sort(s)) :
ctx->fpautil().mk_pinf(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_zero(Z3_context c, Z3_sort s, Z3_bool negative) {
Z3_TRY;
LOG_Z3_mk_fpa_inf(c, s, negative);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = negative != 0 ? ctx->fpautil().mk_nzero(to_sort(s)) :
ctx->fpautil().mk_pzero(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_fp(Z3_context c, Z3_ast sgn, Z3_ast exp, Z3_ast sig) {
Z3_TRY;
LOG_Z3_mk_fpa_fp(c, sgn, sig, exp);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_fp(to_expr(sgn), to_expr(sig), to_expr(exp));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_float(Z3_context c, float v, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_fpa_numeral_float(c, v, ty);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
ctx->fpautil().fm().set(tmp,
ctx->fpautil().get_ebits(to_sort(ty)),
ctx->fpautil().get_sbits(to_sort(ty)),
v);
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_double(Z3_context c, double v, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_fpa_numeral_double(c, v, ty);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
ctx->fpautil().fm().set(tmp, ctx->fpautil().get_ebits(to_sort(ty)), ctx->fpautil().get_sbits(to_sort(ty)), v);
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int(Z3_context c, signed v, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_fpa_numeral_int(c, v, ty);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
ctx->fpautil().fm().set(tmp,
ctx->fpautil().get_ebits(to_sort(ty)),
ctx->fpautil().get_sbits(to_sort(ty)),
v);
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int_uint(Z3_context c, Z3_bool sgn, signed exp, unsigned sig, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_fpa_numeral_int64_uint64(c, sgn, exp, sig, ty);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
ctx->fpautil().fm().set(tmp,
ctx->fpautil().get_ebits(to_sort(ty)),
ctx->fpautil().get_sbits(to_sort(ty)),
sgn != 0, sig, exp);
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int64_uint64(Z3_context c, Z3_bool sgn, __int64 exp, __uint64 sig, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_fpa_numeral_int64_uint64(c, sgn, exp, sig, ty);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
ctx->fpautil().fm().set(tmp,
ctx->fpautil().get_ebits(to_sort(ty)),
ctx->fpautil().get_sbits(to_sort(ty)),
sgn != 0, sig, exp);
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_abs(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_abs(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_abs(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_neg(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_neg(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_neg(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_add(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_add(c, rm, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_add(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_sub(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_add(c, rm, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_sub(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_mul(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_add(c, rm, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_mul(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_div(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_add(c, rm, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_div(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_fma(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2, Z3_ast t3) {
Z3_TRY;
LOG_Z3_mk_fpa_fma(c, rm, t1, t2, t3);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_fma(to_expr(rm), to_expr(t1), to_expr(t2), to_expr(t3));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_sqrt(Z3_context c, Z3_ast rm, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_sqrt(c, rm, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_sqrt(to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_rem(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_rem(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_rem(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_round_to_integral(Z3_context c, Z3_ast rm, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_round_to_integral(c, rm, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_to_integral(to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_min(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_min(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_min(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_max(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_max(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
Z3_ast r = of_ast(ctx->fpautil().mk_max(to_expr(t1), to_expr(t2)));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_leq(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_leq(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_le(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_lt(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_lt(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_lt(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_geq(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_geq(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_ge(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_gt(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_gt(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_gt(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_eq(Z3_context c, Z3_ast t1, Z3_ast t2) {
Z3_TRY;
LOG_Z3_mk_fpa_eq(c, t1, t2);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_float_eq(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_is_normal(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_is_normal(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_normal(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_is_subnormal(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_is_subnormal(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_subnormal(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_is_zero(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_is_zero(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_zero(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_is_infinite(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_is_infinite(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_inf(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_is_nan(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_is_nan(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_nan(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_is_negative(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_is_negative(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_negative(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_is_positive(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_is_positive(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_positive(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_bv(Z3_context c, Z3_ast bv, Z3_sort s) {
Z3_TRY;
LOG_Z3_mk_fpa_to_fp_bv(c, bv, s);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!ctx->bvutil().is_bv(to_expr(bv)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(bv));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_float(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
Z3_TRY;
LOG_Z3_mk_fpa_to_fp_float(c, rm, t, s);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!fu.is_rm(to_expr(rm)) ||
!fu.is_float(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_real(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
Z3_TRY;
LOG_Z3_mk_fpa_to_fp_real(c, rm, t, s);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!fu.is_rm(to_expr(rm)) ||
!ctx->autil().is_real(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_signed(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
Z3_TRY;
LOG_Z3_mk_fpa_to_fp_signed(c, rm, t, s);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!fu.is_rm(to_expr(rm)) ||
!ctx->bvutil().is_bv(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_unsigned(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
Z3_TRY;
LOG_Z3_mk_fpa_to_fp_unsigned(c, rm, t, s);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!fu.is_rm(to_expr(rm)) ||
!ctx->bvutil().is_bv(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
expr * a = fu.mk_to_fp_unsigned(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_ubv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz) {
Z3_TRY;
LOG_Z3_mk_fpa_to_ubv(c, rm, t, sz);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_ubv(to_expr(rm), to_expr(t), sz);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_sbv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz) {
Z3_TRY;
LOG_Z3_mk_fpa_to_sbv(c, rm, t, sz);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_sbv(to_expr(rm), to_expr(t), sz);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_real(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_to_real(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_real(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
unsigned Z3_API Z3_fpa_get_ebits(Z3_context c, Z3_sort s) {
Z3_TRY;
LOG_Z3_fpa_get_ebits(c, s);
RESET_ERROR_CODE();
CHECK_NON_NULL(s, 0);
return mk_c(c)->fpautil().get_ebits(to_sort(s));
Z3_CATCH_RETURN(0);
}
unsigned Z3_API Z3_fpa_get_sbits(Z3_context c, Z3_sort s) {
Z3_TRY;
LOG_Z3_fpa_get_ebits(c, s);
RESET_ERROR_CODE();
CHECK_NON_NULL(s, 0);
return mk_c(c)->fpautil().get_sbits(to_sort(s));
Z3_CATCH_RETURN(0);
}
Z3_bool Z3_API Z3_fpa_get_numeral_sign(Z3_context c, Z3_ast t, int * sgn) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_sign(c, t, sgn);
RESET_ERROR_CODE();
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
fpa_decl_plugin * plugin = (fpa_decl_plugin*)m.get_plugin(mk_c(c)->get_fpa_fid());
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(to_expr(t), val);
if (!r || mpfm.is_nan(val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
*sgn = (mpfm.is_nan(val)) ? 0 : mpfm.sgn(val);
return r;
Z3_CATCH_RETURN(0);
}
Z3_string Z3_API Z3_fpa_get_numeral_significand_string(__in Z3_context c, __in Z3_ast t) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_significand_string(c, t);
RESET_ERROR_CODE();
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
unsynch_mpz_manager & mpzm = mpfm.mpz_manager();
unsynch_mpq_manager & mpqm = mpfm.mpq_manager();
fpa_decl_plugin * plugin = (fpa_decl_plugin*)m.get_plugin(mk_c(c)->get_fpa_fid());
scoped_mpf val(mpfm);
if (!plugin->is_numeral(to_expr(t), val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
}
else if (!mpfm.is_regular(val)) {
SET_ERROR_CODE(Z3_INVALID_ARG)
return "";
}
unsigned sbits = val.get().get_sbits();
scoped_mpq q(mpqm);
scoped_mpz sn(mpzm);
mpfm.sig_normalized(val, sn);
mpqm.set(q, sn);
mpqm.div(q, mpfm.m_powers2(sbits - 1), q);
std::stringstream ss;
mpqm.display_decimal(ss, q, sbits);
return mk_c(c)->mk_external_string(ss.str());
Z3_CATCH_RETURN("");
}
Z3_string Z3_API Z3_fpa_get_numeral_exponent_string(__in Z3_context c, __in Z3_ast t) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_exponent_string(c, t);
RESET_ERROR_CODE();
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
fpa_decl_plugin * plugin = (fpa_decl_plugin*)m.get_plugin(mk_c(c)->get_fpa_fid());
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(to_expr(t), val);
if (!r) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
}
else if (!mpfm.is_normal(val) && !mpfm.is_denormal(val)) {
SET_ERROR_CODE(Z3_INVALID_ARG)
return "";
}
mpf_exp_t exp = mpfm.exp_normalized(val);
std::stringstream ss;
ss << exp;
return mk_c(c)->mk_external_string(ss.str());
Z3_CATCH_RETURN("");
}
Z3_bool Z3_API Z3_fpa_get_numeral_exponent_int64(__in Z3_context c, __in Z3_ast t, __out __int64 * n) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_exponent_string(c, t);
RESET_ERROR_CODE();
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
fpa_decl_plugin * plugin = (fpa_decl_plugin*)m.get_plugin(mk_c(c)->get_fpa_fid());
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(to_expr(t), val);
if (!r) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
*n = mpfm.exp(val);
return 1;
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_ieee_bv(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_to_ieee_bv(c, t);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
Z3_ast r = of_ast(ctx->fpautil().mk_float_to_ieee_bv(to_expr(t)));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_int_real(Z3_context c, Z3_ast rm, Z3_ast exp, Z3_ast sig, Z3_sort s) {
Z3_TRY;
LOG_Z3_mk_fpa_to_fp_int_real(c, rm, sig, exp, s);
RESET_ERROR_CODE();
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!fu.is_rm(to_expr(rm)) ||
!ctx->autil().is_real(to_expr(sig)) ||
!ctx->autil().is_int(to_expr(exp)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(sig), to_expr(exp));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
}
};

View file

@ -293,10 +293,10 @@ extern "C" {
else {
model_ref mr;
m_solver.get()->get_model(mr);
Z3_model_ref *crap = alloc(Z3_model_ref);
crap->m_model = mr.get();
mk_c(c)->save_object(crap);
*model = of_model(crap);
Z3_model_ref *tmp_val = alloc(Z3_model_ref);
tmp_val->m_model = mr.get();
mk_c(c)->save_object(tmp_val);
*model = of_model(tmp_val);
}
*out_interp = of_ast_vector(v);
@ -490,8 +490,8 @@ extern "C" {
try {
std::string foo(filename);
if (foo.size() >= 5 && foo.substr(foo.size() - 5) == ".smt2"){
Z3_ast ass = Z3_parse_smtlib2_file(ctx, filename, 0, 0, 0, 0, 0, 0);
Z3_app app = Z3_to_app(ctx, ass);
Z3_ast assrts = Z3_parse_smtlib2_file(ctx, filename, 0, 0, 0, 0, 0, 0);
Z3_app app = Z3_to_app(ctx, assrts);
int nconjs = Z3_get_app_num_args(ctx, app);
assertions.resize(nconjs);
for (int k = 0; k < nconjs; k++)

View file

@ -663,7 +663,7 @@ extern "C" {
Z3_CATCH_RETURN(Z3_FALSE);
}
char const * Z3_API Z3_model_to_string(Z3_context c, Z3_model m) {
Z3_API char const * Z3_model_to_string(Z3_context c, Z3_model m) {
Z3_TRY;
LOG_Z3_model_to_string(c, m);
RESET_ERROR_CODE();

View file

@ -23,13 +23,15 @@ Revision History:
#include"arith_decl_plugin.h"
#include"bv_decl_plugin.h"
#include"algebraic_numbers.h"
#include"fpa_decl_plugin.h"
bool is_numeral_sort(Z3_context c, Z3_sort ty) {
sort * _ty = to_sort(ty);
family_id fid = _ty->get_family_id();
if (fid != mk_c(c)->get_arith_fid() &&
fid != mk_c(c)->get_bv_fid() &&
fid != mk_c(c)->get_datalog_fid()) {
fid != mk_c(c)->get_datalog_fid() &&
fid != mk_c(c)->get_fpa_fid()) {
return false;
}
return true;
@ -48,7 +50,7 @@ extern "C" {
Z3_ast Z3_API Z3_mk_numeral(Z3_context c, const char* n, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_numeral(c, n, ty);
RESET_ERROR_CODE();
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
}
@ -56,40 +58,42 @@ extern "C" {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
}
sort * _ty = to_sort(ty);
bool is_float = mk_c(c)->fpautil().is_float(_ty);
std::string fixed_num;
char const* m = n;
while (*m) {
if (!(('0' <= *m && *m <= '9') ||
('/' == *m) || ('-' == *m) ||
(' ' == *m) || ('\n' == *m) ||
('.' == *m) || ('e' == *m) ||
('E' == *m))) {
('/' == *m) || ('-' == *m) ||
(' ' == *m) || ('\n' == *m) ||
('.' == *m) || ('e' == *m) ||
('E' == *m) ||
('p' == *m && is_float) ||
('P' == *m && is_float))) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
return 0;
}
++m;
}
ast * a = mk_c(c)->mk_numeral_core(rational(n), to_sort(ty));
ast * a = 0;
if (_ty->get_family_id() == mk_c(c)->get_fpa_fid()) {
// avoid expanding floats into huge rationals.
fpa_util & fu = mk_c(c)->fpautil();
scoped_mpf t(fu.fm());
fu.fm().set(t, fu.get_ebits(_ty), fu.get_sbits(_ty), MPF_ROUND_TOWARD_ZERO, n);
a = fu.mk_value(t);
mk_c(c)->save_ast_trail(a);
}
else
a = mk_c(c)->mk_numeral_core(rational(n), _ty);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_int(Z3_context c, int value, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_int(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
}
ast * a = mk_c(c)->mk_numeral_core(rational(value), to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_unsigned_int(Z3_context c, unsigned value, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_unsigned_int(c, value, ty);
RESET_ERROR_CODE();
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
}
@ -97,11 +101,23 @@ extern "C" {
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_unsigned_int(Z3_context c, unsigned value, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_unsigned_int(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
}
ast * a = mk_c(c)->mk_numeral_core(rational(value), to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_int64(Z3_context c, long long value, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_int64(c, value, ty);
RESET_ERROR_CODE();
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
}
@ -110,11 +126,11 @@ extern "C" {
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
}
Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, unsigned long long value, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_unsigned_int64(c, value, ty);
RESET_ERROR_CODE();
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
}
@ -129,9 +145,11 @@ extern "C" {
LOG_Z3_is_numeral_ast(c, a);
RESET_ERROR_CODE();
expr* e = to_expr(a);
return
return
mk_c(c)->autil().is_numeral(e) ||
mk_c(c)->bvutil().is_numeral(e);
mk_c(c)->bvutil().is_numeral(e) ||
mk_c(c)->fpautil().is_numeral(e) ||
mk_c(c)->fpautil().is_rm_numeral(e);
Z3_CATCH_RETURN(Z3_FALSE);
}
@ -172,8 +190,37 @@ extern "C" {
return mk_c(c)->mk_external_string(r.to_string());
}
else {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
// floats are separated from all others to avoid huge rationals.
fpa_util & fu = mk_c(c)->fpautil();
scoped_mpf tmp(fu.fm());
mpf_rounding_mode rm;
if (mk_c(c)->fpautil().is_rm_numeral(to_expr(a), rm)) {
switch (rm) {
case OP_FPA_RM_NEAREST_TIES_TO_EVEN:
return mk_c(c)->mk_external_string("roundNearestTiesToEven");
break;
case OP_FPA_RM_NEAREST_TIES_TO_AWAY:
return mk_c(c)->mk_external_string("roundNearestTiesToAway");
break;
case OP_FPA_RM_TOWARD_POSITIVE:
return mk_c(c)->mk_external_string("roundTowardPositive");
break;
case OP_FPA_RM_TOWARD_NEGATIVE:
return mk_c(c)->mk_external_string("roundTowardNegative");
break;
case OP_FPA_RM_TOWARD_ZERO:
default:
return mk_c(c)->mk_external_string("roundTowardZero");
break;
}
}
else if (mk_c(c)->fpautil().is_numeral(to_expr(a), tmp)) {
return mk_c(c)->mk_external_string(fu.fm().to_string(tmp));
}
else {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
}
}
Z3_CATCH_RETURN("");
}

View file

@ -507,7 +507,7 @@ extern "C" {
return (Z3_ast)(p);
}
char const * Z3_API Z3_pattern_to_string(Z3_context c, Z3_pattern p) {
Z3_API char const * Z3_pattern_to_string(Z3_context c, Z3_pattern p) {
return Z3_ast_to_string(c, reinterpret_cast<Z3_ast>(p));
}

View file

@ -297,7 +297,7 @@ extern "C" {
Z3_CATCH;
}
char const * Z3_API Z3_context_to_string(Z3_context c) {
Z3_API char const * Z3_context_to_string(Z3_context c) {
Z3_TRY;
LOG_Z3_context_to_string(c);
RESET_ERROR_CODE();

View file

@ -866,6 +866,9 @@ namespace z3 {
friend expr operator|(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) | b; }
friend expr operator~(expr const & a) { Z3_ast r = Z3_mk_bvnot(a.ctx(), a); return expr(a.ctx(), r); }
expr extract(unsigned hi, unsigned lo) const { Z3_ast r = Z3_mk_extract(ctx(), hi, lo, *this); return expr(ctx(), r); }
unsigned lo() const { assert (is_app() && Z3_get_decl_num_parameters(ctx(), decl()) == 2); return static_cast<unsigned>(Z3_get_decl_int_parameter(ctx(), decl(), 1)); }
unsigned hi() const { assert (is_app() && Z3_get_decl_num_parameters(ctx(), decl()) == 2); return static_cast<unsigned>(Z3_get_decl_int_parameter(ctx(), decl(), 0)); }
/**
\brief Return a simplified version of this expression.

View file

@ -213,12 +213,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_dec_ref(ctx.nCtx, obj);
}
@ -227,10 +229,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 +238,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);
}

View file

@ -128,12 +128,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_ast_map_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_ast_map_dec_ref(ctx.nCtx, obj);
}

View file

@ -105,12 +105,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_ast_vector_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_ast_vector_dec_ref(ctx.nCtx, obj);
}

View file

@ -85,12 +85,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_apply_result_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_apply_result_dec_ref(ctx.nCtx, obj);
}

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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
}

View file

@ -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
}

View file

@ -3493,6 +3493,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_int_uint(nCtx, sgn ? 1 : 0, exp, sig, 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, Int64 exp, UInt64 sig, FPSort s)
{
Contract.Ensures(Contract.Result<FPRMExpr>() != null);
return new FPNum(this, Native.Z3_mk_fpa_numeral_int64_uint64(nCtx, sgn ? 1 : 0, exp, sig, 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, exp, sig, 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, exp, sig, 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="exp">Exponent term of Int sort.</param>
/// <param name="sig">Significand term of Real sort.</param>
/// <param name="s">FloatingPoint sort.</param>
public BitVecExpr MkFPToFP(FPRMExpr rm, IntExpr exp, RealExpr sig, FPSort s)
{
Contract.Ensures(Contract.Result<BitVecExpr>() != null);
return new BitVecExpr(this, Native.Z3_mk_fpa_to_fp_int_real(this.nCtx, rm.NativeObject, exp.NativeObject, sig.NativeObject, s.NativeObject));
}
#endregion
#endregion // Floating-point Arithmetic
#region Miscellaneous
/// <summary>
@ -3543,17 +4342,7 @@ namespace Microsoft.Z3
public ParamDescrs SimplifyParameterDescriptions
{
get { return new ParamDescrs(this, Native.Z3_simplify_get_param_descrs(nCtx)); }
}
/// <summary>
/// Enable/disable printing of warning messages to the console.
/// </summary>
/// <remarks>Note that this function is static and effects the behaviour of
/// all contexts globally.</remarks>
public static void ToggleWarningMessages(bool enabled)
{
Native.Z3_toggle_warning_messages((enabled) ? 1 : 0);
}
}
#endregion
#region Error Handling
@ -3653,38 +4442,101 @@ namespace Microsoft.Z3
}
readonly private AST.DecRefQueue m_AST_DRQ = new AST.DecRefQueue();
readonly private ASTMap.DecRefQueue m_ASTMap_DRQ = new ASTMap.DecRefQueue();
readonly private ASTVector.DecRefQueue m_ASTVector_DRQ = new ASTVector.DecRefQueue();
readonly private ApplyResult.DecRefQueue m_ApplyResult_DRQ = new ApplyResult.DecRefQueue();
readonly private FuncInterp.Entry.DecRefQueue m_FuncEntry_DRQ = new FuncInterp.Entry.DecRefQueue();
readonly private FuncInterp.DecRefQueue m_FuncInterp_DRQ = new FuncInterp.DecRefQueue();
readonly private Goal.DecRefQueue m_Goal_DRQ = new Goal.DecRefQueue();
readonly private Model.DecRefQueue m_Model_DRQ = new Model.DecRefQueue();
readonly private Params.DecRefQueue m_Params_DRQ = new Params.DecRefQueue();
readonly private ParamDescrs.DecRefQueue m_ParamDescrs_DRQ = new ParamDescrs.DecRefQueue();
readonly private Probe.DecRefQueue m_Probe_DRQ = new Probe.DecRefQueue();
readonly private Solver.DecRefQueue m_Solver_DRQ = new Solver.DecRefQueue();
readonly private Statistics.DecRefQueue m_Statistics_DRQ = new Statistics.DecRefQueue();
readonly private Tactic.DecRefQueue m_Tactic_DRQ = new Tactic.DecRefQueue();
readonly private Fixedpoint.DecRefQueue m_Fixedpoint_DRQ = new Fixedpoint.DecRefQueue();
readonly private Optimize.DecRefQueue m_Optimize_DRQ = new Optimize.DecRefQueue();
readonly private ASTMap.DecRefQueue m_ASTMap_DRQ = new ASTMap.DecRefQueue(10);
readonly private ASTVector.DecRefQueue m_ASTVector_DRQ = new ASTVector.DecRefQueue(10);
readonly private ApplyResult.DecRefQueue m_ApplyResult_DRQ = new ApplyResult.DecRefQueue(10);
readonly private FuncInterp.Entry.DecRefQueue m_FuncEntry_DRQ = new FuncInterp.Entry.DecRefQueue(10);
readonly private FuncInterp.DecRefQueue m_FuncInterp_DRQ = new FuncInterp.DecRefQueue(10);
readonly private Goal.DecRefQueue m_Goal_DRQ = new Goal.DecRefQueue(10);
readonly private Model.DecRefQueue m_Model_DRQ = new Model.DecRefQueue(10);
readonly private Params.DecRefQueue m_Params_DRQ = new Params.DecRefQueue(10);
readonly private ParamDescrs.DecRefQueue m_ParamDescrs_DRQ = new ParamDescrs.DecRefQueue(10);
readonly private Probe.DecRefQueue m_Probe_DRQ = new Probe.DecRefQueue(10);
readonly private Solver.DecRefQueue m_Solver_DRQ = new Solver.DecRefQueue(10);
readonly private Statistics.DecRefQueue m_Statistics_DRQ = new Statistics.DecRefQueue(10);
readonly private Tactic.DecRefQueue m_Tactic_DRQ = new Tactic.DecRefQueue(10);
readonly private Fixedpoint.DecRefQueue m_Fixedpoint_DRQ = new Fixedpoint.DecRefQueue(10);
readonly private Optimize.DecRefQueue m_Optimize_DRQ = new Optimize.DecRefQueue(10);
internal AST.DecRefQueue AST_DRQ { get { Contract.Ensures(Contract.Result<AST.DecRefQueue>() != null); return m_AST_DRQ; } }
internal ASTMap.DecRefQueue ASTMap_DRQ { get { Contract.Ensures(Contract.Result<ASTMap.DecRefQueue>() != null); return m_ASTMap_DRQ; } }
internal ASTVector.DecRefQueue ASTVector_DRQ { get { Contract.Ensures(Contract.Result<ASTVector.DecRefQueue>() != null); return m_ASTVector_DRQ; } }
internal ApplyResult.DecRefQueue ApplyResult_DRQ { get { Contract.Ensures(Contract.Result<ApplyResult.DecRefQueue>() != null); return m_ApplyResult_DRQ; } }
internal FuncInterp.Entry.DecRefQueue FuncEntry_DRQ { get { Contract.Ensures(Contract.Result<FuncInterp.Entry.DecRefQueue>() != null); return m_FuncEntry_DRQ; } }
internal FuncInterp.DecRefQueue FuncInterp_DRQ { get { Contract.Ensures(Contract.Result<FuncInterp.DecRefQueue>() != null); return m_FuncInterp_DRQ; } }
internal Goal.DecRefQueue Goal_DRQ { get { Contract.Ensures(Contract.Result<Goal.DecRefQueue>() != null); return m_Goal_DRQ; } }
internal Model.DecRefQueue Model_DRQ { get { Contract.Ensures(Contract.Result<Model.DecRefQueue>() != null); return m_Model_DRQ; } }
internal Params.DecRefQueue Params_DRQ { get { Contract.Ensures(Contract.Result<Params.DecRefQueue>() != null); return m_Params_DRQ; } }
internal ParamDescrs.DecRefQueue ParamDescrs_DRQ { get { Contract.Ensures(Contract.Result<ParamDescrs.DecRefQueue>() != null); return m_ParamDescrs_DRQ; } }
internal Probe.DecRefQueue Probe_DRQ { get { Contract.Ensures(Contract.Result<Probe.DecRefQueue>() != null); return m_Probe_DRQ; } }
internal Solver.DecRefQueue Solver_DRQ { get { Contract.Ensures(Contract.Result<Solver.DecRefQueue>() != null); return m_Solver_DRQ; } }
internal Statistics.DecRefQueue Statistics_DRQ { get { Contract.Ensures(Contract.Result<Statistics.DecRefQueue>() != null); return m_Statistics_DRQ; } }
internal Tactic.DecRefQueue Tactic_DRQ { get { Contract.Ensures(Contract.Result<Tactic.DecRefQueue>() != null); return m_Tactic_DRQ; } }
internal Fixedpoint.DecRefQueue Fixedpoint_DRQ { get { Contract.Ensures(Contract.Result<Fixedpoint.DecRefQueue>() != null); return m_Fixedpoint_DRQ; } }
internal Optimize.DecRefQueue Optimize_DRQ { get { Contract.Ensures(Contract.Result<Optimize.DecRefQueue>() != null); return m_Optimize_DRQ; } }
/// <summary>
/// AST DRQ
/// </summary>
public IDecRefQueue AST_DRQ { get { Contract.Ensures(Contract.Result<AST.DecRefQueue>() != null); return m_AST_DRQ; } }
/// <summary>
/// ASTMap DRQ
/// </summary>
public IDecRefQueue ASTMap_DRQ { get { Contract.Ensures(Contract.Result<ASTMap.DecRefQueue>() != null); return m_ASTMap_DRQ; } }
/// <summary>
/// ASTVector DRQ
/// </summary>
public IDecRefQueue ASTVector_DRQ { get { Contract.Ensures(Contract.Result<ASTVector.DecRefQueue>() != null); return m_ASTVector_DRQ; } }
/// <summary>
/// ApplyResult DRQ
/// </summary>
public IDecRefQueue ApplyResult_DRQ { get { Contract.Ensures(Contract.Result<ApplyResult.DecRefQueue>() != null); return m_ApplyResult_DRQ; } }
/// <summary>
/// FuncEntry DRQ
/// </summary>
public IDecRefQueue FuncEntry_DRQ { get { Contract.Ensures(Contract.Result<FuncInterp.Entry.DecRefQueue>() != null); return m_FuncEntry_DRQ; } }
/// <summary>
/// FuncInterp DRQ
/// </summary>
public IDecRefQueue FuncInterp_DRQ { get { Contract.Ensures(Contract.Result<FuncInterp.DecRefQueue>() != null); return m_FuncInterp_DRQ; } }
/// <summary>
/// Goal DRQ
/// </summary>
public IDecRefQueue Goal_DRQ { get { Contract.Ensures(Contract.Result<Goal.DecRefQueue>() != null); return m_Goal_DRQ; } }
/// <summary>
/// Model DRQ
/// </summary>
public IDecRefQueue Model_DRQ { get { Contract.Ensures(Contract.Result<Model.DecRefQueue>() != null); return m_Model_DRQ; } }
/// <summary>
/// Params DRQ
/// </summary>
public IDecRefQueue Params_DRQ { get { Contract.Ensures(Contract.Result<Params.DecRefQueue>() != null); return m_Params_DRQ; } }
/// <summary>
/// ParamDescrs DRQ
/// </summary>
public IDecRefQueue ParamDescrs_DRQ { get { Contract.Ensures(Contract.Result<ParamDescrs.DecRefQueue>() != null); return m_ParamDescrs_DRQ; } }
/// <summary>
/// Probe DRQ
/// </summary>
public IDecRefQueue Probe_DRQ { get { Contract.Ensures(Contract.Result<Probe.DecRefQueue>() != null); return m_Probe_DRQ; } }
/// <summary>
/// Solver DRQ
/// </summary>
public IDecRefQueue Solver_DRQ { get { Contract.Ensures(Contract.Result<Solver.DecRefQueue>() != null); return m_Solver_DRQ; } }
/// <summary>
/// Statistics DRQ
/// </summary>
public IDecRefQueue Statistics_DRQ { get { Contract.Ensures(Contract.Result<Statistics.DecRefQueue>() != null); return m_Statistics_DRQ; } }
/// <summary>
/// Tactic DRQ
/// </summary>
public IDecRefQueue Tactic_DRQ { get { Contract.Ensures(Contract.Result<Tactic.DecRefQueue>() != null); return m_Tactic_DRQ; } }
/// <summary>
/// FixedPoint DRQ
/// </summary>
public IDecRefQueue Fixedpoint_DRQ { get { Contract.Ensures(Contract.Result<Fixedpoint.DecRefQueue>() != null); return m_Fixedpoint_DRQ; } }
/// <summary>
/// Optimize DRQ
/// </summary>
public IDecRefQueue Optimize_DRQ { get { Contract.Ensures(Contract.Result<Optimize.DecRefQueue>() != null); return m_Fixedpoint_DRQ; } }
internal long refCount = 0;

View file

@ -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)
{

View file

@ -44,6 +44,16 @@ namespace Microsoft.Z3
}
}
/// <summary>
/// Retrieves the inx'th constant declaration in the enumeration.
/// </summary>
/// <param name="inx"></param>
/// <returns></returns>
public FuncDecl ConstDecl(uint inx)
{
return new FuncDecl(Context, Native.Z3_get_datatype_sort_constructor(Context.nCtx, NativeObject, inx));
}
/// <summary>
/// The constants in the enumeration.
/// </summary>
@ -61,7 +71,17 @@ namespace Microsoft.Z3
}
/// <summary>
/// The test predicates for the constants in the enumeration.
/// Retrieves the inx'th constant in the enumeration.
/// </summary>
/// <param name="inx"></param>
/// <returns></returns>
public Expr Const(uint inx)
{
return Context.MkApp(ConstDecl(inx));
}
/// <summary>
/// The test predicates (recognizers) for the constants in the enumeration.
/// </summary>
public FuncDecl[] TesterDecls
{
@ -76,9 +96,19 @@ namespace Microsoft.Z3
}
}
/// <summary>
/// Retrieves the inx'th tester/recognizer declaration in the enumeration.
/// </summary>
/// <param name="inx"></param>
/// <returns></returns>
public FuncDecl TesterDecl(uint inx)
{
return new FuncDecl(Context, Native.Z3_get_datatype_sort_recognizer(Context.nCtx, NativeObject, inx));
}
#region Internal
internal EnumSort(Context ctx, Symbol name, Symbol[] enumNames)
: base(ctx)
: base(ctx, IntPtr.Zero)
{
Contract.Requires(ctx != null);
Contract.Requires(name != null);

View file

@ -1311,7 +1311,7 @@ namespace Microsoft.Z3
#region Relational Terms
/// <summary>
/// Indicates whether the term is of an array sort.
/// Indicates whether the term is of relation sort.
/// </summary>
public bool IsRelation
{
@ -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
View 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
View 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 &lt; s &lt; 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);
}
}
}

View 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
View 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
}
}

View 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
View 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
}
}

View file

@ -348,12 +348,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_fixedpoint_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_fixedpoint_dec_ref(ctx.nCtx, obj);
}

View file

@ -91,12 +91,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_func_entry_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_func_entry_dec_ref(ctx.nCtx, obj);
}
@ -197,12 +199,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_func_interp_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_func_interp_dec_ref(ctx.nCtx, obj);
}

View file

@ -82,6 +82,40 @@ namespace Microsoft.Z3
public static void ResetParameters()
{
Native.Z3_global_param_reset_all();
}
}
/// <summary>
/// Enable/disable printing of warning messages to the console.
/// </summary>
/// <remarks>Note that this function is static and effects the behaviour of
/// all contexts globally.</remarks>
public static void ToggleWarningMessages(bool enabled)
{
Native.Z3_toggle_warning_messages((enabled) ? 1 : 0);
}
/// <summary>
/// Enable tracing messages tagged as `tag' when Z3 is compiled in debug mode.
/// </summary>
/// <remarks>
/// It is a NOOP otherwise.
/// </remarks>
/// <param name="tag">trace tag</param>
public static void EnableTrace(string tag)
{
Native.Z3_enable_trace(tag);
}
/// <summary>
/// Disable tracing messages tagged as `tag' when Z3 is compiled in debug mode.
/// </summary>
/// <remarks>
/// It is a NOOP otherwise.
/// </remarks>
/// <param name="tag">trace tag</param>
public static void DisableTrace(string tag)
{
Native.Z3_disable_trace(tag);
}
}
}

View file

@ -219,12 +219,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_goal_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_goal_dec_ref(ctx.nCtx, obj);
}

View file

@ -25,8 +25,11 @@ using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
/// <summary>
/// DecRefQueue interface
/// </summary>
[ContractClass(typeof(DecRefQueueContracts))]
internal abstract class IDecRefQueue
public abstract class IDecRefQueue
{
#region Object invariant
@ -38,14 +41,25 @@ namespace Microsoft.Z3
#endregion
readonly internal protected Object m_lock = new Object();
readonly internal protected List<IntPtr> m_queue = new List<IntPtr>();
internal const uint m_move_limit = 1024;
readonly private Object m_lock = new Object();
readonly private List<IntPtr> m_queue = new List<IntPtr>();
private uint m_move_limit;
public abstract void IncRef(Context ctx, IntPtr obj);
public abstract void DecRef(Context ctx, IntPtr obj);
internal IDecRefQueue(uint move_limit = 1024)
{
m_move_limit = move_limit;
}
public void IncAndClear(Context ctx, IntPtr o)
/// <summary>
/// Sets the limit on numbers of objects that are kept back at GC collection.
/// </summary>
/// <param name="l"></param>
public void SetLimit(uint l) { m_move_limit = l; }
internal abstract void IncRef(Context ctx, IntPtr obj);
internal abstract void DecRef(Context ctx, IntPtr obj);
internal void IncAndClear(Context ctx, IntPtr o)
{
Contract.Requires(ctx != null);
@ -53,7 +67,7 @@ namespace Microsoft.Z3
if (m_queue.Count >= m_move_limit) Clear(ctx);
}
public void Add(IntPtr o)
internal void Add(IntPtr o)
{
if (o == IntPtr.Zero) return;
@ -63,7 +77,7 @@ namespace Microsoft.Z3
}
}
public void Clear(Context ctx)
internal void Clear(Context ctx)
{
Contract.Requires(ctx != null);
@ -79,12 +93,12 @@ namespace Microsoft.Z3
[ContractClassFor(typeof(IDecRefQueue))]
abstract class DecRefQueueContracts : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
internal override void IncRef(Context ctx, IntPtr obj)
{
Contract.Requires(ctx != null);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Contract.Requires(ctx != null);
}

View file

@ -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)
{

View file

@ -13,7 +13,7 @@ namespace Microsoft.Z3
/// <remarks>For more information on interpolation please refer
/// too the C/C++ API, which is well documented.</remarks>
[ContractVerification(true)]
class InterpolationContext : Context
public class InterpolationContext : Context
{
/// <summary>

View file

@ -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);

View file

@ -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" />

View file

@ -291,12 +291,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_model_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_model_dec_ref(ctx.nCtx, obj);
}

View file

@ -269,12 +269,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_optimize_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_optimize_dec_ref(ctx.nCtx, obj);
}

View file

@ -87,12 +87,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_param_descrs_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_param_descrs_dec_ref(ctx.nCtx, obj);
}

View file

@ -23,7 +23,7 @@ using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
/// <summary>
/// A ParameterSet represents a configuration in the form of Symbol/value pairs.
/// A Params objects represents a configuration in the form of Symbol/value pairs.
/// </summary>
[ContractVerification(true)]
public class Params : Z3Object
@ -142,12 +142,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_params_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_params_dec_ref(ctx.nCtx, obj);
}

View file

@ -73,12 +73,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_probe_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_probe_dec_ref(ctx.nCtx, obj);
}

View file

@ -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);

View file

@ -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)
{

View file

@ -328,12 +328,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_solver_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_solver_dec_ref(ctx.nCtx, obj);
}

View file

@ -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");
}

View file

@ -189,12 +189,14 @@ namespace Microsoft.Z3
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_stats_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_stats_dec_ref(ctx.nCtx, obj);
}

View file

@ -112,14 +112,19 @@ namespace Microsoft.Z3
Contract.Requires(ctx != null);
}
/// <summary>
/// DecRefQueue
/// </summary>
internal class DecRefQueue : IDecRefQueue
{
public override void IncRef(Context ctx, IntPtr obj)
public DecRefQueue() : base() { }
public DecRefQueue(uint move_limit) : base(move_limit) { }
internal override void IncRef(Context ctx, IntPtr obj)
{
Native.Z3_tactic_inc_ref(ctx.nCtx, obj);
}
public override void DecRef(Context ctx, IntPtr obj)
internal override void DecRef(Context ctx, IntPtr obj)
{
Native.Z3_tactic_dec_ref(ctx.nCtx, obj);
}

View file

@ -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);

View file

@ -28,7 +28,8 @@ public class AST extends Z3Object
/**
* Object comparison.
* <param name="o">another AST</param>
*
* @param o another AST
**/
public boolean equals(Object o)
{
@ -46,10 +47,12 @@ public class AST extends Z3Object
}
/**
* Object Comparison. <param name="other">Another AST</param>
* Object Comparison.
* @param other Another AST
*
* @return Negative if the object should be sorted before <paramref
* name="other"/>, positive if after else zero.
* @return Negative if the object should be sorted before {@code other},
* positive if after else zero.
* @throws Z3Exception on error
**/
public int compareTo(Object other) throws Z3Exception
{
@ -90,6 +93,7 @@ public class AST extends Z3Object
/**
* A unique identifier for the AST (unique among all ASTs).
* @throws Z3Exception on error
**/
public int getId() throws Z3Exception
{
@ -97,10 +101,11 @@ public class AST extends Z3Object
}
/**
* Translates (copies) the AST to the Context <paramref name="ctx"/>. <param
* name="ctx">A context</param>
* Translates (copies) the AST to the Context {@code ctx}.
* @param ctx A context
*
* @return A copy of the AST which is associated with <paramref name="ctx"/>
* @return A copy of the AST which is associated with {@code ctx}
* @throws Z3Exception on error
**/
public AST translate(Context ctx) throws Z3Exception
{
@ -114,6 +119,7 @@ public class AST extends Z3Object
/**
* The kind of the AST.
* @throws Z3Exception on error
**/
public Z3_ast_kind getASTKind() throws Z3Exception
{
@ -123,6 +129,8 @@ public class AST extends Z3Object
/**
* Indicates whether the AST is an Expr
* @throws Z3Exception on error
* @throws Z3Exception on error
**/
public boolean isExpr() throws Z3Exception
{
@ -140,6 +148,8 @@ public class AST extends Z3Object
/**
* Indicates whether the AST is an application
* @return a boolean
* @throws Z3Exception on error
**/
public boolean isApp() throws Z3Exception
{
@ -147,7 +157,9 @@ public class AST extends Z3Object
}
/**
* Indicates whether the AST is a BoundVariable
* Indicates whether the AST is a BoundVariable.
* @return a boolean
* @throws Z3Exception on error
**/
public boolean isVar() throws Z3Exception
{
@ -156,6 +168,8 @@ public class AST extends Z3Object
/**
* Indicates whether the AST is a Quantifier
* @return a boolean
* @throws Z3Exception on error
**/
public boolean isQuantifier() throws Z3Exception
{
@ -213,22 +227,18 @@ public class AST extends Z3Object
void incRef(long o) throws Z3Exception
{
// Console.WriteLine("AST IncRef()");
if (getContext() == null)
throw new Z3Exception("inc() called on null context");
if (o == 0)
throw new Z3Exception("inc() called on null AST");
getContext().ast_DRQ().incAndClear(getContext(), o);
if (getContext() == null || o == 0)
return;
getContext().getASTDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
// Console.WriteLine("AST DecRef()");
if (getContext() == null)
throw new Z3Exception("dec() called on null context");
if (o == 0)
throw new Z3Exception("dec() called on null AST");
getContext().ast_DRQ().add(o);
if (getContext() == null || o == 0)
return;
getContext().getASTDRQ().add(o);
super.decRef(o);
}

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ASTDecRefQueue extends IDecRefQueue
{
public ASTDecRefQueue()
{
super();
}
public ASTDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -23,10 +23,10 @@ package com.microsoft.z3;
class ASTMap extends Z3Object
{
/**
* Checks whether the map contains the key <paramref name="k"/>. <param
* name="k">An AST</param>
* Checks whether the map contains the key {@code k}.
* @param k An AST
*
* @return True if <paramref name="k"/> is a key in the map, false
* @return True if {@code k} is a key in the map, false
* otherwise.
**/
public boolean contains(AST k) throws Z3Exception
@ -37,9 +37,10 @@ class ASTMap extends Z3Object
}
/**
* Finds the value associated with the key <paramref name="k"/>. <remarks>
* This function signs an error when <paramref name="k"/> is not a key in
* the map. </remarks> <param name="k">An AST</param>
* Finds the value associated with the key {@code k}.
* Remarks: This function signs an error when {@code k} is not a key in
* the map.
* @param k An AST
*
* @throws Z3Exception
**/
@ -50,8 +51,9 @@ class ASTMap extends Z3Object
}
/**
* Stores or replaces a new key/value pair in the map. <param name="k">The
* key AST</param> <param name="v">The value AST</param>
* Stores or replaces a new key/value pair in the map.
* @param k The key AST
* @param v The value AST
**/
public void insert(AST k, AST v) throws Z3Exception
{
@ -61,12 +63,11 @@ class ASTMap extends Z3Object
}
/**
* Erases the key <paramref name="k"/> from the map. <param name="k">An
* AST</param>
* Erases the key {@code k} from the map.
* @param k An AST
**/
public void erase(AST k) throws Z3Exception
{
Native.astMapErase(getContext().nCtx(), getNativeObject(), k.getNativeObject());
}
@ -123,13 +124,13 @@ class ASTMap extends Z3Object
void incRef(long o) throws Z3Exception
{
getContext().astmap_DRQ().incAndClear(getContext(), o);
getContext().getASTMapDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().astmap_DRQ().add(o);
getContext().getASTMapDRQ().add(o);
super.decRef(o);
}
}

View file

@ -31,9 +31,10 @@ class ASTVector extends Z3Object
}
/**
* Retrieves the i-th object in the vector. <remarks>May throw an
* IndexOutOfBoundsException when <paramref name="i"/> is out of
* range.</remarks> <param name="i">Index</param>
* Retrieves the i-th object in the vector.
* Remarks: May throw an {@code IndexOutOfBoundsException} when
* {@code i} is out of range.
* @param i Index
*
* @return An AST
* @throws Z3Exception
@ -52,8 +53,8 @@ class ASTVector extends Z3Object
}
/**
* Resize the vector to <paramref name="newSize"/>. <param
* name="newSize">The new size of the vector.</param>
* Resize the vector to {@code newSize}.
* @param newSize The new size of the vector.
**/
public void resize(int newSize) throws Z3Exception
{
@ -61,8 +62,9 @@ class ASTVector extends Z3Object
}
/**
* Add the AST <paramref name="a"/> to the back of the vector. The size is
* increased by 1. <param name="a">An AST</param>
* Add the AST {@code a} to the back of the vector. The size is
* increased by 1.
* @param a An AST
**/
public void push(AST a) throws Z3Exception
{
@ -70,8 +72,8 @@ class ASTVector extends Z3Object
}
/**
* Translates all ASTs in the vector to <paramref name="ctx"/>. <param
* name="ctx">A context</param>
* Translates all ASTs in the vector to {@code ctx}.
* @param ctx A context
*
* @return A new ASTVector
* @throws Z3Exception
@ -108,13 +110,13 @@ class ASTVector extends Z3Object
void incRef(long o) throws Z3Exception
{
getContext().astvector_DRQ().incAndClear(getContext(), o);
getContext().getASTVectorDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().astvector_DRQ().add(o);
getContext().getASTVectorDRQ().add(o);
super.decRef(o);
}
}

View file

@ -24,11 +24,13 @@ public class AlgebraicNum extends ArithExpr
{
/**
* Return a upper bound for a given real algebraic number. The interval
* isolating the number is smaller than 1/10^<paramref name="precision"/>.
* <seealso cref="Expr.IsAlgebraicNumber"/> <param name="precision">the
* precision of the result</param>
* isolating the number is smaller than 1/10^{@code precision}.
*
* @see Expr#isAlgebraicNumber
* @param precision the precision of the result
*
* @return A numeral Expr of sort Real
* @throws Z3Exception on error
**/
public RatNum toUpper(int precision) throws Z3Exception
{
@ -39,10 +41,13 @@ public class AlgebraicNum extends ArithExpr
/**
* Return a lower bound for the given real algebraic number. The interval
* isolating the number is smaller than 1/10^<paramref name="precision"/>.
* <seealso cref="Expr.IsAlgebraicNumber"/> <param name="precision"></param>
* isolating the number is smaller than 1/10^{@code precision}.
*
* @see Expr#isAlgebraicNumber
* @param precision precision
*
* @return A numeral Expr of sort Real
* @throws Z3Exception on error
**/
public RatNum toLower(int precision) throws Z3Exception
{
@ -52,8 +57,11 @@ public class AlgebraicNum extends ArithExpr
}
/**
* Returns a string representation in decimal notation. <remarks>The result
* has at most <paramref name="precision"/> decimal places.</remarks>
* Returns a string representation in decimal notation.
* Remarks: The result has at most {@code precision} decimal places.
* @param precision precision
* @return String
* @throws Z3Exception on error
**/
public String toDecimal(int precision) throws Z3Exception
{

View file

@ -48,10 +48,10 @@ public class ApplyResult extends Z3Object
}
/**
* Convert a model for the subgoal <paramref name="i"/> into a model for the
* original goal <code>g</code>, that the ApplyResult was obtained from.
* Convert a model for the subgoal {@code i} into a model for the
* original goal {@code g}, that the ApplyResult was obtained from.
*
* @return A model for <code>g</code>
* @return A model for {@code g}
* @throws Z3Exception
**/
public Model convertModel(int i, Model m) throws Z3Exception
@ -81,13 +81,13 @@ public class ApplyResult extends Z3Object
void incRef(long o) throws Z3Exception
{
getContext().applyResult_DRQ().incAndClear(getContext(), o);
getContext().getApplyResultDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().applyResult_DRQ().add(o);
getContext().getApplyResultDRQ().add(o);
super.decRef(o);
}
}

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ApplyResultDecRefQueue extends IDecRefQueue
{
public ApplyResultDecRefQueue()
{
super();
}
public ApplyResultDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -22,16 +22,11 @@ package com.microsoft.z3;
**/
public class ArithExpr extends Expr
{
/**
* Constructor for ArithExpr </summary>
**/
protected ArithExpr(Context ctx)
{
super(ctx);
}
ArithExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
/**
* Constructor for ArithExpr
**/
ArithExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}

View file

@ -22,8 +22,8 @@ package com.microsoft.z3;
**/
public class ArithSort extends Sort
{
ArithSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ArithSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
};

View file

@ -23,16 +23,11 @@ package com.microsoft.z3;
**/
public class ArrayExpr extends Expr
{
/**
* Constructor for ArrayExpr </summary>
**/
protected ArrayExpr(Context ctx)
{
super(ctx);
}
ArrayExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
/**
* Constructor for ArrayExpr
**/
ArrayExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}

View file

@ -22,34 +22,38 @@ package com.microsoft.z3;
**/
public class ArraySort extends Sort
{
/**
* The domain of the array sort.
* @throws Z3Exception
**/
public Sort getDomain() throws Z3Exception
{
return Sort.create(getContext(),
Native.getArraySortDomain(getContext().nCtx(), getNativeObject()));
}
/**
* The domain of the array sort.
* @throws Z3Exception
* @throws Z3Exception on error
* @return a sort
**/
public Sort getDomain() throws Z3Exception
{
return Sort.create(getContext(),
Native.getArraySortDomain(getContext().nCtx(), getNativeObject()));
}
/**
* The range of the array sort.
* @throws Z3Exception
**/
public Sort getRange() throws Z3Exception
{
return Sort.create(getContext(),
Native.getArraySortRange(getContext().nCtx(), getNativeObject()));
}
/**
* The range of the array sort.
* @throws Z3Exception
* @throws Z3Exception on error
* @return a sort
**/
public Sort getRange() throws Z3Exception
{
return Sort.create(getContext(),
Native.getArraySortRange(getContext().nCtx(), getNativeObject()));
}
ArraySort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ArraySort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ArraySort(Context ctx, Sort domain, Sort range) throws Z3Exception
{
super(ctx, Native.mkArraySort(ctx.nCtx(), domain.getNativeObject(),
range.getNativeObject()));
}
ArraySort(Context ctx, Sort domain, Sort range) throws Z3Exception
{
super(ctx, Native.mkArraySort(ctx.nCtx(), domain.getNativeObject(),
range.getNativeObject()));
}
};

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ASTMapDecRefQueue extends IDecRefQueue
{
public ASTMapDecRefQueue()
{
super();
}
public ASTMapDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ASTVectorDecRefQueue extends IDecRefQueue
{
public ASTVectorDecRefQueue()
{
super();
}
public ASTVectorDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -23,25 +23,22 @@ package com.microsoft.z3;
public class BitVecExpr extends Expr
{
/**
* The size of the sort of a bit-vector term.
* @throws Z3Exception
**/
public int getSortSize() throws Z3Exception
{
return ((BitVecSort) getSort()).getSize();
}
/**
* The size of the sort of a bit-vector term.
* @throws Z3Exception
* @throws Z3Exception on error
* @return an int
**/
public int getSortSize() throws Z3Exception
{
return ((BitVecSort) getSort()).getSize();
}
/**
* Constructor for BitVecExpr </summary>
**/
BitVecExpr(Context ctx)
{
super(ctx);
}
BitVecExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
/**
* Constructor for BitVecExpr
**/
BitVecExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}

View file

@ -22,16 +22,18 @@ package com.microsoft.z3;
**/
public class BitVecSort extends Sort
{
/**
* The size of the bit-vector sort.
**/
public int getSize() throws Z3Exception
{
return Native.getBvSortSize(getContext().nCtx(), getNativeObject());
}
/**
* The size of the bit-vector sort.
* @throws Z3Exception on error
* @return an int
**/
public int getSize() throws Z3Exception
{
return Native.getBvSortSize(getContext().nCtx(), getNativeObject());
}
BitVecSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
BitVecSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
};

View file

@ -22,20 +22,21 @@ package com.microsoft.z3;
**/
public class BoolExpr extends Expr
{
/**
* Constructor for BoolExpr </summary>
**/
protected BoolExpr(Context ctx)
{
super(ctx);
}
/**
* Constructor for BoolExpr
**/
protected BoolExpr(Context ctx)
{
super(ctx);
}
/**
* Constructor for BoolExpr </summary>
* @throws Z3Exception
**/
BoolExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
/**
* Constructor for BoolExpr
* @throws Z3Exception
* @throws Z3Exception on error
**/
BoolExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}

View file

@ -22,48 +22,53 @@ package com.microsoft.z3;
**/
public class Constructor extends Z3Object
{
/**
* The number of fields of the constructor.
* @throws Z3Exception
**/
public int getNumFields() throws Z3Exception
{
return n;
}
/**
* The number of fields of the constructor.
* @throws Z3Exception
* @throws Z3Exception on error
* @return an int
**/
public int getNumFields() throws Z3Exception
{
return n;
}
/**
* The function declaration of the constructor.
* @throws Z3Exception
**/
public FuncDecl ConstructorDecl() throws Z3Exception
{
Native.LongPtr constructor = new Native.LongPtr();
Native.LongPtr tester = new Native.LongPtr();
long[] accessors = new long[n];
/**
* The function declaration of the constructor.
* @throws Z3Exception
* @throws Z3Exception on error
**/
public FuncDecl ConstructorDecl() throws Z3Exception
{
Native.LongPtr constructor = new Native.LongPtr();
Native.LongPtr tester = new Native.LongPtr();
long[] accessors = new long[n];
Native.queryConstructor(getContext().nCtx(), getNativeObject(), n, constructor, tester, accessors);
return new FuncDecl(getContext(), constructor.value);
}
}
/**
* The function declaration of the tester.
* @throws Z3Exception
**/
public FuncDecl getTesterDecl() throws Z3Exception
{
Native.LongPtr constructor = new Native.LongPtr();
/**
* The function declaration of the tester.
* @throws Z3Exception
* @throws Z3Exception on error
**/
public FuncDecl getTesterDecl() throws Z3Exception
{
Native.LongPtr constructor = new Native.LongPtr();
Native.LongPtr tester = new Native.LongPtr();
long[] accessors = new long[n];
Native.queryConstructor(getContext().nCtx(), getNativeObject(), n, constructor, tester, accessors);
return new FuncDecl(getContext(), tester.value);
}
}
/**
* The function declarations of the accessors
* @throws Z3Exception
**/
public FuncDecl[] getAccessorDecls() throws Z3Exception
{
Native.LongPtr constructor = new Native.LongPtr();
/**
* The function declarations of the accessors
* @throws Z3Exception
* @throws Z3Exception on error
**/
public FuncDecl[] getAccessorDecls() throws Z3Exception
{
Native.LongPtr constructor = new Native.LongPtr();
Native.LongPtr tester = new Native.LongPtr();
long[] accessors = new long[n];
Native.queryConstructor(getContext().nCtx(), getNativeObject(), n, constructor, tester, accessors);
@ -71,39 +76,40 @@ public class Constructor extends Z3Object
for (int i = 0; i < n; i++)
t[i] = new FuncDecl(getContext(), accessors[i]);
return t;
}
}
/**
* Destructor.
**/
protected void finalize() throws Z3Exception
{
Native.delConstructor(getContext().nCtx(), getNativeObject());
}
/**
* Destructor.
* @throws Z3Exception on error
**/
protected void finalize() throws Z3Exception
{
Native.delConstructor(getContext().nCtx(), getNativeObject());
}
private int n = 0;
private int n = 0;
Constructor(Context ctx, Symbol name, Symbol recognizer,
Symbol[] fieldNames, Sort[] sorts, int[] sortRefs)
throws Z3Exception
{
super(ctx);
Constructor(Context ctx, Symbol name, Symbol recognizer,
Symbol[] fieldNames, Sort[] sorts, int[] sortRefs)
throws Z3Exception
{
super(ctx);
n = AST.arrayLength(fieldNames);
n = AST.arrayLength(fieldNames);
if (n != AST.arrayLength(sorts))
throw new Z3Exception(
"Number of field names does not match number of sorts");
if (sortRefs != null && sortRefs.length != n)
throw new Z3Exception(
"Number of field names does not match number of sort refs");
if (n != AST.arrayLength(sorts))
throw new Z3Exception(
"Number of field names does not match number of sorts");
if (sortRefs != null && sortRefs.length != n)
throw new Z3Exception(
"Number of field names does not match number of sort refs");
if (sortRefs == null)
sortRefs = new int[n];
if (sortRefs == null)
sortRefs = new int[n];
setNativeObject(Native.mkConstructor(ctx.nCtx(), name.getNativeObject(),
recognizer.getNativeObject(), n, Symbol.arrayToNative(fieldNames),
Sort.arrayToNative(sorts), sortRefs));
setNativeObject(Native.mkConstructor(ctx.nCtx(), name.getNativeObject(),
recognizer.getNativeObject(), n, Symbol.arrayToNative(fieldNames),
Sort.arrayToNative(sorts), sortRefs));
}
}
}

View file

@ -22,25 +22,26 @@ package com.microsoft.z3;
**/
public class ConstructorList extends Z3Object
{
/**
* Destructor.
**/
protected void finalize() throws Z3Exception
{
Native.delConstructorList(getContext().nCtx(), getNativeObject());
}
/**
* Destructor.
* @throws Z3Exception on error
**/
protected void finalize() throws Z3Exception
{
Native.delConstructorList(getContext().nCtx(), getNativeObject());
}
ConstructorList(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ConstructorList(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ConstructorList(Context ctx, Constructor[] constructors) throws Z3Exception
{
super(ctx);
ConstructorList(Context ctx, Constructor[] constructors) throws Z3Exception
{
super(ctx);
setNativeObject(Native.mkConstructorList(getContext().nCtx(),
(int) constructors.length,
Constructor.arrayToNative(constructors)));
}
setNativeObject(Native.mkConstructorList(getContext().nCtx(),
(int) constructors.length,
Constructor.arrayToNative(constructors)));
}
}

File diff suppressed because it is too large Load diff

View file

@ -22,16 +22,11 @@ package com.microsoft.z3;
**/
public class DatatypeExpr extends Expr
{
/**
* Constructor for DatatypeExpr </summary>
**/
protected DatatypeExpr(Context ctx)
{
super(ctx);
}
DatatypeExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
/**
* Constructor for DatatypeExpr
**/
DatatypeExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}

View file

@ -22,81 +22,86 @@ package com.microsoft.z3;
**/
public class DatatypeSort extends Sort
{
/**
* The number of constructors of the datatype sort.
**/
public int getNumConstructors() throws Z3Exception
{
return Native.getDatatypeSortNumConstructors(getContext().nCtx(),
getNativeObject());
}
/**
* The number of constructors of the datatype sort.
* @throws Z3Exception on error
* @return an int
**/
public int getNumConstructors() throws Z3Exception
{
return Native.getDatatypeSortNumConstructors(getContext().nCtx(),
getNativeObject());
}
/**
* The constructors.
*
* @throws Z3Exception
**/
public FuncDecl[] getConstructors() throws Z3Exception
{
int n = getNumConstructors();
FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++)
res[i] = new FuncDecl(getContext(), Native.getDatatypeSortConstructor(
getContext().nCtx(), getNativeObject(), i));
return res;
}
/**
* The constructors.
*
* @throws Z3Exception
* @throws Z3Exception on error
**/
public FuncDecl[] getConstructors() throws Z3Exception
{
int n = getNumConstructors();
FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++)
res[i] = new FuncDecl(getContext(), Native.getDatatypeSortConstructor(
getContext().nCtx(), getNativeObject(), i));
return res;
}
/**
* The recognizers.
*
* @throws Z3Exception
**/
public FuncDecl[] getRecognizers() throws Z3Exception
{
int n = getNumConstructors();
FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++)
res[i] = new FuncDecl(getContext(), Native.getDatatypeSortRecognizer(
getContext().nCtx(), getNativeObject(), i));
return res;
}
/**
* The recognizers.
*
* @throws Z3Exception
* @throws Z3Exception on error
**/
public FuncDecl[] getRecognizers() throws Z3Exception
{
int n = getNumConstructors();
FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++)
res[i] = new FuncDecl(getContext(), Native.getDatatypeSortRecognizer(
getContext().nCtx(), getNativeObject(), i));
return res;
}
/**
* The constructor accessors.
*
* @throws Z3Exception
**/
public FuncDecl[][] getAccessors() throws Z3Exception
{
/**
* The constructor accessors.
*
* @throws Z3Exception
* @throws Z3Exception on error
**/
public FuncDecl[][] getAccessors() throws Z3Exception
{
int n = getNumConstructors();
FuncDecl[][] res = new FuncDecl[n][];
for (int i = 0; i < n; i++)
{
FuncDecl fd = new FuncDecl(getContext(),
Native.getDatatypeSortConstructor(getContext().nCtx(),
getNativeObject(), i));
int ds = fd.getDomainSize();
FuncDecl[] tmp = new FuncDecl[ds];
for (int j = 0; j < ds; j++)
tmp[j] = new FuncDecl(getContext(),
Native.getDatatypeSortConstructorAccessor(getContext()
.nCtx(), getNativeObject(), i, j));
res[i] = tmp;
}
return res;
}
int n = getNumConstructors();
FuncDecl[][] res = new FuncDecl[n][];
for (int i = 0; i < n; i++)
{
FuncDecl fd = new FuncDecl(getContext(),
Native.getDatatypeSortConstructor(getContext().nCtx(),
getNativeObject(), i));
int ds = fd.getDomainSize();
FuncDecl[] tmp = new FuncDecl[ds];
for (int j = 0; j < ds; j++)
tmp[j] = new FuncDecl(getContext(),
Native.getDatatypeSortConstructorAccessor(getContext()
.nCtx(), getNativeObject(), i, j));
res[i] = tmp;
}
return res;
}
DatatypeSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
DatatypeSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
DatatypeSort(Context ctx, Symbol name, Constructor[] constructors)
throws Z3Exception
{
super(ctx, Native.mkDatatype(ctx.nCtx(), name.getNativeObject(),
(int) constructors.length, arrayToNative(constructors)));
DatatypeSort(Context ctx, Symbol name, Constructor[] constructors)
throws Z3Exception
{
super(ctx, Native.mkDatatype(ctx.nCtx(), name.getNativeObject(),
(int) constructors.length, arrayToNative(constructors)));
}
}
};

View file

@ -22,51 +22,83 @@ package com.microsoft.z3;
**/
public class EnumSort extends Sort
{
/**
* The function declarations of the constants in the enumeration.
**/
public FuncDecl[] getConstDecls() throws Z3Exception
{
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
/**
* The function declarations of the constants in the enumeration.
* @throws Z3Exception on error
**/
public FuncDecl[] getConstDecls() throws Z3Exception
{
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
FuncDecl[] t = new FuncDecl[n];
for (int i = 0; i < n; i++)
t[i] = new FuncDecl(getContext(), Native.getDatatypeSortConstructor(getContext().nCtx(), getNativeObject(), i));
return t;
}
}
/**
* Retrieves the inx'th constant declaration in the enumeration.
* @throws Z3Exception on error
**/
public FuncDecl getConstDecl(int inx) throws Z3Exception
{
return new FuncDecl(getContext(), Native.getDatatypeSortConstructor(getContext().nCtx(), getNativeObject(), inx));
}
/**
* The constants in the enumeration.
**/
public Expr[] getConsts() throws Z3Exception
{
FuncDecl[] cds = getConstDecls();
/**
* The constants in the enumeration.
* @throws Z3Exception on error
* @return an Expr[]
**/
public Expr[] getConsts() throws Z3Exception
{
FuncDecl[] cds = getConstDecls();
Expr[] t = new Expr[cds.length];
for (int i = 0; i < t.length; i++)
t[i] = getContext().mkApp(cds[i]);
return t;
}
}
/**
* Retrieves the inx'th constant in the enumeration.
* @throws Z3Exception on error
* @return an Expr
**/
public Expr getConst(int inx) throws Z3Exception
{
return getContext().mkApp(getConstDecl(inx));
}
/**
* The test predicates for the constants in the enumeration.
**/
public FuncDecl[] getTesterDecls() throws Z3Exception
{
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
/**
* The test predicates for the constants in the enumeration.
* @throws Z3Exception on error
**/
public FuncDecl[] getTesterDecls() throws Z3Exception
{
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
FuncDecl[] t = new FuncDecl[n];
for (int i = 0; i < n; i++)
t[i] = new FuncDecl(getContext(), Native.getDatatypeSortRecognizer(getContext().nCtx(), getNativeObject(), i));
return t;
}
}
/**
* Retrieves the inx'th tester/recognizer declaration in the enumeration.
* @throws Z3Exception on error
**/
public FuncDecl getTesterDecl(int inx) throws Z3Exception
{
return new FuncDecl(getContext(), Native.getDatatypeSortRecognizer(getContext().nCtx(), getNativeObject(), inx));
}
EnumSort(Context ctx, Symbol name, Symbol[] enumNames) throws Z3Exception
{
super(ctx);
EnumSort(Context ctx, Symbol name, Symbol[] enumNames) throws Z3Exception
{
super(ctx, 0);
int n = enumNames.length;
long[] n_constdecls = new long[n];
long[] n_testers = new long[n];
setNativeObject(Native.mkEnumerationSort(ctx.nCtx(),
name.getNativeObject(), (int) n, Symbol.arrayToNative(enumNames),
n_constdecls, n_testers));
}
int n = enumNames.length;
long[] n_constdecls = new long[n];
long[] n_testers = new long[n];
setNativeObject(Native.mkEnumerationSort(ctx.nCtx(),
name.getNativeObject(), (int) n, Symbol.arrayToNative(enumNames),
n_constdecls, n_testers));
}
};

File diff suppressed because it is too large Load diff

41
src/api/java/FPExpr.java Normal file
View 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);
}
}

84
src/api/java/FPNum.java Normal file
View file

@ -0,0 +1,84 @@
/*++
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 &lt; s &lt; 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();
}
}
}

View 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
View 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);
}
}

View 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
View 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());
}
}

View file

@ -22,24 +22,25 @@ package com.microsoft.z3;
**/
public class FiniteDomainSort extends Sort
{
/**
* The size of the finite domain sort.
**/
public long getSize() throws Z3Exception
{
Native.LongPtr res = new Native.LongPtr();
Native.getFiniteDomainSortSize(getContext().nCtx(), getNativeObject(), res);
return res.value;
}
/**
* The size of the finite domain sort.
* @throws Z3Exception on error
**/
public long getSize() throws Z3Exception
{
Native.LongPtr res = new Native.LongPtr();
Native.getFiniteDomainSortSize(getContext().nCtx(), getNativeObject(), res);
return res.value;
}
FiniteDomainSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
FiniteDomainSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
FiniteDomainSort(Context ctx, Symbol name, long size) throws Z3Exception
{
super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.getNativeObject(),
size));
}
FiniteDomainSort(Context ctx, Symbol name, long size) throws Z3Exception
{
super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.getNativeObject(),
size));
}
}

View file

@ -163,7 +163,8 @@ public class Fixedpoint extends Z3Object
}
/**
* Creates a backtracking point. <seealso cref="Pop"/>
* Creates a backtracking point.
* @see pop
**/
public void push() throws Z3Exception
{
@ -171,9 +172,11 @@ public class Fixedpoint extends Z3Object
}
/**
* Backtrack one backtracking point. <remarks>Note that an exception is
* thrown if Pop is called without a corresponding <code>Push</code>
* </remarks> <seealso cref="Push"/>
* Backtrack one backtracking point.
* Remarks: Note that an exception is thrown if {@code pop}
* is called without a corresponding {@code push}
*
* @see push
**/
public void pop() throws Z3Exception
{
@ -343,13 +346,13 @@ public class Fixedpoint extends Z3Object
void incRef(long o) throws Z3Exception
{
getContext().fixedpoint_DRQ().incAndClear(getContext(), o);
getContext().getFixedpointDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().fixedpoint_DRQ().add(o);
getContext().getFixedpointDRQ().add(o);
super.decRef(o);
}
}

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class FixedpointDecRefQueue extends IDecRefQueue
{
public FixedpointDecRefQueue()
{
super();
}
public FixedpointDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -29,7 +29,7 @@ public class FuncDecl extends AST
/**
* Comparison operator.
*
* @return True if <paramref name="a"/> and <paramref name="b"/> share the
* @return True if {@code a"/> and <paramref name="b} share the
* same context and are equal, false otherwise.
**/
/* Overloaded operators are not translated. */
@ -37,7 +37,7 @@ public class FuncDecl extends AST
/**
* Comparison operator.
*
* @return True if <paramref name="a"/> and <paramref name="b"/> do not
* @return True if {@code a"/> and <paramref name="b} do not
* share the same context or are not equal, false otherwise.
**/
/* Overloaded operators are not translated. */
@ -92,8 +92,8 @@ public class FuncDecl extends AST
}
/**
* The size of the domain of the function declaration <seealso
* cref="Arity"/>
* The size of the domain of the function declaration
* @see getArity
**/
public int getDomainSize() throws Z3Exception
{
@ -221,7 +221,7 @@ public class FuncDecl extends AST
private String r;
/**
* The int value of the parameter.</summary>
* The int value of the parameter.
**/
public int getInt() throws Z3Exception
{
@ -231,7 +231,7 @@ public class FuncDecl extends AST
}
/**
* The double value of the parameter.</summary>
* The double value of the parameter.
**/
public double getDouble() throws Z3Exception
{
@ -241,7 +241,7 @@ public class FuncDecl extends AST
}
/**
* The Symbol value of the parameter.</summary>
* The Symbol value of the parameter.
**/
public Symbol getSymbol() throws Z3Exception
{
@ -251,7 +251,7 @@ public class FuncDecl extends AST
}
/**
* The Sort value of the parameter.</summary>
* The Sort value of the parameter.
**/
public Sort getSort() throws Z3Exception
{
@ -261,7 +261,7 @@ public class FuncDecl extends AST
}
/**
* The AST value of the parameter.</summary>
* The AST value of the parameter.
**/
public AST getAST() throws Z3Exception
{
@ -271,7 +271,7 @@ public class FuncDecl extends AST
}
/**
* The FunctionDeclaration value of the parameter.</summary>
* The FunctionDeclaration value of the parameter.
**/
public FuncDecl getFuncDecl() throws Z3Exception
{
@ -281,7 +281,7 @@ public class FuncDecl extends AST
}
/**
* The rational string value of the parameter.</summary>
* The rational string value of the parameter.
**/
public String getRational() throws Z3Exception
{
@ -375,8 +375,8 @@ public class FuncDecl extends AST
}
/**
* Create expression that applies function to arguments. <param
* name="args"></param>
* Create expression that applies function to arguments.
* @param args
*
* @return
**/

View file

@ -24,173 +24,183 @@ package com.microsoft.z3;
**/
public class FuncInterp extends Z3Object
{
/**
* An Entry object represents an element in the finite map used to encode a
* function interpretation.
**/
public class Entry extends Z3Object
{
/**
* Return the (symbolic) value of this entry.
*
* @throws Z3Exception
**/
public Expr getValue() throws Z3Exception
{
return Expr.create(getContext(),
Native.funcEntryGetValue(getContext().nCtx(), getNativeObject()));
}
/**
* An Entry object represents an element in the finite map used to encode a
* function interpretation.
**/
public class Entry extends Z3Object
{
/**
* Return the (symbolic) value of this entry.
*
* @throws Z3Exception
* @throws Z3Exception on error
**/
public Expr getValue() throws Z3Exception
{
return Expr.create(getContext(),
Native.funcEntryGetValue(getContext().nCtx(), getNativeObject()));
}
/**
* The number of arguments of the entry.
**/
public int getNumArgs() throws Z3Exception
{
return Native.funcEntryGetNumArgs(getContext().nCtx(), getNativeObject());
}
/**
* The number of arguments of the entry.
* @throws Z3Exception on error
**/
public int getNumArgs() throws Z3Exception
{
return Native.funcEntryGetNumArgs(getContext().nCtx(), getNativeObject());
}
/**
* The arguments of the function entry.
*
* @throws Z3Exception
**/
public Expr[] getArgs() throws Z3Exception
{
int n = getNumArgs();
Expr[] res = new Expr[n];
for (int i = 0; i < n; i++)
res[i] = Expr.create(getContext(), Native.funcEntryGetArg(
getContext().nCtx(), getNativeObject(), i));
return res;
}
/**
* The arguments of the function entry.
*
* @throws Z3Exception
* @throws Z3Exception on error
**/
public Expr[] getArgs() throws Z3Exception
{
int n = getNumArgs();
Expr[] res = new Expr[n];
for (int i = 0; i < n; i++)
res[i] = Expr.create(getContext(), Native.funcEntryGetArg(
getContext().nCtx(), getNativeObject(), i));
return res;
}
/**
* A string representation of the function entry.
**/
public String toString()
{
try
{
int n = getNumArgs();
String res = "[";
Expr[] args = getArgs();
for (int i = 0; i < n; i++)
res += args[i] + ", ";
return res + getValue() + "]";
} catch (Z3Exception e)
{
return new String("Z3Exception: " + e.getMessage());
}
}
/**
* A string representation of the function entry.
**/
public String toString()
{
try
{
int n = getNumArgs();
String res = "[";
Expr[] args = getArgs();
for (int i = 0; i < n; i++)
res += args[i] + ", ";
return res + getValue() + "]";
} catch (Z3Exception e)
{
return new String("Z3Exception: " + e.getMessage());
}
}
Entry(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
Entry(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
void incRef(long o) throws Z3Exception
{
getContext().funcEntry_DRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void incRef(long o) throws Z3Exception
{
getContext().getFuncEntryDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().funcEntry_DRQ().add(o);
super.decRef(o);
}
};
void decRef(long o) throws Z3Exception
{
getContext().getFuncEntryDRQ().add(o);
super.decRef(o);
}
};
/**
* The number of entries in the function interpretation.
**/
public int getNumEntries() throws Z3Exception
{
return Native.funcInterpGetNumEntries(getContext().nCtx(), getNativeObject());
}
/**
* The number of entries in the function interpretation.
* @throws Z3Exception on error
* @return an int
**/
public int getNumEntries() throws Z3Exception
{
return Native.funcInterpGetNumEntries(getContext().nCtx(), getNativeObject());
}
/**
* The entries in the function interpretation
*
* @throws Z3Exception
**/
public Entry[] getEntries() throws Z3Exception
{
int n = getNumEntries();
Entry[] res = new Entry[n];
for (int i = 0; i < n; i++)
res[i] = new Entry(getContext(), Native.funcInterpGetEntry(getContext()
.nCtx(), getNativeObject(), i));
return res;
}
/**
* The entries in the function interpretation
*
* @throws Z3Exception
* @throws Z3Exception on error
**/
public Entry[] getEntries() throws Z3Exception
{
int n = getNumEntries();
Entry[] res = new Entry[n];
for (int i = 0; i < n; i++)
res[i] = new Entry(getContext(), Native.funcInterpGetEntry(getContext()
.nCtx(), getNativeObject(), i));
return res;
}
/**
* The (symbolic) `else' value of the function interpretation.
*
* @throws Z3Exception
**/
public Expr getElse() throws Z3Exception
{
return Expr.create(getContext(),
Native.funcInterpGetElse(getContext().nCtx(), getNativeObject()));
}
/**
* The (symbolic) `else' value of the function interpretation.
*
* @throws Z3Exception
* @throws Z3Exception on error
* @return an Expr
**/
public Expr getElse() throws Z3Exception
{
return Expr.create(getContext(),
Native.funcInterpGetElse(getContext().nCtx(), getNativeObject()));
}
/**
* The arity of the function interpretation
**/
public int getArity() throws Z3Exception
{
return Native.funcInterpGetArity(getContext().nCtx(), getNativeObject());
}
/**
* The arity of the function interpretation
* @throws Z3Exception on error
* @return an int
**/
public int getArity() throws Z3Exception
{
return Native.funcInterpGetArity(getContext().nCtx(), getNativeObject());
}
/**
* A string representation of the function interpretation.
**/
public String toString()
{
try
{
String res = "";
res += "[";
for (Entry e : getEntries())
{
int n = e.getNumArgs();
if (n > 1)
res += "[";
Expr[] args = e.getArgs();
for (int i = 0; i < n; i++)
{
if (i != 0)
res += ", ";
res += args[i];
}
if (n > 1)
res += "]";
res += " -> " + e.getValue() + ", ";
}
res += "else -> " + getElse();
res += "]";
return res;
} catch (Z3Exception e)
{
return new String("Z3Exception: " + e.getMessage());
}
}
/**
* A string representation of the function interpretation.
**/
public String toString()
{
try
{
String res = "";
res += "[";
for (Entry e : getEntries())
{
int n = e.getNumArgs();
if (n > 1)
res += "[";
Expr[] args = e.getArgs();
for (int i = 0; i < n; i++)
{
if (i != 0)
res += ", ";
res += args[i];
}
if (n > 1)
res += "]";
res += " -> " + e.getValue() + ", ";
}
res += "else -> " + getElse();
res += "]";
return res;
} catch (Z3Exception e)
{
return new String("Z3Exception: " + e.getMessage());
}
}
FuncInterp(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
FuncInterp(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
void incRef(long o) throws Z3Exception
{
getContext().funcInterp_DRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void incRef(long o) throws Z3Exception
{
getContext().getFuncInterpDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().funcInterp_DRQ().add(o);
super.decRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().getFuncInterpDRQ().add(o);
super.decRef(o);
}
}

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class FuncInterpDecRefQueue extends IDecRefQueue
{
public FuncInterpDecRefQueue()
{
super();
}
public FuncInterpDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class FuncInterpEntryDecRefQueue extends IDecRefQueue
{
public FuncInterpEntryDecRefQueue()
{
super();
}
public FuncInterpEntryDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,16 +19,16 @@ package com.microsoft.z3;
/**
* Global functions for Z3.
* <remarks>
* Remarks:
* This (static) class contains functions that effect the behaviour of Z3
* globally across contexts, etc.
* </remarks>
*
**/
public final class Global
{
/**
* Set a global (or module) parameter, which is shared by all Z3 contexts.
* <remarks>
* Remarks:
* When a Z3 module is initialized it will use the value of these parameters
* when Z3_params objects are not provided.
* The name of parameter can be composed of characters [a-z][A-Z], digits [0-9], '-' and '_'.
@ -36,24 +36,23 @@ public final class Global
* The parameter names are case-insensitive. The character '-' should be viewed as an "alias" for '_'.
* Thus, the following parameter names are considered equivalent: "pp.decimal-precision" and "PP.DECIMAL_PRECISION".
* This function can be used to set parameters for a specific Z3 module.
* This can be done by using <module-name>.<parameter-name>.
* This can be done by using &lt;module-name&gt;.&lt;parameter-name&gt;.
* For example:
* Z3_global_param_set('pp.decimal', 'true')
* will set the parameter "decimal" in the module "pp" to true.
* </remarks>
*
**/
public static void setParameter(String id, String value)
{
Native.globalParamSet(id, value);
Native.globalParamSet(id, value);
}
/**
* Get a global (or module) parameter.
* <remarks>
* Returns null if the parameter <param name="id">parameter id</param> does not exist.
* Remarks:
* This function cannot be invoked simultaneously from different threads without synchronization.
* The result string stored in param_value is stored in a shared location.
* </remarks>
* @return null if the parameter {@code id} does not exist.
**/
public static String getParameter(String id)
{
@ -66,13 +65,44 @@ public final class Global
/**
* Restore the value of all global (and module) parameters.
* <remarks>
* Remarks:
* This command will not affect already created objects (such as tactics and solvers)
* </remarks>
* <seealso cref="SetParameter"/>
* @see setParameter
**/
public static void resetParameters()
{
Native.globalParamResetAll();
}
Native.globalParamResetAll();
}
/**
* Enable/disable printing of warning messages to the console.
* Remarks: Note
* that this function is static and effects the behaviour of all contexts
* globally.
**/
public static void ToggleWarningMessages(boolean enabled)
throws Z3Exception
{
Native.toggleWarningMessages((enabled) ? true : false);
}
/**
* Enable tracing messages tagged as `tag' when Z3 is compiled in debug mode.
*
* Remarks: It is a NOOP otherwise.
**/
public static void enableTrace(String tag)
{
Native.enableTrace(tag);
}
/**
* Disable tracing messages tagged as `tag' when Z3 is compiled in debug mode.
*
* Remarks: It is a NOOP otherwise.
**/
public static void disableTrace(String tag)
{
Native.disableTrace(tag);
}
}

View file

@ -26,11 +26,12 @@ import com.microsoft.z3.enumerations.Z3_goal_prec;
public class Goal extends Z3Object
{
/**
* The precision of the goal. <remarks> Goals can be transformed using over
* The precision of the goal.
* Remarks: Goals can be transformed using over
* and under approximations. An under approximation is applied when the
* objective is to find a model for a given goal. An over approximation is
* applied when the objective is to find a proof for a given goal.
* </remarks>
*
**/
public Z3_goal_prec getPrecision() throws Z3Exception
{
@ -72,7 +73,7 @@ public class Goal extends Z3Object
}
/**
* Adds the <paramref name="constraints"/> to the given goal.
* Adds the {@code constraints} to the given goal.
*
* @throws Z3Exception
**/
@ -95,8 +96,9 @@ public class Goal extends Z3Object
}
/**
* The depth of the goal. <remarks> This tracks how many transformations
* were applied to it. </remarks>
* The depth of the goal.
* Remarks: This tracks how many transformations
* were applied to it.
**/
public int getDepth() throws Z3Exception
{
@ -162,8 +164,7 @@ public class Goal extends Z3Object
}
/**
* Translates (copies) the Goal to the target Context <paramref
* name="ctx"/>.
* Translates (copies) the Goal to the target Context {@code ctx}.
*
* @throws Z3Exception
**/
@ -174,8 +175,9 @@ public class Goal extends Z3Object
}
/**
* Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic
* on the goal.</remarks>
* Simplifies the goal.
* Remarks: Essentially invokes the `simplify' tactic
* on the goal.
**/
public Goal simplify() throws Z3Exception
{
@ -189,8 +191,9 @@ public class Goal extends Z3Object
}
/**
* Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic
* on the goal.</remarks>
* Simplifies the goal.
* Remarks: Essentially invokes the `simplify' tactic
* on the goal.
**/
public Goal simplify(Params p) throws Z3Exception
{
@ -233,13 +236,13 @@ public class Goal extends Z3Object
void incRef(long o) throws Z3Exception
{
getContext().goal_DRQ().incAndClear(getContext(), o);
getContext().getGoalDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().goal_DRQ().add(o);
getContext().getGoalDRQ().add(o);
super.decRef(o);
}

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class GoalDecRefQueue extends IDecRefQueue
{
public GoalDecRefQueue()
{
super();
}
public GoalDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,41 +19,53 @@ package com.microsoft.z3;
import java.util.LinkedList;
abstract class IDecRefQueue
public abstract class IDecRefQueue
{
protected Object m_lock = new Object();
protected LinkedList<Long> m_queue = new LinkedList<Long>();
protected final int m_move_limit = 1024;
protected Object m_lock = new Object();
protected LinkedList<Long> m_queue = new LinkedList<Long>();
protected int m_move_limit;
protected abstract void incRef(Context ctx, long obj);
protected abstract void decRef(Context ctx, long obj);
protected void incAndClear(Context ctx, long o)
protected IDecRefQueue()
{
incRef(ctx, o);
if (m_queue.size() >= m_move_limit)
clear(ctx);
}
m_move_limit = 1024;
}
protected void add(long o)
{
if (o == 0)
return;
protected IDecRefQueue(int move_limit)
{
m_move_limit = move_limit;
}
public void setLimit(int l) { m_move_limit = l; }
protected abstract void incRef(Context ctx, long obj);
synchronized (m_lock)
{
m_queue.add(o);
}
}
protected abstract void decRef(Context ctx, long obj);
protected void clear(Context ctx)
{
synchronized (m_lock)
{
for (Long o : m_queue)
decRef(ctx, o);
m_queue.clear();
}
}
protected void incAndClear(Context ctx, long o)
{
incRef(ctx, o);
if (m_queue.size() >= m_move_limit)
clear(ctx);
}
protected void add(long o)
{
if (o == 0)
return;
synchronized (m_lock)
{
m_queue.add(o);
}
}
protected void clear(Context ctx)
{
synchronized (m_lock)
{
for (Long o : m_queue)
decRef(ctx, o);
m_queue.clear();
}
}
}

View file

@ -21,7 +21,7 @@ package com.microsoft.z3;
public class IDisposable
{
public void dispose() throws Z3Exception
{
}
public void dispose() throws Z3Exception
{
}
}

View file

@ -22,16 +22,12 @@ package com.microsoft.z3;
**/
public class IntExpr extends ArithExpr
{
/**
* Constructor for IntExpr </summary>
**/
protected IntExpr(Context ctx) throws Z3Exception
{
super(ctx);
}
IntExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
/**
* Constructor for IntExpr
* @throws Z3Exception on error
**/
IntExpr(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}

View file

@ -22,13 +22,13 @@ package com.microsoft.z3;
**/
public class IntSort extends ArithSort
{
IntSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
IntSort(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
IntSort(Context ctx) throws Z3Exception
{
super(ctx, Native.mkIntSort(ctx.nCtx()));
}
IntSort(Context ctx) throws Z3Exception
{
super(ctx, Native.mkIntSort(ctx.nCtx()));
}
}

View file

@ -25,8 +25,9 @@ import com.microsoft.z3.enumerations.Z3_symbol_kind;
public class IntSymbol extends Symbol
{
/**
* The int value of the symbol. <remarks>Throws an exception if the symbol
* is not of int kind. </remarks>
* The int value of the symbol.
* Remarks: Throws an exception if the symbol
* is not of int kind.
**/
public int getInt() throws Z3Exception
{

View file

@ -20,15 +20,13 @@ package com.microsoft.z3;
import java.util.Map;
import java.lang.String;
import com.microsoft.z3.Native.IntPtr;
import com.microsoft.z3.Native.UIntArrayPtr;
import com.microsoft.z3.enumerations.Z3_lbool;
/** <summary>
/**
* The InterpolationContext is suitable for generation of interpolants.
* </summary>
* <remarks>For more information on interpolation please refer
* too the C/C++ API, which is well documented.</remarks>
*
* Remarks: For more information on interpolation please refer
* too the C/C++ API, which is well documented.
**/
public class InterpolationContext extends Context
{
@ -44,7 +42,9 @@ public class InterpolationContext extends Context
/**
* Constructor.
*
* <remarks><seealso cref="Context.Context(Dictionary&lt;string, string&gt;)"/></remarks>
*
* Remarks:
* @see Context#Context
**/
public InterpolationContext(Map<String, String> settings) throws Z3Exception
{
@ -58,7 +58,7 @@ public class InterpolationContext extends Context
/**
* Create an expression that marks a formula position for interpolation.
* @throws Z3Exception
* @throws Z3Exception
**/
public BoolExpr MkInterpolant(BoolExpr a) throws Z3Exception
{
@ -68,9 +68,9 @@ public class InterpolationContext extends Context
/**
* Computes an interpolant.
* <remarks>For more information on interpolation please refer
* Remarks: For more information on interpolation please refer
* too the function Z3_get_interpolant in the C/C++ API, which is
* well documented.</remarks>
* well documented.
* @throws Z3Exception
**/
Expr[] GetInterpolant(Expr pf, Expr pat, Params p) throws Z3Exception
@ -89,9 +89,9 @@ public class InterpolationContext extends Context
/**
* Computes an interpolant.
* <remarks>For more information on interpolation please refer
* Remarks: For more information on interpolation please refer
* too the function Z3_compute_interpolant in the C/C++ API, which is
* well documented.</remarks>
* well documented.
* @throws Z3Exception
**/
Z3_lbool ComputeInterpolant(Expr pat, Params p, ASTVector interp, Model model) throws Z3Exception
@ -107,23 +107,23 @@ public class InterpolationContext extends Context
return Z3_lbool.fromInt(r);
}
/// <summary>
///
/// Return a string summarizing cumulative time used for interpolation.
/// </summary>
/// <remarks>For more information on interpolation please refer
///
/// Remarks: For more information on interpolation please refer
/// too the function Z3_interpolation_profile in the C/C++ API, which is
/// well documented.</remarks>
/// well documented.
public String InterpolationProfile() throws Z3Exception
{
return Native.interpolationProfile(nCtx());
}
/// <summary>
///
/// Checks the correctness of an interpolant.
/// </summary>
/// <remarks>For more information on interpolation please refer
///
/// Remarks: For more information on interpolation please refer
/// too the function Z3_check_interpolant in the C/C++ API, which is
/// well documented.</remarks>
/// well documented.
public int CheckInterpolant(Expr[] cnsts, int[] parents, Expr[] interps, String error, Expr[] theory) throws Z3Exception
{
Native.StringPtr n_err_str = new Native.StringPtr();
@ -139,12 +139,12 @@ public class InterpolationContext extends Context
return r;
}
/// <summary>
///
/// Reads an interpolation problem from a file.
/// </summary>
/// <remarks>For more information on interpolation please refer
///
/// Remarks: For more information on interpolation please refer
/// too the function Z3_read_interpolation_problem in the C/C++ API, which is
/// well documented.</remarks>
/// well documented.
public int ReadInterpolationProblem(String filename, Expr[] cnsts, int[] parents, String error, Expr[] theory) throws Z3Exception
{
Native.IntPtr n_num = new Native.IntPtr();
@ -170,12 +170,12 @@ public class InterpolationContext extends Context
return r;
}
/// <summary>
///
/// Writes an interpolation problem to a file.
/// </summary>
/// <remarks>For more information on interpolation please refer
///
/// Remarks: For more information on interpolation please refer
/// too the function Z3_write_interpolation_problem in the C/C++ API, which is
/// well documented.</remarks>
/// well documented.
public void WriteInterpolationProblem(String filename, Expr[] cnsts, int[] parents, String error, Expr[] theory) throws Z3Exception
{
Native.writeInterpolationProblem(nCtx(), cnsts.length, Expr.arrayToNative(cnsts), parents, filename, theory.length, Expr.arrayToNative(theory));

View file

@ -88,7 +88,7 @@ public class ListSort extends Sort
ListSort(Context ctx, Symbol name, Sort elemSort) throws Z3Exception
{
super(ctx);
super(ctx, 0);
Native.LongPtr inil = new Native.LongPtr(), iisnil = new Native.LongPtr();
Native.LongPtr icons = new Native.LongPtr(), iiscons = new Native.LongPtr();

View file

@ -18,17 +18,18 @@ Notes:
package com.microsoft.z3;
/**
* Interaction logging for Z3. <remarks> Note that this is a global, static log
* Interaction logging for Z3.
* Remarks: Note that this is a global, static log
* and if multiple Context objects are created, it logs the interaction with all
* of them. </remarks>
* of them.
**/
public final class Log
{
private static boolean m_is_open = false;
/**
* Open an interaction log file. <param name="filename">the name of the file
* to open</param>
* Open an interaction log file.
* @param filename the name of the file to open
*
* @return True if opening the log file succeeds, false otherwise.
**/
@ -48,7 +49,7 @@ public final class Log
}
/**
* Appends the user-provided string <paramref name="s"/> to the interaction
* Appends the user-provided string {@code s} to the interaction
* log.
* @throws Z3Exception
**/

View file

@ -25,8 +25,9 @@ import com.microsoft.z3.enumerations.Z3_sort_kind;
public class Model extends Z3Object
{
/**
* Retrieves the interpretation (the assignment) of <paramref name="a"/> in
* the model. <param name="a">A Constant</param>
* Retrieves the interpretation (the assignment) of {@code a} in
* the model.
* @param a A Constant
*
* @return An expression if the constant has an interpretation in the model,
* null otherwise.
@ -39,8 +40,9 @@ public class Model extends Z3Object
}
/**
* Retrieves the interpretation (the assignment) of <paramref name="f"/> in
* the model. <param name="f">A function declaration of zero arity</param>
* Retrieves the interpretation (the assignment) of {@code f} in
* the model.
* @param f A function declaration of zero arity
*
* @return An expression if the function has an interpretation in the model,
* null otherwise.
@ -65,9 +67,8 @@ public class Model extends Z3Object
}
/**
* Retrieves the interpretation (the assignment) of a non-constant <paramref
* name="f"/> in the model. <param name="f">A function declaration of
* non-zero arity</param>
* Retrieves the interpretation (the assignment) of a non-constant {@code f} in the model.
* @param f A function declaration of non-zero arity
*
* @return A FunctionInterpretation if the function has an interpretation in
* the model, null otherwise.
@ -196,16 +197,15 @@ public class Model extends Z3Object
}
/**
* Evaluates the expression <paramref name="t"/> in the current model.
* <remarks> This function may fail if <paramref name="t"/> contains
* quantifiers, is partial (MODEL_PARTIAL enabled), or if <paramref
* name="t"/> is not well-sorted. In this case a
* <code>ModelEvaluationFailedException</code> is thrown. </remarks> <param
* name="t">An expression</param> <param name="completion"> When this flag
* Evaluates the expression {@code t} in the current model.
* Remarks: This function may fail if {@code t} contains
* quantifiers, is partial (MODEL_PARTIAL enabled), or if {@code t} is not well-sorted. In this case a
* {@code ModelEvaluationFailedException} is thrown.
* @param t An expression {@code completion} When this flag
* is enabled, a model value will be assigned to any constant or function
* that does not have an interpretation in the model. </param>
* that does not have an interpretation in the model.
*
* @return The evaluation of <paramref name="t"/> in the model.
* @return The evaluation of {@code t} in the model.
* @throws Z3Exception
**/
public Expr eval(Expr t, boolean completion) throws Z3Exception
@ -219,7 +219,7 @@ public class Model extends Z3Object
}
/**
* Alias for <code>Eval</code>.
* Alias for {@code Eval}.
*
* @throws Z3Exception
**/
@ -239,10 +239,12 @@ public class Model extends Z3Object
/**
* The uninterpreted sorts that the model has an interpretation for.
* <remarks> Z3 also provides an intepretation for uninterpreted sorts used
* Remarks: Z3 also provides an intepretation for uninterpreted sorts used
* in a formula. The interpretation for a sort is a finite set of distinct
* values. We say this finite set is the "universe" of the sort. </remarks>
* <seealso cref="NumSorts"/> <seealso cref="SortUniverse"/>
* values. We say this finite set is the "universe" of the sort.
*
* @see getNumSorts
* @see getSortUniverse
*
* @throws Z3Exception
**/
@ -259,11 +261,11 @@ public class Model extends Z3Object
/**
* The finite set of distinct values that represent the interpretation for
* sort <paramref name="s"/>. <seealso cref="Sorts"/> <param name="s">An
* uninterpreted sort</param>
* sort {@code s}.
* @param s An uninterpreted sort
*
* @return An array of expressions, where each is an element of the universe
* of <paramref name="s"/>
* of {@code s}
* @throws Z3Exception
**/
public Expr[] getSortUniverse(Sort s) throws Z3Exception
@ -301,13 +303,13 @@ public class Model extends Z3Object
void incRef(long o) throws Z3Exception
{
getContext().model_DRQ().incAndClear(getContext(), o);
getContext().getModelDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().model_DRQ().add(o);
getContext().getModelDRQ().add(o);
super.decRef(o);
}
}

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ModelDecRefQueue extends IDecRefQueue
{
public ModelDecRefQueue()
{
super();
}
public ModelDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -90,13 +90,13 @@ public class ParamDescrs extends Z3Object
void incRef(long o) throws Z3Exception
{
getContext().paramDescrs_DRQ().incAndClear(getContext(), o);
getContext().getParamDescrsDRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().paramDescrs_DRQ().add(o);
getContext().getParamDescrsDRQ().add(o);
super.decRef(o);
}
}

Some files were not shown because too many files have changed in this diff Show more