mirror of
https://github.com/Z3Prover/z3
synced 2025-08-24 03:57:51 +00:00
add stubs for converting assertions, consolidate filter_model_converter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
53e36c9cf9
commit
0d15b6abb7
76 changed files with 244 additions and 356 deletions
|
@ -101,11 +101,11 @@ namespace smt {
|
|||
return m_context.find_mutexes(vars, mutexes);
|
||||
}
|
||||
|
||||
virtual void assert_expr(expr * t) {
|
||||
virtual void assert_expr_core(expr * t) {
|
||||
m_context.assert_expr(t);
|
||||
}
|
||||
|
||||
virtual void assert_expr(expr * t, expr * a) {
|
||||
virtual void assert_expr_core(expr * t, expr * a) {
|
||||
if (m_name2assertion.contains(a)) {
|
||||
throw default_exception("named assertion defined twice");
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ Notes:
|
|||
#include "smt/params/smt_params_helper.hpp"
|
||||
#include "util/lp/lp_params.hpp"
|
||||
#include "ast/rewriter/rewriter_types.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/generic_model_converter.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "solver/solver2tactic.h"
|
||||
#include "smt/smt_solver.h"
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
expr_ref_vector clauses(m);
|
||||
expr2expr_map bool2dep;
|
||||
ptr_vector<expr> assumptions;
|
||||
ref<filter_model_converter> fmc;
|
||||
ref<generic_model_converter> fmc;
|
||||
if (in->unsat_core_enabled()) {
|
||||
extract_clauses_and_dependencies(in, clauses, assumptions, bool2dep, fmc);
|
||||
TRACE("mus", in->display_with_dependencies(tout);
|
||||
|
|
|
@ -1081,7 +1081,7 @@ namespace smt {
|
|||
virtual inf_eps_rational<inf_rational> maximize(theory_var v, expr_ref& blocker, bool& has_shared);
|
||||
virtual inf_eps_rational<inf_rational> value(theory_var v);
|
||||
virtual theory_var add_objective(app* term);
|
||||
expr_ref mk_ge(filter_model_converter& fm, theory_var v, inf_numeral const& val);
|
||||
expr_ref mk_ge(generic_model_converter& fm, theory_var v, inf_numeral const& val);
|
||||
void enable_record_conflict(expr* bound);
|
||||
void record_conflict(unsigned num_lits, literal const * lits,
|
||||
unsigned num_eqs, enode_pair const * eqs,
|
||||
|
|
|
@ -23,7 +23,7 @@ Revision History:
|
|||
#include "smt/theory_arith.h"
|
||||
#include "smt/smt_farkas_util.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/generic_model_converter.h"
|
||||
|
||||
namespace smt {
|
||||
|
||||
|
@ -1117,14 +1117,14 @@ namespace smt {
|
|||
This allows to handle inequalities with non-standard numbers.
|
||||
*/
|
||||
template<typename Ext>
|
||||
expr_ref theory_arith<Ext>::mk_ge(filter_model_converter& fm, theory_var v, inf_numeral const& val) {
|
||||
expr_ref theory_arith<Ext>::mk_ge(generic_model_converter& fm, theory_var v, inf_numeral const& val) {
|
||||
ast_manager& m = get_manager();
|
||||
context& ctx = get_context();
|
||||
std::ostringstream strm;
|
||||
strm << val << " <= " << mk_pp(get_enode(v)->get_owner(), get_manager());
|
||||
app* b = m.mk_const(symbol(strm.str().c_str()), m.mk_bool_sort());
|
||||
if (!ctx.b_internalized(b)) {
|
||||
fm.insert(b->get_decl());
|
||||
fm.hide(b->get_decl());
|
||||
bool_var bv = ctx.mk_bool_var(b);
|
||||
ctx.set_var_theory(bv, get_id());
|
||||
// ctx.set_enode_flag(bv, true);
|
||||
|
|
|
@ -271,7 +271,7 @@ namespace smt {
|
|||
virtual inf_eps_rational<inf_rational> value(theory_var v);
|
||||
virtual theory_var add_objective(app* term);
|
||||
virtual expr_ref mk_gt(theory_var v, inf_eps const& val);
|
||||
expr_ref mk_ge(filter_model_converter& fm, theory_var v, inf_eps const& val);
|
||||
expr_ref mk_ge(generic_model_converter& fm, theory_var v, inf_eps const& val);
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
|
|
@ -1055,7 +1055,7 @@ namespace smt {
|
|||
|
||||
template<typename Ext>
|
||||
expr_ref theory_dense_diff_logic<Ext>::mk_ge(
|
||||
filter_model_converter& fm, theory_var v, inf_eps const& val) {
|
||||
generic_model_converter& fm, theory_var v, inf_eps const& val) {
|
||||
return mk_ineq(v, val, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ namespace smt {
|
|||
virtual inf_eps maximize(theory_var v, expr_ref& blocker, bool& has_shared);
|
||||
virtual inf_eps value(theory_var v);
|
||||
virtual theory_var add_objective(app* term);
|
||||
expr_ref mk_ge(filter_model_converter& fm, theory_var v, inf_eps const& val);
|
||||
expr_ref mk_ge(generic_model_converter& fm, theory_var v, inf_eps const& val);
|
||||
|
||||
bool internalize_objective(expr * n, rational const& m, rational& r, objective_term & objective);
|
||||
|
||||
|
|
|
@ -1336,7 +1336,7 @@ expr_ref theory_diff_logic<Ext>::mk_gt(theory_var v, inf_eps const& val) {
|
|||
}
|
||||
|
||||
template<typename Ext>
|
||||
expr_ref theory_diff_logic<Ext>::mk_ge(filter_model_converter& fm, theory_var v, inf_eps const& val) {
|
||||
expr_ref theory_diff_logic<Ext>::mk_ge(generic_model_converter& fm, theory_var v, inf_eps const& val) {
|
||||
return mk_ineq(v, val, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Revision History:
|
|||
#include "smt/smt_model_generator.h"
|
||||
#include "smt/arith_eq_adapter.h"
|
||||
#include "util/nat_set.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/generic_model_converter.h"
|
||||
|
||||
namespace lra_lp {
|
||||
enum bound_kind { lower_t, upper_t };
|
||||
|
@ -2417,7 +2417,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
expr_ref mk_ge(filter_model_converter& fm, theory_var v, inf_rational const& val) {
|
||||
expr_ref mk_ge(generic_model_converter& fm, theory_var v, inf_rational const& val) {
|
||||
rational r = val.get_rational();
|
||||
bool is_strict = val.get_infinitesimal().is_pos();
|
||||
app_ref b(m);
|
||||
|
@ -2429,7 +2429,7 @@ namespace smt {
|
|||
b = a.mk_ge(mk_obj(v), a.mk_numeral(r, is_int));
|
||||
}
|
||||
if (!ctx().b_internalized(b)) {
|
||||
fm.insert(b->get_decl());
|
||||
fm.hide(b);
|
||||
bool_var bv = ctx().mk_bool_var(b);
|
||||
ctx().set_var_theory(bv, get_id());
|
||||
// ctx().set_enode_flag(bv, true);
|
||||
|
@ -2620,7 +2620,7 @@ namespace smt {
|
|||
theory_var theory_lra::add_objective(app* term) {
|
||||
return m_imp->add_objective(term);
|
||||
}
|
||||
expr_ref theory_lra::mk_ge(filter_model_converter& fm, theory_var v, inf_rational const& val) {
|
||||
expr_ref theory_lra::mk_ge(generic_model_converter& fm, theory_var v, inf_rational const& val) {
|
||||
return m_imp->mk_ge(fm, v, val);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace smt {
|
|||
virtual inf_eps value(theory_var);
|
||||
virtual inf_eps maximize(theory_var v, expr_ref& blocker, bool& has_shared);
|
||||
virtual theory_var add_objective(app* term);
|
||||
virtual expr_ref mk_ge(filter_model_converter& fm, theory_var v, inf_rational const& val);
|
||||
virtual expr_ref mk_ge(generic_model_converter& fm, theory_var v, inf_rational const& val);
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ Notes:
|
|||
#ifndef THEORY_OPT_H_
|
||||
#define THEORY_OPT_H_
|
||||
|
||||
class filter_model_converter;
|
||||
class generic_model_converter;
|
||||
namespace smt {
|
||||
class theory_opt {
|
||||
public:
|
||||
|
|
|
@ -25,7 +25,7 @@ Notes:
|
|||
|
||||
namespace smt {
|
||||
|
||||
theory_wmaxsat::theory_wmaxsat(ast_manager& m, filter_model_converter& mc):
|
||||
theory_wmaxsat::theory_wmaxsat(ast_manager& m, generic_model_converter& mc):
|
||||
theory(m.mk_family_id("weighted_maxsat")),
|
||||
m_mc(mc),
|
||||
m_vars(m),
|
||||
|
@ -92,7 +92,7 @@ namespace smt {
|
|||
ast_manager& m = get_manager();
|
||||
app_ref var(m), wfml(m);
|
||||
var = m.mk_fresh_const("w", m.mk_bool_sort());
|
||||
m_mc.insert(var->get_decl());
|
||||
m_mc.hide(var);
|
||||
wfml = m.mk_or(var, fml);
|
||||
ctx.assert_expr(wfml);
|
||||
m_rweights.push_back(w);
|
||||
|
|
|
@ -22,7 +22,7 @@ Notes:
|
|||
|
||||
#include "smt/smt_theory.h"
|
||||
#include "smt/smt_clause.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/generic_model_converter.h"
|
||||
|
||||
namespace smt {
|
||||
class theory_wmaxsat : public theory {
|
||||
|
@ -32,7 +32,7 @@ namespace smt {
|
|||
void reset() { memset(this, 0, sizeof(*this)); }
|
||||
stats() { reset(); }
|
||||
};
|
||||
filter_model_converter& m_mc;
|
||||
generic_model_converter& m_mc;
|
||||
mutable unsynch_mpz_manager m_mpz;
|
||||
app_ref_vector m_vars; // Auxiliary variables per soft clause
|
||||
expr_ref_vector m_fmls; // Formulas per soft clause
|
||||
|
@ -56,7 +56,7 @@ namespace smt {
|
|||
svector<bool> m_assigned, m_enabled;
|
||||
stats m_stats;
|
||||
public:
|
||||
theory_wmaxsat(ast_manager& m, filter_model_converter& mc);
|
||||
theory_wmaxsat(ast_manager& m, generic_model_converter& mc);
|
||||
virtual ~theory_wmaxsat();
|
||||
void get_assignment(svector<bool>& result);
|
||||
expr* assert_weighted(expr* fml, rational const& w);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue