mirror of
https://github.com/Z3Prover/z3
synced 2025-04-22 16:45:31 +00:00
Merge remote-tracking branch 'upstream/master' into HEAD
This commit is contained in:
commit
a8d025f5b4
1661 changed files with 45439 additions and 28238 deletions
|
@ -14,6 +14,7 @@ set(Z3_API_HEADER_FILES_TO_SCAN
|
|||
z3_optimization.h
|
||||
z3_interp.h
|
||||
z3_fpa.h
|
||||
z3_spacer.h
|
||||
)
|
||||
set(Z3_FULL_PATH_API_HEADER_FILES_TO_SCAN "")
|
||||
foreach (header_file ${Z3_API_HEADER_FILES_TO_SCAN})
|
||||
|
@ -66,10 +67,7 @@ add_subdirectory(interp)
|
|||
add_subdirectory(cmd_context)
|
||||
add_subdirectory(cmd_context/extra_cmds)
|
||||
add_subdirectory(parsers/smt2)
|
||||
add_subdirectory(ast/proof_checker)
|
||||
## Simplifier module will be deleted in the future.
|
||||
## It has been replaced with rewriter component.
|
||||
add_subdirectory(ast/simplifier)
|
||||
add_subdirectory(ast/proofs)
|
||||
add_subdirectory(ast/fpa)
|
||||
add_subdirectory(ast/macros)
|
||||
add_subdirectory(ast/pattern)
|
||||
|
@ -92,6 +90,7 @@ add_subdirectory(muz/tab)
|
|||
add_subdirectory(muz/bmc)
|
||||
add_subdirectory(muz/ddnf)
|
||||
add_subdirectory(muz/duality)
|
||||
add_subdirectory(muz/spacer)
|
||||
add_subdirectory(muz/fp)
|
||||
add_subdirectory(tactic/nlsat_smt)
|
||||
add_subdirectory(tactic/ufbv)
|
||||
|
@ -168,6 +167,7 @@ set (libz3_public_headers
|
|||
z3_polynomial.h
|
||||
z3_rcf.h
|
||||
z3_v1.h
|
||||
z3_spacer.h
|
||||
)
|
||||
foreach (header ${libz3_public_headers})
|
||||
set_property(TARGET libz3 APPEND PROPERTY
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"ackr_model_converter.h"
|
||||
#include"ackermannize_bv_model_converter.h"
|
||||
#include "ackermannization/ackr_model_converter.h"
|
||||
#include "ackermannization/ackermannize_bv_model_converter.h"
|
||||
|
||||
model_converter * mk_ackermannize_bv_model_converter(ast_manager & m, const ackr_info_ref& info) {
|
||||
return mk_ackr_model_converter(m, info);
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#ifndef ACKERMANNIZE_BV_MODEL_CONVERTER_H_
|
||||
#define ACKERMANNIZE_BV_MODEL_CONVERTER_H_
|
||||
|
||||
#include"model_converter.h"
|
||||
#include"ackr_info.h"
|
||||
#include "tactic/model_converter.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
|
||||
model_converter * mk_ackermannize_bv_model_converter(ast_manager & m, const ackr_info_ref& info);
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@ Mikolas Janota
|
|||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"ackermannize_bv_tactic.h"
|
||||
#include"tactical.h"
|
||||
#include"lackr.h"
|
||||
#include"model_smt2_pp.h"
|
||||
#include"ackermannize_bv_tactic_params.hpp"
|
||||
#include"ackermannize_bv_model_converter.h"
|
||||
#include "ackermannization/ackermannize_bv_tactic.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ackermannization/lackr.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "ackermannization/ackermannize_bv_tactic_params.hpp"
|
||||
#include "ackermannization/ackermannize_bv_model_converter.h"
|
||||
|
||||
|
||||
class ackermannize_bv_tactic : public tactic {
|
||||
|
|
|
@ -16,7 +16,7 @@ Revision History:
|
|||
|
||||
#ifndef _ACKERMANNIZE_TACTIC_H_
|
||||
#define _ACKERMANNIZE_TACTIC_H_
|
||||
#include"tactical.h"
|
||||
#include "tactic/tactical.h"
|
||||
|
||||
tactic * mk_ackermannize_bv_tactic(ast_manager & m, params_ref const & p);
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"ackr_helper.h"
|
||||
#include"ackr_bound_probe.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "ackermannization/ackr_helper.h"
|
||||
#include "ackermannization/ackr_bound_probe.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
/*
|
||||
For each function f, calculate the number of its occurrences o_f and compute "o_f choose 2".
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifndef ACKR_BOUND_PROBE_H_
|
||||
#define ACKR_BOUND_PROBE_H_
|
||||
|
||||
#include"probe.h"
|
||||
#include "tactic/probe.h"
|
||||
|
||||
probe * mk_ackr_bound_probe();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"ackr_helper.h"
|
||||
#include "ackermannization/ackr_helper.h"
|
||||
|
||||
double ackr_helper::calculate_lemma_bound(ackr_helper::fun2terms_map& occurrences) {
|
||||
fun2terms_map::iterator it = occurrences.begin();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef ACKR_HELPER_H_
|
||||
#define ACKR_HELPER_H_
|
||||
|
||||
#include"bv_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
|
||||
class ackr_helper {
|
||||
public:
|
||||
|
|
|
@ -16,11 +16,11 @@ Revision History:
|
|||
#ifndef ACKR_INFO_H_
|
||||
#define ACKR_INFO_H_
|
||||
|
||||
#include"obj_hashtable.h"
|
||||
#include"ast.h"
|
||||
#include"ref.h"
|
||||
#include"expr_replacer.h"
|
||||
#include"ast_translation.h"
|
||||
#include "util/obj_hashtable.h"
|
||||
#include "ast/ast.h"
|
||||
#include "util/ref.h"
|
||||
#include "ast/rewriter/expr_replacer.h"
|
||||
#include "ast/ast_translation.h"
|
||||
|
||||
/** \brief
|
||||
Information about how a formula is being converted into
|
||||
|
|
|
@ -3,27 +3,27 @@ Copyright (c) 2015 Microsoft Corporation
|
|||
|
||||
Module Name:
|
||||
|
||||
ackr_model_converter.cpp
|
||||
ackr_model_converter.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Mikolas Janota
|
||||
Mikolas Janota
|
||||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"ackr_model_converter.h"
|
||||
#include"model_evaluator.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"ackr_info.h"
|
||||
#include "ackermannization/ackr_model_converter.h"
|
||||
#include "model/model_evaluator.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
|
||||
|
||||
class ackr_model_converter : public model_converter {
|
||||
public:
|
||||
ackr_model_converter(ast_manager & m,
|
||||
const ackr_info_ref& info,
|
||||
model_ref& abstr_model)
|
||||
const ackr_info_ref& info,
|
||||
model_ref& abstr_model)
|
||||
: m(m)
|
||||
, info(info)
|
||||
, abstr_model(abstr_model)
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
{ }
|
||||
|
||||
ackr_model_converter(ast_manager & m,
|
||||
const ackr_info_ref& info)
|
||||
const ackr_info_ref& info)
|
||||
: m(m)
|
||||
, info(info)
|
||||
, fixed_model(false)
|
||||
|
@ -51,8 +51,6 @@ public:
|
|||
|
||||
virtual void operator()(model_ref & md) { operator()(md, 0); }
|
||||
|
||||
//void display(std::ostream & out);
|
||||
|
||||
virtual model_converter * translate(ast_translation & translator) {
|
||||
ackr_info_ref retv_info = info->translate(translator);
|
||||
if (fixed_model) {
|
||||
|
@ -63,42 +61,45 @@ public:
|
|||
return alloc(ackr_model_converter, translator.to(), retv_info);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
ast_manager& m;
|
||||
ast_manager & m;
|
||||
const ackr_info_ref info;
|
||||
model_ref abstr_model;
|
||||
bool fixed_model;
|
||||
void convert(model * source, model * destination);
|
||||
void add_entry(model_evaluator & evaluator,
|
||||
app* term, expr* value,
|
||||
obj_map<func_decl, func_interp*>& interpretations);
|
||||
app* term, expr* value,
|
||||
obj_map<func_decl, func_interp*>& interpretations);
|
||||
void convert_constants(model * source, model * destination);
|
||||
};
|
||||
|
||||
void ackr_model_converter::convert(model * source, model * destination) {
|
||||
destination->copy_func_interps(*source);
|
||||
destination->copy_usort_interps(*source);
|
||||
convert_constants(source,destination);
|
||||
convert_constants(source, destination);
|
||||
}
|
||||
|
||||
void ackr_model_converter::convert_constants(model * source, model * destination) {
|
||||
TRACE("ackr_model", tout << "converting constants\n";);
|
||||
obj_map<func_decl, func_interp*> interpretations;
|
||||
model_evaluator evaluator(*source);
|
||||
evaluator.set_model_completion(true);
|
||||
for (unsigned i = 0; i < source->get_num_constants(); i++) {
|
||||
func_decl * const c = source->get_constant(i);
|
||||
app * const term = info->find_term(c);
|
||||
expr * value = source->get_const_interp(c);
|
||||
if(!term) {
|
||||
if (!term) {
|
||||
destination->register_decl(c, value);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
add_entry(evaluator, term, value, interpretations);
|
||||
}
|
||||
}
|
||||
|
||||
obj_map<func_decl, func_interp*>::iterator e = interpretations.end();
|
||||
for (obj_map<func_decl, func_interp*>::iterator i = interpretations.begin();
|
||||
i!=e; ++i) {
|
||||
i != e; ++i) {
|
||||
func_decl* const fd = i->m_key;
|
||||
func_interp* const fi = i->get_value();
|
||||
fi->set_else(m.get_some_value(fd->get_range()));
|
||||
|
@ -107,34 +108,40 @@ void ackr_model_converter::convert_constants(model * source, model * destination
|
|||
}
|
||||
|
||||
void ackr_model_converter::add_entry(model_evaluator & evaluator,
|
||||
app* term, expr* value,
|
||||
obj_map<func_decl, func_interp*>& interpretations) {
|
||||
app* term, expr* value,
|
||||
obj_map<func_decl, func_interp*>& interpretations) {
|
||||
TRACE("ackr_model", tout << "add_entry"
|
||||
<< mk_ismt2_pp(term, m, 2)
|
||||
<< "->"
|
||||
<< mk_ismt2_pp(value, m, 2) << "\n";
|
||||
<< mk_ismt2_pp(term, m, 2)
|
||||
<< "->"
|
||||
<< mk_ismt2_pp(value, m, 2) << "\n";
|
||||
);
|
||||
|
||||
func_interp* fi = 0;
|
||||
func_interp * fi = 0;
|
||||
func_decl * const declaration = term->get_decl();
|
||||
const unsigned sz = declaration->get_arity();
|
||||
SASSERT(sz == term->get_num_args());
|
||||
if (!interpretations.find(declaration, fi)) {
|
||||
fi = alloc(func_interp,m,sz);
|
||||
interpretations.insert(declaration, fi);
|
||||
if (!interpretations.find(declaration, fi)) {
|
||||
fi = alloc(func_interp, m, sz);
|
||||
interpretations.insert(declaration, fi);
|
||||
}
|
||||
expr_ref_vector args(m);
|
||||
for (unsigned gi = 0; gi < sz; ++gi) {
|
||||
expr * const arg = term->get_arg(gi);
|
||||
expr_ref aarg(m);
|
||||
info->abstract(arg, aarg);
|
||||
expr_ref arg_value(m);
|
||||
evaluator(aarg,arg_value);
|
||||
args.push_back(arg_value);
|
||||
expr * const arg = term->get_arg(gi);
|
||||
expr_ref aarg(m);
|
||||
info->abstract(arg, aarg);
|
||||
expr_ref arg_value(m);
|
||||
evaluator(aarg, arg_value);
|
||||
args.push_back(arg_value);
|
||||
}
|
||||
if (fi->get_entry(args.c_ptr()) == 0) {
|
||||
TRACE("ackr_model",
|
||||
tout << mk_ismt2_pp(declaration, m) << " args: " << std::endl;
|
||||
for (unsigned i = 0; i < args.size(); i++)
|
||||
tout << mk_ismt2_pp(args.get(i), m) << std::endl;
|
||||
tout << " -> " << mk_ismt2_pp(value, m) << "\n"; );
|
||||
fi->insert_new_entry(args.c_ptr(), value);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
TRACE("ackr_model", tout << "entry already present\n";);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,23 +3,23 @@ Copyright (c) 2015 Microsoft Corporation
|
|||
|
||||
Module Name:
|
||||
|
||||
ackr_model_converter.h
|
||||
ackr_model_converter.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Author:
|
||||
|
||||
Mikolas Janota
|
||||
Mikolas Janota
|
||||
|
||||
Revision History:
|
||||
--*/
|
||||
#ifndef ACKR_MODEL_CONVERTER_H_
|
||||
#define ACKR_MODEL_CONVERTER_H_
|
||||
|
||||
#include"model_converter.h"
|
||||
#include"ackr_info.h"
|
||||
#include "tactic/model_converter.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
|
||||
model_converter * mk_ackr_model_converter(ast_manager & m, const ackr_info_ref& info, model_ref& abstr_model);
|
||||
model_converter * mk_ackr_model_converter(ast_manager & m, const ackr_info_ref& info);
|
||||
model_converter * mk_ackr_model_converter(ast_manager & m, const ackr_info_ref & info, model_ref & abstr_model);
|
||||
model_converter * mk_ackr_model_converter(ast_manager & m, const ackr_info_ref & info);
|
||||
|
||||
#endif /* LACKR_MODEL_CONVERTER_H_ */
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
Revision History:
|
||||
--*/
|
||||
|
||||
#include"lackr.h"
|
||||
#include"ackermannization_params.hpp"
|
||||
#include"tactic.h"
|
||||
#include"lackr_model_constructor.h"
|
||||
#include"ackr_info.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"model_smt2_pp.h"
|
||||
#include "ackermannization/lackr.h"
|
||||
#include "ackermannization/ackermannization_params.hpp"
|
||||
#include "tactic/tactic.h"
|
||||
#include "ackermannization/lackr_model_constructor.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
|
||||
lackr::lackr(ast_manager& m, params_ref p, lackr_stats& st, expr_ref_vector& formulas,
|
||||
solver * uffree_solver)
|
||||
|
|
|
@ -17,17 +17,17 @@
|
|||
#ifndef LACKR_H_
|
||||
#define LACKR_H_
|
||||
|
||||
#include"ackr_info.h"
|
||||
#include"ackr_helper.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"cooperate.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"lbool.h"
|
||||
#include"model.h"
|
||||
#include"solver.h"
|
||||
#include"util.h"
|
||||
#include"tactic_exception.h"
|
||||
#include"goal.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
#include "ackermannization/ackr_helper.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "util/lbool.h"
|
||||
#include "model/model.h"
|
||||
#include "solver/solver.h"
|
||||
#include "util/util.h"
|
||||
#include "tactic/tactic_exception.h"
|
||||
#include "tactic/goal.h"
|
||||
|
||||
struct lackr_stats {
|
||||
lackr_stats() : m_it(0), m_ackrs_sz(0) {}
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"lackr_model_constructor.h"
|
||||
#include"model_evaluator.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"ackr_info.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"bv_rewriter.h"
|
||||
#include"bool_rewriter.h"
|
||||
#include "ackermannization/lackr_model_constructor.h"
|
||||
#include "model/model_evaluator.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "ast/rewriter/bv_rewriter.h"
|
||||
#include "ast/rewriter/bool_rewriter.h"
|
||||
|
||||
struct lackr_model_constructor::imp {
|
||||
public:
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
#ifndef LACKR_MODEL_CONSTRUCTOR_H_
|
||||
#define LACKR_MODEL_CONSTRUCTOR_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"ackr_info.h"
|
||||
#include"ackr_helper.h"
|
||||
#include"model.h"
|
||||
#include "ast/ast.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
#include "ackermannization/ackr_helper.h"
|
||||
#include "model/model.h"
|
||||
|
||||
class lackr_model_constructor {
|
||||
public:
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"lackr_model_converter_lazy.h"
|
||||
#include"model_evaluator.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"ackr_info.h"
|
||||
#include"lackr_model_constructor.h"
|
||||
#include "ackermannization/lackr_model_converter_lazy.h"
|
||||
#include "model/model_evaluator.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
#include "ackermannization/lackr_model_constructor.h"
|
||||
|
||||
class lackr_model_converter_lazy : public model_converter {
|
||||
public:
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#ifndef LACKR_MODEL_CONVERTER_LAZY_H_
|
||||
#define LACKR_MODEL_CONVERTER_LAZY_H_
|
||||
|
||||
#include"model_converter.h"
|
||||
#include"ackr_info.h"
|
||||
#include "tactic/model_converter.h"
|
||||
#include "ackermannization/ackr_info.h"
|
||||
|
||||
model_converter * mk_lackr_model_converter_lazy(ast_manager & m, const ackr_info_ref& info, model_ref& abstr_model);
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ z3_add_component(api
|
|||
api_parsers.cpp
|
||||
api_pb.cpp
|
||||
api_polynomial.cpp
|
||||
api_qe.cpp
|
||||
api_quant.cpp
|
||||
api_rcf.cpp
|
||||
api_seq.cpp
|
||||
|
|
|
@ -17,14 +17,14 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"algebraic_numbers.h"
|
||||
#include"expr2polynomial.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "math/polynomial/algebraic_numbers.h"
|
||||
#include "ast/expr2polynomial.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
|
||||
|
||||
#define CHECK_IS_ALGEBRAIC(ARG, RET) { \
|
||||
|
|
|
@ -15,12 +15,12 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"algebraic_numbers.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "math/polynomial/algebraic_numbers.h"
|
||||
|
||||
#define MK_ARITH_OP(NAME, OP) MK_NARY(NAME, mk_c(c)->get_arith_fid(), OP, SKIP)
|
||||
#define MK_BINARY_ARITH_OP(NAME, OP) MK_BINARY(NAME, mk_c(c)->get_arith_fid(), OP, SKIP)
|
||||
|
|
|
@ -15,11 +15,11 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -34,6 +34,19 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_sort Z3_API Z3_mk_array_sort_n(Z3_context c, unsigned n, Z3_sort const* domain, Z3_sort range) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_array_sort_n(c, n, domain, range);
|
||||
RESET_ERROR_CODE();
|
||||
vector<parameter> params;
|
||||
for (unsigned i = 0; i < n; ++i) params.push_back(parameter(to_sort(domain[i])));
|
||||
params.push_back(parameter(to_sort(range)));
|
||||
sort * ty = mk_c(c)->m().mk_sort(mk_c(c)->get_array_fid(), ARRAY_SORT, params.size(), params.c_ptr());
|
||||
mk_c(c)->save_ast_trail(ty);
|
||||
RETURN_Z3(of_sort(ty));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_mk_select(Z3_context c, Z3_ast a, Z3_ast i) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_select(c, a, i);
|
||||
|
@ -57,6 +70,35 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_mk_select_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_select_n(c, a, n, idxs);
|
||||
RESET_ERROR_CODE();
|
||||
ast_manager & m = mk_c(c)->m();
|
||||
expr * _a = to_expr(a);
|
||||
// expr * _i = to_expr(i);
|
||||
sort * a_ty = m.get_sort(_a);
|
||||
// sort * i_ty = m.get_sort(_i);
|
||||
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<sort> domain;
|
||||
ptr_vector<expr> args;
|
||||
args.push_back(_a);
|
||||
domain.push_back(a_ty);
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
args.push_back(to_expr(idxs[i]));
|
||||
domain.push_back(m.get_sort(to_expr(idxs[i])));
|
||||
}
|
||||
func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_SELECT, 2, a_ty->get_parameters(), domain.size(), domain.c_ptr());
|
||||
app * r = m.mk_app(d, args.size(), args.c_ptr());
|
||||
mk_c(c)->save_ast_trail(r);
|
||||
check_sorts(c, r);
|
||||
RETURN_Z3(of_ast(r));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_mk_store(Z3_context c, Z3_ast a, Z3_ast i, Z3_ast v) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_store(c, a, i, v);
|
||||
|
@ -82,6 +124,37 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_mk_store_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs, Z3_ast v) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_store_n(c, a, n, idxs, v);
|
||||
RESET_ERROR_CODE();
|
||||
ast_manager & m = mk_c(c)->m();
|
||||
expr * _a = to_expr(a);
|
||||
expr * _v = to_expr(v);
|
||||
sort * a_ty = m.get_sort(_a);
|
||||
sort * v_ty = m.get_sort(_v);
|
||||
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<sort> domain;
|
||||
ptr_vector<expr> args;
|
||||
args.push_back(_a);
|
||||
domain.push_back(a_ty);
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
args.push_back(to_expr(idxs[i]));
|
||||
domain.push_back(m.get_sort(to_expr(idxs[i])));
|
||||
}
|
||||
args.push_back(_v);
|
||||
domain.push_back(v_ty);
|
||||
func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_STORE, 2, a_ty->get_parameters(), domain.size(), domain.c_ptr());
|
||||
app * r = m.mk_app(d, args.size(), args.c_ptr());
|
||||
mk_c(c)->save_ast_trail(r);
|
||||
check_sorts(c, r);
|
||||
RETURN_Z3(of_ast(r));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_mk_map(Z3_context c, Z3_func_decl f, unsigned n, Z3_ast const* args) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_map(c, f, n, args);
|
||||
|
@ -188,6 +261,18 @@ extern "C" {
|
|||
MK_BINARY(Z3_mk_set_subset, mk_c(c)->get_array_fid(), OP_SET_SUBSET, SKIP);
|
||||
MK_BINARY(Z3_mk_array_ext, mk_c(c)->get_array_fid(), OP_ARRAY_EXT, SKIP);
|
||||
|
||||
Z3_ast Z3_API Z3_mk_as_array(Z3_context c, Z3_func_decl f) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_as_array(c, f);
|
||||
RESET_ERROR_CODE();
|
||||
ast_manager & m = mk_c(c)->m();
|
||||
array_util a(m);
|
||||
app * r = a.mk_as_array(to_func_decl(f));
|
||||
mk_c(c)->save_ast_trail(r);
|
||||
return of_ast(r);
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_mk_set_member(Z3_context c, Z3_ast elem, Z3_ast set) {
|
||||
return Z3_mk_select(c, set, elem);
|
||||
}
|
||||
|
@ -222,7 +307,8 @@ extern "C" {
|
|||
CHECK_VALID_AST(t, 0);
|
||||
if (to_sort(t)->get_family_id() == mk_c(c)->get_array_fid() &&
|
||||
to_sort(t)->get_decl_kind() == ARRAY_SORT) {
|
||||
Z3_sort r = reinterpret_cast<Z3_sort>(to_sort(t)->get_parameter(1).get_ast());
|
||||
unsigned n = to_sort(t)->get_num_parameters();
|
||||
Z3_sort r = reinterpret_cast<Z3_sort>(to_sort(t)->get_parameter(n-1).get_ast());
|
||||
RETURN_Z3(r);
|
||||
}
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
|
|
|
@ -16,28 +16,28 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"well_sorted.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"pb_decl_plugin.h"
|
||||
#include"ast_translation.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include"ast_smt_pp.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"var_subst.h"
|
||||
#include"expr_safe_replace.h"
|
||||
#include"pp.h"
|
||||
#include"scoped_ctrl_c.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include"pp_params.hpp"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/well_sorted.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/pb_decl_plugin.h"
|
||||
#include "ast/ast_translation.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "ast/ast_smt_pp.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "ast/rewriter/var_subst.h"
|
||||
#include "ast/rewriter/expr_safe_replace.h"
|
||||
#include "ast/pp.h"
|
||||
#include "util/scoped_ctrl_c.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "ast/pp_params.hpp"
|
||||
|
||||
extern bool is_numeral_sort(Z3_context c, Z3_sort ty);
|
||||
|
||||
|
@ -1204,16 +1204,8 @@ extern "C" {
|
|||
case OP_FPA_TO_SBV: return Z3_OP_FPA_TO_SBV;
|
||||
case OP_FPA_TO_REAL: return Z3_OP_FPA_TO_REAL;
|
||||
case OP_FPA_TO_IEEE_BV: return Z3_OP_FPA_TO_IEEE_BV;
|
||||
case OP_FPA_INTERNAL_MIN_I: return Z3_OP_FPA_MIN_I;
|
||||
case OP_FPA_INTERNAL_MAX_I: return Z3_OP_FPA_MAX_I;
|
||||
case OP_FPA_INTERNAL_BV2RM:
|
||||
case OP_FPA_INTERNAL_BVWRAP:
|
||||
case OP_FPA_INTERNAL_MIN_UNSPECIFIED:
|
||||
case OP_FPA_INTERNAL_MAX_UNSPECIFIED:
|
||||
case OP_FPA_INTERNAL_TO_UBV_UNSPECIFIED:
|
||||
case OP_FPA_INTERNAL_TO_SBV_UNSPECIFIED:
|
||||
case OP_FPA_INTERNAL_TO_REAL_UNSPECIFIED:
|
||||
case OP_FPA_INTERNAL_TO_IEEE_BV_UNSPECIFIED:
|
||||
case OP_FPA_BVWRAP: return Z3_OP_FPA_BVWRAP;
|
||||
case OP_FPA_BV2RM: return Z3_OP_FPA_BV2RM;
|
||||
return Z3_OP_UNINTERPRETED;
|
||||
default:
|
||||
return Z3_OP_INTERNAL;
|
||||
|
|
|
@ -16,13 +16,13 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_ast_map.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"dec_ref_util.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_ast_map.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "util/dec_ref_util.h"
|
||||
|
||||
Z3_ast_map_ref::~Z3_ast_map_ref() {
|
||||
dec_ref_key_values(m, m_map);
|
||||
|
|
|
@ -18,8 +18,8 @@ Revision History:
|
|||
#ifndef API_AST_MAP_H_
|
||||
#define API_AST_MAP_H_
|
||||
|
||||
#include"api_util.h"
|
||||
#include"obj_hashtable.h"
|
||||
#include "api/api_util.h"
|
||||
#include "util/obj_hashtable.h"
|
||||
|
||||
struct Z3_ast_map_ref : public api::object {
|
||||
ast_manager & m;
|
||||
|
|
|
@ -16,12 +16,12 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"ast_translation.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "ast/ast_translation.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Revision History:
|
|||
#ifndef API_AST_VECTOR_H_
|
||||
#define API_AST_VECTOR_H_
|
||||
|
||||
#include"api_util.h"
|
||||
#include "api/api_util.h"
|
||||
|
||||
namespace api {
|
||||
class context;
|
||||
|
|
|
@ -15,11 +15,11 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
|
@ -15,16 +15,16 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_context.h"
|
||||
#include"pp.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_util.h"
|
||||
#include"cmd_context.h"
|
||||
#include"symbol.h"
|
||||
#include"gparams.h"
|
||||
#include"env_params.h"
|
||||
#include"context_params.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_context.h"
|
||||
#include "ast/pp.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_util.h"
|
||||
#include "cmd_context/cmd_context.h"
|
||||
#include "util/symbol.h"
|
||||
#include "util/gparams.h"
|
||||
#include "util/env_params.h"
|
||||
#include "cmd_context/context_params.h"
|
||||
|
||||
extern "C" {
|
||||
void Z3_API Z3_global_param_set(Z3_string param_id, Z3_string param_value) {
|
||||
|
|
|
@ -18,15 +18,15 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<typeinfo>
|
||||
#include"api_context.h"
|
||||
#include"smtparser.h"
|
||||
#include"version.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_util.h"
|
||||
#include"reg_decl_plugins.h"
|
||||
#include"realclosure.h"
|
||||
#include "api/api_context.h"
|
||||
#include "parsers/smt/smtparser.h"
|
||||
#include "util/version.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/reg_decl_plugins.h"
|
||||
#include "math/realclosure/realclosure.h"
|
||||
|
||||
// The install_tactics procedure is automatically generated
|
||||
void install_tactics(tactic_manager & ctx);
|
||||
|
@ -142,7 +142,7 @@ namespace api {
|
|||
#pragma omp critical (set_interruptable)
|
||||
{
|
||||
if (m_interruptable)
|
||||
(*m_interruptable)();
|
||||
(*m_interruptable)(API_INTERRUPT_EH_CALLER);
|
||||
m_limit.cancel();
|
||||
m().limit().cancel();
|
||||
}
|
||||
|
@ -150,8 +150,9 @@ namespace api {
|
|||
|
||||
void context::set_error_code(Z3_error_code err) {
|
||||
m_error_code = err;
|
||||
if (err != Z3_OK)
|
||||
if (err != Z3_OK) {
|
||||
invoke_error_handler(err);
|
||||
}
|
||||
}
|
||||
|
||||
void context::check_searching() {
|
||||
|
|
|
@ -20,22 +20,22 @@ Revision History:
|
|||
#ifndef API_CONTEXT_H_
|
||||
#define API_CONTEXT_H_
|
||||
|
||||
#include"z3.h"
|
||||
#include"ast.h"
|
||||
#include"api_util.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"seq_decl_plugin.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include"dl_decl_plugin.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
#include"smt_kernel.h"
|
||||
#include"smt_params.h"
|
||||
#include"event_handler.h"
|
||||
#include"tactic_manager.h"
|
||||
#include"context_params.h"
|
||||
#include"api_polynomial.h"
|
||||
#include"hashtable.h"
|
||||
#include "api/z3.h"
|
||||
#include "ast/ast.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/seq_decl_plugin.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "ast/dl_decl_plugin.h"
|
||||
#include "ast/fpa_decl_plugin.h"
|
||||
#include "smt/smt_kernel.h"
|
||||
#include "smt/params/smt_params.h"
|
||||
#include "util/event_handler.h"
|
||||
#include "cmd_context/tactic_manager.h"
|
||||
#include "cmd_context/context_params.h"
|
||||
#include "api/api_polynomial.h"
|
||||
#include "util/hashtable.h"
|
||||
|
||||
namespace smtlib {
|
||||
class parser;
|
||||
|
|
|
@ -15,24 +15,24 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"api_datalog.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"ast_pp.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_stats.h"
|
||||
#include"datalog_parser.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include"dl_cmds.h"
|
||||
#include"cmd_context.h"
|
||||
#include"smt2parser.h"
|
||||
#include"dl_context.h"
|
||||
#include"dl_register_engine.h"
|
||||
#include"dl_external_relation.h"
|
||||
#include"dl_decl_plugin.h"
|
||||
#include"rel_context.h"
|
||||
#include "api/api_datalog.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_stats.h"
|
||||
#include "muz/fp/datalog_parser.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "muz/fp/dl_cmds.h"
|
||||
#include "cmd_context/cmd_context.h"
|
||||
#include "parsers/smt2/smt2parser.h"
|
||||
#include "muz/base/dl_context.h"
|
||||
#include "muz/fp/dl_register_engine.h"
|
||||
#include "muz/rel/dl_external_relation.h"
|
||||
#include "ast/dl_decl_plugin.h"
|
||||
#include "muz/rel/rel_context.h"
|
||||
|
||||
namespace api {
|
||||
|
||||
|
@ -605,5 +605,6 @@ extern "C" {
|
|||
|
||||
}
|
||||
|
||||
#include "api_datalog_spacer.inc"
|
||||
|
||||
};
|
||||
|
|
|
@ -19,11 +19,11 @@ Revision History:
|
|||
#ifndef API_DATALOG_H_
|
||||
#define API_DATALOG_H_
|
||||
|
||||
#include"z3.h"
|
||||
#include"ast.h"
|
||||
#include"smt_params.h"
|
||||
#include"smt_kernel.h"
|
||||
#include"api_util.h"
|
||||
#include "api/z3.h"
|
||||
#include "ast/ast.h"
|
||||
#include "smt/params/smt_params.h"
|
||||
#include "smt/smt_kernel.h"
|
||||
#include "api/api_util.h"
|
||||
|
||||
typedef void (*reduce_app_callback_fptr)(void*, func_decl*, unsigned, expr*const*, expr**);
|
||||
typedef void (*reduce_assign_callback_fptr)(void*, func_decl*, unsigned, expr*const*, unsigned, expr*const*);
|
||||
|
|
113
src/api/api_datalog_spacer.inc
Normal file
113
src/api/api_datalog_spacer.inc
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Arie Gurfinkel
|
||||
|
||||
Module Name:
|
||||
|
||||
api_datalog_spacer.inc
|
||||
|
||||
Abstract:
|
||||
|
||||
Spacer-specific datalog API
|
||||
|
||||
Author:
|
||||
|
||||
Arie Gurfinkel (arie)
|
||||
|
||||
Notes:
|
||||
this file is included at the bottom of api_datalog.cpp
|
||||
|
||||
--*/
|
||||
Z3_lbool Z3_API Z3_fixedpoint_query_from_lvl (Z3_context c, Z3_fixedpoint d, Z3_ast q, unsigned lvl) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_fixedpoint_query_from_lvl (c, d, q, lvl);
|
||||
RESET_ERROR_CODE();
|
||||
lbool r = l_undef;
|
||||
unsigned timeout = to_fixedpoint(d)->m_params.get_uint("timeout", mk_c(c)->get_timeout());
|
||||
unsigned rlimit = to_fixedpoint(d)->m_params.get_uint("rlimit", mk_c(c)->get_rlimit());
|
||||
{
|
||||
scoped_rlimit _rlimit(mk_c(c)->m().limit(), rlimit);
|
||||
cancel_eh<reslimit> eh(mk_c(c)->m().limit());
|
||||
api::context::set_interruptable si(*(mk_c(c)), eh);
|
||||
scoped_timer timer(timeout, &eh);
|
||||
try {
|
||||
r = to_fixedpoint_ref(d)->ctx().query_from_lvl (to_expr(q), lvl);
|
||||
}
|
||||
catch (z3_exception& ex) {
|
||||
mk_c(c)->handle_exception(ex);
|
||||
r = l_undef;
|
||||
}
|
||||
to_fixedpoint_ref(d)->ctx().cleanup();
|
||||
}
|
||||
return of_lbool(r);
|
||||
Z3_CATCH_RETURN(Z3_L_UNDEF);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_fixedpoint_get_ground_sat_answer(Z3_context c, Z3_fixedpoint d) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_fixedpoint_get_ground_sat_answer(c, d);
|
||||
RESET_ERROR_CODE();
|
||||
expr* e = to_fixedpoint_ref(d)->ctx().get_ground_sat_answer();
|
||||
mk_c(c)->save_ast_trail(e);
|
||||
RETURN_Z3(of_expr(e));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast_vector Z3_API Z3_fixedpoint_get_rules_along_trace(
|
||||
Z3_context c,
|
||||
Z3_fixedpoint d)
|
||||
{
|
||||
Z3_TRY;
|
||||
LOG_Z3_fixedpoint_get_rules_along_trace(c, d);
|
||||
ast_manager& m = mk_c(c)->m();
|
||||
Z3_ast_vector_ref* v = alloc(Z3_ast_vector_ref, *mk_c(c), m);
|
||||
mk_c(c)->save_object(v);
|
||||
expr_ref_vector rules(m);
|
||||
svector<symbol> names;
|
||||
|
||||
to_fixedpoint_ref(d)->ctx().get_rules_along_trace_as_formulas(rules, names);
|
||||
for (unsigned i = 0; i < rules.size(); ++i) {
|
||||
v->m_ast_vector.push_back(rules[i].get());
|
||||
}
|
||||
RETURN_Z3(of_ast_vector(v));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_symbol Z3_API Z3_fixedpoint_get_rule_names_along_trace(
|
||||
Z3_context c,
|
||||
Z3_fixedpoint d)
|
||||
{
|
||||
Z3_TRY;
|
||||
LOG_Z3_fixedpoint_get_rule_names_along_trace(c, d);
|
||||
ast_manager& m = mk_c(c)->m();
|
||||
Z3_ast_vector_ref* v = alloc(Z3_ast_vector_ref, *mk_c(c), m);
|
||||
mk_c(c)->save_object(v);
|
||||
expr_ref_vector rules(m);
|
||||
svector<symbol> names;
|
||||
std::stringstream ss;
|
||||
|
||||
to_fixedpoint_ref(d)->ctx().get_rules_along_trace_as_formulas(rules, names);
|
||||
for (unsigned i = 0; i < names.size(); ++i) {
|
||||
ss << ";" << names[i].str();
|
||||
}
|
||||
RETURN_Z3(of_symbol(symbol(ss.str().substr(1).c_str())));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
void Z3_API Z3_fixedpoint_add_invariant(Z3_context c, Z3_fixedpoint d, Z3_func_decl pred, Z3_ast property) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_fixedpoint_add_invariant(c, d, pred, property);
|
||||
RESET_ERROR_CODE();
|
||||
to_fixedpoint_ref(d)->ctx ().add_invariant(to_func_decl(pred), to_expr(property));
|
||||
Z3_CATCH;
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_fixedpoint_get_reachable(Z3_context c, Z3_fixedpoint d, Z3_func_decl pred) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_fixedpoint_get_reachable(c, d, pred);
|
||||
RESET_ERROR_CODE();
|
||||
expr_ref r = to_fixedpoint_ref(d)->ctx().get_reachable(to_func_decl(pred));
|
||||
mk_c(c)->save_ast_trail(r);
|
||||
RETURN_Z3(of_expr(r.get()));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
|
@ -15,11 +15,11 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -45,13 +45,13 @@ extern "C" {
|
|||
|
||||
ptr_vector<accessor_decl> acc;
|
||||
for (unsigned i = 0; i < num_fields; ++i) {
|
||||
acc.push_back(mk_accessor_decl(to_symbol(field_names[i]), type_ref(to_sort(field_sorts[i]))));
|
||||
acc.push_back(mk_accessor_decl(m, to_symbol(field_names[i]), type_ref(to_sort(field_sorts[i]))));
|
||||
}
|
||||
|
||||
constructor_decl* constrs[1] = { mk_constructor_decl(to_symbol(name), recognizer, acc.size(), acc.c_ptr()) };
|
||||
|
||||
{
|
||||
datatype_decl * dt = mk_datatype_decl(to_symbol(name), 1, constrs);
|
||||
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, 1, constrs);
|
||||
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, 0, tuples);
|
||||
del_datatype_decl(dt);
|
||||
|
||||
|
@ -69,18 +69,13 @@ extern "C" {
|
|||
// create constructor
|
||||
SASSERT(dt_util.is_datatype(tuple));
|
||||
SASSERT(!dt_util.is_recursive(tuple));
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(tuple);
|
||||
func_decl* decl = (*decls)[0];
|
||||
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(tuple);
|
||||
func_decl* decl = (decls)[0];
|
||||
mk_c(c)->save_multiple_ast_trail(decl);
|
||||
*mk_tuple_decl = of_func_decl(decl);
|
||||
|
||||
// Create projections
|
||||
ptr_vector<func_decl> const * accs = dt_util.get_constructor_accessors(decl);
|
||||
if (!accs) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<func_decl> const & _accs = *accs;
|
||||
ptr_vector<func_decl> const & _accs = *dt_util.get_constructor_accessors(decl);
|
||||
SASSERT(_accs.size() == num_fields);
|
||||
for (unsigned i = 0; i < _accs.size(); i++) {
|
||||
mk_c(c)->save_multiple_ast_trail(_accs[i]);
|
||||
|
@ -118,7 +113,7 @@ extern "C" {
|
|||
|
||||
|
||||
{
|
||||
datatype_decl * dt = mk_datatype_decl(to_symbol(name), n, constrs.c_ptr());
|
||||
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, 0, n, constrs.c_ptr());
|
||||
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, 0, sorts);
|
||||
del_datatype_decl(dt);
|
||||
|
||||
|
@ -136,10 +131,10 @@ extern "C" {
|
|||
// create constructor
|
||||
SASSERT(dt_util.is_datatype(e));
|
||||
SASSERT(!dt_util.is_recursive(e));
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(e);
|
||||
SASSERT(decls && decls->size() == n);
|
||||
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(e);
|
||||
SASSERT(decls.size() == n);
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
func_decl* decl = (*decls)[i];
|
||||
func_decl* decl = (decls)[i];
|
||||
mk_c(c)->save_multiple_ast_trail(decl);
|
||||
enum_consts[i] = of_func_decl(decl);
|
||||
decl = dt_util.get_constructor_recognizer(decl);
|
||||
|
@ -165,11 +160,12 @@ extern "C" {
|
|||
LOG_Z3_mk_list_sort(c, name, elem_sort, nil_decl, is_nil_decl, cons_decl, is_cons_decl, head_decl, tail_decl);
|
||||
RESET_ERROR_CODE();
|
||||
ast_manager& m = mk_c(c)->m();
|
||||
datatype_util& dt_util = mk_c(c)->dtutil();
|
||||
mk_c(c)->reset_last_result();
|
||||
datatype_util data_util(m);
|
||||
accessor_decl* head_tail[2] = {
|
||||
mk_accessor_decl(symbol("head"), type_ref(to_sort(elem_sort))),
|
||||
mk_accessor_decl(symbol("tail"), type_ref(0))
|
||||
mk_accessor_decl(m, symbol("head"), type_ref(to_sort(elem_sort))),
|
||||
mk_accessor_decl(m, symbol("tail"), type_ref(0))
|
||||
};
|
||||
constructor_decl* constrs[2] = {
|
||||
mk_constructor_decl(symbol("nil"), symbol("is_nil"), 0, 0),
|
||||
|
@ -179,7 +175,7 @@ extern "C" {
|
|||
|
||||
sort_ref_vector sorts(m);
|
||||
{
|
||||
datatype_decl * decl = mk_datatype_decl(to_symbol(name), 2, constrs);
|
||||
datatype_decl * decl = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, 2, constrs);
|
||||
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &decl, 0, 0, sorts);
|
||||
del_datatype_decl(decl);
|
||||
|
||||
|
@ -215,18 +211,16 @@ extern "C" {
|
|||
*is_cons_decl = of_func_decl(f);
|
||||
}
|
||||
if (head_decl) {
|
||||
ptr_vector<func_decl> const* acc = data_util.get_constructor_accessors(cnstrs[1]);
|
||||
SASSERT(acc);
|
||||
SASSERT(acc->size() == 2);
|
||||
f = (*acc)[0];
|
||||
ptr_vector<func_decl> const& acc = *data_util.get_constructor_accessors(cnstrs[1]);
|
||||
SASSERT(acc.size() == 2);
|
||||
f = (acc)[0];
|
||||
mk_c(c)->save_multiple_ast_trail(f);
|
||||
*head_decl = of_func_decl(f);
|
||||
}
|
||||
if (tail_decl) {
|
||||
ptr_vector<func_decl> const* acc = data_util.get_constructor_accessors(cnstrs[1]);
|
||||
SASSERT(acc);
|
||||
SASSERT(acc->size() == 2);
|
||||
f = (*acc)[1];
|
||||
ptr_vector<func_decl> const& acc = *data_util.get_constructor_accessors(cnstrs[1]);
|
||||
SASSERT(acc.size() == 2);
|
||||
f = (acc)[1];
|
||||
mk_c(c)->save_multiple_ast_trail(f);
|
||||
*tail_decl = of_func_decl(f);
|
||||
}
|
||||
|
@ -301,13 +295,9 @@ extern "C" {
|
|||
*tester = of_func_decl(f2);
|
||||
}
|
||||
|
||||
ptr_vector<func_decl> const* accs = data_util.get_constructor_accessors(f);
|
||||
if (!accs && num_fields > 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return;
|
||||
}
|
||||
ptr_vector<func_decl> const& accs = *data_util.get_constructor_accessors(f);
|
||||
for (unsigned i = 0; i < num_fields; ++i) {
|
||||
func_decl* f2 = (*accs)[i];
|
||||
func_decl* f2 = (accs)[i];
|
||||
mk_c(c)->save_multiple_ast_trail(f2);
|
||||
accessors[i] = of_func_decl(f2);
|
||||
}
|
||||
|
@ -327,21 +317,23 @@ extern "C" {
|
|||
Z3_symbol name,
|
||||
unsigned num_constructors,
|
||||
Z3_constructor constructors[]) {
|
||||
datatype_util& dt_util = mk_c(c)->dtutil();
|
||||
ast_manager& m = mk_c(c)->m();
|
||||
ptr_vector<constructor_decl> constrs;
|
||||
for (unsigned i = 0; i < num_constructors; ++i) {
|
||||
constructor* cn = reinterpret_cast<constructor*>(constructors[i]);
|
||||
ptr_vector<accessor_decl> acc;
|
||||
for (unsigned j = 0; j < cn->m_sorts.size(); ++j) {
|
||||
if (cn->m_sorts[j].get()) {
|
||||
acc.push_back(mk_accessor_decl(cn->m_field_names[j], type_ref(cn->m_sorts[j].get())));
|
||||
acc.push_back(mk_accessor_decl(m, cn->m_field_names[j], type_ref(cn->m_sorts[j].get())));
|
||||
}
|
||||
else {
|
||||
acc.push_back(mk_accessor_decl(cn->m_field_names[j], type_ref(cn->m_sort_refs[j])));
|
||||
acc.push_back(mk_accessor_decl(m, cn->m_field_names[j], type_ref(cn->m_sort_refs[j])));
|
||||
}
|
||||
}
|
||||
constrs.push_back(mk_constructor_decl(cn->m_name, cn->m_tester, acc.size(), acc.c_ptr()));
|
||||
}
|
||||
return mk_datatype_decl(to_symbol(name), num_constructors, constrs.c_ptr());
|
||||
return mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, num_constructors, constrs.c_ptr());
|
||||
}
|
||||
|
||||
Z3_sort Z3_API Z3_mk_datatype(Z3_context c,
|
||||
|
@ -368,11 +360,11 @@ extern "C" {
|
|||
sort * s = sorts.get(0);
|
||||
|
||||
mk_c(c)->save_ast_trail(s);
|
||||
ptr_vector<func_decl> const* cnstrs = data_util.get_datatype_constructors(s);
|
||||
ptr_vector<func_decl> const& cnstrs = *data_util.get_datatype_constructors(s);
|
||||
|
||||
for (unsigned i = 0; i < num_constructors; ++i) {
|
||||
constructor* cn = reinterpret_cast<constructor*>(constructors[i]);
|
||||
cn->m_constructor = (*cnstrs)[i];
|
||||
cn->m_constructor = cnstrs[i];
|
||||
}
|
||||
RETURN_Z3_mk_datatype(of_sort(s));
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -417,7 +409,7 @@ extern "C" {
|
|||
ptr_vector<datatype_decl> datas;
|
||||
for (unsigned i = 0; i < num_sorts; ++i) {
|
||||
constructor_list* cl = reinterpret_cast<constructor_list*>(constructor_lists[i]);
|
||||
datas.push_back(mk_datatype_decl(c,sort_names[i], cl->size(), reinterpret_cast<Z3_constructor*>(cl->c_ptr())));
|
||||
datas.push_back(mk_datatype_decl(c, sort_names[i], cl->size(), reinterpret_cast<Z3_constructor*>(cl->c_ptr())));
|
||||
}
|
||||
sort_ref_vector _sorts(m);
|
||||
bool ok = mk_c(c)->get_dt_plugin()->mk_datatypes(datas.size(), datas.c_ptr(), 0, 0, _sorts);
|
||||
|
@ -434,10 +426,10 @@ extern "C" {
|
|||
mk_c(c)->save_multiple_ast_trail(s);
|
||||
sorts[i] = of_sort(s);
|
||||
constructor_list* cl = reinterpret_cast<constructor_list*>(constructor_lists[i]);
|
||||
ptr_vector<func_decl> const* cnstrs = data_util.get_datatype_constructors(s);
|
||||
ptr_vector<func_decl> const& cnstrs = *data_util.get_datatype_constructors(s);
|
||||
for (unsigned j = 0; j < cl->size(); ++j) {
|
||||
constructor* cn = (*cl)[j];
|
||||
cn->m_constructor = (*cnstrs)[j];
|
||||
cn->m_constructor = cnstrs[j];
|
||||
}
|
||||
}
|
||||
RETURN_Z3_mk_datatypes;
|
||||
|
@ -456,12 +448,7 @@ extern "C" {
|
|||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return 0;
|
||||
}
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(_t);
|
||||
if (!decls) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return 0;
|
||||
}
|
||||
return decls->size();
|
||||
return dt_util.get_datatype_constructors(_t)->size();
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -474,12 +461,12 @@ extern "C" {
|
|||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return 0;
|
||||
}
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(_t);
|
||||
if (!decls || idx >= decls->size()) {
|
||||
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
|
||||
if (idx >= decls.size()) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return 0;
|
||||
}
|
||||
func_decl* decl = (*decls)[idx];
|
||||
func_decl* decl = (decls)[idx];
|
||||
mk_c(c)->save_ast_trail(decl);
|
||||
return of_func_decl(decl);
|
||||
}
|
||||
|
@ -504,12 +491,12 @@ extern "C" {
|
|||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(_t);
|
||||
if (!decls || idx >= decls->size()) {
|
||||
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
|
||||
if (idx >= decls.size()) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
func_decl* decl = (*decls)[idx];
|
||||
func_decl* decl = (decls)[idx];
|
||||
decl = dt_util.get_constructor_recognizer(decl);
|
||||
mk_c(c)->save_ast_trail(decl);
|
||||
RETURN_Z3(of_func_decl(decl));
|
||||
|
@ -527,23 +514,23 @@ extern "C" {
|
|||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(_t);
|
||||
if (!decls || idx_c >= decls->size()) {
|
||||
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
|
||||
if (idx_c >= decls.size()) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return 0;
|
||||
}
|
||||
func_decl* decl = (*decls)[idx_c];
|
||||
func_decl* decl = (decls)[idx_c];
|
||||
if (decl->get_arity() <= idx_a) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<func_decl> const * accs = dt_util.get_constructor_accessors(decl);
|
||||
SASSERT(accs && accs->size() == decl->get_arity());
|
||||
if (!accs || accs->size() <= idx_a) {
|
||||
ptr_vector<func_decl> const & accs = *dt_util.get_constructor_accessors(decl);
|
||||
SASSERT(accs.size() == decl->get_arity());
|
||||
if (accs.size() <= idx_a) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
decl = (*accs)[idx_a];
|
||||
decl = (accs)[idx_a];
|
||||
mk_c(c)->save_ast_trail(decl);
|
||||
RETURN_Z3(of_func_decl(decl));
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -574,16 +561,13 @@ extern "C" {
|
|||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return 0;
|
||||
}
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(tuple);
|
||||
if (!decls || decls->size() != 1) {
|
||||
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(tuple);
|
||||
if (decls.size() != 1) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
return 0;
|
||||
}
|
||||
ptr_vector<func_decl> const * accs = dt_util.get_constructor_accessors((*decls)[0]);
|
||||
if (!accs) {
|
||||
return 0;
|
||||
}
|
||||
return accs->size();
|
||||
ptr_vector<func_decl> const & accs = *dt_util.get_constructor_accessors(decls[0]);
|
||||
return accs.size();
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -597,21 +581,17 @@ extern "C" {
|
|||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<func_decl> const * decls = dt_util.get_datatype_constructors(tuple);
|
||||
if (!decls || decls->size() != 1) {
|
||||
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(tuple);
|
||||
if (decls.size() != 1) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
ptr_vector<func_decl> const * accs = dt_util.get_constructor_accessors((*decls)[0]);
|
||||
if (!accs) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
if (accs->size() <= i) {
|
||||
ptr_vector<func_decl> const & accs = *dt_util.get_constructor_accessors((decls)[0]);
|
||||
if (accs.size() <= i) {
|
||||
SET_ERROR_CODE(Z3_IOB);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
func_decl* acc = (*accs)[i];
|
||||
func_decl* acc = (accs)[i];
|
||||
mk_c(c)->save_ast_trail(acc);
|
||||
RETURN_Z3(of_func_decl(acc));
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
|
|
@ -17,10 +17,10 @@ Notes:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "ast/fpa_decl_plugin.h"
|
||||
|
||||
bool is_fp_sort(Z3_context c, Z3_sort s) {
|
||||
return mk_c(c)->fpautil().is_float(to_sort(s));
|
||||
|
|
|
@ -16,11 +16,11 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_goal.h"
|
||||
#include"ast_translation.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_goal.h"
|
||||
#include "ast/ast_translation.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ Revision History:
|
|||
#ifndef API_GOAL_H_
|
||||
#define API_GOAL_H_
|
||||
|
||||
#include"api_util.h"
|
||||
#include"goal.h"
|
||||
#include "api/api_util.h"
|
||||
#include "tactic/goal.h"
|
||||
|
||||
struct Z3_goal_ref : public api::object {
|
||||
goal_ref m_goal;
|
||||
|
|
|
@ -17,27 +17,27 @@
|
|||
--*/
|
||||
#include<sstream>
|
||||
#include<vector>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_tactic.h"
|
||||
#include"api_solver.h"
|
||||
#include"api_model.h"
|
||||
#include"api_stats.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"tactic2solver.h"
|
||||
#include"scoped_ctrl_c.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include"smt_strategic_solver.h"
|
||||
#include"smt_solver.h"
|
||||
#include"smt_implied_equalities.h"
|
||||
#include"iz3interp.h"
|
||||
#include"iz3profiling.h"
|
||||
#include"iz3hash.h"
|
||||
#include"iz3pp.h"
|
||||
#include"iz3checker.h"
|
||||
#include"scoped_proof.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_tactic.h"
|
||||
#include "api/api_solver.h"
|
||||
#include "api/api_model.h"
|
||||
#include "api/api_stats.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "solver/tactic2solver.h"
|
||||
#include "util/scoped_ctrl_c.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "tactic/portfolio/smt_strategic_solver.h"
|
||||
#include "smt/smt_solver.h"
|
||||
#include "smt/smt_implied_equalities.h"
|
||||
#include "interp/iz3interp.h"
|
||||
#include "interp/iz3profiling.h"
|
||||
#include "interp/iz3hash.h"
|
||||
#include "interp/iz3pp.h"
|
||||
#include "interp/iz3checker.h"
|
||||
#include "ast/scoped_proof.h"
|
||||
|
||||
using namespace stl_ext;
|
||||
|
||||
|
@ -249,7 +249,7 @@ extern "C" {
|
|||
params_ref _p;
|
||||
_p.set_bool("proof", true); // this is currently useless
|
||||
|
||||
scoped_proof_mode spm(mk_c(c)->m(), PGM_FINE);
|
||||
scoped_proof_mode spm(mk_c(c)->m(), PGM_ENABLED);
|
||||
scoped_ptr<solver_factory> sf = mk_smt_solver_factory();
|
||||
scoped_ptr<solver> m_solver((*sf)(mk_c(c)->m(), _p, true, true, true, ::symbol::null));
|
||||
m_solver.get()->updt_params(_p); // why do we have to do this?
|
||||
|
|
|
@ -16,10 +16,10 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<fstream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"util.h"
|
||||
#include"version.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "util/util.h"
|
||||
#include "util/version.h"
|
||||
|
||||
std::ostream * g_z3_log = 0;
|
||||
bool g_z3_log_enabled = false;
|
||||
|
|
|
@ -16,20 +16,31 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_model.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"model.h"
|
||||
#include"model_v2_pp.h"
|
||||
#include"model_smt2_pp.h"
|
||||
#include"model_params.hpp"
|
||||
#include"model_evaluator_params.hpp"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_model.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "model/model.h"
|
||||
#include "model/model_v2_pp.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "model/model_params.hpp"
|
||||
#include "model/model_evaluator_params.hpp"
|
||||
|
||||
extern "C" {
|
||||
|
||||
Z3_model Z3_API Z3_mk_model(Z3_context c) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_model(c);
|
||||
RESET_ERROR_CODE();
|
||||
Z3_model_ref * m_ref = alloc(Z3_model_ref, *mk_c(c));
|
||||
m_ref->m_model = alloc(model, mk_c(c)->m());
|
||||
mk_c(c)->save_object(m_ref);
|
||||
RETURN_Z3(of_model(m_ref));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
void Z3_API Z3_model_inc_ref(Z3_context c, Z3_model m) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_model_inc_ref(c, m);
|
||||
|
@ -224,6 +235,36 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_func_interp Z3_API Z3_add_func_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast else_val) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_add_func_interp(c, m, f, else_val);
|
||||
RESET_ERROR_CODE();
|
||||
func_decl* d = to_func_decl(f);
|
||||
model* mdl = to_model_ref(m);
|
||||
Z3_func_interp_ref * f_ref = alloc(Z3_func_interp_ref, *mk_c(c), mdl);
|
||||
f_ref->m_func_interp = alloc(func_interp, mk_c(c)->m(), d->get_arity());
|
||||
mk_c(c)->save_object(f_ref);
|
||||
mdl->register_decl(d, f_ref->m_func_interp);
|
||||
f_ref->m_func_interp->set_else(to_expr(else_val));
|
||||
RETURN_Z3(of_func_interp(f_ref));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
void Z3_API Z3_add_const_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast a) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_add_const_interp(c, m, f, a);
|
||||
RESET_ERROR_CODE();
|
||||
func_decl* d = to_func_decl(f);
|
||||
if (d->get_arity() != 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
}
|
||||
else {
|
||||
model* mdl = to_model_ref(m);
|
||||
mdl->register_decl(d, to_expr(a));
|
||||
}
|
||||
Z3_CATCH;
|
||||
}
|
||||
|
||||
void Z3_API Z3_func_interp_inc_ref(Z3_context c, Z3_func_interp f) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_func_interp_inc_ref(c, f);
|
||||
|
@ -283,6 +324,15 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
void Z3_API Z3_func_interp_set_else(Z3_context c, Z3_func_interp f, Z3_ast else_value) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_func_interp_set_else(c, f, else_value);
|
||||
RESET_ERROR_CODE();
|
||||
// CHECK_NON_NULL(f, 0);
|
||||
to_func_interp_ref(f)->set_else(to_expr(else_value));
|
||||
Z3_CATCH;
|
||||
}
|
||||
|
||||
unsigned Z3_API Z3_func_interp_get_arity(Z3_context c, Z3_func_interp f) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_func_interp_get_arity(c, f);
|
||||
|
@ -292,6 +342,24 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
void Z3_API Z3_func_interp_add_entry(Z3_context c, Z3_func_interp fi, Z3_ast_vector args, Z3_ast value) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_func_interp_add_entry(c, fi, args, value);
|
||||
//CHECK_NON_NULL(fi, void);
|
||||
//CHECK_NON_NULL(args, void);
|
||||
//CHECK_NON_NULL(value, void);
|
||||
func_interp* _fi = to_func_interp_ref(fi);
|
||||
expr* _value = to_expr(value);
|
||||
if (to_ast_vector_ref(args).size() != _fi->get_arity()) {
|
||||
SET_ERROR_CODE(Z3_IOB);
|
||||
return;
|
||||
}
|
||||
// check sorts of value
|
||||
expr* const* _args = (expr* const*) to_ast_vector_ref(args).c_ptr();
|
||||
_fi->insert_entry(_args, _value);
|
||||
Z3_CATCH;
|
||||
}
|
||||
|
||||
void Z3_API Z3_func_entry_inc_ref(Z3_context c, Z3_func_entry e) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_func_entry_inc_ref(c, e);
|
||||
|
|
|
@ -18,8 +18,8 @@ Revision History:
|
|||
#ifndef API_MODEL_H_
|
||||
#define API_MODEL_H_
|
||||
|
||||
#include"api_util.h"
|
||||
#include"model.h"
|
||||
#include "api/api_util.h"
|
||||
#include "model/model.h"
|
||||
|
||||
struct Z3_model_ref : public api::object {
|
||||
model_ref m_model;
|
||||
|
|
|
@ -16,14 +16,14 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"algebraic_numbers.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "math/polynomial/algebraic_numbers.h"
|
||||
#include "ast/fpa_decl_plugin.h"
|
||||
|
||||
bool is_numeral_sort(Z3_context c, Z3_sort ty) {
|
||||
sort * _ty = to_sort(ty);
|
||||
|
|
|
@ -16,18 +16,18 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_stats.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"api_model.h"
|
||||
#include"opt_context.h"
|
||||
#include"opt_cmds.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include"smt2parser.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_stats.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "api/api_model.h"
|
||||
#include "opt/opt_context.h"
|
||||
#include "opt/opt_cmds.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "parsers/smt2/smt2parser.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -283,15 +283,16 @@ extern "C" {
|
|||
Z3_optimize opt,
|
||||
std::istream& s) {
|
||||
ast_manager& m = mk_c(c)->m();
|
||||
cmd_context ctx(false, &m);
|
||||
install_opt_cmds(ctx, to_optimize_ptr(opt));
|
||||
ctx.set_ignore_check(true);
|
||||
if (!parse_smt2_commands(ctx, s)) {
|
||||
scoped_ptr<cmd_context> ctx = alloc(cmd_context, false, &m);
|
||||
install_opt_cmds(*ctx.get(), to_optimize_ptr(opt));
|
||||
ctx->set_ignore_check(true);
|
||||
if (!parse_smt2_commands(*ctx.get(), s)) {
|
||||
ctx = nullptr;
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
return;
|
||||
}
|
||||
ptr_vector<expr>::const_iterator it = ctx.begin_assertions();
|
||||
ptr_vector<expr>::const_iterator end = ctx.end_assertions();
|
||||
ptr_vector<expr>::const_iterator it = ctx->begin_assertions();
|
||||
ptr_vector<expr>::const_iterator end = ctx->end_assertions();
|
||||
for (; it != end; ++it) {
|
||||
to_optimize_ptr(opt)->add_hard_constraint(*it);
|
||||
}
|
||||
|
@ -320,9 +321,6 @@ extern "C" {
|
|||
std::ostringstream strm;
|
||||
strm << "Could not open file " << s;
|
||||
throw default_exception(strm.str());
|
||||
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
return;
|
||||
}
|
||||
Z3_optimize_from_stream(c, d, is);
|
||||
Z3_CATCH;
|
||||
|
|
|
@ -18,11 +18,11 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"params.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "util/params.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"cmd_context.h"
|
||||
#include"smt2parser.h"
|
||||
#include"smtparser.h"
|
||||
#include"solver_na2as.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "cmd_context/cmd_context.h"
|
||||
#include "parsers/smt2/smt2parser.h"
|
||||
#include "parsers/smt/smtparser.h"
|
||||
#include "solver/solver_na2as.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -56,19 +56,20 @@ extern "C" {
|
|||
Z3_func_decl const decls[]) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_parse_smtlib_string(c, str, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
|
||||
std::ostringstream outs;
|
||||
scoped_ptr<std::ostringstream> outs = alloc(std::ostringstream);
|
||||
bool ok = false;
|
||||
|
||||
RESET_ERROR_CODE();
|
||||
init_smtlib_parser(c, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
|
||||
mk_c(c)->m_smtlib_parser->set_error_stream(outs);
|
||||
mk_c(c)->m_smtlib_parser->set_error_stream(*outs);
|
||||
try {
|
||||
ok = mk_c(c)->m_smtlib_parser->parse_string(str);
|
||||
}
|
||||
catch (...) {
|
||||
ok = false;
|
||||
}
|
||||
mk_c(c)->m_smtlib_error_buffer = outs.str();
|
||||
mk_c(c)->m_smtlib_error_buffer = outs->str();
|
||||
outs = nullptr;
|
||||
if (!ok) {
|
||||
mk_c(c)->reset_parser();
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
|
@ -88,16 +89,17 @@ extern "C" {
|
|||
LOG_Z3_parse_smtlib_file(c, file_name, num_sorts, sort_names, types, num_decls, decl_names, decls);
|
||||
bool ok = false;
|
||||
RESET_ERROR_CODE();
|
||||
std::ostringstream outs;
|
||||
scoped_ptr<std::ostringstream> outs = alloc(std::ostringstream);
|
||||
init_smtlib_parser(c, num_sorts, sort_names, types, num_decls, decl_names, decls);
|
||||
mk_c(c)->m_smtlib_parser->set_error_stream(outs);
|
||||
mk_c(c)->m_smtlib_parser->set_error_stream(*outs);
|
||||
try {
|
||||
ok = mk_c(c)->m_smtlib_parser->parse_file(file_name);
|
||||
}
|
||||
catch(...) {
|
||||
ok = false;
|
||||
}
|
||||
mk_c(c)->m_smtlib_error_buffer = outs.str();
|
||||
mk_c(c)->m_smtlib_error_buffer = outs->str();
|
||||
outs = nullptr;
|
||||
if (!ok) {
|
||||
mk_c(c)->reset_parser();
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
|
@ -260,21 +262,22 @@ extern "C" {
|
|||
Z3_symbol const decl_names[],
|
||||
Z3_func_decl const decls[]) {
|
||||
Z3_TRY;
|
||||
cmd_context ctx(false, &(mk_c(c)->m()));
|
||||
ctx.set_ignore_check(true);
|
||||
scoped_ptr<cmd_context> ctx = alloc(cmd_context, false, &(mk_c(c)->m()));
|
||||
ctx->set_ignore_check(true);
|
||||
for (unsigned i = 0; i < num_decls; ++i) {
|
||||
ctx.insert(to_symbol(decl_names[i]), to_func_decl(decls[i]));
|
||||
ctx->insert(to_symbol(decl_names[i]), to_func_decl(decls[i]));
|
||||
}
|
||||
for (unsigned i = 0; i < num_sorts; ++i) {
|
||||
psort* ps = ctx.pm().mk_psort_cnst(to_sort(sorts[i]));
|
||||
ctx.insert(ctx.pm().mk_psort_user_decl(0, to_symbol(sort_names[i]), ps));
|
||||
psort* ps = ctx->pm().mk_psort_cnst(to_sort(sorts[i]));
|
||||
ctx->insert(ctx->pm().mk_psort_user_decl(0, to_symbol(sort_names[i]), ps));
|
||||
}
|
||||
if (!parse_smt2_commands(ctx, is)) {
|
||||
if (!parse_smt2_commands(*ctx.get(), is)) {
|
||||
ctx = nullptr;
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
return of_ast(mk_c(c)->m().mk_true());
|
||||
}
|
||||
ptr_vector<expr>::const_iterator it = ctx.begin_assertions();
|
||||
ptr_vector<expr>::const_iterator end = ctx.end_assertions();
|
||||
ptr_vector<expr>::const_iterator it = ctx->begin_assertions();
|
||||
ptr_vector<expr>::const_iterator end = ctx->end_assertions();
|
||||
unsigned size = static_cast<unsigned>(end - it);
|
||||
return of_ast(mk_c(c)->mk_and(size, it));
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
|
|
@ -15,11 +15,11 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"pb_decl_plugin.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/pb_decl_plugin.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_polynomial.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"expr2polynomial.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include"expr2var.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_polynomial.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "ast/expr2polynomial.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "ast/expr2var.h"
|
||||
|
||||
namespace api {
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Notes:
|
|||
#ifndef API_POLYNOMIAL_H_
|
||||
#define API_POLYNOMIAL_H_
|
||||
|
||||
#include"polynomial.h"
|
||||
#include "math/polynomial/polynomial.h"
|
||||
|
||||
namespace api {
|
||||
|
||||
|
|
173
src/api/api_qe.cpp
Normal file
173
src/api/api_qe.cpp
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Arie Gurfinkel
|
||||
|
||||
Module Name:
|
||||
|
||||
api_qe.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Model-based Projection (MBP) and Quantifier Elimination (QE) API
|
||||
|
||||
Author:
|
||||
|
||||
Arie Gurfinkel (arie)
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
#include <iostream>
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "api/api_model.h"
|
||||
#include "api/api_ast_map.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "qe/qe_vartest.h"
|
||||
#include "qe/qe_lite.h"
|
||||
#include "muz/spacer/spacer_util.h"
|
||||
#include "ast/expr_map.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
static bool to_apps(unsigned n, Z3_app const es[], app_ref_vector& result) {
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (!is_app(to_app(es[i]))) {
|
||||
return false;
|
||||
}
|
||||
result.push_back (to_app (es [i]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_qe_model_project (Z3_context c,
|
||||
Z3_model m,
|
||||
unsigned num_bounds,
|
||||
Z3_app const bound[],
|
||||
Z3_ast body)
|
||||
{
|
||||
Z3_TRY;
|
||||
LOG_Z3_qe_model_project (c, m, num_bounds, bound, body);
|
||||
RESET_ERROR_CODE();
|
||||
|
||||
app_ref_vector vars(mk_c(c)->m ());
|
||||
if (!to_apps(num_bounds, bound, vars)) {
|
||||
SET_ERROR_CODE (Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
|
||||
expr_ref result (mk_c(c)->m ());
|
||||
result = to_expr (body);
|
||||
model_ref model (to_model_ref (m));
|
||||
spacer::qe_project (mk_c(c)->m (), vars, result, model);
|
||||
mk_c(c)->save_ast_trail (result.get ());
|
||||
|
||||
return of_expr (result.get ());
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_qe_model_project_skolem (Z3_context c,
|
||||
Z3_model m,
|
||||
unsigned num_bounds,
|
||||
Z3_app const bound[],
|
||||
Z3_ast body,
|
||||
Z3_ast_map map)
|
||||
{
|
||||
Z3_TRY;
|
||||
LOG_Z3_qe_model_project_skolem (c, m, num_bounds, bound, body, map);
|
||||
RESET_ERROR_CODE();
|
||||
|
||||
ast_manager& man = mk_c(c)->m ();
|
||||
app_ref_vector vars(man);
|
||||
if (!to_apps(num_bounds, bound, vars)) {
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
|
||||
expr_ref result (mk_c(c)->m ());
|
||||
result = to_expr (body);
|
||||
model_ref model (to_model_ref (m));
|
||||
expr_map emap (man);
|
||||
|
||||
spacer::qe_project (mk_c(c)->m (), vars, result, model, emap);
|
||||
mk_c(c)->save_ast_trail (result.get ());
|
||||
|
||||
obj_map<ast, ast*> &map_z3 = to_ast_map_ref(map);
|
||||
|
||||
for (expr_map::iterator it = emap.begin(), end = emap.end(); it != end; ++it){
|
||||
man.inc_ref(&(it->get_key()));
|
||||
man.inc_ref(it->get_value());
|
||||
map_z3.insert(&(it->get_key()), it->get_value());
|
||||
}
|
||||
|
||||
return of_expr (result.get ());
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_model_extrapolate (Z3_context c,
|
||||
Z3_model m,
|
||||
Z3_ast fml)
|
||||
{
|
||||
Z3_TRY;
|
||||
LOG_Z3_model_extrapolate (c, m, fml);
|
||||
RESET_ERROR_CODE();
|
||||
|
||||
model_ref model (to_model_ref (m));
|
||||
expr_ref_vector facts (mk_c(c)->m ());
|
||||
facts.push_back (to_expr (fml));
|
||||
flatten_and (facts);
|
||||
|
||||
spacer::model_evaluator_util mev (mk_c(c)->m());
|
||||
mev.set_model (*model);
|
||||
|
||||
expr_ref_vector lits (mk_c(c)->m());
|
||||
spacer::compute_implicant_literals (mev, facts, lits);
|
||||
|
||||
expr_ref result (mk_c(c)->m ());
|
||||
result = mk_and (lits);
|
||||
mk_c(c)->save_ast_trail (result.get ());
|
||||
|
||||
return of_expr (result.get ());
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_qe_lite (Z3_context c, Z3_ast_vector vars, Z3_ast body)
|
||||
{
|
||||
Z3_TRY;
|
||||
LOG_Z3_qe_lite (c, vars, body);
|
||||
RESET_ERROR_CODE();
|
||||
ast_ref_vector &vVars = to_ast_vector_ref (vars);
|
||||
|
||||
app_ref_vector vApps (mk_c(c)->m());
|
||||
for (unsigned i = 0; i < vVars.size (); ++i) {
|
||||
app *a = to_app (vVars.get (i));
|
||||
if (a->get_kind () != AST_APP) {
|
||||
SET_ERROR_CODE (Z3_INVALID_ARG);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
vApps.push_back (a);
|
||||
}
|
||||
|
||||
expr_ref result (mk_c(c)->m ());
|
||||
result = to_expr (body);
|
||||
|
||||
params_ref p;
|
||||
qe_lite qe (mk_c(c)->m (), p);
|
||||
qe (vApps, result);
|
||||
|
||||
// -- copy back variables that were not eliminated
|
||||
if (vApps.size () < vVars.size ()) {
|
||||
vVars.reset ();
|
||||
for (app* v : vApps) {
|
||||
vVars.push_back (v);
|
||||
}
|
||||
}
|
||||
|
||||
mk_c(c)->save_ast_trail (result.get ());
|
||||
return of_expr (result);
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
}
|
|
@ -15,12 +15,12 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"pattern_validation.h"
|
||||
#include"expr_abstract.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "parsers/util/pattern_validation.h"
|
||||
#include "ast/expr_abstract.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -63,9 +63,11 @@ extern "C" {
|
|||
RESET_ERROR_CODE();
|
||||
if (!mk_c(c)->m().is_bool(to_expr(body))) {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
if (num_patterns > 0 && num_no_patterns > 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
return nullptr;
|
||||
}
|
||||
expr * const* ps = reinterpret_cast<expr * const*>(patterns);
|
||||
expr * const* no_ps = reinterpret_cast<expr * const*>(no_patterns);
|
||||
|
@ -76,7 +78,7 @@ extern "C" {
|
|||
for (unsigned i = 0; i < num_patterns; i++) {
|
||||
if (!v(num_decls, ps[i], 0, 0)) {
|
||||
SET_ERROR_CODE(Z3_INVALID_PATTERN);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ Notes:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"realclosure.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "math/realclosure/realclosure.h"
|
||||
|
||||
static rcmanager & rcfm(Z3_context c) {
|
||||
return mk_c(c)->rcfm();
|
||||
|
|
|
@ -16,11 +16,11 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_util.h"
|
||||
#include"ast_pp.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_util.h"
|
||||
#include "ast/ast_pp.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
|
@ -17,22 +17,22 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_tactic.h"
|
||||
#include"api_solver.h"
|
||||
#include"api_model.h"
|
||||
#include"api_stats.h"
|
||||
#include"api_ast_vector.h"
|
||||
#include"tactic2solver.h"
|
||||
#include"scoped_ctrl_c.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include"smt_strategic_solver.h"
|
||||
#include"smt_solver.h"
|
||||
#include"smt_implied_equalities.h"
|
||||
#include"smt_logics.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_tactic.h"
|
||||
#include "api/api_solver.h"
|
||||
#include "api/api_model.h"
|
||||
#include "api/api_stats.h"
|
||||
#include "api/api_ast_vector.h"
|
||||
#include "solver/tactic2solver.h"
|
||||
#include "util/scoped_ctrl_c.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "tactic/portfolio/smt_strategic_solver.h"
|
||||
#include "smt/smt_solver.h"
|
||||
#include "smt/smt_implied_equalities.h"
|
||||
#include "solver/smt_logics.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -296,10 +296,14 @@ extern "C" {
|
|||
result = to_solver_ref(s)->check_sat(num_assumptions, _assumptions);
|
||||
}
|
||||
catch (z3_exception & ex) {
|
||||
to_solver_ref(s)->set_reason_unknown(eh);
|
||||
mk_c(c)->handle_exception(ex);
|
||||
return Z3_L_UNDEF;
|
||||
}
|
||||
}
|
||||
if (result == l_undef) {
|
||||
to_solver_ref(s)->set_reason_unknown(eh);
|
||||
}
|
||||
return static_cast<Z3_lbool>(result);
|
||||
}
|
||||
|
||||
|
@ -438,6 +442,7 @@ extern "C" {
|
|||
unsigned sz = __assumptions.size();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (!is_expr(__assumptions[i])) {
|
||||
_assumptions.finalize(); _consequences.finalize(); _variables.finalize();
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
return Z3_L_UNDEF;
|
||||
}
|
||||
|
@ -447,6 +452,7 @@ extern "C" {
|
|||
sz = __variables.size();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (!is_expr(__variables[i])) {
|
||||
_assumptions.finalize(); _consequences.finalize(); _variables.finalize();
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
return Z3_L_UNDEF;
|
||||
}
|
||||
|
@ -466,10 +472,15 @@ extern "C" {
|
|||
result = to_solver_ref(s)->get_consequences(_assumptions, _variables, _consequences);
|
||||
}
|
||||
catch (z3_exception & ex) {
|
||||
to_solver_ref(s)->set_reason_unknown(eh);
|
||||
_assumptions.finalize(); _consequences.finalize(); _variables.finalize();
|
||||
mk_c(c)->handle_exception(ex);
|
||||
return Z3_L_UNDEF;
|
||||
}
|
||||
}
|
||||
if (result == l_undef) {
|
||||
to_solver_ref(s)->set_reason_unknown(eh);
|
||||
}
|
||||
for (unsigned i = 0; i < _consequences.size(); ++i) {
|
||||
to_ast_vector_ref(consequences).push_back(_consequences[i].get());
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ Revision History:
|
|||
#ifndef API_SOLVER_H_
|
||||
#define API_SOLVER_H_
|
||||
|
||||
#include"api_util.h"
|
||||
#include"solver.h"
|
||||
#include "api/api_util.h"
|
||||
#include "solver/solver.h"
|
||||
|
||||
struct Z3_solver_ref : public api::object {
|
||||
scoped_ptr<solver_factory> m_solver_factory;
|
||||
|
|
|
@ -16,10 +16,10 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_stats.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_stats.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ Revision History:
|
|||
#ifndef API_STATS_H_
|
||||
#define API_STATS_H_
|
||||
|
||||
#include"api_util.h"
|
||||
#include"statistics.h"
|
||||
#include "api/api_util.h"
|
||||
#include "util/statistics.h"
|
||||
|
||||
struct Z3_stats_ref : public api::object {
|
||||
statistics m_stats;
|
||||
|
|
|
@ -16,14 +16,14 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"api_log_macros.h"
|
||||
#include"api_context.h"
|
||||
#include"api_tactic.h"
|
||||
#include"api_model.h"
|
||||
#include"scoped_ctrl_c.h"
|
||||
#include"cancel_eh.h"
|
||||
#include"scoped_timer.h"
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "api/api_context.h"
|
||||
#include "api/api_tactic.h"
|
||||
#include "api/api_model.h"
|
||||
#include "util/scoped_ctrl_c.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_timer.h"
|
||||
|
||||
Z3_apply_result_ref::Z3_apply_result_ref(api::context& c, ast_manager & m): api::object(c), m_core(m) {
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ Revision History:
|
|||
#ifndef API_TACTIC_H_
|
||||
#define API_TACTIC_H_
|
||||
|
||||
#include"api_goal.h"
|
||||
#include"tactical.h"
|
||||
#include "api/api_goal.h"
|
||||
#include "tactic/tactical.h"
|
||||
|
||||
namespace api {
|
||||
class context;
|
||||
|
|
|
@ -18,9 +18,9 @@ Revision History:
|
|||
#ifndef API_UTIL_H_
|
||||
#define API_UTIL_H_
|
||||
|
||||
#include"params.h"
|
||||
#include"lbool.h"
|
||||
#include"ast.h"
|
||||
#include "util/params.h"
|
||||
#include "util/lbool.h"
|
||||
#include "ast/ast.h"
|
||||
|
||||
#define Z3_TRY try {
|
||||
#define Z3_CATCH_CORE(CODE) } catch (z3_exception & ex) { mk_c(c)->handle_exception(ex); CODE }
|
||||
|
|
|
@ -140,18 +140,17 @@ namespace z3 {
|
|||
class context {
|
||||
bool m_enable_exceptions;
|
||||
Z3_context m_ctx;
|
||||
static void error_handler(Z3_context /*c*/, Z3_error_code /*e*/) { /* do nothing */ }
|
||||
void init(config & c) {
|
||||
m_ctx = Z3_mk_context_rc(c);
|
||||
m_enable_exceptions = true;
|
||||
Z3_set_error_handler(m_ctx, error_handler);
|
||||
Z3_set_error_handler(m_ctx, 0);
|
||||
Z3_set_ast_print_mode(m_ctx, Z3_PRINT_SMTLIB2_COMPLIANT);
|
||||
}
|
||||
|
||||
void init_interp(config & c) {
|
||||
m_ctx = Z3_mk_interpolation_context(c);
|
||||
m_enable_exceptions = true;
|
||||
Z3_set_error_handler(m_ctx, error_handler);
|
||||
Z3_set_error_handler(m_ctx, 0);
|
||||
Z3_set_ast_print_mode(m_ctx, Z3_PRINT_SMTLIB2_COMPLIANT);
|
||||
}
|
||||
|
||||
|
@ -251,6 +250,8 @@ namespace z3 {
|
|||
Example: Given a context \c c, <tt>c.array_sort(c.int_sort(), c.bool_sort())</tt> is an array sort from integer to Boolean.
|
||||
*/
|
||||
sort array_sort(sort d, sort r);
|
||||
sort array_sort(sort_vector const& d, sort r);
|
||||
|
||||
/**
|
||||
\brief Return an enumeration sort: enum_names[0], ..., enum_names[n-1].
|
||||
\c cs and \c ts are output parameters. The method stores in \c cs the constants corresponding to the enumerated elements,
|
||||
|
@ -354,7 +355,7 @@ namespace z3 {
|
|||
Z3_error_code check_error() const { return m_ctx->check_error(); }
|
||||
friend void check_context(object const & a, object const & b);
|
||||
};
|
||||
inline void check_context(object const & a, object const & b) { assert(a.m_ctx == b.m_ctx); }
|
||||
inline void check_context(object const & a, object const & b) { (void)a; (void)b; assert(a.m_ctx == b.m_ctx); }
|
||||
|
||||
class symbol : public object {
|
||||
Z3_symbol m_sym;
|
||||
|
@ -1731,6 +1732,14 @@ namespace z3 {
|
|||
expr else_value() const { Z3_ast r = Z3_func_interp_get_else(ctx(), m_interp); check_error(); return expr(ctx(), r); }
|
||||
unsigned num_entries() const { unsigned r = Z3_func_interp_get_num_entries(ctx(), m_interp); check_error(); return r; }
|
||||
func_entry entry(unsigned i) const { Z3_func_entry e = Z3_func_interp_get_entry(ctx(), m_interp, i); check_error(); return func_entry(ctx(), e); }
|
||||
void add_entry(expr_vector const& args, expr& value) {
|
||||
Z3_func_interp_add_entry(ctx(), m_interp, args, value);
|
||||
check_error();
|
||||
}
|
||||
void set_else(expr& value) {
|
||||
Z3_func_interp_set_else(ctx(), m_interp, value);
|
||||
check_error();
|
||||
}
|
||||
};
|
||||
|
||||
class model : public object {
|
||||
|
@ -1740,6 +1749,7 @@ namespace z3 {
|
|||
Z3_model_inc_ref(ctx(), m);
|
||||
}
|
||||
public:
|
||||
model(context & c):object(c) { init(Z3_mk_model(c)); }
|
||||
model(context & c, Z3_model m):object(c) { init(m); }
|
||||
model(model const & s):object(s) { init(s.m_model); }
|
||||
~model() { Z3_model_dec_ref(ctx(), m_model); }
|
||||
|
@ -1795,6 +1805,17 @@ namespace z3 {
|
|||
return 0 != Z3_model_has_interp(ctx(), m_model, f);
|
||||
}
|
||||
|
||||
func_interp add_func_interp(func_decl& f, expr& else_val) {
|
||||
Z3_func_interp r = Z3_add_func_interp(ctx(), m_model, f, else_val);
|
||||
check_error();
|
||||
return func_interp(ctx(), r);
|
||||
}
|
||||
|
||||
void add_const_interp(func_decl& f, expr& value) {
|
||||
Z3_add_const_interp(ctx(), m_model, f, value);
|
||||
check_error();
|
||||
}
|
||||
|
||||
friend std::ostream & operator<<(std::ostream & out, model const & m);
|
||||
};
|
||||
inline std::ostream & operator<<(std::ostream & out, model const & m) { out << Z3_model_to_string(m.ctx(), m); return out; }
|
||||
|
@ -2308,6 +2329,11 @@ namespace z3 {
|
|||
inline sort context::re_sort(sort& s) { Z3_sort r = Z3_mk_re_sort(m_ctx, s); check_error(); return sort(*this, r); }
|
||||
|
||||
inline sort context::array_sort(sort d, sort r) { Z3_sort s = Z3_mk_array_sort(m_ctx, d, r); check_error(); return sort(*this, s); }
|
||||
inline sort context::array_sort(sort_vector const& d, sort r) {
|
||||
array<Z3_sort> dom(d);
|
||||
Z3_sort s = Z3_mk_array_sort_n(m_ctx, dom.size(), dom.ptr(), r); check_error(); return sort(*this, s);
|
||||
}
|
||||
|
||||
inline sort context::enumeration_sort(char const * name, unsigned n, char const * const * enum_names, func_decl_vector & cs, func_decl_vector & ts) {
|
||||
array<Z3_symbol> _enum_names(n);
|
||||
for (unsigned i = 0; i < n; i++) { _enum_names[i] = Z3_mk_string_symbol(*this, enum_names[i]); }
|
||||
|
@ -2554,11 +2580,32 @@ namespace z3 {
|
|||
a.check_error();
|
||||
return expr(a.ctx(), r);
|
||||
}
|
||||
inline expr select(expr const & a, expr_vector const & i) {
|
||||
check_context(a, i);
|
||||
array<Z3_ast> idxs(i);
|
||||
Z3_ast r = Z3_mk_select_n(a.ctx(), a, idxs.size(), idxs.ptr());
|
||||
a.check_error();
|
||||
return expr(a.ctx(), r);
|
||||
}
|
||||
|
||||
inline expr store(expr const & a, int i, expr const & v) { return store(a, a.ctx().num_val(i, a.get_sort().array_domain()), v); }
|
||||
inline expr store(expr const & a, expr i, int v) { return store(a, i, a.ctx().num_val(v, a.get_sort().array_range())); }
|
||||
inline expr store(expr const & a, int i, int v) {
|
||||
return store(a, a.ctx().num_val(i, a.get_sort().array_domain()), a.ctx().num_val(v, a.get_sort().array_range()));
|
||||
}
|
||||
inline expr store(expr const & a, expr_vector const & i, expr const & v) {
|
||||
check_context(a, i); check_context(a, v);
|
||||
array<Z3_ast> idxs(i);
|
||||
Z3_ast r = Z3_mk_store_n(a.ctx(), a, idxs.size(), idxs.ptr(), v);
|
||||
a.check_error();
|
||||
return expr(a.ctx(), r);
|
||||
}
|
||||
|
||||
inline expr as_array(func_decl & f) {
|
||||
Z3_ast r = Z3_mk_as_array(f.ctx(), f);
|
||||
f.check_error();
|
||||
return expr(f.ctx(), r);
|
||||
}
|
||||
|
||||
#define MK_EXPR1(_fn, _arg) \
|
||||
Z3_ast r = _fn(_arg.ctx(), _arg); \
|
||||
|
|
|
@ -15,16 +15,16 @@ Copyright (c) 2015 Microsoft Corporation
|
|||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,13 @@ namespace Microsoft.Z3
|
|||
Contract.Requires(domain != null);
|
||||
Contract.Requires(range != null);
|
||||
}
|
||||
internal ArraySort(Context ctx, Sort[] domain, Sort range)
|
||||
: base(ctx, Native.Z3_mk_array_sort_n(ctx.nCtx, (uint)domain.Length, AST.ArrayToNative(domain), range.NativeObject))
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
Contract.Requires(domain != null);
|
||||
Contract.Requires(range != null);
|
||||
}
|
||||
#endregion
|
||||
};
|
||||
|
||||
|
|
|
@ -43,78 +43,78 @@ add_custom_command(OUTPUT "${Z3_DOTNET_CONST_FILE}"
|
|||
)
|
||||
|
||||
set(Z3_DOTNET_ASSEMBLY_SOURCES_IN_SRC_TREE
|
||||
AlgebraicNum.cs
|
||||
ApplyResult.cs
|
||||
ArithExpr.cs
|
||||
ArithSort.cs
|
||||
ArrayExpr.cs
|
||||
ArraySort.cs
|
||||
AST.cs
|
||||
ASTMap.cs
|
||||
ASTVector.cs
|
||||
BitVecExpr.cs
|
||||
BitVecNum.cs
|
||||
BitVecSort.cs
|
||||
BoolExpr.cs
|
||||
BoolSort.cs
|
||||
Constructor.cs
|
||||
ConstructorList.cs
|
||||
Context.cs
|
||||
DatatypeExpr.cs
|
||||
DatatypeSort.cs
|
||||
Deprecated.cs
|
||||
EnumSort.cs
|
||||
Expr.cs
|
||||
FiniteDomainExpr.cs
|
||||
FiniteDomainNum.cs
|
||||
FiniteDomainSort.cs
|
||||
Fixedpoint.cs
|
||||
FPExpr.cs
|
||||
FPNum.cs
|
||||
FPRMExpr.cs
|
||||
FPRMNum.cs
|
||||
FPRMSort.cs
|
||||
FPSort.cs
|
||||
FuncDecl.cs
|
||||
FuncInterp.cs
|
||||
Global.cs
|
||||
Goal.cs
|
||||
IDecRefQueue.cs
|
||||
InterpolationContext.cs
|
||||
IntExpr.cs
|
||||
IntNum.cs
|
||||
IntSort.cs
|
||||
IntSymbol.cs
|
||||
ListSort.cs
|
||||
Log.cs
|
||||
Model.cs
|
||||
Optimize.cs
|
||||
ParamDescrs.cs
|
||||
Params.cs
|
||||
Pattern.cs
|
||||
Probe.cs
|
||||
Quantifier.cs
|
||||
RatNum.cs
|
||||
RealExpr.cs
|
||||
RealSort.cs
|
||||
ReExpr.cs
|
||||
RelationSort.cs
|
||||
ReSort.cs
|
||||
SeqExpr.cs
|
||||
SeqSort.cs
|
||||
SetSort.cs
|
||||
Solver.cs
|
||||
Sort.cs
|
||||
Statistics.cs
|
||||
Status.cs
|
||||
StringSymbol.cs
|
||||
Symbol.cs
|
||||
Tactic.cs
|
||||
TupleSort.cs
|
||||
UninterpretedSort.cs
|
||||
Version.cs
|
||||
Z3Exception.cs
|
||||
Z3Object.cs
|
||||
AlgebraicNum.cs
|
||||
ApplyResult.cs
|
||||
ArithExpr.cs
|
||||
ArithSort.cs
|
||||
ArrayExpr.cs
|
||||
ArraySort.cs
|
||||
AST.cs
|
||||
ASTMap.cs
|
||||
ASTVector.cs
|
||||
BitVecExpr.cs
|
||||
BitVecNum.cs
|
||||
BitVecSort.cs
|
||||
BoolExpr.cs
|
||||
BoolSort.cs
|
||||
Constructor.cs
|
||||
ConstructorList.cs
|
||||
Context.cs
|
||||
DatatypeExpr.cs
|
||||
DatatypeSort.cs
|
||||
Deprecated.cs
|
||||
EnumSort.cs
|
||||
Expr.cs
|
||||
FiniteDomainExpr.cs
|
||||
FiniteDomainNum.cs
|
||||
FiniteDomainSort.cs
|
||||
Fixedpoint.cs
|
||||
FPExpr.cs
|
||||
FPNum.cs
|
||||
FPRMExpr.cs
|
||||
FPRMNum.cs
|
||||
FPRMSort.cs
|
||||
FPSort.cs
|
||||
FuncDecl.cs
|
||||
FuncInterp.cs
|
||||
Global.cs
|
||||
Goal.cs
|
||||
IDecRefQueue.cs
|
||||
InterpolationContext.cs
|
||||
IntExpr.cs
|
||||
IntNum.cs
|
||||
IntSort.cs
|
||||
IntSymbol.cs
|
||||
ListSort.cs
|
||||
Log.cs
|
||||
Model.cs
|
||||
Optimize.cs
|
||||
ParamDescrs.cs
|
||||
Params.cs
|
||||
Pattern.cs
|
||||
Probe.cs
|
||||
Quantifier.cs
|
||||
RatNum.cs
|
||||
RealExpr.cs
|
||||
RealSort.cs
|
||||
ReExpr.cs
|
||||
RelationSort.cs
|
||||
ReSort.cs
|
||||
SeqExpr.cs
|
||||
SeqSort.cs
|
||||
SetSort.cs
|
||||
Solver.cs
|
||||
Sort.cs
|
||||
Statistics.cs
|
||||
Status.cs
|
||||
StringSymbol.cs
|
||||
Symbol.cs
|
||||
Tactic.cs
|
||||
TupleSort.cs
|
||||
UninterpretedSort.cs
|
||||
Version.cs
|
||||
Z3Exception.cs
|
||||
Z3Object.cs
|
||||
)
|
||||
|
||||
set(Z3_DOTNET_ASSEMBLY_SOURCES "")
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace Microsoft.Z3
|
|||
private BoolSort m_boolSort = null;
|
||||
private IntSort m_intSort = null;
|
||||
private RealSort m_realSort = null;
|
||||
private SeqSort m_stringSort = null;
|
||||
private SeqSort m_stringSort = null;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the Boolean sort of the context.
|
||||
|
@ -274,6 +274,20 @@ namespace Microsoft.Z3
|
|||
return new ArraySort(this, domain, range);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new n-ary array sort.
|
||||
/// </summary>
|
||||
public ArraySort MkArraySort(Sort[] domain, Sort range)
|
||||
{
|
||||
Contract.Requires(domain != null);
|
||||
Contract.Requires(range != null);
|
||||
Contract.Ensures(Contract.Result<ArraySort>() != null);
|
||||
|
||||
CheckContextMatch<Sort>(domain);
|
||||
CheckContextMatch(range);
|
||||
return new ArraySort(this, domain, range);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new tuple sort.
|
||||
/// </summary>
|
||||
|
@ -2113,6 +2127,7 @@ namespace Microsoft.Z3
|
|||
return (ArrayExpr)MkConst(MkSymbol(name), MkArraySort(domain, range));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Array read.
|
||||
/// </summary>
|
||||
|
@ -2123,8 +2138,8 @@ namespace Microsoft.Z3
|
|||
/// The node <c>a</c> must have an array sort <c>[domain -> range]</c>,
|
||||
/// and <c>i</c> must have the sort <c>domain</c>.
|
||||
/// The sort of the result is <c>range</c>.
|
||||
/// <seealso cref="MkArraySort"/>
|
||||
/// <seealso cref="MkStore"/>
|
||||
/// <seealso cref="MkArraySort(Sort, Sort)"/>
|
||||
/// <seealso cref="MkStore(ArrayExpr, Expr, Expr)"/>
|
||||
/// </remarks>
|
||||
public Expr MkSelect(ArrayExpr a, Expr i)
|
||||
{
|
||||
|
@ -2137,6 +2152,30 @@ namespace Microsoft.Z3
|
|||
return Expr.Create(this, Native.Z3_mk_select(nCtx, a.NativeObject, i.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array read.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The argument <c>a</c> is the array and <c>args</c> are the indices
|
||||
/// of the array that gets read.
|
||||
///
|
||||
/// The node <c>a</c> must have an array sort <c>[domain1,..,domaink -> range]</c>,
|
||||
/// and <c>args</c> must have the sort <c>domain1,..,domaink</c>.
|
||||
/// The sort of the result is <c>range</c>.
|
||||
/// <seealso cref="MkArraySort(Sort, Sort)"/>
|
||||
/// <seealso cref="MkStore(ArrayExpr, Expr, Expr)"/>
|
||||
/// </remarks>
|
||||
public Expr MkSelect(ArrayExpr a, params Expr[] args)
|
||||
{
|
||||
Contract.Requires(a != null);
|
||||
Contract.Requires(args != null && Contract.ForAll(args, n => n != null));
|
||||
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||
|
||||
CheckContextMatch(a);
|
||||
CheckContextMatch<Expr>(args);
|
||||
return Expr.Create(this, Native.Z3_mk_select_n(nCtx, a.NativeObject, AST.ArrayLength(args), AST.ArrayToNative(args)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array update.
|
||||
/// </summary>
|
||||
|
@ -2151,8 +2190,9 @@ namespace Microsoft.Z3
|
|||
/// on all indices except for <c>i</c>, where it maps to <c>v</c>
|
||||
/// (and the <c>select</c> of <c>a</c> with
|
||||
/// respect to <c>i</c> may be a different value).
|
||||
/// <seealso cref="MkArraySort"/>
|
||||
/// <seealso cref="MkSelect"/>
|
||||
/// <seealso cref="MkArraySort(Sort, Sort)"/>
|
||||
/// <seealso cref="MkSelect(ArrayExpr, Expr)"/>
|
||||
/// <seealso cref="MkSelect(ArrayExpr, Expr[])"/>
|
||||
/// </remarks>
|
||||
public ArrayExpr MkStore(ArrayExpr a, Expr i, Expr v)
|
||||
{
|
||||
|
@ -2167,14 +2207,45 @@ namespace Microsoft.Z3
|
|||
return new ArrayExpr(this, Native.Z3_mk_store(nCtx, a.NativeObject, i.NativeObject, v.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array update.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The node <c>a</c> must have an array sort <c>[domain1,..,domaink -> range]</c>,
|
||||
/// <c>args</c> must have sort <c>domain1,..,domaink</c>,
|
||||
/// <c>v</c> must have sort range. The sort of the result is <c>[domain -> range]</c>.
|
||||
/// The semantics of this function is given by the theory of arrays described in the SMT-LIB
|
||||
/// standard. See http://smtlib.org for more details.
|
||||
/// The result of this function is an array that is equal to <c>a</c>
|
||||
/// (with respect to <c>select</c>)
|
||||
/// on all indices except for <c>args</c>, where it maps to <c>v</c>
|
||||
/// (and the <c>select</c> of <c>a</c> with
|
||||
/// respect to <c>args</c> may be a different value).
|
||||
/// <seealso cref="MkArraySort(Sort, Sort)"/>
|
||||
/// <seealso cref="MkSelect(ArrayExpr, Expr)"/>
|
||||
/// <seealso cref="MkSelect(ArrayExpr, Expr[])"/>
|
||||
/// </remarks>
|
||||
public ArrayExpr MkStore(ArrayExpr a, Expr[] args, Expr v)
|
||||
{
|
||||
Contract.Requires(a != null);
|
||||
Contract.Requires(args != null);
|
||||
Contract.Requires(v != null);
|
||||
Contract.Ensures(Contract.Result<ArrayExpr>() != null);
|
||||
|
||||
CheckContextMatch<Expr>(args);
|
||||
CheckContextMatch(a);
|
||||
CheckContextMatch(v);
|
||||
return new ArrayExpr(this, Native.Z3_mk_store_n(nCtx, a.NativeObject, AST.ArrayLength(args), AST.ArrayToNative(args), v.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a constant array.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The resulting term is an array, such that a <c>select</c>on an arbitrary index
|
||||
/// produces the value <c>v</c>.
|
||||
/// <seealso cref="MkArraySort"/>
|
||||
/// <seealso cref="MkSelect"/>
|
||||
/// <seealso cref="MkArraySort(Sort, Sort)"/>
|
||||
/// <seealso cref="MkSelect(ArrayExpr, Expr)"/>
|
||||
/// </remarks>
|
||||
public ArrayExpr MkConstArray(Sort domain, Expr v)
|
||||
{
|
||||
|
@ -2194,9 +2265,9 @@ namespace Microsoft.Z3
|
|||
/// Eeach element of <c>args</c> must be of an array sort <c>[domain_i -> range_i]</c>.
|
||||
/// The function declaration <c>f</c> must have type <c> range_1 .. range_n -> range</c>.
|
||||
/// <c>v</c> must have sort range. The sort of the result is <c>[domain_i -> range]</c>.
|
||||
/// <seealso cref="MkArraySort"/>
|
||||
/// <seealso cref="MkSelect"/>
|
||||
/// <seealso cref="MkStore"/>
|
||||
/// <seealso cref="MkArraySort(Sort, Sort)"/>
|
||||
/// <seealso cref="MkSelect(ArrayExpr, Expr)"/>
|
||||
/// <seealso cref="MkStore(ArrayExpr, Expr, Expr)"/>
|
||||
/// </remarks>
|
||||
public ArrayExpr MkMap(FuncDecl f, params ArrayExpr[] args)
|
||||
{
|
||||
|
@ -2426,7 +2497,7 @@ namespace Microsoft.Z3
|
|||
public SeqExpr IntToString(Expr e)
|
||||
{
|
||||
Contract.Requires(e != null);
|
||||
Contract.Requires(e is ArithExpr);
|
||||
Contract.Requires(e is ArithExpr);
|
||||
Contract.Ensures(Contract.Result<SeqExpr>() != null);
|
||||
return new SeqExpr(this, Native.Z3_mk_int_to_str(nCtx, e.NativeObject));
|
||||
}
|
||||
|
@ -2690,7 +2761,7 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Create a range expression.
|
||||
/// </summary>
|
||||
public ReExpr MkRange(SeqExpr lo, SeqExpr hi)
|
||||
public ReExpr MkRange(SeqExpr lo, SeqExpr hi)
|
||||
{
|
||||
Contract.Requires(lo != null);
|
||||
Contract.Requires(hi != null);
|
||||
|
|
|
@ -809,55 +809,55 @@ namespace Microsoft.Z3
|
|||
/// Check whether expression is a concatentation.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONCAT; } }
|
||||
public bool IsConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONCAT; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is a prefix.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsPrefix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_PREFIX; } }
|
||||
public bool IsPrefix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_PREFIX; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is a suffix.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsSuffix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_SUFFIX; } }
|
||||
public bool IsSuffix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_SUFFIX; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is a contains.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsContains { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONTAINS; } }
|
||||
public bool IsContains { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONTAINS; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is an extract.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_EXTRACT; } }
|
||||
public bool IsExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_EXTRACT; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is a replace.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsReplace { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_REPLACE; } }
|
||||
public bool IsReplace { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_REPLACE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is an at.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsAt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_AT; } }
|
||||
public bool IsAt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_AT; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is a sequence length.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsLength { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_LENGTH; } }
|
||||
public bool IsLength { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_LENGTH; } }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether expression is a sequence index.
|
||||
/// </summary>
|
||||
/// <returns>a Boolean</returns>
|
||||
public bool IsIndex { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_INDEX; } }
|
||||
public bool IsIndex { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_INDEX; } }
|
||||
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve a lower bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public ArithExpr Lower
|
||||
{
|
||||
get { return opt.GetLower(handle); }
|
||||
|
@ -131,7 +131,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve an upper bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public ArithExpr Upper
|
||||
{
|
||||
get { return opt.GetUpper(handle); }
|
||||
|
@ -139,7 +139,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve the value of an objective.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public ArithExpr Value
|
||||
{
|
||||
get { return Lower; }
|
||||
|
@ -147,7 +147,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve a lower bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public ArithExpr[] LowerAsVector
|
||||
{
|
||||
get { return opt.GetLowerAsVector(handle); }
|
||||
|
@ -155,7 +155,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve an upper bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public ArithExpr[] UpperAsVector
|
||||
{
|
||||
get { return opt.GetUpperAsVector(handle); }
|
||||
|
@ -240,7 +240,7 @@ namespace Microsoft.Z3
|
|||
/// Declare an arithmetical maximization objective.
|
||||
/// Return a handle to the objective. The handle is used as
|
||||
/// to retrieve the values of objectives after calling Check.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public Handle MkMaximize(ArithExpr e)
|
||||
{
|
||||
return new Handle(this, Native.Z3_optimize_maximize(Context.nCtx, NativeObject, e.NativeObject));
|
||||
|
@ -249,7 +249,7 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Declare an arithmetical minimization objective.
|
||||
/// Similar to MkMaximize.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public Handle MkMinimize(ArithExpr e)
|
||||
{
|
||||
return new Handle(this, Native.Z3_optimize_minimize(Context.nCtx, NativeObject, e.NativeObject));
|
||||
|
@ -257,7 +257,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve a lower bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
private ArithExpr GetLower(uint index)
|
||||
{
|
||||
return (ArithExpr)Expr.Create(Context, Native.Z3_optimize_get_lower(Context.nCtx, NativeObject, index));
|
||||
|
@ -266,7 +266,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve an upper bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
private ArithExpr GetUpper(uint index)
|
||||
{
|
||||
return (ArithExpr)Expr.Create(Context, Native.Z3_optimize_get_upper(Context.nCtx, NativeObject, index));
|
||||
|
@ -274,7 +274,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve a lower bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
private ArithExpr[] GetLowerAsVector(uint index)
|
||||
{
|
||||
ASTVector v = new ASTVector(Context, Native.Z3_optimize_get_lower_as_vector(Context.nCtx, NativeObject, index));
|
||||
|
@ -284,29 +284,29 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Retrieve an upper bound for the objective handle.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
private ArithExpr[] GetUpperAsVector(uint index)
|
||||
{
|
||||
ASTVector v = new ASTVector(Context, Native.Z3_optimize_get_upper_as_vector(Context.nCtx, NativeObject, index));
|
||||
return v.ToArithExprArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a string the describes why the last to check returned unknown
|
||||
/// </summary>
|
||||
public String ReasonUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Return a string the describes why the last to check returned unknown
|
||||
/// </summary>
|
||||
public String ReasonUnknown
|
||||
{
|
||||
get
|
||||
{
|
||||
Contract.Ensures(Contract.Result<string>() != null);
|
||||
return Native.Z3_optimize_get_reason_unknown(Context.nCtx, NativeObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Print the context to a string (SMT-LIB parseable benchmark).
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return Native.Z3_optimize_to_string(Context.nCtx, NativeObject);
|
||||
|
|
|
@ -8,41 +8,41 @@ EndProject
|
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x64.ActiveCfg = Release|x64
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x64.Build.0 = Release|x64
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x64.ActiveCfg = Release|x64
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x64.Build.0 = Release|x64
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x64.ActiveCfg = Release|x64
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x64.Build.0 = Release|x64
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EC3DB697-B734-42F7-9468-5B62821EEB5A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x64.ActiveCfg = Release|x64
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x64.Build.0 = Release|x64
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2A8E577B-7B6D-4CA9-832A-CA2EEC314812}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -131,7 +131,7 @@ public class ASTVector extends Z3Object {
|
|||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.create(getContext(), get(i).getNativeObject());
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,57 +22,57 @@ package com.microsoft.z3;
|
|||
**/
|
||||
public class AlgebraicNum extends ArithExpr
|
||||
{
|
||||
/**
|
||||
* Return a upper bound for a given real algebraic number. The interval
|
||||
* isolating the number is smaller than 1/10^{@code precision}.
|
||||
*
|
||||
* @see Expr#isAlgebraicNumber
|
||||
* @param precision the precision of the result
|
||||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public RatNum toUpper(int precision)
|
||||
{
|
||||
/**
|
||||
* Return a upper bound for a given real algebraic number. The interval
|
||||
* isolating the number is smaller than 1/10^{@code precision}.
|
||||
*
|
||||
* @see Expr#isAlgebraicNumber
|
||||
* @param precision the precision of the result
|
||||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public RatNum toUpper(int precision)
|
||||
{
|
||||
|
||||
return new RatNum(getContext(), Native.getAlgebraicNumberUpper(getContext()
|
||||
.nCtx(), getNativeObject(), precision));
|
||||
}
|
||||
return new RatNum(getContext(), Native.getAlgebraicNumberUpper(getContext()
|
||||
.nCtx(), getNativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a lower bound for the given real algebraic number. The interval
|
||||
* isolating the number is smaller than 1/10^{@code precision}.
|
||||
*
|
||||
* @see Expr#isAlgebraicNumber
|
||||
* @param precision precision
|
||||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public RatNum toLower(int precision)
|
||||
{
|
||||
/**
|
||||
* Return a lower bound for the given real algebraic number. The interval
|
||||
* isolating the number is smaller than 1/10^{@code precision}.
|
||||
*
|
||||
* @see Expr#isAlgebraicNumber
|
||||
* @param precision precision
|
||||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public RatNum toLower(int precision)
|
||||
{
|
||||
|
||||
return new RatNum(getContext(), Native.getAlgebraicNumberLower(getContext()
|
||||
.nCtx(), getNativeObject(), precision));
|
||||
}
|
||||
return new RatNum(getContext(), Native.getAlgebraicNumberLower(getContext()
|
||||
.nCtx(), getNativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation in decimal notation.
|
||||
* Remarks: The result has at most {@code precision} decimal places.
|
||||
* @param precision precision
|
||||
* @return String
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public String toDecimal(int precision)
|
||||
{
|
||||
/**
|
||||
* Returns a string representation in decimal notation.
|
||||
* Remarks: The result has at most {@code precision} decimal places.
|
||||
* @param precision precision
|
||||
* @return String
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public String toDecimal(int precision)
|
||||
{
|
||||
|
||||
return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
|
||||
precision);
|
||||
}
|
||||
return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
|
||||
precision);
|
||||
}
|
||||
|
||||
AlgebraicNum(Context ctx, long obj)
|
||||
{
|
||||
super(ctx, obj);
|
||||
AlgebraicNum(Context ctx, long obj)
|
||||
{
|
||||
super(ctx, obj);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,4 +56,10 @@ public class ArraySort extends Sort
|
|||
super(ctx, Native.mkArraySort(ctx.nCtx(), domain.getNativeObject(),
|
||||
range.getNativeObject()));
|
||||
}
|
||||
|
||||
ArraySort(Context ctx, Sort[] domains, Sort range)
|
||||
{
|
||||
super(ctx, Native.mkArraySortN(ctx.nCtx(), domains.length, AST.arrayToNative(domains),
|
||||
range.getNativeObject()));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -224,6 +224,17 @@ public class Context implements AutoCloseable {
|
|||
return new ArraySort(this, domain, range);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new array sort.
|
||||
**/
|
||||
public ArraySort mkArraySort(Sort[] domains, Sort range)
|
||||
{
|
||||
checkContextMatch(domains);
|
||||
checkContextMatch(range);
|
||||
return new ArraySort(this, domains, range);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new string sort
|
||||
**/
|
||||
|
@ -414,7 +425,7 @@ public class Context implements AutoCloseable {
|
|||
* that is passed in as argument is updated with value v,
|
||||
* the remaining fields of t are unchanged.
|
||||
**/
|
||||
public Expr MkUpdateField(FuncDecl field, Expr t, Expr v)
|
||||
public Expr mkUpdateField(FuncDecl field, Expr t, Expr v)
|
||||
throws Z3Exception
|
||||
{
|
||||
return Expr.create (this,
|
||||
|
@ -706,7 +717,7 @@ public class Context implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Mk an expression representing {@code not(a)}.
|
||||
* Create an expression representing {@code not(a)}.
|
||||
**/
|
||||
public BoolExpr mkNot(BoolExpr a)
|
||||
{
|
||||
|
@ -1679,6 +1690,28 @@ public class Context implements AutoCloseable {
|
|||
i.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Array read.
|
||||
* Remarks: The argument {@code a} is the array and
|
||||
* {@code args} are the indices of the array that gets read.
|
||||
*
|
||||
* The node {@code a} must have an array sort
|
||||
* {@code [domains -> range]}, and {@code args} must have the sorts
|
||||
* {@code domains}. The sort of the result is {@code range}.
|
||||
*
|
||||
* @see #mkArraySort
|
||||
* @see #mkStore
|
||||
|
||||
**/
|
||||
public Expr mkSelect(ArrayExpr a, Expr[] args)
|
||||
{
|
||||
checkContextMatch(a);
|
||||
checkContextMatch(args);
|
||||
return Expr.create(
|
||||
this,
|
||||
Native.mkSelectN(nCtx(), a.getNativeObject(), args.length, AST.arrayToNative(args)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Array update.
|
||||
* Remarks: The node {@code a} must have an array sort
|
||||
|
@ -1704,6 +1737,31 @@ public class Context implements AutoCloseable {
|
|||
i.getNativeObject(), v.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Array update.
|
||||
* Remarks: The node {@code a} must have an array sort
|
||||
* {@code [domains -> range]}, {@code i} must have sort
|
||||
* {@code domain}, {@code v} must have sort range. The sort of the
|
||||
* result is {@code [domains -> range]}. The semantics of this function
|
||||
* is given by the theory of arrays described in the SMT-LIB standard. See
|
||||
* http://smtlib.org for more details. The result of this function is an
|
||||
* array that is equal to {@code a} (with respect to
|
||||
* {@code select}) on all indices except for {@code args}, where it
|
||||
* maps to {@code v} (and the {@code select} of {@code a}
|
||||
* with respect to {@code args} may be a different value).
|
||||
* @see #mkArraySort
|
||||
* @see #mkSelect
|
||||
|
||||
**/
|
||||
public ArrayExpr mkStore(ArrayExpr a, Expr[] args, Expr v)
|
||||
{
|
||||
checkContextMatch(a);
|
||||
checkContextMatch(args);
|
||||
checkContextMatch(v);
|
||||
return new ArrayExpr(this, Native.mkStoreN(nCtx(), a.getNativeObject(),
|
||||
args.length, AST.arrayToNative(args), v.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a constant array.
|
||||
* Remarks: The resulting term is an array, such
|
||||
|
@ -1898,8 +1956,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public SeqExpr mkEmptySeq(Sort s)
|
||||
{
|
||||
checkContextMatch(s);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqEmpty(nCtx(), s.getNativeObject()));
|
||||
checkContextMatch(s);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqEmpty(nCtx(), s.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1907,8 +1965,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public SeqExpr mkUnit(Expr elem)
|
||||
{
|
||||
checkContextMatch(elem);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqUnit(nCtx(), elem.getNativeObject()));
|
||||
checkContextMatch(elem);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqUnit(nCtx(), elem.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1916,7 +1974,7 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public SeqExpr mkString(String s)
|
||||
{
|
||||
return (SeqExpr) Expr.create(this, Native.mkString(nCtx(), s));
|
||||
return (SeqExpr) Expr.create(this, Native.mkString(nCtx(), s));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1924,8 +1982,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public SeqExpr mkConcat(SeqExpr... t)
|
||||
{
|
||||
checkContextMatch(t);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqConcat(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
checkContextMatch(t);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqConcat(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1934,8 +1992,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public IntExpr mkLength(SeqExpr s)
|
||||
{
|
||||
checkContextMatch(s);
|
||||
return (IntExpr) Expr.create(this, Native.mkSeqLength(nCtx(), s.getNativeObject()));
|
||||
checkContextMatch(s);
|
||||
return (IntExpr) Expr.create(this, Native.mkSeqLength(nCtx(), s.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1943,8 +2001,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkPrefixOf(SeqExpr s1, SeqExpr s2)
|
||||
{
|
||||
checkContextMatch(s1, s2);
|
||||
return (BoolExpr) Expr.create(this, Native.mkSeqPrefix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
|
||||
checkContextMatch(s1, s2);
|
||||
return (BoolExpr) Expr.create(this, Native.mkSeqPrefix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1952,8 +2010,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkSuffixOf(SeqExpr s1, SeqExpr s2)
|
||||
{
|
||||
checkContextMatch(s1, s2);
|
||||
return (BoolExpr)Expr.create(this, Native.mkSeqSuffix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
|
||||
checkContextMatch(s1, s2);
|
||||
return (BoolExpr)Expr.create(this, Native.mkSeqSuffix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1961,8 +2019,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkContains(SeqExpr s1, SeqExpr s2)
|
||||
{
|
||||
checkContextMatch(s1, s2);
|
||||
return (BoolExpr) Expr.create(this, Native.mkSeqContains(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
|
||||
checkContextMatch(s1, s2);
|
||||
return (BoolExpr) Expr.create(this, Native.mkSeqContains(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1970,8 +2028,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public SeqExpr mkAt(SeqExpr s, IntExpr index)
|
||||
{
|
||||
checkContextMatch(s, index);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqAt(nCtx(), s.getNativeObject(), index.getNativeObject()));
|
||||
checkContextMatch(s, index);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqAt(nCtx(), s.getNativeObject(), index.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1979,8 +2037,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public SeqExpr mkExtract(SeqExpr s, IntExpr offset, IntExpr length)
|
||||
{
|
||||
checkContextMatch(s, offset, length);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqExtract(nCtx(), s.getNativeObject(), offset.getNativeObject(), length.getNativeObject()));
|
||||
checkContextMatch(s, offset, length);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqExtract(nCtx(), s.getNativeObject(), offset.getNativeObject(), length.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1988,8 +2046,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public IntExpr mkIndexOf(SeqExpr s, SeqExpr substr, ArithExpr offset)
|
||||
{
|
||||
checkContextMatch(s, substr, offset);
|
||||
return (IntExpr)Expr.create(this, Native.mkSeqIndex(nCtx(), s.getNativeObject(), substr.getNativeObject(), offset.getNativeObject()));
|
||||
checkContextMatch(s, substr, offset);
|
||||
return (IntExpr)Expr.create(this, Native.mkSeqIndex(nCtx(), s.getNativeObject(), substr.getNativeObject(), offset.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1997,8 +2055,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public SeqExpr mkReplace(SeqExpr s, SeqExpr src, SeqExpr dst)
|
||||
{
|
||||
checkContextMatch(s, src, dst);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqReplace(nCtx(), s.getNativeObject(), src.getNativeObject(), dst.getNativeObject()));
|
||||
checkContextMatch(s, src, dst);
|
||||
return (SeqExpr) Expr.create(this, Native.mkSeqReplace(nCtx(), s.getNativeObject(), src.getNativeObject(), dst.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2006,8 +2064,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkToRe(SeqExpr s)
|
||||
{
|
||||
checkContextMatch(s);
|
||||
return (ReExpr) Expr.create(this, Native.mkSeqToRe(nCtx(), s.getNativeObject()));
|
||||
checkContextMatch(s);
|
||||
return (ReExpr) Expr.create(this, Native.mkSeqToRe(nCtx(), s.getNativeObject()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2016,8 +2074,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkInRe(SeqExpr s, ReExpr re)
|
||||
{
|
||||
checkContextMatch(s, re);
|
||||
return (BoolExpr) Expr.create(this, Native.mkSeqInRe(nCtx(), s.getNativeObject(), re.getNativeObject()));
|
||||
checkContextMatch(s, re);
|
||||
return (BoolExpr) Expr.create(this, Native.mkSeqInRe(nCtx(), s.getNativeObject(), re.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2025,8 +2083,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkStar(ReExpr re)
|
||||
{
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkReStar(nCtx(), re.getNativeObject()));
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkReStar(nCtx(), re.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2034,7 +2092,7 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkLoop(ReExpr re, int lo, int hi)
|
||||
{
|
||||
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, hi));
|
||||
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, hi));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2042,7 +2100,7 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkLoop(ReExpr re, int lo)
|
||||
{
|
||||
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, 0));
|
||||
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2051,8 +2109,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkPlus(ReExpr re)
|
||||
{
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkRePlus(nCtx(), re.getNativeObject()));
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkRePlus(nCtx(), re.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2060,8 +2118,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkOption(ReExpr re)
|
||||
{
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkReOption(nCtx(), re.getNativeObject()));
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkReOption(nCtx(), re.getNativeObject()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2070,8 +2128,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkComplement(ReExpr re)
|
||||
{
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkReComplement(nCtx(), re.getNativeObject()));
|
||||
checkContextMatch(re);
|
||||
return (ReExpr) Expr.create(this, Native.mkReComplement(nCtx(), re.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2079,8 +2137,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkConcat(ReExpr... t)
|
||||
{
|
||||
checkContextMatch(t);
|
||||
return (ReExpr) Expr.create(this, Native.mkReConcat(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
checkContextMatch(t);
|
||||
return (ReExpr) Expr.create(this, Native.mkReConcat(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2088,8 +2146,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkUnion(ReExpr... t)
|
||||
{
|
||||
checkContextMatch(t);
|
||||
return (ReExpr) Expr.create(this, Native.mkReUnion(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
checkContextMatch(t);
|
||||
return (ReExpr) Expr.create(this, Native.mkReUnion(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2097,17 +2155,17 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public ReExpr mkIntersect(ReExpr... t)
|
||||
{
|
||||
checkContextMatch(t);
|
||||
return (ReExpr) Expr.create(this, Native.mkReIntersect(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
checkContextMatch(t);
|
||||
return (ReExpr) Expr.create(this, Native.mkReIntersect(nCtx(), t.length, AST.arrayToNative(t)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a range expression.
|
||||
*/
|
||||
public ReExpr MkRange(SeqExpr lo, SeqExpr hi)
|
||||
public ReExpr mkRange(SeqExpr lo, SeqExpr hi)
|
||||
{
|
||||
checkContextMatch(lo, hi);
|
||||
return (ReExpr) Expr.create(this, Native.mkReRange(nCtx(), lo.getNativeObject(), hi.getNativeObject()));
|
||||
checkContextMatch(lo, hi);
|
||||
return (ReExpr) Expr.create(this, Native.mkReRange(nCtx(), lo.getNativeObject(), hi.getNativeObject()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2116,8 +2174,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkAtMost(BoolExpr[] args, int k)
|
||||
{
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkAtmost(nCtx(), args.length, AST.arrayToNative(args), k));
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkAtmost(nCtx(), args.length, AST.arrayToNative(args), k));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2125,8 +2183,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkAtLeast(BoolExpr[] args, int k)
|
||||
{
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkAtleast(nCtx(), args.length, AST.arrayToNative(args), k));
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkAtleast(nCtx(), args.length, AST.arrayToNative(args), k));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2134,8 +2192,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkPBLe(int[] coeffs, BoolExpr[] args, int k)
|
||||
{
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkPble(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkPble(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2143,8 +2201,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkPBGe(int[] coeffs, BoolExpr[] args, int k)
|
||||
{
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkPbge(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkPbge(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2152,8 +2210,8 @@ public class Context implements AutoCloseable {
|
|||
*/
|
||||
public BoolExpr mkPBEq(int[] coeffs, BoolExpr[] args, int k)
|
||||
{
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkPbeq(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
|
||||
checkContextMatch(args);
|
||||
return (BoolExpr) Expr.create(this, Native.mkPbeq(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3988,15 +4046,15 @@ public class Context implements AutoCloseable {
|
|||
|
||||
void checkContextMatch(Z3Object other1, Z3Object other2)
|
||||
{
|
||||
checkContextMatch(other1);
|
||||
checkContextMatch(other2);
|
||||
checkContextMatch(other1);
|
||||
checkContextMatch(other2);
|
||||
}
|
||||
|
||||
void checkContextMatch(Z3Object other1, Z3Object other2, Z3Object other3)
|
||||
{
|
||||
checkContextMatch(other1);
|
||||
checkContextMatch(other2);
|
||||
checkContextMatch(other3);
|
||||
checkContextMatch(other1);
|
||||
checkContextMatch(other2);
|
||||
checkContextMatch(other3);
|
||||
}
|
||||
|
||||
void checkContextMatch(Z3Object[] arr)
|
||||
|
|
|
@ -65,7 +65,7 @@ public class EnumSort extends Sort
|
|||
**/
|
||||
public Expr getConst(int inx)
|
||||
{
|
||||
return getContext().mkApp(getConstDecl(inx));
|
||||
return getContext().mkApp(getConstDecl(inx));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1287,7 +1287,7 @@ public class Expr extends AST
|
|||
*/
|
||||
public String getString()
|
||||
{
|
||||
return Native.getString(getContext().nCtx(), getNativeObject());
|
||||
return Native.getString(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -200,7 +200,7 @@ public class Model extends Z3Object {
|
|||
* Remarks: This function may fail if {@code t} contains
|
||||
* quantifiers, is partial (MODEL_PARTIAL enabled), or if {@code t} is not well-sorted. In this case a
|
||||
* {@code ModelEvaluationFailedException} is thrown.
|
||||
* @param t the expression to evaluate
|
||||
* @param t the expression to evaluate
|
||||
* @param completion An expression {@code completion} When this flag
|
||||
* is enabled, a model value will be assigned to any constant or function
|
||||
* that does not have an interpretation in the model.
|
||||
|
|
|
@ -213,7 +213,7 @@ public class Optimize extends Z3Object {
|
|||
* Declare an arithmetical maximization objective.
|
||||
* Return a handle to the objective. The handle is used as
|
||||
* to retrieve the values of objectives after calling Check.
|
||||
**/
|
||||
**/
|
||||
public Handle MkMaximize(ArithExpr e)
|
||||
{
|
||||
return new Handle(this, Native.optimizeMaximize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
|
||||
|
@ -285,8 +285,7 @@ public class Optimize extends Z3Object {
|
|||
**/
|
||||
public String getReasonUnknown()
|
||||
{
|
||||
return Native.optimizeGetReasonUnknown(getContext().nCtx(),
|
||||
getNativeObject());
|
||||
return Native.optimizeGetReasonUnknown(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -298,6 +297,24 @@ public class Optimize extends Z3Object {
|
|||
return Native.optimizeToString(getContext().nCtx(), getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an SMT-LIB2 file with optimization objectives and constraints.
|
||||
* The parsed constraints and objectives are added to the optimization context.
|
||||
*/
|
||||
public void fromFile(String file)
|
||||
{
|
||||
Native.optimizeFromFile(getContext().nCtx(), getNativeObject(), file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to FromFile. Instead it takes as argument a string.
|
||||
*/
|
||||
public void fromString(String s)
|
||||
{
|
||||
Native.optimizeFromString(getContext().nCtx(), getNativeObject(), s);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Optimize statistics.
|
||||
**/
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ParamDescrs extends Z3Object {
|
|||
|
||||
public String getDocumentation(Symbol name)
|
||||
{
|
||||
return Native.paramDescrsGetDocumentation(getContext().nCtx(), getNativeObject(), name.getNativeObject());
|
||||
return Native.paramDescrsGetDocumentation(getContext().nCtx(), getNativeObject(), name.getNativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -302,7 +302,7 @@ public class Solver extends Z3Object {
|
|||
*/
|
||||
public Solver translate(Context ctx)
|
||||
{
|
||||
return new Solver(ctx, Native.solverTranslate(getContext().nCtx(), getNativeObject(), ctx.nCtx()));
|
||||
return new Solver(ctx, Native.solverTranslate(getContext().nCtx(), getNativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,12 +35,8 @@ public class Sort extends AST
|
|||
if (!(o instanceof Sort)) return false;
|
||||
Sort other = (Sort) o;
|
||||
|
||||
return (getContext().nCtx() == other.getContext().nCtx()) &&
|
||||
(Native.isEqSort(
|
||||
getContext().nCtx(),
|
||||
getNativeObject(),
|
||||
other.getNativeObject()
|
||||
));
|
||||
return (getContext().nCtx() == other.getContext().nCtx()) &&
|
||||
(Native.isEqSort(getContext().nCtx(), getNativeObject(), other.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1215,6 +1215,44 @@ struct
|
|||
let mk_numeral ctx v size = Z3native.mk_numeral ctx v (mk_sort ctx size)
|
||||
end
|
||||
|
||||
module Seq =
|
||||
struct
|
||||
let mk_seq_sort = Z3native.mk_seq_sort
|
||||
let is_seq_sort = Z3native.is_seq_sort
|
||||
let mk_re_sort = Z3native.mk_re_sort
|
||||
let is_re_sort = Z3native.is_re_sort
|
||||
let mk_string_sort = Z3native.mk_string_sort
|
||||
let is_string_sort = Z3native.is_string_sort
|
||||
let mk_string = Z3native.mk_string
|
||||
let is_string = Z3native.is_string
|
||||
let get_string = Z3native.get_string
|
||||
let mk_seq_empty = Z3native.mk_seq_empty
|
||||
let mk_seq_unit = Z3native.mk_seq_unit
|
||||
let mk_seq_concat ctx args = Z3native.mk_seq_concat ctx (List.length args) args
|
||||
let mk_seq_prefix = Z3native.mk_seq_prefix
|
||||
let mk_seq_suffix = Z3native.mk_seq_suffix
|
||||
let mk_seq_contains = Z3native.mk_seq_contains
|
||||
let mk_seq_extract = Z3native.mk_seq_extract
|
||||
let mk_seq_replace = Z3native.mk_seq_replace
|
||||
let mk_seq_at = Z3native.mk_seq_at
|
||||
let mk_seq_length = Z3native.mk_seq_length
|
||||
let mk_seq_index = Z3native.mk_seq_index
|
||||
let mk_str_to_int = Z3native.mk_str_to_int
|
||||
let mk_int_to_str = Z3native.mk_int_to_str
|
||||
let mk_seq_to_re = Z3native.mk_seq_to_re
|
||||
let mk_seq_in_re = Z3native.mk_seq_in_re
|
||||
let mk_re_plus = Z3native.mk_re_plus
|
||||
let mk_re_star = Z3native.mk_re_star
|
||||
let mk_re_option = Z3native.mk_re_option
|
||||
let mk_re_union ctx args = Z3native.mk_re_union ctx (List.length args) args
|
||||
let mk_re_concat ctx args = Z3native.mk_re_concat ctx (List.length args) args
|
||||
let mk_re_range = Z3native.mk_re_range
|
||||
let mk_re_loop = Z3native.mk_re_loop
|
||||
let mk_re_intersect = Z3native.mk_re_intersect
|
||||
let mk_re_complement = Z3native.mk_re_complement
|
||||
let mk_re_empty = Z3native.mk_re_empty
|
||||
let mk_re_full = Z3native.mk_re_full
|
||||
end
|
||||
|
||||
module FloatingPoint =
|
||||
struct
|
||||
|
@ -1926,7 +1964,7 @@ struct
|
|||
let from_file (x:optimize) (s:string) = Z3native.optimize_from_file (gc x) x s
|
||||
let from_string (x:optimize) (s:string) = Z3native.optimize_from_string (gc x) x s
|
||||
let get_assertions (x:optimize) = AST.ASTVector.to_expr_list (Z3native.optimize_get_assertions (gc x) x)
|
||||
let get_objectives (x:optimize) = AST.ASTVector.to_expr_list (Z3native.optimize_get_statistics (gc x) x)
|
||||
let get_objectives (x:optimize) = AST.ASTVector.to_expr_list (Z3native.optimize_get_objectives (gc x) x)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1825,6 +1825,116 @@ sig
|
|||
val mk_numeral : context -> string -> int -> Expr.expr
|
||||
end
|
||||
|
||||
(** Sequences, Strings and Regular Expressions **)
|
||||
module Seq :
|
||||
sig
|
||||
(* create a sequence sort *)
|
||||
val mk_seq_sort : context -> Sort.sort -> Sort.sort
|
||||
|
||||
(* test if sort is a sequence sort *)
|
||||
val is_seq_sort : context -> Sort.sort -> bool
|
||||
|
||||
(* create regular expression sorts over sequences of the argument sort *)
|
||||
val mk_re_sort : context -> Sort.sort -> Sort.sort
|
||||
|
||||
(* test if sort is a regular expression sort *)
|
||||
val is_re_sort : context -> Sort.sort -> bool
|
||||
|
||||
(* create string sort *)
|
||||
val mk_string_sort : context -> Sort.sort
|
||||
|
||||
(* test if sort is a string sort (a sequence of 8-bit bit-vectors) *)
|
||||
val is_string_sort : context -> Sort.sort -> bool
|
||||
|
||||
(* create a string literal *)
|
||||
val mk_string : context -> string -> Expr.expr
|
||||
|
||||
(* test if expression is a string *)
|
||||
val is_string : context -> Expr.expr -> bool
|
||||
|
||||
(* retrieve string from string Expr.expr *)
|
||||
val get_string : context -> Expr.expr -> string
|
||||
|
||||
(* the empty sequence over base sort *)
|
||||
val mk_seq_empty : context -> Sort.sort -> Expr.expr
|
||||
|
||||
(* a unit sequence *)
|
||||
val mk_seq_unit : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* sequence concatenation *)
|
||||
val mk_seq_concat : context -> Expr.expr list -> Expr.expr
|
||||
|
||||
(* predicate if the first argument is a prefix of the second *)
|
||||
val mk_seq_prefix : context -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* predicate if the first argument is a suffix of the second *)
|
||||
val mk_seq_suffix : context -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* predicate if the first argument contains the second *)
|
||||
val mk_seq_contains : context -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* extract sub-sequence starting at index given by second argument and of length provided by third argument *)
|
||||
val mk_seq_extract : context -> Expr.expr -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* replace first occurrence of second argument by third *)
|
||||
val mk_seq_replace : context -> Expr.expr -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* a unit sequence at index provided by second argument *)
|
||||
val mk_seq_at : context -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* length of a sequence *)
|
||||
val mk_seq_length : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* index of the first occurrence of the second argument in the first *)
|
||||
val mk_seq_index : context -> Expr.expr -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* retrieve integer expression encoded in string *)
|
||||
val mk_str_to_int : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* convert an integer expression to a string *)
|
||||
val mk_int_to_str : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* create regular expression that accepts the argument sequence *)
|
||||
val mk_seq_to_re : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* regular expression membership predicate *)
|
||||
val mk_seq_in_re : context -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* regular expression plus *)
|
||||
val mk_re_plus : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* regular expression star *)
|
||||
val mk_re_star : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* optional regular expression *)
|
||||
val mk_re_option : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* union of regular expressions *)
|
||||
val mk_re_union : context -> Expr.expr list -> Expr.expr
|
||||
|
||||
(* concatenation of regular expressions *)
|
||||
val mk_re_concat : context -> Expr.expr list -> Expr.expr
|
||||
|
||||
(* regular expression for the range between two characters *)
|
||||
val mk_re_range : context -> Expr.expr -> Expr.expr -> Expr.expr
|
||||
|
||||
(* bounded loop regular expression *)
|
||||
val mk_re_loop : context -> Expr.expr -> int -> int -> Expr.expr
|
||||
|
||||
(* intersection of regular expressions *)
|
||||
val mk_re_intersect : context -> int -> Expr.expr list -> Expr.expr
|
||||
|
||||
(* the regular expression complement *)
|
||||
val mk_re_complement : context -> Expr.expr -> Expr.expr
|
||||
|
||||
(* the regular expression that accepts no sequences *)
|
||||
val mk_re_empty : context -> Sort.sort -> Expr.expr
|
||||
|
||||
(* the regular expression that accepts all sequences *)
|
||||
val mk_re_full : context -> Sort.sort -> Expr.expr
|
||||
|
||||
end
|
||||
|
||||
(** Floating-Point Arithmetic *)
|
||||
module FloatingPoint :
|
||||
sig
|
||||
|
|
|
@ -25,31 +25,34 @@ extern "C" {
|
|||
#include <z3native_stubs.h>
|
||||
|
||||
#define CAMLlocal6(X1,X2,X3,X4,X5,X6) \
|
||||
CAMLlocal5(X1,X2,X3,X4,X5); \
|
||||
CAMLlocal5(X1,X2,X3,X4,X5); \
|
||||
CAMLlocal1(X6)
|
||||
#define CAMLlocal7(X1,X2,X3,X4,X5,X6,X7) \
|
||||
CAMLlocal5(X1,X2,X3,X4,X5); \
|
||||
#define CAMLlocal7(X1,X2,X3,X4,X5,X6,X7) \
|
||||
CAMLlocal5(X1,X2,X3,X4,X5); \
|
||||
CAMLlocal2(X6,X7)
|
||||
#define CAMLlocal8(X1,X2,X3,X4,X5,X6,X7,X8) \
|
||||
CAMLlocal5(X1,X2,X3,X4,X5); \
|
||||
#define CAMLlocal8(X1,X2,X3,X4,X5,X6,X7,X8) \
|
||||
CAMLlocal5(X1,X2,X3,X4,X5); \
|
||||
CAMLlocal3(X6,X7,X8)
|
||||
|
||||
#define CAMLparam7(X1,X2,X3,X4,X5,X6,X7) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
#define CAMLparam6(X1,X2,X3,X4,X5,X6) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam1(X6)
|
||||
#define CAMLparam7(X1,X2,X3,X4,X5,X6,X7) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam2(X6,X7)
|
||||
#define CAMLparam8(X1,X2,X3,X4,X5,X6,X7,X8) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
#define CAMLparam8(X1,X2,X3,X4,X5,X6,X7,X8) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam3(X6,X7,X8)
|
||||
#define CAMLparam9(X1,X2,X3,X4,X5,X6,X7,X8,X9) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
#define CAMLparam9(X1,X2,X3,X4,X5,X6,X7,X8,X9) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam4(X6,X7,X8,X9)
|
||||
#define CAMLparam12(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam5(X6,X7,X8,X9,X10); \
|
||||
#define CAMLparam12(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam5(X6,X7,X8,X9,X10); \
|
||||
CAMLxparam2(X11,X12)
|
||||
#define CAMLparam13(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam5(X6,X7,X8,X9,X10); \
|
||||
#define CAMLparam13(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13) \
|
||||
CAMLparam5(X1,X2,X3,X4,X5); \
|
||||
CAMLxparam5(X6,X7,X8,X9,X10); \
|
||||
CAMLxparam3(X11,X12,X13)
|
||||
|
||||
|
||||
|
|
|
@ -36,5 +36,5 @@ Notes:
|
|||
#define DLL_LOCAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -120,7 +120,7 @@ def _get_args(args):
|
|||
try:
|
||||
if len(args) == 1 and (isinstance(args[0], tuple) or isinstance(args[0], list)):
|
||||
return args[0]
|
||||
elif len(args) == 1 and isinstance(args[0], set):
|
||||
elif len(args) == 1 and (isinstance(args[0], set) or isinstance(args[0], AstVector)):
|
||||
return [arg for arg in args[0]]
|
||||
else:
|
||||
return args
|
||||
|
@ -6536,6 +6536,22 @@ class Fixedpoint(Z3PPObject):
|
|||
r = Z3_fixedpoint_query(self.ctx.ref(), self.fixedpoint, query.as_ast())
|
||||
return CheckSatResult(r)
|
||||
|
||||
def query_from_lvl (self, lvl, *query):
|
||||
"""Query the fixedpoint engine whether formula is derivable starting at the given query level.
|
||||
"""
|
||||
query = _get_args(query)
|
||||
sz = len(query)
|
||||
if sz >= 1 and isinstance(query[0], FuncDecl):
|
||||
_z3_assert (False, "unsupported")
|
||||
else:
|
||||
if sz == 1:
|
||||
query = query[0]
|
||||
else:
|
||||
query = And(query)
|
||||
query = self.abstract(query, False)
|
||||
r = Z3_fixedpoint_query_from_lvl (self.ctx.ref(), self.fixedpoint, query.as_ast(), lvl)
|
||||
return CheckSatResult(r)
|
||||
|
||||
def push(self):
|
||||
"""create a backtracking point for added rules, facts and assertions"""
|
||||
Z3_fixedpoint_push(self.ctx.ref(), self.fixedpoint)
|
||||
|
@ -6558,6 +6574,23 @@ class Fixedpoint(Z3PPObject):
|
|||
r = Z3_fixedpoint_get_answer(self.ctx.ref(), self.fixedpoint)
|
||||
return _to_expr_ref(r, self.ctx)
|
||||
|
||||
def get_ground_sat_answer(self):
|
||||
"""Retrieve a ground cex from last query call."""
|
||||
r = Z3_fixedpoint_get_ground_sat_answer(self.ctx.ref(), self.fixedpoint)
|
||||
return _to_expr_ref(r, self.ctx)
|
||||
|
||||
def get_rules_along_trace(self):
|
||||
"""retrieve rules along the counterexample trace"""
|
||||
return AstVector(Z3_fixedpoint_get_rules_along_trace(self.ctx.ref(), self.fixedpoint), self.ctx)
|
||||
|
||||
def get_rule_names_along_trace(self):
|
||||
"""retrieve rule names along the counterexample trace"""
|
||||
# this is a hack as I don't know how to return a list of symbols from C++;
|
||||
# obtain names as a single string separated by semicolons
|
||||
names = _symbol2py (self.ctx, Z3_fixedpoint_get_rule_names_along_trace(self.ctx.ref(), self.fixedpoint))
|
||||
# split into individual names
|
||||
return names.split (';')
|
||||
|
||||
def get_num_levels(self, predicate):
|
||||
"""Retrieve number of levels used for predicate in PDR engine"""
|
||||
return Z3_fixedpoint_get_num_levels(self.ctx.ref(), self.fixedpoint, predicate.ast)
|
||||
|
@ -8152,9 +8185,9 @@ def sequence_interpolant(v,p=None,ctx=None):
|
|||
If parameters p are supplied, these are used in creating the
|
||||
solver that determines satisfiability.
|
||||
|
||||
>>> x = Int('x')
|
||||
>>> y = Int('y')
|
||||
>>> print(sequence_interpolant([x < 0, y == x , y > 2]))
|
||||
x = Int('x')
|
||||
y = Int('y')
|
||||
print(sequence_interpolant([x < 0, y == x , y > 2]))
|
||||
[Not(x >= 0), Not(y >= 0)]
|
||||
"""
|
||||
f = v[0]
|
||||
|
|
22
src/api/z3.h
22
src/api/z3.h
|
@ -22,16 +22,16 @@ Notes:
|
|||
#define Z3_H_
|
||||
|
||||
#include<stdio.h>
|
||||
#include"z3_macros.h"
|
||||
#include"z3_api.h"
|
||||
#include"z3_ast_containers.h"
|
||||
#include"z3_algebraic.h"
|
||||
#include"z3_polynomial.h"
|
||||
#include"z3_rcf.h"
|
||||
#include"z3_fixedpoint.h"
|
||||
#include"z3_optimization.h"
|
||||
#include"z3_interp.h"
|
||||
#include"z3_fpa.h"
|
||||
|
||||
#include "z3_macros.h"
|
||||
#include "z3_api.h"
|
||||
#include "z3_ast_containers.h"
|
||||
#include "z3_algebraic.h"
|
||||
#include "z3_polynomial.h"
|
||||
#include "z3_rcf.h"
|
||||
#include "z3_fixedpoint.h"
|
||||
#include "z3_optimization.h"
|
||||
#include "z3_interp.h"
|
||||
#include "z3_fpa.h"
|
||||
#include "z3_spacer.h"
|
||||
#endif
|
||||
|
||||
|
|
130
src/api/z3_api.h
130
src/api/z3_api.h
|
@ -397,23 +397,23 @@ typedef enum
|
|||
(xor3 l1 l2 l3) <=> (xor (xor l1 l2) l3)
|
||||
|
||||
- Z3_OP_BSMUL_NO_OVFL: a predicate to check that bit-wise signed multiplication does not overflow.
|
||||
Signed multiplication overflows if the operands have the same sign and the result of multiplication
|
||||
Signed multiplication overflows if the operands have the same sign and the result of multiplication
|
||||
does not fit within the available bits. \sa Z3_mk_bvmul_no_overflow.
|
||||
|
||||
- Z3_OP_BUMUL_NO_OVFL: check that bit-wise unsigned multiplication does not overflow.
|
||||
Unsigned multiplication overflows if the result does not fit within the available bits.
|
||||
\sa Z3_mk_bvmul_no_overflow.
|
||||
|
||||
|
||||
- Z3_OP_BSMUL_NO_UDFL: check that bit-wise signed multiplication does not underflow.
|
||||
Signed multiplication underflows if the operands have opposite signs and the result of multiplication
|
||||
does not fit within the avaialble bits. Z3_mk_bvmul_no_underflow.
|
||||
|
||||
- Z3_OP_BSDIV_I: Binary signed division.
|
||||
|
||||
- Z3_OP_BSDIV_I: Binary signed division.
|
||||
It has the same semantics as Z3_OP_BSDIV, but created in a context where the second operand can be assumed to be non-zero.
|
||||
|
||||
- Z3_OP_BUDIV_I: Binary unsigned division.
|
||||
It has the same semantics as Z3_OP_BUDIV, but created in a context where the second operand can be assumed to be non-zero.
|
||||
|
||||
|
||||
- Z3_OP_BSREM_I: Binary signed remainder.
|
||||
It has the same semantics as Z3_OP_BSREM, but created in a context where the second operand can be assumed to be non-zero.
|
||||
|
||||
|
@ -979,7 +979,23 @@ typedef enum
|
|||
|
||||
- Z3_OP_FPA_TO_IEEE_BV: Floating-point conversion to IEEE-754 bit-vector
|
||||
|
||||
- Z3_OP_INTERNAL: internal (often interpreted) symbol, but no additional information is exposed. Tools may use the string representation of the function declaration to obtain more information.
|
||||
- Z3_OP_FPA_BVWRAP: (Implicitly) represents the internal bitvector-
|
||||
representation of a floating-point term (used for the lazy encoding
|
||||
of non-relevant terms in theory_fpa)
|
||||
|
||||
- Z3_OP_FPA_BV2RM: Conversion of a 3-bit bit-vector term to a
|
||||
floating-point rouding-mode term
|
||||
|
||||
The conversion uses the following values:
|
||||
0 = 000 = Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN,
|
||||
1 = 001 = Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY,
|
||||
2 = 010 = Z3_OP_FPA_RM_TOWARD_POSITIVE,
|
||||
3 = 011 = Z3_OP_FPA_RM_TOWARD_NEGATIVE,
|
||||
4 = 100 = Z3_OP_FPA_RM_TOWARD_ZERO.
|
||||
|
||||
- Z3_OP_INTERNAL: internal (often interpreted) symbol, but no additional
|
||||
information is exposed. Tools may use the string representation of the
|
||||
function declaration to obtain more information.
|
||||
|
||||
- Z3_OP_UNINTERPRETED: kind used for uninterpreted symbols.
|
||||
*/
|
||||
|
@ -1263,8 +1279,8 @@ typedef enum {
|
|||
|
||||
Z3_OP_FPA_TO_IEEE_BV,
|
||||
|
||||
Z3_OP_FPA_MIN_I,
|
||||
Z3_OP_FPA_MAX_I,
|
||||
Z3_OP_FPA_BVWRAP,
|
||||
Z3_OP_FPA_BV2RM,
|
||||
|
||||
Z3_OP_INTERNAL,
|
||||
|
||||
|
@ -1530,7 +1546,7 @@ extern "C" {
|
|||
In contrast to #Z3_mk_context_rc, the life time of Z3_ast objects
|
||||
are determined by the scope level of #Z3_solver_push and #Z3_solver_pop.
|
||||
In other words, a Z3_ast object remains valid until there is a
|
||||
call to Z3_pop that takes the current scope below the level where
|
||||
call to Z3_solver_pop that takes the current scope below the level where
|
||||
the object was created.
|
||||
|
||||
Note that all other reference counted objects, including Z3_model,
|
||||
|
@ -1865,6 +1881,17 @@ extern "C" {
|
|||
*/
|
||||
Z3_sort Z3_API Z3_mk_array_sort(Z3_context c, Z3_sort domain, Z3_sort range);
|
||||
|
||||
/**
|
||||
\brief Create an array type with N arguments
|
||||
|
||||
\sa Z3_mk_select_n
|
||||
\sa Z3_mk_store_n
|
||||
|
||||
def_API('Z3_mk_array_sort_n', SORT, (_in(CONTEXT), _in(UINT), _in_array(1, SORT), _in(SORT)))
|
||||
*/
|
||||
Z3_sort Z3_API Z3_mk_array_sort_n(Z3_context c, unsigned n, Z3_sort const * domain, Z3_sort range);
|
||||
|
||||
|
||||
/**
|
||||
\brief Create a tuple type.
|
||||
|
||||
|
@ -2957,6 +2984,15 @@ extern "C" {
|
|||
*/
|
||||
Z3_ast Z3_API Z3_mk_select(Z3_context c, Z3_ast a, Z3_ast i);
|
||||
|
||||
/**
|
||||
\brief n-ary Array read.
|
||||
The argument \c a is the array and \c idxs are the indices of the array that gets read.
|
||||
|
||||
def_API('Z3_mk_select_n', AST, (_in(CONTEXT), _in(AST), _in(UINT), _in_array(2, AST)))
|
||||
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_select_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs);
|
||||
|
||||
/**
|
||||
\brief Array update.
|
||||
|
||||
|
@ -2975,6 +3011,14 @@ extern "C" {
|
|||
*/
|
||||
Z3_ast Z3_API Z3_mk_store(Z3_context c, Z3_ast a, Z3_ast i, Z3_ast v);
|
||||
|
||||
/**
|
||||
\brief n-ary Array update.
|
||||
|
||||
def_API('Z3_mk_store_n', AST, (_in(CONTEXT), _in(AST), _in(UINT), _in_array(2, AST), _in(AST)))
|
||||
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_store_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs, Z3_ast v);
|
||||
|
||||
/**
|
||||
\brief Create the constant array.
|
||||
|
||||
|
@ -3015,6 +3059,15 @@ extern "C" {
|
|||
def_API('Z3_mk_array_default', AST, (_in(CONTEXT), _in(AST)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_array_default(Z3_context c, Z3_ast array);
|
||||
|
||||
/**
|
||||
\brief Create array with the same interpretation as a function.
|
||||
The array satisfies the property (f x) = (select (_ as-array f) x)
|
||||
for every argument x.
|
||||
|
||||
def_API('Z3_mk_as_array', AST, (_in(CONTEXT), _in(FUNC_DECL)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_as_array(Z3_context c, Z3_func_decl f);
|
||||
/*@}*/
|
||||
|
||||
/** @name Sets */
|
||||
|
@ -3361,7 +3414,7 @@ extern "C" {
|
|||
\brief Convert string to integer.
|
||||
|
||||
def_API('Z3_mk_str_to_int' ,AST ,(_in(CONTEXT), _in(AST)))
|
||||
*/
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_str_to_int(Z3_context c, Z3_ast s);
|
||||
|
||||
|
||||
|
@ -3369,7 +3422,7 @@ extern "C" {
|
|||
\brief Integer to string conversion.
|
||||
|
||||
def_API('Z3_mk_int_to_str' ,AST ,(_in(CONTEXT), _in(AST)))
|
||||
*/
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_int_to_str(Z3_context c, Z3_ast s);
|
||||
|
||||
/**
|
||||
|
@ -3838,6 +3891,7 @@ extern "C" {
|
|||
|
||||
/**
|
||||
\brief Return the domain of the given array sort.
|
||||
In the case of a multi-dimensional array, this function returns the sort of the first dimension.
|
||||
|
||||
\pre Z3_get_sort_kind(c, t) == Z3_ARRAY_SORT
|
||||
|
||||
|
@ -4680,6 +4734,14 @@ extern "C" {
|
|||
|
||||
/** @name Models */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
\brief Create a fresh model object. It has reference count 0.
|
||||
|
||||
def_API('Z3_mk_model', MODEL, (_in(CONTEXT),))
|
||||
*/
|
||||
Z3_model Z3_API Z3_mk_model(Z3_context c);
|
||||
|
||||
/**
|
||||
\brief Increment the reference counter of the given model.
|
||||
|
||||
|
@ -4850,6 +4912,26 @@ extern "C" {
|
|||
*/
|
||||
Z3_func_decl Z3_API Z3_get_as_array_func_decl(Z3_context c, Z3_ast a);
|
||||
|
||||
/**
|
||||
\brief Create a fresh func_interp object, add it to a model for a specified function.
|
||||
It has reference count 0.
|
||||
|
||||
\param c context
|
||||
\param m model
|
||||
\param f function declaration
|
||||
\param default_value default value for function interpretation
|
||||
|
||||
def_API('Z3_add_func_interp', FUNC_INTERP, (_in(CONTEXT), _in(MODEL), _in(FUNC_DECL), _in(AST)))
|
||||
*/
|
||||
Z3_func_interp Z3_API Z3_add_func_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast default_value);
|
||||
|
||||
/**
|
||||
\brief Add a constant interpretation.
|
||||
|
||||
def_API('Z3_add_const_interp', VOID, (_in(CONTEXT), _in(MODEL), _in(FUNC_DECL), _in(AST)))
|
||||
*/
|
||||
void Z3_API Z3_add_const_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast a);
|
||||
|
||||
/**
|
||||
\brief Increment the reference counter of the given Z3_func_interp object.
|
||||
|
||||
|
@ -4897,6 +4979,16 @@ extern "C" {
|
|||
*/
|
||||
Z3_ast Z3_API Z3_func_interp_get_else(Z3_context c, Z3_func_interp f);
|
||||
|
||||
/**
|
||||
\brief Return the 'else' value of the given function interpretation.
|
||||
|
||||
A function interpretation is represented as a finite map and an 'else' value.
|
||||
This procedure can be used to update the 'else' value.
|
||||
|
||||
def_API('Z3_func_interp_set_else', VOID, (_in(CONTEXT), _in(FUNC_INTERP), _in(AST)))
|
||||
*/
|
||||
void Z3_API Z3_func_interp_set_else(Z3_context c, Z3_func_interp f, Z3_ast else_value);
|
||||
|
||||
/**
|
||||
\brief Return the arity (number of arguments) of the given function interpretation.
|
||||
|
||||
|
@ -4904,6 +4996,22 @@ extern "C" {
|
|||
*/
|
||||
unsigned Z3_API Z3_func_interp_get_arity(Z3_context c, Z3_func_interp f);
|
||||
|
||||
/**
|
||||
\brief add a function entry to a function interpretation.
|
||||
|
||||
\param c logical context
|
||||
\param fi a function interpregation to be updated.
|
||||
\param args list of arguments. They should be constant values (such as integers) and be of the same types as the domain of the function.
|
||||
\param value value of the function when the parameters match args.
|
||||
|
||||
It is assumed that entries added to a function cover disjoint arguments.
|
||||
If an two entries are added with the same arguments, only the second insertion survives and the
|
||||
first inserted entry is removed.
|
||||
|
||||
def_API('Z3_func_interp_add_entry', VOID, (_in(CONTEXT), _in(FUNC_INTERP), _in(AST_VECTOR), _in(AST)))
|
||||
*/
|
||||
void Z3_API Z3_func_interp_add_entry(Z3_context c, Z3_func_interp fi, Z3_ast_vector args, Z3_ast value);
|
||||
|
||||
/**
|
||||
\brief Increment the reference counter of the given Z3_func_entry object.
|
||||
|
||||
|
|
|
@ -197,4 +197,4 @@ extern "C" {
|
|||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,7 @@ Notes:
|
|||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"symbol.h"
|
||||
#include "util/symbol.h"
|
||||
struct ll_escaped { char const * m_str; ll_escaped(char const * str):m_str(str) {} };
|
||||
static std::ostream & operator<<(std::ostream & out, ll_escaped const & d);
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ Notes:
|
|||
--*/
|
||||
|
||||
#include<iostream>
|
||||
#include"rational.h"
|
||||
#include"z3_macros.h"
|
||||
#include "util/rational.h"
|
||||
#include "api/z3_macros.h"
|
||||
|
||||
#ifndef Z3_PRIVATE_H_
|
||||
#define Z3_PRIVATE_H_
|
||||
|
|
|
@ -16,12 +16,12 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"vector.h"
|
||||
#include"map.h"
|
||||
#include"z3_replayer.h"
|
||||
#include"stream_buffer.h"
|
||||
#include"symbol.h"
|
||||
#include"trace.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/map.h"
|
||||
#include "api/z3_replayer.h"
|
||||
#include "util/stream_buffer.h"
|
||||
#include "util/symbol.h"
|
||||
#include "util/trace.h"
|
||||
#include<sstream>
|
||||
#include<vector>
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ Notes:
|
|||
#define Z3_REPLAYER_H_
|
||||
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"z3_exception.h"
|
||||
#include "api/z3.h"
|
||||
#include "util/z3_exception.h"
|
||||
|
||||
class z3_replayer;
|
||||
|
||||
|
|
143
src/api/z3_spacer.h
Normal file
143
src/api/z3_spacer.h
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Arie Gurfinkel
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_spacer.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Spacer API
|
||||
|
||||
Author:
|
||||
|
||||
Arie Gurfinkel (arie)
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef Z3_SPACER_H_
|
||||
#define Z3_SPACER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/** \defgroup capi C API */
|
||||
/*@{*/
|
||||
|
||||
/** @name Spacer facilities */
|
||||
/*@{*/
|
||||
/**
|
||||
\brief Pose a query against the asserted rules at the given level.
|
||||
|
||||
\code
|
||||
query ::= (exists (bound-vars) query)
|
||||
| literals
|
||||
\endcode
|
||||
|
||||
query returns
|
||||
- Z3_L_FALSE if the query is unsatisfiable.
|
||||
- Z3_L_TRUE if the query is satisfiable. Obtain the answer by calling #Z3_fixedpoint_get_answer.
|
||||
- Z3_L_UNDEF if the query was interrupted, timed out or otherwise failed.
|
||||
|
||||
def_API('Z3_fixedpoint_query_from_lvl', INT, (_in(CONTEXT), _in(FIXEDPOINT), _in(AST), _in(UINT)))
|
||||
*/
|
||||
Z3_lbool Z3_API Z3_fixedpoint_query_from_lvl (Z3_context c,Z3_fixedpoint d, Z3_ast query, unsigned lvl);
|
||||
|
||||
/**
|
||||
\brief Retrieve a bottom-up (from query) sequence of ground facts
|
||||
|
||||
The previous call to Z3_fixedpoint_query must have returned Z3_L_TRUE.
|
||||
|
||||
def_API('Z3_fixedpoint_get_ground_sat_answer', AST, (_in(CONTEXT), _in(FIXEDPOINT)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_fixedpoint_get_ground_sat_answer(Z3_context c,Z3_fixedpoint d);
|
||||
|
||||
/**
|
||||
\brief Obtain the list of rules along the counterexample trace.
|
||||
|
||||
def_API('Z3_fixedpoint_get_rules_along_trace', AST_VECTOR, (_in(CONTEXT), _in(FIXEDPOINT)))
|
||||
*/
|
||||
Z3_ast_vector Z3_API Z3_fixedpoint_get_rules_along_trace(Z3_context c,Z3_fixedpoint d);
|
||||
|
||||
/**
|
||||
\brief Obtain the list of rules along the counterexample trace.
|
||||
|
||||
def_API('Z3_fixedpoint_get_rule_names_along_trace', SYMBOL, (_in(CONTEXT), _in(FIXEDPOINT)))
|
||||
*/
|
||||
Z3_symbol Z3_API Z3_fixedpoint_get_rule_names_along_trace(Z3_context c,Z3_fixedpoint d);
|
||||
|
||||
/**
|
||||
\brief Add an invariant for the predicate \c pred.
|
||||
Add an assumed invariant of predicate \c pred.
|
||||
|
||||
Note: this functionality is Spacer specific.
|
||||
|
||||
def_API('Z3_fixedpoint_add_invariant', VOID, (_in(CONTEXT), _in(FIXEDPOINT), _in(FUNC_DECL), _in(AST)))
|
||||
*/
|
||||
void Z3_API Z3_fixedpoint_add_invariant(Z3_context c, Z3_fixedpoint d, Z3_func_decl pred, Z3_ast property);
|
||||
|
||||
|
||||
/**
|
||||
Retrieve reachable states of a predicate.
|
||||
Note: this functionality is Spacer specific.
|
||||
|
||||
def_API('Z3_fixedpoint_get_reachable', AST, (_in(CONTEXT), _in(FIXEDPOINT), _in(FUNC_DECL)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_fixedpoint_get_reachable(Z3_context c, Z3_fixedpoint d, Z3_func_decl pred);
|
||||
|
||||
/**
|
||||
\brief Project variables given a model
|
||||
|
||||
def_API('Z3_qe_model_project', AST, (_in(CONTEXT), _in(MODEL), _in(UINT), _in_array(2, APP), _in(AST)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_qe_model_project
|
||||
(Z3_context c,
|
||||
Z3_model m,
|
||||
unsigned num_bounds,
|
||||
Z3_app const bound[],
|
||||
Z3_ast body);
|
||||
|
||||
|
||||
/**
|
||||
\brief Project variables given a model
|
||||
|
||||
def_API('Z3_qe_model_project_skolem', AST, (_in(CONTEXT), _in(MODEL), _in(UINT), _in_array(2, APP), _in(AST), _in(AST_MAP)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_qe_model_project_skolem
|
||||
(Z3_context c,
|
||||
Z3_model m,
|
||||
unsigned num_bounds,
|
||||
Z3_app const bound[],
|
||||
Z3_ast body,
|
||||
Z3_ast_map map);
|
||||
|
||||
/**
|
||||
\brief Extrapolates a model of a formula
|
||||
|
||||
def_API('Z3_model_extrapolate', AST, (_in(CONTEXT), _in(MODEL), _in(AST)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_model_extrapolate
|
||||
(Z3_context c,
|
||||
Z3_model m,
|
||||
Z3_ast fml);
|
||||
|
||||
/**
|
||||
\brief Best-effort quantifier elimination
|
||||
|
||||
def_API ('Z3_qe_lite', AST, (_in(CONTEXT), _in(AST_VECTOR), _in(AST)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_qe_lite
|
||||
(Z3_context c,
|
||||
Z3_ast_vector vars,
|
||||
Z3_ast body);
|
||||
|
||||
/*@}*/
|
||||
/*@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
|
@ -21,7 +21,7 @@ Notes:
|
|||
#ifndef Z3_V1_H_
|
||||
#define Z3_V1_H_
|
||||
|
||||
#include"z3.h"
|
||||
#include "api/z3.h"
|
||||
|
||||
// Backwards compatibility
|
||||
#define Z3_type_ast Z3_sort
|
||||
|
|
|
@ -10,6 +10,7 @@ z3_add_component(ast
|
|||
ast_printer.cpp
|
||||
ast_smt2_pp.cpp
|
||||
ast_smt_pp.cpp
|
||||
ast_pp_dot.cpp
|
||||
ast_translation.cpp
|
||||
ast_util.cpp
|
||||
bv_decl_plugin.cpp
|
||||
|
@ -23,6 +24,7 @@ z3_add_component(ast
|
|||
expr_map.cpp
|
||||
expr_stat.cpp
|
||||
expr_substitution.cpp
|
||||
factor_equivs.cpp
|
||||
for_each_ast.cpp
|
||||
for_each_expr.cpp
|
||||
format.cpp
|
||||
|
|
|
@ -17,7 +17,7 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"act_cache.h"
|
||||
#include "ast/act_cache.h"
|
||||
|
||||
#define MIN_MAX_UNUSED 1024
|
||||
#define INITIAL_CAPACITY 128
|
||||
|
|
|
@ -20,9 +20,9 @@ Notes:
|
|||
#ifndef ACT_CACHE_H_
|
||||
#define ACT_CACHE_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"obj_hashtable.h"
|
||||
#include"chashtable.h"
|
||||
#include "ast/ast.h"
|
||||
#include "util/obj_hashtable.h"
|
||||
#include "util/chashtable.h"
|
||||
|
||||
class act_cache {
|
||||
ast_manager & m_manager;
|
||||
|
|
|
@ -16,11 +16,11 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"warning.h"
|
||||
#include"algebraic_numbers.h"
|
||||
#include"id_gen.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "util/warning.h"
|
||||
#include "math/polynomial/algebraic_numbers.h"
|
||||
#include "util/id_gen.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
struct arith_decl_plugin::algebraic_numbers_wrapper {
|
||||
unsynch_mpq_manager m_qmanager;
|
||||
|
@ -81,8 +81,9 @@ app * arith_decl_plugin::mk_numeral(algebraic_numbers::anum const & val, bool is
|
|||
return mk_numeral(rval, is_int);
|
||||
}
|
||||
else {
|
||||
if (is_int)
|
||||
if (is_int) {
|
||||
m_manager->raise_exception("invalid irrational value passed as an integer");
|
||||
}
|
||||
unsigned idx = aw().mk_id(val);
|
||||
parameter p(idx, true);
|
||||
SASSERT(p.is_external());
|
||||
|
@ -214,18 +215,8 @@ void arith_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
|||
m_e = m->mk_const(e_decl);
|
||||
m->inc_ref(m_e);
|
||||
|
||||
func_decl * z_pw_z_int = m->mk_const_decl(symbol("0^0-int"), i, func_decl_info(id, OP_0_PW_0_INT));
|
||||
m_0_pw_0_int = m->mk_const(z_pw_z_int);
|
||||
m->inc_ref(m_0_pw_0_int);
|
||||
|
||||
func_decl * z_pw_z_real = m->mk_const_decl(symbol("0^0-real"), r, func_decl_info(id, OP_0_PW_0_REAL));
|
||||
m_0_pw_0_real = m->mk_const(z_pw_z_real);
|
||||
m->inc_ref(m_0_pw_0_real);
|
||||
|
||||
MK_OP(m_neg_root_decl, "neg-root", OP_NEG_ROOT, r);
|
||||
MK_UNARY(m_div_0_decl, "/0", OP_DIV_0, r);
|
||||
MK_UNARY(m_idiv_0_decl, "div0", OP_IDIV_0, i);
|
||||
MK_UNARY(m_mod_0_decl, "mod0", OP_MOD_0, i);
|
||||
MK_UNARY(m_u_asin_decl, "asin-u", OP_U_ASIN, r);
|
||||
MK_UNARY(m_u_acos_decl, "acos-u", OP_U_ACOS, r);
|
||||
}
|
||||
|
@ -278,12 +269,7 @@ arith_decl_plugin::arith_decl_plugin():
|
|||
m_atanh_decl(0),
|
||||
m_pi(0),
|
||||
m_e(0),
|
||||
m_0_pw_0_int(0),
|
||||
m_0_pw_0_real(0),
|
||||
m_neg_root_decl(0),
|
||||
m_div_0_decl(0),
|
||||
m_idiv_0_decl(0),
|
||||
m_mod_0_decl(0),
|
||||
m_u_asin_decl(0),
|
||||
m_u_acos_decl(0),
|
||||
m_convert_int_numerals_to_real(false) {
|
||||
|
@ -338,12 +324,7 @@ void arith_decl_plugin::finalize() {
|
|||
DEC_REF(m_atanh_decl);
|
||||
DEC_REF(m_pi);
|
||||
DEC_REF(m_e);
|
||||
DEC_REF(m_0_pw_0_int);
|
||||
DEC_REF(m_0_pw_0_real);
|
||||
DEC_REF(m_neg_root_decl);
|
||||
DEC_REF(m_div_0_decl);
|
||||
DEC_REF(m_idiv_0_decl);
|
||||
DEC_REF(m_mod_0_decl);
|
||||
DEC_REF(m_u_asin_decl);
|
||||
DEC_REF(m_u_acos_decl);
|
||||
m_manager->dec_array_ref(m_small_ints.size(), m_small_ints.c_ptr());
|
||||
|
@ -391,18 +372,24 @@ inline func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, bool is_real) {
|
|||
case OP_ATANH: return m_atanh_decl;
|
||||
case OP_PI: return m_pi->get_decl();
|
||||
case OP_E: return m_e->get_decl();
|
||||
case OP_0_PW_0_INT: return m_0_pw_0_int->get_decl();
|
||||
case OP_0_PW_0_REAL: return m_0_pw_0_real->get_decl();
|
||||
//case OP_0_PW_0_INT: return m_0_pw_0_int->get_decl();
|
||||
//case OP_0_PW_0_REAL: return m_0_pw_0_real->get_decl();
|
||||
case OP_NEG_ROOT: return m_neg_root_decl;
|
||||
case OP_DIV_0: return m_div_0_decl;
|
||||
case OP_IDIV_0: return m_idiv_0_decl;
|
||||
case OP_MOD_0: return m_mod_0_decl;
|
||||
//case OP_DIV_0: return m_div_0_decl;
|
||||
//case OP_IDIV_0: return m_idiv_0_decl;
|
||||
//case OP_MOD_0: return m_mod_0_decl;
|
||||
case OP_U_ASIN: return m_u_asin_decl;
|
||||
case OP_U_ACOS: return m_u_acos_decl;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void arith_decl_plugin::check_arity(unsigned arity, unsigned expected_arity) {
|
||||
if (arity != expected_arity) {
|
||||
m_manager->raise_exception("invalid number of arguments passed to function");
|
||||
}
|
||||
}
|
||||
|
||||
inline decl_kind arith_decl_plugin::fix_kind(decl_kind k, unsigned arity) {
|
||||
if (k == OP_SUB && arity == 1) {
|
||||
return OP_UMINUS;
|
||||
|
@ -482,9 +469,9 @@ static bool has_real_arg(ast_manager * m, unsigned num_args, expr * const * args
|
|||
static bool is_const_op(decl_kind k) {
|
||||
return
|
||||
k == OP_PI ||
|
||||
k == OP_E ||
|
||||
k == OP_0_PW_0_INT ||
|
||||
k == OP_0_PW_0_REAL;
|
||||
k == OP_E;
|
||||
//k == OP_0_PW_0_INT ||
|
||||
//k == OP_0_PW_0_REAL;
|
||||
}
|
||||
|
||||
func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef ARITH_DECL_PLUGIN_H_
|
||||
#define ARITH_DECL_PLUGIN_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include "ast/ast.h"
|
||||
class sexpr;
|
||||
|
||||
namespace algebraic_numbers {
|
||||
|
@ -70,12 +70,7 @@ enum arith_op_kind {
|
|||
OP_PI,
|
||||
OP_E,
|
||||
// under-specified symbols
|
||||
OP_0_PW_0_INT, // 0^0 for integers
|
||||
OP_0_PW_0_REAL, // 0^0 for reals
|
||||
OP_NEG_ROOT, // x^n when n is even and x is negative
|
||||
OP_DIV_0, // x/0
|
||||
OP_IDIV_0, // x div 0
|
||||
OP_MOD_0, // x mod 0
|
||||
OP_U_ASIN, // asin(x) for x < -1 or x > 1
|
||||
OP_U_ACOS, // acos(x) for x < -1 or x > 1
|
||||
LAST_ARITH_OP
|
||||
|
@ -141,12 +136,7 @@ protected:
|
|||
app * m_pi;
|
||||
app * m_e;
|
||||
|
||||
app * m_0_pw_0_int;
|
||||
app * m_0_pw_0_real;
|
||||
func_decl * m_neg_root_decl;
|
||||
func_decl * m_div_0_decl;
|
||||
func_decl * m_idiv_0_decl;
|
||||
func_decl * m_mod_0_decl;
|
||||
func_decl * m_u_asin_decl;
|
||||
func_decl * m_u_acos_decl;
|
||||
ptr_vector<app> m_small_ints;
|
||||
|
@ -157,6 +147,7 @@ protected:
|
|||
func_decl * mk_func_decl(decl_kind k, bool is_real);
|
||||
virtual void set_manager(ast_manager * m, family_id id);
|
||||
decl_kind fix_kind(decl_kind k, unsigned arity);
|
||||
void check_arity(unsigned arity, unsigned expected_arity);
|
||||
func_decl * mk_num_decl(unsigned num_parameters, parameter const * parameters, unsigned arity);
|
||||
|
||||
public:
|
||||
|
@ -206,10 +197,6 @@ public:
|
|||
|
||||
app * mk_e() const { return m_e; }
|
||||
|
||||
app * mk_0_pw_0_int() const { return m_0_pw_0_int; }
|
||||
|
||||
app * mk_0_pw_0_real() const { return m_0_pw_0_real; }
|
||||
|
||||
virtual expr * get_some_value(sort * s);
|
||||
|
||||
virtual bool is_considered_uninterpreted(func_decl * f) {
|
||||
|
@ -217,12 +204,7 @@ public:
|
|||
return false;
|
||||
switch (f->get_decl_kind())
|
||||
{
|
||||
case OP_0_PW_0_INT:
|
||||
case OP_0_PW_0_REAL:
|
||||
case OP_NEG_ROOT:
|
||||
case OP_DIV_0:
|
||||
case OP_IDIV_0:
|
||||
case OP_MOD_0:
|
||||
case OP_U_ASIN:
|
||||
case OP_U_ACOS:
|
||||
return true;
|
||||
|
@ -275,9 +257,9 @@ public:
|
|||
bool is_uminus(expr const * n) const { return is_app_of(n, m_afid, OP_UMINUS); }
|
||||
bool is_mul(expr const * n) const { return is_app_of(n, m_afid, OP_MUL); }
|
||||
bool is_div(expr const * n) const { return is_app_of(n, m_afid, OP_DIV); }
|
||||
bool is_div0(expr const * n) const { return is_app_of(n, m_afid, OP_DIV_0); }
|
||||
//bool is_div0(expr const * n) const { return is_app_of(n, m_afid, OP_DIV_0); }
|
||||
bool is_idiv(expr const * n) const { return is_app_of(n, m_afid, OP_IDIV); }
|
||||
bool is_idiv0(expr const * n) const { return is_app_of(n, m_afid, OP_IDIV_0); }
|
||||
//bool is_idiv0(expr const * n) const { return is_app_of(n, m_afid, OP_IDIV_0); }
|
||||
bool is_mod(expr const * n) const { return is_app_of(n, m_afid, OP_MOD); }
|
||||
bool is_rem(expr const * n) const { return is_app_of(n, m_afid, OP_REM); }
|
||||
bool is_to_real(expr const * n) const { return is_app_of(n, m_afid, OP_TO_REAL); }
|
||||
|
@ -388,16 +370,16 @@ public:
|
|||
app * mk_lt(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_LT, arg1, arg2); }
|
||||
app * mk_gt(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_GT, arg1, arg2); }
|
||||
|
||||
app * mk_add(unsigned num_args, expr * const * args) { return m_manager.mk_app(m_afid, OP_ADD, num_args, args); }
|
||||
app * mk_add(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_ADD, arg1, arg2); }
|
||||
app * mk_add(expr * arg1, expr * arg2, expr* arg3) { return m_manager.mk_app(m_afid, OP_ADD, arg1, arg2, arg3); }
|
||||
app * mk_add(unsigned num_args, expr * const * args) const { return m_manager.mk_app(m_afid, OP_ADD, num_args, args); }
|
||||
app * mk_add(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_ADD, arg1, arg2); }
|
||||
app * mk_add(expr * arg1, expr * arg2, expr* arg3) const { return m_manager.mk_app(m_afid, OP_ADD, arg1, arg2, arg3); }
|
||||
|
||||
app * mk_sub(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_SUB, arg1, arg2); }
|
||||
app * mk_sub(unsigned num_args, expr * const * args) { return m_manager.mk_app(m_afid, OP_SUB, num_args, args); }
|
||||
app * mk_mul(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_MUL, arg1, arg2); }
|
||||
app * mk_mul(expr * arg1, expr * arg2, expr* arg3) { return m_manager.mk_app(m_afid, OP_MUL, arg1, arg2, arg3); }
|
||||
app * mk_mul(unsigned num_args, expr * const * args) { return m_manager.mk_app(m_afid, OP_MUL, num_args, args); }
|
||||
app * mk_uminus(expr * arg) { return m_manager.mk_app(m_afid, OP_UMINUS, arg); }
|
||||
app * mk_sub(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_SUB, arg1, arg2); }
|
||||
app * mk_sub(unsigned num_args, expr * const * args) const { return m_manager.mk_app(m_afid, OP_SUB, num_args, args); }
|
||||
app * mk_mul(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_MUL, arg1, arg2); }
|
||||
app * mk_mul(expr * arg1, expr * arg2, expr* arg3) const { return m_manager.mk_app(m_afid, OP_MUL, arg1, arg2, arg3); }
|
||||
app * mk_mul(unsigned num_args, expr * const * args) const { return m_manager.mk_app(m_afid, OP_MUL, num_args, args); }
|
||||
app * mk_uminus(expr * arg) const { return m_manager.mk_app(m_afid, OP_UMINUS, arg); }
|
||||
app * mk_div(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_DIV, arg1, arg2); }
|
||||
app * mk_idiv(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_IDIV, arg1, arg2); }
|
||||
app * mk_rem(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_REM, arg1, arg2); }
|
||||
|
@ -424,11 +406,6 @@ public:
|
|||
app * mk_pi() { return plugin().mk_pi(); }
|
||||
app * mk_e() { return plugin().mk_e(); }
|
||||
|
||||
app * mk_0_pw_0_int() { return plugin().mk_0_pw_0_int(); }
|
||||
app * mk_0_pw_0_real() { return plugin().mk_0_pw_0_real(); }
|
||||
app * mk_div0(expr * arg) { return m_manager.mk_app(m_afid, OP_DIV_0, arg); }
|
||||
app * mk_idiv0(expr * arg) { return m_manager.mk_app(m_afid, OP_IDIV_0, arg); }
|
||||
app * mk_mod0(expr * arg) { return m_manager.mk_app(m_afid, OP_MOD_0, arg); }
|
||||
app * mk_neg_root(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_NEG_ROOT, arg1, arg2); }
|
||||
app * mk_u_asin(expr * arg) { return m_manager.mk_app(m_afid, OP_U_ASIN, arg); }
|
||||
app * mk_u_acos(expr * arg) { return m_manager.mk_app(m_afid, OP_U_ACOS, arg); }
|
||||
|
|
|
@ -17,10 +17,10 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<sstream>
|
||||
#include"array_decl_plugin.h"
|
||||
#include"warning.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "util/warning.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
|
||||
array_decl_plugin::array_decl_plugin():
|
||||
m_store_sym("store"),
|
||||
|
@ -242,7 +242,9 @@ func_decl* array_decl_plugin::mk_select(unsigned arity, sort * const * domain) {
|
|||
parameter const* parameters = s->get_parameters();
|
||||
|
||||
if (num_parameters != arity) {
|
||||
m_manager->raise_exception("select requires as many arguments as the size of the domain");
|
||||
std::stringstream strm;
|
||||
strm << "select requires " << num_parameters << " arguments, but was provided with " << arity << " arguments";
|
||||
m_manager->raise_exception(strm.str().c_str());
|
||||
return 0;
|
||||
}
|
||||
ptr_buffer<sort> new_domain; // we need this because of coercions.
|
||||
|
@ -314,7 +316,7 @@ func_decl * array_decl_plugin::mk_array_ext(unsigned arity, sort * const * domai
|
|||
return 0;
|
||||
}
|
||||
sort * r = to_sort(s->get_parameter(i).get_ast());
|
||||
parameter param(s);
|
||||
parameter param(i);
|
||||
return m_manager->mk_func_decl(m_array_ext_sym, arity, domain, r, func_decl_info(m_family_id, OP_ARRAY_EXT, 1, ¶m));
|
||||
}
|
||||
|
||||
|
@ -546,7 +548,7 @@ expr * array_decl_plugin::get_some_value(sort * s) {
|
|||
return m_manager->mk_app(m_family_id, OP_CONST_ARRAY, 1, &p, 1, &v);
|
||||
}
|
||||
|
||||
bool array_decl_plugin::is_fully_interp(sort const * s) const {
|
||||
bool array_decl_plugin::is_fully_interp(sort * s) const {
|
||||
SASSERT(s->is_sort_of(m_family_id, ARRAY_SORT));
|
||||
unsigned sz = get_array_arity(s);
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
|
@ -556,9 +558,9 @@ bool array_decl_plugin::is_fully_interp(sort const * s) const {
|
|||
return m_manager->is_fully_interp(get_array_range(s));
|
||||
}
|
||||
|
||||
func_decl * array_recognizers::get_as_array_func_decl(app * n) const {
|
||||
func_decl * array_recognizers::get_as_array_func_decl(expr * n) const {
|
||||
SASSERT(is_as_array(n));
|
||||
return to_func_decl(n->get_decl()->get_parameter(0).get_ast());
|
||||
return to_func_decl(to_app(n)->get_decl()->get_parameter(0).get_ast());
|
||||
}
|
||||
|
||||
array_util::array_util(ast_manager& m):
|
||||
|
@ -592,3 +594,9 @@ sort * array_util::mk_array_sort(unsigned arity, sort* const* domain, sort* rang
|
|||
params.push_back(parameter(range));
|
||||
return m_manager.mk_sort(m_fid, ARRAY_SORT, params.size(), params.c_ptr());
|
||||
}
|
||||
|
||||
func_decl* array_util::mk_array_ext(sort *domain, unsigned i) {
|
||||
sort * domains[2] = { domain, domain };
|
||||
parameter p(i);
|
||||
return m_manager.mk_func_decl(m_fid, OP_ARRAY_EXT, 1, &p, 2, domains);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef ARRAY_DECL_PLUGIN_H_
|
||||
#define ARRAY_DECL_PLUGIN_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include "ast/ast.h"
|
||||
|
||||
|
||||
inline sort* get_array_range(sort const * s) {
|
||||
|
@ -127,7 +127,7 @@ class array_decl_plugin : public decl_plugin {
|
|||
|
||||
virtual expr * get_some_value(sort * s);
|
||||
|
||||
virtual bool is_fully_interp(sort const * s) const;
|
||||
virtual bool is_fully_interp(sort * s) const;
|
||||
};
|
||||
|
||||
class array_recognizers {
|
||||
|
@ -143,12 +143,13 @@ public:
|
|||
bool is_const(expr* n) const { return is_app_of(n, m_fid, OP_CONST_ARRAY); }
|
||||
bool is_map(expr* n) const { return is_app_of(n, m_fid, OP_ARRAY_MAP); }
|
||||
bool is_as_array(expr * n) const { return is_app_of(n, m_fid, OP_AS_ARRAY); }
|
||||
bool is_as_array(expr * n, func_decl*& f) const { return is_as_array(n) && (f = get_as_array_func_decl(n), true); }
|
||||
bool is_select(func_decl* f) const { return is_decl_of(f, m_fid, OP_SELECT); }
|
||||
bool is_store(func_decl* f) const { return is_decl_of(f, m_fid, OP_STORE); }
|
||||
bool is_const(func_decl* f) const { return is_decl_of(f, m_fid, OP_CONST_ARRAY); }
|
||||
bool is_map(func_decl* f) const { return is_decl_of(f, m_fid, OP_ARRAY_MAP); }
|
||||
bool is_as_array(func_decl* f) const { return is_decl_of(f, m_fid, OP_AS_ARRAY); }
|
||||
func_decl * get_as_array_func_decl(app * n) const;
|
||||
func_decl * get_as_array_func_decl(expr * n) const;
|
||||
};
|
||||
|
||||
class array_util : public array_recognizers {
|
||||
|
@ -182,13 +183,15 @@ public:
|
|||
return mk_const_array(s, m_manager.mk_true());
|
||||
}
|
||||
|
||||
func_decl * mk_array_ext(sort* domain, unsigned i);
|
||||
|
||||
sort * mk_array_sort(sort* dom, sort* range) { return mk_array_sort(1, &dom, range); }
|
||||
|
||||
sort * mk_array_sort(unsigned arity, sort* const* domain, sort* range);
|
||||
|
||||
app * mk_as_array(sort * s, func_decl * f) {
|
||||
app * mk_as_array(func_decl * f) {
|
||||
parameter param(f);
|
||||
return m_manager.mk_app(m_fid, OP_AS_ARRAY, 1, ¶m, 0, 0, s);
|
||||
return m_manager.mk_app(m_fid, OP_AS_ARRAY, 1, ¶m, 0, 0, 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