mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 17:45:32 +00:00
recursive function definitions; combine model-building functionality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
6fa2338edc
commit
7c6540e18f
19 changed files with 129 additions and 173 deletions
|
@ -40,6 +40,15 @@ array_decl_plugin::array_decl_plugin():
|
|||
#define ARRAY_SORT_STR "Array"
|
||||
|
||||
sort * array_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
|
||||
|
||||
if (k == _SET_SORT) {
|
||||
if (num_parameters != 1) {
|
||||
m_manager->raise_exception("invalid array sort definition, invalid number of parameters");
|
||||
return 0;
|
||||
}
|
||||
parameter params[2] = { parameters[0], parameter(m_manager->mk_bool_sort()) };
|
||||
return mk_sort(ARRAY_SORT, 2, params);
|
||||
}
|
||||
SASSERT(k == ARRAY_SORT);
|
||||
if (num_parameters < 2) {
|
||||
m_manager->raise_exception("invalid array sort definition, invalid number of parameters");
|
||||
|
@ -506,6 +515,8 @@ func_decl * array_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
|
|||
|
||||
void array_decl_plugin::get_sort_names(svector<builtin_name>& sort_names, symbol const & logic) {
|
||||
sort_names.push_back(builtin_name(ARRAY_SORT_STR, ARRAY_SORT));
|
||||
// TBD: this could easily break users even though it is already used in CVC4:
|
||||
// sort_names.push_back(builtin_name("Set", _SET_SORT));
|
||||
}
|
||||
|
||||
void array_decl_plugin::get_op_names(svector<builtin_name>& op_names, symbol const & logic) {
|
||||
|
|
|
@ -35,7 +35,8 @@ inline sort* get_array_domain(sort const * s, unsigned idx) {
|
|||
}
|
||||
|
||||
enum array_sort_kind {
|
||||
ARRAY_SORT
|
||||
ARRAY_SORT,
|
||||
_SET_SORT
|
||||
};
|
||||
|
||||
enum array_op_kind {
|
||||
|
|
|
@ -1308,7 +1308,8 @@ ast_manager::ast_manager(proof_gen_mode m, char const * trace_file, bool is_form
|
|||
m_expr_dependency_array_manager(*this, m_alloc),
|
||||
m_proof_mode(m),
|
||||
m_trace_stream(0),
|
||||
m_trace_stream_owner(false) {
|
||||
m_trace_stream_owner(false),
|
||||
m_rec_fun(":rec-fun") {
|
||||
|
||||
if (trace_file) {
|
||||
m_trace_stream = alloc(std::fstream, trace_file, std::ios_base::out);
|
||||
|
@ -1329,7 +1330,8 @@ ast_manager::ast_manager(proof_gen_mode m, std::fstream * trace_stream, bool is_
|
|||
m_expr_dependency_array_manager(*this, m_alloc),
|
||||
m_proof_mode(m),
|
||||
m_trace_stream(trace_stream),
|
||||
m_trace_stream_owner(false) {
|
||||
m_trace_stream_owner(false),
|
||||
m_rec_fun(":rec-fun") {
|
||||
|
||||
if (!is_format_manager)
|
||||
m_format_manager = alloc(ast_manager, PGM_DISABLED, trace_stream, true);
|
||||
|
@ -1345,7 +1347,8 @@ ast_manager::ast_manager(ast_manager const & src, bool disable_proofs):
|
|||
m_expr_dependency_array_manager(*this, m_alloc),
|
||||
m_proof_mode(disable_proofs ? PGM_DISABLED : src.m_proof_mode),
|
||||
m_trace_stream(src.m_trace_stream),
|
||||
m_trace_stream_owner(false) {
|
||||
m_trace_stream_owner(false),
|
||||
m_rec_fun(":rec-fun") {
|
||||
SASSERT(!src.is_format_manager());
|
||||
m_format_manager = alloc(ast_manager, PGM_DISABLED, m_trace_stream, true);
|
||||
init();
|
||||
|
|
|
@ -1455,6 +1455,7 @@ protected:
|
|||
bool slow_not_contains(ast const * n);
|
||||
#endif
|
||||
ast_manager * m_format_manager; // hack for isolating format objects in a different manager.
|
||||
symbol m_rec_fun;
|
||||
|
||||
void init();
|
||||
|
||||
|
@ -1561,6 +1562,10 @@ public:
|
|||
|
||||
bool contains(ast * a) const { return m_ast_table.contains(a); }
|
||||
|
||||
bool is_rec_fun_def(quantifier* q) const { return q->get_qid() == m_rec_fun; }
|
||||
|
||||
symbol const& rec_fun_qid() const { return m_rec_fun; }
|
||||
|
||||
unsigned get_num_asts() const { return m_ast_table.size(); }
|
||||
|
||||
void debug_ref_count() { m_debug_ref_count = true; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue