mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 20:05:51 +00:00
model refactor (#4723)
* refactor model fixing Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * missing cond macro Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * file Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * file Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * add macros dependency Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * deps and debug Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * add dependency to normal forms Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * build issues Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * compile Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fix leal regression * complete model fixer Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fold back private functionality to model_finder Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * avoid duplicate fixed callbacks Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
6cc52e04c3
commit
fa58a36b9f
42 changed files with 2060 additions and 1494 deletions
|
@ -19,13 +19,14 @@ Author:
|
|||
#include "sat/smt/q_solver.h"
|
||||
#include "sat/smt/euf_solver.h"
|
||||
#include "sat/smt/sat_th.h"
|
||||
|
||||
#include "ast/normal_forms/pull_quant.h"
|
||||
#include "ast/well_sorted.h"
|
||||
|
||||
namespace q {
|
||||
|
||||
solver::solver(euf::solver& ctx):
|
||||
th_euf_solver(ctx, ctx.get_manager().get_family_id(name())),
|
||||
m_mbqi(ctx, *this)
|
||||
th_euf_solver(ctx, symbol("quant"), ctx.get_manager().get_family_id(symbol("quant"))),
|
||||
m_mbqi(ctx, *this)
|
||||
{}
|
||||
|
||||
void solver::asserted(sat::literal l) {
|
||||
|
@ -43,10 +44,12 @@ namespace q {
|
|||
}
|
||||
|
||||
sat::check_result solver::check() {
|
||||
switch (m_mbqi()) {
|
||||
case l_true: return sat::check_result::CR_DONE;
|
||||
case l_false: return sat::check_result::CR_CONTINUE;
|
||||
case l_undef: return sat::check_result::CR_GIVEUP;
|
||||
if (ctx.get_config().m_mbqi) {
|
||||
switch (m_mbqi()) {
|
||||
case l_true: return sat::check_result::CR_DONE;
|
||||
case l_false: return sat::check_result::CR_CONTINUE;
|
||||
case l_undef: return sat::check_result::CR_GIVEUP;
|
||||
}
|
||||
}
|
||||
return sat::check_result::CR_GIVEUP;
|
||||
}
|
||||
|
@ -117,4 +120,27 @@ namespace q {
|
|||
mk_var(ctx.get_egraph().find(e));
|
||||
return lit;
|
||||
}
|
||||
|
||||
void solver::finalize_model(model& mdl) {
|
||||
m_mbqi.finalize_model(mdl);
|
||||
}
|
||||
|
||||
quantifier* solver::flatten(quantifier* q) {
|
||||
quantifier* q_flat = nullptr;
|
||||
if (!has_quantifiers(q->get_expr()))
|
||||
return q;
|
||||
if (m_flat.find(q, q_flat))
|
||||
return q_flat;
|
||||
proof_ref pr(m);
|
||||
expr_ref new_q(m);
|
||||
pull_quant pull(m);
|
||||
pull(q, new_q, pr);
|
||||
SASSERT(is_well_sorted(m, new_q));
|
||||
q_flat = to_quantifier(new_q);
|
||||
m.inc_ref(q_flat);
|
||||
m.inc_ref(q);
|
||||
m_flat.insert(q, q_flat);
|
||||
ctx.push(insert_ref2_map<euf::solver, ast_manager, quantifier, quantifier>(m, m_flat, q, q_flat));
|
||||
return q_flat;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue