mirror of
https://github.com/Z3Prover/z3
synced 2025-08-07 19:51:22 +00:00
add get-interpolant command
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
d3b105f9f8
commit
9179deb746
5 changed files with 127 additions and 32 deletions
|
@ -29,6 +29,7 @@ Notes:
|
|||
--*/
|
||||
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "ast/rewriter/expr_safe_replace.h"
|
||||
#include "ast/rewriter/bool_rewriter.h"
|
||||
|
@ -43,6 +44,38 @@ Notes:
|
|||
|
||||
namespace qe {
|
||||
|
||||
void mbi_plugin::set_shared(expr* a, expr* b) {
|
||||
TRACE("qe", tout << mk_pp(a, m) << " " << mk_pp(b, m) << "\n";);
|
||||
struct fun_proc {
|
||||
obj_hashtable<func_decl> s;
|
||||
void operator()(app* a) { if (is_uninterp(a)) s.insert(a->get_decl()); }
|
||||
void operator()(expr*) {}
|
||||
};
|
||||
fun_proc symbols_in_a;
|
||||
expr_fast_mark1 marks;
|
||||
quick_for_each_expr(symbols_in_a, marks, a);
|
||||
marks.reset();
|
||||
m_shared_trail.reset();
|
||||
m_shared.reset();
|
||||
m_is_shared.reset();
|
||||
|
||||
struct intersect_proc {
|
||||
mbi_plugin& p;
|
||||
obj_hashtable<func_decl>& sA;
|
||||
intersect_proc(mbi_plugin& p, obj_hashtable<func_decl>& sA):p(p), sA(sA) {}
|
||||
void operator()(app* a) {
|
||||
func_decl* f = a->get_decl();
|
||||
if (sA.contains(f) && !p.m_shared.contains(f)) {
|
||||
p.m_shared_trail.push_back(f);
|
||||
p.m_shared.insert(f);
|
||||
}
|
||||
}
|
||||
void operator()(expr*) {}
|
||||
};
|
||||
intersect_proc symbols_in_b(*this, symbols_in_a.s);
|
||||
quick_for_each_expr(symbols_in_b, marks, b);
|
||||
}
|
||||
|
||||
lbool mbi_plugin::check(expr_ref_vector& lits, model_ref& mdl) {
|
||||
while (true) {
|
||||
switch ((*this)(lits, mdl)) {
|
||||
|
|
|
@ -21,6 +21,7 @@ Revision History:
|
|||
#pragma once
|
||||
|
||||
#include "qe/qe_arith.h"
|
||||
#include "util/lbool.h"
|
||||
|
||||
namespace qe {
|
||||
enum mbi_result {
|
||||
|
@ -54,6 +55,8 @@ namespace qe {
|
|||
for (auto* f : vars) m_shared.insert(f);
|
||||
}
|
||||
|
||||
void set_shared(expr* a, expr* b);
|
||||
|
||||
/**
|
||||
* Set representative (shared) expression finder.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue