mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 18:31:49 +00:00
remove unused file & hide a few symbols
This commit is contained in:
parent
35aa98436f
commit
d79692b185
|
@ -26,7 +26,7 @@ Revision History:
|
|||
//
|
||||
// -----------------------------------
|
||||
|
||||
namespace occurs_namespace {
|
||||
namespace {
|
||||
struct found {};
|
||||
|
||||
struct proc {
|
||||
|
@ -49,27 +49,26 @@ namespace occurs_namespace {
|
|||
void operator()(quantifier const * n) { }
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// Return true if n1 occurs in n2
|
||||
bool occurs(expr * n1, expr * n2) {
|
||||
occurs_namespace::proc p(n1);
|
||||
proc p(n1);
|
||||
try {
|
||||
quick_for_each_expr(p, n2);
|
||||
}
|
||||
catch (const occurs_namespace::found &) {
|
||||
catch (const found &) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool occurs(func_decl * d, expr * n) {
|
||||
occurs_namespace::decl_proc p(d);
|
||||
decl_proc p(d);
|
||||
try {
|
||||
quick_for_each_expr(p, n);
|
||||
}
|
||||
catch (const occurs_namespace::found &) {
|
||||
catch (const found &) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -25,6 +25,8 @@ Revision History:
|
|||
#include "util/warning.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
namespace {
|
||||
|
||||
struct well_sorted_proc {
|
||||
ast_manager & m_manager;
|
||||
bool m_error;
|
||||
|
@ -76,6 +78,8 @@ struct well_sorted_proc {
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
bool is_well_sorted(ast_manager const & m, expr * n) {
|
||||
well_sorted_proc p(const_cast<ast_manager&>(m));
|
||||
for_each_expr(p, n);
|
||||
|
|
|
@ -20,7 +20,6 @@ z3_add_component(sat
|
|||
sat_elim_eqs.cpp
|
||||
sat_elim_vars.cpp
|
||||
sat_bcd.cpp
|
||||
sat_iff3_finder.cpp
|
||||
sat_integrity_checker.cpp
|
||||
sat_local_search.cpp
|
||||
sat_lookahead.cpp
|
||||
|
|
|
@ -21,6 +21,7 @@ Revision History:
|
|||
#undef min
|
||||
#include "sat/sat_solver.h"
|
||||
|
||||
namespace {
|
||||
struct lex_error {};
|
||||
|
||||
class stream_buffer {
|
||||
|
@ -138,6 +139,8 @@ bool parse_dimacs_core(Buffer & in, std::ostream& err, sat::solver & solver) {
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool parse_dimacs(std::istream & in, std::ostream& err, sat::solver & solver) {
|
||||
stream_buffer _in(in);
|
||||
return parse_dimacs_core(_in, err, solver);
|
||||
|
|
|
@ -1,214 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
sat_iff3_finder.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Find constraints of the form x = l1 = l2
|
||||
That is, search for clauses of the form
|
||||
~x \/ l1 \/ ~l2
|
||||
~x \/ ~l1 \/ l2
|
||||
x \/ l1 \/ l2
|
||||
x \/ ~l1 \/ ~l2
|
||||
|
||||
The basic idea is to sort the watch lists.
|
||||
|
||||
This information can be used to propagate equivalences
|
||||
during probing (and search).
|
||||
|
||||
The initial experiments were disappointing.
|
||||
Not using it on the solver.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-06-04.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#include "sat/sat_iff3_finder.h"
|
||||
#include "sat/sat_solver.h"
|
||||
|
||||
namespace sat {
|
||||
|
||||
struct iff3_lt {
|
||||
bool operator()(watched const & w1, watched const & w2) const {
|
||||
// keep th binary clauses in the beginning
|
||||
if (w2.is_binary_clause()) return false;
|
||||
if (w1.is_binary_clause()) return true;
|
||||
//
|
||||
if (w2.is_ternary_clause()) {
|
||||
if (w1.is_ternary_clause()) {
|
||||
literal l1_1 = w1.get_literal1();
|
||||
literal l1_2 = w1.get_literal2();
|
||||
literal l2_1 = w2.get_literal1();
|
||||
literal l2_2 = w2.get_literal2();
|
||||
if (l1_1.index() < l2_1.index()) return true;
|
||||
if (l1_1.index() > l2_1.index()) return false;
|
||||
return l1_2.index() < l2_2.index();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (w1.is_ternary_clause()) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
static void unmark(svector<bool> & marks, literal_vector & to_unmark) {
|
||||
literal_vector::const_iterator it = to_unmark.begin();
|
||||
literal_vector::const_iterator end = to_unmark.end();
|
||||
for (; it != end; ++it) {
|
||||
marks[it->index()] = false;
|
||||
}
|
||||
to_unmark.reset();
|
||||
}
|
||||
|
||||
#define SMALL_WLIST 16
|
||||
|
||||
/**
|
||||
\brief Return true if wlist contains (l1, l2)
|
||||
It assumes wlist have been sorted using iff3_lt
|
||||
*/
|
||||
static bool contains(watch_list const & wlist, literal l1, literal l2) {
|
||||
watched k(l1, l2);
|
||||
if (wlist.size() < SMALL_WLIST)
|
||||
return wlist.contains(k);
|
||||
iff3_lt lt;
|
||||
int low = 0;
|
||||
int high = wlist.size();
|
||||
while (true) {
|
||||
int mid = low + ((high - low) / 2);
|
||||
watched const & m = wlist[mid];
|
||||
if (m == k)
|
||||
return true;
|
||||
if (lt(m, k)) {
|
||||
low = mid + 1;
|
||||
}
|
||||
else {
|
||||
SASSERT(lt(k, m));
|
||||
high = mid - 1;
|
||||
}
|
||||
if (low > high)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
iff3_finder::iff3_finder(solver & _s):
|
||||
s(_s) {
|
||||
}
|
||||
|
||||
void iff3_finder::sort_watches() {
|
||||
vector<watch_list>::iterator it = s.m_watches.begin();
|
||||
vector<watch_list>::iterator end = s.m_watches.end();
|
||||
for (; it != end; ++it) {
|
||||
watch_list & wlist = *it;
|
||||
std::stable_sort(wlist.begin(), wlist.end(), iff3_lt());
|
||||
}
|
||||
}
|
||||
|
||||
void iff3_finder::mk_eq(literal l1, literal l2) {
|
||||
s.mk_clause(l1, ~l2);
|
||||
s.mk_clause(~l1, l2);
|
||||
}
|
||||
|
||||
void iff3_finder::operator()() {
|
||||
TRACE("iff3_finder", tout << "starting iff3_finder\n";);
|
||||
sort_watches();
|
||||
|
||||
unsigned counter = 0;
|
||||
|
||||
svector<bool> found;
|
||||
found.resize(s.num_vars()*2, false);
|
||||
literal_vector to_unmark;
|
||||
|
||||
typedef std::pair<literal, literal> lit_pair;
|
||||
svector<lit_pair> pairs;
|
||||
|
||||
for (bool_var x = 0; x < s.num_vars(); x++) {
|
||||
literal pos_x(x, false);
|
||||
literal neg_x(x, true);
|
||||
watch_list & pos_wlist = s.get_wlist(neg_x);
|
||||
watch_list & neg_wlist = s.get_wlist(pos_x);
|
||||
//
|
||||
TRACE("iff3_finder",
|
||||
tout << "visiting: " << x << "\n";
|
||||
tout << "pos:\n";
|
||||
s.display_watch_list(tout, pos_wlist);
|
||||
tout << "\nneg:\n";
|
||||
s.display_watch_list(tout, neg_wlist);
|
||||
tout << "\n--------------\n";);
|
||||
// traverse the ternary clauses x \/ l1 \/ l2
|
||||
bool_var curr_v1 = null_bool_var;
|
||||
watch_list::iterator it = pos_wlist.begin();
|
||||
watch_list::iterator end = pos_wlist.end();
|
||||
for (; it != end; ++it) {
|
||||
if (it->is_binary_clause())
|
||||
continue;
|
||||
if (it->is_ternary_clause()) {
|
||||
literal l1 = it->get_literal1();
|
||||
if (l1.index() < pos_x.index())
|
||||
break; // stop
|
||||
literal l2 = it->get_literal2();
|
||||
bool_var v1 = l1.var();
|
||||
if (v1 != curr_v1) {
|
||||
curr_v1 = v1;
|
||||
unmark(found, to_unmark);
|
||||
pairs.reset();
|
||||
}
|
||||
if (!l1.sign()) {
|
||||
if (!found[l2.index()]) {
|
||||
found[l2.index()] = true;
|
||||
to_unmark.push_back(l2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
l2.neg();
|
||||
if (found[l2.index()]) {
|
||||
// Found clauses x \/ v1 \/ l2 and x \/ ~v1 \/ ~l2
|
||||
// So, I have to find the clauses
|
||||
// ~x \/ v1 \/ ~l2
|
||||
// ~x \/ ~v1 \/ l2
|
||||
if (contains(neg_wlist, literal(v1, false), ~l2) &&
|
||||
contains(neg_wlist, literal(v1, true), l2)) {
|
||||
// found new iff3
|
||||
// x = v1 = l2
|
||||
counter++;
|
||||
// verbose_stream() << counter << ": " << x << " = " << v1 << " = " << l2 << "\n";
|
||||
TRACE("iff3_finder", tout << counter << ": " << x << " = " << v1 << " = " << l2 << "\n";);
|
||||
l1.neg();
|
||||
svector<lit_pair>::iterator it2 = pairs.begin();
|
||||
svector<lit_pair>::iterator end2 = pairs.end();
|
||||
for (; it2 != end2; ++it2) {
|
||||
if (it2->first == l1) {
|
||||
// l2 == it2->second
|
||||
mk_eq(l2, it2->second);
|
||||
}
|
||||
else if (it2->second == l1) {
|
||||
// l2 == it2->first
|
||||
mk_eq(l2, it2->first);
|
||||
}
|
||||
else if (it2->first == l2) {
|
||||
// l1 == it2->second
|
||||
mk_eq(l1, it2->second);
|
||||
}
|
||||
else if (it2->second == l2) {
|
||||
// l1 == it2->first
|
||||
mk_eq(l1, it2->first);
|
||||
}
|
||||
}
|
||||
pairs.push_back(lit_pair(l1, l2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
break; // stop, no more ternary clauses from this point
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
|
@ -1,48 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
sat_iff3_finder.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Find constraints of the form x = l1 = l2
|
||||
That is, search for clauses of the form
|
||||
~x \/ l1 \/ ~l2
|
||||
~x \/ ~l1 \/ l2
|
||||
x \/ l1 \/ l2
|
||||
x \/ ~l1 \/ ~l2
|
||||
|
||||
The basic idea is to sort the watch lists.
|
||||
|
||||
This information can be used to propagate equivalences
|
||||
during probing (and search).
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-06-04.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef SAT_IFF3_FINDER_H_
|
||||
#define SAT_IFF3_FINDER_H_
|
||||
|
||||
#include "sat/sat_types.h"
|
||||
|
||||
namespace sat {
|
||||
|
||||
class iff3_finder {
|
||||
solver & s;
|
||||
void sort_watches();
|
||||
void mk_eq(literal l1, literal l2);
|
||||
public:
|
||||
iff3_finder(solver & s);
|
||||
|
||||
void operator()();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1676,12 +1676,6 @@ namespace sat {
|
|||
}
|
||||
|
||||
|
||||
struct clause_size_lt {
|
||||
bool operator()(clause const * c1, clause const * c2) const {
|
||||
return c1->size() < c2->size();
|
||||
}
|
||||
};
|
||||
|
||||
void solver::init_assumptions(unsigned num_lits, literal const* lits) {
|
||||
if (num_lits == 0 && m_user_scope_literals.empty()) {
|
||||
return;
|
||||
|
|
|
@ -32,7 +32,6 @@ Revision History:
|
|||
#include "sat/sat_scc.h"
|
||||
#include "sat/sat_asymm_branch.h"
|
||||
#include "sat/sat_aig_simplifier.h"
|
||||
#include "sat/sat_iff3_finder.h"
|
||||
#include "sat/sat_probing.h"
|
||||
#include "sat/sat_mus.h"
|
||||
#include "sat/sat_binspr.h"
|
||||
|
@ -202,7 +201,6 @@ namespace sat {
|
|||
friend class drat;
|
||||
friend class elim_eqs;
|
||||
friend class bcd;
|
||||
friend class iff3_finder;
|
||||
friend class mus;
|
||||
friend class probing;
|
||||
friend class simplifier;
|
||||
|
|
|
@ -27,6 +27,8 @@ Revision History:
|
|||
#include "smt/mam.h"
|
||||
#include "smt/smt_context.h"
|
||||
|
||||
using namespace smt;
|
||||
|
||||
// #define _PROFILE_MAM
|
||||
|
||||
// -----------------------------------------
|
||||
|
@ -53,7 +55,7 @@ Revision History:
|
|||
|
||||
#define IS_CGR_SUPPORT true
|
||||
|
||||
namespace smt {
|
||||
namespace {
|
||||
// ------------------------------------
|
||||
//
|
||||
// Trail
|
||||
|
@ -1985,11 +1987,13 @@ namespace smt {
|
|||
|
||||
enode * init_continue(cont const * c, unsigned expected_num_args);
|
||||
|
||||
#ifdef _TRACE
|
||||
void display_reg(std::ostream & out, unsigned reg);
|
||||
|
||||
void display_instr_input_reg(std::ostream & out, instruction const * instr);
|
||||
|
||||
void display_pc_info(std::ostream & out);
|
||||
#endif
|
||||
|
||||
#define INIT_ARGS_SIZE 16
|
||||
|
||||
|
@ -2222,6 +2226,7 @@ namespace smt {
|
|||
return *(bp.m_it);
|
||||
}
|
||||
|
||||
#ifdef _TRACE
|
||||
void interpreter::display_reg(std::ostream & out, unsigned reg) {
|
||||
out << "reg[" << reg << "]: ";
|
||||
enode * n = m_registers[reg];
|
||||
|
@ -2273,6 +2278,7 @@ namespace smt {
|
|||
out << "\n";
|
||||
display_instr_input_reg(out, m_pc);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool interpreter::execute_core(code_tree * t, enode * n) {
|
||||
TRACE("trigger_bug", tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_owner(), m) << "\n";);
|
||||
|
@ -2839,6 +2845,7 @@ namespace smt {
|
|||
return false;
|
||||
} // end of execute_core
|
||||
|
||||
#if 0
|
||||
void display_trees(std::ostream & out, const ptr_vector<code_tree> & trees) {
|
||||
unsigned lbl = 0;
|
||||
for (code_tree * tree : trees) {
|
||||
|
@ -2849,6 +2856,7 @@ namespace smt {
|
|||
++lbl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------
|
||||
//
|
||||
|
@ -4010,11 +4018,13 @@ namespace smt {
|
|||
SASSERT(approx_subset(r1->get_lbls(), r2->get_lbls()));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace smt {
|
||||
mam * mk_mam(context & ctx) {
|
||||
return alloc(mam_impl, ctx, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
void pp(smt::code_tree * c) {
|
||||
|
|
|
@ -25,7 +25,9 @@ Revision History:
|
|||
#include "util/map.h"
|
||||
#include "util/hashtable.h"
|
||||
|
||||
namespace smt {
|
||||
using namespace smt;
|
||||
|
||||
namespace {
|
||||
|
||||
typedef map<bool_var, double, int_hash, default_eq<bool_var> > theory_var_priority_map;
|
||||
|
||||
|
@ -1250,8 +1252,9 @@ namespace smt {
|
|||
|
||||
~theory_aware_branching_queue() override {};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace smt {
|
||||
case_split_queue * mk_case_split_queue(context & ctx, smt_params & p) {
|
||||
if (ctx.relevancy_lvl() < 2 && (p.m_case_split_strategy == CS_RELEVANCY || p.m_case_split_strategy == CS_RELEVANCY_ACTIVITY ||
|
||||
p.m_case_split_strategy == CS_RELEVANCY_GOAL)) {
|
||||
|
@ -1281,5 +1284,4 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ Revision History:
|
|||
#include "model/model.h"
|
||||
#include "solver/solver.h"
|
||||
|
||||
namespace smt {
|
||||
namespace {
|
||||
|
||||
class get_implied_equalities_impl {
|
||||
|
||||
|
@ -177,7 +177,7 @@ namespace smt {
|
|||
|
||||
uint_set non_values;
|
||||
|
||||
if (!is_value_sort(m, srt)) {
|
||||
if (!smt::is_value_sort(m, srt)) {
|
||||
for (unsigned i = 0; i < terms.size(); ++i) {
|
||||
non_values.insert(i);
|
||||
}
|
||||
|
@ -370,12 +370,14 @@ namespace smt {
|
|||
|
||||
stopwatch get_implied_equalities_impl::s_timer;
|
||||
stopwatch get_implied_equalities_impl::s_stats_val_eq_timer;
|
||||
}
|
||||
|
||||
namespace smt {
|
||||
lbool implied_equalities(ast_manager& m, solver& solver, unsigned num_terms, expr* const* terms, unsigned* class_ids) {
|
||||
get_implied_equalities_impl gi(m, solver);
|
||||
return gi(num_terms, terms, class_ids);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ Notes:
|
|||
#include "ast/func_decl_dependencies.h"
|
||||
#include "util/dec_ref_util.h"
|
||||
|
||||
namespace smt {
|
||||
namespace {
|
||||
|
||||
class smt_solver : public solver_na2as {
|
||||
|
||||
|
@ -445,18 +445,20 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
solver * mk_smt_solver(ast_manager & m, params_ref const & p, symbol const & logic) {
|
||||
return alloc(smt::smt_solver, m, p, logic);
|
||||
}
|
||||
|
||||
solver * mk_smt_solver(ast_manager & m, params_ref const & p, symbol const & logic) {
|
||||
return alloc(smt_solver, m, p, logic);
|
||||
}
|
||||
|
||||
namespace {
|
||||
class smt_solver_factory : public solver_factory {
|
||||
public:
|
||||
solver * operator()(ast_manager & m, params_ref const & p, bool proofs_enabled, bool models_enabled, bool unsat_core_enabled, symbol const & logic) override {
|
||||
return mk_smt_solver(m, p, logic);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
solver_factory * mk_smt_solver_factory() {
|
||||
return alloc(smt_solver_factory);
|
||||
|
|
|
@ -25,7 +25,7 @@ bool uses_theory(expr * n, family_id fid) {
|
|||
return uses_theory(n, fid, visited);
|
||||
}
|
||||
|
||||
namespace uses_theory_ns {
|
||||
namespace {
|
||||
struct found {};
|
||||
struct proc {
|
||||
family_id m_fid;
|
||||
|
@ -34,16 +34,15 @@ namespace uses_theory_ns {
|
|||
void operator()(app * n) { if (n->get_family_id() == m_fid) throw found(); }
|
||||
void operator()(quantifier * n) {}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
bool uses_theory(expr * n, family_id fid, expr_mark & visited) {
|
||||
uses_theory_ns::proc p(fid);
|
||||
proc p(fid);
|
||||
try {
|
||||
for_each_expr(p, visited, n);
|
||||
}
|
||||
catch (const uses_theory_ns::found &) {
|
||||
catch (const found &) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ Revision History:
|
|||
#include "ast/arith_decl_plugin.h"
|
||||
#include "tactic/goal_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class arith_degree_probe : public probe {
|
||||
struct proc {
|
||||
ast_manager & m;
|
||||
|
@ -163,6 +165,8 @@ struct has_nlmul {
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
probe * mk_arith_avg_degree_probe() {
|
||||
return alloc(arith_degree_probe, true);
|
||||
}
|
||||
|
@ -179,6 +183,7 @@ probe * mk_arith_max_bw_probe() {
|
|||
return alloc(arith_bw_probe, false);
|
||||
}
|
||||
|
||||
namespace {
|
||||
struct is_non_qflira_functor {
|
||||
struct found {};
|
||||
ast_manager & m;
|
||||
|
@ -392,6 +397,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
probe * mk_is_qflia_probe() {
|
||||
return alloc(is_qflia_probe);
|
||||
}
|
||||
|
@ -417,6 +424,8 @@ probe * mk_is_mip_probe() {
|
|||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct is_non_nira_functor {
|
||||
struct found {};
|
||||
ast_manager & m;
|
||||
|
@ -697,6 +706,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
probe * mk_is_qfnia_probe() {
|
||||
return alloc(is_qfnia_probe);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue