3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 16:45:31 +00:00
This commit is contained in:
Nikolaj Bjorner 2017-07-26 19:52:11 -07:00
commit 3f8b63f5a8
16 changed files with 98 additions and 43 deletions

View file

@ -429,8 +429,9 @@ format_ns::format * smt2_pp_environment::pp_sort(sort * s) {
if ((get_sutil().is_seq(s) || get_sutil().is_re(s)) && !get_sutil().is_string(s)) {
ptr_buffer<format> fs;
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":"Re");
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);
@ -439,6 +440,7 @@ format_ns::format * smt2_pp_environment::pp_sort(sort * s) {
}
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());
}

View file

@ -366,13 +366,14 @@ class smt_printer {
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 << " ";
@ -380,6 +381,7 @@ class smt_printer {
}
m_out << ")";
}
#endif
return;
}
else {

View file

@ -1190,6 +1190,7 @@ namespace nlsat {
info.m_lc = lc_eq.get();
info.m_lc_sign = sign(lc_eq);
info.m_lc_add = false;
info.m_lc_add_ineq = false;
info.m_lc_const = m_pm.is_const(lc_eq);
SASSERT(info.m_lc != 0);
scoped_literal new_lit(m_solver);

View file

@ -620,8 +620,8 @@ namespace smt2 {
int idx = 0;
if (d == 0) {
if (m_dt_name2idx.find(id, idx)) {
unsigned num_params = m_dt_name2arity.find(id);
throw parser_exception("smtlib 2.6 parametric datatype sorts are not supported");
// unsigned num_params = m_dt_name2arity.find(id);
// d = pm().mk_psort_dt_decl(num_params, id);
}
else {

View file

@ -51,9 +51,9 @@ namespace smt {
if (!m_theory_var_priority.find(v2, p_v2)) {
p_v2 = 0.0;
}
// add clause activity
p_v1 += m_activity[v1];
p_v2 += m_activity[v2];
// add clause activity
p_v1 += m_activity[v1];
p_v2 += m_activity[v2];
return p_v1 > p_v2;
}
};
@ -82,6 +82,7 @@ namespace smt {
virtual void mk_var_eh(bool_var v) {
m_queue.reserve(v+1);
SASSERT(!m_queue.contains(v));
m_queue.insert(v);
}
@ -130,10 +131,7 @@ namespace smt {
virtual void display(std::ostream & out) {
bool first = true;
bool_var_act_queue::const_iterator it = m_queue.begin();
bool_var_act_queue::const_iterator end = m_queue.end();
for (; it != end ; ++it) {
unsigned v = *it;
for (unsigned v : m_queue) {
if (m_context.get_assignment(v) == l_undef) {
if (first) {
out << "remaining case-splits:\n";
@ -143,8 +141,7 @@ namespace smt {
}
}
if (!first)
out << "\n";
out << "\n";
}
virtual ~act_case_split_queue() {};
@ -166,11 +163,15 @@ namespace smt {
act_case_split_queue::activity_increased_eh(v);
if (m_queue.contains(v))
m_queue.decreased(v);
if (m_delayed_queue.contains(v))
m_delayed_queue.decreased(v);
}
virtual void mk_var_eh(bool_var v) {
m_queue.reserve(v+1);
m_delayed_queue.reserve(v+1);
SASSERT(!m_delayed_queue.contains(v));
SASSERT(!m_queue.contains(v));
if (m_context.is_searching())
m_delayed_queue.insert(v);
else
@ -1099,8 +1100,6 @@ namespace smt {
#endif
GOAL_STOP();
//std::cout << "goal set, time " << m_goal_time.get_seconds() << "\n";
}
void set_global_generation()

View file

@ -1826,6 +1826,7 @@ namespace smt {
}
void context::rescale_bool_var_activity() {
TRACE("case_split", tout << "rescale\n";);
svector<double>::iterator it = m_activity.begin();
svector<double>::iterator end = m_activity.end();
for (; it != end; ++it)

View file

@ -1040,6 +1040,7 @@ namespace smt {
if (act > ACTIVITY_LIMIT)
rescale_bool_var_activity();
m_case_split_queue->activity_increased_eh(v);
TRACE("case_split", tout << "v" << v << " " << m_bvar_inc << " -> " << act << "\n";);
}
protected:

View file

@ -4653,34 +4653,24 @@ namespace smt {
}
bool theory_str::get_arith_value(expr* e, rational& val) const {
if (opt_DisableIntegerTheoryIntegration) {
TRACE("str", tout << "WARNING: integer theory integration disabled" << std::endl;);
return false;
}
context& ctx = get_context();
ast_manager & m = get_manager();
theory_mi_arith* tha = get_th_arith(ctx, m_autil.get_family_id(), e);
if (!tha) {
// safety
if (!ctx.e_internalized(e)) {
return false;
}
// if an integer constant exists in the eqc, it should be the root
enode * en_e = ctx.get_enode(e);
enode * root_e = en_e->get_root();
if (m_autil.is_numeral(root_e->get_owner(), val) && val.is_int()) {
TRACE("str", tout << mk_pp(e, m) << " ~= " << mk_pp(root_e->get_owner(), m) << std::endl;);
return true;
} else {
TRACE("str", tout << "root of eqc of " << mk_pp(e, m) << " is not a numeral" << std::endl;);
return false;
}
TRACE("str", tout << "checking eqc of " << mk_pp(e, m) << " for arithmetic value" << std::endl;);
expr_ref _val(m);
enode * en_e = ctx.get_enode(e);
enode * it = en_e;
do {
if (m_autil.is_numeral(it->get_owner(), val) && val.is_int()) {
// found an arithmetic term
TRACE("str", tout << mk_pp(it->get_owner(), m) << " is an integer ( ~= " << val << " )"
<< std::endl;);
return true;
} else {
TRACE("str", tout << mk_pp(it->get_owner(), m) << " not a numeral" << std::endl;);
}
it = it->get_next();
} while (it != en_e);
TRACE("str", tout << "no arithmetic values found in eqc" << std::endl;);
return false;
}
bool theory_str::lower_bound(expr* _e, rational& lo) {

View file

@ -43,6 +43,15 @@ class heap : private LT {
return i >> 1;
}
void display(std::ostream& out, unsigned indent, int idx) const {
if (idx < static_cast<int>(m_values.size())) {
for (unsigned i = 0; i < indent; ++i) out << " ";
out << m_values[idx] << "\n";
display(out, indent + 1, left(idx));
display(out, indent + 1, right(idx));
}
}
#ifdef Z3DEBUG
// Return true if the value can be inserted in the heap. That is, the vector m_value2indices is big enough to store this value.
bool is_valid_value(int v) const {
@ -59,10 +68,13 @@ class heap : private LT {
}
return true;
}
public:
bool check_invariant() const {
return check_invariant_core(1);
}
#endif
private:
@ -219,6 +231,7 @@ public:
void insert(int val) {
CASSERT("heap", check_invariant());
CASSERT("heap", !contains(val));
SASSERT(is_valid_value(val));
int idx = static_cast<int>(m_values.size());
m_value2indices[val] = idx;
@ -272,6 +285,11 @@ public:
}
}
}
void display(std::ostream& out) const {
display(out, 0, 1);
}
};

View file

@ -2,8 +2,8 @@
Copyright (c) 2017 Microsoft Corporation
Author: Lev Nachmanson
*/
#include "util/vector.h"
#include <memory>
#include "util/vector.h"
#include "util/lp/lp_settings.hpp"
template bool lean::vectors_are_equal<double>(vector<double> const&, vector<double> const&);
template bool lean::vectors_are_equal<lean::mpq>(vector<lean::mpq > const&, vector<lean::mpq> const&);

View file

@ -2,8 +2,8 @@
Copyright (c) 2017 Microsoft Corporation
Author: Lev Nachmanson
*/
#include "util/vector.h"
#include <memory>
#include "util/vector.h"
#include "util/lp/row_eta_matrix.hpp"
#include "util/lp/lu.h"
namespace lean {

View file

@ -2,10 +2,10 @@
Copyright (c) 2017 Microsoft Corporation
Author: Lev Nachmanson
*/
#include "util/vector.h"
#include <memory>
#include <set>
#include <utility>
#include "util/vector.h"
#include "util/lp/static_matrix.hpp"
#include "util/lp/lp_core_solver_base.h"
#include "util/lp/lp_dual_core_solver.h"