mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
Formatting only. No change to code
This commit is contained in:
parent
fcfa6baeca
commit
4ed6783aff
|
@ -29,9 +29,9 @@ Revision History:
|
||||||
|
|
||||||
namespace spacer {
|
namespace spacer {
|
||||||
|
|
||||||
// arithmetic lemma recognizer
|
// arithmetic lemma recognizer
|
||||||
bool is_arith_lemma(ast_manager& m, proof* pr)
|
bool is_arith_lemma(ast_manager& m, proof* pr)
|
||||||
{
|
{
|
||||||
// arith lemmas: second parameter specifies exact type of lemma,
|
// arith lemmas: second parameter specifies exact type of lemma,
|
||||||
// could be "farkas", "triangle-eq", "eq-propagate",
|
// could be "farkas", "triangle-eq", "eq-propagate",
|
||||||
// "assign-bounds", maybe also something else
|
// "assign-bounds", maybe also something else
|
||||||
|
@ -43,11 +43,11 @@ bool is_arith_lemma(ast_manager& m, proof* pr)
|
||||||
sym == "arith";
|
sym == "arith";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// farkas lemma recognizer
|
// farkas lemma recognizer
|
||||||
bool is_farkas_lemma(ast_manager& m, proof* pr)
|
bool is_farkas_lemma(ast_manager& m, proof* pr)
|
||||||
{
|
{
|
||||||
if (pr->get_decl_kind() == PR_TH_LEMMA)
|
if (pr->get_decl_kind() == PR_TH_LEMMA)
|
||||||
{
|
{
|
||||||
func_decl* d = pr->get_decl();
|
func_decl* d = pr->get_decl();
|
||||||
|
@ -57,7 +57,7 @@ bool is_farkas_lemma(ast_manager& m, proof* pr)
|
||||||
d->get_parameter(1).is_symbol(sym) && sym == "farkas";
|
d->get_parameter(1).is_symbol(sym) && sym == "farkas";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -66,12 +66,12 @@ bool is_farkas_lemma(ast_manager& m, proof* pr)
|
||||||
* ====================================
|
* ====================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void theory_axiom_reducer::reset() {
|
void theory_axiom_reducer::reset() {
|
||||||
m_cache.reset();
|
m_cache.reset();
|
||||||
m_pinned.reset();
|
m_pinned.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
static proof* mk_th_lemma(ast_manager &m, ptr_buffer<proof> const &parents,
|
static proof* mk_th_lemma(ast_manager &m, ptr_buffer<proof> const &parents,
|
||||||
unsigned num_params, parameter const *params) {
|
unsigned num_params, parameter const *params) {
|
||||||
buffer<parameter> v;
|
buffer<parameter> v;
|
||||||
for (unsigned i = 1; i < num_params; ++i)
|
for (unsigned i = 1; i < num_params; ++i)
|
||||||
|
@ -84,10 +84,10 @@ static proof* mk_th_lemma(ast_manager &m, ptr_buffer<proof> const &parents,
|
||||||
return m.mk_th_lemma(tid, m.mk_false(),
|
return m.mk_th_lemma(tid, m.mk_false(),
|
||||||
parents.size(), parents.c_ptr(),
|
parents.size(), parents.c_ptr(),
|
||||||
num_params-1, v.c_ptr());
|
num_params-1, v.c_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- rewrite theory axioms into theory lemmas
|
// -- rewrite theory axioms into theory lemmas
|
||||||
proof_ref theory_axiom_reducer::reduce(proof* pr) {
|
proof_ref theory_axiom_reducer::reduce(proof* pr) {
|
||||||
proof_post_order pit(pr, m);
|
proof_post_order pit(pr, m);
|
||||||
while (pit.hasNext()) {
|
while (pit.hasNext()) {
|
||||||
proof* p = pit.next();
|
proof* p = pit.next();
|
||||||
|
@ -176,13 +176,13 @@ proof_ref theory_axiom_reducer::reduce(proof* pr) {
|
||||||
);
|
);
|
||||||
|
|
||||||
return proof_ref(res, m);
|
return proof_ref(res, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
/* hypothesis_reducer */
|
/* hypothesis_reducer */
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
proof_ref hypothesis_reducer::reduce(proof* pr) {
|
proof_ref hypothesis_reducer::reduce(proof* pr) {
|
||||||
compute_hypsets(pr);
|
compute_hypsets(pr);
|
||||||
collect_units(pr);
|
collect_units(pr);
|
||||||
|
|
||||||
|
@ -194,9 +194,9 @@ proof_ref hypothesis_reducer::reduce(proof* pr) {
|
||||||
expr_ref_vector side(m);
|
expr_ref_vector side(m);
|
||||||
SASSERT(pc.check(res, side)););
|
SASSERT(pc.check(res, side)););
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hypothesis_reducer::reset() {
|
void hypothesis_reducer::reset() {
|
||||||
m_active_hyps.reset();
|
m_active_hyps.reset();
|
||||||
m_units.reset();
|
m_units.reset();
|
||||||
m_cache.reset();
|
m_cache.reset();
|
||||||
|
@ -206,9 +206,9 @@ void hypothesis_reducer::reset() {
|
||||||
m_hyp_mark.reset();
|
m_hyp_mark.reset();
|
||||||
m_open_mark.reset();
|
m_open_mark.reset();
|
||||||
m_visited.reset();
|
m_visited.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hypothesis_reducer::compute_hypsets(proof *pr) {
|
void hypothesis_reducer::compute_hypsets(proof *pr) {
|
||||||
ptr_buffer<proof> todo;
|
ptr_buffer<proof> todo;
|
||||||
todo.push_back(pr);
|
todo.push_back(pr);
|
||||||
|
|
||||||
|
@ -272,11 +272,11 @@ void hypothesis_reducer::compute_hypsets(proof *pr) {
|
||||||
m_active_hyps.insert(p, active_hyps);
|
m_active_hyps.insert(p, active_hyps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect all units that are hyp-free and are used as hypotheses somewhere
|
// collect all units that are hyp-free and are used as hypotheses somewhere
|
||||||
// requires that m_active_hyps has been computed
|
// requires that m_active_hyps has been computed
|
||||||
void hypothesis_reducer::collect_units(proof* pr) {
|
void hypothesis_reducer::collect_units(proof* pr) {
|
||||||
|
|
||||||
proof_post_order pit(pr, m);
|
proof_post_order pit(pr, m);
|
||||||
while (pit.hasNext()) {
|
while (pit.hasNext()) {
|
||||||
|
@ -289,12 +289,12 @@ void hypothesis_reducer::collect_units(proof* pr) {
|
||||||
m_units.insert(m.get_fact(p), p);
|
m_units.insert(m.get_fact(p), p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief returns true if p is an ancestor of q
|
\brief returns true if p is an ancestor of q
|
||||||
*/
|
*/
|
||||||
bool hypothesis_reducer::is_ancestor(proof *p, proof *q) {
|
bool hypothesis_reducer::is_ancestor(proof *p, proof *q) {
|
||||||
if (p == q) return true;
|
if (p == q) return true;
|
||||||
ptr_vector<proof> todo;
|
ptr_vector<proof> todo;
|
||||||
todo.push_back(q);
|
todo.push_back(q);
|
||||||
|
@ -315,9 +315,9 @@ bool hypothesis_reducer::is_ancestor(proof *p, proof *q) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
proof* hypothesis_reducer::reduce_core(proof* pf) {
|
proof* hypothesis_reducer::reduce_core(proof* pf) {
|
||||||
SASSERT(m.is_false(m.get_fact(pf)));
|
SASSERT(m.is_false(m.get_fact(pf)));
|
||||||
|
|
||||||
proof *res = NULL;
|
proof *res = NULL;
|
||||||
|
@ -417,9 +417,9 @@ proof* hypothesis_reducer::reduce_core(proof* pf) {
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
proof* hypothesis_reducer::mk_lemma_core(proof* premise, expr *fact) {
|
proof* hypothesis_reducer::mk_lemma_core(proof* premise, expr *fact) {
|
||||||
SASSERT(m.is_false(m.get_fact(premise)));
|
SASSERT(m.is_false(m.get_fact(premise)));
|
||||||
SASSERT(m_active_hyps.contains(premise));
|
SASSERT(m_active_hyps.contains(premise));
|
||||||
|
|
||||||
|
@ -453,9 +453,9 @@ proof* hypothesis_reducer::mk_lemma_core(proof* premise, expr *fact) {
|
||||||
res = m.mk_lemma(premise, lemma);
|
res = m.mk_lemma(premise, lemma);
|
||||||
m_pinned.push_back(res);
|
m_pinned.push_back(res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
proof* hypothesis_reducer::mk_unit_resolution_core(proof *ures,
|
proof* hypothesis_reducer::mk_unit_resolution_core(proof *ures,
|
||||||
ptr_buffer<proof>& args) {
|
ptr_buffer<proof>& args) {
|
||||||
// if any literal is false, we don't need a unit resolution step
|
// if any literal is false, we don't need a unit resolution step
|
||||||
// This can be the case due to some previous transformations
|
// This can be the case due to some previous transformations
|
||||||
|
@ -533,9 +533,9 @@ proof* hypothesis_reducer::mk_unit_resolution_core(proof *ures,
|
||||||
m_pinned.push_back(res);
|
m_pinned.push_back(res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
proof* hypothesis_reducer::mk_proof_core(proof* old, ptr_buffer<proof>& args) {
|
proof* hypothesis_reducer::mk_proof_core(proof* old, ptr_buffer<proof>& args) {
|
||||||
// if any of the literals are false, we don't need a step
|
// if any of the literals are false, we don't need a step
|
||||||
for (unsigned i = 0; i < args.size(); ++i) {
|
for (unsigned i = 0; i < args.size(); ++i) {
|
||||||
if (m.is_false(m.get_fact(args[i]))) {
|
if (m.is_false(m.get_fact(args[i]))) {
|
||||||
|
@ -555,6 +555,6 @@ proof* hypothesis_reducer::mk_proof_core(proof* old, ptr_buffer<proof>& args) {
|
||||||
(expr * const*)args.c_ptr());
|
(expr * const*)args.c_ptr());
|
||||||
m_pinned.push_back(res);
|
m_pinned.push_back(res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue