mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 11:55:51 +00:00
Merge branch 'unstable' into contrib
This commit is contained in:
commit
b4d57e0ab1
171 changed files with 9433 additions and 3739 deletions
|
@ -38,6 +38,8 @@ Revision History:
|
|||
#include"scoped_timer.h"
|
||||
#include"pp_params.hpp"
|
||||
|
||||
extern bool is_numeral_sort(Z3_context c, Z3_sort ty);
|
||||
|
||||
extern "C" {
|
||||
|
||||
Z3_symbol Z3_API Z3_mk_int_symbol(Z3_context c, int i) {
|
||||
|
@ -76,7 +78,7 @@ extern "C" {
|
|||
Z3_TRY;
|
||||
LOG_Z3_mk_uninterpreted_sort(c, name);
|
||||
RESET_ERROR_CODE();
|
||||
sort* ty = mk_c(c)->m().mk_sort(to_symbol(name));
|
||||
sort* ty = mk_c(c)->m().mk_uninterpreted_sort(to_symbol(name));
|
||||
mk_c(c)->save_ast_trail(ty);
|
||||
RETURN_Z3(of_sort(ty));
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -313,8 +315,6 @@ extern "C" {
|
|||
Z3_CATCH_RETURN("");
|
||||
}
|
||||
|
||||
extern bool is_numeral_sort(Z3_context c, Z3_sort ty);
|
||||
|
||||
Z3_ast_kind Z3_API Z3_get_ast_kind(Z3_context c, Z3_ast a) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_get_ast_kind(c, a);
|
||||
|
@ -620,7 +620,7 @@ extern "C" {
|
|||
CHECK_VALID_AST(t, Z3_UNKNOWN_SORT);
|
||||
family_id fid = to_sort(t)->get_family_id();
|
||||
decl_kind k = to_sort(t)->get_decl_kind();
|
||||
if (fid == null_family_id) {
|
||||
if (mk_c(c)->m().is_uninterp(to_sort(t))) {
|
||||
return Z3_UNINTERPRETED_SORT;
|
||||
}
|
||||
else if (fid == mk_c(c)->m().get_basic_family_id() && k == BOOL_SORT) {
|
||||
|
|
|
@ -43,7 +43,7 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
void Z3_API Z3_global_param_reset_all() {
|
||||
void Z3_API Z3_global_param_reset_all(void) {
|
||||
memory::initialize(UINT_MAX);
|
||||
LOG_Z3_global_param_reset_all();
|
||||
gparams::reset();
|
||||
|
@ -71,7 +71,7 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
Z3_config Z3_API Z3_mk_config() {
|
||||
Z3_config Z3_API Z3_mk_config(void) {
|
||||
memory::initialize(UINT_MAX);
|
||||
LOG_Z3_mk_config();
|
||||
Z3_config r = reinterpret_cast<Z3_config>(alloc(context_params));
|
||||
|
|
|
@ -419,17 +419,21 @@ namespace api {
|
|||
extern "C" {
|
||||
|
||||
Z3_context Z3_API Z3_mk_context(Z3_config c) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_context(c);
|
||||
memory::initialize(UINT_MAX);
|
||||
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), false));
|
||||
RETURN_Z3(r);
|
||||
Z3_CATCH_RETURN_NO_HANDLE(0);
|
||||
}
|
||||
|
||||
Z3_context Z3_API Z3_mk_context_rc(Z3_config c) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_context_rc(c);
|
||||
memory::initialize(UINT_MAX);
|
||||
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), true));
|
||||
RETURN_Z3(r);
|
||||
Z3_CATCH_RETURN_NO_HANDLE(0);
|
||||
}
|
||||
|
||||
void Z3_API Z3_del_context(Z3_context c) {
|
||||
|
|
|
@ -44,7 +44,7 @@ extern "C" {
|
|||
_Z3_append_log(static_cast<char const *>(str));
|
||||
}
|
||||
|
||||
void Z3_API Z3_close_log() {
|
||||
void Z3_API Z3_close_log(void) {
|
||||
if (g_z3_log != 0) {
|
||||
dealloc(g_z3_log);
|
||||
g_z3_log_enabled = false;
|
||||
|
|
|
@ -26,6 +26,7 @@ Revision History:
|
|||
#include"model_v2_pp.h"
|
||||
#include"model_smt2_pp.h"
|
||||
#include"model_params.hpp"
|
||||
#include"model_evaluator_params.hpp"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -489,7 +490,7 @@ extern "C" {
|
|||
Z3_model m,
|
||||
Z3_ast t,
|
||||
Z3_ast * v) {
|
||||
model_params p;
|
||||
model_evaluator_params p;
|
||||
return Z3_model_eval(c, m, t, p.completion(), v);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,27 +24,27 @@ Revision History:
|
|||
#include"bv_decl_plugin.h"
|
||||
#include"algebraic_numbers.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()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_numeral_sort(Z3_context c, Z3_sort ty) {
|
||||
bool is_num = is_numeral_sort(c, ty);
|
||||
if (!is_num) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
}
|
||||
return is_num;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_numeral_sort(Z3_context c, Z3_sort ty) {
|
||||
bool is_num = is_numeral_sort(c, ty);
|
||||
if (!is_num) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
}
|
||||
return is_num;
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -98,13 +98,13 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_rcf_num Z3_API Z3_rcf_mk_infinitesimal(Z3_context c, Z3_string name) {
|
||||
Z3_rcf_num Z3_API Z3_rcf_mk_infinitesimal(Z3_context c) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_rcf_mk_infinitesimal(c, name);
|
||||
LOG_Z3_rcf_mk_infinitesimal(c);
|
||||
RESET_ERROR_CODE();
|
||||
reset_rcf_cancel(c);
|
||||
rcnumeral r;
|
||||
rcfm(c).mk_infinitesimal(name, r);
|
||||
rcfm(c).mk_infinitesimal(r);
|
||||
RETURN_Z3(from_rcnumeral(r));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
@ -264,17 +264,17 @@ extern "C" {
|
|||
LOG_Z3_rcf_neq(c, a, b);
|
||||
RESET_ERROR_CODE();
|
||||
reset_rcf_cancel(c);
|
||||
return rcfm(c).eq(to_rcnumeral(a), to_rcnumeral(b));
|
||||
return rcfm(c).neq(to_rcnumeral(a), to_rcnumeral(b));
|
||||
Z3_CATCH_RETURN(Z3_FALSE);
|
||||
}
|
||||
|
||||
Z3_string Z3_API Z3_rcf_num_to_string(Z3_context c, Z3_rcf_num a) {
|
||||
Z3_string Z3_API Z3_rcf_num_to_string(Z3_context c, Z3_rcf_num a, Z3_bool compact, Z3_bool html) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_rcf_num_to_string(c, a);
|
||||
LOG_Z3_rcf_num_to_string(c, a, compact, html);
|
||||
RESET_ERROR_CODE();
|
||||
reset_rcf_cancel(c);
|
||||
std::ostringstream buffer;
|
||||
rcfm(c).display(buffer, to_rcnumeral(a));
|
||||
rcfm(c).display(buffer, to_rcnumeral(a), compact != 0, html != 0);
|
||||
return mk_c(c)->mk_external_string(buffer.str());
|
||||
Z3_CATCH_RETURN("");
|
||||
}
|
||||
|
@ -290,4 +290,17 @@ extern "C" {
|
|||
Z3_CATCH_RETURN("");
|
||||
}
|
||||
|
||||
void Z3_API Z3_rcf_get_numerator_denominator(Z3_context c, Z3_rcf_num a, Z3_rcf_num * n, Z3_rcf_num * d) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_rcf_get_numerator_denominator(c, a, n, d);
|
||||
RESET_ERROR_CODE();
|
||||
reset_rcf_cancel(c);
|
||||
rcnumeral _n, _d;
|
||||
rcfm(c).clean_denominators(to_rcnumeral(a), _n, _d);
|
||||
*n = from_rcnumeral(_n);
|
||||
*d = from_rcnumeral(_d);
|
||||
RETURN_Z3_rcf_get_numerator_denominator;
|
||||
Z3_CATCH;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -26,6 +26,7 @@ Revision History:
|
|||
#define Z3_CATCH_CORE(CODE) } catch (z3_exception & ex) { mk_c(c)->handle_exception(ex); CODE }
|
||||
#define Z3_CATCH Z3_CATCH_CORE(return;)
|
||||
#define Z3_CATCH_RETURN(VAL) Z3_CATCH_CORE(return VAL;)
|
||||
#define Z3_CATCH_RETURN_NO_HANDLE(VAL) } catch (z3_exception &) { return VAL; }
|
||||
|
||||
#define CHECK_REF_COUNT(a) (reinterpret_cast<ast const*>(a)->get_ref_count() > 0)
|
||||
#define VALIDATE(a) SASSERT(!a || CHECK_REF_COUNT(a))
|
||||
|
|
|
@ -619,6 +619,8 @@ namespace z3 {
|
|||
a.check_error();
|
||||
return expr(a.ctx(), r);
|
||||
}
|
||||
friend expr implies(expr const & a, bool b) { return implies(a, a.ctx().bool_val(b)); }
|
||||
friend expr implies(bool a, expr const & b) { return implies(b.ctx().bool_val(a), b); }
|
||||
|
||||
/**
|
||||
\brief Create the if-then-else expression <tt>ite(c, t, e)</tt>
|
||||
|
@ -758,7 +760,7 @@ namespace z3 {
|
|||
return expr(a.ctx(), r);
|
||||
}
|
||||
friend expr operator-(expr const & a, int b) { return a - a.ctx().num_val(b, a.get_sort()); }
|
||||
friend expr operator-(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) - a; }
|
||||
friend expr operator-(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) - b; }
|
||||
|
||||
friend expr operator<=(expr const & a, expr const & b) {
|
||||
check_context(a, b);
|
||||
|
@ -777,7 +779,7 @@ namespace z3 {
|
|||
return expr(a.ctx(), r);
|
||||
}
|
||||
friend expr operator<=(expr const & a, int b) { return a <= a.ctx().num_val(b, a.get_sort()); }
|
||||
friend expr operator<=(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) <= a; }
|
||||
friend expr operator<=(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) <= b; }
|
||||
|
||||
friend expr operator>=(expr const & a, expr const & b) {
|
||||
check_context(a, b);
|
||||
|
@ -796,7 +798,7 @@ namespace z3 {
|
|||
return expr(a.ctx(), r);
|
||||
}
|
||||
friend expr operator>=(expr const & a, int b) { return a >= a.ctx().num_val(b, a.get_sort()); }
|
||||
friend expr operator>=(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) >= a; }
|
||||
friend expr operator>=(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) >= b; }
|
||||
|
||||
friend expr operator<(expr const & a, expr const & b) {
|
||||
check_context(a, b);
|
||||
|
@ -815,7 +817,7 @@ namespace z3 {
|
|||
return expr(a.ctx(), r);
|
||||
}
|
||||
friend expr operator<(expr const & a, int b) { return a < a.ctx().num_val(b, a.get_sort()); }
|
||||
friend expr operator<(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) < a; }
|
||||
friend expr operator<(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) < b; }
|
||||
|
||||
friend expr operator>(expr const & a, expr const & b) {
|
||||
check_context(a, b);
|
||||
|
@ -834,7 +836,7 @@ namespace z3 {
|
|||
return expr(a.ctx(), r);
|
||||
}
|
||||
friend expr operator>(expr const & a, int b) { return a > a.ctx().num_val(b, a.get_sort()); }
|
||||
friend expr operator>(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) > a; }
|
||||
friend expr operator>(int a, expr const & b) { return b.ctx().num_val(a, b.get_sort()) > b; }
|
||||
|
||||
friend expr operator&(expr const & a, expr const & b) { check_context(a, b); Z3_ast r = Z3_mk_bvand(a.ctx(), a, b); return expr(a.ctx(), r); }
|
||||
friend expr operator&(expr const & a, int b) { return a & a.ctx().num_val(b, a.get_sort()); }
|
||||
|
@ -888,31 +890,31 @@ namespace z3 {
|
|||
*/
|
||||
inline expr ule(expr const & a, expr const & b) { return to_expr(a.ctx(), Z3_mk_bvule(a.ctx(), a, b)); }
|
||||
inline expr ule(expr const & a, int b) { return ule(a, a.ctx().num_val(b, a.get_sort())); }
|
||||
inline expr ule(int a, expr const & b) { return ule(b.ctx().num_val(a, b.get_sort()), a); }
|
||||
inline expr ule(int a, expr const & b) { return ule(b.ctx().num_val(a, b.get_sort()), b); }
|
||||
/**
|
||||
\brief unsigned less than operator for bitvectors.
|
||||
*/
|
||||
inline expr ult(expr const & a, expr const & b) { return to_expr(a.ctx(), Z3_mk_bvult(a.ctx(), a, b)); }
|
||||
inline expr ult(expr const & a, int b) { return ult(a, a.ctx().num_val(b, a.get_sort())); }
|
||||
inline expr ult(int a, expr const & b) { return ult(b.ctx().num_val(a, b.get_sort()), a); }
|
||||
inline expr ult(int a, expr const & b) { return ult(b.ctx().num_val(a, b.get_sort()), b); }
|
||||
/**
|
||||
\brief unsigned greater than or equal to operator for bitvectors.
|
||||
*/
|
||||
inline expr uge(expr const & a, expr const & b) { return to_expr(a.ctx(), Z3_mk_bvuge(a.ctx(), a, b)); }
|
||||
inline expr uge(expr const & a, int b) { return uge(a, a.ctx().num_val(b, a.get_sort())); }
|
||||
inline expr uge(int a, expr const & b) { return uge(b.ctx().num_val(a, b.get_sort()), a); }
|
||||
inline expr uge(int a, expr const & b) { return uge(b.ctx().num_val(a, b.get_sort()), b); }
|
||||
/**
|
||||
\brief unsigned greater than operator for bitvectors.
|
||||
*/
|
||||
inline expr ugt(expr const & a, expr const & b) { return to_expr(a.ctx(), Z3_mk_bvugt(a.ctx(), a, b)); }
|
||||
inline expr ugt(expr const & a, int b) { return ugt(a, a.ctx().num_val(b, a.get_sort())); }
|
||||
inline expr ugt(int a, expr const & b) { return ugt(b.ctx().num_val(a, b.get_sort()), a); }
|
||||
inline expr ugt(int a, expr const & b) { return ugt(b.ctx().num_val(a, b.get_sort()), b); }
|
||||
/**
|
||||
\brief unsigned division operator for bitvectors.
|
||||
*/
|
||||
inline expr udiv(expr const & a, expr const & b) { return to_expr(a.ctx(), Z3_mk_bvudiv(a.ctx(), a, b)); }
|
||||
inline expr udiv(expr const & a, int b) { return udiv(a, a.ctx().num_val(b, a.get_sort())); }
|
||||
inline expr udiv(int a, expr const & b) { return udiv(b.ctx().num_val(a, b.get_sort()), a); }
|
||||
inline expr udiv(int a, expr const & b) { return udiv(b.ctx().num_val(a, b.get_sort()), b); }
|
||||
|
||||
// Basic functions for creating quantified formulas.
|
||||
// The C API should be used for creating quantifiers with patterns, weights, many variables, etc.
|
||||
|
@ -1644,11 +1646,6 @@ namespace z3 {
|
|||
|
||||
};
|
||||
|
||||
template class z3::ast_vector_tpl<z3::ast>;
|
||||
template class z3::ast_vector_tpl<z3::expr>;
|
||||
template class z3::ast_vector_tpl<z3::sort>;
|
||||
template class z3::ast_vector_tpl<z3::func_decl>;
|
||||
|
||||
/*@}*/
|
||||
/*@}*/
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Create a new enumeration sort.
|
||||
/// </summary>
|
||||
public EnumSort MkEnumSort(Symbol name, Symbol[] enumNames)
|
||||
public EnumSort MkEnumSort(Symbol name, params Symbol[] enumNames)
|
||||
{
|
||||
Contract.Requires(name != null);
|
||||
Contract.Requires(enumNames != null);
|
||||
|
@ -252,7 +252,7 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Create a new enumeration sort.
|
||||
/// </summary>
|
||||
public EnumSort MkEnumSort(string name, string[] enumNames)
|
||||
public EnumSort MkEnumSort(string name, params string[] enumNames)
|
||||
{
|
||||
Contract.Requires(enumNames != null);
|
||||
Contract.Ensures(Contract.Result<EnumSort>() != null);
|
||||
|
@ -3219,7 +3219,7 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Create a probe that always evaluates to <paramref name="val"/>.
|
||||
/// </summary>
|
||||
public Probe Const(double val)
|
||||
public Probe ConstProbe(double val)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<Probe>() != null);
|
||||
|
||||
|
@ -3518,8 +3518,7 @@ namespace Microsoft.Z3
|
|||
public string GetParamValue(string id)
|
||||
{
|
||||
IntPtr res = IntPtr.Zero;
|
||||
int r = Native.Z3_get_param_value(nCtx, id, out res);
|
||||
if (r == (int)Z3_lbool.Z3_L_FALSE)
|
||||
if (Native.Z3_get_param_value(nCtx, id, out res) == 0)
|
||||
return null;
|
||||
else
|
||||
return Marshal.PtrToStringAnsi(res);
|
||||
|
|
87
src/api/dotnet/Global.cs
Normal file
87
src/api/dotnet/Global.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
Global.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Global Functions
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2013-01-15
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// Global functions for Z3.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This (static) class contains functions that effect the behaviour of Z3
|
||||
/// globally across contexts, etc.
|
||||
/// </remarks>
|
||||
public static class Global
|
||||
{
|
||||
/// <summary>
|
||||
/// Set a global (or module) parameter, which is shared by all Z3 contexts.
|
||||
/// </summary>
|
||||
/// <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 '_'.
|
||||
/// The character '.' is a delimiter (more later).
|
||||
/// 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>.
|
||||
/// 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.Z3_global_param_set(id, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a global (or module) parameter.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Returns null if the parameter <param name="id"/> does not exist.
|
||||
/// The caller must invoke #Z3_global_param_del_value to delete the value returned at \c param_value.
|
||||
/// 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>
|
||||
public static string GetParameter(string id)
|
||||
{
|
||||
IntPtr t;
|
||||
if (Native.Z3_global_param_get(id, out t) == 0)
|
||||
return null;
|
||||
else
|
||||
return Marshal.PtrToStringAnsi(t);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Restore the value of all global (and module) parameters.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This command will not affect already created objects (such as tactics and solvers)
|
||||
/// </remarks>
|
||||
/// <seealso cref="SetParameter"/>
|
||||
public static void ResetParameters()
|
||||
{
|
||||
Native.Z3_global_param_reset_all();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -341,6 +341,7 @@
|
|||
<Compile Include="ConstructorList.cs" />
|
||||
<Compile Include="DatatypeExpr.cs" />
|
||||
<Compile Include="DatatypeSort.cs" />
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="IDecRefQueue.cs" />
|
||||
<Compile Include="Enumerations.cs" />
|
||||
<Compile Include="EnumSort.cs" />
|
||||
|
|
|
@ -117,6 +117,50 @@ namespace Microsoft.Z3
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assert multiple constraints into the solver, and track them (in the unsat) core
|
||||
/// using the Boolean constants in ps.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This API is an alternative to <see cref="Check"/> with assumptions for extracting unsat cores.
|
||||
/// Both APIs can be used in the same solver. The unsat core will contain a combination
|
||||
/// of the Boolean variables provided using <see cref="AssertAndTrack"/> and the Boolean literals
|
||||
/// provided using <see cref="Check"/> with assumptions.
|
||||
/// </remarks>
|
||||
public void AssertAndTrack(BoolExpr[] constraints, BoolExpr[] ps)
|
||||
{
|
||||
Contract.Requires(constraints != null);
|
||||
Contract.Requires(Contract.ForAll(constraints, c => c != null));
|
||||
Contract.Requires(Contract.ForAll(ps, c => c != null));
|
||||
Context.CheckContextMatch(constraints);
|
||||
Context.CheckContextMatch(ps);
|
||||
if (constraints.Length != ps.Length)
|
||||
throw new Z3Exception("Argument size mismatch");
|
||||
|
||||
for (int i = 0 ; i < constraints.Length; i++)
|
||||
Native.Z3_solver_assert_and_track(Context.nCtx, NativeObject, constraints[i].NativeObject, ps[i].NativeObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assert a constraint into the solver, and track it (in the unsat) core
|
||||
/// using the Boolean constant p.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This API is an alternative to <see cref="Check"/> with assumptions for extracting unsat cores.
|
||||
/// Both APIs can be used in the same solver. The unsat core will contain a combination
|
||||
/// of the Boolean variables provided using <see cref="AssertAndTrack"/> and the Boolean literals
|
||||
/// provided using <see cref="Check"/> with assumptions.
|
||||
/// </remarks>
|
||||
public void AssertAndTrack(BoolExpr constraint, BoolExpr p)
|
||||
{
|
||||
Contract.Requires(constraint != null);
|
||||
Contract.Requires(p != null);
|
||||
Context.CheckContextMatch(constraint);
|
||||
Context.CheckContextMatch(p);
|
||||
|
||||
Native.Z3_solver_assert_and_track(Context.nCtx, NativeObject, constraint.NativeObject, p.NativeObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of assertions in the solver.
|
||||
/// </summary>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_ast_kind;
|
||||
|
||||
/**
|
||||
* The abstract syntax tree (AST) class.
|
||||
|
@ -47,7 +47,7 @@ public class AST extends Z3Object
|
|||
return false;
|
||||
}
|
||||
|
||||
return this.NativeObject() == casted.NativeObject();
|
||||
return this.getNativeObject() == casted.getNativeObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,9 +70,9 @@ public class AST extends Z3Object
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (Id() < oAST.Id())
|
||||
if (getId() < oAST.getId())
|
||||
return -1;
|
||||
else if (Id() > oAST.Id())
|
||||
else if (getId() > oAST.getId())
|
||||
return +1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -83,17 +83,22 @@ public class AST extends Z3Object
|
|||
*
|
||||
* @return A hash code
|
||||
**/
|
||||
public int GetHashCode() throws Z3Exception
|
||||
public int hashCode()
|
||||
{
|
||||
return (int) Native.getAstHash(Context().nCtx(), NativeObject());
|
||||
int r = 0;
|
||||
try {
|
||||
Native.getAstHash(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
catch (Z3Exception ex) {}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for the AST (unique among all ASTs).
|
||||
**/
|
||||
public int Id() throws Z3Exception
|
||||
public int getId() throws Z3Exception
|
||||
{
|
||||
return Native.getAstId(Context().nCtx(), NativeObject());
|
||||
return Native.getAstId(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,31 +107,31 @@ public class AST extends Z3Object
|
|||
*
|
||||
* @return A copy of the AST which is associated with <paramref name="ctx"/>
|
||||
**/
|
||||
public AST Translate(Context ctx) throws Z3Exception
|
||||
public AST translate(Context ctx) throws Z3Exception
|
||||
{
|
||||
|
||||
if (Context() == ctx)
|
||||
if (getContext() == ctx)
|
||||
return this;
|
||||
else
|
||||
return new AST(ctx, Native.translate(Context().nCtx(),
|
||||
NativeObject(), ctx.nCtx()));
|
||||
return new AST(ctx, Native.translate(getContext().nCtx(),
|
||||
getNativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the AST.
|
||||
**/
|
||||
public Z3_ast_kind ASTKind() throws Z3Exception
|
||||
public Z3_ast_kind getASTKind() throws Z3Exception
|
||||
{
|
||||
return Z3_ast_kind.fromInt(Native.getAstKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return Z3_ast_kind.fromInt(Native.getAstKind(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is an Expr
|
||||
**/
|
||||
public boolean IsExpr() throws Z3Exception
|
||||
public boolean isExpr() throws Z3Exception
|
||||
{
|
||||
switch (ASTKind())
|
||||
switch (getASTKind())
|
||||
{
|
||||
case Z3_APP_AST:
|
||||
case Z3_NUMERAL_AST:
|
||||
|
@ -141,41 +146,41 @@ public class AST extends Z3Object
|
|||
/**
|
||||
* Indicates whether the AST is an application
|
||||
**/
|
||||
public boolean IsApp() throws Z3Exception
|
||||
public boolean isApp() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_APP_AST;
|
||||
return this.getASTKind() == Z3_ast_kind.Z3_APP_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a BoundVariable
|
||||
**/
|
||||
public boolean IsVar() throws Z3Exception
|
||||
public boolean isVar() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_VAR_AST;
|
||||
return this.getASTKind() == Z3_ast_kind.Z3_VAR_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a Quantifier
|
||||
**/
|
||||
public boolean IsQuantifier() throws Z3Exception
|
||||
public boolean isQuantifier() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST;
|
||||
return this.getASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a Sort
|
||||
**/
|
||||
public boolean IsSort() throws Z3Exception
|
||||
public boolean isSort() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_SORT_AST;
|
||||
return this.getASTKind() == Z3_ast_kind.Z3_SORT_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a FunctionDeclaration
|
||||
**/
|
||||
public boolean IsFuncDecl() throws Z3Exception
|
||||
public boolean isFuncDecl() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST;
|
||||
return this.getASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,7 +190,7 @@ public class AST extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.astToString(Context().nCtx(), NativeObject());
|
||||
return Native.astToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -195,9 +200,9 @@ public class AST extends Z3Object
|
|||
/**
|
||||
* A string representation of the AST in s-expression notation.
|
||||
**/
|
||||
public String SExpr() throws Z3Exception
|
||||
public String getSExpr() throws Z3Exception
|
||||
{
|
||||
return Native.astToString(Context().nCtx(), NativeObject());
|
||||
return Native.astToString(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
AST(Context ctx)
|
||||
|
@ -210,29 +215,29 @@ public class AST extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
// Console.WriteLine("AST IncRef()");
|
||||
if (Context() == null)
|
||||
if (getContext() == null)
|
||||
throw new Z3Exception("inc() called on null context");
|
||||
if (o == 0)
|
||||
throw new Z3Exception("inc() called on null AST");
|
||||
Context().AST_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().ast_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
// Console.WriteLine("AST DecRef()");
|
||||
if (Context() == null)
|
||||
if (getContext() == null)
|
||||
throw new Z3Exception("dec() called on null context");
|
||||
if (o == 0)
|
||||
throw new Z3Exception("dec() called on null AST");
|
||||
Context().AST_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().ast_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
|
||||
static AST Create(Context ctx, long obj) throws Z3Exception
|
||||
static AST create(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
switch (Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)))
|
||||
{
|
||||
|
@ -241,11 +246,11 @@ public class AST extends Z3Object
|
|||
case Z3_QUANTIFIER_AST:
|
||||
return new Quantifier(ctx, obj);
|
||||
case Z3_SORT_AST:
|
||||
return Sort.Create(ctx, obj);
|
||||
return Sort.create(ctx, obj);
|
||||
case Z3_APP_AST:
|
||||
case Z3_NUMERAL_AST:
|
||||
case Z3_VAR_AST:
|
||||
return Expr.Create(ctx, obj);
|
||||
return Expr.create(ctx, obj);
|
||||
default:
|
||||
throw new Z3Exception("Unknown AST kind");
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
public class ASTDecRefQueue extends IDecRefQueue
|
||||
class ASTDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public class ASTDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -18,11 +18,11 @@ class ASTMap extends Z3Object
|
|||
* @return True if <paramref name="k"/> is a key in the map, false
|
||||
* otherwise.
|
||||
**/
|
||||
public boolean Contains(AST k) throws Z3Exception
|
||||
public boolean contains(AST k) throws Z3Exception
|
||||
{
|
||||
|
||||
return Native.astMapContains(Context().nCtx(), NativeObject(),
|
||||
k.NativeObject());
|
||||
return Native.astMapContains(getContext().nCtx(), getNativeObject(),
|
||||
k.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,47 +32,47 @@ class ASTMap extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public AST Find(AST k) throws Z3Exception
|
||||
public AST find(AST k) throws Z3Exception
|
||||
{
|
||||
return new AST(Context(), Native.astMapFind(Context().nCtx(),
|
||||
NativeObject(), k.NativeObject()));
|
||||
return new AST(getContext(), Native.astMapFind(getContext().nCtx(),
|
||||
getNativeObject(), k.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>
|
||||
**/
|
||||
public void Insert(AST k, AST v) throws Z3Exception
|
||||
public void insert(AST k, AST v) throws Z3Exception
|
||||
{
|
||||
|
||||
Native.astMapInsert(Context().nCtx(), NativeObject(), k.NativeObject(),
|
||||
v.NativeObject());
|
||||
Native.astMapInsert(getContext().nCtx(), getNativeObject(), k.getNativeObject(),
|
||||
v.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Erases the key <paramref name="k"/> from the map. <param name="k">An
|
||||
* AST</param>
|
||||
**/
|
||||
public void Erase(AST k) throws Z3Exception
|
||||
public void erase(AST k) throws Z3Exception
|
||||
{
|
||||
|
||||
Native.astMapErase(Context().nCtx(), NativeObject(), k.NativeObject());
|
||||
Native.astMapErase(getContext().nCtx(), getNativeObject(), k.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all keys from the map.
|
||||
**/
|
||||
public void Reset() throws Z3Exception
|
||||
public void reset() throws Z3Exception
|
||||
{
|
||||
Native.astMapReset(Context().nCtx(), NativeObject());
|
||||
Native.astMapReset(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the map
|
||||
**/
|
||||
public int Size() throws Z3Exception
|
||||
public int size() throws Z3Exception
|
||||
{
|
||||
return Native.astMapSize(Context().nCtx(), NativeObject());
|
||||
return Native.astMapSize(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,10 +80,10 @@ class ASTMap extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ASTVector Keys() throws Z3Exception
|
||||
public ASTVector getKeys() throws Z3Exception
|
||||
{
|
||||
return new ASTVector(Context(), Native.astMapKeys(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return new ASTVector(getContext(), Native.astMapKeys(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,7 +93,7 @@ class ASTMap extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.astMapToString(Context().nCtx(), NativeObject());
|
||||
return Native.astMapToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -110,15 +110,15 @@ class ASTMap extends Z3Object
|
|||
super(ctx, Native.mkAstMap(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTMap_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().astmap_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTMap_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().astmap_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ class ASTVector extends Z3Object
|
|||
/**
|
||||
* The size of the vector
|
||||
**/
|
||||
public int Size() throws Z3Exception
|
||||
public int size() throws Z3Exception
|
||||
{
|
||||
return Native.astVectorSize(Context().nCtx(), NativeObject());
|
||||
return Native.astVectorSize(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,33 +29,33 @@ class ASTVector extends Z3Object
|
|||
**/
|
||||
public AST get(int i) throws Z3Exception
|
||||
{
|
||||
return new AST(Context(), Native.astVectorGet(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
return new AST(getContext(), Native.astVectorGet(getContext().nCtx(),
|
||||
getNativeObject(), i));
|
||||
}
|
||||
|
||||
public void set(int i, AST value) throws Z3Exception
|
||||
{
|
||||
|
||||
Native.astVectorSet(Context().nCtx(), NativeObject(), i,
|
||||
value.NativeObject());
|
||||
Native.astVectorSet(getContext().nCtx(), getNativeObject(), i,
|
||||
value.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the vector to <paramref name="newSize"/>. <param
|
||||
* name="newSize">The new size of the vector.</param>
|
||||
**/
|
||||
public void Resize(int newSize) throws Z3Exception
|
||||
public void resize(int newSize) throws Z3Exception
|
||||
{
|
||||
Native.astVectorResize(Context().nCtx(), NativeObject(), newSize);
|
||||
Native.astVectorResize(getContext().nCtx(), getNativeObject(), newSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the AST <paramref name="a"/> to the back of the vector. The size is
|
||||
* increased by 1. <param name="a">An AST</param>
|
||||
**/
|
||||
public void Push(AST a) throws Z3Exception
|
||||
public void push(AST a) throws Z3Exception
|
||||
{
|
||||
Native.astVectorPush(Context().nCtx(), NativeObject(), a.NativeObject());
|
||||
Native.astVectorPush(getContext().nCtx(), getNativeObject(), a.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,10 +65,10 @@ class ASTVector extends Z3Object
|
|||
* @return A new ASTVector
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ASTVector Translate(Context ctx) throws Z3Exception
|
||||
public ASTVector translate(Context ctx) throws Z3Exception
|
||||
{
|
||||
return new ASTVector(Context(), Native.astVectorTranslate(Context()
|
||||
.nCtx(), NativeObject(), ctx.nCtx()));
|
||||
return new ASTVector(getContext(), Native.astVectorTranslate(getContext()
|
||||
.nCtx(), getNativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ class ASTVector extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.astVectorToString(Context().nCtx(), NativeObject());
|
||||
return Native.astVectorToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -95,15 +95,15 @@ class ASTVector extends Z3Object
|
|||
super(ctx, Native.mkAstVector(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTVector_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().astvector_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTVector_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().astvector_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ public class AlgebraicNum extends ArithExpr
|
|||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
**/
|
||||
public RatNum ToUpper(int precision) throws Z3Exception
|
||||
public RatNum toUpper(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
return new RatNum(Context(), Native.getAlgebraicNumberUpper(Context()
|
||||
.nCtx(), NativeObject(), precision));
|
||||
return new RatNum(getContext(), Native.getAlgebraicNumberUpper(getContext()
|
||||
.nCtx(), getNativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,21 +33,21 @@ public class AlgebraicNum extends ArithExpr
|
|||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
**/
|
||||
public RatNum ToLower(int precision) throws Z3Exception
|
||||
public RatNum toLower(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
return new RatNum(Context(), Native.getAlgebraicNumberLower(Context()
|
||||
.nCtx(), NativeObject(), precision));
|
||||
return new RatNum(getContext(), Native.getAlgebraicNumberLower(getContext()
|
||||
.nCtx(), getNativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation in decimal notation. <remarks>The result
|
||||
* has at most <paramref name="precision"/> decimal places.</remarks>
|
||||
**/
|
||||
public String ToDecimal(int precision) throws Z3Exception
|
||||
public String toDecimal(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(),
|
||||
return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
|
||||
precision);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ public class ApplyResult extends Z3Object
|
|||
/**
|
||||
* The number of Subgoals.
|
||||
**/
|
||||
public int NumSubgoals() throws Z3Exception
|
||||
public int getNumSubgoals() throws Z3Exception
|
||||
{
|
||||
return Native.applyResultGetNumSubgoals(Context().nCtx(),
|
||||
NativeObject());
|
||||
return Native.applyResultGetNumSubgoals(getContext().nCtx(),
|
||||
getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,13 +26,13 @@ public class ApplyResult extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Goal[] Subgoals() throws Z3Exception
|
||||
public Goal[] getSubgoals() throws Z3Exception
|
||||
{
|
||||
int n = NumSubgoals();
|
||||
int n = getNumSubgoals();
|
||||
Goal[] res = new Goal[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Goal(Context(), Native.applyResultGetSubgoal(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = new Goal(getContext(),
|
||||
Native.applyResultGetSubgoal(getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,10 @@ public class ApplyResult extends Z3Object
|
|||
* @return A model for <code>g</code>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Model ConvertModel(int i, Model m) throws Z3Exception
|
||||
public Model convertModel(int i, Model m) throws Z3Exception
|
||||
{
|
||||
return new Model(Context(), Native.applyResultConvertModel(Context()
|
||||
.nCtx(), NativeObject(), i, m.NativeObject()));
|
||||
return new Model(getContext(),
|
||||
Native.applyResultConvertModel(getContext().nCtx(), getNativeObject(), i, m.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ public class ApplyResult extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.applyResultToString(Context().nCtx(), NativeObject());
|
||||
return Native.applyResultToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -68,15 +68,15 @@ public class ApplyResult extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ApplyResult_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().applyResult_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ApplyResult_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().applyResult_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class ApplyResultDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class ApplyResultDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -15,20 +15,20 @@ public class ArraySort extends Sort
|
|||
* The domain of the array sort.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort Domain() throws Z3Exception
|
||||
public Sort getDomain() throws Z3Exception
|
||||
{
|
||||
return Sort.Create(Context(),
|
||||
Native.getArraySortDomain(Context().nCtx(), NativeObject()));
|
||||
return Sort.create(getContext(),
|
||||
Native.getArraySortDomain(getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The range of the array sort.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort Range() throws Z3Exception
|
||||
public Sort getRange() throws Z3Exception
|
||||
{
|
||||
return Sort.Create(Context(),
|
||||
Native.getArraySortRange(Context().nCtx(), NativeObject()));
|
||||
return Sort.create(getContext(),
|
||||
Native.getArraySortRange(getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
ArraySort(Context ctx, long obj) throws Z3Exception
|
||||
|
@ -38,7 +38,7 @@ public class ArraySort extends Sort
|
|||
|
||||
ArraySort(Context ctx, Sort domain, Sort range) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkArraySort(ctx.nCtx(), domain.NativeObject(),
|
||||
range.NativeObject()));
|
||||
super(ctx, Native.mkArraySort(ctx.nCtx(), domain.getNativeObject(),
|
||||
range.getNativeObject()));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class ASTMapDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class ASTMapDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class ASTVectorDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class ASTVectorDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -16,15 +16,15 @@ public class BitVecExpr extends Expr
|
|||
* The size of the sort of a bit-vector term.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int SortSize() throws Z3Exception
|
||||
public int getSortSize() throws Z3Exception
|
||||
{
|
||||
return ((BitVecSort) Sort()).Size();
|
||||
return ((BitVecSort) getSort()).getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for BitVecExpr </summary>
|
||||
**/
|
||||
protected BitVecExpr(Context ctx)
|
||||
BitVecExpr(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ public class BitVecNum extends BitVecExpr
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
public int getInt() throws Z3Exception
|
||||
{
|
||||
Native.IntPtr res = new Native.IntPtr();
|
||||
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
if (Native.getNumeralInt(getContext().nCtx(), getNativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int");
|
||||
return res.value;
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ public class BitVecNum extends BitVecExpr
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public long Long() throws Z3Exception
|
||||
public long getLong() throws Z3Exception
|
||||
{
|
||||
Native.LongPtr res = new Native.LongPtr();
|
||||
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
if (Native.getNumeralInt64(getContext().nCtx(), getNativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int64");
|
||||
return res.value;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class BitVecNum extends BitVecExpr
|
|||
/**
|
||||
* Retrieve the BigInteger value.
|
||||
**/
|
||||
public BigInteger BigInteger()
|
||||
public BigInteger getBigInteger()
|
||||
{
|
||||
return new BigInteger(this.toString());
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class BitVecNum extends BitVecExpr
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.getNumeralString(Context().nCtx(), NativeObject());
|
||||
return Native.getNumeralString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
|
|
@ -13,9 +13,9 @@ public class BitVecSort extends Sort
|
|||
/**
|
||||
* The size of the bit-vector sort.
|
||||
**/
|
||||
public int Size() throws Z3Exception
|
||||
public int getSize() throws Z3Exception
|
||||
{
|
||||
return Native.getBvSortSize(Context().nCtx(), NativeObject());
|
||||
return Native.getBvSortSize(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
BitVecSort(Context ctx, long obj) throws Z3Exception
|
||||
|
|
|
@ -15,7 +15,7 @@ public class Constructor extends Z3Object
|
|||
* The number of fields of the constructor.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int NumFields() throws Z3Exception
|
||||
public int getNumFields() throws Z3Exception
|
||||
{
|
||||
init();
|
||||
return n;
|
||||
|
@ -35,7 +35,7 @@ public class Constructor extends Z3Object
|
|||
* The function declaration of the tester.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl TesterDecl() throws Z3Exception
|
||||
public FuncDecl getTesterDecl() throws Z3Exception
|
||||
{
|
||||
init();
|
||||
return m_testerDecl;
|
||||
|
@ -45,7 +45,7 @@ public class Constructor extends Z3Object
|
|||
* The function declarations of the accessors
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] AccessorDecls() throws Z3Exception
|
||||
public FuncDecl[] getAccessorDecls() throws Z3Exception
|
||||
{
|
||||
init();
|
||||
return m_accessorDecls;
|
||||
|
@ -56,7 +56,7 @@ public class Constructor extends Z3Object
|
|||
**/
|
||||
protected void finalize() throws Z3Exception
|
||||
{
|
||||
Native.delConstructor(Context().nCtx(), NativeObject());
|
||||
Native.delConstructor(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
private int n = 0;
|
||||
|
@ -70,9 +70,9 @@ public class Constructor extends Z3Object
|
|||
{
|
||||
super(ctx);
|
||||
|
||||
n = AST.ArrayLength(fieldNames);
|
||||
n = AST.arrayLength(fieldNames);
|
||||
|
||||
if (n != AST.ArrayLength(sorts))
|
||||
if (n != AST.arrayLength(sorts))
|
||||
throw new Z3Exception(
|
||||
"Number of field names does not match number of sorts");
|
||||
if (sortRefs != null && sortRefs.length != n)
|
||||
|
@ -82,9 +82,9 @@ public class Constructor extends Z3Object
|
|||
if (sortRefs == null)
|
||||
sortRefs = new int[n];
|
||||
|
||||
setNativeObject(Native.mkConstructor(ctx.nCtx(), name.NativeObject(),
|
||||
recognizer.NativeObject(), 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));
|
||||
|
||||
}
|
||||
|
||||
|
@ -95,13 +95,13 @@ public class Constructor extends Z3Object
|
|||
Native.LongPtr constructor = new Native.LongPtr();
|
||||
Native.LongPtr tester = new Native.LongPtr();
|
||||
long[] accessors = new long[n];
|
||||
Native.queryConstructor(Context().nCtx(), NativeObject(), n,
|
||||
Native.queryConstructor(getContext().nCtx(), getNativeObject(), n,
|
||||
constructor, tester, accessors);
|
||||
m_constructorDecl = new FuncDecl(Context(), constructor.value);
|
||||
m_testerDecl = new FuncDecl(Context(), tester.value);
|
||||
m_constructorDecl = new FuncDecl(getContext(), constructor.value);
|
||||
m_testerDecl = new FuncDecl(getContext(), tester.value);
|
||||
m_accessorDecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
m_accessorDecls[i] = new FuncDecl(Context(), accessors[i]);
|
||||
m_accessorDecls[i] = new FuncDecl(getContext(), accessors[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ConstructorList extends Z3Object
|
|||
**/
|
||||
protected void finalize() throws Z3Exception
|
||||
{
|
||||
Native.delConstructorList(Context().nCtx(), NativeObject());
|
||||
Native.delConstructorList(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
ConstructorList(Context ctx, long obj) throws Z3Exception
|
||||
|
@ -28,8 +28,8 @@ public class ConstructorList extends Z3Object
|
|||
{
|
||||
super(ctx);
|
||||
|
||||
setNativeObject(Native.mkConstructorList(Context().nCtx(),
|
||||
setNativeObject(Native.mkConstructorList(getContext().nCtx(),
|
||||
(int) constructors.length,
|
||||
Constructor.ArrayToNative(constructors)));
|
||||
Constructor.arrayToNative(constructors)));
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,10 +14,10 @@ public class DatatypeSort extends Sort
|
|||
/**
|
||||
* The number of constructors of the datatype sort.
|
||||
**/
|
||||
public int NumConstructors() throws Z3Exception
|
||||
public int getNumConstructors() throws Z3Exception
|
||||
{
|
||||
return Native.getDatatypeSortNumConstructors(Context().nCtx(),
|
||||
NativeObject());
|
||||
return Native.getDatatypeSortNumConstructors(getContext().nCtx(),
|
||||
getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,13 +25,13 @@ public class DatatypeSort extends Sort
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] Constructors() throws Z3Exception
|
||||
public FuncDecl[] getConstructors() throws Z3Exception
|
||||
{
|
||||
int n = NumConstructors();
|
||||
int n = getNumConstructors();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.getDatatypeSortConstructor(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = new FuncDecl(getContext(), Native.getDatatypeSortConstructor(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -40,13 +40,13 @@ public class DatatypeSort extends Sort
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] Recognizers() throws Z3Exception
|
||||
public FuncDecl[] getRecognizers() throws Z3Exception
|
||||
{
|
||||
int n = NumConstructors();
|
||||
int n = getNumConstructors();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.getDatatypeSortRecognizer(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = new FuncDecl(getContext(), Native.getDatatypeSortRecognizer(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -55,22 +55,22 @@ public class DatatypeSort extends Sort
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[][] Accessors() throws Z3Exception
|
||||
public FuncDecl[][] getAccessors() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumConstructors();
|
||||
int n = getNumConstructors();
|
||||
FuncDecl[][] res = new FuncDecl[n][];
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
FuncDecl fd = new FuncDecl(Context(),
|
||||
Native.getDatatypeSortConstructor(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
int ds = fd.DomainSize();
|
||||
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(Context(),
|
||||
Native.getDatatypeSortConstructorAccessor(Context()
|
||||
.nCtx(), NativeObject(), i, j));
|
||||
tmp[j] = new FuncDecl(getContext(),
|
||||
Native.getDatatypeSortConstructorAccessor(getContext()
|
||||
.nCtx(), getNativeObject(), i, j));
|
||||
res[i] = tmp;
|
||||
}
|
||||
return res;
|
||||
|
@ -84,8 +84,8 @@ public class DatatypeSort extends Sort
|
|||
DatatypeSort(Context ctx, Symbol name, Constructor[] constructors)
|
||||
throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkDatatype(ctx.nCtx(), name.NativeObject(),
|
||||
(int) constructors.length, ArrayToNative(constructors)));
|
||||
super(ctx, Native.mkDatatype(ctx.nCtx(), name.getNativeObject(),
|
||||
(int) constructors.length, arrayToNative(constructors)));
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ public class EnumSort extends Sort
|
|||
/**
|
||||
* The function declarations of the constants in the enumeration.
|
||||
**/
|
||||
public FuncDecl[] ConstDecls()
|
||||
public FuncDecl[] getConstDecls()
|
||||
{
|
||||
return _constdecls;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class EnumSort extends Sort
|
|||
/**
|
||||
* The constants in the enumeration.
|
||||
**/
|
||||
public Expr[] Consts()
|
||||
public Expr[] getConsts()
|
||||
{
|
||||
return _consts;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class EnumSort extends Sort
|
|||
/**
|
||||
* The test predicates for the constants in the enumeration.
|
||||
**/
|
||||
public FuncDecl[] TesterDecls()
|
||||
public FuncDecl[] getTesterDecls()
|
||||
{
|
||||
return _testerdecls;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class EnumSort extends Sort
|
|||
long[] n_constdecls = new long[n];
|
||||
long[] n_testers = new long[n];
|
||||
setNativeObject(Native.mkEnumerationSort(ctx.nCtx(),
|
||||
name.NativeObject(), (int) n, Symbol.ArrayToNative(enumNames),
|
||||
name.getNativeObject(), (int) n, Symbol.arrayToNative(enumNames),
|
||||
n_constdecls, n_testers));
|
||||
_constdecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
|
@ -56,6 +56,6 @@ public class EnumSort extends Sort
|
|||
_testerdecls[i] = new FuncDecl(ctx, n_testers[i]);
|
||||
_consts = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
_consts[i] = ctx.MkApp(_constdecls[i], (Expr[])null);
|
||||
_consts[i] = ctx.mkApp(_constdecls[i], (Expr[])null);
|
||||
}
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,10 +14,10 @@ public class FiniteDomainSort extends Sort
|
|||
/**
|
||||
* The size of the finite domain sort.
|
||||
**/
|
||||
public long Size() throws Z3Exception
|
||||
public long getSize() throws Z3Exception
|
||||
{
|
||||
Native.LongPtr res = new Native.LongPtr();
|
||||
Native.getFiniteDomainSortSize(Context().nCtx(), NativeObject(), res);
|
||||
Native.getFiniteDomainSortSize(getContext().nCtx(), getNativeObject(), res);
|
||||
return res.value;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class FiniteDomainSort extends Sort
|
|||
|
||||
FiniteDomainSort(Context ctx, Symbol name, long size) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.NativeObject(),
|
||||
super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.getNativeObject(),
|
||||
size));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_lbool;
|
||||
|
||||
/**
|
||||
* Object for managing fixedpoints
|
||||
|
@ -17,9 +17,9 @@ public class Fixedpoint extends Z3Object
|
|||
/**
|
||||
* A string that describes all available fixedpoint solver parameters.
|
||||
**/
|
||||
public String Help() throws Z3Exception
|
||||
public String getHelp() throws Z3Exception
|
||||
{
|
||||
return Native.fixedpointGetHelp(Context().nCtx(), NativeObject());
|
||||
return Native.fixedpointGetHelp(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,9 +30,9 @@ public class Fixedpoint extends Z3Object
|
|||
public void setParameters(Params value) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(value);
|
||||
Native.fixedpointSetParams(Context().nCtx(), NativeObject(),
|
||||
value.NativeObject());
|
||||
getContext().checkContextMatch(value);
|
||||
Native.fixedpointSetParams(getContext().nCtx(), getNativeObject(),
|
||||
value.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,10 +40,10 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ParamDescrs ParameterDescriptions() throws Z3Exception
|
||||
public ParamDescrs getParameterDescriptions() throws Z3Exception
|
||||
{
|
||||
return new ParamDescrs(Context(), Native.fixedpointGetParamDescrs(
|
||||
Context().nCtx(), NativeObject()));
|
||||
return new ParamDescrs(getContext(), Native.fixedpointGetParamDescrs(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,13 +51,13 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr[] constraints) throws Z3Exception
|
||||
public void assert_(BoolExpr ... constraints) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(constraints);
|
||||
getContext().checkContextMatch(constraints);
|
||||
for (BoolExpr a : constraints)
|
||||
{
|
||||
Native.fixedpointAssert(Context().nCtx(), NativeObject(),
|
||||
a.NativeObject());
|
||||
Native.fixedpointAssert(getContext().nCtx(), getNativeObject(),
|
||||
a.getNativeObject());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,12 +66,12 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void RegisterRelation(FuncDecl f) throws Z3Exception
|
||||
public void registerRelation(FuncDecl f) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(f);
|
||||
Native.fixedpointRegisterRelation(Context().nCtx(), NativeObject(),
|
||||
f.NativeObject());
|
||||
getContext().checkContextMatch(f);
|
||||
Native.fixedpointRegisterRelation(getContext().nCtx(), getNativeObject(),
|
||||
f.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,12 +79,12 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void AddRule(BoolExpr rule, Symbol name) throws Z3Exception
|
||||
public void addRule(BoolExpr rule, Symbol name) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(rule);
|
||||
Native.fixedpointAddRule(Context().nCtx(), NativeObject(),
|
||||
rule.NativeObject(), AST.GetNativeObject(name));
|
||||
getContext().checkContextMatch(rule);
|
||||
Native.fixedpointAddRule(getContext().nCtx(), getNativeObject(),
|
||||
rule.getNativeObject(), AST.getNativeObject(name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,12 +92,11 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void AddFact(FuncDecl pred, int[] args) throws Z3Exception
|
||||
public void addFact(FuncDecl pred, int ... args) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(pred);
|
||||
Native.fixedpointAddFact(Context().nCtx(), NativeObject(),
|
||||
pred.NativeObject(), (int) args.length, args);
|
||||
getContext().checkContextMatch(pred);
|
||||
Native.fixedpointAddFact(getContext().nCtx(), getNativeObject(),
|
||||
pred.getNativeObject(), (int) args.length, args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,12 +108,12 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Status Query(BoolExpr query) throws Z3Exception
|
||||
public Status query(BoolExpr query) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(query);
|
||||
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQuery(Context().nCtx(),
|
||||
NativeObject(), query.NativeObject()));
|
||||
getContext().checkContextMatch(query);
|
||||
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQuery(getContext().nCtx(),
|
||||
getNativeObject(), query.getNativeObject()));
|
||||
switch (r)
|
||||
{
|
||||
case Z3_L_TRUE:
|
||||
|
@ -134,13 +133,13 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Status Query(FuncDecl[] relations) throws Z3Exception
|
||||
public Status query(FuncDecl[] relations) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(relations);
|
||||
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQueryRelations(Context()
|
||||
.nCtx(), NativeObject(), AST.ArrayLength(relations), AST
|
||||
.ArrayToNative(relations)));
|
||||
getContext().checkContextMatch(relations);
|
||||
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQueryRelations(getContext()
|
||||
.nCtx(), getNativeObject(), AST.arrayLength(relations), AST
|
||||
.arrayToNative(relations)));
|
||||
switch (r)
|
||||
{
|
||||
case Z3_L_TRUE:
|
||||
|
@ -155,9 +154,9 @@ public class Fixedpoint extends Z3Object
|
|||
/**
|
||||
* Creates a backtracking point. <seealso cref="Pop"/>
|
||||
**/
|
||||
public void Push() throws Z3Exception
|
||||
public void push() throws Z3Exception
|
||||
{
|
||||
Native.fixedpointPush(Context().nCtx(), NativeObject());
|
||||
Native.fixedpointPush(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,9 +164,9 @@ public class Fixedpoint extends Z3Object
|
|||
* thrown if Pop is called without a corresponding <code>Push</code>
|
||||
* </remarks> <seealso cref="Push"/>
|
||||
**/
|
||||
public void Pop() throws Z3Exception
|
||||
public void pop() throws Z3Exception
|
||||
{
|
||||
Native.fixedpointPop(Context().nCtx(), NativeObject());
|
||||
Native.fixedpointPop(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,12 +174,12 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void UpdateRule(BoolExpr rule, Symbol name) throws Z3Exception
|
||||
public void updateRule(BoolExpr rule, Symbol name) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(rule);
|
||||
Native.fixedpointUpdateRule(Context().nCtx(), NativeObject(),
|
||||
rule.NativeObject(), AST.GetNativeObject(name));
|
||||
getContext().checkContextMatch(rule);
|
||||
Native.fixedpointUpdateRule(getContext().nCtx(), getNativeObject(),
|
||||
rule.getNativeObject(), AST.getNativeObject(name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,29 +188,29 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr GetAnswer() throws Z3Exception
|
||||
public Expr getAnswer() throws Z3Exception
|
||||
{
|
||||
long ans = Native.fixedpointGetAnswer(Context().nCtx(), NativeObject());
|
||||
return (ans == 0) ? null : Expr.Create(Context(), ans);
|
||||
long ans = Native.fixedpointGetAnswer(getContext().nCtx(), getNativeObject());
|
||||
return (ans == 0) ? null : Expr.create(getContext(), ans);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve explanation why fixedpoint engine returned status Unknown.
|
||||
**/
|
||||
public String GetReasonUnknown() throws Z3Exception
|
||||
public String getReasonUnknown() throws Z3Exception
|
||||
{
|
||||
|
||||
return Native.fixedpointGetReasonUnknown(Context().nCtx(),
|
||||
NativeObject());
|
||||
return Native.fixedpointGetReasonUnknown(getContext().nCtx(),
|
||||
getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the number of levels explored for a given predicate.
|
||||
**/
|
||||
public int GetNumLevels(FuncDecl predicate) throws Z3Exception
|
||||
public int getNumLevels(FuncDecl predicate) throws Z3Exception
|
||||
{
|
||||
return Native.fixedpointGetNumLevels(Context().nCtx(), NativeObject(),
|
||||
predicate.NativeObject());
|
||||
return Native.fixedpointGetNumLevels(getContext().nCtx(), getNativeObject(),
|
||||
predicate.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,22 +218,22 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr GetCoverDelta(int level, FuncDecl predicate) throws Z3Exception
|
||||
public Expr getCoverDelta(int level, FuncDecl predicate) throws Z3Exception
|
||||
{
|
||||
long res = Native.fixedpointGetCoverDelta(Context().nCtx(),
|
||||
NativeObject(), level, predicate.NativeObject());
|
||||
return (res == 0) ? null : Expr.Create(Context(), res);
|
||||
long res = Native.fixedpointGetCoverDelta(getContext().nCtx(),
|
||||
getNativeObject(), level, predicate.getNativeObject());
|
||||
return (res == 0) ? null : Expr.create(getContext(), res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add <tt>property</tt> about the <tt>predicate</tt>. The property is added
|
||||
* at <tt>level</tt>.
|
||||
**/
|
||||
public void AddCover(int level, FuncDecl predicate, Expr property)
|
||||
public void addCover(int level, FuncDecl predicate, Expr property)
|
||||
throws Z3Exception
|
||||
{
|
||||
Native.fixedpointAddCover(Context().nCtx(), NativeObject(), level,
|
||||
predicate.NativeObject(), property.NativeObject());
|
||||
Native.fixedpointAddCover(getContext().nCtx(), getNativeObject(), level,
|
||||
predicate.getNativeObject(), property.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -244,7 +243,7 @@ public class Fixedpoint extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.fixedpointToString(Context().nCtx(), NativeObject(),
|
||||
return Native.fixedpointToString(getContext().nCtx(), getNativeObject(),
|
||||
0, null);
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
|
@ -256,12 +255,12 @@ public class Fixedpoint extends Z3Object
|
|||
* Instrument the Datalog engine on which table representation to use for
|
||||
* recursive predicate.
|
||||
**/
|
||||
public void SetPredicateRepresentation(FuncDecl f, Symbol[] kinds) throws Z3Exception
|
||||
public void setPredicateRepresentation(FuncDecl f, Symbol[] kinds) throws Z3Exception
|
||||
{
|
||||
|
||||
Native.fixedpointSetPredicateRepresentation(Context().nCtx(),
|
||||
NativeObject(), f.NativeObject(), AST.ArrayLength(kinds),
|
||||
Symbol.ArrayToNative(kinds));
|
||||
Native.fixedpointSetPredicateRepresentation(getContext().nCtx(),
|
||||
getNativeObject(), f.getNativeObject(), AST.arrayLength(kinds),
|
||||
Symbol.arrayToNative(kinds));
|
||||
|
||||
}
|
||||
|
||||
|
@ -271,8 +270,8 @@ public class Fixedpoint extends Z3Object
|
|||
public String toString(BoolExpr[] queries) throws Z3Exception
|
||||
{
|
||||
|
||||
return Native.fixedpointToString(Context().nCtx(), NativeObject(),
|
||||
AST.ArrayLength(queries), AST.ArrayToNative(queries));
|
||||
return Native.fixedpointToString(getContext().nCtx(), getNativeObject(),
|
||||
AST.arrayLength(queries), AST.arrayToNative(queries));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -280,15 +279,15 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Rules() throws Z3Exception
|
||||
public BoolExpr[] getRules() throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector v = new ASTVector(Context(), Native.fixedpointGetRules(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = v.Size();
|
||||
ASTVector v = new ASTVector(getContext(), Native.fixedpointGetRules(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
int n = v.size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), v.get(i).NativeObject());
|
||||
res[i] = new BoolExpr(getContext(), v.get(i).getNativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -297,15 +296,15 @@ public class Fixedpoint extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Assertions() throws Z3Exception
|
||||
public BoolExpr[] getAssertions() throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector v = new ASTVector(Context(), Native.fixedpointGetAssertions(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = v.Size();
|
||||
ASTVector v = new ASTVector(getContext(), Native.fixedpointGetAssertions(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
int n = v.size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), v.get(i).NativeObject());
|
||||
res[i] = new BoolExpr(getContext(), v.get(i).getNativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -319,15 +318,15 @@ public class Fixedpoint extends Z3Object
|
|||
super(ctx, Native.mkFixedpoint(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Fixedpoint_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().fixedpoint_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Fixedpoint_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().fixedpoint_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class FixedpointDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class FixedpointDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_ast_kind;
|
||||
import com.microsoft.z3.enumerations.Z3_decl_kind;
|
||||
import com.microsoft.z3.enumerations.Z3_parameter_kind;
|
||||
|
||||
/**
|
||||
* Function declarations.
|
||||
|
@ -32,7 +34,7 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* Object comparison.
|
||||
**/
|
||||
public boolean Equals(Object o)
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
FuncDecl casted = (FuncDecl) o;
|
||||
if (casted == null)
|
||||
|
@ -43,9 +45,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* A hash code.
|
||||
**/
|
||||
public int GetHashCode() throws Z3Exception
|
||||
public int hashCode()
|
||||
{
|
||||
return super.GetHashCode();
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,7 +57,7 @@ public class FuncDecl extends AST
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.funcDeclToString(Context().nCtx(), NativeObject());
|
||||
return Native.funcDeclToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -65,125 +67,125 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* Returns a unique identifier for the function declaration.
|
||||
**/
|
||||
public int Id() throws Z3Exception
|
||||
public int getId() throws Z3Exception
|
||||
{
|
||||
return Native.getFuncDeclId(Context().nCtx(), NativeObject());
|
||||
return Native.getFuncDeclId(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The arity of the function declaration
|
||||
**/
|
||||
public int Arity() throws Z3Exception
|
||||
public int getArity() throws Z3Exception
|
||||
{
|
||||
return Native.getArity(Context().nCtx(), NativeObject());
|
||||
return Native.getArity(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the domain of the function declaration <seealso
|
||||
* cref="Arity"/>
|
||||
**/
|
||||
public int DomainSize() throws Z3Exception
|
||||
public int getDomainSize() throws Z3Exception
|
||||
{
|
||||
return Native.getDomainSize(Context().nCtx(), NativeObject());
|
||||
return Native.getDomainSize(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The domain of the function declaration
|
||||
**/
|
||||
public Sort[] Domain() throws Z3Exception
|
||||
public Sort[] getDomain() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = DomainSize();
|
||||
int n = getDomainSize();
|
||||
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(),
|
||||
Native.getDomain(Context().nCtx(), NativeObject(), i));
|
||||
res[i] = Sort.create(getContext(),
|
||||
Native.getDomain(getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The range of the function declaration
|
||||
**/
|
||||
public Sort Range() throws Z3Exception
|
||||
public Sort getRange() throws Z3Exception
|
||||
{
|
||||
|
||||
return Sort.Create(Context(),
|
||||
Native.getRange(Context().nCtx(), NativeObject()));
|
||||
return Sort.create(getContext(),
|
||||
Native.getRange(getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the function declaration.
|
||||
**/
|
||||
public Z3_decl_kind DeclKind() throws Z3Exception
|
||||
public Z3_decl_kind getDeclKind() throws Z3Exception
|
||||
{
|
||||
return Z3_decl_kind.fromInt(Native.getDeclKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return Z3_decl_kind.fromInt(Native.getDeclKind(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the function declaration
|
||||
**/
|
||||
public Symbol Name() throws Z3Exception
|
||||
public Symbol getName() throws Z3Exception
|
||||
{
|
||||
|
||||
return Symbol.Create(Context(),
|
||||
Native.getDeclName(Context().nCtx(), NativeObject()));
|
||||
return Symbol.create(getContext(),
|
||||
Native.getDeclName(getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of parameters of the function declaration
|
||||
**/
|
||||
public int NumParameters() throws Z3Exception
|
||||
public int getNumParameters() throws Z3Exception
|
||||
{
|
||||
return Native.getDeclNumParameters(Context().nCtx(), NativeObject());
|
||||
return Native.getDeclNumParameters(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The parameters of the function declaration
|
||||
**/
|
||||
public Parameter[] Parameters() throws Z3Exception
|
||||
public Parameter[] getParameters() throws Z3Exception
|
||||
{
|
||||
|
||||
int num = NumParameters();
|
||||
int num = getNumParameters();
|
||||
Parameter[] res = new Parameter[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
Z3_parameter_kind k = Z3_parameter_kind.fromInt(Native
|
||||
.getDeclParameterKind(Context().nCtx(), NativeObject(), i));
|
||||
.getDeclParameterKind(getContext().nCtx(), getNativeObject(), i));
|
||||
switch (k)
|
||||
{
|
||||
case Z3_PARAMETER_INT:
|
||||
res[i] = new Parameter(k, Native.getDeclIntParameter(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = new Parameter(k, Native.getDeclIntParameter(getContext()
|
||||
.nCtx(), getNativeObject(), i));
|
||||
break;
|
||||
case Z3_PARAMETER_DOUBLE:
|
||||
res[i] = new Parameter(k, Native.getDeclDoubleParameter(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
break;
|
||||
case Z3_PARAMETER_SYMBOL:
|
||||
res[i] = new Parameter(k, Symbol.Create(Context(), Native
|
||||
.getDeclSymbolParameter(Context().nCtx(),
|
||||
NativeObject(), i)));
|
||||
res[i] = new Parameter(k, Symbol.create(getContext(), Native
|
||||
.getDeclSymbolParameter(getContext().nCtx(),
|
||||
getNativeObject(), i)));
|
||||
break;
|
||||
case Z3_PARAMETER_SORT:
|
||||
res[i] = new Parameter(k, Sort.Create(Context(), Native
|
||||
.getDeclSortParameter(Context().nCtx(), NativeObject(),
|
||||
res[i] = new Parameter(k, Sort.create(getContext(), Native
|
||||
.getDeclSortParameter(getContext().nCtx(), getNativeObject(),
|
||||
i)));
|
||||
break;
|
||||
case Z3_PARAMETER_AST:
|
||||
res[i] = new Parameter(k, new AST(Context(),
|
||||
Native.getDeclAstParameter(Context().nCtx(),
|
||||
NativeObject(), i)));
|
||||
res[i] = new Parameter(k, new AST(getContext(),
|
||||
Native.getDeclAstParameter(getContext().nCtx(),
|
||||
getNativeObject(), i)));
|
||||
break;
|
||||
case Z3_PARAMETER_FUNC_DECL:
|
||||
res[i] = new Parameter(k, new FuncDecl(Context(),
|
||||
Native.getDeclFuncDeclParameter(Context().nCtx(),
|
||||
NativeObject(), i)));
|
||||
res[i] = new Parameter(k, new FuncDecl(getContext(),
|
||||
Native.getDeclFuncDeclParameter(getContext().nCtx(),
|
||||
getNativeObject(), i)));
|
||||
break;
|
||||
case Z3_PARAMETER_RATIONAL:
|
||||
res[i] = new Parameter(k, Native.getDeclRationalParameter(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
break;
|
||||
default:
|
||||
throw new Z3Exception(
|
||||
|
@ -210,9 +212,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The int value of the parameter.</summary>
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
public int getInt() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_INT)
|
||||
if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_INT)
|
||||
throw new Z3Exception("parameter is not an int");
|
||||
return i;
|
||||
}
|
||||
|
@ -220,9 +222,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The double value of the parameter.</summary>
|
||||
**/
|
||||
public double Double() throws Z3Exception
|
||||
public double getDouble() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_DOUBLE)
|
||||
if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_DOUBLE)
|
||||
throw new Z3Exception("parameter is not a double ");
|
||||
return d;
|
||||
}
|
||||
|
@ -230,9 +232,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The Symbol value of the parameter.</summary>
|
||||
**/
|
||||
public Symbol Symbol() throws Z3Exception
|
||||
public Symbol getSymbol() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SYMBOL)
|
||||
if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SYMBOL)
|
||||
throw new Z3Exception("parameter is not a Symbol");
|
||||
return sym;
|
||||
}
|
||||
|
@ -240,9 +242,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The Sort value of the parameter.</summary>
|
||||
**/
|
||||
public Sort Sort() throws Z3Exception
|
||||
public Sort getSort() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SORT)
|
||||
if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SORT)
|
||||
throw new Z3Exception("parameter is not a Sort");
|
||||
return srt;
|
||||
}
|
||||
|
@ -250,9 +252,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The AST value of the parameter.</summary>
|
||||
**/
|
||||
public AST AST() throws Z3Exception
|
||||
public AST getAST() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_AST)
|
||||
if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_AST)
|
||||
throw new Z3Exception("parameter is not an AST");
|
||||
return ast;
|
||||
}
|
||||
|
@ -260,9 +262,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The FunctionDeclaration value of the parameter.</summary>
|
||||
**/
|
||||
public FuncDecl FuncDecl() throws Z3Exception
|
||||
public FuncDecl getFuncDecl() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL)
|
||||
if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL)
|
||||
throw new Z3Exception("parameter is not a function declaration");
|
||||
return fd;
|
||||
}
|
||||
|
@ -270,9 +272,9 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The rational string value of the parameter.</summary>
|
||||
**/
|
||||
public String Rational() throws Z3Exception
|
||||
public String getRational() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_RATIONAL)
|
||||
if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_RATIONAL)
|
||||
throw new Z3Exception("parameter is not a rational String");
|
||||
return r;
|
||||
}
|
||||
|
@ -280,7 +282,7 @@ public class FuncDecl extends AST
|
|||
/**
|
||||
* The kind of the parameter.
|
||||
**/
|
||||
public Z3_parameter_kind ParameterKind() throws Z3Exception
|
||||
public Z3_parameter_kind getParameterKind() throws Z3Exception
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
|
@ -337,9 +339,9 @@ public class FuncDecl extends AST
|
|||
FuncDecl(Context ctx, Symbol name, Sort[] domain, Sort range)
|
||||
throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFuncDecl(ctx.nCtx(), name.NativeObject(),
|
||||
AST.ArrayLength(domain), AST.ArrayToNative(domain),
|
||||
range.NativeObject()));
|
||||
super(ctx, Native.mkFuncDecl(ctx.nCtx(), name.getNativeObject(),
|
||||
AST.arrayLength(domain), AST.arrayToNative(domain),
|
||||
range.getNativeObject()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -347,18 +349,18 @@ public class FuncDecl extends AST
|
|||
throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFreshFuncDecl(ctx.nCtx(), prefix,
|
||||
AST.ArrayLength(domain), AST.ArrayToNative(domain),
|
||||
range.NativeObject()));
|
||||
AST.arrayLength(domain), AST.arrayToNative(domain),
|
||||
range.getNativeObject()));
|
||||
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
void checkNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_FUNC_DECL_AST
|
||||
if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_FUNC_DECL_AST
|
||||
.toInt())
|
||||
throw new Z3Exception(
|
||||
"Underlying object is not a function declaration");
|
||||
super.CheckNativeObject(obj);
|
||||
super.checkNativeObject(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -367,31 +369,9 @@ public class FuncDecl extends AST
|
|||
*
|
||||
* @return
|
||||
**/
|
||||
/* operator this[] not translated */
|
||||
|
||||
/**
|
||||
* Create expression that applies function to arguments. <param
|
||||
* name="args"></param>
|
||||
*
|
||||
* @return
|
||||
**/
|
||||
public Expr Apply(Expr[] args) throws Z3Exception
|
||||
public Expr apply(Expr ... args) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(args);
|
||||
return Expr.Create(Context(), this, args);
|
||||
getContext().checkContextMatch(args);
|
||||
return Expr.create(getContext(), this, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create expression that applies function to one argument. <param
|
||||
* name="arg"></param>
|
||||
*
|
||||
* @return
|
||||
**/
|
||||
public Expr Apply(Expr arg) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(arg);
|
||||
Expr[] a = { arg };
|
||||
return Expr.Create(Context(), this, a);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,18 +24,18 @@ public class FuncInterp extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Value() throws Z3Exception
|
||||
public Expr getValue() throws Z3Exception
|
||||
{
|
||||
return Expr.Create(Context(),
|
||||
Native.funcEntryGetValue(Context().nCtx(), NativeObject()));
|
||||
return Expr.create(getContext(),
|
||||
Native.funcEntryGetValue(getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of arguments of the entry.
|
||||
**/
|
||||
public int NumArgs() throws Z3Exception
|
||||
public int getNumArgs() throws Z3Exception
|
||||
{
|
||||
return Native.funcEntryGetNumArgs(Context().nCtx(), NativeObject());
|
||||
return Native.funcEntryGetNumArgs(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,13 +43,13 @@ public class FuncInterp extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] Args() throws Z3Exception
|
||||
public Expr[] getArgs() throws Z3Exception
|
||||
{
|
||||
int n = NumArgs();
|
||||
int n = getNumArgs();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(), Native.funcEntryGetArg(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = Expr.create(getContext(), Native.funcEntryGetArg(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -60,12 +60,12 @@ public class FuncInterp extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
int n = NumArgs();
|
||||
int n = getNumArgs();
|
||||
String res = "[";
|
||||
Expr[] args = Args();
|
||||
Expr[] args = getArgs();
|
||||
for (int i = 0; i < n; i++)
|
||||
res += args[i] + ", ";
|
||||
return res + Value() + "]";
|
||||
return res + getValue() + "]";
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return new String("Z3Exception: " + e.getMessage());
|
||||
|
@ -77,25 +77,25 @@ public class FuncInterp extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncEntry_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().funcEntry_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncEntry_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().funcEntry_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The number of entries in the function interpretation.
|
||||
**/
|
||||
public int NumEntries() throws Z3Exception
|
||||
public int getNumEntries() throws Z3Exception
|
||||
{
|
||||
return Native.funcInterpGetNumEntries(Context().nCtx(), NativeObject());
|
||||
return Native.funcInterpGetNumEntries(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,13 +103,13 @@ public class FuncInterp extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Entry[] Entries() throws Z3Exception
|
||||
public Entry[] getEntries() throws Z3Exception
|
||||
{
|
||||
int n = NumEntries();
|
||||
int n = getNumEntries();
|
||||
Entry[] res = new Entry[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Entry(Context(), Native.funcInterpGetEntry(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = new Entry(getContext(), Native.funcInterpGetEntry(getContext()
|
||||
.nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -118,18 +118,18 @@ public class FuncInterp extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Else() throws Z3Exception
|
||||
public Expr getElse() throws Z3Exception
|
||||
{
|
||||
return Expr.Create(Context(),
|
||||
Native.funcInterpGetElse(Context().nCtx(), NativeObject()));
|
||||
return Expr.create(getContext(),
|
||||
Native.funcInterpGetElse(getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The arity of the function interpretation
|
||||
**/
|
||||
public int Arity() throws Z3Exception
|
||||
public int getArity() throws Z3Exception
|
||||
{
|
||||
return Native.funcInterpGetArity(Context().nCtx(), NativeObject());
|
||||
return Native.funcInterpGetArity(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,12 +141,12 @@ public class FuncInterp extends Z3Object
|
|||
{
|
||||
String res = "";
|
||||
res += "[";
|
||||
for (Entry e : Entries())
|
||||
for (Entry e : getEntries())
|
||||
{
|
||||
int n = e.NumArgs();
|
||||
int n = e.getNumArgs();
|
||||
if (n > 1)
|
||||
res += "[";
|
||||
Expr[] args = e.Args();
|
||||
Expr[] args = e.getArgs();
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
|
@ -155,9 +155,9 @@ public class FuncInterp extends Z3Object
|
|||
}
|
||||
if (n > 1)
|
||||
res += "]";
|
||||
res += " -> " + e.Value() + ", ";
|
||||
res += " -> " + e.getValue() + ", ";
|
||||
}
|
||||
res += "else -> " + Else();
|
||||
res += "else -> " + getElse();
|
||||
res += "]";
|
||||
return res;
|
||||
} catch (Z3Exception e)
|
||||
|
@ -171,15 +171,15 @@ public class FuncInterp extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncInterp_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().funcInterp_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncInterp_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().funcInterp_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class FuncInterpDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class FuncInterpDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class FuncInterpEntryDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class FuncInterpEntryDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
67
src/api/java/Global.java
Normal file
67
src/api/java/Global.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* Global.java
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.microsoft.z3;
|
||||
|
||||
/**
|
||||
* Global functions for Z3.
|
||||
* <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>
|
||||
* 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 '_'.
|
||||
* The character '.' is a delimiter (more later).
|
||||
* 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>.
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a global (or module) parameter.
|
||||
* <remarks>
|
||||
* Returns null if the parameter <param name="id"/> does not exist.
|
||||
* The caller must invoke #Z3_global_param_del_value to delete the value returned at \c param_value.
|
||||
* 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>
|
||||
**/
|
||||
public static String getParameter(String id)
|
||||
{
|
||||
Native.StringPtr res = new Native.StringPtr();
|
||||
if (!Native.globalParamGet(id, res))
|
||||
return null;
|
||||
else
|
||||
return res.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the value of all global (and module) parameters.
|
||||
* <remarks>
|
||||
* This command will not affect already created objects (such as tactics and solvers)
|
||||
* </remarks>
|
||||
* @seealso SetParameter
|
||||
**/
|
||||
public static void resetParameters()
|
||||
{
|
||||
Native.globalParamResetAll();
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_goal_prec;
|
||||
|
||||
/**
|
||||
* A goal (aka problem). A goal is essentially a set of formulas, that can be
|
||||
|
@ -21,43 +21,43 @@ public class Goal extends Z3Object
|
|||
* applied when the objective is to find a proof for a given goal.
|
||||
* </remarks>
|
||||
**/
|
||||
public Z3_goal_prec Precision() throws Z3Exception
|
||||
public Z3_goal_prec getPrecision() throws Z3Exception
|
||||
{
|
||||
return Z3_goal_prec.fromInt(Native.goalPrecision(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return Z3_goal_prec.fromInt(Native.goalPrecision(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is precise.
|
||||
**/
|
||||
public boolean IsPrecise() throws Z3Exception
|
||||
public boolean isPrecise() throws Z3Exception
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_PRECISE;
|
||||
return getPrecision() == Z3_goal_prec.Z3_GOAL_PRECISE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is an under-approximation.
|
||||
**/
|
||||
public boolean IsUnderApproximation() throws Z3Exception
|
||||
public boolean isUnderApproximation() throws Z3Exception
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_UNDER;
|
||||
return getPrecision() == Z3_goal_prec.Z3_GOAL_UNDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is an over-approximation.
|
||||
**/
|
||||
public boolean IsOverApproximation() throws Z3Exception
|
||||
public boolean isOverApproximation() throws Z3Exception
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_OVER;
|
||||
return getPrecision() == Z3_goal_prec.Z3_GOAL_OVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is garbage (i.e., the product of over- and
|
||||
* under-approximations).
|
||||
**/
|
||||
public boolean IsGarbage() throws Z3Exception
|
||||
public boolean isGarbage() throws Z3Exception
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_UNDER_OVER;
|
||||
return getPrecision() == Z3_goal_prec.Z3_GOAL_UNDER_OVER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,59 +65,47 @@ public class Goal extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr[] constraints) throws Z3Exception
|
||||
public void assert_(BoolExpr ... constraints) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(constraints);
|
||||
getContext().checkContextMatch(constraints);
|
||||
for (BoolExpr c : constraints)
|
||||
{
|
||||
Native.goalAssert(Context().nCtx(), NativeObject(),
|
||||
c.NativeObject());
|
||||
Native.goalAssert(getContext().nCtx(), getNativeObject(),
|
||||
c.getNativeObject());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a <paramref name="constraint"/> to the given goal.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr constraint) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(constraint);
|
||||
Native.goalAssert(Context().nCtx(), NativeObject(),
|
||||
constraint.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal contains `false'.
|
||||
**/
|
||||
public boolean Inconsistent() throws Z3Exception
|
||||
public boolean inconsistent() throws Z3Exception
|
||||
{
|
||||
return Native.goalInconsistent(Context().nCtx(), NativeObject());
|
||||
return Native.goalInconsistent(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The depth of the goal. <remarks> This tracks how many transformations
|
||||
* were applied to it. </remarks>
|
||||
**/
|
||||
public int Depth() throws Z3Exception
|
||||
public int getDepth() throws Z3Exception
|
||||
{
|
||||
return Native.goalDepth(Context().nCtx(), NativeObject());
|
||||
return Native.goalDepth(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Erases all formulas from the given goal.
|
||||
**/
|
||||
public void Reset() throws Z3Exception
|
||||
public void reset() throws Z3Exception
|
||||
{
|
||||
Native.goalReset(Context().nCtx(), NativeObject());
|
||||
Native.goalReset(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of formulas in the goal.
|
||||
**/
|
||||
public int Size() throws Z3Exception
|
||||
public int size() throws Z3Exception
|
||||
{
|
||||
return Native.goalSize(Context().nCtx(), NativeObject());
|
||||
return Native.goalSize(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,40 +113,41 @@ public class Goal extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Formulas() throws Z3Exception
|
||||
public BoolExpr[] getFormulas() throws Z3Exception
|
||||
{
|
||||
int n = Size();
|
||||
int n = size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), Native.goalFormula(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = new BoolExpr(getContext(), Native.goalFormula(getContext()
|
||||
.nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of formulas, subformulas and terms in the goal.
|
||||
**/
|
||||
public int NumExprs() throws Z3Exception
|
||||
public int getNumExprs() throws Z3Exception
|
||||
{
|
||||
return Native.goalNumExprs(Context().nCtx(), NativeObject());
|
||||
return Native.goalNumExprs(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is empty, and it is precise or the product of
|
||||
* an under approximation.
|
||||
**/
|
||||
public boolean IsDecidedSat() throws Z3Exception
|
||||
public boolean isDecidedSat() throws Z3Exception
|
||||
{
|
||||
return Native.goalIsDecidedSat(Context().nCtx(), NativeObject());
|
||||
return Native.goalIsDecidedSat(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal contains `false', and it is precise or the
|
||||
* product of an over approximation.
|
||||
**/
|
||||
public boolean IsDecidedUnsat() throws Z3Exception
|
||||
public boolean isDecidedUnsat() throws Z3Exception
|
||||
{
|
||||
return Native.goalIsDecidedUnsat(Context().nCtx(), NativeObject());
|
||||
return Native
|
||||
.goalIsDecidedUnsat(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,25 +156,40 @@ public class Goal extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Goal Translate(Context ctx) throws Z3Exception
|
||||
public Goal translate(Context ctx) throws Z3Exception
|
||||
{
|
||||
return new Goal(ctx, Native.goalTranslate(Context().nCtx(),
|
||||
NativeObject(), ctx.nCtx()));
|
||||
return new Goal(ctx, Native.goalTranslate(getContext().nCtx(),
|
||||
getNativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic
|
||||
* on the goal.</remarks>
|
||||
**/
|
||||
public Goal Simplify(Params p) throws Z3Exception
|
||||
public Goal simplify() throws Z3Exception
|
||||
{
|
||||
Tactic t = Context().MkTactic("simplify");
|
||||
ApplyResult res = t.Apply(this, p);
|
||||
Tactic t = getContext().mkTactic("simplify");
|
||||
ApplyResult res = t.apply(this);
|
||||
|
||||
if (res.NumSubgoals() == 0)
|
||||
if (res.getNumSubgoals() == 0)
|
||||
throw new Z3Exception("No subgoals");
|
||||
else
|
||||
return res.Subgoals()[0];
|
||||
return res.getSubgoals()[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic
|
||||
* on the goal.</remarks>
|
||||
**/
|
||||
public Goal simplify(Params p) throws Z3Exception
|
||||
{
|
||||
Tactic t = getContext().mkTactic("simplify");
|
||||
ApplyResult res = t.apply(this, p);
|
||||
|
||||
if (res.getNumSubgoals() == 0)
|
||||
throw new Z3Exception("No subgoals");
|
||||
else
|
||||
return res.getSubgoals()[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +201,7 @@ public class Goal extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.goalToString(Context().nCtx(), NativeObject());
|
||||
return Native.goalToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -216,16 +220,16 @@ public class Goal extends Z3Object
|
|||
(unsatCores) ? true : false, (proofs) ? true : false));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Goal_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().goal_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Goal_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().goal_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class GoalDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class GoalDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -6,26 +6,26 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.LinkedList;
|
||||
|
||||
abstract class IDecRefQueue
|
||||
{
|
||||
protected Object m_lock = new Object();
|
||||
protected LinkedList<Long> m_queue = new LinkedList<Long>();
|
||||
final int m_move_limit = 1024;
|
||||
protected final int m_move_limit = 1024;
|
||||
|
||||
public abstract void IncRef(Context ctx, long obj);
|
||||
protected abstract void incRef(Context ctx, long obj);
|
||||
|
||||
public abstract void DecRef(Context ctx, long obj);
|
||||
protected abstract void decRef(Context ctx, long obj);
|
||||
|
||||
public void IncAndClear(Context ctx, long o)
|
||||
protected void incAndClear(Context ctx, long o)
|
||||
{
|
||||
IncRef(ctx, o);
|
||||
incRef(ctx, o);
|
||||
if (m_queue.size() >= m_move_limit)
|
||||
Clear(ctx);
|
||||
clear(ctx);
|
||||
}
|
||||
|
||||
public void Add(long o)
|
||||
protected void add(long o)
|
||||
{
|
||||
if (o == 0)
|
||||
return;
|
||||
|
@ -36,12 +36,12 @@ abstract class IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void Clear(Context ctx)
|
||||
protected void clear(Context ctx)
|
||||
{
|
||||
synchronized (m_lock)
|
||||
{
|
||||
for (Long o : m_queue)
|
||||
DecRef(ctx, o);
|
||||
decRef(ctx, o);
|
||||
m_queue.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ package com.microsoft.z3;
|
|||
|
||||
public class IDisposable
|
||||
{
|
||||
public void Dispose() throws Z3Exception
|
||||
public void dispose() throws Z3Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ public class IntNum extends IntExpr
|
|||
/**
|
||||
* Retrieve the int value.
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
public int getInt() throws Z3Exception
|
||||
{
|
||||
Native.IntPtr res = new Native.IntPtr();
|
||||
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
if (Native.getNumeralInt(getContext().nCtx(), getNativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int");
|
||||
return res.value;
|
||||
}
|
||||
|
@ -33,10 +33,10 @@ public class IntNum extends IntExpr
|
|||
/**
|
||||
* Retrieve the 64-bit int value.
|
||||
**/
|
||||
public long Int64() throws Z3Exception
|
||||
public long getInt64() throws Z3Exception
|
||||
{
|
||||
Native.LongPtr res = new Native.LongPtr();
|
||||
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
if (Native.getNumeralInt64(getContext().nCtx(), getNativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int64");
|
||||
return res.value;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class IntNum extends IntExpr
|
|||
/**
|
||||
* Retrieve the BigInteger value.
|
||||
**/
|
||||
public BigInteger BigInteger() throws Z3Exception
|
||||
public BigInteger getBigInteger() throws Z3Exception
|
||||
{
|
||||
return new BigInteger(this.toString());
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class IntNum extends IntExpr
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.getNumeralString(Context().nCtx(), NativeObject());
|
||||
return Native.getNumeralString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_symbol_kind;
|
||||
|
||||
/**
|
||||
* Numbered symbols
|
||||
|
@ -17,11 +17,11 @@ public class IntSymbol extends Symbol
|
|||
* The int value of the symbol. <remarks>Throws an exception if the symbol
|
||||
* is not of int kind. </remarks>
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
public int getInt() throws Z3Exception
|
||||
{
|
||||
if (!IsIntSymbol())
|
||||
if (!isIntSymbol())
|
||||
throw new Z3Exception("Int requested from non-Int symbol");
|
||||
return Native.getSymbolInt(Context().nCtx(), NativeObject());
|
||||
return Native.getSymbolInt(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
IntSymbol(Context ctx, long obj) throws Z3Exception
|
||||
|
@ -34,11 +34,11 @@ public class IntSymbol extends Symbol
|
|||
super(ctx, Native.mkIntSymbol(ctx.nCtx(), i));
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
void checkNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_INT_SYMBOL
|
||||
if (Native.getSymbolKind(getContext().nCtx(), obj) != Z3_symbol_kind.Z3_INT_SYMBOL
|
||||
.toInt())
|
||||
throw new Z3Exception("Symbol is not of integer kind");
|
||||
super.CheckNativeObject(obj);
|
||||
super.checkNativeObject(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,36 +14,32 @@ public class ListSort extends Sort
|
|||
/**
|
||||
* The declaration of the nil function of this list sort.
|
||||
**/
|
||||
public FuncDecl NilDecl()
|
||||
public FuncDecl getNilDecl()
|
||||
{
|
||||
|
||||
return nilDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The empty list.
|
||||
**/
|
||||
public Expr Nil()
|
||||
public Expr getNil()
|
||||
{
|
||||
|
||||
return nilConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the isNil function of this list sort.
|
||||
**/
|
||||
public FuncDecl IsNilDecl()
|
||||
public FuncDecl getIsNilDecl()
|
||||
{
|
||||
|
||||
return isNilDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the cons function of this list sort.
|
||||
**/
|
||||
public FuncDecl ConsDecl()
|
||||
public FuncDecl getConsDecl()
|
||||
{
|
||||
|
||||
return consDecl;
|
||||
}
|
||||
|
||||
|
@ -51,27 +47,24 @@ public class ListSort extends Sort
|
|||
* The declaration of the isCons function of this list sort.
|
||||
*
|
||||
**/
|
||||
public FuncDecl IsConsDecl()
|
||||
public FuncDecl getIsConsDecl()
|
||||
{
|
||||
|
||||
return isConsDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the head function of this list sort.
|
||||
**/
|
||||
public FuncDecl HeadDecl()
|
||||
public FuncDecl getHeadDecl()
|
||||
{
|
||||
|
||||
return headDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the tail function of this list sort.
|
||||
**/
|
||||
public FuncDecl TailDecl()
|
||||
public FuncDecl getTailDecl()
|
||||
{
|
||||
|
||||
return tailDecl;
|
||||
}
|
||||
|
||||
|
@ -87,8 +80,8 @@ public class ListSort extends Sort
|
|||
Native.LongPtr icons = new Native.LongPtr(), iiscons = new Native.LongPtr();
|
||||
Native.LongPtr ihead = new Native.LongPtr(), itail = new Native.LongPtr();
|
||||
|
||||
setNativeObject(Native.mkListSort(ctx.nCtx(), name.NativeObject(),
|
||||
elemSort.NativeObject(), inil, iisnil, icons, iiscons, ihead,
|
||||
setNativeObject(Native.mkListSort(ctx.nCtx(), name.getNativeObject(),
|
||||
elemSort.getNativeObject(), inil, iisnil, icons, iiscons, ihead,
|
||||
itail));
|
||||
nilDecl = new FuncDecl(ctx, inil.value);
|
||||
isNilDecl = new FuncDecl(ctx, iisnil.value);
|
||||
|
@ -96,6 +89,6 @@ public class ListSort extends Sort
|
|||
isConsDecl = new FuncDecl(ctx, iiscons.value);
|
||||
headDecl = new FuncDecl(ctx, ihead.value);
|
||||
tailDecl = new FuncDecl(ctx, itail.value);
|
||||
nilConst = ctx.MkConst(nilDecl);
|
||||
nilConst = ctx.mkConst(nilDecl);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ public final class Log
|
|||
*
|
||||
* @return True if opening the log file succeeds, false otherwise.
|
||||
**/
|
||||
public static boolean Open(String filename)
|
||||
public static boolean open(String filename)
|
||||
{
|
||||
m_is_open = true;
|
||||
return Native.openLog(filename) == 1;
|
||||
|
@ -30,7 +30,7 @@ public final class Log
|
|||
/**
|
||||
* Closes the interaction log.
|
||||
**/
|
||||
public static void Close()
|
||||
public static void close()
|
||||
{
|
||||
m_is_open = false;
|
||||
Native.closeLog();
|
||||
|
@ -41,7 +41,7 @@ public final class Log
|
|||
* log.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public static void Append(String s) throws Z3Exception
|
||||
public static void append(String s) throws Z3Exception
|
||||
{
|
||||
if (!m_is_open)
|
||||
throw new Z3Exception("Log cannot be closed.");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_sort_kind;
|
||||
|
||||
/**
|
||||
* A Model contains interpretations (assignments) of constants and functions.
|
||||
|
@ -21,10 +21,10 @@ public class Model extends Z3Object
|
|||
* null otherwise.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr ConstInterp(Expr a) throws Z3Exception
|
||||
public Expr getConstInterp(Expr a) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(a);
|
||||
return ConstInterp(a.FuncDecl());
|
||||
getContext().checkContextMatch(a);
|
||||
return getConstInterp(a.getFuncDecl());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,22 +35,22 @@ public class Model extends Z3Object
|
|||
* null otherwise.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr ConstInterp(FuncDecl f) throws Z3Exception
|
||||
public Expr getConstInterp(FuncDecl f) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(f);
|
||||
if (f.Arity() != 0
|
||||
|| Native.getSortKind(Context().nCtx(),
|
||||
Native.getRange(Context().nCtx(), f.NativeObject())) == Z3_sort_kind.Z3_ARRAY_SORT
|
||||
getContext().checkContextMatch(f);
|
||||
if (f.getArity() != 0
|
||||
|| Native.getSortKind(getContext().nCtx(),
|
||||
Native.getRange(getContext().nCtx(), f.getNativeObject())) == Z3_sort_kind.Z3_ARRAY_SORT
|
||||
.toInt())
|
||||
throw new Z3Exception(
|
||||
"Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp.");
|
||||
|
||||
long n = Native.modelGetConstInterp(Context().nCtx(), NativeObject(),
|
||||
f.NativeObject());
|
||||
long n = Native.modelGetConstInterp(getContext().nCtx(), getNativeObject(),
|
||||
f.getNativeObject());
|
||||
if (n == 0)
|
||||
return null;
|
||||
else
|
||||
return Expr.Create(Context(), n);
|
||||
return Expr.create(getContext(), n);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,17 +62,17 @@ public class Model extends Z3Object
|
|||
* the model, null otherwise.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncInterp FuncInterp(FuncDecl f) throws Z3Exception
|
||||
public FuncInterp getFuncInterp(FuncDecl f) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(f);
|
||||
getContext().checkContextMatch(f);
|
||||
|
||||
Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(Context()
|
||||
.nCtx(), Native.getRange(Context().nCtx(), f.NativeObject())));
|
||||
Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(getContext()
|
||||
.nCtx(), Native.getRange(getContext().nCtx(), f.getNativeObject())));
|
||||
|
||||
if (f.Arity() == 0)
|
||||
if (f.getArity() == 0)
|
||||
{
|
||||
long n = Native.modelGetConstInterp(Context().nCtx(),
|
||||
NativeObject(), f.NativeObject());
|
||||
long n = Native.modelGetConstInterp(getContext().nCtx(),
|
||||
getNativeObject(), f.getNativeObject());
|
||||
|
||||
if (sk == Z3_sort_kind.Z3_ARRAY_SORT)
|
||||
{
|
||||
|
@ -80,11 +80,11 @@ public class Model extends Z3Object
|
|||
return null;
|
||||
else
|
||||
{
|
||||
if (Native.isAsArray(Context().nCtx(), n) ^ true)
|
||||
if (Native.isAsArray(getContext().nCtx(), n) ^ true)
|
||||
throw new Z3Exception(
|
||||
"Argument was not an array constant");
|
||||
long fd = Native.getAsArrayFuncDecl(Context().nCtx(), n);
|
||||
return FuncInterp(new FuncDecl(Context(), fd));
|
||||
long fd = Native.getAsArrayFuncDecl(getContext().nCtx(), n);
|
||||
return getFuncInterp(new FuncDecl(getContext(), fd));
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -93,21 +93,21 @@ public class Model extends Z3Object
|
|||
}
|
||||
} else
|
||||
{
|
||||
long n = Native.modelGetFuncInterp(Context().nCtx(),
|
||||
NativeObject(), f.NativeObject());
|
||||
long n = Native.modelGetFuncInterp(getContext().nCtx(),
|
||||
getNativeObject(), f.getNativeObject());
|
||||
if (n == 0)
|
||||
return null;
|
||||
else
|
||||
return new FuncInterp(Context(), n);
|
||||
return new FuncInterp(getContext(), n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of constants that have an interpretation in the model.
|
||||
**/
|
||||
public int NumConsts() throws Z3Exception
|
||||
public int getNumConsts() throws Z3Exception
|
||||
{
|
||||
return Native.modelGetNumConsts(Context().nCtx(), NativeObject());
|
||||
return Native.modelGetNumConsts(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,22 +115,22 @@ public class Model extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] ConstDecls() throws Z3Exception
|
||||
public FuncDecl[] getConstDecls() throws Z3Exception
|
||||
{
|
||||
int n = NumConsts();
|
||||
int n = getNumConsts();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.modelGetConstDecl(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = new FuncDecl(getContext(), Native.modelGetConstDecl(getContext()
|
||||
.nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of function interpretations in the model.
|
||||
**/
|
||||
public int NumFuncs() throws Z3Exception
|
||||
public int getNumFuncs() throws Z3Exception
|
||||
{
|
||||
return Native.modelGetNumFuncs(Context().nCtx(), NativeObject());
|
||||
return Native.modelGetNumFuncs(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,13 +138,13 @@ public class Model extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] FuncDecls() throws Z3Exception
|
||||
public FuncDecl[] getFuncDecls() throws Z3Exception
|
||||
{
|
||||
int n = NumFuncs();
|
||||
int n = getNumFuncs();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.modelGetFuncDecl(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = new FuncDecl(getContext(), Native.modelGetFuncDecl(getContext()
|
||||
.nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -153,18 +153,18 @@ public class Model extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] Decls() throws Z3Exception
|
||||
public FuncDecl[] getDecls() throws Z3Exception
|
||||
{
|
||||
int nFuncs = NumFuncs();
|
||||
int nConsts = NumConsts();
|
||||
int nFuncs = getNumFuncs();
|
||||
int nConsts = getNumConsts();
|
||||
int n = nFuncs + nConsts;
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < nConsts; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.modelGetConstDecl(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = new FuncDecl(getContext(), Native.modelGetConstDecl(getContext()
|
||||
.nCtx(), getNativeObject(), i));
|
||||
for (int i = 0; i < nFuncs; i++)
|
||||
res[nConsts + i] = new FuncDecl(Context(), Native.modelGetFuncDecl(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[nConsts + i] = new FuncDecl(getContext(), Native.modelGetFuncDecl(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -197,14 +197,14 @@ public class Model extends Z3Object
|
|||
* @return The evaluation of <paramref name="t"/> in the model.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Eval(Expr t, boolean completion) throws Z3Exception
|
||||
public Expr eval(Expr t, boolean completion) throws Z3Exception
|
||||
{
|
||||
Native.LongPtr v = new Native.LongPtr();
|
||||
if (Native.modelEval(Context().nCtx(), NativeObject(),
|
||||
t.NativeObject(), (completion) ? true : false, v) ^ true)
|
||||
if (Native.modelEval(getContext().nCtx(), getNativeObject(),
|
||||
t.getNativeObject(), (completion) ? true : false, v) ^ true)
|
||||
throw new ModelEvaluationFailedException();
|
||||
else
|
||||
return Expr.Create(Context(), v.value);
|
||||
return Expr.create(getContext(), v.value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,18 +212,18 @@ public class Model extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Evaluate(Expr t, boolean completion) throws Z3Exception
|
||||
public Expr evaluate(Expr t, boolean completion) throws Z3Exception
|
||||
{
|
||||
return Eval(t, completion);
|
||||
return eval(t, completion);
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of uninterpreted sorts that the model has an interpretation
|
||||
* for.
|
||||
**/
|
||||
public int NumSorts() throws Z3Exception
|
||||
public int getNumSorts() throws Z3Exception
|
||||
{
|
||||
return Native.modelGetNumSorts(Context().nCtx(), NativeObject());
|
||||
return Native.modelGetNumSorts(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -235,14 +235,14 @@ public class Model extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort[] Sorts() throws Z3Exception
|
||||
public Sort[] getSorts() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumSorts();
|
||||
int n = getNumSorts();
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(),
|
||||
Native.modelGetSort(Context().nCtx(), NativeObject(), i));
|
||||
res[i] = Sort.create(getContext(),
|
||||
Native.modelGetSort(getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -255,15 +255,15 @@ public class Model extends Z3Object
|
|||
* of <paramref name="s"/>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] SortUniverse(Sort s) throws Z3Exception
|
||||
public Expr[] getSortUniverse(Sort s) throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector nUniv = new ASTVector(Context(), Native.modelGetSortUniverse(
|
||||
Context().nCtx(), NativeObject(), s.NativeObject()));
|
||||
int n = nUniv.Size();
|
||||
ASTVector nUniv = new ASTVector(getContext(), Native.modelGetSortUniverse(
|
||||
getContext().nCtx(), getNativeObject(), s.getNativeObject()));
|
||||
int n = nUniv.size();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(), nUniv.get(i).NativeObject());
|
||||
res[i] = Expr.create(getContext(), nUniv.get(i).getNativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ public class Model extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.modelToString(Context().nCtx(), NativeObject());
|
||||
return Native.modelToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -288,15 +288,15 @@ public class Model extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Model_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().model_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Model_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().model_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class ModelDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class ModelDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_param_kind;
|
||||
|
||||
/**
|
||||
* A ParamDescrs describes a set of parameters.
|
||||
|
@ -16,21 +16,21 @@ public class ParamDescrs extends Z3Object
|
|||
/**
|
||||
* validate a set of parameters.
|
||||
**/
|
||||
public void Validate(Params p) throws Z3Exception
|
||||
public void validate(Params p) throws Z3Exception
|
||||
{
|
||||
|
||||
Native.paramsValidate(Context().nCtx(), p.NativeObject(),
|
||||
NativeObject());
|
||||
Native.paramsValidate(getContext().nCtx(), p.getNativeObject(),
|
||||
getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve kind of parameter.
|
||||
**/
|
||||
public Z3_param_kind GetKind(Symbol name) throws Z3Exception
|
||||
public Z3_param_kind getKind(Symbol name) throws Z3Exception
|
||||
{
|
||||
|
||||
return Z3_param_kind.fromInt(Native.paramDescrsGetKind(
|
||||
Context().nCtx(), NativeObject(), name.NativeObject()));
|
||||
getContext().nCtx(), getNativeObject(), name.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,14 +38,14 @@ public class ParamDescrs extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Symbol[] Names() throws Z3Exception
|
||||
public Symbol[] getNames() throws Z3Exception
|
||||
{
|
||||
int sz = Native.paramDescrsSize(Context().nCtx(), NativeObject());
|
||||
int sz = Native.paramDescrsSize(getContext().nCtx(), getNativeObject());
|
||||
Symbol[] names = new Symbol[sz];
|
||||
for (int i = 0; i < sz; ++i)
|
||||
{
|
||||
names[i] = Symbol.Create(Context(), Native.paramDescrsGetName(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
names[i] = Symbol.create(getContext(), Native.paramDescrsGetName(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ public class ParamDescrs extends Z3Object
|
|||
/**
|
||||
* The size of the ParamDescrs.
|
||||
**/
|
||||
public int Size() throws Z3Exception
|
||||
public int size() throws Z3Exception
|
||||
{
|
||||
return Native.paramDescrsSize(Context().nCtx(), NativeObject());
|
||||
return Native.paramDescrsSize(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ public class ParamDescrs extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.paramDescrsToString(Context().nCtx(), NativeObject());
|
||||
return Native.paramDescrsToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -77,15 +77,15 @@ public class ParamDescrs extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ParamDescrs_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().paramDescrs_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ParamDescrs_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().paramDescrs_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class ParamDescrsDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class ParamDescrsDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -14,65 +14,65 @@ public class Params extends Z3Object
|
|||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(Symbol name, boolean value) throws Z3Exception
|
||||
public void add(Symbol name, boolean value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetBool(Context().nCtx(), NativeObject(),
|
||||
name.NativeObject(), (value) ? true : false);
|
||||
Native.paramsSetBool(getContext().nCtx(), getNativeObject(),
|
||||
name.getNativeObject(), (value) ? true : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(Symbol name, double value) throws Z3Exception
|
||||
public void add(Symbol name, double value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetDouble(Context().nCtx(), NativeObject(),
|
||||
name.NativeObject(), value);
|
||||
Native.paramsSetDouble(getContext().nCtx(), getNativeObject(),
|
||||
name.getNativeObject(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(Symbol name, Symbol value) throws Z3Exception
|
||||
public void add(Symbol name, Symbol value) throws Z3Exception
|
||||
{
|
||||
|
||||
Native.paramsSetSymbol(Context().nCtx(), NativeObject(),
|
||||
name.NativeObject(), value.NativeObject());
|
||||
Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(),
|
||||
name.getNativeObject(), value.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, boolean value) throws Z3Exception
|
||||
public void add(String name, boolean value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetBool(Context().nCtx(), NativeObject(),
|
||||
Context().MkSymbol(name).NativeObject(), value);
|
||||
Native.paramsSetBool(getContext().nCtx(), getNativeObject(),
|
||||
getContext().mkSymbol(name).getNativeObject(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, int value) throws Z3Exception
|
||||
public void add(String name, int value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetUint(Context().nCtx(), NativeObject(), Context()
|
||||
.MkSymbol(name).NativeObject(), value);
|
||||
Native.paramsSetUint(getContext().nCtx(), getNativeObject(), getContext()
|
||||
.mkSymbol(name).getNativeObject(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, double value) throws Z3Exception
|
||||
public void add(String name, double value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetDouble(Context().nCtx(), NativeObject(), Context()
|
||||
.MkSymbol(name).NativeObject(), value);
|
||||
Native.paramsSetDouble(getContext().nCtx(), getNativeObject(), getContext()
|
||||
.mkSymbol(name).getNativeObject(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, Symbol value) throws Z3Exception
|
||||
public void add(String name, Symbol value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetSymbol(Context().nCtx(), NativeObject(), Context()
|
||||
.MkSymbol(name).NativeObject(), value.NativeObject());
|
||||
Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(), getContext()
|
||||
.mkSymbol(name).getNativeObject(), value.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,7 +82,7 @@ public class Params extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.paramsToString(Context().nCtx(), NativeObject());
|
||||
return Native.paramsToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -94,15 +94,15 @@ public class Params extends Z3Object
|
|||
super(ctx, Native.mkParams(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Params_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().params_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Params_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().params_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class ParamsDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class ParamsDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -15,9 +15,9 @@ public class Pattern extends AST
|
|||
/**
|
||||
* The number of terms in the pattern.
|
||||
**/
|
||||
public int NumTerms() throws Z3Exception
|
||||
public int getNumTerms() throws Z3Exception
|
||||
{
|
||||
return Native.getPatternNumTerms(Context().nCtx(), NativeObject());
|
||||
return Native.getPatternNumTerms(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,14 +25,14 @@ public class Pattern extends AST
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] Terms() throws Z3Exception
|
||||
public Expr[] getTerms() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumTerms();
|
||||
int n = getNumTerms();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(),
|
||||
Native.getPattern(Context().nCtx(), NativeObject(), i));
|
||||
res[i] = Expr.create(getContext(),
|
||||
Native.getPattern(getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class Pattern extends AST
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.patternToString(Context().nCtx(), NativeObject());
|
||||
return Native.patternToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
|
|
@ -23,20 +23,11 @@ public class Probe extends Z3Object
|
|||
* 0.0 for false, and a value different from 0.0 for true.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public double Apply(Goal g) throws Z3Exception
|
||||
public double apply(Goal g) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(g);
|
||||
return Native.probeApply(Context().nCtx(), NativeObject(),
|
||||
g.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the probe to a goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public double get(Goal g) throws Z3Exception
|
||||
{
|
||||
return Apply(g);
|
||||
getContext().checkContextMatch(g);
|
||||
return Native.probeApply(getContext().nCtx(), getNativeObject(),
|
||||
g.getNativeObject());
|
||||
}
|
||||
|
||||
Probe(Context ctx, long obj) throws Z3Exception
|
||||
|
@ -49,15 +40,15 @@ public class Probe extends Z3Object
|
|||
super(ctx, Native.mkProbe(ctx.nCtx(), name));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Probe_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().probe_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Probe_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().probe_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class ProbeDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class ProbeDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_ast_kind;
|
||||
|
||||
/**
|
||||
* Quantifier expressions.
|
||||
|
@ -16,34 +16,34 @@ public class Quantifier extends BoolExpr
|
|||
/**
|
||||
* Indicates whether the quantifier is universal.
|
||||
**/
|
||||
public boolean IsUniversal() throws Z3Exception
|
||||
public boolean isUniversal() throws Z3Exception
|
||||
{
|
||||
return Native.isQuantifierForall(Context().nCtx(), NativeObject());
|
||||
return Native.isQuantifierForall(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the quantifier is existential.
|
||||
**/
|
||||
public boolean IsExistential() throws Z3Exception
|
||||
public boolean isExistential() throws Z3Exception
|
||||
{
|
||||
return !IsUniversal();
|
||||
return !isUniversal();
|
||||
}
|
||||
|
||||
/**
|
||||
* The weight of the quantifier.
|
||||
**/
|
||||
public int Weight() throws Z3Exception
|
||||
public int getWeight() throws Z3Exception
|
||||
{
|
||||
return Native.getQuantifierWeight(Context().nCtx(), NativeObject());
|
||||
return Native.getQuantifierWeight(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of patterns.
|
||||
**/
|
||||
public int NumPatterns() throws Z3Exception
|
||||
public int getNumPatterns() throws Z3Exception
|
||||
{
|
||||
return Native
|
||||
.getQuantifierNumPatterns(Context().nCtx(), NativeObject());
|
||||
.getQuantifierNumPatterns(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,23 +51,23 @@ public class Quantifier extends BoolExpr
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Pattern[] Patterns() throws Z3Exception
|
||||
public Pattern[] getPatterns() throws Z3Exception
|
||||
{
|
||||
int n = NumPatterns();
|
||||
int n = getNumPatterns();
|
||||
Pattern[] res = new Pattern[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Pattern(Context(), Native.getQuantifierPatternAst(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = new Pattern(getContext(), Native.getQuantifierPatternAst(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of no-patterns.
|
||||
**/
|
||||
public int NumNoPatterns() throws Z3Exception
|
||||
public int getNumNoPatterns() throws Z3Exception
|
||||
{
|
||||
return Native.getQuantifierNumNoPatterns(Context().nCtx(),
|
||||
NativeObject());
|
||||
return Native.getQuantifierNumNoPatterns(getContext().nCtx(),
|
||||
getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,22 +75,22 @@ public class Quantifier extends BoolExpr
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Pattern[] NoPatterns() throws Z3Exception
|
||||
public Pattern[] getNoPatterns() throws Z3Exception
|
||||
{
|
||||
int n = NumNoPatterns();
|
||||
int n = getNumNoPatterns();
|
||||
Pattern[] res = new Pattern[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Pattern(Context(), Native.getQuantifierNoPatternAst(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = new Pattern(getContext(), Native.getQuantifierNoPatternAst(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of bound variables.
|
||||
**/
|
||||
public int NumBound() throws Z3Exception
|
||||
public int getNumBound() throws Z3Exception
|
||||
{
|
||||
return Native.getQuantifierNumBound(Context().nCtx(), NativeObject());
|
||||
return Native.getQuantifierNumBound(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,13 +98,13 @@ public class Quantifier extends BoolExpr
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Symbol[] BoundVariableNames() throws Z3Exception
|
||||
public Symbol[] getBoundVariableNames() throws Z3Exception
|
||||
{
|
||||
int n = NumBound();
|
||||
int n = getNumBound();
|
||||
Symbol[] res = new Symbol[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Symbol.Create(Context(), Native.getQuantifierBoundName(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = Symbol.create(getContext(), Native.getQuantifierBoundName(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -113,13 +113,13 @@ public class Quantifier extends BoolExpr
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort[] BoundVariableSorts() throws Z3Exception
|
||||
public Sort[] getBoundVariableSorts() throws Z3Exception
|
||||
{
|
||||
int n = NumBound();
|
||||
int n = getNumBound();
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(), Native.getQuantifierBoundSort(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = Sort.create(getContext(), Native.getQuantifierBoundSort(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -128,10 +128,10 @@ public class Quantifier extends BoolExpr
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr Body() throws Z3Exception
|
||||
public BoolExpr getBody() throws Z3Exception
|
||||
{
|
||||
return new BoolExpr(Context(), Native.getQuantifierBody(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
return new BoolExpr(getContext(), Native.getQuantifierBody(getContext()
|
||||
.nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
Quantifier(Context ctx, boolean isForall, Sort[] sorts, Symbol[] names,
|
||||
|
@ -140,11 +140,11 @@ public class Quantifier extends BoolExpr
|
|||
{
|
||||
super(ctx);
|
||||
|
||||
Context().CheckContextMatch(patterns);
|
||||
Context().CheckContextMatch(noPatterns);
|
||||
Context().CheckContextMatch(sorts);
|
||||
Context().CheckContextMatch(names);
|
||||
Context().CheckContextMatch(body);
|
||||
getContext().checkContextMatch(patterns);
|
||||
getContext().checkContextMatch(noPatterns);
|
||||
getContext().checkContextMatch(sorts);
|
||||
getContext().checkContextMatch(names);
|
||||
getContext().checkContextMatch(body);
|
||||
|
||||
if (sorts.length != names.length)
|
||||
throw new Z3Exception(
|
||||
|
@ -153,20 +153,20 @@ public class Quantifier extends BoolExpr
|
|||
if (noPatterns == null && quantifierID == null && skolemID == null)
|
||||
{
|
||||
setNativeObject(Native.mkQuantifier(ctx.nCtx(), (isForall) ? true
|
||||
: false, weight, AST.ArrayLength(patterns), AST
|
||||
.ArrayToNative(patterns), AST.ArrayLength(sorts), AST
|
||||
.ArrayToNative(sorts), Symbol.ArrayToNative(names), body
|
||||
.NativeObject()));
|
||||
: false, weight, AST.arrayLength(patterns), AST
|
||||
.arrayToNative(patterns), AST.arrayLength(sorts), AST
|
||||
.arrayToNative(sorts), Symbol.arrayToNative(names), body
|
||||
.getNativeObject()));
|
||||
} else
|
||||
{
|
||||
setNativeObject(Native.mkQuantifierEx(ctx.nCtx(),
|
||||
(isForall) ? true : false, weight, AST.GetNativeObject(quantifierID),
|
||||
AST.GetNativeObject(skolemID),
|
||||
AST.ArrayLength(patterns), AST.ArrayToNative(patterns),
|
||||
AST.ArrayLength(noPatterns), AST.ArrayToNative(noPatterns),
|
||||
AST.ArrayLength(sorts), AST.ArrayToNative(sorts),
|
||||
Symbol.ArrayToNative(names),
|
||||
body.NativeObject()));
|
||||
(isForall) ? true : false, weight, AST.getNativeObject(quantifierID),
|
||||
AST.getNativeObject(skolemID),
|
||||
AST.arrayLength(patterns), AST.arrayToNative(patterns),
|
||||
AST.arrayLength(noPatterns), AST.arrayToNative(noPatterns),
|
||||
AST.arrayLength(sorts), AST.arrayToNative(sorts),
|
||||
Symbol.arrayToNative(names),
|
||||
body.getNativeObject()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,26 +176,26 @@ public class Quantifier extends BoolExpr
|
|||
{
|
||||
super(ctx);
|
||||
|
||||
Context().CheckContextMatch(noPatterns);
|
||||
Context().CheckContextMatch(patterns);
|
||||
getContext().checkContextMatch(noPatterns);
|
||||
getContext().checkContextMatch(patterns);
|
||||
// Context().CheckContextMatch(bound);
|
||||
Context().CheckContextMatch(body);
|
||||
getContext().checkContextMatch(body);
|
||||
|
||||
if (noPatterns == null && quantifierID == null && skolemID == null)
|
||||
{
|
||||
setNativeObject(Native.mkQuantifierConst(ctx.nCtx(),
|
||||
(isForall) ? true : false, weight, AST.ArrayLength(bound),
|
||||
AST.ArrayToNative(bound), AST.ArrayLength(patterns),
|
||||
AST.ArrayToNative(patterns), body.NativeObject()));
|
||||
(isForall) ? true : false, weight, AST.arrayLength(bound),
|
||||
AST.arrayToNative(bound), AST.arrayLength(patterns),
|
||||
AST.arrayToNative(patterns), body.getNativeObject()));
|
||||
} else
|
||||
{
|
||||
setNativeObject(Native.mkQuantifierConstEx(ctx.nCtx(),
|
||||
(isForall) ? true : false, weight,
|
||||
AST.GetNativeObject(quantifierID),
|
||||
AST.GetNativeObject(skolemID), AST.ArrayLength(bound),
|
||||
AST.ArrayToNative(bound), AST.ArrayLength(patterns),
|
||||
AST.ArrayToNative(patterns), AST.ArrayLength(noPatterns),
|
||||
AST.ArrayToNative(noPatterns), body.NativeObject()));
|
||||
AST.getNativeObject(quantifierID),
|
||||
AST.getNativeObject(skolemID), AST.arrayLength(bound),
|
||||
AST.arrayToNative(bound), AST.arrayLength(patterns),
|
||||
AST.arrayToNative(patterns), AST.arrayLength(noPatterns),
|
||||
AST.arrayToNative(noPatterns), body.getNativeObject()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,11 +204,11 @@ public class Quantifier extends BoolExpr
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
void checkNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST
|
||||
if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST
|
||||
.toInt())
|
||||
throw new Z3Exception("Underlying object is not a quantifier");
|
||||
super.CheckNativeObject(obj);
|
||||
super.checkNativeObject(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,36 +16,36 @@ public class RatNum extends RealExpr
|
|||
/**
|
||||
* The numerator of a rational numeral.
|
||||
**/
|
||||
public IntNum Numerator() throws Z3Exception
|
||||
public IntNum getNumerator() throws Z3Exception
|
||||
{
|
||||
return new IntNum(Context(), Native.getNumerator(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return new IntNum(getContext(), Native.getNumerator(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The denominator of a rational numeral.
|
||||
**/
|
||||
public IntNum Denominator() throws Z3Exception
|
||||
public IntNum getDenominator() throws Z3Exception
|
||||
{
|
||||
return new IntNum(Context(), Native.getDenominator(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return new IntNum(getContext(), Native.getDenominator(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the numerator of the rational to a BigInteger
|
||||
**/
|
||||
public BigInteger BigIntNumerator() throws Z3Exception
|
||||
public BigInteger getBigIntNumerator() throws Z3Exception
|
||||
{
|
||||
IntNum n = Numerator();
|
||||
IntNum n = getNumerator();
|
||||
return new BigInteger(n.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the denominator of the rational to a BigInteger
|
||||
**/
|
||||
public BigInteger BigIntDenominator() throws Z3Exception
|
||||
public BigInteger getBigIntDenominator() throws Z3Exception
|
||||
{
|
||||
IntNum n = Denominator();
|
||||
IntNum n = getDenominator();
|
||||
return new BigInteger(n.toString());
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,9 @@ public class RatNum extends RealExpr
|
|||
* Returns a string representation in decimal notation. <remarks>The result
|
||||
* has at most <paramref name="precision"/> decimal places.</remarks>
|
||||
**/
|
||||
public String ToDecimalString(int precision) throws Z3Exception
|
||||
public String toDecimalString(int precision) throws Z3Exception
|
||||
{
|
||||
return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(),
|
||||
return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
|
||||
precision);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class RatNum extends RealExpr
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.getNumeralString(Context().nCtx(), NativeObject());
|
||||
return Native.getNumeralString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
|
|
@ -14,26 +14,26 @@ public class RelationSort extends Sort
|
|||
/**
|
||||
* The arity of the relation sort.
|
||||
**/
|
||||
public int Arity() throws Z3Exception
|
||||
public int getArity() throws Z3Exception
|
||||
{
|
||||
return Native.getRelationArity(Context().nCtx(), NativeObject());
|
||||
return Native.getRelationArity(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The sorts of the columns of the relation sort.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort[] ColumnSorts() throws Z3Exception
|
||||
public Sort[] getColumnSorts() throws Z3Exception
|
||||
{
|
||||
|
||||
if (m_columnSorts != null)
|
||||
return m_columnSorts;
|
||||
|
||||
int n = Arity();
|
||||
int n = getArity();
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(), Native.getRelationColumn(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
res[i] = Sort.create(getContext(), Native.getRelationColumn(getContext()
|
||||
.nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,6 @@ public class SetSort extends Sort
|
|||
|
||||
SetSort(Context ctx, Sort ty) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkSetSort(ctx.nCtx(), ty.NativeObject()));
|
||||
super(ctx, Native.mkSetSort(ctx.nCtx(), ty.getNativeObject()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_lbool;
|
||||
|
||||
/**
|
||||
* Solvers.
|
||||
|
@ -16,9 +16,9 @@ public class Solver extends Z3Object
|
|||
/**
|
||||
* A string that describes all available solver parameters.
|
||||
**/
|
||||
public String Help() throws Z3Exception
|
||||
public String getHelp() throws Z3Exception
|
||||
{
|
||||
return Native.solverGetHelp(Context().nCtx(), NativeObject());
|
||||
return Native.solverGetHelp(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,9 +28,9 @@ public class Solver extends Z3Object
|
|||
**/
|
||||
public void setParameters(Params value) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(value);
|
||||
Native.solverSetParams(Context().nCtx(), NativeObject(),
|
||||
value.NativeObject());
|
||||
getContext().checkContextMatch(value);
|
||||
Native.solverSetParams(getContext().nCtx(), getNativeObject(),
|
||||
value.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,35 +38,36 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ParamDescrs ParameterDescriptions() throws Z3Exception
|
||||
public ParamDescrs getParameterDescriptions() throws Z3Exception
|
||||
{
|
||||
return new ParamDescrs(Context(), Native.solverGetParamDescrs(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
return new ParamDescrs(getContext(), Native.solverGetParamDescrs(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The current number of backtracking points (scopes). <seealso cref="Pop"/>
|
||||
* <seealso cref="Push"/>
|
||||
**/
|
||||
public int NumScopes() throws Z3Exception
|
||||
public int getNumScopes() throws Z3Exception
|
||||
{
|
||||
return Native.solverGetNumScopes(Context().nCtx(), NativeObject());
|
||||
return Native
|
||||
.solverGetNumScopes(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a backtracking point. <seealso cref="Pop"/>
|
||||
**/
|
||||
public void Push() throws Z3Exception
|
||||
public void push() throws Z3Exception
|
||||
{
|
||||
Native.solverPush(Context().nCtx(), NativeObject());
|
||||
Native.solverPush(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Backtracks one backtracking point. <remarks>.
|
||||
**/
|
||||
public void Pop() throws Z3Exception
|
||||
public void pop() throws Z3Exception
|
||||
{
|
||||
Pop(1);
|
||||
pop(1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,18 +75,18 @@ public class Solver extends Z3Object
|
|||
* an exception is thrown if <paramref name="n"/> is not smaller than
|
||||
* <code>NumScopes</code></remarks> <seealso cref="Push"/>
|
||||
**/
|
||||
public void Pop(int n) throws Z3Exception
|
||||
public void pop(int n) throws Z3Exception
|
||||
{
|
||||
Native.solverPop(Context().nCtx(), NativeObject(), n);
|
||||
Native.solverPop(getContext().nCtx(), getNativeObject(), n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the Solver. <remarks>This removes all assertions from the
|
||||
* solver.</remarks>
|
||||
**/
|
||||
public void Reset() throws Z3Exception
|
||||
public void reset() throws Z3Exception
|
||||
{
|
||||
Native.solverReset(Context().nCtx(), NativeObject());
|
||||
Native.solverReset(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,26 +94,62 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr[] constraints) throws Z3Exception
|
||||
public void assert_(BoolExpr... constraints) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(constraints);
|
||||
getContext().checkContextMatch(constraints);
|
||||
for (BoolExpr a : constraints)
|
||||
{
|
||||
Native.solverAssert(Context().nCtx(), NativeObject(),
|
||||
a.NativeObject());
|
||||
Native.solverAssert(getContext().nCtx(), getNativeObject(),
|
||||
a.getNativeObject());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert one constraint into the solver.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr constraint) throws Z3Exception
|
||||
// / <summary>
|
||||
// / Assert multiple constraints into the solver, and track them (in the
|
||||
// unsat) core
|
||||
// / using the Boolean constants in ps.
|
||||
// / </summary>
|
||||
// / <remarks>
|
||||
// / This API is an alternative to <see cref="Check"/> with assumptions for
|
||||
// extracting unsat cores.
|
||||
// / Both APIs can be used in the same solver. The unsat core will contain a
|
||||
// combination
|
||||
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
|
||||
// and the Boolean literals
|
||||
// / provided using <see cref="Check"/> with assumptions.
|
||||
// / </remarks>
|
||||
public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(constraint);
|
||||
Native.solverAssert(Context().nCtx(), NativeObject(),
|
||||
constraint.NativeObject());
|
||||
getContext().checkContextMatch(constraints);
|
||||
getContext().checkContextMatch(ps);
|
||||
if (constraints.length != ps.length)
|
||||
throw new Z3Exception("Argument size mismatch");
|
||||
|
||||
for (int i = 0; i < constraints.length; i++)
|
||||
Native.solverAssertAndTrack(getContext().nCtx(), getNativeObject(),
|
||||
constraints[i].getNativeObject(), ps[i].getNativeObject());
|
||||
}
|
||||
|
||||
// / <summary>
|
||||
// / Assert a constraint into the solver, and track it (in the unsat) core
|
||||
// / using the Boolean constant p.
|
||||
// / </summary>
|
||||
// / <remarks>
|
||||
// / This API is an alternative to <see cref="Check"/> with assumptions for
|
||||
// extracting unsat cores.
|
||||
// / Both APIs can be used in the same solver. The unsat core will contain a
|
||||
// combination
|
||||
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
|
||||
// and the Boolean literals
|
||||
// / provided using <see cref="Check"/> with assumptions.
|
||||
// / </remarks>
|
||||
public void assertAndTrack(BoolExpr constraint, BoolExpr p) throws Z3Exception
|
||||
{
|
||||
getContext().checkContextMatch(constraint);
|
||||
getContext().checkContextMatch(p);
|
||||
|
||||
Native.solverAssertAndTrack(getContext().nCtx(), getNativeObject(),
|
||||
constraint.getNativeObject(), p.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,11 +157,11 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int NumAssertions() throws Z3Exception
|
||||
public int getNumAssertions() throws Z3Exception
|
||||
{
|
||||
ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions(
|
||||
Context().nCtx(), NativeObject()));
|
||||
return ass.Size();
|
||||
ASTVector ass = new ASTVector(getContext(), Native.solverGetAssertions(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
return ass.size();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,14 +169,14 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Assertions() throws Z3Exception
|
||||
public BoolExpr[] getAssertions() throws Z3Exception
|
||||
{
|
||||
ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = ass.Size();
|
||||
ASTVector ass = new ASTVector(getContext(), Native.solverGetAssertions(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
int n = ass.size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), ass.get(i).NativeObject());
|
||||
res[i] = new BoolExpr(getContext(), ass.get(i).getNativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -148,16 +185,16 @@ public class Solver extends Z3Object
|
|||
* <remarks> <seealso cref="Model"/> <seealso cref="UnsatCore"/> <seealso
|
||||
* cref="Proof"/> </remarks>
|
||||
**/
|
||||
public Status Check(Expr[] assumptions) throws Z3Exception
|
||||
public Status check(Expr... assumptions) throws Z3Exception
|
||||
{
|
||||
Z3_lbool r;
|
||||
if (assumptions == null)
|
||||
r = Z3_lbool.fromInt(Native.solverCheck(Context().nCtx(),
|
||||
NativeObject()));
|
||||
r = Z3_lbool.fromInt(Native.solverCheck(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
else
|
||||
r = Z3_lbool.fromInt(Native.solverCheckAssumptions(
|
||||
Context().nCtx(), NativeObject(), (int) assumptions.length,
|
||||
AST.ArrayToNative(assumptions)));
|
||||
r = Z3_lbool.fromInt(Native.solverCheckAssumptions(getContext()
|
||||
.nCtx(), getNativeObject(), (int) assumptions.length, AST
|
||||
.arrayToNative(assumptions)));
|
||||
switch (r)
|
||||
{
|
||||
case Z3_L_TRUE:
|
||||
|
@ -174,9 +211,9 @@ public class Solver extends Z3Object
|
|||
* <remarks> <seealso cref="Model"/> <seealso cref="UnsatCore"/> <seealso
|
||||
* cref="Proof"/> </remarks>
|
||||
**/
|
||||
public Status Check() throws Z3Exception
|
||||
public Status check() throws Z3Exception
|
||||
{
|
||||
return Check(null);
|
||||
return check((Expr[]) null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,13 +224,13 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Model Model() throws Z3Exception
|
||||
public Model getModel() throws Z3Exception
|
||||
{
|
||||
long x = Native.solverGetModel(Context().nCtx(), NativeObject());
|
||||
long x = Native.solverGetModel(getContext().nCtx(), getNativeObject());
|
||||
if (x == 0)
|
||||
return null;
|
||||
else
|
||||
return new Model(Context(), x);
|
||||
return new Model(getContext(), x);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,13 +241,13 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Proof() throws Z3Exception
|
||||
public Expr getProof() throws Z3Exception
|
||||
{
|
||||
long x = Native.solverGetProof(Context().nCtx(), NativeObject());
|
||||
long x = Native.solverGetProof(getContext().nCtx(), getNativeObject());
|
||||
if (x == 0)
|
||||
return null;
|
||||
else
|
||||
return Expr.Create(Context(), x);
|
||||
return Expr.create(getContext(), x);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,15 +258,15 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] UnsatCore() throws Z3Exception
|
||||
public Expr[] getUnsatCore() throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector core = new ASTVector(Context(), Native.solverGetUnsatCore(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = core.Size();
|
||||
ASTVector core = new ASTVector(getContext(), Native.solverGetUnsatCore(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
int n = core.size();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(), core.get(i).NativeObject());
|
||||
res[i] = Expr.create(getContext(), core.get(i).getNativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -237,9 +274,10 @@ public class Solver extends Z3Object
|
|||
* A brief justification of why the last call to <code>Check</code> returned
|
||||
* <code>UNKNOWN</code>.
|
||||
**/
|
||||
public String ReasonUnknown() throws Z3Exception
|
||||
public String getReasonUnknown() throws Z3Exception
|
||||
{
|
||||
return Native.solverGetReasonUnknown(Context().nCtx(), NativeObject());
|
||||
return Native.solverGetReasonUnknown(getContext().nCtx(),
|
||||
getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,10 +285,10 @@ public class Solver extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Statistics Statistics() throws Z3Exception
|
||||
public Statistics getStatistics() throws Z3Exception
|
||||
{
|
||||
return new Statistics(Context(), Native.solverGetStatistics(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
return new Statistics(getContext(), Native.solverGetStatistics(
|
||||
getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -260,7 +298,8 @@ public class Solver extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.solverToString(Context().nCtx(), NativeObject());
|
||||
return Native
|
||||
.solverToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -272,15 +311,15 @@ public class Solver extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Solver_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().solver_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Solver_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().solver_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class SolverDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class SolverDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_ast_kind;
|
||||
import com.microsoft.z3.enumerations.Z3_sort_kind;
|
||||
|
||||
/**
|
||||
* The Sort class implements type information for ASTs.
|
||||
|
@ -47,7 +48,7 @@ public class Sort extends AST
|
|||
return false;
|
||||
}
|
||||
|
||||
return this.NativeObject() == casted.NativeObject();
|
||||
return this.getNativeObject() == casted.getNativeObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,35 +56,35 @@ public class Sort extends AST
|
|||
*
|
||||
* @return A hash code
|
||||
**/
|
||||
public int GetHashCode() throws Z3Exception
|
||||
public int hashCode()
|
||||
{
|
||||
return super.GetHashCode();
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unique identifier for the sort.
|
||||
**/
|
||||
public int Id() throws Z3Exception
|
||||
public int getId() throws Z3Exception
|
||||
{
|
||||
return Native.getSortId(Context().nCtx(), NativeObject());
|
||||
return Native.getSortId(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the sort.
|
||||
**/
|
||||
public Z3_sort_kind SortKind() throws Z3Exception
|
||||
public Z3_sort_kind getSortKind() throws Z3Exception
|
||||
{
|
||||
return Z3_sort_kind.fromInt(Native.getSortKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return Z3_sort_kind.fromInt(Native.getSortKind(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the sort
|
||||
**/
|
||||
public Symbol Name() throws Z3Exception
|
||||
public Symbol getName() throws Z3Exception
|
||||
{
|
||||
return Symbol.Create(Context(),
|
||||
Native.getSortName(Context().nCtx(), NativeObject()));
|
||||
return Symbol.create(getContext(),
|
||||
Native.getSortName(getContext().nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,7 +94,7 @@ public class Sort extends AST
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.sortToString(Context().nCtx(), NativeObject());
|
||||
return Native.sortToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -117,17 +118,18 @@ public class Sort extends AST
|
|||
}
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
void checkNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_SORT_AST
|
||||
if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_SORT_AST
|
||||
.toInt())
|
||||
throw new Z3Exception("Underlying object is not a sort");
|
||||
super.CheckNativeObject(obj);
|
||||
super.checkNativeObject(obj);
|
||||
}
|
||||
|
||||
static Sort Create(Context ctx, long obj) throws Z3Exception
|
||||
static Sort create(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
switch (Z3_sort_kind.fromInt(Native.getSortKind(ctx.nCtx(), obj)))
|
||||
Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(ctx.nCtx(), obj));
|
||||
switch (sk)
|
||||
{
|
||||
case Z3_ARRAY_SORT:
|
||||
return new ArraySort(ctx, obj);
|
||||
|
|
|
@ -25,7 +25,7 @@ public class Statistics extends Z3Object
|
|||
/**
|
||||
* The uint-value of the entry.
|
||||
**/
|
||||
public int UIntValue()
|
||||
public int getUIntValue()
|
||||
{
|
||||
return m_int;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class Statistics extends Z3Object
|
|||
/**
|
||||
* The double-value of the entry.
|
||||
**/
|
||||
public double DoubleValue()
|
||||
public double getDoubleValue()
|
||||
{
|
||||
return m_double;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class Statistics extends Z3Object
|
|||
/**
|
||||
* True if the entry is uint-valued.
|
||||
**/
|
||||
public boolean IsUInt()
|
||||
public boolean isUInt()
|
||||
{
|
||||
return m_is_int;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class Statistics extends Z3Object
|
|||
/**
|
||||
* True if the entry is double-valued.
|
||||
**/
|
||||
public boolean IsDouble()
|
||||
public boolean isDouble()
|
||||
{
|
||||
return m_is_double;
|
||||
}
|
||||
|
@ -59,11 +59,11 @@ public class Statistics extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public String Value() throws Z3Exception
|
||||
public String getValueString() throws Z3Exception
|
||||
{
|
||||
if (IsUInt())
|
||||
if (isUInt())
|
||||
return Integer.toString(m_int);
|
||||
else if (IsDouble())
|
||||
else if (isDouble())
|
||||
return Double.toString(m_double);
|
||||
else
|
||||
throw new Z3Exception("Unknown statistical entry type");
|
||||
|
@ -76,7 +76,7 @@ public class Statistics extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Key + ": " + Value();
|
||||
return Key + ": " + getValueString();
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return new String("Z3Exception: " + e.getMessage());
|
||||
|
@ -110,7 +110,7 @@ public class Statistics extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
return Native.statsToString(Context().nCtx(), NativeObject());
|
||||
return Native.statsToString(getContext().nCtx(), getNativeObject());
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return "Z3Exception: " + e.getMessage();
|
||||
|
@ -120,9 +120,9 @@ public class Statistics extends Z3Object
|
|||
/**
|
||||
* The number of statistical data.
|
||||
**/
|
||||
public int Size() throws Z3Exception
|
||||
public int size() throws Z3Exception
|
||||
{
|
||||
return Native.statsSize(Context().nCtx(), NativeObject());
|
||||
return Native.statsSize(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,21 +130,21 @@ public class Statistics extends Z3Object
|
|||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Entry[] Entries() throws Z3Exception
|
||||
public Entry[] getEntries() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = Size();
|
||||
int n = size();
|
||||
Entry[] res = new Entry[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
Entry e;
|
||||
String k = Native.statsGetKey(Context().nCtx(), NativeObject(), i);
|
||||
if (Native.statsIsUint(Context().nCtx(), NativeObject(), i))
|
||||
e = new Entry(k, Native.statsGetUintValue(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
else if (Native.statsIsDouble(Context().nCtx(), NativeObject(), i))
|
||||
e = new Entry(k, Native.statsGetDoubleValue(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
String k = Native.statsGetKey(getContext().nCtx(), getNativeObject(), i);
|
||||
if (Native.statsIsUint(getContext().nCtx(), getNativeObject(), i))
|
||||
e = new Entry(k, Native.statsGetUintValue(getContext().nCtx(),
|
||||
getNativeObject(), i));
|
||||
else if (Native.statsIsDouble(getContext().nCtx(), getNativeObject(), i))
|
||||
e = new Entry(k, Native.statsGetDoubleValue(getContext().nCtx(),
|
||||
getNativeObject(), i));
|
||||
else
|
||||
throw new Z3Exception("Unknown data entry value");
|
||||
res[i] = e;
|
||||
|
@ -155,12 +155,12 @@ public class Statistics extends Z3Object
|
|||
/**
|
||||
* The statistical counters.
|
||||
**/
|
||||
public String[] Keys() throws Z3Exception
|
||||
public String[] getKeys() throws Z3Exception
|
||||
{
|
||||
int n = Size();
|
||||
int n = size();
|
||||
String[] res = new String[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Native.statsGetKey(Context().nCtx(), NativeObject(), i);
|
||||
res[i] = Native.statsGetKey(getContext().nCtx(), getNativeObject(), i);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -172,8 +172,8 @@ public class Statistics extends Z3Object
|
|||
**/
|
||||
public Entry get(String key) throws Z3Exception
|
||||
{
|
||||
int n = Size();
|
||||
Entry[] es = Entries();
|
||||
int n = size();
|
||||
Entry[] es = getEntries();
|
||||
for (int i = 0; i < n; i++)
|
||||
if (es[i].Key == key)
|
||||
return es[i];
|
||||
|
@ -185,15 +185,15 @@ public class Statistics extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Statistics_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().statistics_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Statistics_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().statistics_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class StatisticsDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class StatisticsDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_symbol_kind;
|
||||
|
||||
/**
|
||||
* Named symbols
|
||||
|
@ -17,9 +17,9 @@ public class StringSymbol extends Symbol
|
|||
* The string value of the symbol. <remarks>Throws an exception if the
|
||||
* symbol is not of string kind.</remarks>
|
||||
**/
|
||||
public String String() throws Z3Exception
|
||||
public String getString() throws Z3Exception
|
||||
{
|
||||
return Native.getSymbolString(Context().nCtx(), NativeObject());
|
||||
return Native.getSymbolString(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
StringSymbol(Context ctx, long obj) throws Z3Exception
|
||||
|
@ -32,12 +32,12 @@ public class StringSymbol extends Symbol
|
|||
super(ctx, Native.mkStringSymbol(ctx.nCtx(), s));
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
void checkNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_STRING_SYMBOL
|
||||
if (Native.getSymbolKind(getContext().nCtx(), obj) != Z3_symbol_kind.Z3_STRING_SYMBOL
|
||||
.toInt())
|
||||
throw new Z3Exception("Symbol is not of String kind");
|
||||
|
||||
super.CheckNativeObject(obj);
|
||||
super.checkNativeObject(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import com.microsoft.z3.enumerations.*;
|
||||
import com.microsoft.z3.enumerations.Z3_symbol_kind;
|
||||
|
||||
/**
|
||||
* Symbols are used to name several term and type constructors.
|
||||
|
@ -16,26 +16,26 @@ public class Symbol extends Z3Object
|
|||
/**
|
||||
* The kind of the symbol (int or string)
|
||||
**/
|
||||
protected Z3_symbol_kind Kind() throws Z3Exception
|
||||
protected Z3_symbol_kind getKind() throws Z3Exception
|
||||
{
|
||||
return Z3_symbol_kind.fromInt(Native.getSymbolKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
return Z3_symbol_kind.fromInt(Native.getSymbolKind(getContext().nCtx(),
|
||||
getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the symbol is of Int kind
|
||||
**/
|
||||
public boolean IsIntSymbol() throws Z3Exception
|
||||
public boolean isIntSymbol() throws Z3Exception
|
||||
{
|
||||
return Kind() == Z3_symbol_kind.Z3_INT_SYMBOL;
|
||||
return getKind() == Z3_symbol_kind.Z3_INT_SYMBOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the symbol is of string kind.
|
||||
**/
|
||||
public boolean IsStringSymbol() throws Z3Exception
|
||||
public boolean isStringSymbol() throws Z3Exception
|
||||
{
|
||||
return Kind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
|
||||
return getKind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,10 +45,10 @@ public class Symbol extends Z3Object
|
|||
{
|
||||
try
|
||||
{
|
||||
if (IsIntSymbol())
|
||||
return Integer.toString(((IntSymbol) this).Int());
|
||||
else if (IsStringSymbol())
|
||||
return ((StringSymbol) this).String();
|
||||
if (isIntSymbol())
|
||||
return Integer.toString(((IntSymbol) this).getInt());
|
||||
else if (isStringSymbol())
|
||||
return ((StringSymbol) this).getString();
|
||||
else
|
||||
return new String(
|
||||
"Z3Exception: Unknown symbol kind encountered.");
|
||||
|
@ -66,7 +66,7 @@ public class Symbol extends Z3Object
|
|||
super(ctx, obj);
|
||||
}
|
||||
|
||||
static Symbol Create(Context ctx, long obj) throws Z3Exception
|
||||
static Symbol create(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
switch (Z3_symbol_kind.fromInt(Native.getSymbolKind(ctx.nCtx(), obj)))
|
||||
{
|
||||
|
|
|
@ -18,69 +18,57 @@ public class Tactic extends Z3Object
|
|||
/**
|
||||
* A string containing a description of parameters accepted by the tactic.
|
||||
**/
|
||||
public String Help() throws Z3Exception
|
||||
public String getHelp() throws Z3Exception
|
||||
{
|
||||
return Native.tacticGetHelp(Context().nCtx(), NativeObject());
|
||||
return Native.tacticGetHelp(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves parameter descriptions for Tactics.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ParamDescrs ParameterDescriptions() throws Z3Exception
|
||||
public ParamDescrs getParameterDescriptions() throws Z3Exception
|
||||
{
|
||||
return new ParamDescrs(Context(), Native.tacticGetParamDescrs(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
return new ParamDescrs(getContext(), Native.tacticGetParamDescrs(getContext()
|
||||
.nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the tactic over the goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ApplyResult Apply(Goal g) throws Z3Exception
|
||||
public ApplyResult apply(Goal g) throws Z3Exception
|
||||
{
|
||||
return Apply(g, null);
|
||||
return apply(g, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the tactic over the goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ApplyResult Apply(Goal g, Params p) throws Z3Exception
|
||||
public ApplyResult apply(Goal g, Params p) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(g);
|
||||
getContext().checkContextMatch(g);
|
||||
if (p == null)
|
||||
return new ApplyResult(Context(), Native.tacticApply(Context()
|
||||
.nCtx(), NativeObject(), g.NativeObject()));
|
||||
return new ApplyResult(getContext(), Native.tacticApply(getContext()
|
||||
.nCtx(), getNativeObject(), g.getNativeObject()));
|
||||
else
|
||||
{
|
||||
Context().CheckContextMatch(p);
|
||||
return new ApplyResult(Context(),
|
||||
Native.tacticApplyEx(Context().nCtx(), NativeObject(),
|
||||
g.NativeObject(), p.NativeObject()));
|
||||
getContext().checkContextMatch(p);
|
||||
return new ApplyResult(getContext(),
|
||||
Native.tacticApplyEx(getContext().nCtx(), getNativeObject(),
|
||||
g.getNativeObject(), p.getNativeObject()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the tactic to a goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ApplyResult get(Goal g) throws Z3Exception
|
||||
{
|
||||
|
||||
return Apply(g, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a solver that is implemented using the given tactic. <seealso
|
||||
* cref="Context.MkSolver(Tactic)"/>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Solver Solver() throws Z3Exception
|
||||
public Solver getSolver() throws Z3Exception
|
||||
{
|
||||
|
||||
return Context().MkSolver(this);
|
||||
return getContext().mkSolver(this);
|
||||
}
|
||||
|
||||
Tactic(Context ctx, long obj) throws Z3Exception
|
||||
|
@ -93,15 +81,15 @@ public class Tactic extends Z3Object
|
|||
super(ctx, Native.mkTactic(ctx.nCtx(), name));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Tactic_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
getContext().tactic_DRQ().incAndClear(getContext(), o);
|
||||
super.incRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Tactic_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
getContext().tactic_DRQ().add(o);
|
||||
super.decRef(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.microsoft.z3;
|
|||
|
||||
class TacticDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
protected void incRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class TacticDecRefQueue extends IDecRefQueue
|
|||
}
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
protected void decRef(Context ctx, long obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -15,33 +15,33 @@ public class TupleSort extends Sort
|
|||
* The constructor function of the tuple.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl MkDecl() throws Z3Exception
|
||||
public FuncDecl mkDecl() throws Z3Exception
|
||||
{
|
||||
|
||||
return new FuncDecl(Context(), Native.getTupleSortMkDecl(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
return new FuncDecl(getContext(), Native.getTupleSortMkDecl(getContext()
|
||||
.nCtx(), getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of fields in the tuple.
|
||||
**/
|
||||
public int NumFields() throws Z3Exception
|
||||
public int getNumFields() throws Z3Exception
|
||||
{
|
||||
return Native.getTupleSortNumFields(Context().nCtx(), NativeObject());
|
||||
return Native.getTupleSortNumFields(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The field declarations.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] FieldDecls() throws Z3Exception
|
||||
public FuncDecl[] getFieldDecls() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumFields();
|
||||
int n = getNumFields();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.getTupleSortFieldDecl(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
res[i] = new FuncDecl(getContext(), Native.getTupleSortFieldDecl(
|
||||
getContext().nCtx(), getNativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ public class TupleSort extends Sort
|
|||
super(ctx);
|
||||
|
||||
Native.LongPtr t = new Native.LongPtr();
|
||||
setNativeObject(Native.mkTupleSort(ctx.nCtx(), name.NativeObject(),
|
||||
numFields, Symbol.ArrayToNative(fieldNames),
|
||||
AST.ArrayToNative(fieldSorts), t, new long[numFields]));
|
||||
setNativeObject(Native.mkTupleSort(ctx.nCtx(), name.getNativeObject(),
|
||||
numFields, Symbol.arrayToNative(fieldNames),
|
||||
AST.arrayToNative(fieldSorts), t, new long[numFields]));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,6 +18,6 @@ public class UninterpretedSort extends Sort
|
|||
|
||||
UninterpretedSort(Context ctx, Symbol s) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkUninterpretedSort(ctx.nCtx(), s.NativeObject()));
|
||||
super(ctx, Native.mkUninterpretedSort(ctx.nCtx(), s.getNativeObject()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class Version
|
|||
/**
|
||||
* The major version
|
||||
**/
|
||||
public static int Major()
|
||||
public static int getMajor()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
|
@ -24,7 +24,7 @@ public class Version
|
|||
/**
|
||||
* The minor version
|
||||
**/
|
||||
public static int Minor()
|
||||
public static int getMinor()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
|
@ -34,7 +34,7 @@ public class Version
|
|||
/**
|
||||
* The build version
|
||||
**/
|
||||
public static int Build()
|
||||
public static int getBuild()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
|
@ -44,7 +44,7 @@ public class Version
|
|||
/**
|
||||
* The revision
|
||||
**/
|
||||
public static int Revision()
|
||||
public static int getRevision()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
package com.microsoft.z3;
|
||||
|
||||
import java.lang.Exception;
|
||||
|
||||
/**
|
||||
* The exception base class for error reporting from Z3
|
||||
|
|
|
@ -17,17 +17,17 @@ public class Z3Object extends IDisposable
|
|||
**/
|
||||
protected void finalize() throws Z3Exception
|
||||
{
|
||||
Dispose();
|
||||
dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes of the underlying native Z3 object.
|
||||
**/
|
||||
public void Dispose() throws Z3Exception
|
||||
public void dispose() throws Z3Exception
|
||||
{
|
||||
if (m_n_obj != 0)
|
||||
{
|
||||
DecRef(m_n_obj);
|
||||
decRef(m_n_obj);
|
||||
m_n_obj = 0;
|
||||
}
|
||||
|
||||
|
@ -51,23 +51,23 @@ public class Z3Object extends IDisposable
|
|||
{
|
||||
ctx.m_refCount++;
|
||||
m_ctx = ctx;
|
||||
IncRef(obj);
|
||||
incRef(obj);
|
||||
m_n_obj = obj;
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
void incRef(long o) throws Z3Exception
|
||||
{
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
void decRef(long o) throws Z3Exception
|
||||
{
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
void checkNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
}
|
||||
|
||||
long NativeObject()
|
||||
long getNativeObject()
|
||||
{
|
||||
return m_n_obj;
|
||||
}
|
||||
|
@ -76,39 +76,39 @@ public class Z3Object extends IDisposable
|
|||
{
|
||||
if (value != 0)
|
||||
{
|
||||
CheckNativeObject(value);
|
||||
IncRef(value);
|
||||
checkNativeObject(value);
|
||||
incRef(value);
|
||||
}
|
||||
if (m_n_obj != 0)
|
||||
{
|
||||
DecRef(m_n_obj);
|
||||
decRef(m_n_obj);
|
||||
}
|
||||
m_n_obj = value;
|
||||
}
|
||||
|
||||
static long GetNativeObject(Z3Object s)
|
||||
static long getNativeObject(Z3Object s)
|
||||
{
|
||||
if (s == null)
|
||||
return 0;
|
||||
return s.NativeObject();
|
||||
return s.getNativeObject();
|
||||
}
|
||||
|
||||
Context Context()
|
||||
Context getContext()
|
||||
{
|
||||
return m_ctx;
|
||||
}
|
||||
|
||||
static long[] ArrayToNative(Z3Object[] a)
|
||||
static long[] arrayToNative(Z3Object[] a)
|
||||
{
|
||||
if (a == null)
|
||||
return null;
|
||||
long[] an = new long[a.length];
|
||||
for (int i = 0; i < a.length; i++)
|
||||
an[i] = (a[i] == null) ? 0 : a[i].NativeObject();
|
||||
an[i] = (a[i] == null) ? 0 : a[i].getNativeObject();
|
||||
return an;
|
||||
}
|
||||
|
||||
static int ArrayLength(Z3Object[] a)
|
||||
static int arrayLength(Z3Object[] a)
|
||||
{
|
||||
return (a == null) ? 0 : a.length;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,10 @@ def E(ctx=None):
|
|||
return RCFNum(Z3_rcf_mk_e(ctx.ref()), ctx)
|
||||
|
||||
def MkInfinitesimal(name="eps", ctx=None):
|
||||
# Todo: remove parameter name.
|
||||
# For now, we keep it for backward compatibility.
|
||||
ctx = z3._get_ctx(ctx)
|
||||
return RCFNum(Z3_rcf_mk_infinitesimal(ctx.ref(), name), ctx)
|
||||
return RCFNum(Z3_rcf_mk_infinitesimal(ctx.ref()), ctx)
|
||||
|
||||
def MkRoots(p, ctx=None):
|
||||
ctx = z3._get_ctx(ctx)
|
||||
|
@ -65,7 +67,10 @@ class RCFNum:
|
|||
return self.ctx.ref()
|
||||
|
||||
def __repr__(self):
|
||||
return Z3_rcf_num_to_string(self.ctx_ref(), self.num)
|
||||
return Z3_rcf_num_to_string(self.ctx_ref(), self.num, False, in_html_mode())
|
||||
|
||||
def compact_str(self):
|
||||
return Z3_rcf_num_to_string(self.ctx_ref(), self.num, True, in_html_mode())
|
||||
|
||||
def __add__(self, other):
|
||||
v = _to_rcfnum(other, self.ctx)
|
||||
|
@ -151,3 +156,8 @@ class RCFNum:
|
|||
v = _to_rcfnum(other, self.ctx)
|
||||
return Z3_rcf_neq(self.ctx_ref(), self.num, v.num)
|
||||
|
||||
def split(self):
|
||||
n = (RCFNumObj * 1)()
|
||||
d = (RCFNumObj * 1)()
|
||||
Z3_rcf_get_numerator_denominator(self.ctx_ref(), self.num, n, d)
|
||||
return (RCFNum(n[0], self.ctx), RCFNum(d[0], self.ctx))
|
||||
|
|
|
@ -1274,7 +1274,7 @@ extern "C" {
|
|||
|
||||
def_API('Z3_global_param_reset_all', VOID, ())
|
||||
*/
|
||||
void Z3_API Z3_global_param_reset_all();
|
||||
void Z3_API Z3_global_param_reset_all(void);
|
||||
|
||||
/**
|
||||
\brief Get a global (or module) parameter.
|
||||
|
@ -1335,7 +1335,7 @@ extern "C" {
|
|||
|
||||
def_API('Z3_mk_config', CONFIG, ())
|
||||
*/
|
||||
Z3_config Z3_API Z3_mk_config();
|
||||
Z3_config Z3_API Z3_mk_config(void);
|
||||
|
||||
/**
|
||||
\brief Delete the given configuration object.
|
||||
|
@ -4765,7 +4765,7 @@ END_MLAPI_EXCLUDE
|
|||
|
||||
extra_API('Z3_close_log', VOID, ())
|
||||
*/
|
||||
void Z3_API Z3_close_log();
|
||||
void Z3_API Z3_close_log(void);
|
||||
|
||||
/**
|
||||
\brief Enable/disable printing warning messages to the console.
|
||||
|
|
|
@ -64,9 +64,9 @@ extern "C" {
|
|||
/**
|
||||
\brief Return a new infinitesimal that is smaller than all elements in the Z3 field.
|
||||
|
||||
def_API('Z3_rcf_mk_infinitesimal', RCF_NUM, (_in(CONTEXT), _in(STRING)))
|
||||
def_API('Z3_rcf_mk_infinitesimal', RCF_NUM, (_in(CONTEXT),))
|
||||
*/
|
||||
Z3_rcf_num Z3_API Z3_rcf_mk_infinitesimal(__in Z3_context c, __in Z3_string name);
|
||||
Z3_rcf_num Z3_API Z3_rcf_mk_infinitesimal(__in Z3_context c);
|
||||
|
||||
/**
|
||||
\brief Store in roots the roots of the polynomial <tt>a[n-1]*x^{n-1} + ... + a[0]</tt>.
|
||||
|
@ -173,9 +173,9 @@ extern "C" {
|
|||
/**
|
||||
\brief Convert the RCF numeral into a string.
|
||||
|
||||
def_API('Z3_rcf_num_to_string', STRING, (_in(CONTEXT), _in(RCF_NUM)))
|
||||
def_API('Z3_rcf_num_to_string', STRING, (_in(CONTEXT), _in(RCF_NUM), _in(BOOL), _in(BOOL)))
|
||||
*/
|
||||
Z3_string Z3_API Z3_rcf_num_to_string(__in Z3_context c, __in Z3_rcf_num a);
|
||||
Z3_string Z3_API Z3_rcf_num_to_string(__in Z3_context c, __in Z3_rcf_num a, __in Z3_bool compact, __in Z3_bool html);
|
||||
|
||||
/**
|
||||
\brief Convert the RCF numeral into a string in decimal notation.
|
||||
|
@ -184,6 +184,14 @@ extern "C" {
|
|||
*/
|
||||
Z3_string Z3_API Z3_rcf_num_to_decimal_string(__in Z3_context c, __in Z3_rcf_num a, __in unsigned prec);
|
||||
|
||||
/**
|
||||
\brief Extract the "numerator" and "denominator" of the given RCF numeral.
|
||||
We have that a = n/d, moreover n and d are not represented using rational functions.
|
||||
|
||||
def_API('Z3_rcf_get_numerator_denominator', VOID, (_in(CONTEXT), _in(RCF_NUM), _out(RCF_NUM), _out(RCF_NUM)))
|
||||
*/
|
||||
void Z3_API Z3_rcf_get_numerator_denominator(__in Z3_context c, __in Z3_rcf_num a, __out Z3_rcf_num * n, __out Z3_rcf_num * d);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // __cplusplus
|
||||
|
|
|
@ -154,6 +154,14 @@ void arith_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
|||
m->inc_ref(FIELD); \
|
||||
}
|
||||
|
||||
#define MK_LEFT_ASSOC_OP(FIELD, NAME, KIND, SORT) { \
|
||||
func_decl_info info(id, KIND); \
|
||||
info.set_left_associative(); \
|
||||
FIELD = m->mk_func_decl(symbol(NAME), SORT, SORT, SORT, info); \
|
||||
m->inc_ref(FIELD); \
|
||||
}
|
||||
|
||||
|
||||
#define MK_OP(FIELD, NAME, KIND, SORT) \
|
||||
FIELD = m->mk_func_decl(symbol(NAME), SORT, SORT, SORT, func_decl_info(id, KIND)); \
|
||||
m->inc_ref(FIELD)
|
||||
|
@ -163,15 +171,15 @@ void arith_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
|||
m->inc_ref(FIELD)
|
||||
|
||||
MK_AC_OP(m_r_add_decl, "+", OP_ADD, r);
|
||||
MK_OP(m_r_sub_decl, "-", OP_SUB, r);
|
||||
MK_LEFT_ASSOC_OP(m_r_sub_decl, "-", OP_SUB, r);
|
||||
MK_AC_OP(m_r_mul_decl, "*", OP_MUL, r);
|
||||
MK_OP(m_r_div_decl, "/", OP_DIV, r);
|
||||
MK_LEFT_ASSOC_OP(m_r_div_decl, "/", OP_DIV, r);
|
||||
MK_UNARY(m_r_uminus_decl, "-", OP_UMINUS, r);
|
||||
|
||||
MK_AC_OP(m_i_add_decl, "+", OP_ADD, i);
|
||||
MK_OP(m_i_sub_decl, "-", OP_SUB, i);
|
||||
MK_LEFT_ASSOC_OP(m_i_sub_decl, "-", OP_SUB, i);
|
||||
MK_AC_OP(m_i_mul_decl, "*", OP_MUL, i);
|
||||
MK_OP(m_i_div_decl, "div", OP_IDIV, i);
|
||||
MK_LEFT_ASSOC_OP(m_i_div_decl, "div", OP_IDIV, i);
|
||||
MK_OP(m_i_rem_decl, "rem", OP_REM, i);
|
||||
MK_OP(m_i_mod_decl, "mod", OP_MOD, i);
|
||||
MK_UNARY(m_i_uminus_decl, "-", OP_UMINUS, i);
|
||||
|
@ -186,6 +194,9 @@ void arith_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
|||
MK_OP(m_r_power_decl, "^", OP_POWER, r);
|
||||
MK_OP(m_i_power_decl, "^", OP_POWER, i);
|
||||
|
||||
MK_UNARY(m_i_abs_decl, "abs", OP_ABS, i);
|
||||
MK_UNARY(m_r_abs_decl, "abs", OP_ABS, r);
|
||||
|
||||
MK_UNARY(m_sin_decl, "sin", OP_SIN, r);
|
||||
MK_UNARY(m_cos_decl, "cos", OP_COS, r);
|
||||
MK_UNARY(m_tan_decl, "tan", OP_TAN, r);
|
||||
|
@ -255,6 +266,8 @@ arith_decl_plugin::arith_decl_plugin():
|
|||
m_is_int_decl(0),
|
||||
m_r_power_decl(0),
|
||||
m_i_power_decl(0),
|
||||
m_r_abs_decl(0),
|
||||
m_i_abs_decl(0),
|
||||
m_sin_decl(0),
|
||||
m_cos_decl(0),
|
||||
m_tan_decl(0),
|
||||
|
@ -312,6 +325,8 @@ void arith_decl_plugin::finalize() {
|
|||
DEC_REF(m_is_int_decl);
|
||||
DEC_REF(m_i_power_decl);
|
||||
DEC_REF(m_r_power_decl);
|
||||
DEC_REF(m_i_abs_decl);
|
||||
DEC_REF(m_r_abs_decl);
|
||||
DEC_REF(m_sin_decl);
|
||||
DEC_REF(m_cos_decl);
|
||||
DEC_REF(m_tan_decl);
|
||||
|
@ -364,6 +379,7 @@ inline func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, bool is_real) {
|
|||
case OP_TO_INT: return m_to_int_decl;
|
||||
case OP_IS_INT: return m_is_int_decl;
|
||||
case OP_POWER: return is_real ? m_r_power_decl : m_i_power_decl;
|
||||
case OP_ABS: return is_real ? m_r_abs_decl : m_i_abs_decl;
|
||||
case OP_SIN: return m_sin_decl;
|
||||
case OP_COS: return m_cos_decl;
|
||||
case OP_TAN: return m_tan_decl;
|
||||
|
@ -530,6 +546,7 @@ void arith_decl_plugin::get_op_names(svector<builtin_name>& op_names, symbol con
|
|||
op_names.push_back(builtin_name("to_real",OP_TO_REAL));
|
||||
op_names.push_back(builtin_name("to_int",OP_TO_INT));
|
||||
op_names.push_back(builtin_name("is_int",OP_IS_INT));
|
||||
op_names.push_back(builtin_name("abs", OP_ABS));
|
||||
if (logic == symbol::null) {
|
||||
op_names.push_back(builtin_name("^", OP_POWER));
|
||||
op_names.push_back(builtin_name("sin", OP_SIN));
|
||||
|
|
|
@ -51,6 +51,7 @@ enum arith_op_kind {
|
|||
OP_TO_REAL,
|
||||
OP_TO_INT,
|
||||
OP_IS_INT,
|
||||
OP_ABS,
|
||||
OP_POWER,
|
||||
// hyperbolic and trigonometric functions
|
||||
OP_SIN,
|
||||
|
@ -121,6 +122,9 @@ protected:
|
|||
func_decl * m_r_power_decl;
|
||||
func_decl * m_i_power_decl;
|
||||
|
||||
func_decl * m_r_abs_decl;
|
||||
func_decl * m_i_abs_decl;
|
||||
|
||||
func_decl * m_sin_decl;
|
||||
func_decl * m_cos_decl;
|
||||
func_decl * m_tan_decl;
|
||||
|
|
|
@ -1044,7 +1044,7 @@ func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
|
|||
}
|
||||
|
||||
func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||
unsigned num_args, expr * const * args, sort * range) {
|
||||
unsigned num_args, expr * const * args, sort * range) {
|
||||
switch (static_cast<basic_op_kind>(k)) {
|
||||
case OP_TRUE: return m_true_decl;
|
||||
case OP_FALSE: return m_false_decl;
|
||||
|
@ -1816,6 +1816,12 @@ sort * ast_manager::mk_sort(symbol const & name, sort_info * info) {
|
|||
return register_node(new_node);
|
||||
}
|
||||
|
||||
sort * ast_manager::mk_uninterpreted_sort(symbol const & name, unsigned num_parameters, parameter const * parameters) {
|
||||
user_sort_plugin * plugin = get_user_sort_plugin();
|
||||
decl_kind kind = plugin->register_name(name);
|
||||
return plugin->mk_sort(kind, num_parameters, parameters);
|
||||
}
|
||||
|
||||
func_decl * ast_manager::mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range,
|
||||
bool assoc, bool comm, bool inj) {
|
||||
func_decl_info info(null_family_id, null_decl_kind);
|
||||
|
@ -1836,14 +1842,17 @@ func_decl * ast_manager::mk_func_decl(symbol const & name, unsigned arity, sort
|
|||
}
|
||||
|
||||
void ast_manager::check_sort(func_decl const * decl, unsigned num_args, expr * const * args) const {
|
||||
ast_manager& m = const_cast<ast_manager&>(*this);
|
||||
if (decl->is_associative()) {
|
||||
sort * expected = decl->get_domain(0);
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
sort * given = get_sort(args[i]);
|
||||
if (!compatible_sorts(expected, given)) {
|
||||
string_buffer<> buff;
|
||||
buff << "invalid function application, sort mismatch on argument at position " << (i+1);
|
||||
throw ast_exception(buff.c_str());
|
||||
std::ostringstream buff;
|
||||
buff << "invalid function application for " << decl->get_name() << ", ";
|
||||
buff << "sort mismatch on argument at position " << (i+1) << ", ";
|
||||
buff << "expected " << mk_pp(expected, m) << " but given " << mk_pp(given, m);
|
||||
throw ast_exception(buff.str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1855,9 +1864,11 @@ void ast_manager::check_sort(func_decl const * decl, unsigned num_args, expr * c
|
|||
sort * expected = decl->get_domain(i);
|
||||
sort * given = get_sort(args[i]);
|
||||
if (!compatible_sorts(expected, given)) {
|
||||
string_buffer<> buff;
|
||||
buff << "invalid function application, sort mismatch on argument at position " << (i+1);
|
||||
throw ast_exception(buff.c_str());
|
||||
std::ostringstream buff;
|
||||
buff << "invalid function application for " << decl->get_name() << ", ";
|
||||
buff << "sort mismatch on argument at position " << (i+1) << ", ";
|
||||
buff << "expected " << mk_pp(expected, m) << " but given " << mk_pp(given, m);
|
||||
throw ast_exception(buff.str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2058,7 +2069,7 @@ sort * ast_manager::mk_fresh_sort(char const * prefix) {
|
|||
string_buffer<32> buffer;
|
||||
buffer << prefix << "!" << m_fresh_id;
|
||||
m_fresh_id++;
|
||||
return mk_sort(symbol(buffer.c_str()));
|
||||
return mk_uninterpreted_sort(symbol(buffer.c_str()));
|
||||
}
|
||||
|
||||
symbol ast_manager::mk_fresh_var_name(char const * prefix) {
|
||||
|
|
|
@ -1622,11 +1622,13 @@ private:
|
|||
sort * mk_sort(symbol const & name, sort_info * info);
|
||||
|
||||
public:
|
||||
sort * mk_sort(symbol const & name) { return mk_sort(name, 0); }
|
||||
sort * mk_uninterpreted_sort(symbol const & name, unsigned num_parameters, parameter const * parameters);
|
||||
|
||||
sort * mk_uninterpreted_sort(symbol const & name) { return mk_uninterpreted_sort(name, 0, 0); }
|
||||
|
||||
sort * mk_sort(symbol const & name, sort_info const & info) {
|
||||
if (info.get_family_id() == null_family_id) {
|
||||
return mk_sort(name, 0);
|
||||
return mk_uninterpreted_sort(name);
|
||||
}
|
||||
else {
|
||||
return mk_sort(name, &const_cast<sort_info &>(info));
|
||||
|
|
|
@ -126,7 +126,21 @@ public:
|
|||
m_autil(m) {
|
||||
}
|
||||
|
||||
void operator()(sort * n) {
|
||||
void pp(ast* n) {
|
||||
ast_mark visited;
|
||||
pp(n, visited);
|
||||
}
|
||||
|
||||
void pp(ast* n, ast_mark& visited) {
|
||||
if (is_sort(n)) {
|
||||
display_sort(to_sort(n));
|
||||
}
|
||||
else {
|
||||
for_each_ast(*this, visited, n, true);
|
||||
}
|
||||
}
|
||||
|
||||
void operator()(sort* n) {
|
||||
}
|
||||
|
||||
void operator()(func_decl * n) {
|
||||
|
@ -296,17 +310,17 @@ public:
|
|||
|
||||
void ast_ll_pp(std::ostream & out, ast_manager & m, ast * n, bool only_exprs, bool compact) {
|
||||
ll_printer p(out, m, n, only_exprs, compact);
|
||||
for_each_ast(p, n, true);
|
||||
p.pp(n);
|
||||
}
|
||||
|
||||
void ast_ll_pp(std::ostream & out, ast_manager & m, ast * n, ast_mark & visited, bool only_exprs, bool compact) {
|
||||
ll_printer p(out, m, n, only_exprs, compact);
|
||||
for_each_ast(p, visited, n, true);
|
||||
p.pp(n, visited);
|
||||
}
|
||||
|
||||
void ast_def_ll_pp(std::ostream & out, ast_manager & m, ast * n, ast_mark & visited, bool only_exprs, bool compact) {
|
||||
ll_printer p(out, m, 0, only_exprs, compact);
|
||||
for_each_ast(p, visited, n, true);
|
||||
p.pp(n, visited);
|
||||
}
|
||||
|
||||
void ast_ll_bounded_pp(std::ostream & out, ast_manager & m, ast * n, unsigned depth) {
|
||||
|
|
|
@ -401,7 +401,12 @@ class smt_printer {
|
|||
if (m_autil.is_numeral(n, val, is_int)) {
|
||||
if (val.is_neg()) {
|
||||
val.neg();
|
||||
m_out << "(~ ";
|
||||
if (m_is_smt2) {
|
||||
m_out << "(- ";
|
||||
}
|
||||
else {
|
||||
m_out << "(~ ";
|
||||
}
|
||||
display_rational(val, is_int);
|
||||
m_out << ")";
|
||||
}
|
||||
|
@ -532,7 +537,7 @@ class smt_printer {
|
|||
}
|
||||
|
||||
void print_bound(symbol const& name) {
|
||||
if (name.is_numerical() || '?' != name.bare_str()[0]) {
|
||||
if (!m_is_smt2 && (name.is_numerical() || '?' != name.bare_str()[0])) {
|
||||
m_out << "?";
|
||||
}
|
||||
m_out << name;
|
||||
|
@ -637,7 +642,9 @@ class smt_printer {
|
|||
m_out << m_var_names[m_num_var_names - idx - 1];
|
||||
}
|
||||
else {
|
||||
m_out << "?" << idx;
|
||||
if (!m_is_smt2) {
|
||||
m_out << "?" << idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -862,7 +869,7 @@ public:
|
|||
for (unsigned j = 0; j < f->get_arity(); ++j) {
|
||||
sort* s2 = f->get_domain(j);
|
||||
if (!mark.is_marked(s2)) {
|
||||
if (s2->get_family_id() == null_family_id) {
|
||||
if (m_manager.is_uninterp(s2)) {
|
||||
pp_sort_decl(mark, s2);
|
||||
}
|
||||
else if (!util.is_datatype(s2)) {
|
||||
|
|
|
@ -111,7 +111,10 @@ void ast_translation::mk_sort(sort * s, frame & fr) {
|
|||
sort_info * si = s->get_info();
|
||||
sort * new_s;
|
||||
if (si == 0) {
|
||||
new_s = m_to_manager.mk_sort(s->get_name());
|
||||
// TODO: investigate: this branch is probably unreachable.
|
||||
// It became unreachable after we started using mk_uninterpreted_sort for creating uninterpreted sorts,
|
||||
// and mk_uninterpreted_sort actually creates a user_sort.
|
||||
new_s = m_to_manager.mk_uninterpreted_sort(s->get_name());
|
||||
SASSERT(m_result_stack.size() == fr.m_rpos);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -171,6 +171,9 @@ sort * bv_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter c
|
|||
m_manager->raise_exception("expecting one integer parameter to bit-vector sort");
|
||||
}
|
||||
unsigned bv_size = parameters[0].get_int();
|
||||
if (bv_size == 0) {
|
||||
m_manager->raise_exception("bit-vector size must be greater than zero");
|
||||
}
|
||||
mk_bv_sort(bv_size);
|
||||
return m_bv_sorts[bv_size];
|
||||
}
|
||||
|
@ -457,7 +460,7 @@ func_decl * bv_decl_plugin::mk_mkbv(unsigned arity, sort * const * domain) {
|
|||
}
|
||||
|
||||
func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||
unsigned arity, sort * const * domain, sort * range) {
|
||||
unsigned arity, sort * const * domain, sort * range) {
|
||||
int bv_size;
|
||||
if (k == OP_INT2BV && get_int2bv_size(num_parameters, parameters, bv_size)) {
|
||||
// bv_size is filled in.
|
||||
|
@ -555,7 +558,7 @@ func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
|
|||
}
|
||||
|
||||
func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||
unsigned num_args, expr * const * args, sort * range) {
|
||||
unsigned num_args, expr * const * args, sort * range) {
|
||||
int bv_size;
|
||||
if (k == OP_INT2BV && get_int2bv_size(num_parameters, parameters, bv_size)) {
|
||||
// bv_size is filled in.
|
||||
|
|
|
@ -70,6 +70,7 @@ br_status arith_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * c
|
|||
case OP_TO_INT: SASSERT(num_args == 1); st = mk_to_int_core(args[0], result); break;
|
||||
case OP_IS_INT: SASSERT(num_args == 1); st = mk_is_int(args[0], result); break;
|
||||
case OP_POWER: SASSERT(num_args == 2); st = mk_power_core(args[0], args[1], result); break;
|
||||
case OP_ABS: SASSERT(num_args == 1); st = mk_abs_core(args[0], result); break;
|
||||
case OP_SIN: SASSERT(num_args == 1); st = mk_sin_core(args[0], result); break;
|
||||
case OP_COS: SASSERT(num_args == 1); st = mk_cos_core(args[0], result); break;
|
||||
case OP_TAN: SASSERT(num_args == 1); st = mk_tan_core(args[0], result); break;
|
||||
|
@ -1024,6 +1025,11 @@ br_status arith_rewriter::mk_is_int(expr * arg, expr_ref & result) {
|
|||
}
|
||||
}
|
||||
|
||||
br_status arith_rewriter::mk_abs_core(expr * arg, expr_ref & result) {
|
||||
result = m().mk_ite(m_util.mk_ge(arg, m_util.mk_numeral(rational(0), m_util.is_int(arg))), arg, m_util.mk_uminus(arg));
|
||||
return BR_REWRITE2;
|
||||
}
|
||||
|
||||
void arith_rewriter::set_cancel(bool f) {
|
||||
m_util.set_cancel(f);
|
||||
}
|
||||
|
|
|
@ -131,6 +131,8 @@ public:
|
|||
}
|
||||
void mk_gt(expr * arg1, expr * arg2, expr_ref & result) { mk_gt_core(arg1, arg2, result); }
|
||||
|
||||
br_status mk_abs_core(expr * arg, expr_ref & result);
|
||||
|
||||
br_status mk_div_core(expr * arg1, expr * arg2, expr_ref & result);
|
||||
br_status mk_idiv_core(expr * arg1, expr * arg2, expr_ref & result);
|
||||
br_status mk_mod_core(expr * arg1, expr * arg2, expr_ref & result);
|
||||
|
|
|
@ -117,8 +117,8 @@ void seq_decl_plugin::init() {
|
|||
if(m_init) return;
|
||||
ast_manager& m = *m_manager;
|
||||
m_init = true;
|
||||
sort* A = m.mk_sort(symbol((unsigned)0));
|
||||
sort* B = m.mk_sort(symbol((unsigned)1));
|
||||
sort* A = m.mk_uninterpreted_sort(symbol((unsigned)0));
|
||||
sort* B = m.mk_uninterpreted_sort(symbol((unsigned)1));
|
||||
parameter paramA(A);
|
||||
sort* seqA = m.mk_sort(m_family_id, SEQ_SORT, 1, ¶mA);
|
||||
sort* reA = m.mk_sort(m_family_id, RE_SORT, 1, ¶mA);
|
||||
|
|
|
@ -404,6 +404,7 @@ bool arith_simplifier_plugin::reduce(func_decl * f, unsigned num_args, expr * co
|
|||
case OP_TO_INT: SASSERT(num_args == 1); mk_to_int(args[0], result); break;
|
||||
case OP_IS_INT: SASSERT(num_args == 1); mk_is_int(args[0], result); break;
|
||||
case OP_POWER: return false;
|
||||
case OP_ABS: SASSERT(num_args == 1); mk_abs(args[0], result); break;
|
||||
case OP_IRRATIONAL_ALGEBRAIC_NUM: return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -413,6 +414,14 @@ bool arith_simplifier_plugin::reduce(func_decl * f, unsigned num_args, expr * co
|
|||
return true;
|
||||
}
|
||||
|
||||
void arith_simplifier_plugin::mk_abs(expr * arg, expr_ref & result) {
|
||||
expr_ref c(m_manager);
|
||||
expr_ref m_arg(m_manager);
|
||||
mk_uminus(arg, m_arg);
|
||||
mk_ge(arg, m_util.mk_numeral(rational(0), m_util.is_int(arg)), c);
|
||||
m_bsimp.mk_ite(c, arg, m_arg, result);
|
||||
}
|
||||
|
||||
bool arith_simplifier_plugin::is_arith_term(expr * n) const {
|
||||
return n->get_kind() == AST_APP && to_app(n)->get_family_id() == m_fid;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
void mk_to_real(expr * arg, expr_ref & result);
|
||||
void mk_to_int(expr * arg, expr_ref & result);
|
||||
void mk_is_int(expr * arg, expr_ref & result);
|
||||
void mk_abs(expr * arg, expr_ref & result);
|
||||
|
||||
virtual bool reduce(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result);
|
||||
virtual bool reduce_eq(expr * lhs, expr * rhs, expr_ref & result);
|
||||
|
|
|
@ -165,7 +165,8 @@ void static_features::update_core(expr * e) {
|
|||
// even if a benchmark does not contain any theory interpreted function decls, we still have to install
|
||||
// the theory if the benchmark contains constants or function applications of an interpreted sort.
|
||||
sort * s = m_manager.get_sort(e);
|
||||
mark_theory(s->get_family_id());
|
||||
if (!m_manager.is_uninterp(s))
|
||||
mark_theory(s->get_family_id());
|
||||
|
||||
bool _is_gate = is_gate(e);
|
||||
bool _is_eq = m_manager.is_eq(e);
|
||||
|
@ -255,9 +256,11 @@ void static_features::update_core(expr * e) {
|
|||
m_num_simple_eqs++;
|
||||
}
|
||||
sort * s = m_manager.get_sort(to_app(e)->get_arg(0));
|
||||
family_id fid = s->get_family_id();
|
||||
if (fid != null_family_id && fid != m_bfid)
|
||||
inc_theory_eqs(fid);
|
||||
if (!m_manager.is_uninterp(s)) {
|
||||
family_id fid = s->get_family_id();
|
||||
if (fid != null_family_id && fid != m_bfid)
|
||||
inc_theory_eqs(fid);
|
||||
}
|
||||
}
|
||||
if (!m_has_int && m_autil.is_int(e))
|
||||
m_has_int = true;
|
||||
|
@ -295,9 +298,11 @@ void static_features::update_core(expr * e) {
|
|||
if (to_app(e)->get_num_args() == 0) {
|
||||
m_num_uninterpreted_constants++;
|
||||
sort * s = m_manager.get_sort(e);
|
||||
family_id fid = s->get_family_id();
|
||||
if (fid != null_family_id && fid != m_bfid)
|
||||
inc_theory_constants(fid);
|
||||
if (!m_manager.is_uninterp(s)) {
|
||||
family_id fid = s->get_family_id();
|
||||
if (fid != null_family_id && fid != m_bfid)
|
||||
inc_theory_constants(fid);
|
||||
}
|
||||
}
|
||||
}
|
||||
func_decl * d = to_app(e)->get_decl();
|
||||
|
@ -312,18 +317,20 @@ void static_features::update_core(expr * e) {
|
|||
for (unsigned i = 0; i < num_args; i++) {
|
||||
expr * arg = to_app(e)->get_arg(i);
|
||||
sort * arg_s = m_manager.get_sort(arg);
|
||||
family_id fid_arg = arg_s->get_family_id();
|
||||
if (fid_arg != fid && fid_arg != null_family_id) {
|
||||
m_num_aliens++;
|
||||
inc_num_aliens(fid_arg);
|
||||
if (fid_arg == m_afid) {
|
||||
SASSERT(!_is_le_ge);
|
||||
m_num_arith_terms++;
|
||||
rational k;
|
||||
TRACE("diff_term", tout << "diff_term: " << is_diff_term(arg, k) << "\n" << mk_pp(arg, m_manager) << "\n";);
|
||||
if (is_diff_term(arg, k)) {
|
||||
m_num_diff_terms++;
|
||||
acc_num(k);
|
||||
if (!m_manager.is_uninterp(arg_s)) {
|
||||
family_id fid_arg = arg_s->get_family_id();
|
||||
if (fid_arg != fid && fid_arg != null_family_id) {
|
||||
m_num_aliens++;
|
||||
inc_num_aliens(fid_arg);
|
||||
if (fid_arg == m_afid) {
|
||||
SASSERT(!_is_le_ge);
|
||||
m_num_arith_terms++;
|
||||
rational k;
|
||||
TRACE("diff_term", tout << "diff_term: " << is_diff_term(arg, k) << "\n" << mk_pp(arg, m_manager) << "\n";);
|
||||
if (is_diff_term(arg, k)) {
|
||||
m_num_diff_terms++;
|
||||
acc_num(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,10 @@ bool matcher::operator()(expr * e1, expr * e2, substitution & s) {
|
|||
|
||||
if (is_var(p.second))
|
||||
return false;
|
||||
if (!is_app(p.first))
|
||||
return false;
|
||||
if (!is_app(p.second))
|
||||
return false;
|
||||
|
||||
app * n1 = to_app(p.first);
|
||||
app * n2 = to_app(p.second);
|
||||
|
|
|
@ -32,7 +32,7 @@ class matcher {
|
|||
|
||||
ast_manager & m_manager;
|
||||
substitution * m_subst;
|
||||
cache m_cache;
|
||||
// cache m_cache;
|
||||
svector<expr_pair> m_todo;
|
||||
|
||||
void reset();
|
||||
|
|
|
@ -20,22 +20,23 @@ Revision History:
|
|||
#include"substitution.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include"rewriter.h"
|
||||
|
||||
substitution::substitution(ast_manager & m):
|
||||
m_manager(m),
|
||||
m_new_exprs(m) {
|
||||
m_refs(m),
|
||||
m_new_exprs(m),
|
||||
m_state(CLEAN) {
|
||||
}
|
||||
|
||||
void substitution::reset() {
|
||||
reset_subst();
|
||||
m_subst.reset();
|
||||
m_vars.reset();
|
||||
m_refs.reset();
|
||||
m_scopes.reset();
|
||||
reset_cache();
|
||||
}
|
||||
|
||||
void substitution::reset_subst() {
|
||||
m_subst.reset();
|
||||
m_vars.reset();
|
||||
m_scopes.reset();
|
||||
}
|
||||
|
||||
void substitution::reset_cache() {
|
||||
TRACE("subst_bug", tout << "substitution::reset_cache\n";
|
||||
|
@ -43,6 +44,7 @@ void substitution::reset_cache() {
|
|||
|
||||
m_apply_cache.reset();
|
||||
m_new_exprs.reset();
|
||||
m_state = CLEAN;
|
||||
}
|
||||
|
||||
void substitution::pop_scope(unsigned num_scopes) {
|
||||
|
@ -57,7 +59,9 @@ void substitution::pop_scope(unsigned num_scopes) {
|
|||
m_subst.erase(curr.first, curr.second);
|
||||
}
|
||||
m_vars.shrink(old_sz);
|
||||
m_refs.shrink(old_sz);
|
||||
m_scopes.shrink(new_lvl);
|
||||
reset_cache();
|
||||
}
|
||||
|
||||
inline void substitution::apply_visit(expr_offset const & n, bool & visited) {
|
||||
|
@ -72,11 +76,14 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e
|
|||
|
||||
TRACE("subst_bug", tout << "BEGIN substitution::apply\n";);
|
||||
|
||||
|
||||
// It is incorrect to cache results between different calls if we are applying a substitution
|
||||
// modulo a substitution s -> t.
|
||||
if (s != expr_offset(0,0))
|
||||
if (m_state == INSERT || s != expr_offset(0,0))
|
||||
reset_cache();
|
||||
|
||||
m_state = APPLY;
|
||||
|
||||
unsigned j;
|
||||
expr * e;
|
||||
unsigned off;
|
||||
|
@ -160,6 +167,48 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e
|
|||
}
|
||||
}
|
||||
break;
|
||||
case AST_QUANTIFIER: {
|
||||
quantifier* q = to_quantifier(e);
|
||||
unsigned num_vars = q->get_num_decls();
|
||||
substitution subst(m_manager);
|
||||
expr_ref er(m_manager);
|
||||
subst.reserve(m_subst.offsets_capacity(), m_subst.vars_capacity() + num_vars);
|
||||
var_shifter var_sh(m_manager);
|
||||
expr_offset r;
|
||||
for (unsigned i = 0; i < m_subst.offsets_capacity(); i++) {
|
||||
for (unsigned j = 0; j < m_subst.vars_capacity(); j++) {
|
||||
if (find(j, i, r)) {
|
||||
var_sh(r.get_expr(), num_vars, er);
|
||||
subst.insert(j + num_vars, i, expr_offset(er, r.get_offset()));
|
||||
}
|
||||
}
|
||||
}
|
||||
expr_offset body(q->get_expr(), off);
|
||||
expr_ref s1_ref(m_manager), t1_ref(m_manager);
|
||||
if (s.get_expr() != 0) {
|
||||
var_sh(s.get_expr(), num_vars, s1_ref);
|
||||
}
|
||||
if (t.get_expr() != 0) {
|
||||
var_sh(t.get_expr(), num_vars, t1_ref);
|
||||
}
|
||||
expr_offset s1(s1_ref, s.get_offset());
|
||||
expr_offset t1(t1_ref, t.get_offset());
|
||||
expr_ref_vector pats(m_manager), no_pats(m_manager);
|
||||
for (unsigned i = 0; i < q->get_num_patterns(); ++i) {
|
||||
subst.apply(num_actual_offsets, deltas, expr_offset(q->get_pattern(i), off), s1, t1, er);
|
||||
pats.push_back(er);
|
||||
}
|
||||
for (unsigned i = 0; i < q->get_num_no_patterns(); ++i) {
|
||||
subst.apply(num_actual_offsets, deltas, expr_offset(q->get_no_pattern(i), off), s1, t1, er);
|
||||
no_pats.push_back(er);
|
||||
}
|
||||
subst.apply(num_actual_offsets, deltas, body, s1, t1, er);
|
||||
er = m_manager.update_quantifier(q, pats.size(), pats.c_ptr(), no_pats.size(), no_pats.c_ptr(), er);
|
||||
m_todo.pop_back();
|
||||
m_new_exprs.push_back(er);
|
||||
m_apply_cache.insert(n, er);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,19 @@ Author:
|
|||
|
||||
Revision History:
|
||||
|
||||
nbjorner 2013-01-21:
|
||||
- reset the apply cache on pop_scope to make sure that popped
|
||||
substitutions are invalidated.
|
||||
- reset_cache if a new binding was added after application
|
||||
of a substitution.
|
||||
- Add m_refs to make sure terms in the range of the
|
||||
substitution have the same life-time as the substitution.
|
||||
- Remove reset_subst() function. If called without resetting the cache, then
|
||||
results of applying substitutions are incoherent.
|
||||
- Replace UNREACHABLE segment for quantifiers by recursive invocation of substitution
|
||||
that updates expressions within quantifiers. It shifts all variables in the domain
|
||||
of the current substitution by the number of quantified variables.
|
||||
|
||||
--*/
|
||||
#ifndef _SUBSTITUTION_H_
|
||||
#define _SUBSTITUTION_H_
|
||||
|
@ -34,6 +47,7 @@ class substitution {
|
|||
// field for backtracking
|
||||
typedef std::pair<unsigned, unsigned> var_offset;
|
||||
svector<var_offset> m_vars;
|
||||
expr_ref_vector m_refs;
|
||||
unsigned_vector m_scopes;
|
||||
|
||||
// fields for applying substitutions
|
||||
|
@ -45,6 +59,11 @@ class substitution {
|
|||
enum color { White, Grey, Black };
|
||||
expr_offset_map<color> m_color;
|
||||
|
||||
|
||||
// keep track of how substitution state was last updated.
|
||||
enum state { CLEAN, APPLY, INSERT };
|
||||
state m_state;
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
unsigned m_max_offset_since_reset;
|
||||
#endif
|
||||
|
@ -81,8 +100,6 @@ public:
|
|||
|
||||
// reset everything
|
||||
void reset();
|
||||
// reset only the mapping from variables to expressions
|
||||
void reset_subst();
|
||||
// reset only the substitution application cache
|
||||
void reset_cache();
|
||||
|
||||
|
@ -119,7 +136,9 @@ public:
|
|||
TRACE("subst_insert", tout << "inserting: #" << v_idx << ":" << offset << " --> " << mk_pp(t.get_expr(), m_manager)
|
||||
<< ":" << t.get_offset() << "\n";);
|
||||
m_vars.push_back(var_offset(v_idx, offset));
|
||||
m_refs.push_back(t.get_expr());
|
||||
m_subst.insert(v_idx, offset, t);
|
||||
m_state = INSERT;
|
||||
}
|
||||
void insert(var * v, unsigned offset, expr_offset const & t) { insert(v->get_idx(), offset, t); }
|
||||
void insert(expr_offset v, expr_offset const & t) {
|
||||
|
|
|
@ -213,7 +213,12 @@ ATOMIC_CMD(labels_cmd, "labels", "retrieve Simplify-like labels", {
|
|||
|
||||
ATOMIC_CMD(get_assertions_cmd, "get-assertions", "retrieve asserted terms when in interactive mode", ctx.display_assertions(););
|
||||
|
||||
UNARY_CMD(set_logic_cmd, "set-logic", "<symbol>", "set the background logic.", CPK_SYMBOL, symbol const &, ctx.set_logic(arg); ctx.print_success(););
|
||||
UNARY_CMD(set_logic_cmd, "set-logic", "<symbol>", "set the background logic.", CPK_SYMBOL, symbol const &,
|
||||
if (ctx.set_logic(arg))
|
||||
ctx.print_success();
|
||||
else
|
||||
ctx.print_unsupported(symbol::null);
|
||||
);
|
||||
|
||||
UNARY_CMD(pp_cmd, "display", "<term>", "display the given term.", CPK_EXPR, expr *, {
|
||||
ctx.display(ctx.regular_stream(), arg);
|
||||
|
|
|
@ -228,6 +228,9 @@ struct check_logic::imp {
|
|||
bool is_int(expr * t) {
|
||||
if (m_a_util.is_uminus(t))
|
||||
t = to_app(t)->get_arg(0);
|
||||
// Take care of coercions automatically added by Z3
|
||||
if (m_a_util.is_to_real(t))
|
||||
t = to_app(t)->get_arg(0);
|
||||
return m_a_util.is_numeral(t);
|
||||
}
|
||||
|
||||
|
|
|
@ -304,8 +304,8 @@ cmd_context::cmd_context(bool main_ctx, ast_manager * m, symbol const & l):
|
|||
m_main_ctx(main_ctx),
|
||||
m_logic(l),
|
||||
m_interactive_mode(false),
|
||||
m_global_decls(false), // :global-decls is false by default.
|
||||
m_print_success(false), // params.m_smtlib2_compliant),
|
||||
m_global_decls(false),
|
||||
m_print_success(m_params.m_smtlib2_compliant),
|
||||
m_random_seed(0),
|
||||
m_produce_unsat_cores(false),
|
||||
m_produce_assignments(false),
|
||||
|
@ -352,6 +352,8 @@ void cmd_context::set_cancel(bool f) {
|
|||
|
||||
void cmd_context::global_params_updated() {
|
||||
m_params.updt_params();
|
||||
if (m_params.m_smtlib2_compliant)
|
||||
m_print_success = true;
|
||||
if (m_solver) {
|
||||
params_ref p;
|
||||
if (!m_params.m_auto_config)
|
||||
|
@ -619,14 +621,19 @@ bool cmd_context::supported_logic(symbol const & s) const {
|
|||
s == "QF_FPA" || s == "QF_FPABV";
|
||||
}
|
||||
|
||||
void cmd_context::set_logic(symbol const & s) {
|
||||
bool cmd_context::set_logic(symbol const & s) {
|
||||
if (has_logic())
|
||||
throw cmd_exception("the logic has already been set");
|
||||
if (has_manager() && m_main_ctx)
|
||||
throw cmd_exception("logic must be set before initialization");
|
||||
if (!supported_logic(s)) {
|
||||
warning_msg("unknown logic, ignoring set-logic command");
|
||||
return;
|
||||
if (m_params.m_smtlib2_compliant) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
warning_msg("unknown logic, ignoring set-logic command");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
m_logic = s;
|
||||
if (is_logic("QF_RDL") ||
|
||||
|
@ -638,6 +645,7 @@ void cmd_context::set_logic(symbol const & s) {
|
|||
is_logic("QF_UFNRA") ||
|
||||
is_logic("QF_UFLRA"))
|
||||
m_numeral_as_real = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string cmd_context::reason_unknown() const {
|
||||
|
@ -668,7 +676,7 @@ void cmd_context::insert(symbol const & s, func_decl * f) {
|
|||
msg += f->get_arity() == 0 ? "constant" : "function";
|
||||
msg += " '";
|
||||
msg += s.str();
|
||||
msg += "' (whith the given signature) already declared";
|
||||
msg += "' (with the given signature) already declared";
|
||||
throw cmd_exception(msg.c_str());
|
||||
}
|
||||
if (s != f->get_name()) {
|
||||
|
@ -1415,7 +1423,7 @@ void cmd_context::validate_model() {
|
|||
params_ref p;
|
||||
p.set_uint("max_degree", UINT_MAX); // evaluate algebraic numbers of any degree.
|
||||
p.set_uint("sort_store", true);
|
||||
p.set_bool("model_completion", true);
|
||||
p.set_bool("completion", true);
|
||||
model_evaluator evaluator(*(md.get()), p);
|
||||
contains_array_op_proc contains_array(m());
|
||||
{
|
||||
|
|
|
@ -254,7 +254,7 @@ public:
|
|||
void reset_cancel() { set_cancel(false); }
|
||||
context_params & params() { return m_params; }
|
||||
void global_params_updated(); // this method should be invoked when global (and module) params are updated.
|
||||
void set_logic(symbol const & s);
|
||||
bool set_logic(symbol const & s);
|
||||
bool has_logic() const { return m_logic != symbol::null; }
|
||||
symbol const & get_logic() const { return m_logic; }
|
||||
bool is_logic(char const * l_name) const { return has_logic() && strcmp(m_logic.bare_str(), l_name) == 0; }
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue