3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 12:28:44 +00:00
Signed-off-by: Miguel Angelo Da Terra Neves <t-mineve@microsoft.com>
This commit is contained in:
Miguel Angelo Da Terra Neves 2017-12-11 14:14:44 -08:00
commit 1e22cb73d5
4 changed files with 16 additions and 17 deletions

View file

@ -622,6 +622,9 @@ public:
sort * const * get_domain() const { return m_domain; }
sort * get_range() const { return m_range; }
unsigned get_size() const { return get_obj_size(m_arity); }
sort * const * begin() const { return get_domain(); }
sort * const * end() const { return get_domain() + get_arity(); }
};
// -----------------------------------

View file

@ -20,20 +20,15 @@ Revision History:
#include "ast/decl_collector.h"
void decl_collector::visit_sort(sort * n) {
SASSERT(!m_visited.is_marked(n));
family_id fid = n->get_family_id();
if (m().is_uninterp(n))
m_sorts.push_back(n);
if (fid == m_dt_fid) {
else if (fid == m_dt_fid) {
m_sorts.push_back(n);
unsigned num_cnstr = m_dt_util.get_datatype_num_constructors(n);
for (unsigned i = 0; i < num_cnstr; i++) {
func_decl * cnstr = m_dt_util.get_datatype_constructors(n)->get(i);
for (func_decl* cnstr : *m_dt_util.get_datatype_constructors(n)) {
m_decls.push_back(cnstr);
ptr_vector<func_decl> const & cnstr_acc = *m_dt_util.get_constructor_accessors(cnstr);
unsigned num_cas = cnstr_acc.size();
for (unsigned j = 0; j < num_cas; j++) {
func_decl * accsr = cnstr_acc.get(j);
for (func_decl * accsr : *m_dt_util.get_constructor_accessors(cnstr)) {
m_decls.push_back(accsr);
}
}
@ -53,6 +48,7 @@ void decl_collector::visit_func(func_decl * n) {
else
m_decls.push_back(n);
}
m_visited.mark(n, true);
}
}
@ -72,11 +68,10 @@ void decl_collector::visit(ast* n) {
if (!m_visited.is_marked(n)) {
switch(n->get_kind()) {
case AST_APP: {
app * a = to_app(n);
for (unsigned i = 0; i < a->get_num_args(); ++i) {
m_todo.push_back(a->get_arg(i));
for (expr * e : *to_app(n)) {
m_todo.push_back(e);
}
m_todo.push_back(a->get_decl());
m_todo.push_back(to_app(n)->get_decl());
break;
}
case AST_QUANTIFIER: {
@ -96,8 +91,8 @@ void decl_collector::visit(ast* n) {
break;
case AST_FUNC_DECL: {
func_decl * d = to_func_decl(n);
for (unsigned i = 0; i < d->get_arity(); ++i) {
m_todo.push_back(d->get_domain(i));
for (sort* srt : *d) {
m_todo.push_back(srt);
}
m_todo.push_back(d->get_range());
visit_func(d);

View file

@ -41,7 +41,7 @@ class decl_collector {
public:
// if preds == true, then predicates are stored in a separate collection.
decl_collector(ast_manager & m, bool preds=true);
decl_collector(ast_manager & m, bool preds = true);
ast_manager & m() { return m_manager; }
void visit_func(func_decl* n);

View file

@ -208,7 +208,6 @@ namespace sat {
m_to_delete.reset();
for (unsigned i = m_pos.size() - 1; i-- > 0; ) {
literal lit = m_pos[i];
//SASSERT(scc.get_left(lit) < scc.get_left(last));
int right2 = scc.get_right(lit);
if (right2 > right) {
// lit => last, so lit can be deleted
@ -345,10 +344,12 @@ namespace sat {
bool asymm_branch::process_sampled(scc& scc, clause & c) {
scoped_detach scoped_d(s, c);
sort(scc, c);
#if 0
if (uhte(scc, c)) {
scoped_d.del_clause();
return false;
}
#endif
return uhle(scoped_d, scc, c);
}