mirror of
https://github.com/Z3Prover/z3
synced 2025-10-05 23:43:59 +00:00
merge with master branch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
651587ce01
1602 changed files with 40496 additions and 27837 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})
|
||||
|
@ -67,9 +68,6 @@ 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/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
|
||||
|
|
|
@ -13,10 +13,10 @@ 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 {
|
||||
|
|
|
@ -16,8 +16,8 @@ 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);
|
||||
|
|
|
@ -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" {
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,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);
|
||||
|
|
|
@ -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" {
|
||||
|
||||
|
|
|
@ -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,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" {
|
||||
|
||||
|
|
|
@ -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" {
|
||||
|
||||
|
|
|
@ -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" {
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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.
|
||||
**/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -23,6 +23,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"),
|
||||
|
@ -546,7 +546,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 +556,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):
|
||||
|
|
|
@ -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 {
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
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 {
|
||||
|
|
116
src/ast/ast.cpp
116
src/ast/ast.cpp
|
@ -18,14 +18,14 @@ Revision History:
|
|||
--*/
|
||||
#include<sstream>
|
||||
#include<cstring>
|
||||
#include"ast.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include"buffer.h"
|
||||
#include"warning.h"
|
||||
#include"string_buffer.h"
|
||||
#include"ast_util.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "ast/ast.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "util/buffer.h"
|
||||
#include "util/warning.h"
|
||||
#include "util/string_buffer.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
@ -35,7 +35,7 @@ Revision History:
|
|||
|
||||
parameter::~parameter() {
|
||||
if (m_kind == PARAM_RATIONAL) {
|
||||
reinterpret_cast<rational *>(m_rational)->~rational();
|
||||
dealloc(m_rational);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,14 +50,14 @@ parameter& parameter::operator=(parameter const& other) {
|
|||
return *this;
|
||||
}
|
||||
if (m_kind == PARAM_RATIONAL) {
|
||||
reinterpret_cast<rational *>(m_rational)->~rational();
|
||||
dealloc(m_rational);
|
||||
}
|
||||
m_kind = other.m_kind;
|
||||
switch(other.m_kind) {
|
||||
case PARAM_INT: m_int = other.get_int(); break;
|
||||
case PARAM_AST: m_ast = other.get_ast(); break;
|
||||
case PARAM_SYMBOL: new (m_symbol) symbol(other.get_symbol()); break;
|
||||
case PARAM_RATIONAL: new (m_rational) rational(other.get_rational()); break;
|
||||
case PARAM_SYMBOL: m_symbol = other.m_symbol; break;
|
||||
case PARAM_RATIONAL: m_rational = alloc(rational, other.get_rational()); break;
|
||||
case PARAM_DOUBLE: m_dval = other.m_dval; break;
|
||||
case PARAM_EXTERNAL: m_ext_id = other.m_ext_id; break;
|
||||
default:
|
||||
|
@ -188,18 +188,14 @@ decl_info::decl_info(decl_info const& other) :
|
|||
|
||||
|
||||
void decl_info::init_eh(ast_manager & m) {
|
||||
vector<parameter>::iterator it = m_parameters.begin();
|
||||
vector<parameter>::iterator end = m_parameters.end();
|
||||
for (; it != end; ++it) {
|
||||
it->init_eh(m);
|
||||
for (parameter & p : m_parameters) {
|
||||
p.init_eh(m);
|
||||
}
|
||||
}
|
||||
|
||||
void decl_info::del_eh(ast_manager & m) {
|
||||
vector<parameter>::iterator it = m_parameters.begin();
|
||||
vector<parameter>::iterator end = m_parameters.end();
|
||||
for (; it != end; ++it) {
|
||||
it->del_eh(m, m_family_id);
|
||||
for (parameter & p : m_parameters) {
|
||||
p.del_eh(m, m_family_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1291,10 +1287,8 @@ decl_kind user_sort_plugin::register_name(symbol s) {
|
|||
|
||||
decl_plugin * user_sort_plugin::mk_fresh() {
|
||||
user_sort_plugin * p = alloc(user_sort_plugin);
|
||||
svector<symbol>::iterator it = m_sort_names.begin();
|
||||
svector<symbol>::iterator end = m_sort_names.end();
|
||||
for (; it != end; ++it)
|
||||
p->register_name(*it);
|
||||
for (symbol const& s : m_sort_names)
|
||||
p->register_name(s);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -1414,26 +1408,20 @@ ast_manager::~ast_manager() {
|
|||
dec_ref(m_true);
|
||||
dec_ref(m_false);
|
||||
dec_ref(m_undef_proof);
|
||||
ptr_vector<decl_plugin>::iterator it = m_plugins.begin();
|
||||
ptr_vector<decl_plugin>::iterator end = m_plugins.end();
|
||||
for (; it != end; ++it) {
|
||||
if (*it)
|
||||
(*it)->finalize();
|
||||
for (decl_plugin* p : m_plugins) {
|
||||
if (p)
|
||||
p->finalize();
|
||||
}
|
||||
it = m_plugins.begin();
|
||||
for (; it != end; ++it) {
|
||||
if (*it)
|
||||
dealloc(*it);
|
||||
for (decl_plugin* p : m_plugins) {
|
||||
if (p)
|
||||
dealloc(p);
|
||||
}
|
||||
m_plugins.reset();
|
||||
while (!m_ast_table.empty()) {
|
||||
DEBUG_CODE(std::cout << "ast_manager LEAKED: " << m_ast_table.size() << std::endl;);
|
||||
ptr_vector<ast> roots;
|
||||
ast_mark mark;
|
||||
ast_table::iterator it_a = m_ast_table.begin();
|
||||
ast_table::iterator end_a = m_ast_table.end();
|
||||
for (; it_a != end_a; ++it_a) {
|
||||
ast* n = (*it_a);
|
||||
for (ast * n : m_ast_table) {
|
||||
switch (n->get_kind()) {
|
||||
case AST_SORT: {
|
||||
sort_info* info = to_sort(n)->get_info();
|
||||
|
@ -1466,9 +1454,7 @@ ast_manager::~ast_manager() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
it_a = m_ast_table.begin();
|
||||
for (; it_a != end_a; ++it_a) {
|
||||
ast* n = *it_a;
|
||||
for (ast * n : m_ast_table) {
|
||||
if (!mark.is_marked(n)) {
|
||||
roots.push_back(n);
|
||||
}
|
||||
|
@ -1543,12 +1529,15 @@ void ast_manager::raise_exception(char const * msg) {
|
|||
throw ast_exception(msg);
|
||||
}
|
||||
|
||||
#include "ast/ast_translation.h"
|
||||
|
||||
void ast_manager::copy_families_plugins(ast_manager const & from) {
|
||||
TRACE("copy_families_plugins",
|
||||
tout << "target:\n";
|
||||
for (family_id fid = 0; m_family_manager.has_family(fid); fid++) {
|
||||
tout << "fid: " << fid << " fidname: " << get_family_name(fid) << "\n";
|
||||
});
|
||||
ast_translation trans(const_cast<ast_manager&>(from), *this, false);
|
||||
for (family_id fid = 0; from.m_family_manager.has_family(fid); fid++) {
|
||||
SASSERT(from.is_builtin_family_id(fid) == is_builtin_family_id(fid));
|
||||
SASSERT(!from.is_builtin_family_id(fid) || m_family_manager.has_family(fid));
|
||||
|
@ -1569,6 +1558,9 @@ void ast_manager::copy_families_plugins(ast_manager const & from) {
|
|||
SASSERT(new_p->get_family_id() == fid);
|
||||
SASSERT(has_plugin(fid));
|
||||
}
|
||||
if (from.has_plugin(fid)) {
|
||||
get_plugin(fid)->inherit(from.get_plugin(fid), trans);
|
||||
}
|
||||
SASSERT(from.m_family_manager.has_family(fid) == m_family_manager.has_family(fid));
|
||||
SASSERT(from.get_family_id(fid_name) == get_family_id(fid_name));
|
||||
SASSERT(!from.has_plugin(fid) || has_plugin(fid));
|
||||
|
@ -1663,11 +1655,8 @@ bool ast_manager::is_bool(expr const * n) const {
|
|||
|
||||
#ifdef Z3DEBUG
|
||||
bool ast_manager::slow_not_contains(ast const * n) {
|
||||
ast_table::iterator it = m_ast_table.begin();
|
||||
ast_table::iterator end = m_ast_table.end();
|
||||
unsigned num = 0;
|
||||
for (; it != end; ++it) {
|
||||
ast * curr = *it;
|
||||
for (ast * curr : m_ast_table) {
|
||||
if (compare_nodes(curr, n)) {
|
||||
TRACE("nondet_bug",
|
||||
tout << "id1: " << curr->get_id() << ", id2: " << n->get_id() << "\n";
|
||||
|
@ -1935,6 +1924,35 @@ sort * ast_manager::mk_sort(symbol const & name, sort_info * info) {
|
|||
return register_node(new_node);
|
||||
}
|
||||
|
||||
sort * ast_manager::substitute(sort* s, unsigned n, sort * const * src, sort * const * dst) {
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (s == src[i]) return dst[i];
|
||||
}
|
||||
|
||||
vector<parameter> ps;
|
||||
bool change = false;
|
||||
sort_ref_vector sorts(*this);
|
||||
for (unsigned i = 0; i < s->get_num_parameters(); ++i) {
|
||||
parameter const& p = s->get_parameter(i);
|
||||
if (p.is_ast()) {
|
||||
SASSERT(is_sort(p.get_ast()));
|
||||
change = true;
|
||||
sorts.push_back(substitute(to_sort(p.get_ast()), n, src, dst));
|
||||
ps.push_back(parameter(sorts.back()));
|
||||
}
|
||||
else {
|
||||
ps.push_back(p);
|
||||
}
|
||||
}
|
||||
if (!change) {
|
||||
return s;
|
||||
}
|
||||
decl_info dinfo(s->get_family_id(), s->get_decl_kind(), ps.size(), ps.c_ptr(), s->private_parameters());
|
||||
sort_info sinfo(dinfo, s->get_num_elements());
|
||||
return mk_sort(s->get_name(), &sinfo);
|
||||
}
|
||||
|
||||
|
||||
sort * ast_manager::mk_uninterpreted_sort(symbol const & name, unsigned num_parameters, parameter const * parameters) {
|
||||
user_sort_plugin * plugin = get_user_sort_plugin();
|
||||
decl_kind kind = plugin->register_name(name);
|
||||
|
@ -2177,7 +2195,10 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
|
|||
throw ast_exception(buffer.str().c_str());
|
||||
}
|
||||
app * r = 0;
|
||||
if (num_args > 2 && !decl->is_flat_associative()) {
|
||||
if (num_args == 1 && decl->is_chainable() && decl->get_arity() == 2) {
|
||||
r = mk_true();
|
||||
}
|
||||
else if (num_args > 2 && !decl->is_flat_associative()) {
|
||||
if (decl->is_right_associative()) {
|
||||
unsigned j = num_args - 1;
|
||||
r = mk_app_core(decl, args[j-1], args[j]);
|
||||
|
@ -2206,7 +2227,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
|
|||
r = mk_app_core(decl, num_args, args);
|
||||
}
|
||||
SASSERT(r != 0);
|
||||
TRACE("app_ground", tout << "ground: " << r->is_ground() << "\n" << mk_ll_pp(r, *this) << "\n";);
|
||||
TRACE("app_ground", tout << "ground: " << r->is_ground() << " id: " << r->get_id() << "\n" << mk_ll_pp(r, *this) << "\n";);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -2351,6 +2372,7 @@ quantifier * ast_manager::mk_quantifier(bool forall, unsigned num_decls, sort *
|
|||
SASSERT(num_decls > 0);
|
||||
DEBUG_CODE({
|
||||
for (unsigned i = 0; i < num_patterns; ++i) {
|
||||
TRACE("ast", tout << i << " " << mk_pp(patterns[i], *this) << "\n";);
|
||||
SASSERT(is_pattern(patterns[i]));
|
||||
}});
|
||||
unsigned sz = quantifier::get_obj_size(num_decls, num_patterns, num_no_patterns);
|
||||
|
@ -2576,7 +2598,7 @@ expr * ast_manager::get_some_value(sort * s) {
|
|||
return mk_model_value(0, s);
|
||||
}
|
||||
|
||||
bool ast_manager::is_fully_interp(sort const * s) const {
|
||||
bool ast_manager::is_fully_interp(sort * s) const {
|
||||
if (is_uninterp(s))
|
||||
return false;
|
||||
family_id fid = s->get_family_id();
|
||||
|
|
|
@ -19,32 +19,32 @@ Revision History:
|
|||
#ifndef AST_H_
|
||||
#define AST_H_
|
||||
|
||||
#include"vector.h"
|
||||
#include"hashtable.h"
|
||||
#include"buffer.h"
|
||||
#include"symbol.h"
|
||||
#include"rational.h"
|
||||
#include"hash.h"
|
||||
#include"optional.h"
|
||||
#include"trace.h"
|
||||
#include"bit_vector.h"
|
||||
#include"symbol_table.h"
|
||||
#include"tptr.h"
|
||||
#include"memory_manager.h"
|
||||
#include"small_object_allocator.h"
|
||||
#include"obj_ref.h"
|
||||
#include"ref_vector.h"
|
||||
#include"ref_buffer.h"
|
||||
#include"obj_mark.h"
|
||||
#include"obj_hashtable.h"
|
||||
#include"id_gen.h"
|
||||
#include"map.h"
|
||||
#include"parray.h"
|
||||
#include"dictionary.h"
|
||||
#include"chashtable.h"
|
||||
#include"z3_exception.h"
|
||||
#include"dependency.h"
|
||||
#include"rlimit.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/hashtable.h"
|
||||
#include "util/buffer.h"
|
||||
#include "util/symbol.h"
|
||||
#include "util/rational.h"
|
||||
#include "util/hash.h"
|
||||
#include "util/optional.h"
|
||||
#include "util/trace.h"
|
||||
#include "util/bit_vector.h"
|
||||
#include "util/symbol_table.h"
|
||||
#include "util/tptr.h"
|
||||
#include "util/memory_manager.h"
|
||||
#include "util/small_object_allocator.h"
|
||||
#include "util/obj_ref.h"
|
||||
#include "util/ref_vector.h"
|
||||
#include "util/ref_buffer.h"
|
||||
#include "util/obj_mark.h"
|
||||
#include "util/obj_hashtable.h"
|
||||
#include "util/id_gen.h"
|
||||
#include "util/map.h"
|
||||
#include "util/parray.h"
|
||||
#include "util/dictionary.h"
|
||||
#include "util/chashtable.h"
|
||||
#include "util/z3_exception.h"
|
||||
#include "util/dependency.h"
|
||||
#include "util/rlimit.h"
|
||||
|
||||
#define RECYCLE_FREE_AST_INDICES
|
||||
|
||||
|
@ -102,8 +102,8 @@ private:
|
|||
union {
|
||||
int m_int; // for PARAM_INT
|
||||
ast* m_ast; // for PARAM_AST
|
||||
char m_symbol[sizeof(symbol)]; // for PARAM_SYMBOL
|
||||
char m_rational[sizeof(rational)]; // for PARAM_RATIONAL
|
||||
void const* m_symbol; // for PARAM_SYMBOL
|
||||
rational* m_rational; // for PARAM_RATIONAL
|
||||
double m_dval; // for PARAM_DOUBLE (remark: this is not used in float_decl_plugin)
|
||||
unsigned m_ext_id; // for PARAM_EXTERNAL
|
||||
};
|
||||
|
@ -114,12 +114,10 @@ public:
|
|||
explicit parameter(int val): m_kind(PARAM_INT), m_int(val) {}
|
||||
explicit parameter(unsigned val): m_kind(PARAM_INT), m_int(val) {}
|
||||
explicit parameter(ast * p): m_kind(PARAM_AST), m_ast(p) {}
|
||||
explicit parameter(symbol const & s): m_kind(PARAM_SYMBOL) { new (m_symbol) symbol(s); }
|
||||
explicit parameter(rational const & r): m_kind(PARAM_RATIONAL) { new (m_rational) rational(r); }
|
||||
explicit parameter(symbol const & s): m_kind(PARAM_SYMBOL), m_symbol(s.c_ptr()) {}
|
||||
explicit parameter(rational const & r): m_kind(PARAM_RATIONAL), m_rational(alloc(rational, r)) {}
|
||||
explicit parameter(double d):m_kind(PARAM_DOUBLE), m_dval(d) {}
|
||||
explicit parameter(const char *s):m_kind(PARAM_SYMBOL) {
|
||||
new (m_symbol) symbol(s);
|
||||
}
|
||||
explicit parameter(const char *s):m_kind(PARAM_SYMBOL), m_symbol(symbol(s).c_ptr()) {}
|
||||
explicit parameter(unsigned ext_id, bool):m_kind(PARAM_EXTERNAL), m_ext_id(ext_id) {}
|
||||
parameter(parameter const&);
|
||||
|
||||
|
@ -156,8 +154,8 @@ public:
|
|||
|
||||
int get_int() const { SASSERT(is_int()); return m_int; }
|
||||
ast * get_ast() const { SASSERT(is_ast()); return m_ast; }
|
||||
symbol const & get_symbol() const { SASSERT(is_symbol()); return *(reinterpret_cast<const symbol *>(m_symbol)); }
|
||||
rational const & get_rational() const { SASSERT(is_rational()); return *(reinterpret_cast<const rational *>(m_rational)); }
|
||||
symbol get_symbol() const { SASSERT(is_symbol()); return symbol::mk_symbol_from_c_ptr(m_symbol); }
|
||||
rational const & get_rational() const { SASSERT(is_rational()); return *m_rational; }
|
||||
double get_double() const { SASSERT(is_double()); return m_dval; }
|
||||
unsigned get_ext_id() const { SASSERT(is_external()); return m_ext_id; }
|
||||
|
||||
|
@ -337,13 +335,17 @@ public:
|
|||
unsigned num_parameters = 0, parameter const * parameters = 0, bool private_parameters = false):
|
||||
decl_info(family_id, k, num_parameters, parameters, private_parameters), m_num_elements(num_elements) {
|
||||
}
|
||||
sort_info(sort_info const& other) : decl_info(other), m_num_elements(other.m_num_elements) {
|
||||
sort_info(sort_info const& other) : decl_info(other), m_num_elements(other.m_num_elements) {
|
||||
}
|
||||
sort_info(decl_info const& di, sort_size const& num_elements) :
|
||||
decl_info(di), m_num_elements(num_elements) {}
|
||||
|
||||
~sort_info() {}
|
||||
|
||||
bool is_infinite() const { return m_num_elements.is_infinite(); }
|
||||
bool is_very_big() const { return m_num_elements.is_very_big(); }
|
||||
sort_size const & get_num_elements() const { return m_num_elements; }
|
||||
void set_num_elements(sort_size const& s) { m_num_elements = s; }
|
||||
};
|
||||
|
||||
std::ostream & operator<<(std::ostream & out, sort_info const & info);
|
||||
|
@ -569,6 +571,7 @@ public:
|
|||
bool is_very_big() const { return get_info() == 0 || get_info()->is_very_big(); }
|
||||
bool is_sort_of(family_id fid, decl_kind k) const { return get_family_id() == fid && get_decl_kind() == k; }
|
||||
sort_size const & get_num_elements() const { return get_info()->get_num_elements(); }
|
||||
void set_num_elements(sort_size const& s) { get_info()->set_num_elements(s); }
|
||||
unsigned get_size() const { return get_obj_size(); }
|
||||
};
|
||||
|
||||
|
@ -892,6 +895,8 @@ struct ast_eq_proc {
|
|||
}
|
||||
};
|
||||
|
||||
class ast_translation;
|
||||
|
||||
class ast_table : public chashtable<ast*, obj_ptr_hash<ast>, ast_eq_proc> {
|
||||
public:
|
||||
void erase(ast * n);
|
||||
|
@ -927,6 +932,8 @@ protected:
|
|||
m_family_id = id;
|
||||
}
|
||||
|
||||
virtual void inherit(decl_plugin* other_p, ast_translation& ) { }
|
||||
|
||||
friend class ast_manager;
|
||||
|
||||
public:
|
||||
|
@ -990,7 +997,7 @@ public:
|
|||
|
||||
// Return true if the interpreted sort s does not depend on uninterpreted sorts.
|
||||
// This may be the case, for example, for array and datatype sorts.
|
||||
virtual bool is_fully_interp(sort const * s) const { return true; }
|
||||
virtual bool is_fully_interp(sort * s) const { return true; }
|
||||
|
||||
// Event handlers for deleting/translating PARAM_EXTERNAL
|
||||
virtual void del(parameter const & p) {}
|
||||
|
@ -1657,6 +1664,8 @@ public:
|
|||
|
||||
sort * mk_sort(family_id fid, decl_kind k, unsigned num_parameters = 0, parameter const * parameters = 0);
|
||||
|
||||
sort * substitute(sort* s, unsigned n, sort * const * src, sort * const * dst);
|
||||
|
||||
sort * mk_bool_sort() const { return m_bool_sort; }
|
||||
|
||||
sort * mk_proof_sort() const { return m_proof_sort; }
|
||||
|
@ -1669,7 +1678,7 @@ public:
|
|||
\brief A sort is "fully" interpreted if it is interpreted,
|
||||
and doesn't depend on other uninterpreted sorts.
|
||||
*/
|
||||
bool is_fully_interp(sort const * s) const;
|
||||
bool is_fully_interp(sort * s) const;
|
||||
|
||||
func_decl * mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||
unsigned arity, sort * const * domain, sort * range = 0);
|
||||
|
@ -2021,8 +2030,8 @@ public:
|
|||
app * mk_not(expr * n) { return mk_app(m_basic_family_id, OP_NOT, n); }
|
||||
app * mk_distinct(unsigned num_args, expr * const * args);
|
||||
app * mk_distinct_expanded(unsigned num_args, expr * const * args);
|
||||
app * mk_true() { return m_true; }
|
||||
app * mk_false() { return m_false; }
|
||||
app * mk_true() const { return m_true; }
|
||||
app * mk_false() const { return m_false; }
|
||||
app * mk_bool_val(bool b) { return b?m_true:m_false; }
|
||||
app * mk_interp(expr * arg) { return mk_app(m_basic_family_id, OP_INTERP, arg); }
|
||||
|
||||
|
@ -2472,6 +2481,7 @@ public:
|
|||
void operator()(AST * n) { m_manager.inc_ref(n); }
|
||||
};
|
||||
|
||||
|
||||
#endif /* AST_H_ */
|
||||
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ Revision History:
|
|||
--*/
|
||||
|
||||
#include<iostream>
|
||||
#include"for_each_ast.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include "ast/for_each_ast.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
|
||||
// #define AST_LL_PP_SHOW_FAMILY_NAME
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef AST_LL_PP_H_
|
||||
#define AST_LL_PP_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include "ast/ast.h"
|
||||
#include<iostream>
|
||||
|
||||
void ast_ll_pp(std::ostream & out, ast_manager & m, ast * n, bool only_exprs=true, bool compact=true);
|
||||
|
|
|
@ -16,7 +16,7 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"ast.h"
|
||||
#include "ast/ast.h"
|
||||
|
||||
#define check_symbol(S1,S2) if (S1 != S2) return lt(S1,S2)
|
||||
#define check_value(V1,V2) if (V1 != V2) return V1 < V2
|
||||
|
|
|
@ -21,7 +21,7 @@ Revision History:
|
|||
#ifndef AST_PP_H_
|
||||
#define AST_PP_H_
|
||||
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
struct mk_pp : public mk_ismt2_pp {
|
||||
mk_pp(ast * t, ast_manager & m, params_ref const & p, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = 0):
|
||||
|
|
|
@ -17,9 +17,9 @@ Revision History:
|
|||
|
||||
--*/
|
||||
|
||||
#include "ast_pp_util.h"
|
||||
#include "ast_smt2_pp.h"
|
||||
#include "ast_smt_pp.h"
|
||||
#include "ast/ast_pp_util.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/ast_smt_pp.h"
|
||||
|
||||
void ast_pp_util::collect(expr* e) {
|
||||
coll.visit(e);
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef AST_PP_UTIL_H_
|
||||
#define AST_PP_UTIL_H_
|
||||
|
||||
#include "decl_collector.h"
|
||||
#include "ast/decl_collector.h"
|
||||
|
||||
class ast_pp_util {
|
||||
ast_manager& m;
|
||||
|
|
|
@ -16,8 +16,8 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"ast_printer.h"
|
||||
#include"pp.h"
|
||||
#include "ast/ast_printer.h"
|
||||
#include "ast/pp.h"
|
||||
|
||||
class simple_ast_printer_context : public ast_printer_context {
|
||||
ast_manager & m_manager;
|
||||
|
|
|
@ -19,8 +19,8 @@ Revision History:
|
|||
#ifndef AST_PRINTER_H_
|
||||
#define AST_PRINTER_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "ast/ast.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
class ast_printer {
|
||||
public:
|
||||
|
|
|
@ -18,13 +18,13 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"shared_occs.h"
|
||||
#include"pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include"ast_pp.h"
|
||||
#include"algebraic_numbers.h"
|
||||
#include"pp_params.hpp"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/shared_occs.h"
|
||||
#include "ast/pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "math/polynomial/algebraic_numbers.h"
|
||||
#include "ast/pp_params.hpp"
|
||||
using namespace format_ns;
|
||||
|
||||
#define ALIAS_PREFIX "a"
|
||||
|
@ -43,6 +43,9 @@ format * smt2_pp_environment::pp_fdecl_name(symbol const & s, unsigned & len) co
|
|||
len = static_cast<unsigned>(str.length());
|
||||
return mk_string(m, str.c_str());
|
||||
}
|
||||
else if (!s.bare_str()) {
|
||||
return mk_string(m, "null");
|
||||
}
|
||||
else {
|
||||
len = static_cast<unsigned>(strlen(s.bare_str()));
|
||||
return mk_string(m, s.bare_str());
|
||||
|
@ -431,16 +434,16 @@ format_ns::format * smt2_pp_environment::pp_sort(sort * s) {
|
|||
fs.push_back(pp_sort(to_sort(s->get_parameter(0).get_ast())));
|
||||
return mk_seq1(m, fs.begin(), fs.end(), f2f(), get_sutil().is_seq(s)?"Seq":"RegEx");
|
||||
}
|
||||
#if 0
|
||||
if (get_dtutil().is_datatype(s)) {
|
||||
ptr_buffer<format> fs;
|
||||
unsigned sz = get_dtutil().get_datatype_num_parameter_sorts(s);
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
fs.push_back(pp_sort(get_dtutil().get_datatype_parameter_sort(s, i)));
|
||||
if (sz > 0) {
|
||||
ptr_buffer<format> fs;
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
fs.push_back(pp_sort(get_dtutil().get_datatype_parameter_sort(s, i)));
|
||||
}
|
||||
return mk_seq1(m, fs.begin(), fs.end(), f2f(), s->get_name().str().c_str());
|
||||
}
|
||||
return mk_seq1(m, fs.begin(), fs.end(), f2f(), s->get_name().str().c_str());
|
||||
}
|
||||
#endif
|
||||
return format_ns::mk_string(get_manager(), s->get_name().str().c_str());
|
||||
}
|
||||
|
||||
|
@ -1222,15 +1225,15 @@ mk_ismt2_pp::mk_ismt2_pp(ast * t, ast_manager & m, unsigned indent, unsigned num
|
|||
|
||||
std::ostream& operator<<(std::ostream& out, mk_ismt2_pp const & p) {
|
||||
smt2_pp_environment_dbg env(p.m_manager);
|
||||
if (is_expr(p.m_ast)) {
|
||||
if (p.m_ast == 0) {
|
||||
out << "null";
|
||||
}
|
||||
else if (is_expr(p.m_ast)) {
|
||||
ast_smt2_pp(out, to_expr(p.m_ast), env, p.m_params, p.m_indent, p.m_num_vars, p.m_var_prefix);
|
||||
}
|
||||
else if (is_sort(p.m_ast)) {
|
||||
ast_smt2_pp(out, to_sort(p.m_ast), env, p.m_params, p.m_indent);
|
||||
}
|
||||
else if (p.m_ast == 0) {
|
||||
out << "null";
|
||||
}
|
||||
else {
|
||||
SASSERT(is_func_decl(p.m_ast));
|
||||
ast_smt2_pp(out, to_func_decl(p.m_ast), env, p.m_params, p.m_indent);
|
||||
|
|
|
@ -22,16 +22,16 @@ Revision History:
|
|||
#ifndef AST_SMT2_PP_H_
|
||||
#define AST_SMT2_PP_H_
|
||||
|
||||
#include"format.h"
|
||||
#include"params.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
#include"dl_decl_plugin.h"
|
||||
#include"seq_decl_plugin.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include"smt2_util.h"
|
||||
#include "ast/format.h"
|
||||
#include "util/params.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/fpa_decl_plugin.h"
|
||||
#include "ast/dl_decl_plugin.h"
|
||||
#include "ast/seq_decl_plugin.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "util/smt2_util.h"
|
||||
|
||||
class smt2_pp_environment {
|
||||
protected:
|
||||
|
|
|
@ -21,17 +21,17 @@ Revision History:
|
|||
|
||||
#include<sstream>
|
||||
#include<iostream>
|
||||
#include"ast_smt_pp.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
#include"vector.h"
|
||||
#include"for_each_ast.h"
|
||||
#include"decl_collector.h"
|
||||
#include"smt2_util.h"
|
||||
#include"seq_decl_plugin.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/smt2_util.h"
|
||||
#include "ast/ast_smt_pp.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "ast/seq_decl_plugin.h"
|
||||
#include "ast/fpa_decl_plugin.h"
|
||||
#include "ast/for_each_ast.h"
|
||||
#include "ast/decl_collector.h"
|
||||
|
||||
// ---------------------------------------
|
||||
// smt_renaming
|
||||
|
@ -174,7 +174,6 @@ class smt_printer {
|
|||
symbol m_logic;
|
||||
symbol m_AUFLIRA;
|
||||
bool m_no_lets;
|
||||
bool m_is_smt2;
|
||||
bool m_simplify_implies;
|
||||
expr* m_top;
|
||||
|
||||
|
@ -199,37 +198,30 @@ class smt_printer {
|
|||
}
|
||||
|
||||
void pp_id(expr* n) {
|
||||
if (m_is_smt2) {
|
||||
m_out << (is_bool(n)?"$x":(is_proof(n)?"@x":"?x")) << n->get_id();
|
||||
}
|
||||
else {
|
||||
m_out << (is_bool(n)?"$x":"?x") << n->get_id();
|
||||
}
|
||||
m_out << (is_bool(n)?"$x":(is_proof(n)?"@x":"?x")) << n->get_id();
|
||||
}
|
||||
|
||||
void pp_decl(func_decl* d) {
|
||||
symbol sym = m_renaming.get_symbol(d->get_name());
|
||||
if (d->get_family_id() == m_dt_fid) {
|
||||
m_out << sym;
|
||||
}
|
||||
else if (m_manager.is_ite(d)) {
|
||||
if (!m_is_smt2 && is_bool(d->get_range())) {
|
||||
m_out << "if_then_else";
|
||||
datatype_util util(m_manager);
|
||||
if (util.is_recognizer(d)) {
|
||||
visit_params(false, sym, d->get_num_parameters(), d->get_parameters());
|
||||
}
|
||||
else {
|
||||
m_out << "ite";
|
||||
m_out << sym;
|
||||
}
|
||||
}
|
||||
else if (!m_is_smt2 && m_manager.is_implies(d)) {
|
||||
m_out << "implies";
|
||||
else if (m_manager.is_ite(d)) {
|
||||
m_out << "ite";
|
||||
}
|
||||
else if (m_is_smt2 && m_manager.is_iff(d)) {
|
||||
else if (m_manager.is_iff(d)) {
|
||||
m_out << "=";
|
||||
}
|
||||
else if (m_is_smt2 && m_manager.is_implies(d)) {
|
||||
else if (m_manager.is_implies(d)) {
|
||||
m_out << "=>";
|
||||
}
|
||||
else if (m_is_smt2 && is_decl_of(d, m_arith_fid, OP_UMINUS)) {
|
||||
else if (is_decl_of(d, m_arith_fid, OP_UMINUS)) {
|
||||
m_out << "-";
|
||||
}
|
||||
else {
|
||||
|
@ -251,28 +243,23 @@ class smt_printer {
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_is_smt2) {
|
||||
if (is_sort_symbol && sym == symbol("String")) {
|
||||
m_out << "String";
|
||||
return;
|
||||
}
|
||||
if (is_sort_symbol &&
|
||||
sym != symbol("BitVec") &&
|
||||
sym != symbol("FloatingPoint") &&
|
||||
sym != symbol("RoundingMode")) {
|
||||
m_out << "(" << sym << " ";
|
||||
}
|
||||
else if (!is_sort_symbol && is_sort_param(num_params, params)) {
|
||||
m_out << "(as " << sym << " ";
|
||||
}
|
||||
else {
|
||||
m_out << "(_ " << sym << " ";
|
||||
}
|
||||
if (is_sort_symbol && sym == symbol("String")) {
|
||||
m_out << "String";
|
||||
return;
|
||||
}
|
||||
if (is_sort_symbol &&
|
||||
sym != symbol("BitVec") &&
|
||||
sym != symbol("FloatingPoint") &&
|
||||
sym != symbol("RoundingMode")) {
|
||||
m_out << "(" << sym << " ";
|
||||
}
|
||||
else if (!is_sort_symbol && is_sort_param(num_params, params)) {
|
||||
m_out << "(as " << sym << " ";
|
||||
}
|
||||
else {
|
||||
m_out << sym << "[";
|
||||
m_out << "(_ " << sym << " ";
|
||||
}
|
||||
|
||||
|
||||
for (unsigned i = 0; i < num_params; ++i) {
|
||||
parameter const& p = params[i];
|
||||
if (p.is_ast()) {
|
||||
|
@ -293,20 +280,10 @@ class smt_printer {
|
|||
m_out << p;
|
||||
}
|
||||
if (i + 1 < num_params) {
|
||||
if (m_is_smt2) {
|
||||
m_out << " ";
|
||||
}
|
||||
else {
|
||||
m_out << ": ";
|
||||
}
|
||||
m_out << " ";
|
||||
}
|
||||
}
|
||||
if (m_is_smt2) {
|
||||
m_out << ")";
|
||||
}
|
||||
else {
|
||||
m_out << "]";
|
||||
}
|
||||
m_out << ")";
|
||||
}
|
||||
|
||||
bool is_auflira() const {
|
||||
|
@ -315,9 +292,7 @@ class smt_printer {
|
|||
|
||||
void visit_sort(sort* s, bool bool2int = false) {
|
||||
symbol sym;
|
||||
if (bool2int && is_bool(s) && !m_is_smt2) {
|
||||
sym = symbol("Int");
|
||||
} else if (s->is_sort_of(m_bv_fid, BV_SORT)) {
|
||||
if (s->is_sort_of(m_bv_fid, BV_SORT)) {
|
||||
sym = symbol("BitVec");
|
||||
}
|
||||
else if (s->is_sort_of(m_arith_fid, REAL_SORT)) {
|
||||
|
@ -329,51 +304,16 @@ class smt_printer {
|
|||
else if (s->is_sort_of(m_arith_fid, INT_SORT)) {
|
||||
sym = s->get_name();
|
||||
}
|
||||
else if (s->is_sort_of(m_array_fid, ARRAY_SORT) && m_is_smt2) {
|
||||
else if (s->is_sort_of(m_array_fid, ARRAY_SORT)) {
|
||||
sym = "Array";
|
||||
}
|
||||
else if (s->is_sort_of(m_array_fid, ARRAY_SORT) && !m_is_smt2) {
|
||||
unsigned num_params = s->get_num_parameters();
|
||||
SASSERT(num_params >= 2);
|
||||
if (is_auflira()) {
|
||||
sort* rng = to_sort(s->get_parameter(1).get_ast());
|
||||
if (rng->get_family_id() == m_array_fid) {
|
||||
m_out << "Array2";
|
||||
}
|
||||
else {
|
||||
m_out << "Array1";
|
||||
}
|
||||
return;
|
||||
}
|
||||
sort* s1 = to_sort(s->get_parameter(0).get_ast());
|
||||
sort* s2 = to_sort(s->get_parameter(1).get_ast());
|
||||
if (num_params == 2 &&
|
||||
s1->is_sort_of(m_bv_fid, BV_SORT) &&
|
||||
s2->is_sort_of(m_bv_fid, BV_SORT)) {
|
||||
m_out << "Array";
|
||||
m_out << "[" << s1->get_parameter(0).get_int();
|
||||
m_out << ":" << s2->get_parameter(0).get_int() << "]";
|
||||
return;
|
||||
}
|
||||
m_out << "(Array ";
|
||||
for (unsigned i = 0; i < num_params; ++i) {
|
||||
visit_sort(to_sort(s->get_parameter(i).get_ast()));
|
||||
if (i + 1 < num_params) {
|
||||
m_out << " ";
|
||||
}
|
||||
}
|
||||
m_out << ")";
|
||||
return;
|
||||
}
|
||||
else if (s->is_sort_of(m_dt_fid, DATATYPE_SORT)) {
|
||||
m_out << m_renaming.get_symbol(s->get_name());
|
||||
#if 0
|
||||
datatype_util util(m_manager);
|
||||
unsigned num_sorts = util.get_datatype_num_parameter_sorts(s);
|
||||
if (num_sorts > 0) {
|
||||
m_out << "(";
|
||||
}
|
||||
|
||||
m_out << m_renaming.get_symbol(s->get_name());
|
||||
if (num_sorts > 0) {
|
||||
for (unsigned i = 0; i < num_sorts; ++i) {
|
||||
m_out << " ";
|
||||
|
@ -381,7 +321,6 @@ class smt_printer {
|
|||
}
|
||||
m_out << ")";
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@ -403,20 +342,7 @@ class smt_printer {
|
|||
|
||||
void pp_arg(expr *arg, app *parent)
|
||||
{
|
||||
if (!m_is_smt2 && is_bool(arg) && is_var(arg) && parent->get_family_id() == m_basic_fid) {
|
||||
m_out << "(not (= ";
|
||||
pp_marked_expr(arg);
|
||||
m_out << " 0))";
|
||||
} else if (!m_is_smt2 && is_bool(arg) && !is_var(arg) &&
|
||||
parent->get_family_id() != m_basic_fid &&
|
||||
parent->get_family_id() != m_dt_fid) {
|
||||
|
||||
m_out << "(ite ";
|
||||
pp_marked_expr(arg);
|
||||
m_out << " 1 0)";
|
||||
} else {
|
||||
pp_marked_expr(arg);
|
||||
}
|
||||
pp_marked_expr(arg);
|
||||
}
|
||||
|
||||
void visit_app(app* n) {
|
||||
|
@ -431,12 +357,7 @@ class smt_printer {
|
|||
if (m_autil.is_numeral(n, val, is_int)) {
|
||||
if (val.is_neg()) {
|
||||
val.neg();
|
||||
if (m_is_smt2) {
|
||||
m_out << "(- ";
|
||||
}
|
||||
else {
|
||||
m_out << "(~ ";
|
||||
}
|
||||
m_out << "(- ";
|
||||
display_rational(val, is_int);
|
||||
m_out << ")";
|
||||
}
|
||||
|
@ -458,12 +379,7 @@ class smt_printer {
|
|||
m_out << "\"";
|
||||
}
|
||||
else if (m_bvutil.is_numeral(n, val, bv_size)) {
|
||||
if (m_is_smt2) {
|
||||
m_out << "(_ bv" << val << " " << bv_size << ")";
|
||||
}
|
||||
else {
|
||||
m_out << "bv" << val << "[" << bv_size << "]";
|
||||
}
|
||||
m_out << "(_ bv" << val << " " << bv_size << ")";
|
||||
}
|
||||
else if (m_futil.is_numeral(n, float_val)) {
|
||||
m_out << "((_ to_fp " <<
|
||||
|
@ -473,37 +389,17 @@ class smt_printer {
|
|||
}
|
||||
else if (m_bvutil.is_bit2bool(n)) {
|
||||
unsigned bit = n->get_decl()->get_parameter(0).get_int();
|
||||
if (m_is_smt2) {
|
||||
m_out << "(= ((_ extract " << bit << " " << bit << ") ";
|
||||
pp_marked_expr(n->get_arg(0));
|
||||
m_out << ") (_ bv1 1))";
|
||||
}
|
||||
else {
|
||||
m_out << "(= (extract[" << bit << ":" << bit << "] ";
|
||||
pp_marked_expr(n->get_arg(0));
|
||||
m_out << ") bv1[1])";
|
||||
}
|
||||
m_out << "(= ((_ extract " << bit << " " << bit << ") ";
|
||||
pp_marked_expr(n->get_arg(0));
|
||||
m_out << ") (_ bv1 1))";
|
||||
}
|
||||
else if (m_manager.is_label(n, pos, names) && names.size() >= 1) {
|
||||
if (m_is_smt2) {
|
||||
m_out << "(! ";
|
||||
pp_marked_expr(n->get_arg(0));
|
||||
m_out << (pos?":lblpos":":lblneg") << " " << m_renaming.get_symbol(names[0]) << ")";
|
||||
}
|
||||
else {
|
||||
m_out << "(" << (pos?"lblpos":"lblneg") << " " << m_renaming.get_symbol(names[0]) << " ";
|
||||
expr* ch = n->get_arg(0);
|
||||
pp_marked_expr(ch);
|
||||
m_out << ")";
|
||||
}
|
||||
m_out << "(! ";
|
||||
pp_marked_expr(n->get_arg(0));
|
||||
m_out << (pos?":lblpos":":lblneg") << " " << m_renaming.get_symbol(names[0]) << ")";
|
||||
}
|
||||
else if (m_manager.is_label_lit(n, names) && names.size() >= 1) {
|
||||
if (m_is_smt2) {
|
||||
m_out << "(! true :lblpos " << m_renaming.get_symbol(names[0]) << ")";
|
||||
}
|
||||
else {
|
||||
m_out << "(lblpos " << m_renaming.get_symbol(names[0]) << " true )";
|
||||
}
|
||||
m_out << "(! true :lblpos " << m_renaming.get_symbol(names[0]) << ")";
|
||||
}
|
||||
else if (num_args == 0) {
|
||||
if (decl->private_parameters()) {
|
||||
|
@ -533,7 +429,8 @@ class smt_printer {
|
|||
pp_arg(curr, n);
|
||||
m_out << ")";
|
||||
|
||||
} else if (m_manager.is_distinct(decl)) {
|
||||
}
|
||||
else if (m_manager.is_distinct(decl)) {
|
||||
ptr_vector<expr> args(num_args, n->get_args());
|
||||
unsigned idx = 0;
|
||||
m_out << "(and";
|
||||
|
@ -581,14 +478,11 @@ class smt_printer {
|
|||
|
||||
void print_no_lets(expr *e)
|
||||
{
|
||||
smt_printer p(m_out, m_manager, m_qlists, m_renaming, m_logic, true, m_simplify_implies, m_is_smt2, m_indent, m_num_var_names, m_var_names);
|
||||
smt_printer p(m_out, m_manager, m_qlists, m_renaming, m_logic, true, m_simplify_implies, true, m_indent, m_num_var_names, m_var_names);
|
||||
p(e);
|
||||
}
|
||||
|
||||
void print_bound(symbol const& name) {
|
||||
if (!m_is_smt2 && (name.is_numerical() || '?' != name.bare_str()[0])) {
|
||||
m_out << "?";
|
||||
}
|
||||
m_out << name;
|
||||
}
|
||||
|
||||
|
@ -602,9 +496,7 @@ class smt_printer {
|
|||
else {
|
||||
m_out << "exists ";
|
||||
}
|
||||
if (m_is_smt2) {
|
||||
m_out << "(";
|
||||
}
|
||||
m_out << "(";
|
||||
for (unsigned i = 0; i < q->get_num_decls(); ++i) {
|
||||
sort* s = q->get_decl_sort(i);
|
||||
m_out << "(";
|
||||
|
@ -613,15 +505,13 @@ class smt_printer {
|
|||
visit_sort(s, true);
|
||||
m_out << ") ";
|
||||
}
|
||||
if (m_is_smt2) {
|
||||
m_out << ")";
|
||||
}
|
||||
m_out << ")";
|
||||
|
||||
if (m_is_smt2 && (q->get_num_patterns() > 0 || q->get_qid() != symbol::null)) {
|
||||
if ((q->get_num_patterns() > 0 || q->get_qid() != symbol::null)) {
|
||||
m_out << "(! ";
|
||||
}
|
||||
{
|
||||
smt_printer p(m_out, m_manager, m_qlists, m_renaming, m_logic, false, m_is_smt2, m_simplify_implies, m_indent, m_num_var_names, m_var_names);
|
||||
smt_printer p(m_out, m_manager, m_qlists, m_renaming, m_logic, false, true, m_simplify_implies, m_indent, m_num_var_names, m_var_names);
|
||||
p(q->get_expr());
|
||||
}
|
||||
|
||||
|
@ -640,28 +530,18 @@ class smt_printer {
|
|||
}
|
||||
}
|
||||
|
||||
if (m_is_smt2) {
|
||||
m_out << " :pattern ( ";
|
||||
}
|
||||
else {
|
||||
m_out << " :pat { ";
|
||||
}
|
||||
m_out << " :pattern ( ";
|
||||
for (unsigned j = 0; j < pat->get_num_args(); ++j) {
|
||||
print_no_lets(pat->get_arg(j));
|
||||
m_out << " ";
|
||||
}
|
||||
if (m_is_smt2) {
|
||||
m_out << ")";
|
||||
}
|
||||
else {
|
||||
m_out << "}";
|
||||
}
|
||||
m_out << ")";
|
||||
}
|
||||
|
||||
if (q->get_qid() != symbol::null)
|
||||
m_out << " :qid " << q->get_qid();
|
||||
|
||||
if (m_is_smt2 && (q->get_num_patterns() > 0 || q->get_qid() != symbol::null)) {
|
||||
if ((q->get_num_patterns() > 0 || q->get_qid() != symbol::null)) {
|
||||
m_out << ")";
|
||||
}
|
||||
m_out << ")";
|
||||
|
@ -725,21 +605,11 @@ class smt_printer {
|
|||
}
|
||||
|
||||
void visit_expr(expr* n) {
|
||||
if (m_is_smt2) {
|
||||
m_out << "(let ((";
|
||||
}
|
||||
else if (is_bool(n)) {
|
||||
m_out << "(flet (";
|
||||
}
|
||||
else {
|
||||
m_out << "(let (";
|
||||
}
|
||||
m_out << "(let ((";
|
||||
pp_id(n);
|
||||
m_out << " ";
|
||||
pp_expr(n);
|
||||
if (m_is_smt2) {
|
||||
m_out << ")";
|
||||
}
|
||||
m_out << ")";
|
||||
m_out << ")";
|
||||
newline();
|
||||
}
|
||||
|
@ -851,7 +721,6 @@ public:
|
|||
m_AUFLIRA("AUFLIRA"),
|
||||
// It's much easier to read those testcases with that.
|
||||
m_no_lets(no_lets),
|
||||
m_is_smt2(is_smt2),
|
||||
m_simplify_implies(simplify_implies)
|
||||
{
|
||||
m_basic_fid = m.get_basic_family_id();
|
||||
|
@ -905,91 +774,59 @@ public:
|
|||
}
|
||||
|
||||
void pp_dt(ast_mark& mark, sort* s) {
|
||||
SASSERT(s->is_sort_of(m_dt_fid, DATATYPE_SORT));
|
||||
datatype_util util(m_manager);
|
||||
ptr_vector<func_decl> const* decls;
|
||||
ptr_vector<sort> rec_sorts;
|
||||
SASSERT(util.is_datatype(s));
|
||||
|
||||
rec_sorts.push_back(s);
|
||||
mark.mark(s, true);
|
||||
sort_ref_vector ps(m_manager);
|
||||
ptr_vector<datatype::def> defs;
|
||||
util.get_defs(s, defs);
|
||||
|
||||
// collect siblings and sorts that have not already been printed.
|
||||
for (unsigned h = 0; h < rec_sorts.size(); ++h) {
|
||||
s = rec_sorts[h];
|
||||
decls = util.get_datatype_constructors(s);
|
||||
|
||||
for (unsigned i = 0; i < decls->size(); ++i) {
|
||||
func_decl* f = (*decls)[i];
|
||||
for (unsigned j = 0; j < f->get_arity(); ++j) {
|
||||
sort* s2 = f->get_domain(j);
|
||||
if (!mark.is_marked(s2)) {
|
||||
if (m_manager.is_uninterp(s2)) {
|
||||
pp_sort_decl(mark, s2);
|
||||
}
|
||||
else if (!util.is_datatype(s2)) {
|
||||
// skip
|
||||
}
|
||||
else if (util.are_siblings(s, s2)) {
|
||||
rec_sorts.push_back(s2);
|
||||
mark.mark(s2, true);
|
||||
}
|
||||
else {
|
||||
pp_sort_decl(mark, s2);
|
||||
}
|
||||
}
|
||||
for (datatype::def* d : defs) {
|
||||
sort_ref sr = d->instantiate(ps);
|
||||
if (mark.is_marked(sr)) return; // already processed
|
||||
mark.mark(sr, true);
|
||||
}
|
||||
|
||||
m_out << "(declare-datatypes (";
|
||||
bool first_def = true;
|
||||
for (datatype::def* d : defs) {
|
||||
if (!first_def) m_out << "\n "; else first_def = false;
|
||||
m_out << "(" << d->name() << " " << d->params().size() << ")";
|
||||
}
|
||||
m_out << ") (";
|
||||
bool first_sort = true;
|
||||
for (datatype::def* d : defs) {
|
||||
if (!first_sort) m_out << "\n "; else first_sort = false;
|
||||
if (!d->params().empty()) {
|
||||
m_out << "(par (";
|
||||
bool first_param = true;
|
||||
for (sort* s : d->params()) {
|
||||
if (!first_param) m_out << " "; else first_param = false;
|
||||
visit_sort(s);
|
||||
}
|
||||
m_out << ")";
|
||||
}
|
||||
}
|
||||
|
||||
if (m_is_smt2) {
|
||||
// TBD: datatypes may be declared parametrically.
|
||||
// get access to parametric generalization, or print
|
||||
// monomorphic specialization with a tag that gets reused at use-point.
|
||||
m_out << "(declare-datatypes () (";
|
||||
}
|
||||
else {
|
||||
m_out << ":datatypes (";
|
||||
}
|
||||
for (unsigned si = 0; si < rec_sorts.size(); ++si) {
|
||||
s = rec_sorts[si];
|
||||
m_out << "(";
|
||||
m_out << m_renaming.get_symbol(s->get_name());
|
||||
m_out << m_renaming.get_symbol(d->name());
|
||||
m_out << " ";
|
||||
decls = util.get_datatype_constructors(s);
|
||||
|
||||
for (unsigned i = 0; i < decls->size(); ++i) {
|
||||
func_decl* f = (*decls)[i];
|
||||
ptr_vector<func_decl> const& accs = *util.get_constructor_accessors(f);
|
||||
if (m_is_smt2 || accs.size() > 0) {
|
||||
m_out << "(";
|
||||
}
|
||||
m_out << m_renaming.get_symbol(f->get_name());
|
||||
if (!accs.empty() || !m_is_smt2) {
|
||||
m_out << " ";
|
||||
}
|
||||
for (unsigned j = 0; j < accs.size(); ++j) {
|
||||
func_decl* a = accs[j];
|
||||
m_out << "(" << m_renaming.get_symbol(a->get_name()) << " ";
|
||||
visit_sort(a->get_range());
|
||||
bool first_constr = true;
|
||||
for (datatype::constructor* f : *d) {
|
||||
if (!first_constr) m_out << " "; else first_constr = false;
|
||||
m_out << "(";
|
||||
m_out << m_renaming.get_symbol(f->name());
|
||||
for (datatype::accessor* a : *f) {
|
||||
m_out << " (" << m_renaming.get_symbol(a->name()) << " ";
|
||||
visit_sort(a->range());
|
||||
m_out << ")";
|
||||
if (j + 1 < accs.size()) m_out << " ";
|
||||
}
|
||||
if (m_is_smt2 || accs.size() > 0) {
|
||||
m_out << ")";
|
||||
if (i + 1 < decls->size()) {
|
||||
m_out << " ";
|
||||
}
|
||||
}
|
||||
m_out << ")";
|
||||
}
|
||||
if (!d->params().empty()) {
|
||||
m_out << ")";
|
||||
}
|
||||
m_out << ")";
|
||||
if (si + 1 < rec_sorts.size()) {
|
||||
m_out << " ";
|
||||
}
|
||||
}
|
||||
if (m_is_smt2) {
|
||||
m_out << ")";
|
||||
}
|
||||
m_out << ")";
|
||||
m_out << "))";
|
||||
newline();
|
||||
}
|
||||
|
||||
|
@ -1002,12 +839,7 @@ public:
|
|||
pp_dt(mark, s);
|
||||
}
|
||||
else {
|
||||
if (m_is_smt2) {
|
||||
m_out << "(declare-sort ";
|
||||
}
|
||||
else {
|
||||
m_out << ":extrasorts (";
|
||||
}
|
||||
m_out << "(declare-sort ";
|
||||
visit_sort(s);
|
||||
m_out << ")";
|
||||
newline();
|
||||
|
@ -1021,29 +853,16 @@ public:
|
|||
}
|
||||
|
||||
void operator()(func_decl* d) {
|
||||
if (m_is_smt2) {
|
||||
m_out << "(declare-fun ";
|
||||
pp_decl(d);
|
||||
m_out << "(";
|
||||
for (unsigned i = 0; i < d->get_arity(); ++i) {
|
||||
if (i > 0) m_out << " ";
|
||||
visit_sort(d->get_domain(i), true);
|
||||
}
|
||||
m_out << ") ";
|
||||
visit_sort(d->get_range());
|
||||
m_out << ")";
|
||||
}
|
||||
else {
|
||||
m_out << "(";
|
||||
pp_decl(d);
|
||||
for (unsigned i = 0; i < d->get_arity(); ++i) {
|
||||
m_out << " ";
|
||||
visit_sort(d->get_domain(i), true);
|
||||
}
|
||||
m_out << " ";
|
||||
visit_sort(d->get_range());
|
||||
m_out << ")";
|
||||
m_out << "(declare-fun ";
|
||||
pp_decl(d);
|
||||
m_out << "(";
|
||||
for (unsigned i = 0; i < d->get_arity(); ++i) {
|
||||
if (i > 0) m_out << " ";
|
||||
visit_sort(d->get_domain(i), true);
|
||||
}
|
||||
m_out << ") ";
|
||||
visit_sort(d->get_range());
|
||||
m_out << ")";
|
||||
}
|
||||
|
||||
void visit_pred(func_decl* d) {
|
||||
|
|
|
@ -19,9 +19,9 @@ Revision History:
|
|||
#ifndef AST_SMT_PP_H_
|
||||
#define AST_SMT_PP_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include "ast/ast.h"
|
||||
#include<string>
|
||||
#include"map.h"
|
||||
#include "util/map.h"
|
||||
|
||||
class smt_renaming {
|
||||
typedef map<symbol, symbol, symbol_hash_proc, symbol_eq_proc> symbol2symbol;
|
||||
|
|
|
@ -22,8 +22,8 @@ Revision History:
|
|||
#ifndef AST_TRAIL_H_
|
||||
#define AST_TRAIL_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"trail.h"
|
||||
#include "ast/ast.h"
|
||||
#include "util/trail.h"
|
||||
|
||||
|
||||
template<typename S, typename T>
|
||||
|
|
|
@ -16,13 +16,13 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include "arith_decl_plugin.h"
|
||||
#include "bv_decl_plugin.h"
|
||||
#include "datatype_decl_plugin.h"
|
||||
#include "array_decl_plugin.h"
|
||||
#include "format.h"
|
||||
#include "ast_translation.h"
|
||||
#include "ast_ll_pp.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/format.h"
|
||||
#include "ast/ast_translation.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
|
||||
ast_translation::~ast_translation() {
|
||||
reset_cache();
|
||||
|
@ -37,11 +37,9 @@ void ast_translation::cleanup() {
|
|||
}
|
||||
|
||||
void ast_translation::reset_cache() {
|
||||
obj_map<ast, ast*>::iterator it = m_cache.begin();
|
||||
obj_map<ast, ast*>::iterator end = m_cache.end();
|
||||
for (; it != end; ++it) {
|
||||
m_from_manager.dec_ref(it->m_key);
|
||||
m_to_manager.dec_ref(it->m_value);
|
||||
for (auto & kv : m_cache) {
|
||||
m_from_manager.dec_ref(kv.m_key);
|
||||
m_to_manager.dec_ref(kv.m_value);
|
||||
}
|
||||
m_cache.reset();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ Revision History:
|
|||
#ifndef AST_TRANSLATION_H_
|
||||
#define AST_TRANSLATION_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include "ast/ast.h"
|
||||
|
||||
class ast_translation {
|
||||
struct frame {
|
||||
|
|
|
@ -16,7 +16,7 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include "ast_util.h"
|
||||
#include "ast/ast_util.h"
|
||||
|
||||
app * mk_list_assoc_app(ast_manager & m, func_decl * f, unsigned num_args, expr * const * args) {
|
||||
SASSERT(f->is_associative());
|
||||
|
|
|
@ -19,8 +19,8 @@ Revision History:
|
|||
#ifndef AST_UTIL_H_
|
||||
#define AST_UTIL_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"obj_hashtable.h"
|
||||
#include "ast/ast.h"
|
||||
#include "util/obj_hashtable.h"
|
||||
|
||||
template<typename C>
|
||||
void remove_duplicates(C & v) {
|
||||
|
|
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