mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
modulating data-type solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
cb2d8d2107
commit
bbfe02b25a
10 changed files with 44 additions and 26 deletions
|
@ -732,7 +732,8 @@ void datatype_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol
|
|||
datatype_util::datatype_util(ast_manager & m):
|
||||
m_manager(m),
|
||||
m_family_id(m.mk_family_id("datatype")),
|
||||
m_asts(m) {
|
||||
m_asts(m),
|
||||
m_start(0) {
|
||||
}
|
||||
|
||||
datatype_util::~datatype_util() {
|
||||
|
@ -807,11 +808,11 @@ func_decl * datatype_util::get_non_rec_constructor_core(sort * ty, ptr_vector<so
|
|||
// If there is no such constructor, then we select one that
|
||||
// 2) each type T_i is not recursive or contains a constructor that does not depend on T
|
||||
ptr_vector<func_decl> const * constructors = get_datatype_constructors(ty);
|
||||
ptr_vector<func_decl>::const_iterator it = constructors->begin();
|
||||
ptr_vector<func_decl>::const_iterator end = constructors->end();
|
||||
// step 1)
|
||||
for (; it != end; ++it) {
|
||||
func_decl * c = *it;
|
||||
unsigned sz = constructors->size();
|
||||
++m_start;
|
||||
for (unsigned j = 0; j < sz; ++j) {
|
||||
func_decl * c = (*constructors)[(j + m_start) % sz];
|
||||
unsigned num_args = c->get_arity();
|
||||
unsigned i = 0;
|
||||
for (; i < num_args; i++) {
|
||||
|
@ -823,9 +824,8 @@ func_decl * datatype_util::get_non_rec_constructor_core(sort * ty, ptr_vector<so
|
|||
return c;
|
||||
}
|
||||
// step 2)
|
||||
it = constructors->begin();
|
||||
for (; it != end; ++it) {
|
||||
func_decl * c = *it;
|
||||
for (unsigned j = 0; j < sz; ++j) {
|
||||
func_decl * c = (*constructors)[(j + m_start) % sz];
|
||||
TRACE("datatype_util_bug", tout << "non_rec_constructor c: " << c->get_name() << "\n";);
|
||||
unsigned num_args = c->get_arity();
|
||||
unsigned i = 0;
|
||||
|
@ -964,6 +964,7 @@ void datatype_util::reset() {
|
|||
std::for_each(m_vectors.begin(), m_vectors.end(), delete_proc<ptr_vector<func_decl> >());
|
||||
m_vectors.reset();
|
||||
m_asts.reset();
|
||||
++m_start;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -176,7 +176,8 @@ class datatype_util {
|
|||
obj_map<sort, bool> m_is_enum;
|
||||
ast_ref_vector m_asts;
|
||||
ptr_vector<ptr_vector<func_decl> > m_vectors;
|
||||
|
||||
unsigned m_start;
|
||||
|
||||
func_decl * get_non_rec_constructor_core(sort * ty, ptr_vector<sort> & forbidden_set);
|
||||
func_decl * get_constructor(sort * ty, unsigned c_id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue