mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
record simplified input clauses as lemmas
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
247980c5a2
commit
f2e636c598
7 changed files with 54 additions and 23 deletions
|
@ -3915,7 +3915,7 @@ namespace smt {
|
|||
SASSERT(bindings[i]->get_generation() <= max_generation);
|
||||
}
|
||||
#endif
|
||||
unsigned min_gen, max_gen;
|
||||
unsigned min_gen = 0, max_gen = 0;
|
||||
m_interpreter.get_min_max_top_generation(min_gen, max_gen);
|
||||
m_context.add_instance(qa, pat, num_bindings, bindings, nullptr, max_generation, min_gen, max_gen, used_enodes);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ Revision History:
|
|||
#include "smt/smt_clause.h"
|
||||
#include "smt/smt_justification.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "ast/ast_pp.h"
|
||||
|
||||
namespace smt {
|
||||
/**
|
||||
|
@ -96,22 +97,33 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
void clause::display(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const {
|
||||
std::ostream& clause::display(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const {
|
||||
out << "(clause";
|
||||
for (unsigned i = 0; i < m_num_literals; i++) {
|
||||
out << " ";
|
||||
m_lits[i].display(out, m, bool_var2expr_map);
|
||||
}
|
||||
out << ")";
|
||||
return out << ")";
|
||||
}
|
||||
|
||||
void clause::display_compact(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const {
|
||||
std::ostream& clause::display_compact(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const {
|
||||
out << "(clause";
|
||||
for (unsigned i = 0; i < m_num_literals; i++) {
|
||||
out << " ";
|
||||
m_lits[i].display_compact(out, bool_var2expr_map);
|
||||
}
|
||||
out << ")";
|
||||
return out << ")";
|
||||
}
|
||||
|
||||
std::ostream& clause::display_smt2(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const {
|
||||
expr_ref_vector args(m);
|
||||
for (unsigned i = 0; i < m_num_literals; i++) {
|
||||
literal lit = m_lits[i];
|
||||
args.push_back(bool_var2expr_map[lit.var()]);
|
||||
if (lit.sign()) args[args.size()-1] = m.mk_not(args.back());
|
||||
}
|
||||
expr_ref disj(m.mk_or(args.size(), args.c_ptr()), m);
|
||||
return out << disj;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -239,9 +239,11 @@ namespace smt {
|
|||
set_activity(get_activity() + 1);
|
||||
}
|
||||
|
||||
void display(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const;
|
||||
std::ostream& display(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const;
|
||||
|
||||
std::ostream& display_smt2(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const;
|
||||
|
||||
void display_compact(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const;
|
||||
std::ostream& display_compact(std::ostream & out, ast_manager & m, expr * const * bool_var2expr_map) const;
|
||||
|
||||
unsigned hash() const {
|
||||
return get_ptr_hash(this);
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
void context::display_clause(std::ostream & out, clause const * cls) const {
|
||||
cls->display_compact(out, m_manager, m_bool_var2expr.c_ptr());
|
||||
cls->display_smt2(out, m_manager, m_bool_var2expr.c_ptr());
|
||||
}
|
||||
|
||||
void context::display_clauses(std::ostream & out, ptr_vector<clause> const & v) const {
|
||||
|
@ -185,11 +185,18 @@ namespace smt {
|
|||
out << "binary clauses:\n";
|
||||
first = false;
|
||||
}
|
||||
expr_ref t1(m_manager), t2(m_manager);
|
||||
literal2expr(neg_l1, t1);
|
||||
literal2expr(l2, t2);
|
||||
expr_ref disj(m_manager.mk_or(t1, t2), m_manager);
|
||||
out << disj << "\n";
|
||||
#if 0
|
||||
out << "(clause ";
|
||||
display_literal(out, neg_l1);
|
||||
out << " ";
|
||||
display_literal(out, l2);
|
||||
out << ")\n";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "smt/smt_quantifier.h"
|
||||
#include "smt/smt_context.h"
|
||||
#include "smt/smt_quantifier_stat.h"
|
||||
|
@ -260,13 +260,20 @@ namespace smt {
|
|||
m_qi_queue.insert(f, pat, max_generation, min_top_generation, max_top_generation); // TODO
|
||||
m_num_instances++;
|
||||
}
|
||||
TRACE("quantifier",
|
||||
tout << mk_pp(q, m()) << " ";
|
||||
static unsigned count = 0;
|
||||
CTRACE("quantifier", f != nullptr,
|
||||
tout << (count++) << " " << q->get_id() << "\n";
|
||||
if (q->get_id() == 28 || true) {
|
||||
tout << mk_ll_pp(q, m()) << "\n";
|
||||
}
|
||||
);
|
||||
|
||||
CTRACE("quantifier_", f != nullptr,
|
||||
tout << expr_ref(q, m()) << " ";
|
||||
for (unsigned i = 0; i < num_bindings; ++i) {
|
||||
tout << mk_pp(bindings[i]->get_owner(), m()) << " ";
|
||||
tout << expr_ref(bindings[i]->get_owner(), m()) << " ";
|
||||
}
|
||||
tout << "\n";
|
||||
tout << "inserted: " << (f != nullptr) << "\n";
|
||||
);
|
||||
|
||||
return f != nullptr;
|
||||
|
@ -646,7 +653,7 @@ namespace smt {
|
|||
m_lazy_mam->add_pattern(q, mp);
|
||||
}
|
||||
else {
|
||||
TRACE("quantifier", tout << "adding:\n" << mk_ismt2_pp(mp, m) << "\n";);
|
||||
TRACE("quantifier", tout << "adding:\n" << expr_ref(mp, m) << "\n";);
|
||||
m_mam->add_pattern(q, mp);
|
||||
}
|
||||
if (!unary)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue