mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 03:45:51 +00:00
update rewriting of equalities and monomials for regressions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
7fbb938474
commit
c6722859c2
9 changed files with 102 additions and 95 deletions
|
@ -585,10 +585,8 @@ void cmd_context::register_builtin_sorts(decl_plugin * p) {
|
|||
svector<builtin_name> names;
|
||||
p->get_sort_names(names, m_logic);
|
||||
family_id fid = p->get_family_id();
|
||||
svector<builtin_name>::const_iterator it = names.begin();
|
||||
svector<builtin_name>::const_iterator end = names.end();
|
||||
for (; it != end; ++it) {
|
||||
psort_decl * d = pm().mk_psort_builtin_decl((*it).m_name, fid, (*it).m_kind);
|
||||
for (builtin_name const& n : names) {
|
||||
psort_decl * d = pm().mk_psort_builtin_decl(n.m_name, fid, n.m_kind);
|
||||
insert(d);
|
||||
}
|
||||
}
|
||||
|
@ -597,17 +595,15 @@ void cmd_context::register_builtin_ops(decl_plugin * p) {
|
|||
svector<builtin_name> names;
|
||||
p->get_op_names(names, m_logic);
|
||||
family_id fid = p->get_family_id();
|
||||
svector<builtin_name>::const_iterator it = names.begin();
|
||||
svector<builtin_name>::const_iterator end = names.end();
|
||||
for (; it != end; ++it) {
|
||||
if (m_builtin_decls.contains((*it).m_name)) {
|
||||
builtin_decl & d = m_builtin_decls.find((*it).m_name);
|
||||
builtin_decl * new_d = alloc(builtin_decl, fid, (*it).m_kind, d.m_next);
|
||||
for (builtin_name const& n : names) {
|
||||
if (m_builtin_decls.contains(n.m_name)) {
|
||||
builtin_decl & d = m_builtin_decls.find(n.m_name);
|
||||
builtin_decl * new_d = alloc(builtin_decl, fid, n.m_kind, d.m_next);
|
||||
d.m_next = new_d;
|
||||
m_extra_builtin_decls.push_back(new_d);
|
||||
}
|
||||
else {
|
||||
m_builtin_decls.insert((*it).m_name, builtin_decl(fid, (*it).m_kind));
|
||||
m_builtin_decls.insert(n.m_name, builtin_decl(fid, n.m_kind));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -693,10 +689,8 @@ void cmd_context::init_manager_core(bool new_manager) {
|
|||
load_plugin(symbol("seq"), logic_has_seq(), fids);
|
||||
load_plugin(symbol("fpa"), logic_has_fpa(), fids);
|
||||
load_plugin(symbol("pb"), logic_has_pb(), fids);
|
||||
svector<family_id>::iterator it = fids.begin();
|
||||
svector<family_id>::iterator end = fids.end();
|
||||
for (; it != end; ++it) {
|
||||
decl_plugin * p = m_manager->get_plugin(*it);
|
||||
for (family_id fid : fids) {
|
||||
decl_plugin * p = m_manager->get_plugin(fid);
|
||||
if (p) {
|
||||
register_builtin_sorts(p);
|
||||
register_builtin_ops(p);
|
||||
|
@ -1148,11 +1142,8 @@ void cmd_context::erase_object_ref(symbol const & s) {
|
|||
}
|
||||
|
||||
void cmd_context::reset_func_decls() {
|
||||
dictionary<func_decls>::iterator it = m_func_decls.begin();
|
||||
dictionary<func_decls>::iterator end = m_func_decls.end();
|
||||
for (; it != end; ++it) {
|
||||
func_decls fs = (*it).m_value;
|
||||
fs.finalize(m());
|
||||
for (auto & kv : m_func_decls) {
|
||||
kv.m_value.finalize(m());
|
||||
}
|
||||
m_func_decls.reset();
|
||||
m_func_decls_stack.reset();
|
||||
|
@ -1160,10 +1151,8 @@ void cmd_context::reset_func_decls() {
|
|||
}
|
||||
|
||||
void cmd_context::reset_psort_decls() {
|
||||
dictionary<psort_decl*>::iterator it = m_psort_decls.begin();
|
||||
dictionary<psort_decl*>::iterator end = m_psort_decls.end();
|
||||
for (; it != end; ++it) {
|
||||
psort_decl * p = (*it).m_value;
|
||||
for (auto & kv : m_psort_decls) {
|
||||
psort_decl * p = kv.m_value;
|
||||
pm().dec_ref(p);
|
||||
}
|
||||
m_psort_decls.reset();
|
||||
|
@ -1179,19 +1168,14 @@ void cmd_context::reset_macros() {
|
|||
}
|
||||
|
||||
void cmd_context::reset_cmds() {
|
||||
dictionary<cmd*>::iterator it = m_cmds.begin();
|
||||
dictionary<cmd*>::iterator end = m_cmds.end();
|
||||
for (; it != end; ++it) {
|
||||
cmd * c = (*it).m_value;
|
||||
c->reset(*this);
|
||||
for (auto& kv : m_cmds) {
|
||||
kv.m_value->reset(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void cmd_context::finalize_cmds() {
|
||||
dictionary<cmd*>::iterator it = m_cmds.begin();
|
||||
dictionary<cmd*>::iterator end = m_cmds.end();
|
||||
for (; it != end; ++it) {
|
||||
cmd * c = (*it).m_value;
|
||||
for (auto& kv : m_cmds) {
|
||||
cmd * c = kv.m_value;
|
||||
c->finalize(*this);
|
||||
dealloc(c);
|
||||
}
|
||||
|
@ -1204,10 +1188,8 @@ void cmd_context::reset_user_tactics() {
|
|||
}
|
||||
|
||||
void cmd_context::reset_object_refs() {
|
||||
dictionary<object_ref*>::iterator it = m_object_refs.begin();
|
||||
dictionary<object_ref*>::iterator end = m_object_refs.end();
|
||||
for (; it != end; ++it) {
|
||||
object_ref * r = (*it).m_value;
|
||||
for (auto& kv : m_object_refs) {
|
||||
object_ref * r = kv.m_value;
|
||||
r->dec_ref(*this);
|
||||
}
|
||||
m_object_refs.reset();
|
||||
|
@ -1541,10 +1523,8 @@ void cmd_context::reset_assertions() {
|
|||
mk_solver();
|
||||
}
|
||||
restore_assertions(0);
|
||||
svector<scope>::iterator it = m_scopes.begin();
|
||||
svector<scope>::iterator end = m_scopes.end();
|
||||
for (; it != end; ++it) {
|
||||
it->m_assertions_lim = 0;
|
||||
for (scope& s : m_scopes) {
|
||||
s.m_assertions_lim = 0;
|
||||
if (m_solver) m_solver->push();
|
||||
}
|
||||
}
|
||||
|
@ -1717,10 +1697,7 @@ void cmd_context::set_solver_factory(solver_factory * f) {
|
|||
mk_solver();
|
||||
// assert formulas and create scopes in the new solver.
|
||||
unsigned lim = 0;
|
||||
svector<scope>::iterator it = m_scopes.begin();
|
||||
svector<scope>::iterator end = m_scopes.end();
|
||||
for (; it != end; ++it) {
|
||||
scope & s = *it;
|
||||
for (scope& s : m_scopes) {
|
||||
for (unsigned i = lim; i < s.m_assertions_lim; i++) {
|
||||
m_solver->assert_expr(m_assertions[i]);
|
||||
}
|
||||
|
@ -1757,11 +1734,9 @@ void cmd_context::display_statistics(bool show_total_time, double total_time) {
|
|||
void cmd_context::display_assertions() {
|
||||
if (!m_interactive_mode)
|
||||
throw cmd_exception("command is only available in interactive mode, use command (set-option :interactive-mode true)");
|
||||
std::vector<std::string>::const_iterator it = m_assertion_strings.begin();
|
||||
std::vector<std::string>::const_iterator end = m_assertion_strings.end();
|
||||
regular_stream() << "(";
|
||||
for (bool first = true; it != end; ++it) {
|
||||
std::string const & s = *it;
|
||||
bool first = true;
|
||||
for (std::string const& s : m_assertion_strings) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
|
@ -1837,10 +1812,8 @@ void cmd_context::display(std::ostream & out, func_decl * d, unsigned indent) co
|
|||
}
|
||||
|
||||
void cmd_context::dump_assertions(std::ostream & out) const {
|
||||
ptr_vector<expr>::const_iterator it = m_assertions.begin();
|
||||
ptr_vector<expr>::const_iterator end = m_assertions.end();
|
||||
for (; it != end; ++it) {
|
||||
display(out, *it);
|
||||
for (expr * e : m_assertions) {
|
||||
display(out, e);
|
||||
out << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue