3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-27 00:18:45 +00:00

Post merge compile fixes

This commit is contained in:
Arie Gurfinkel 2018-05-15 15:29:29 -07:00
parent 649bab2f58
commit 3bc3b00fdd
12 changed files with 66 additions and 129 deletions

View file

@ -14,6 +14,7 @@ z3_add_component(spacer
spacer_iuc_solver.cpp spacer_iuc_solver.cpp
spacer_virtual_solver.cpp spacer_virtual_solver.cpp
spacer_legacy_mbp.cpp spacer_legacy_mbp.cpp
spacer_proof_utils.cpp
spacer_unsat_core_learner.cpp spacer_unsat_core_learner.cpp
spacer_unsat_core_plugin.cpp spacer_unsat_core_plugin.cpp
spacer_matrix.cpp spacer_matrix.cpp

View file

@ -40,7 +40,7 @@ Notes:
#include "ast/ast_smt2_pp.h" #include "ast/ast_smt2_pp.h"
#include "ast/ast_ll_pp.h" #include "ast/ast_ll_pp.h"
#include "ast/ast_util.h" #include "ast/ast_util.h"
#include "ast/proof_checker/proof_checker.h" #include "ast/proofs/proof_checker.h"
#include "smt/smt_value_sort.h" #include "smt/smt_value_sort.h"
#include "ast/scoped_proof.h" #include "ast/scoped_proof.h"
#include "muz/spacer/spacer_qe_project.h" #include "muz/spacer/spacer_qe_project.h"
@ -3618,9 +3618,9 @@ expr_ref context::get_constraints (unsigned level)
return m_pm.mk_and (constraints); return m_pm.mk_and (constraints);
} }
void context::add_constraint (unsigned level, const expr_ref& c) void context::add_constraint (expr *c, unsigned level)
{ {
if (!c.get()) { return; } if (!c) { return; }
if (m.is_true(c)) { return; } if (m.is_true(c)) { return; }
expr *e1, *e2; expr *e1, *e2;

View file

@ -914,7 +914,7 @@ public:
pob& get_root() const { return m_pob_queue.get_root(); } pob& get_root() const { return m_pob_queue.get_root(); }
expr_ref get_constraints (unsigned lvl); expr_ref get_constraints (unsigned lvl);
void add_constraint (unsigned lvl, const expr_ref& c); void add_constraint (expr *c, unsigned lvl);
void new_lemma_eh(pred_transformer &pt, lemma *lem); void new_lemma_eh(pred_transformer &pt, lemma *lem);

View file

@ -362,5 +362,5 @@ void dl_interface::add_callback(void *state,
} }
void dl_interface::add_constraint (expr *c, unsigned lvl){ void dl_interface::add_constraint (expr *c, unsigned lvl){
m_context->add_constraint(c,lvl); m_context->add_constraint(c, lvl);
} }

View file

@ -82,9 +82,9 @@ public:
void add_callback(void *state, void add_callback(void *state,
const datalog::t_new_lemma_eh new_lemma_eh, const datalog::t_new_lemma_eh new_lemma_eh,
const datalog::t_predecessor_eh predecessor_eh, const datalog::t_predecessor_eh predecessor_eh,
const datalog::t_unfold_eh unfold_eh); const datalog::t_unfold_eh unfold_eh) override;
void add_constraint (expr *c, unsigned lvl); void add_constraint (expr *c, unsigned lvl) override;
}; };
} }

View file

@ -162,7 +162,7 @@ void unsat_core_generalizer::operator()(lemma_ref &lemma)
unsigned uses_level; unsigned uses_level;
expr_ref_vector core(m); expr_ref_vector core(m);
VERIFY(pt.is_invariant(old_level, lemma->get_expr(), uses_level, &core)); VERIFY(pt.is_invariant(lemma->level(), lemma.get(), uses_level, &core));
CTRACE("spacer", old_sz > core.size(), CTRACE("spacer", old_sz > core.size(),
tout << "unsat core reduced lemma from: " tout << "unsat core reduced lemma from: "

View file

@ -1,8 +1,7 @@
#include "muz/spacer/spacer_iuc_proof.h" #include "muz/spacer/spacer_iuc_proof.h"
#include "ast/for_each_expr.h" #include "ast/for_each_expr.h"
#include "ast/array_decl_plugin.h" #include "ast/array_decl_plugin.h"
#include "ast/proofs/proof_utils.h"
#include "muz/spacer/spacer_proof_utils.h" #include "muz/spacer/spacer_proof_utils.h"
namespace spacer { namespace spacer {
@ -102,7 +101,7 @@ namespace spacer {
void iuc_proof::compute_marks(expr_set& b_conjuncts) void iuc_proof::compute_marks(expr_set& b_conjuncts)
{ {
ProofIteratorPostOrder it(m_pr, m); proof_post_order it(m_pr, m);
while (it.hasNext()) while (it.hasNext())
{ {
proof* currentNode = it.next(); proof* currentNode = it.next();
@ -201,7 +200,7 @@ namespace spacer {
unsigned farkas_counter = 0; unsigned farkas_counter = 0;
unsigned farkas_counter2 = 0; unsigned farkas_counter2 = 0;
ProofIteratorPostOrder it3(m_pr, m); proof_post_order it3(m_pr, m);
while (it3.hasNext()) while (it3.hasNext())
{ {
proof* currentNode = it3.next(); proof* currentNode = it3.next();

View file

@ -19,7 +19,7 @@ Notes:
#include"muz/spacer/spacer_iuc_solver.h" #include"muz/spacer/spacer_iuc_solver.h"
#include"ast/ast.h" #include"ast/ast.h"
#include"muz/spacer/spacer_util.h" #include"muz/spacer/spacer_util.h"
#include"muz/base/proof_utils.h" #include"ast/proofs/proof_utils.h"
#include"muz/spacer/spacer_farkas_learner.h" #include"muz/spacer/spacer_farkas_learner.h"
#include"ast/rewriter/expr_replacer.h" #include"ast/rewriter/expr_replacer.h"
#include"muz/spacer/spacer_unsat_core_learner.h" #include"muz/spacer/spacer_unsat_core_learner.h"

View file

@ -22,8 +22,8 @@ Notes:
#include<iostream> #include<iostream>
#include<map> #include<map>
#include "ref.h" #include "util/ref.h"
#include "ref_vector.h" #include "util/ref_vector.h"
class ast; class ast;

View file

@ -16,20 +16,22 @@ Revision History:
--*/ --*/
#include "muz/spacer/spacer_proof_utils.h"
#include "ast/ast_util.h"
#include "ast/ast_pp.h"
#include "ast/proof_checker/proof_checker.h"
#include <unordered_map> #include <unordered_map>
#include "params.h" #include "util/params.h"
#include "muz/spacer/spacer_iuc_proof.h" #include "ast/ast_pp.h"
#include "ast/ast_util.h"
#include "ast/proofs/proof_checker.h"
#include "muz/base/dl_util.h" #include "muz/base/dl_util.h"
#include "muz/spacer/spacer_iuc_proof.h"
#include "ast/proofs/proof_utils.h"
#include "muz/spacer/spacer_proof_utils.h"
namespace spacer { namespace spacer {
// arith lemmas: second parameter specifies exact type of lemma, could be "farkas", "triangle-eq", "eq-propagate", "assign-bounds", maybe also something else // arith lemmas: second parameter specifies exact type of lemma,
// could be "farkas", "triangle-eq", "eq-propagate",
// "assign-bounds", maybe also something else
bool is_arith_lemma(ast_manager& m, proof* pr) bool is_arith_lemma(ast_manager& m, proof* pr)
{ {
if (pr->get_decl_kind() == PR_TH_LEMMA) if (pr->get_decl_kind() == PR_TH_LEMMA)
@ -61,57 +63,6 @@ namespace spacer {
return false; return false;
} }
/*
* ====================================
* methods for proof traversal
* ====================================
*/
ProofIteratorPostOrder::ProofIteratorPostOrder(proof* root, ast_manager& manager) : m(manager)
{m_todo.push_back(root);}
bool ProofIteratorPostOrder::hasNext()
{return !m_todo.empty();}
/*
* iterative post-order depth-first search (DFS) through the proof DAG
*/
proof* ProofIteratorPostOrder::next()
{
while (!m_todo.empty()) {
proof* currentNode = m_todo.back();
// if we haven't already visited the current unit
if (!m_visited.is_marked(currentNode)) {
bool existsUnvisitedParent = false;
// add unprocessed premises to stack for DFS. If there is at least one unprocessed premise, don't compute the result
// for currentProof now, but wait until those unprocessed premises are processed.
for (unsigned i = 0; i < m.get_num_parents(currentNode); ++i) {
SASSERT(m.is_proof(currentNode->get_arg(i)));
proof* premise = to_app(currentNode->get_arg(i));
// if we haven't visited the current premise yet
if (!m_visited.is_marked(premise)) {
// add it to the stack
m_todo.push_back(premise);
existsUnvisitedParent = true;
}
}
// if we already visited all parent-inferences, we can visit the inference too
if (!existsUnvisitedParent) {
m_visited.mark(currentNode, true);
m_todo.pop_back();
return currentNode;
}
} else {
m_todo.pop_back();
}
}
// we have already iterated through all inferences
return NULL;
}
/* /*
* ==================================== * ====================================
* methods for dot printing * methods for dot printing
@ -140,7 +91,7 @@ proof* ProofIteratorPostOrder::next()
std::unordered_map<unsigned, unsigned> id_to_small_id; std::unordered_map<unsigned, unsigned> id_to_small_id;
unsigned counter = 0; unsigned counter = 0;
ProofIteratorPostOrder it2(pr, m); proof_post_order it2(pr, m);
while (it2.hasNext()) while (it2.hasNext())
{ {
proof* currentNode = it2.next(); proof* currentNode = it2.next();
@ -306,7 +257,7 @@ proof* ProofIteratorPostOrder::next()
proof_ref theory_axiom_reducer::reduce(proof* pr) proof_ref theory_axiom_reducer::reduce(proof* pr)
{ {
ProofIteratorPostOrder pit(pr, m); proof_post_order pit(pr, m);
while (pit.hasNext()) while (pit.hasNext())
{ {
proof* p = pit.next(); proof* p = pit.next();
@ -468,11 +419,11 @@ proof* ProofIteratorPostOrder::next()
for (unsigned i = 0, sz = m.get_num_parents(p); i < sz; ++i) for (unsigned i = 0, sz = m.get_num_parents(p); i < sz; ++i)
{ {
proof* pp = m.get_parent(p, i); proof* pp = m.get_parent(p, i);
datalog::set_union(*parent_hyps, *m_parent_hyps.find(pp)); set_union(*parent_hyps, *m_parent_hyps.find(pp));
if (!m.is_lemma(p)) // lemmas clear all hypotheses if (!m.is_lemma(p)) // lemmas clear all hypotheses
{ {
datalog::set_union(*active_hyps, *m_active_hyps.find(pp)); set_union(*active_hyps, *m_active_hyps.find(pp));
} }
} }
} }
@ -488,7 +439,7 @@ proof* ProofIteratorPostOrder::next()
expr_set* all_hyps = m_parent_hyps.find(pr); expr_set* all_hyps = m_parent_hyps.find(pr);
SASSERT(all_hyps != nullptr); SASSERT(all_hyps != nullptr);
ProofIteratorPostOrder pit(pr, m); proof_post_order pit(pr, m);
while (pit.hasNext()) { while (pit.hasNext()) {
proof* p = pit.next(); proof* p = pit.next();
if (!m.is_hypothesis(p)) if (!m.is_hypothesis(p))

View file

@ -24,21 +24,6 @@ namespace spacer {
bool is_arith_lemma(ast_manager& m, proof* pr); bool is_arith_lemma(ast_manager& m, proof* pr);
bool is_farkas_lemma(ast_manager& m, proof* pr); bool is_farkas_lemma(ast_manager& m, proof* pr);
/*
* iterator, which traverses the proof in depth-first post-order.
*/
class ProofIteratorPostOrder {
public:
ProofIteratorPostOrder(proof* refutation, ast_manager& manager);
bool hasNext();
proof* next();
private:
ptr_vector<proof> m_todo;
ast_mark m_visited; // the proof nodes we have already visited
ast_manager& m;
};
/* /*
* prints the proof pr in dot representation to the file proof.dot * prints the proof pr in dot representation to the file proof.dot

View file

@ -22,6 +22,7 @@ Revision History:
#include "muz/spacer/spacer_iuc_proof.h" #include "muz/spacer/spacer_iuc_proof.h"
#include "ast/for_each_expr.h" #include "ast/for_each_expr.h"
#include "ast/proofs/proof_utils.h"
#include "muz/spacer/spacer_util.h" #include "muz/spacer/spacer_util.h"