mirror of
https://github.com/Z3Prover/z3
synced 2025-06-13 17:36:15 +00:00
Tabs, formatting.
This commit is contained in:
parent
8871cb120a
commit
00651f8f21
63 changed files with 715 additions and 717 deletions
|
@ -15,16 +15,16 @@ Copyright (c) 2015 Microsoft Corporation
|
|||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -3332,18 +3332,18 @@ void fpa2bv_converter::mk_to_bv(func_decl * f, unsigned num, expr * const * args
|
|||
dbg_decouple("fpa2bv_to_bv_inc", inc);
|
||||
dbg_decouple("fpa2bv_to_bv_pre_rounded", pre_rounded);
|
||||
|
||||
pre_rounded = m.mk_ite(x_is_neg, m_bv_util.mk_bv_neg(pre_rounded), pre_rounded);
|
||||
pre_rounded = m.mk_ite(x_is_neg, m_bv_util.mk_bv_neg(pre_rounded), pre_rounded);
|
||||
|
||||
expr_ref ll(m), ul(m), in_range(m);
|
||||
expr_ref ll(m), ul(m), in_range(m);
|
||||
if (!is_signed) {
|
||||
ll = m_bv_util.mk_numeral(0, bv_sz+3);
|
||||
ll = m_bv_util.mk_numeral(0, bv_sz+3);
|
||||
ul = m_bv_util.mk_zero_extend(3, m_bv_util.mk_numeral(-1, bv_sz));
|
||||
}
|
||||
else {
|
||||
ll = m_bv_util.mk_sign_extend(3, m_bv_util.mk_concat(bv1, m_bv_util.mk_numeral(0, bv_sz-1)));
|
||||
ul = m_bv_util.mk_zero_extend(4, m_bv_util.mk_numeral(-1, bv_sz-1));
|
||||
}
|
||||
in_range = m.mk_and(m_bv_util.mk_sle(ll, pre_rounded), m_bv_util.mk_sle(pre_rounded, ul));
|
||||
in_range = m.mk_and(m_bv_util.mk_sle(ll, pre_rounded), m_bv_util.mk_sle(pre_rounded, ul));
|
||||
dbg_decouple("fpa2bv_to_bv_in_range", in_range);
|
||||
|
||||
expr_ref rounded(m);
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
bv_bounds(ast_manager& m) : m_m(m), m_bv_util(m), m_okay(true) {};
|
||||
~bv_bounds();
|
||||
public: // bounds addition methods
|
||||
br_status rewrite(unsigned limit, func_decl * f, unsigned num, expr * const * args, expr_ref& result);
|
||||
br_status rewrite(unsigned limit, func_decl * f, unsigned num, expr * const * args, expr_ref& result);
|
||||
|
||||
/** \brief Add a constraint to the system.
|
||||
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
bv_util m_bv_util;
|
||||
bool m_okay;
|
||||
bool is_sat(app * v);
|
||||
bool is_sat_core(app * v);
|
||||
bool is_sat_core(app * v);
|
||||
inline bool in_range(app *v, numeral l);
|
||||
inline bool is_constant_add(unsigned bv_sz, expr * e, app*& v, numeral& val);
|
||||
void record_singleton(app * v, numeral& singleton_value);
|
||||
|
@ -94,7 +94,7 @@ protected:
|
|||
inline bool bv_bounds::is_okay() { return m_okay; }
|
||||
|
||||
inline bool bv_bounds::to_bound(const expr * e) const {
|
||||
return is_app(e) && m_bv_util.is_bv(e)
|
||||
return is_app(e) && m_bv_util.is_bv(e)
|
||||
&& !m_bv_util.is_bv_add(e)
|
||||
&& !m_bv_util.is_numeral(e);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "duality/duality_wrapper.h"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
|
@ -831,8 +832,8 @@ namespace Duality {
|
|||
symbol name;
|
||||
expr value;
|
||||
bool pos;
|
||||
label_struct(const symbol &s, const expr &e, bool b)
|
||||
: name(s), value(e), pos(b) {}
|
||||
label_struct(const symbol &s, const expr &e, bool b)
|
||||
: name(s), value(e), pos(b) {}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -281,17 +281,17 @@ namespace Duality {
|
|||
object(object const & s):m_ctx(s.m_ctx) {}
|
||||
context & ctx() const { return *m_ctx; }
|
||||
friend void check_context(object const & a, object const & b) { assert(a.m_ctx == b.m_ctx); }
|
||||
ast_manager &m() const {return m_ctx->m();}
|
||||
ast_manager &m() const {return m_ctx->m();}
|
||||
};
|
||||
|
||||
class symbol : public object {
|
||||
::symbol m_sym;
|
||||
public:
|
||||
symbol(context & c, ::symbol s):object(c), m_sym(s) {}
|
||||
symbol(symbol const & s):object(s), m_sym(s.m_sym) {}
|
||||
symbol(context & c, ::symbol s):object(c), m_sym(s) {}
|
||||
symbol(symbol const & s):object(s), m_sym(s.m_sym) {}
|
||||
symbol & operator=(symbol const & s) { m_ctx = s.m_ctx; m_sym = s.m_sym; return *this; }
|
||||
operator ::symbol() const {return m_sym;}
|
||||
std::string str() const {
|
||||
operator ::symbol() const {return m_sym;}
|
||||
std::string str() const {
|
||||
if (m_sym.is_numerical()) {
|
||||
std::ostringstream buffer;
|
||||
buffer << m_sym.get_num();
|
||||
|
@ -300,13 +300,13 @@ namespace Duality {
|
|||
else {
|
||||
return m_sym.bare_str();
|
||||
}
|
||||
}
|
||||
friend std::ostream & operator<<(std::ostream & out, symbol const & s){
|
||||
}
|
||||
friend std::ostream & operator<<(std::ostream & out, symbol const & s) {
|
||||
return out << s.str();
|
||||
}
|
||||
friend bool operator==(const symbol &x, const symbol &y){
|
||||
}
|
||||
friend bool operator==(const symbol &x, const symbol &y) {
|
||||
return x.m_sym == y.m_sym;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class params : public config {};
|
||||
|
@ -434,9 +434,9 @@ namespace Duality {
|
|||
expr operator()(expr const & a1, expr const & a2, expr const & a3, expr const & a4) const;
|
||||
expr operator()(expr const & a1, expr const & a2, expr const & a3, expr const & a4, expr const & a5) const;
|
||||
|
||||
func_decl get_func_decl_parameter(unsigned idx){
|
||||
func_decl get_func_decl_parameter(unsigned idx){
|
||||
return func_decl(ctx(),to_func_decl(to_func_decl(raw())->get_parameters()[idx].get_ast()));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -447,8 +447,8 @@ namespace Duality {
|
|||
expr(context & c, ::ast *n):ast(c, n) {}
|
||||
expr(expr const & n):ast(n) {}
|
||||
expr & operator=(expr const & n) { return static_cast<expr&>(ast::operator=(n)); }
|
||||
operator ::expr*() const { return to_expr(raw()); }
|
||||
unsigned get_id() const {return to_expr(raw())->get_id();}
|
||||
operator ::expr*() const { return to_expr(raw()); }
|
||||
unsigned get_id() const {return to_expr(raw())->get_id();}
|
||||
|
||||
sort get_sort() const { return sort(ctx(),m().get_sort(to_expr(raw()))); }
|
||||
|
||||
|
@ -460,27 +460,27 @@ namespace Duality {
|
|||
bool is_datatype() const { return get_sort().is_datatype(); }
|
||||
bool is_relation() const { return get_sort().is_relation(); }
|
||||
bool is_finite_domain() const { return get_sort().is_finite_domain(); }
|
||||
bool is_true() const {return is_app() && decl().get_decl_kind() == True; }
|
||||
bool is_true() const {return is_app() && decl().get_decl_kind() == True; }
|
||||
|
||||
bool is_numeral() const {
|
||||
return is_app() && decl().get_decl_kind() == OtherArith && m().is_unique_value(to_expr(raw()));
|
||||
}
|
||||
bool is_app() const {return raw()->get_kind() == AST_APP;}
|
||||
}
|
||||
bool is_app() const {return raw()->get_kind() == AST_APP;}
|
||||
bool is_quantifier() const {return raw()->get_kind() == AST_QUANTIFIER;}
|
||||
bool is_var() const {return raw()->get_kind() == AST_VAR;}
|
||||
bool is_label (bool &pos,std::vector<symbol> &names) const ;
|
||||
bool is_ground() const {return to_app(raw())->is_ground();}
|
||||
bool has_quantifiers() const {return to_app(raw())->has_quantifiers();}
|
||||
bool has_free(int idx) const {
|
||||
bool is_label (bool &pos,std::vector<symbol> &names) const ;
|
||||
bool is_ground() const {return to_app(raw())->is_ground();}
|
||||
bool has_quantifiers() const {return to_app(raw())->has_quantifiers();}
|
||||
bool has_free(int idx) const {
|
||||
used_vars proc;
|
||||
proc.process(to_expr(raw()));
|
||||
return proc.contains(idx);
|
||||
}
|
||||
unsigned get_max_var_idx_plus_1() const {
|
||||
}
|
||||
unsigned get_max_var_idx_plus_1() const {
|
||||
used_vars proc;
|
||||
proc.process(to_expr(raw()));
|
||||
return proc.get_max_found_var_idx_plus_1();
|
||||
}
|
||||
}
|
||||
|
||||
// operator Z3_app() const { assert(is_app()); return reinterpret_cast<Z3_app>(m_ast); }
|
||||
func_decl decl() const {return func_decl(ctx(),to_app(raw())->get_decl());}
|
||||
|
@ -497,7 +497,7 @@ namespace Duality {
|
|||
}
|
||||
SASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
expr arg(unsigned i) const {
|
||||
ast_kind dk = raw()->get_kind();
|
||||
switch(dk){
|
||||
|
@ -509,20 +509,20 @@ namespace Duality {
|
|||
}
|
||||
assert(0);
|
||||
return expr();
|
||||
}
|
||||
}
|
||||
|
||||
expr body() const {
|
||||
return ctx().cook(to_quantifier(raw())->get_expr());
|
||||
}
|
||||
}
|
||||
|
||||
friend expr operator!(expr const & a) {
|
||||
// ::expr *e = a;
|
||||
return expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_NOT,a));
|
||||
}
|
||||
}
|
||||
|
||||
friend expr operator&&(expr const & a, expr const & b) {
|
||||
return expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_AND,a,b));
|
||||
}
|
||||
}
|
||||
|
||||
friend expr operator||(expr const & a, expr const & b) {
|
||||
return expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_OR,a,b));
|
||||
|
@ -546,7 +546,7 @@ namespace Duality {
|
|||
|
||||
friend expr operator*(expr const & a, expr const & b) {
|
||||
return a.ctx().make(Times,a,b); // expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_MUL,a,b));
|
||||
}
|
||||
}
|
||||
|
||||
friend expr operator/(expr const & a, expr const & b) {
|
||||
return a.ctx().make(Div,a,b); // expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_DIV,a,b));
|
||||
|
@ -562,7 +562,7 @@ namespace Duality {
|
|||
|
||||
friend expr operator<=(expr const & a, expr const & b) {
|
||||
return a.ctx().make(Leq,a,b); // expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_LE,a,b));
|
||||
}
|
||||
}
|
||||
|
||||
friend expr operator>=(expr const & a, expr const & b) {
|
||||
return a.ctx().make(Geq,a,b); //expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_GE,a,b));
|
||||
|
@ -574,7 +574,7 @@ namespace Duality {
|
|||
|
||||
friend expr operator>(expr const & a, expr const & b) {
|
||||
return a.ctx().make(Gt,a,b); expr(a.ctx(),a.m().mk_app(a.m().get_basic_family_id(),OP_GT,a,b));
|
||||
}
|
||||
}
|
||||
|
||||
expr simplify() const;
|
||||
|
||||
|
@ -582,45 +582,45 @@ namespace Duality {
|
|||
|
||||
expr qe_lite() const;
|
||||
|
||||
expr qe_lite(const std::set<int> &idxs, bool index_of_bound) const;
|
||||
expr qe_lite(const std::set<int> &idxs, bool index_of_bound) const;
|
||||
|
||||
friend expr clone_quantifier(const expr &, const expr &);
|
||||
friend expr clone_quantifier(const expr &, const expr &);
|
||||
|
||||
friend expr clone_quantifier(const expr &q, const expr &b, const std::vector<expr> &patterns);
|
||||
|
||||
friend expr clone_quantifier(decl_kind, const expr &, const expr &);
|
||||
friend expr clone_quantifier(decl_kind, const expr &, const expr &);
|
||||
|
||||
friend std::ostream & operator<<(std::ostream & out, expr const & m){
|
||||
m.ctx().print_expr(out,m);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
void get_patterns(std::vector<expr> &pats) const ;
|
||||
void get_patterns(std::vector<expr> &pats) const ;
|
||||
|
||||
unsigned get_quantifier_num_bound() const {
|
||||
unsigned get_quantifier_num_bound() const {
|
||||
return to_quantifier(raw())->get_num_decls();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned get_index_value() const {
|
||||
unsigned get_index_value() const {
|
||||
var* va = to_var(raw());
|
||||
return va->get_idx();
|
||||
}
|
||||
}
|
||||
|
||||
bool is_quantifier_forall() const {
|
||||
return to_quantifier(raw())->is_forall();
|
||||
}
|
||||
}
|
||||
|
||||
sort get_quantifier_bound_sort(unsigned n) const {
|
||||
sort get_quantifier_bound_sort(unsigned n) const {
|
||||
return sort(ctx(),to_quantifier(raw())->get_decl_sort(n));
|
||||
}
|
||||
}
|
||||
|
||||
symbol get_quantifier_bound_name(unsigned n) const {
|
||||
symbol get_quantifier_bound_name(unsigned n) const {
|
||||
return symbol(ctx(),to_quantifier(raw())->get_decl_names()[n]);
|
||||
}
|
||||
}
|
||||
|
||||
friend expr forall(const std::vector<expr> &quants, const expr &body);
|
||||
friend expr forall(const std::vector<expr> &quants, const expr &body);
|
||||
|
||||
friend expr exists(const std::vector<expr> &quants, const expr &body);
|
||||
friend expr exists(const std::vector<expr> &quants, const expr &body);
|
||||
|
||||
};
|
||||
|
||||
|
@ -729,9 +729,9 @@ namespace Duality {
|
|||
m_model = m;
|
||||
}
|
||||
public:
|
||||
model(context & c, ::model * m = 0):object(c), m_model(m) { }
|
||||
model(model const & s):object(s), m_model(s.m_model) { }
|
||||
~model() { }
|
||||
model(context & c, ::model * m = 0):object(c), m_model(m) { }
|
||||
model(model const & s):object(s), m_model(s.m_model) { }
|
||||
~model() { }
|
||||
operator ::model *() const { return m_model.get(); }
|
||||
model & operator=(model const & s) {
|
||||
// ::model *_inc_ref(s.ctx(), s.m_model);
|
||||
|
@ -741,10 +741,10 @@ namespace Duality {
|
|||
return *this;
|
||||
}
|
||||
model & operator=(::model *s) {
|
||||
m_model = s;
|
||||
m_model = s;
|
||||
return *this;
|
||||
}
|
||||
bool null() const {return !m_model;}
|
||||
bool null() const {return !m_model;}
|
||||
|
||||
expr eval(expr const & n, bool model_completion=true) const {
|
||||
::model * _m = m_model.get();
|
||||
|
@ -754,7 +754,7 @@ namespace Duality {
|
|||
}
|
||||
|
||||
void show() const;
|
||||
void show_hash() const;
|
||||
void show_hash() const;
|
||||
|
||||
unsigned num_consts() const {return m_model.get()->get_num_constants();}
|
||||
unsigned num_funcs() const {return m_model.get()->get_num_functions();}
|
||||
|
@ -765,11 +765,11 @@ namespace Duality {
|
|||
|
||||
expr get_const_interp(func_decl f) const {
|
||||
return ctx().cook(m_model->get_const_interp(to_func_decl(f.raw())));
|
||||
}
|
||||
}
|
||||
|
||||
func_interp get_func_interp(func_decl f) const {
|
||||
return func_interp(ctx(),m_model->get_func_interp(to_func_decl(f.raw())));
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
friend std::ostream & operator<<(std::ostream & out, model const & m) { out << Z3_model_to_string(m.ctx(), m); return out; }
|
||||
|
@ -837,30 +837,30 @@ namespace Duality {
|
|||
protected:
|
||||
::solver *m_solver;
|
||||
model the_model;
|
||||
bool canceled;
|
||||
proof_gen_mode m_mode;
|
||||
bool extensional;
|
||||
bool canceled;
|
||||
proof_gen_mode m_mode;
|
||||
bool extensional;
|
||||
public:
|
||||
solver(context & c, bool extensional = false, bool models = true);
|
||||
solver(context & c, ::solver *s):object(c),the_model(c) { m_solver = s; canceled = false;}
|
||||
solver(solver const & s):object(s), the_model(s.the_model) { m_solver = s.m_solver; canceled = false;}
|
||||
solver(context & c, ::solver *s):object(c),the_model(c) { m_solver = s; canceled = false;}
|
||||
solver(solver const & s):object(s), the_model(s.the_model) { m_solver = s.m_solver; canceled = false;}
|
||||
~solver() {
|
||||
if(m_solver)
|
||||
dealloc(m_solver);
|
||||
}
|
||||
operator ::solver*() const { return m_solver; }
|
||||
}
|
||||
operator ::solver*() const { return m_solver; }
|
||||
solver & operator=(solver const & s) {
|
||||
m_ctx = s.m_ctx;
|
||||
m_solver = s.m_solver;
|
||||
the_model = s.the_model;
|
||||
m_mode = s.m_mode;
|
||||
the_model = s.the_model;
|
||||
m_mode = s.m_mode;
|
||||
return *this;
|
||||
}
|
||||
struct cancel_exception {};
|
||||
void checkpoint(){
|
||||
struct cancel_exception {};
|
||||
void checkpoint(){
|
||||
if(canceled)
|
||||
throw(cancel_exception());
|
||||
}
|
||||
}
|
||||
// void set(params const & p) { Z3_solver_set_params(ctx(), m_solver, p); check_error(); }
|
||||
void push() { scoped_proof_mode spm(m(),m_mode); m_solver->push(); }
|
||||
void pop(unsigned n = 1) { scoped_proof_mode spm(m(),m_mode); m_solver->pop(n); }
|
||||
|
@ -874,7 +874,7 @@ namespace Duality {
|
|||
m_solver->get_model(m);
|
||||
the_model = m.get();
|
||||
return to_check_result(r);
|
||||
}
|
||||
}
|
||||
check_result check_keep_model(unsigned n, expr * const assumptions, unsigned *core_size = 0, expr *core = 0) {
|
||||
scoped_proof_mode spm(m(),m_mode);
|
||||
model old_model(the_model);
|
||||
|
@ -882,7 +882,7 @@ namespace Duality {
|
|||
if(the_model == 0)
|
||||
the_model = old_model;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
check_result check(unsigned n, expr * const assumptions, unsigned *core_size = 0, expr *core = 0) {
|
||||
scoped_proof_mode spm(m(),m_mode);
|
||||
checkpoint();
|
||||
|
@ -930,27 +930,26 @@ namespace Duality {
|
|||
#endif
|
||||
// expr proof() const { Z3_ast r = Z3_solver_proof(ctx(), m_solver); check_error(); return expr(ctx(), r); }
|
||||
// friend std::ostream & operator<<(std::ostream & out, solver const & s) { out << Z3_solver_to_string(s.ctx(), s); return out; }
|
||||
int get_num_decisions();
|
||||
|
||||
int get_num_decisions();
|
||||
|
||||
void cancel(){
|
||||
void cancel(){
|
||||
scoped_proof_mode spm(m(),m_mode);
|
||||
canceled = true;
|
||||
m().limit().cancel();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned get_scope_level(){ scoped_proof_mode spm(m(),m_mode); return m_solver->get_scope_level();}
|
||||
unsigned get_scope_level(){ scoped_proof_mode spm(m(),m_mode); return m_solver->get_scope_level();}
|
||||
|
||||
void show();
|
||||
void print(const char *filename);
|
||||
void show_assertion_ids();
|
||||
void show();
|
||||
void print(const char *filename);
|
||||
void show_assertion_ids();
|
||||
|
||||
proof get_proof(){
|
||||
proof get_proof(){
|
||||
scoped_proof_mode spm(m(),m_mode);
|
||||
return proof(ctx(),m_solver->get_proof());
|
||||
}
|
||||
}
|
||||
|
||||
bool extensional_array_theory() {return extensional;}
|
||||
bool extensional_array_theory() {return extensional;}
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
@ -1196,7 +1195,7 @@ namespace Duality {
|
|||
|
||||
inline func_decl context::function(char const * name, sort const & d1, sort const & d2, sort const & range) {
|
||||
sort args[2] = { d1, d2 };
|
||||
return function(name, 2, args, range);
|
||||
return function(name, 2, args, range);
|
||||
}
|
||||
|
||||
inline func_decl context::function(char const * name, sort const & d1, sort const & d2, sort const & d3, sort const & range) {
|
||||
|
|
|
@ -66,35 +66,35 @@ class iz3base : public iz3mgr, public scopes {
|
|||
|
||||
/** Constructor */
|
||||
|
||||
iz3base(ast_manager &_m_manager,
|
||||
const std::vector<ast> &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
: iz3mgr(_m_manager), scopes(_parents) {
|
||||
iz3base(ast_manager &_m_manager,
|
||||
const std::vector<ast> &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
: iz3mgr(_m_manager), scopes(_parents) {
|
||||
initialize(_cnsts,_parents,_theory);
|
||||
weak = false;
|
||||
}
|
||||
|
||||
iz3base(const iz3mgr& other,
|
||||
const std::vector<ast> &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
: iz3mgr(other), scopes(_parents) {
|
||||
iz3base(const iz3mgr& other,
|
||||
const std::vector<ast> &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
: iz3mgr(other), scopes(_parents) {
|
||||
initialize(_cnsts,_parents,_theory);
|
||||
weak = false;
|
||||
}
|
||||
|
||||
iz3base(const iz3mgr& other,
|
||||
const std::vector<std::vector<ast> > &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
: iz3mgr(other), scopes(_parents) {
|
||||
iz3base(const iz3mgr& other,
|
||||
const std::vector<std::vector<ast> > &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
: iz3mgr(other), scopes(_parents) {
|
||||
initialize(_cnsts,_parents,_theory);
|
||||
weak = false;
|
||||
}
|
||||
|
||||
iz3base(const iz3mgr& other)
|
||||
: iz3mgr(other), scopes() {
|
||||
iz3base(const iz3mgr& other)
|
||||
: iz3mgr(other), scopes() {
|
||||
weak = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,26 +24,26 @@
|
|||
#include "solver/solver.h"
|
||||
|
||||
bool iz3check(ast_manager &_m_manager,
|
||||
solver *s,
|
||||
std::ostream &err,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
const ::vector<int> &parents,
|
||||
const ptr_vector<ast> &interps,
|
||||
const ptr_vector<ast> &theory);
|
||||
solver *s,
|
||||
std::ostream &err,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
const ::vector<int> &parents,
|
||||
const ptr_vector<ast> &interps,
|
||||
const ptr_vector<ast> &theory);
|
||||
|
||||
bool iz3check(ast_manager &_m_manager,
|
||||
solver *s,
|
||||
std::ostream &err,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
ast *tree,
|
||||
const ptr_vector<ast> &interps);
|
||||
solver *s,
|
||||
std::ostream &err,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
ast *tree,
|
||||
const ptr_vector<ast> &interps);
|
||||
|
||||
bool iz3check(iz3mgr &mgr,
|
||||
solver *s,
|
||||
std::ostream &err,
|
||||
const std::vector<iz3mgr::ast> &cnsts,
|
||||
const std::vector<int> &parents,
|
||||
const std::vector<iz3mgr::ast> &interps,
|
||||
const ptr_vector<iz3mgr::ast> &theory);
|
||||
solver *s,
|
||||
std::ostream &err,
|
||||
const std::vector<iz3mgr::ast> &cnsts,
|
||||
const std::vector<int> &parents,
|
||||
const std::vector<iz3mgr::ast> &interps,
|
||||
const ptr_vector<iz3mgr::ast> &theory);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -468,10 +468,10 @@ namespace hash_space {
|
|||
: hashtable<std::pair<Key,Value>,Key,HashFun,proj1<Key,Value>,EqFun>(7) {}
|
||||
|
||||
Value &operator[](const Key& key) {
|
||||
std::pair<Key,Value> kvp(key,Value());
|
||||
return
|
||||
hashtable<std::pair<Key,Value>,Key,HashFun,proj1<Key,Value>,EqFun>::
|
||||
lookup(kvp,true)->val.second;
|
||||
std::pair<Key,Value> kvp(key,Value());
|
||||
return
|
||||
hashtable<std::pair<Key,Value>,Key,HashFun,proj1<Key,Value>,EqFun>::
|
||||
lookup(kvp,true)->val.second;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -73,22 +73,22 @@ typedef interpolation_options_struct *interpolation_options;
|
|||
representation, for compatibility with the old API. */
|
||||
|
||||
void iz3interpolate(ast_manager &_m_manager,
|
||||
ast *proof,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
const ::vector<int> &parents,
|
||||
ptr_vector<ast> &interps,
|
||||
const ptr_vector<ast> &theory,
|
||||
interpolation_options_struct * options = 0);
|
||||
ast *proof,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
const ::vector<int> &parents,
|
||||
ptr_vector<ast> &interps,
|
||||
const ptr_vector<ast> &theory,
|
||||
interpolation_options_struct * options = 0);
|
||||
|
||||
/* Same as above, but each constraint is a vector of formulas. */
|
||||
|
||||
void iz3interpolate(ast_manager &_m_manager,
|
||||
ast *proof,
|
||||
const vector<ptr_vector<ast> > &cnsts,
|
||||
const ::vector<int> &parents,
|
||||
ptr_vector<ast> &interps,
|
||||
const ptr_vector<ast> &theory,
|
||||
interpolation_options_struct * options = 0);
|
||||
ast *proof,
|
||||
const vector<ptr_vector<ast> > &cnsts,
|
||||
const ::vector<int> &parents,
|
||||
ptr_vector<ast> &interps,
|
||||
const ptr_vector<ast> &theory,
|
||||
interpolation_options_struct * options = 0);
|
||||
|
||||
/* Compute an interpolant from a proof. This version uses the ast
|
||||
representation, for compatibility with the new API. Here, cnsts is
|
||||
|
@ -98,11 +98,11 @@ void iz3interpolate(ast_manager &_m_manager,
|
|||
proof, so it can be considered a hint. */
|
||||
|
||||
void iz3interpolate(ast_manager &_m_manager,
|
||||
ast *proof,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
ast *tree,
|
||||
ptr_vector<ast> &interps,
|
||||
interpolation_options_struct * options);
|
||||
ast *proof,
|
||||
const ptr_vector<ast> &cnsts,
|
||||
ast *tree,
|
||||
ptr_vector<ast> &interps,
|
||||
interpolation_options_struct * options);
|
||||
|
||||
|
||||
/* Compute an interpolant from an ast representing an interpolation
|
||||
|
@ -112,12 +112,12 @@ void iz3interpolate(ast_manager &_m_manager,
|
|||
*/
|
||||
|
||||
lbool iz3interpolate(ast_manager &_m_manager,
|
||||
solver &s,
|
||||
ast *tree,
|
||||
ptr_vector<ast> &cnsts,
|
||||
ptr_vector<ast> &interps,
|
||||
model_ref &m,
|
||||
interpolation_options_struct * options);
|
||||
solver &s,
|
||||
ast *tree,
|
||||
ptr_vector<ast> &cnsts,
|
||||
ptr_vector<ast> &interps,
|
||||
model_ref &m,
|
||||
interpolation_options_struct * options);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ struct iz3pp_bad_tree: public iz3_exception {
|
|||
};
|
||||
|
||||
void iz3pp(ast_manager &m,
|
||||
const ptr_vector<expr> &cnsts_vec,
|
||||
expr *tree,
|
||||
std::ostream& out);
|
||||
const ptr_vector<expr> &cnsts_vec,
|
||||
expr *tree,
|
||||
std::ostream& out);
|
||||
#endif
|
||||
|
|
|
@ -105,7 +105,7 @@ class scopes {
|
|||
|
||||
void range_add(int i, range &n){
|
||||
#if 0
|
||||
if(i < n.lo) n.lo = i;
|
||||
if(i < n.lo) n.lo = i;
|
||||
if(i > n.hi) n.hi = i;
|
||||
#else
|
||||
range rng; rng.lo = i; rng.hi = i;
|
||||
|
@ -119,7 +119,7 @@ class scopes {
|
|||
int thing = tree_lca(rng1.lo,rng2.hi);
|
||||
if(thing == rng1.lo) frame = rng1.lo;
|
||||
else frame = tree_gcd(thing,rng1.hi);
|
||||
return frame;
|
||||
return frame;
|
||||
}
|
||||
#else
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ class iz3translation : public iz3base {
|
|||
|
||||
protected:
|
||||
iz3translation(iz3mgr &mgr,
|
||||
const std::vector<std::vector<ast> > &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
const std::vector<std::vector<ast> > &_cnsts,
|
||||
const std::vector<int> &_parents,
|
||||
const std::vector<ast> &_theory)
|
||||
: iz3base(mgr,_cnsts,_parents,_theory) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@ class boolean_algebra : public positive_boolean_algebra<T> {
|
|||
public:
|
||||
virtual ~boolean_algebra() {}
|
||||
virtual T mk_not(T x) = 0;
|
||||
//virtual lbool are_equivalent(T x, T y) = 0;
|
||||
//virtual T simplify(T x) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -63,8 +63,8 @@ namespace polynomial {
|
|||
public:
|
||||
void set_degree(var x, unsigned d) { m_var2degree.setx(x, d, 0); }
|
||||
unsigned degree(var x) const { return m_var2degree.get(x, 0); }
|
||||
void display(std::ostream & out) const;
|
||||
friend std::ostream & operator<<(std::ostream & out, var2degree const & ideal) { ideal.display(out); return out; }
|
||||
void display(std::ostream & out) const;
|
||||
friend std::ostream & operator<<(std::ostream & out, var2degree const & ideal) { ideal.display(out); return out; }
|
||||
};
|
||||
|
||||
template<typename ValManager, typename Value = typename ValManager::numeral>
|
||||
|
|
|
@ -434,11 +434,11 @@ namespace upolynomial {
|
|||
m().reset(r[i]);
|
||||
}
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
typename polynomial::monomial * mon = pm.get_monomial(p, i);
|
||||
if (pm.size(mon) == 0) {
|
||||
typename polynomial::monomial * mon = pm.get_monomial(p, i);
|
||||
if (pm.size(mon) == 0) {
|
||||
m().set(r[0], pm.coeff(p, i));
|
||||
} else if (pm.size(mon) == 1 && pm.get_var(mon, 0) == x) {
|
||||
unsigned m_deg_x = pm.degree(mon, 0);
|
||||
} else if (pm.size(mon) == 1 && pm.get_var(mon, 0) == x) {
|
||||
unsigned m_deg_x = pm.degree(mon, 0);
|
||||
m().set(r[m_deg_x], pm.coeff(p, i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ void model_core::register_decl(func_decl * d, func_interp * fi) {
|
|||
void model_core::unregister_decl(func_decl * d) {
|
||||
decl2expr::obj_map_entry * ec = m_interp.find_core(d);
|
||||
if (ec && ec->get_data().m_value != 0) {
|
||||
m_manager.dec_ref(ec->get_data().m_key);
|
||||
m_manager.dec_ref(ec->get_data().m_value);
|
||||
m_manager.dec_ref(ec->get_data().m_key);
|
||||
m_manager.dec_ref(ec->get_data().m_value);
|
||||
m_interp.remove(d);
|
||||
m_const_decls.erase(d);
|
||||
return;
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace datalog {
|
|||
MEMOUT,
|
||||
INPUT_ERROR,
|
||||
APPROX,
|
||||
BOUNDED,
|
||||
BOUNDED,
|
||||
CANCELED
|
||||
};
|
||||
|
||||
|
@ -318,7 +318,7 @@ namespace datalog {
|
|||
\brief Retrieve predicates
|
||||
*/
|
||||
func_decl_set const& get_predicates() const { return m_preds; }
|
||||
ast_ref_vector const &get_pinned() const {return m_pinned; }
|
||||
ast_ref_vector const &get_pinned() const {return m_pinned; }
|
||||
|
||||
bool is_predicate(func_decl* pred) const { return m_preds.contains(pred); }
|
||||
bool is_predicate(expr * e) const { return is_app(e) && is_predicate(to_app(e)->get_decl()); }
|
||||
|
@ -534,7 +534,7 @@ namespace datalog {
|
|||
\brief retrieve proof from derivation of the query.
|
||||
|
||||
\pre engine == 'pdr' || engine == 'duality'- this option is only supported
|
||||
for PDR mode and Duality mode.
|
||||
for PDR mode and Duality mode.
|
||||
*/
|
||||
proof_ref get_proof();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace datalog {
|
|||
QBMC_ENGINE,
|
||||
TAB_ENGINE,
|
||||
CLP_ENGINE,
|
||||
DUALITY_ENGINE,
|
||||
DUALITY_ENGINE,
|
||||
DDNF_ENGINE,
|
||||
LAST_ENGINE
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Duality {
|
|||
|
||||
class dl_interface : public datalog::engine_base {
|
||||
duality_data *_d;
|
||||
datalog::context &m_ctx;
|
||||
datalog::context &m_ctx;
|
||||
|
||||
public:
|
||||
dl_interface(datalog::context& ctx);
|
||||
|
@ -69,7 +69,7 @@ namespace Duality {
|
|||
|
||||
proof_ref get_proof();
|
||||
|
||||
duality_data *dd(){return _d;}
|
||||
duality_data *dd(){return _d;}
|
||||
|
||||
private:
|
||||
void display_certificate_non_const(std::ostream& out);
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace datalog {
|
|||
*/
|
||||
class mk_similarity_compressor : public rule_transformer::plugin {
|
||||
|
||||
context & m_context;
|
||||
context & m_context;
|
||||
ast_manager & m_manager;
|
||||
/** number of similar rules necessary for a group to be introduced */
|
||||
unsigned m_threshold_count;
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace datalog {
|
|||
We say that a rule containing C_i's is a rule with a "big tail".
|
||||
*/
|
||||
class mk_simple_joins : public rule_transformer::plugin {
|
||||
context & m_context;
|
||||
context & m_context;
|
||||
rule_manager & rm;
|
||||
public:
|
||||
mk_simple_joins(context & ctx);
|
||||
|
|
|
@ -1209,7 +1209,7 @@ namespace qe {
|
|||
|
||||
void operator()(model& mdl, app_ref_vector& vars, expr_ref& fml) {
|
||||
expr_map map (m);
|
||||
operator()(mdl, vars, fml, map);
|
||||
operator()(mdl, vars, fml, map);
|
||||
}
|
||||
|
||||
void operator()(model& mdl, app_ref_vector& vars, expr_ref& fml, expr_map& map) {
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace datalog {
|
|||
typedef obj_map<func_decl, adornment> pred_adornment_map;
|
||||
typedef obj_map<func_decl, func_decl *> pred2pred;
|
||||
|
||||
context & m_context;
|
||||
context & m_context;
|
||||
ast_manager & m;
|
||||
rule_manager& rm;
|
||||
ast_ref_vector m_pinned;
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace datalog {
|
|||
typedef hashtable<c_info, c_info_hash, default_eq<c_info> > in_progress_table;
|
||||
typedef svector<c_info> todo_stack;
|
||||
|
||||
context & m_context;
|
||||
context & m_context;
|
||||
ast_manager & m;
|
||||
rule_manager & rm;
|
||||
rule_ref_vector m_rules;
|
||||
|
|
|
@ -956,8 +956,8 @@ public:
|
|||
}
|
||||
|
||||
void get_neighbours_undirected(dl_var current, svector<dl_var> & neighbours) {
|
||||
neighbours.reset();
|
||||
edge_id_vector & out_edges = m_out_edges[current];
|
||||
neighbours.reset();
|
||||
edge_id_vector & out_edges = m_out_edges[current];
|
||||
typename edge_id_vector::iterator it = out_edges.begin(), end = out_edges.end();
|
||||
for (; it != end; ++it) {
|
||||
edge_id e_id = *it;
|
||||
|
@ -968,7 +968,7 @@ public:
|
|||
}
|
||||
edge_id_vector & in_edges = m_in_edges[current];
|
||||
typename edge_id_vector::iterator it2 = in_edges.begin(), end2 = in_edges.end();
|
||||
for (; it2 != end2; ++it2) {
|
||||
for (; it2 != end2; ++it2) {
|
||||
edge_id e_id = *it2;
|
||||
edge & e = m_edges[e_id];
|
||||
SASSERT(e.get_target() == current);
|
||||
|
@ -980,19 +980,19 @@ public:
|
|||
void dfs_undirected(dl_var start, svector<dl_var> & threads) {
|
||||
threads.reset();
|
||||
threads.resize(get_num_nodes());
|
||||
uint_set discovered, explored;
|
||||
svector<dl_var> nodes;
|
||||
uint_set discovered, explored;
|
||||
svector<dl_var> nodes;
|
||||
discovered.insert(start);
|
||||
nodes.push_back(start);
|
||||
dl_var prev = start;
|
||||
while(!nodes.empty()) {
|
||||
dl_var current = nodes.back();
|
||||
nodes.push_back(start);
|
||||
dl_var prev = start;
|
||||
while(!nodes.empty()) {
|
||||
dl_var current = nodes.back();
|
||||
SASSERT(discovered.contains(current) && !explored.contains(current));
|
||||
svector<dl_var> neighbours;
|
||||
get_neighbours_undirected(current, neighbours);
|
||||
svector<dl_var> neighbours;
|
||||
get_neighbours_undirected(current, neighbours);
|
||||
SASSERT(!neighbours.empty());
|
||||
bool found = false;
|
||||
for (unsigned i = 0; i < neighbours.size(); ++i) {
|
||||
for (unsigned i = 0; i < neighbours.size(); ++i) {
|
||||
dl_var next = neighbours[i];
|
||||
DEBUG_CODE(
|
||||
edge_id id;
|
||||
|
@ -1002,18 +1002,18 @@ public:
|
|||
threads[prev] = next;
|
||||
prev = next;
|
||||
discovered.insert(next);
|
||||
nodes.push_back(next);
|
||||
nodes.push_back(next);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
SASSERT(!nodes.empty());
|
||||
if (!found) {
|
||||
explored.insert(current);
|
||||
nodes.pop_back();
|
||||
}
|
||||
}
|
||||
threads[prev] = start;
|
||||
}
|
||||
threads[prev] = start;
|
||||
}
|
||||
|
||||
void bfs_undirected(dl_var start, svector<dl_var> & parents, svector<dl_var> & depths) {
|
||||
|
@ -1022,31 +1022,31 @@ public:
|
|||
parents[start] = -1;
|
||||
depths.reset();
|
||||
depths.resize(get_num_nodes());
|
||||
uint_set visited;
|
||||
std::deque<dl_var> nodes;
|
||||
visited.insert(start);
|
||||
nodes.push_front(start);
|
||||
while(!nodes.empty()) {
|
||||
uint_set visited;
|
||||
std::deque<dl_var> nodes;
|
||||
visited.insert(start);
|
||||
nodes.push_front(start);
|
||||
while(!nodes.empty()) {
|
||||
dl_var current = nodes.back();
|
||||
nodes.pop_back();
|
||||
SASSERT(visited.contains(current));
|
||||
SASSERT(visited.contains(current));
|
||||
svector<dl_var> neighbours;
|
||||
get_neighbours_undirected(current, neighbours);
|
||||
get_neighbours_undirected(current, neighbours);
|
||||
SASSERT(!neighbours.empty());
|
||||
for (unsigned i = 0; i < neighbours.size(); ++i) {
|
||||
dl_var next = neighbours[i];
|
||||
for (unsigned i = 0; i < neighbours.size(); ++i) {
|
||||
dl_var next = neighbours[i];
|
||||
DEBUG_CODE(
|
||||
edge_id id;
|
||||
SASSERT(get_edge_id(current, next, id) || get_edge_id(next, current, id)););
|
||||
if (!visited.contains(next)) {
|
||||
TRACE("diff_logic", tout << "parents[" << next << "] --> " << current << std::endl;);
|
||||
parents[next] = current;
|
||||
depths[next] = depths[current] + 1;
|
||||
visited.insert(next);
|
||||
nodes.push_front(next);
|
||||
parents[next] = current;
|
||||
depths[next] = depths[current] + 1;
|
||||
visited.insert(next);
|
||||
nodes.push_front(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Functor>
|
||||
|
|
|
@ -40,10 +40,10 @@ namespace smt {
|
|||
|
||||
/** \ brief Use sparse maps in SMT solver.
|
||||
|
||||
Define this to use hash maps rather than vectors over ast
|
||||
nodes. This is useful in the case there are many solvers, each
|
||||
referencing few nodes from a large ast manager. There is some
|
||||
unknown performance penalty for this. */
|
||||
Define this to use hash maps rather than vectors over ast
|
||||
nodes. This is useful in the case there are many solvers, each
|
||||
referencing few nodes from a large ast manager. There is some
|
||||
unknown performance penalty for this. */
|
||||
|
||||
// #define SPARSE_MAP
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace smt {
|
|||
/**
|
||||
\brief Is "model based" instantiate allowed to instantiate this quantifier?
|
||||
*/
|
||||
virtual bool mbqi_enabled(quantifier *q) const {return true;}
|
||||
virtual bool mbqi_enabled(quantifier *q) const {return true;}
|
||||
|
||||
/**
|
||||
\brief Give a change to the plugin to adjust the interpretation of unintepreted functions.
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace smt {
|
|||
typedef trail_stack<theory_seq> th_trail_stack;
|
||||
typedef std::pair<expr*, dependency*> expr_dep;
|
||||
typedef obj_map<expr, expr_dep> eqdep_map_t;
|
||||
typedef union_find<theory_seq> th_union_find;
|
||||
typedef union_find<theory_seq> th_union_find;
|
||||
|
||||
class seq_value_proc;
|
||||
|
||||
|
@ -299,7 +299,7 @@ namespace smt {
|
|||
scoped_vector<ne> m_nqs; // set of current disequalities.
|
||||
scoped_vector<nc> m_ncs; // set of non-contains constraints.
|
||||
unsigned m_eq_id;
|
||||
th_union_find m_find;
|
||||
th_union_find m_find;
|
||||
|
||||
seq_factory* m_factory; // value factory
|
||||
exclusion_table m_exclude; // set of asserted disequalities.
|
||||
|
@ -584,7 +584,7 @@ namespace smt {
|
|||
// model building
|
||||
app* mk_value(app* a);
|
||||
|
||||
th_trail_stack& get_trail_stack() { return m_trail_stack; }
|
||||
th_trail_stack& get_trail_stack() { return m_trail_stack; }
|
||||
void merge_eh(theory_var, theory_var, theory_var v1, theory_var v2) {}
|
||||
void after_merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) { }
|
||||
void unmerge_eh(theory_var v1, theory_var v2) {}
|
||||
|
|
|
@ -4748,10 +4748,10 @@ namespace smt {
|
|||
context& ctx = get_context();
|
||||
ast_manager & m = get_manager();
|
||||
|
||||
// safety
|
||||
if (!ctx.e_internalized(e)) {
|
||||
// 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);
|
||||
|
@ -7028,7 +7028,7 @@ namespace smt {
|
|||
ast_manager & m = get_manager();
|
||||
if (lenTester_fvar_map.contains(lenTester)) {
|
||||
expr * fVar = lenTester_fvar_map[lenTester];
|
||||
expr_ref toAssert(gen_len_val_options_for_free_var(fVar, lenTester, lenTesterValue), m);
|
||||
expr_ref toAssert(gen_len_val_options_for_free_var(fVar, lenTester, lenTesterValue), m);
|
||||
TRACE("str", tout << "asserting more length tests for free variable " << mk_ismt2_pp(fVar, m) << std::endl;);
|
||||
if (toAssert) {
|
||||
assert_axiom(toAssert);
|
||||
|
|
|
@ -36,10 +36,10 @@ namespace smt {
|
|||
|
||||
void watch_list::expand() {
|
||||
if (m_data == 0) {
|
||||
unsigned size = DEFAULT_WATCH_LIST_SIZE + HEADER_SIZE;
|
||||
unsigned size = DEFAULT_WATCH_LIST_SIZE + HEADER_SIZE;
|
||||
unsigned * mem = reinterpret_cast<unsigned*>(alloc_svect(char, size));
|
||||
#ifdef _AMD64_
|
||||
++mem; // make sure data is aligned in 64 bit machines
|
||||
++mem; // make sure data is aligned in 64 bit machines
|
||||
#endif
|
||||
*mem = 0;
|
||||
++mem;
|
||||
|
@ -62,9 +62,9 @@ namespace smt {
|
|||
unsigned * mem = reinterpret_cast<unsigned*>(alloc_svect(char, new_capacity + HEADER_SIZE));
|
||||
unsigned curr_end_cls = end_cls_core();
|
||||
#ifdef _AMD64_
|
||||
++mem; // make sure data is aligned in 64 bit machines
|
||||
++mem; // make sure data is aligned in 64 bit machines
|
||||
#endif
|
||||
*mem = curr_end_cls;
|
||||
*mem = curr_end_cls;
|
||||
++mem;
|
||||
SASSERT(bin_bytes <= new_capacity);
|
||||
unsigned new_begin_bin = new_capacity - bin_bytes;
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
typedef obj_map<expr, value_score> scores_type;
|
||||
typedef obj_map<expr, ptr_vector<expr> > uplinks_type;
|
||||
typedef obj_map<expr, ptr_vector<func_decl> > occ_type;
|
||||
obj_hashtable<expr> m_top_expr;
|
||||
obj_hashtable<expr> m_top_expr;
|
||||
scores_type m_scores;
|
||||
uplinks_type m_uplinks;
|
||||
entry_point_type m_entry_points;
|
||||
|
@ -85,11 +85,11 @@ private:
|
|||
unsigned m_touched;
|
||||
double m_scale_unsat;
|
||||
unsigned m_paws_init;
|
||||
obj_map<expr, unsigned> m_where_false;
|
||||
expr** m_list_false;
|
||||
obj_map<expr, unsigned> m_where_false;
|
||||
expr** m_list_false;
|
||||
unsigned m_track_unsat;
|
||||
obj_map<expr, unsigned> m_weights;
|
||||
double m_top_sum;
|
||||
double m_top_sum;
|
||||
obj_hashtable<expr> m_temp_seen;
|
||||
|
||||
public:
|
||||
|
@ -450,7 +450,7 @@ public:
|
|||
m_list_false = new expr*[sz];
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
{
|
||||
if (m_mpz_manager.eq(get_value(as[i]), m_zero))
|
||||
if (m_mpz_manager.eq(get_value(as[i]), m_zero))
|
||||
break_assertion(as[i]);
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ public:
|
|||
|
||||
// initialize weights
|
||||
if (!m_weights.contains(e))
|
||||
m_weights.insert(e, m_paws_init);
|
||||
m_weights.insert(e, m_paws_init);
|
||||
|
||||
// positive/negative occurrences used for early pruning
|
||||
setup_occs(as[i]);
|
||||
|
|
|
@ -27,36 +27,36 @@ static void tst1() {
|
|||
unsigned n = rand()%10000;
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
int op = rand()%6;
|
||||
if (op <= 1) {
|
||||
bool val = (rand()%2) != 0;
|
||||
v1.push_back(val);
|
||||
v2.push_back(val);
|
||||
ENSURE(v1.size() == v2.size());
|
||||
}
|
||||
else if (op <= 3) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
bool val = (rand()%2) != 0;
|
||||
unsigned idx = rand()%v1.size();
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
v1.set(idx, val);
|
||||
v2[idx] = val;
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 4) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
unsigned idx = rand()%v1.size();
|
||||
VERIFY(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 5) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
for (unsigned j = 0; j < v1.size(); j++) {
|
||||
ENSURE(v1.get(j) == v2[j]);
|
||||
}
|
||||
}
|
||||
if (op <= 1) {
|
||||
bool val = (rand()%2) != 0;
|
||||
v1.push_back(val);
|
||||
v2.push_back(val);
|
||||
ENSURE(v1.size() == v2.size());
|
||||
}
|
||||
else if (op <= 3) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
bool val = (rand()%2) != 0;
|
||||
unsigned idx = rand()%v1.size();
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
v1.set(idx, val);
|
||||
v2[idx] = val;
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 4) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
unsigned idx = rand()%v1.size();
|
||||
VERIFY(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 5) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
for (unsigned j = 0; j < v1.size(); j++) {
|
||||
ENSURE(v1.get(j) == v2[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,6 +309,6 @@ void tst_bit_vector() {
|
|||
tst2();
|
||||
for (unsigned i = 0; i < 20; i++) {
|
||||
std::cerr << i << std::endl;
|
||||
tst1();
|
||||
tst1();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ template class dl_graph<diff_logic_ext>;
|
|||
typedef dl_graph<diff_logic_ext> dlg;
|
||||
|
||||
struct tst_dl_functor {
|
||||
smt::literal_vector m_literals;
|
||||
smt::literal_vector m_literals;
|
||||
void operator()(smt::literal l) {
|
||||
m_literals.push_back(l);
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ void tst_expr_rand(char** argv, int argc, int& i) {
|
|||
i += 1;
|
||||
if (i + 1 < argc && 0 == strncmp(argv[i+1],"/rs:",3)) {
|
||||
rand_seed = atol(argv[i+1]+4);
|
||||
std::cout << "random seed:" << rand_seed << "\n";
|
||||
i += 1;
|
||||
std::cout << "random seed:" << rand_seed << "\n";
|
||||
i += 1;
|
||||
}
|
||||
|
||||
if (i + 1 < argc && 0 == strcmp(argv[i+1],"/arith")) {
|
||||
|
|
|
@ -16,20 +16,20 @@
|
|||
// and print "PASS" to indicate success.
|
||||
//
|
||||
|
||||
#define TST(MODULE) { \
|
||||
std::string s("test "); \
|
||||
s += #MODULE; \
|
||||
void tst_##MODULE(); \
|
||||
#define TST(MODULE) { \
|
||||
std::string s("test "); \
|
||||
s += #MODULE; \
|
||||
void tst_##MODULE(); \
|
||||
if (do_display_usage) \
|
||||
std::cout << #MODULE << "\n"; \
|
||||
for (int i = 0; i < argc; i++) \
|
||||
if (test_all || strcmp(argv[i], #MODULE) == 0) { \
|
||||
for (int i = 0; i < argc; i++) \
|
||||
if (test_all || strcmp(argv[i], #MODULE) == 0) { \
|
||||
enable_trace(#MODULE); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(); \
|
||||
std::cout << "PASS" << std::endl; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TST_ARGV(MODULE) { \
|
||||
|
@ -39,13 +39,13 @@
|
|||
if (do_display_usage) \
|
||||
std::cout << #MODULE << "\n"; \
|
||||
for (int i = 0; i < argc; i++) \
|
||||
if (strcmp(argv[i], #MODULE) == 0) { \
|
||||
if (strcmp(argv[i], #MODULE) == 0) { \
|
||||
enable_trace(#MODULE); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(argv, argc, i); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(argv, argc, i); \
|
||||
std::cout << "PASS" << std::endl; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
void error(const char * msg) {
|
||||
|
@ -76,49 +76,49 @@ void display_usage() {
|
|||
void parse_cmd_line_args(int argc, char ** argv, bool& do_display_usage, bool& test_all) {
|
||||
int i = 1;
|
||||
while (i < argc) {
|
||||
char * arg = argv[i], *eq_pos = 0;
|
||||
char * arg = argv[i], *eq_pos = 0;
|
||||
|
||||
if (arg[0] == '-' || arg[0] == '/') {
|
||||
char * opt_name = arg + 1;
|
||||
char * opt_arg = 0;
|
||||
char * colon = strchr(arg, ':');
|
||||
if (colon) {
|
||||
opt_arg = colon + 1;
|
||||
*colon = 0;
|
||||
}
|
||||
if (strcmp(opt_name, "h") == 0 ||
|
||||
if (arg[0] == '-' || arg[0] == '/') {
|
||||
char * opt_name = arg + 1;
|
||||
char * opt_arg = 0;
|
||||
char * colon = strchr(arg, ':');
|
||||
if (colon) {
|
||||
opt_arg = colon + 1;
|
||||
*colon = 0;
|
||||
}
|
||||
if (strcmp(opt_name, "h") == 0 ||
|
||||
strcmp(opt_name, "?") == 0) {
|
||||
display_usage();
|
||||
display_usage();
|
||||
do_display_usage = true;
|
||||
return;
|
||||
}
|
||||
else if (strcmp(opt_name, "v") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/v:level) is missing.");
|
||||
long lvl = strtol(opt_arg, 0, 10);
|
||||
set_verbosity_level(lvl);
|
||||
}
|
||||
else if (strcmp(opt_name, "w") == 0) {
|
||||
}
|
||||
else if (strcmp(opt_name, "v") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/v:level) is missing.");
|
||||
long lvl = strtol(opt_arg, 0, 10);
|
||||
set_verbosity_level(lvl);
|
||||
}
|
||||
else if (strcmp(opt_name, "w") == 0) {
|
||||
enable_warning_messages(true);
|
||||
}
|
||||
else if (strcmp(opt_name, "a") == 0) {
|
||||
}
|
||||
else if (strcmp(opt_name, "a") == 0) {
|
||||
test_all = true;
|
||||
}
|
||||
}
|
||||
#ifdef _TRACE
|
||||
else if (strcmp(opt_name, "tr") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/tr:tag) is missing.");
|
||||
enable_trace(opt_arg);
|
||||
}
|
||||
else if (strcmp(opt_name, "tr") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/tr:tag) is missing.");
|
||||
enable_trace(opt_arg);
|
||||
}
|
||||
#endif
|
||||
#ifdef Z3DEBUG
|
||||
else if (strcmp(opt_name, "dbg") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/dbg:tag) is missing.");
|
||||
enable_debug(opt_arg);
|
||||
}
|
||||
else if (strcmp(opt_name, "dbg") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/dbg:tag) is missing.");
|
||||
enable_debug(opt_arg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (arg[0] != '"' && (eq_pos = strchr(arg, '='))) {
|
||||
char * key = arg;
|
||||
*eq_pos = 0;
|
||||
|
@ -130,7 +130,7 @@ void parse_cmd_line_args(int argc, char ** argv, bool& do_display_usage, bool& t
|
|||
std::cerr << ex.msg() << "\n";
|
||||
}
|
||||
}
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ static void add_random_ineq(opt::model_based_opt& mbo,
|
|||
continue;
|
||||
}
|
||||
unsigned sign = r(2);
|
||||
coeff = sign == 0 ? coeff : -coeff;
|
||||
coeff = sign == 0 ? coeff : -coeff;
|
||||
vars.push_back(var(x, rational(coeff)));
|
||||
value += coeff*values[x];
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ struct OptFoo {
|
|||
int m_y;
|
||||
|
||||
OptFoo(int x, int y):m_x(x), m_y(y) {
|
||||
TRACE("optional", tout << "OptFoo created: " << m_x << " : " << m_y << "\n";);
|
||||
TRACE("optional", tout << "OptFoo created: " << m_x << " : " << m_y << "\n";);
|
||||
}
|
||||
|
||||
~OptFoo() {
|
||||
TRACE("optional", tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";);
|
||||
TRACE("optional", tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
m_todo.push_back(d);
|
||||
unsigned qhead = 0;
|
||||
while (qhead < m_todo.size()) {
|
||||
d = m_todo[qhead];
|
||||
d = m_todo[qhead];
|
||||
qhead++;
|
||||
if (d->is_leaf()) {
|
||||
vs.push_back(to_leaf(d)->m_value);
|
||||
|
|
|
@ -236,7 +236,7 @@ template<typename T>
|
|||
struct ptr_hash {
|
||||
typedef T * data;
|
||||
unsigned operator()(T * ptr) const {
|
||||
return get_ptr_hash(ptr);
|
||||
return get_ptr_hash(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -119,12 +119,12 @@ class inf_eps_rational {
|
|||
bool is_rational() const { return m_infty.is_zero() && m_r.is_rational(); }
|
||||
|
||||
int64 get_int64() const {
|
||||
SASSERT(is_int64());
|
||||
SASSERT(is_int64());
|
||||
return m_r.get_int64();
|
||||
}
|
||||
|
||||
uint64 get_uint64() const {
|
||||
SASSERT(is_uint64());
|
||||
SASSERT(is_uint64());
|
||||
return m_r.get_uint64();
|
||||
}
|
||||
|
||||
|
@ -168,45 +168,45 @@ class inf_eps_rational {
|
|||
inf_eps_rational & operator=(const inf_eps_rational & r) {
|
||||
m_infty = r.m_infty;
|
||||
m_r = r.m_r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator=(const Numeral & r) {
|
||||
m_infty.reset();
|
||||
m_r = r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator+=(const inf_eps_rational & r) {
|
||||
m_infty += r.m_infty;
|
||||
m_r += r.m_r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator-=(const inf_eps_rational & r) {
|
||||
m_infty -= r.m_infty;
|
||||
m_r -= r.m_r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator-=(const inf_rational & r) {
|
||||
m_r -= r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator+=(const inf_rational & r) {
|
||||
m_r += r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator+=(const rational & r) {
|
||||
m_r += r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator-=(const rational & r) {
|
||||
m_r -= r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_eps_rational & operator*=(const rational & r1) {
|
||||
|
|
|
@ -110,12 +110,12 @@ class inf_int_rational {
|
|||
bool is_rational() const { return m_second == 0; }
|
||||
|
||||
int64 get_int64() const {
|
||||
SASSERT(is_int64());
|
||||
SASSERT(is_int64());
|
||||
return m_first.get_int64();
|
||||
}
|
||||
|
||||
uint64 get_uint64() const {
|
||||
SASSERT(is_uint64());
|
||||
SASSERT(is_uint64());
|
||||
return m_first.get_uint64();
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ class inf_int_rational {
|
|||
inf_int_rational & operator=(const inf_int_rational & r) {
|
||||
m_first = r.m_first;
|
||||
m_second = r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_int_rational & operator=(const rational & r) {
|
||||
|
@ -154,7 +154,7 @@ class inf_int_rational {
|
|||
inf_int_rational & operator+=(const inf_int_rational & r) {
|
||||
m_first += r.m_first;
|
||||
m_second += r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_int_rational & operator*=(const rational & r) {
|
||||
|
@ -163,7 +163,7 @@ class inf_int_rational {
|
|||
}
|
||||
m_first *= r;
|
||||
m_second *= r.get_int32();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,17 +171,17 @@ class inf_int_rational {
|
|||
inf_int_rational & operator-=(const inf_int_rational & r) {
|
||||
m_first -= r.m_first;
|
||||
m_second -= r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_int_rational & operator+=(const rational & r) {
|
||||
m_first += r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_int_rational & operator-=(const rational & r) {
|
||||
m_first -= r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_int_rational & operator++() {
|
||||
|
|
|
@ -123,12 +123,12 @@ class inf_rational {
|
|||
bool is_rational() const { return m_second.is_zero(); }
|
||||
|
||||
int64 get_int64() const {
|
||||
SASSERT(is_int64());
|
||||
SASSERT(is_int64());
|
||||
return m_first.get_int64();
|
||||
}
|
||||
|
||||
uint64 get_uint64() const {
|
||||
SASSERT(is_uint64());
|
||||
SASSERT(is_uint64());
|
||||
return m_first.get_uint64();
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ class inf_rational {
|
|||
inf_rational & operator=(const inf_rational & r) {
|
||||
m_first = r.m_first;
|
||||
m_second = r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_rational & operator=(const rational & r) {
|
||||
|
@ -167,23 +167,23 @@ class inf_rational {
|
|||
inf_rational & operator+=(const inf_rational & r) {
|
||||
m_first += r.m_first;
|
||||
m_second += r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_rational & operator-=(const inf_rational & r) {
|
||||
m_first -= r.m_first;
|
||||
m_second -= r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_rational & operator+=(const rational & r) {
|
||||
m_first += r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_rational & operator-=(const rational & r) {
|
||||
m_first -= r;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inf_rational & operator*=(const rational & r1) {
|
||||
|
|
|
@ -67,7 +67,7 @@ class inf_s_integer {
|
|||
inf_s_integer & operator=(const inf_s_integer & r) {
|
||||
m_first = r.m_first;
|
||||
m_second = r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inf_s_integer & operator=(const rational & r) {
|
||||
m_first = static_cast<int>(r.get_int64());
|
||||
|
@ -90,20 +90,20 @@ class inf_s_integer {
|
|||
inf_s_integer & operator+=(const inf_s_integer & r) {
|
||||
m_first += r.m_first;
|
||||
m_second += r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inf_s_integer & operator-=(const inf_s_integer & r) {
|
||||
m_first -= r.m_first;
|
||||
m_second -= r.m_second;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inf_s_integer & operator+=(const s_integer & r) {
|
||||
m_first += r.get_int();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inf_s_integer & operator-=(const s_integer & r) {
|
||||
m_first -= r.get_int();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inf_s_integer & operator*=(const s_integer & r1) {
|
||||
m_first *= r1.get_int();
|
||||
|
|
|
@ -114,22 +114,22 @@ public :
|
|||
}
|
||||
return a * lb(j).x;
|
||||
}
|
||||
mpq monoid_max(const mpq & a, unsigned j, bool & strict) const {
|
||||
if (is_pos(a)) {
|
||||
strict = !is_zero(ub(j).y);
|
||||
return a * ub(j).x;
|
||||
}
|
||||
strict = !is_zero(lb(j).y);
|
||||
return a * lb(j).x;
|
||||
}
|
||||
const mpq & monoid_min_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
|
||||
if (!a_is_pos) {
|
||||
strict = !is_zero(ub(j).y);
|
||||
return ub(j).x;
|
||||
}
|
||||
strict = !is_zero(lb(j).y);
|
||||
return lb(j).x;
|
||||
}
|
||||
mpq monoid_max(const mpq & a, unsigned j, bool & strict) const {
|
||||
if (is_pos(a)) {
|
||||
strict = !is_zero(ub(j).y);
|
||||
return a * ub(j).x;
|
||||
}
|
||||
strict = !is_zero(lb(j).y);
|
||||
return a * lb(j).x;
|
||||
}
|
||||
const mpq & monoid_min_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
|
||||
if (!a_is_pos) {
|
||||
strict = !is_zero(ub(j).y);
|
||||
return ub(j).x;
|
||||
}
|
||||
strict = !is_zero(lb(j).y);
|
||||
return lb(j).x;
|
||||
}
|
||||
|
||||
mpq monoid_min(const mpq & a, unsigned j, bool& strict) const {
|
||||
if (is_neg(a)) {
|
||||
|
@ -166,7 +166,7 @@ public :
|
|||
m_it.reset();
|
||||
while (m_it.next(a, j)) {
|
||||
bool str;
|
||||
bool a_is_pos = is_pos(a);
|
||||
bool a_is_pos = is_pos(a);
|
||||
mpq bound = total / a + monoid_min_no_mult(a_is_pos, j, str);
|
||||
if (a_is_pos) {
|
||||
limit_j(j, bound, true, false, strict - static_cast<int>(str) > 0);
|
||||
|
@ -192,8 +192,8 @@ public :
|
|||
m_it.reset();
|
||||
while (m_it.next(a, j)) {
|
||||
bool str;
|
||||
bool a_is_pos = is_pos(a);
|
||||
mpq bound = total / a + monoid_max_no_mult(a_is_pos, j, str);
|
||||
bool a_is_pos = is_pos(a);
|
||||
mpq bound = total / a + monoid_max_no_mult(a_is_pos, j, str);
|
||||
bool astrict = strict - static_cast<int>(str) > 0;
|
||||
if (a_is_pos) {
|
||||
limit_j(j, bound, true, true, astrict);
|
||||
|
|
|
@ -123,7 +123,7 @@ void add_row_for_term(const lar_term * term, unsigned term_ext_index) {
|
|||
void add_row_from_term_no_constraint(const lar_term * term, unsigned term_ext_index) {
|
||||
register_new_ext_var_index(term_ext_index);
|
||||
// j will be a new variable
|
||||
unsigned j = A_r().column_count();
|
||||
unsigned j = A_r().column_count();
|
||||
ul_pair ul(j);
|
||||
m_vars_to_ul_pairs.push_back(ul);
|
||||
add_basic_var_to_core_fields();
|
||||
|
@ -152,7 +152,7 @@ void add_basic_var_to_core_fields() {
|
|||
}
|
||||
|
||||
constraint_index add_var_bound(var_index j, lconstraint_kind kind, const mpq & right_side) {
|
||||
constraint_index ci = m_constraints.size();
|
||||
constraint_index ci = m_constraints.size();
|
||||
if (!is_term(j)) { // j is a var
|
||||
auto vc = new lar_var_constraint(j, kind, right_side);
|
||||
m_constraints.push_back(vc);
|
||||
|
@ -212,8 +212,8 @@ void add_constraint_from_term_and_create_new_column_row(unsigned term_j, const l
|
|||
}
|
||||
|
||||
void decide_on_strategy_and_adjust_initial_state() {
|
||||
lean_assert(strategy_is_undecided());
|
||||
if (m_vars_to_ul_pairs.size() > m_settings.column_number_threshold_for_using_lu_in_lar_solver) {
|
||||
lean_assert(strategy_is_undecided());
|
||||
if (m_vars_to_ul_pairs.size() > m_settings.column_number_threshold_for_using_lu_in_lar_solver) {
|
||||
m_settings.simplex_strategy() = simplex_strategy_enum::lu;
|
||||
} else {
|
||||
m_settings.simplex_strategy() = simplex_strategy_enum::tableau_rows; // todo: when to switch to tableau_costs?
|
||||
|
@ -239,14 +239,14 @@ void adjust_initial_state() {
|
|||
|
||||
void adjust_initial_state_for_lu() {
|
||||
copy_from_mpq_matrix(A_d());
|
||||
unsigned n = A_d().column_count();
|
||||
m_mpq_lar_core_solver.m_d_x.resize(n);
|
||||
m_mpq_lar_core_solver.m_d_low_bounds.resize(n);
|
||||
m_mpq_lar_core_solver.m_d_upper_bounds.resize(n);
|
||||
m_mpq_lar_core_solver.m_d_heading = m_mpq_lar_core_solver.m_r_heading;
|
||||
m_mpq_lar_core_solver.m_d_basis = m_mpq_lar_core_solver.m_r_basis;
|
||||
unsigned n = A_d().column_count();
|
||||
m_mpq_lar_core_solver.m_d_x.resize(n);
|
||||
m_mpq_lar_core_solver.m_d_low_bounds.resize(n);
|
||||
m_mpq_lar_core_solver.m_d_upper_bounds.resize(n);
|
||||
m_mpq_lar_core_solver.m_d_heading = m_mpq_lar_core_solver.m_r_heading;
|
||||
m_mpq_lar_core_solver.m_d_basis = m_mpq_lar_core_solver.m_r_basis;
|
||||
|
||||
/*
|
||||
/*
|
||||
unsigned j = A_d().column_count();
|
||||
A_d().add_column();
|
||||
lean_assert(m_mpq_lar_core_solver.m_d_x.size() == j);
|
||||
|
|
|
@ -550,7 +550,7 @@ public:
|
|||
lean_assert(m_r_solver.m_basis_heading[leaving] >= 0);
|
||||
m_r_solver.change_basis_unconditionally(entering, leaving);
|
||||
if(!m_r_solver.pivot_column_tableau(entering, m_r_solver.m_basis_heading[entering])) {
|
||||
// unroll the last step
|
||||
// unroll the last step
|
||||
m_r_solver.change_basis_unconditionally(leaving, entering);
|
||||
#ifdef LEAN_DEBUG
|
||||
bool t =
|
||||
|
|
|
@ -380,8 +380,8 @@ public:
|
|||
|
||||
|
||||
bool term_is_used_as_row(unsigned term) const {
|
||||
lean_assert(is_term(term));
|
||||
return contains(m_ext_vars_to_columns, term);
|
||||
lean_assert(is_term(term));
|
||||
return contains(m_ext_vars_to_columns, term);
|
||||
}
|
||||
|
||||
void propagate_bounds_on_terms(lp_bound_propagator & bp) {
|
||||
|
@ -484,16 +484,16 @@ public:
|
|||
|
||||
void pop(unsigned k) {
|
||||
int n_was = static_cast<int>(m_ext_vars_to_columns.size());
|
||||
m_status.pop(k);
|
||||
m_infeasible_column_index.pop(k);
|
||||
m_status.pop(k);
|
||||
m_infeasible_column_index.pop(k);
|
||||
unsigned n = m_vars_to_ul_pairs.peek_size(k);
|
||||
for (unsigned j = n_was; j-- > n;)
|
||||
m_ext_vars_to_columns.erase(m_columns_to_ext_vars_or_term_indices[j]);
|
||||
m_columns_to_ext_vars_or_term_indices.resize(n);
|
||||
if (m_settings.use_tableau()) {
|
||||
for (unsigned j = n_was; j-- > n;)
|
||||
m_ext_vars_to_columns.erase(m_columns_to_ext_vars_or_term_indices[j]);
|
||||
m_columns_to_ext_vars_or_term_indices.resize(n);
|
||||
if (m_settings.use_tableau()) {
|
||||
pop_tableau();
|
||||
}
|
||||
m_vars_to_ul_pairs.pop(k);
|
||||
m_vars_to_ul_pairs.pop(k);
|
||||
|
||||
m_mpq_lar_core_solver.pop(k);
|
||||
clean_large_elements_after_pop(n, m_columns_with_changed_bound);
|
||||
|
@ -501,7 +501,7 @@ public:
|
|||
clean_large_elements_after_pop(m, m_rows_with_changed_bounds);
|
||||
clean_inf_set_of_r_solver_after_pop();
|
||||
lean_assert(m_settings.simplex_strategy() == simplex_strategy_enum::undecided ||
|
||||
(!use_tableau()) || m_mpq_lar_core_solver.m_r_solver.reduced_costs_are_correct_tableau());
|
||||
(!use_tableau()) || m_mpq_lar_core_solver.m_r_solver.reduced_costs_are_correct_tableau());
|
||||
|
||||
|
||||
lean_assert(ax_is_correct());
|
||||
|
@ -518,9 +518,9 @@ public:
|
|||
}
|
||||
m_terms.resize(m_term_count);
|
||||
m_orig_terms.resize(m_term_count);
|
||||
m_simplex_strategy.pop(k);
|
||||
m_settings.simplex_strategy() = m_simplex_strategy;
|
||||
lean_assert(sizes_are_correct());
|
||||
m_simplex_strategy.pop(k);
|
||||
m_settings.simplex_strategy() = m_simplex_strategy;
|
||||
lean_assert(sizes_are_correct());
|
||||
lean_assert((!m_settings.use_tableau()) || m_mpq_lar_core_solver.m_r_solver.reduced_costs_are_correct_tableau());
|
||||
}
|
||||
|
||||
|
@ -967,8 +967,8 @@ public:
|
|||
|
||||
template <typename U, typename V>
|
||||
void copy_from_mpq_matrix(static_matrix<U, V> & matr) {
|
||||
matr.m_rows.resize(A_r().row_count());
|
||||
matr.m_columns.resize(A_r().column_count());
|
||||
matr.m_rows.resize(A_r().row_count());
|
||||
matr.m_columns.resize(A_r().column_count());
|
||||
for (unsigned i = 0; i < matr.row_count(); i++) {
|
||||
for (auto & it : A_r().m_rows[i]) {
|
||||
matr.set(i, it.m_j, convert_struct<U, mpq>::convert(it.get_val()));
|
||||
|
|
|
@ -17,11 +17,11 @@ const impq & lp_bound_propagator::get_upper_bound(unsigned j) const {
|
|||
}
|
||||
void lp_bound_propagator::try_add_bound(const mpq & v, unsigned j, bool is_low, bool coeff_before_j_is_pos, unsigned row_or_term_index, bool strict) {
|
||||
unsigned term_j = m_lar_solver.adjust_column_index_to_term_index(j);
|
||||
mpq w = v;
|
||||
if (term_j != j) {
|
||||
j = term_j;
|
||||
w += m_lar_solver.get_term(term_j).m_v; // when terms are turned into the columns they "lose" the right side, at this moment they aquire it back
|
||||
}
|
||||
mpq w = v;
|
||||
if (term_j != j) {
|
||||
j = term_j;
|
||||
w += m_lar_solver.get_term(term_j).m_v; // when terms are turned into the columns they "lose" the right side, at this moment they aquire it back
|
||||
}
|
||||
lconstraint_kind kind = is_low? GE : LE;
|
||||
if (strict)
|
||||
kind = static_cast<lconstraint_kind>(kind / 2);
|
||||
|
|
|
@ -278,13 +278,13 @@ public:
|
|||
return m_simplex_strategy;
|
||||
}
|
||||
|
||||
bool use_lu() const {
|
||||
return m_simplex_strategy == simplex_strategy_enum::lu;
|
||||
}
|
||||
bool use_lu() const {
|
||||
return m_simplex_strategy == simplex_strategy_enum::lu;
|
||||
}
|
||||
|
||||
bool use_tableau() const {
|
||||
return m_simplex_strategy == simplex_strategy_enum::tableau_rows ||
|
||||
m_simplex_strategy == simplex_strategy_enum::tableau_costs;
|
||||
return m_simplex_strategy == simplex_strategy_enum::tableau_rows ||
|
||||
m_simplex_strategy == simplex_strategy_enum::tableau_costs;
|
||||
}
|
||||
|
||||
bool use_tableau_rows() const {
|
||||
|
|
|
@ -18,7 +18,7 @@ bool try_get_val(const std::unordered_map<A,B> & map, const A& key, B & val) {
|
|||
|
||||
template <typename A, typename B>
|
||||
bool contains(const std::unordered_map<A, B> & map, const A& key) {
|
||||
return map.find(key) != map.end();
|
||||
return map.find(key) != map.end();
|
||||
}
|
||||
|
||||
#ifdef lp_for_z3
|
||||
|
|
|
@ -51,10 +51,10 @@ public:
|
|||
|
||||
private:
|
||||
void emplace_replace(unsigned i,const B & b) {
|
||||
if (m_vector[i] != b) {
|
||||
m_changes.push_back(std::make_pair(i, m_vector[i]));
|
||||
m_vector[i] = b;
|
||||
}
|
||||
if (m_vector[i] != b) {
|
||||
m_changes.push_back(std::make_pair(i, m_vector[i]));
|
||||
m_vector[i] = b;
|
||||
}
|
||||
}
|
||||
public:
|
||||
|
||||
|
@ -87,14 +87,14 @@ public:
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void pop_tail(vector<T> & v, unsigned k) {
|
||||
lean_assert(v.size() >= k);
|
||||
v.resize(v.size() - k);
|
||||
}
|
||||
void pop_tail(vector<T> & v, unsigned k) {
|
||||
lean_assert(v.size() >= k);
|
||||
v.resize(v.size() - k);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void resize(vector<T> & v, unsigned new_size) {
|
||||
v.resize(new_size);
|
||||
v.resize(new_size);
|
||||
}
|
||||
|
||||
void pop(unsigned k) {
|
||||
|
@ -156,10 +156,10 @@ public:
|
|||
m_vector.resize(m_vector.size() + 1);
|
||||
}
|
||||
|
||||
unsigned peek_size(unsigned k) const {
|
||||
lean_assert(k > 0 && k <= m_stack_of_vector_sizes.size());
|
||||
return m_stack_of_vector_sizes[m_stack_of_vector_sizes.size() - k];
|
||||
}
|
||||
unsigned peek_size(unsigned k) const {
|
||||
lean_assert(k > 0 && k <= m_stack_of_vector_sizes.size());
|
||||
return m_stack_of_vector_sizes[m_stack_of_vector_sizes.size() - k];
|
||||
}
|
||||
|
||||
const vector<B>& operator()() const { return m_vector; }
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ class static_matrix
|
|||
dim(unsigned m, unsigned n) :m_m(m), m_n(n) {}
|
||||
};
|
||||
std::stack<dim> m_stack;
|
||||
vector<unsigned> m_became_zeros; // the row indices that became zeroes during the pivoting
|
||||
vector<unsigned> m_became_zeros; // the row indices that became zeroes during the pivoting
|
||||
public:
|
||||
typedef vector<row_cell<T>> row_strip;
|
||||
typedef vector<column_cell> column_strip;
|
||||
|
|
|
@ -49,8 +49,8 @@ public:
|
|||
&& m_upper_bound_witness == p.m_upper_bound_witness &&
|
||||
m_i == p.m_i;
|
||||
}
|
||||
// empty constructor
|
||||
ul_pair() :
|
||||
// empty constructor
|
||||
ul_pair() :
|
||||
m_low_bound_witness(static_cast<constraint_index>(-1)),
|
||||
m_upper_bound_witness(static_cast<constraint_index>(-1)),
|
||||
m_i(static_cast<row_index>(-1))
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
value const& get(key const& k, value const& default_value) const {
|
||||
entry* e = find_core(k);
|
||||
if (e) {
|
||||
return e->get_data().m_value;
|
||||
return e->get_data().m_value;
|
||||
}
|
||||
else {
|
||||
return default_value;
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
m_next.reserve(std::max(src, dst) + 1);
|
||||
m_next.reserve(std::max(negate(src), negate(dst)) + 1);
|
||||
m_next[src].push_back(dst);
|
||||
m_next[dst].push_back(src);
|
||||
m_next[dst].push_back(src);
|
||||
}
|
||||
|
||||
void cliques(unsigned_vector const& ps, vector<unsigned_vector>& cliques) {
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
max = std::max(max, std::max(np, p) + 1);
|
||||
}
|
||||
m_next.reserve(max);
|
||||
m_tc.reserve(m_next.size());
|
||||
m_tc.reserve(m_next.size());
|
||||
unsigned_vector clique;
|
||||
uint_set vars;
|
||||
for (unsigned i = 0; i < num_ps; ++i) {
|
||||
|
|
|
@ -422,7 +422,7 @@ inline bool operator>(rational const & r1, rational const & r2) {
|
|||
}
|
||||
|
||||
inline bool operator<(rational const & r1, int r2) {
|
||||
return r1 < rational(r2);
|
||||
return r1 < rational(r2);
|
||||
}
|
||||
|
||||
inline bool operator<=(rational const & r1, rational const & r2) {
|
||||
|
@ -450,11 +450,11 @@ inline rational operator+(rational const & r1, rational const & r2) {
|
|||
}
|
||||
|
||||
inline rational operator+(int r1, rational const & r2) {
|
||||
return rational(r1) + r2;
|
||||
return rational(r1) + r2;
|
||||
}
|
||||
|
||||
inline rational operator+(rational const & r1, int r2) {
|
||||
return r1 + rational(r2);
|
||||
return r1 + rational(r2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -463,11 +463,11 @@ inline rational operator-(rational const & r1, rational const & r2) {
|
|||
}
|
||||
|
||||
inline rational operator-(rational const & r1, int r2) {
|
||||
return r1 - rational(r2);
|
||||
return r1 - rational(r2);
|
||||
}
|
||||
|
||||
inline rational operator-(int r1, rational const & r2) {
|
||||
return rational(r1) - r2;
|
||||
return rational(r1) - r2;
|
||||
}
|
||||
|
||||
inline rational operator-(rational const & r) {
|
||||
|
@ -492,11 +492,11 @@ inline rational operator/(rational const & r1, rational const & r2) {
|
|||
}
|
||||
|
||||
inline rational operator/(rational const & r1, int r2) {
|
||||
return r1 / rational(r2);
|
||||
return r1 / rational(r2);
|
||||
}
|
||||
|
||||
inline rational operator/(int r1, rational const & r2) {
|
||||
return rational(r1) / r2;
|
||||
inline rational operator/(int r1, rational const & r2) {
|
||||
return rational(r1) / r2;
|
||||
}
|
||||
|
||||
inline rational power(rational const & r, unsigned p) {
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
mach_timespec_t _stop;
|
||||
clock_get_time(m_host_clock, &_stop);
|
||||
m_time += (_stop.tv_sec - m_start.tv_sec) * 1000000000ull;
|
||||
m_time += (_stop.tv_nsec - m_start.tv_nsec);
|
||||
m_time += (_stop.tv_nsec - m_start.tv_nsec);
|
||||
m_running = false;
|
||||
}
|
||||
}
|
||||
|
@ -163,8 +163,8 @@ public:
|
|||
struct timespec _stop;
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &_stop);
|
||||
m_time += (_stop.tv_sec - m_start.tv_sec) * 1000000000ull;
|
||||
if (m_time != 0 || _stop.tv_nsec >= m_start.tv_nsec)
|
||||
m_time += (_stop.tv_nsec - m_start.tv_nsec);
|
||||
if (m_time != 0 || _stop.tv_nsec >= m_start.tv_nsec)
|
||||
m_time += (_stop.tv_nsec - m_start.tv_nsec);
|
||||
m_running = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,13 +153,13 @@ template<class T, size_t N> char (*ArraySizer(T (&)[N]))[N];
|
|||
template<typename IT>
|
||||
void display(std::ostream & out, const IT & begin, const IT & end, const char * sep, bool & first) {
|
||||
for(IT it = begin; it != end; ++it) {
|
||||
if (first) {
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
out << sep;
|
||||
}
|
||||
out << *it;
|
||||
if (first) {
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
out << sep;
|
||||
}
|
||||
out << *it;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,9 +172,9 @@ void display(std::ostream & out, const IT & begin, const IT & end, const char *
|
|||
template<typename T>
|
||||
struct delete_proc {
|
||||
void operator()(T * ptr) {
|
||||
if (ptr) {
|
||||
dealloc(ptr);
|
||||
}
|
||||
if (ptr) {
|
||||
dealloc(ptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue