mirror of
https://github.com/Z3Prover/z3
synced 2025-08-18 01:02:15 +00:00
Merge branch 'unstable' of https://git01.codeplex.com/z3 into unstable
This commit is contained in:
commit
7e4c9a7f75
7 changed files with 22 additions and 27 deletions
|
@ -2755,7 +2755,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro
|
||||||
app const * cls = to_app(f1);
|
app const * cls = to_app(f1);
|
||||||
unsigned num_args = cls->get_num_args();
|
unsigned num_args = cls->get_num_args();
|
||||||
#ifdef Z3DEBUG
|
#ifdef Z3DEBUG
|
||||||
vector<bool> found;
|
svector<bool> found;
|
||||||
#endif
|
#endif
|
||||||
for (unsigned i = 0; i < num_args; i++) {
|
for (unsigned i = 0; i < num_args; i++) {
|
||||||
expr * lit = cls->get_arg(i);
|
expr * lit = cls->get_arg(i);
|
||||||
|
|
|
@ -803,17 +803,15 @@ namespace datalog {
|
||||||
context& m_context;
|
context& m_context;
|
||||||
item_set & m_removed;
|
item_set & m_removed;
|
||||||
svector<T> m_stack;
|
svector<T> m_stack;
|
||||||
ast_mark m_stack_content;
|
|
||||||
ast_mark m_visited;
|
ast_mark m_visited;
|
||||||
|
|
||||||
void traverse(T v) {
|
void traverse(T v) {
|
||||||
SASSERT(!m_stack_content.is_marked(v));
|
SASSERT(!m_visited.is_marked(v));
|
||||||
if(m_visited.is_marked(v) || m_removed.contains(v)) {
|
if (m_removed.contains(v)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stack.push_back(v);
|
m_stack.push_back(v);
|
||||||
m_stack_content.mark(v, true);
|
|
||||||
m_visited.mark(v, true);
|
m_visited.mark(v, true);
|
||||||
|
|
||||||
const item_set & deps = m_deps.get_deps(v);
|
const item_set & deps = m_deps.get_deps(v);
|
||||||
|
@ -821,33 +819,34 @@ namespace datalog {
|
||||||
item_set::iterator end = deps.end();
|
item_set::iterator end = deps.end();
|
||||||
for(; it!=end; ++it) {
|
for(; it!=end; ++it) {
|
||||||
T d = *it;
|
T d = *it;
|
||||||
if(m_stack_content.is_marked(d)) {
|
if (m_visited.is_marked(d)) {
|
||||||
//TODO: find the best vertex to remove in the cycle
|
//TODO: find the best vertex to remove in the cycle
|
||||||
remove_from_stack();
|
remove_from_stack();
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
traverse(d);
|
traverse(d);
|
||||||
}
|
}
|
||||||
SASSERT(m_stack.back()==v);
|
SASSERT(m_stack.back()==v);
|
||||||
|
|
||||||
m_stack.pop_back();
|
m_stack.pop_back();
|
||||||
m_stack_content.mark(v, false);
|
m_visited.mark(v, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_from_stack() {
|
void remove_from_stack() {
|
||||||
for (unsigned i = 0; i < m_stack.size(); ++i) {
|
for (unsigned i = 0; i < m_stack.size(); ++i) {
|
||||||
func_decl* p = m_stack[i];
|
func_decl* p = m_stack[i];
|
||||||
rule_vector const& rules = m_rules.get_predicate_rules(p);
|
|
||||||
unsigned stratum = m_rules.get_predicate_strat(p);
|
|
||||||
if (m_context.has_facts(p)) {
|
if (m_context.has_facts(p)) {
|
||||||
m_removed.insert(p);
|
m_removed.insert(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rule_vector const& rules = m_rules.get_predicate_rules(p);
|
||||||
|
unsigned stratum = m_rules.get_predicate_strat(p);
|
||||||
for (unsigned j = 0; j < rules.size(); ++j) {
|
for (unsigned j = 0; j < rules.size(); ++j) {
|
||||||
rule const& r = *rules[j];
|
rule const& r = *rules[j];
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
for (unsigned k = 0; ok && k < r.get_uninterpreted_tail_size(); ++k) {
|
for (unsigned k = 0; ok && k < r.get_uninterpreted_tail_size(); ++k) {
|
||||||
ok &= m_rules.get_predicate_strat(r.get_decl(k)) < stratum;
|
ok = m_rules.get_predicate_strat(r.get_decl(k)) < stratum;
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
m_removed.insert(p);
|
m_removed.insert(p);
|
||||||
|
@ -858,8 +857,8 @@ namespace datalog {
|
||||||
|
|
||||||
// nothing was found.
|
// nothing was found.
|
||||||
m_removed.insert(m_stack.back());
|
m_removed.insert(m_stack.back());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cycle_breaker(rule_dependencies & deps, rule_set const& rules, context& ctx, item_set & removed)
|
cycle_breaker(rule_dependencies & deps, rule_set const& rules, context& ctx, item_set & removed)
|
||||||
: m_deps(deps), m_rules(rules), m_context(ctx), m_removed(removed) { SASSERT(removed.empty()); }
|
: m_deps(deps), m_rules(rules), m_context(ctx), m_removed(removed) { SASSERT(removed.empty()); }
|
||||||
|
|
|
@ -1022,19 +1022,16 @@ namespace datalog {
|
||||||
|
|
||||||
|
|
||||||
class sparse_table_plugin::rename_fn : public convenient_table_rename_fn {
|
class sparse_table_plugin::rename_fn : public convenient_table_rename_fn {
|
||||||
const unsigned m_cycle_len;
|
|
||||||
const unsigned m_col_cnt;
|
|
||||||
unsigned_vector m_out_of_cycle;
|
unsigned_vector m_out_of_cycle;
|
||||||
public:
|
public:
|
||||||
rename_fn(const table_signature & orig_sig, unsigned permutation_cycle_len, const unsigned * permutation_cycle)
|
rename_fn(const table_signature & orig_sig, unsigned permutation_cycle_len, const unsigned * permutation_cycle)
|
||||||
: convenient_table_rename_fn(orig_sig, permutation_cycle_len, permutation_cycle),
|
: convenient_table_rename_fn(orig_sig, permutation_cycle_len, permutation_cycle) {
|
||||||
m_cycle_len(permutation_cycle_len), m_col_cnt(orig_sig.size()) {
|
|
||||||
SASSERT(permutation_cycle_len>=2);
|
SASSERT(permutation_cycle_len>=2);
|
||||||
idx_set cycle_cols;
|
idx_set cycle_cols;
|
||||||
for (unsigned i=0; i<m_cycle_len; i++) {
|
for (unsigned i=0; i < permutation_cycle_len; ++i) {
|
||||||
cycle_cols.insert(permutation_cycle[i]);
|
cycle_cols.insert(permutation_cycle[i]);
|
||||||
}
|
}
|
||||||
for (unsigned i=0; i<m_col_cnt; i++) {
|
for (unsigned i=0; i < orig_sig.size(); ++i) {
|
||||||
if (!cycle_cols.contains(i)) {
|
if (!cycle_cols.contains(i)) {
|
||||||
m_out_of_cycle.push_back(i);
|
m_out_of_cycle.push_back(i);
|
||||||
}
|
}
|
||||||
|
@ -1045,10 +1042,10 @@ namespace datalog {
|
||||||
const sparse_table::column_layout & src_layout,
|
const sparse_table::column_layout & src_layout,
|
||||||
const sparse_table::column_layout & tgt_layout) {
|
const sparse_table::column_layout & tgt_layout) {
|
||||||
|
|
||||||
for (unsigned i=1; i<m_cycle_len; i++) {
|
for (unsigned i=1; i < m_cycle.size(); ++i) {
|
||||||
tgt_layout.set(tgt, m_cycle[i-1], src_layout.get(src, m_cycle[i]));
|
tgt_layout.set(tgt, m_cycle[i-1], src_layout.get(src, m_cycle[i]));
|
||||||
}
|
}
|
||||||
tgt_layout.set(tgt, m_cycle[m_cycle_len-1], src_layout.get(src, m_cycle[0]));
|
tgt_layout.set(tgt, m_cycle[m_cycle.size()-1], src_layout.get(src, m_cycle[0]));
|
||||||
|
|
||||||
unsigned_vector::const_iterator it = m_out_of_cycle.begin();
|
unsigned_vector::const_iterator it = m_out_of_cycle.begin();
|
||||||
unsigned_vector::const_iterator end = m_out_of_cycle.end();
|
unsigned_vector::const_iterator end = m_out_of_cycle.end();
|
||||||
|
|
|
@ -145,7 +145,8 @@ namespace pdr {
|
||||||
rational two(2);
|
rational two(2);
|
||||||
for (unsigned j = 0; j < bv_size; ++j) {
|
for (unsigned j = 0; j < bv_size; ++j) {
|
||||||
parameter p(j);
|
parameter p(j);
|
||||||
expr* e = m.mk_app(bv.get_family_id(), OP_BIT2BOOL, 1, &p, 1, &c);
|
//expr* e = m.mk_app(bv.get_family_id(), OP_BIT2BOOL, 1, &p, 1, &c);
|
||||||
|
expr* e = m.mk_eq(m.mk_app(bv.get_family_id(), OP_BIT1), bv.mk_extract(j, j, c));
|
||||||
if ((r % two).is_zero()) {
|
if ((r % two).is_zero()) {
|
||||||
e = m.mk_not(e);
|
e = m.mk_not(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,8 +208,8 @@ void bit_vector::display(std::ostream & out) const {
|
||||||
|
|
||||||
void fr_bit_vector::reset() {
|
void fr_bit_vector::reset() {
|
||||||
unsigned sz = size();
|
unsigned sz = size();
|
||||||
vector<unsigned>::const_iterator it = m_one_idxs.begin();
|
unsigned_vector::const_iterator it = m_one_idxs.begin();
|
||||||
vector<unsigned>::const_iterator end = m_one_idxs.end();
|
unsigned_vector::const_iterator end = m_one_idxs.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
unsigned idx = *it;
|
unsigned idx = *it;
|
||||||
if (idx < sz)
|
if (idx < sz)
|
||||||
|
@ -217,5 +217,3 @@ void fr_bit_vector::reset() {
|
||||||
}
|
}
|
||||||
m_one_idxs.reset();
|
m_one_idxs.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ inline std::ostream & operator<<(std::ostream & out, bit_vector const & b) {
|
||||||
This class should be used if the reset is frequently called.
|
This class should be used if the reset is frequently called.
|
||||||
*/
|
*/
|
||||||
class fr_bit_vector : private bit_vector {
|
class fr_bit_vector : private bit_vector {
|
||||||
svector<unsigned> m_one_idxs;
|
unsigned_vector m_one_idxs;
|
||||||
public:
|
public:
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ class mpff_manager {
|
||||||
|
|
||||||
unsigned m_precision; //!< Number of words in the significand. Must be an even number.
|
unsigned m_precision; //!< Number of words in the significand. Must be an even number.
|
||||||
unsigned m_precision_bits; //!< Number of bits in the significand. Must be 32*m_precision.
|
unsigned m_precision_bits; //!< Number of bits in the significand. Must be 32*m_precision.
|
||||||
vector<unsigned> m_significands; //!< Array containing all significands.
|
unsigned_vector m_significands; //!< Array containing all significands.
|
||||||
unsigned m_capacity; //!< Number of significands that can be stored in m_significands.
|
unsigned m_capacity; //!< Number of significands that can be stored in m_significands.
|
||||||
bool m_to_plus_inf; //!< If True, then round to plus infinity, otherwise to minus infinity
|
bool m_to_plus_inf; //!< If True, then round to plus infinity, otherwise to minus infinity
|
||||||
id_gen m_id_gen;
|
id_gen m_id_gen;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue