3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-20 21:03:39 +00:00

merge with master branch

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-09-19 09:39:22 -07:00
commit 651587ce01
1602 changed files with 40496 additions and 27837 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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,31 @@ 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);
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 +319,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 +337,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);

View file

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

View file

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

View file

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

View file

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

View file

@ -16,15 +16,15 @@ 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_ast_vector.h"
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
#include "api/api_util.h"
#include "api/api_ast_vector.h"
#include "cmd_context/cmd_context.h"
#include "parsers/smt2/smt2parser.h"
#include "parsers/smt/smtparser.h"
#include "solver/solver_na2as.h"
extern "C" {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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" {
@ -306,10 +306,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);
}
@ -476,10 +480,14 @@ extern "C" {
result = to_solver_ref(s)->get_consequences(_assumptions, _variables, _consequences);
}
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);
}
for (unsigned i = 0; i < _consequences.size(); ++i) {
to_ast_vector_ref(consequences).push_back(_consequences[i].get());
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1731,6 +1731,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 +1748,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 +1804,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; }

View file

@ -298,6 +298,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.
**/

View file

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

View file

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

View file

@ -34,6 +34,9 @@ extern "C" {
CAMLlocal5(X1,X2,X3,X4,X5); \
CAMLlocal3(X6,X7,X8)
#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)

View file

@ -6551,6 +6551,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)
@ -6573,6 +6589,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)
@ -8167,9 +8200,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]

View file

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

View file

@ -1530,7 +1530,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,
@ -4680,6 +4680,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 +4858,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 +4925,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 +4942,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.

View file

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

View file

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

View file

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

View file

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

View file

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