mirror of
https://github.com/Z3Prover/z3
synced 2025-08-31 23:34:55 +00:00
Reorganizing the code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
2b8fb6c718
commit
492484c5aa
125 changed files with 632 additions and 390 deletions
114
src/framework/der_tactic.cpp
Normal file
114
src/framework/der_tactic.cpp
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
der_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
DER tactic
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-10-20
|
||||
|
||||
--*/
|
||||
#include"der.h"
|
||||
#include"tactical.h"
|
||||
|
||||
class der_tactic : public tactic {
|
||||
struct imp {
|
||||
ast_manager & m_manager;
|
||||
der_rewriter m_r;
|
||||
|
||||
imp(ast_manager & m):
|
||||
m_manager(m),
|
||||
m_r(m) {
|
||||
}
|
||||
|
||||
ast_manager & m() const { return m_manager; }
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_r.set_cancel(f);
|
||||
}
|
||||
|
||||
void reset() {
|
||||
m_r.reset();
|
||||
}
|
||||
|
||||
void operator()(goal & g) {
|
||||
SASSERT(g.is_well_sorted());
|
||||
bool proofs_enabled = g.proofs_enabled();
|
||||
tactic_report report("der", g);
|
||||
TRACE("before_der", g.display(tout););
|
||||
expr_ref new_curr(m());
|
||||
proof_ref new_pr(m());
|
||||
unsigned size = g.size();
|
||||
for (unsigned idx = 0; idx < size; idx++) {
|
||||
if (g.inconsistent())
|
||||
break;
|
||||
expr * curr = g.form(idx);
|
||||
m_r(curr, new_curr, new_pr);
|
||||
if (proofs_enabled) {
|
||||
proof * pr = g.pr(idx);
|
||||
new_pr = m().mk_modus_ponens(pr, new_pr);
|
||||
}
|
||||
g.update(idx, new_curr, new_pr, g.dep(idx));
|
||||
}
|
||||
g.elim_redundancies();
|
||||
TRACE("after_der", g.display(tout););
|
||||
SASSERT(g.is_well_sorted());
|
||||
}
|
||||
};
|
||||
|
||||
imp * m_imp;
|
||||
|
||||
public:
|
||||
der_tactic(ast_manager & m) {
|
||||
m_imp = alloc(imp, m);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
return alloc(der_tactic, m);
|
||||
}
|
||||
|
||||
virtual ~der_tactic() {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
mc = 0; pc = 0; core = 0;
|
||||
(*m_imp)(*(in.get()));
|
||||
in->inc_depth();
|
||||
result.push_back(in.get());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
ast_manager & m = m_imp->m();
|
||||
imp * d = m_imp;
|
||||
#pragma omp critical (tactic_cancel)
|
||||
{
|
||||
m_imp = 0;
|
||||
}
|
||||
dealloc(d);
|
||||
d = alloc(imp, m);
|
||||
#pragma omp critical (tactic_cancel)
|
||||
{
|
||||
m_imp = d;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_der_tactic(ast_manager & m) {
|
||||
return alloc(der_tactic, m);
|
||||
}
|
25
src/framework/der_tactic.h
Normal file
25
src/framework/der_tactic.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
der_tactic.h
|
||||
|
||||
Abstract:
|
||||
|
||||
DER tactic
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-10-20
|
||||
|
||||
--*/
|
||||
#ifndef _DER_TACTIC_H_
|
||||
#define _DER_TACTIC_H_
|
||||
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
tactic * mk_der_tactic(ast_manager & m);
|
||||
|
||||
#endif /* _DER_TACTIC_H_ */
|
27
src/framework/num_occurs_goal.cpp
Normal file
27
src/framework/num_occurs_goal.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
num_occurs_goal.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-10-20.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"num_occurs_goal.h"
|
||||
#include"goal.h"
|
||||
|
||||
void num_occurs_goal::operator()(goal const & g) {
|
||||
expr_fast_mark1 visited;
|
||||
unsigned sz = g.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
process(g.form(i), visited);
|
||||
}
|
||||
}
|
35
src/framework/num_occurs_goal.h
Normal file
35
src/framework/num_occurs_goal.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
num_occurs_goal.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-10-20.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _NUM_OCCURS_GOAL_H_
|
||||
#define _NUM_OCCURS_GOAL_H_
|
||||
|
||||
#include"num_occurs.h"
|
||||
|
||||
class goal;
|
||||
|
||||
class num_occurs_goal : public num_occurs {
|
||||
public:
|
||||
num_occurs_goal(bool ignore_ref_count1 = false, bool ignore_quantifiers = false):
|
||||
num_occurs(ignore_ref_count1, ignore_quantifiers) {
|
||||
}
|
||||
|
||||
void operator()(goal const & s);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue