3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-18 02:16:40 +00:00

Use nullptr.

This commit is contained in:
Bruce Mitchener 2018-02-12 14:05:55 +07:00
parent f01328c65f
commit 76eb7b9ede
625 changed files with 4639 additions and 4639 deletions

View file

@ -199,7 +199,7 @@ namespace Duality {
lbool interpolate_tree(TermTree *assumptions,
TermTree *&interpolants,
model &_model,
TermTree *goals = 0,
TermTree *goals = nullptr,
bool weak = false
) = 0;
@ -247,7 +247,7 @@ namespace Duality {
lbool interpolate_tree(TermTree *assumptions,
TermTree *&interpolants,
model &_model,
TermTree *goals = 0,
TermTree *goals = nullptr,
bool weak = false) override
{
literals _labels;
@ -393,7 +393,7 @@ namespace Duality {
edgeCount = 0;
stack.push_back(stack_entry());
HornClauses = false;
proof_core = 0;
proof_core = nullptr;
}
virtual ~RPFP();
@ -494,7 +494,7 @@ namespace Duality {
unsigned recursion_bound;
Node(const FuncDecl &_Name, const Transformer &_Annotation, const Transformer &_Bound, const Transformer &_Underapprox, const Term &_dual, RPFP *_owner, int _number)
: Name(_Name), Annotation(_Annotation), Bound(_Bound), Underapprox(_Underapprox), dual(_dual) {owner = _owner; number = _number; Outgoing = 0; recursion_bound = UINT_MAX;}
: Name(_Name), Annotation(_Annotation), Bound(_Bound), Underapprox(_Underapprox), dual(_dual) {owner = _owner; number = _number; Outgoing = nullptr; recursion_bound = UINT_MAX;}
};
/** Create a node in the graph. The input is a term R(v_1...v_n)
@ -591,7 +591,7 @@ namespace Duality {
/** Delete a hyper-edge and unlink it from any nodes. */
void DeleteEdge(Edge *edge){
if(edge->Parent)
edge->Parent->Outgoing = 0;
edge->Parent->Outgoing = nullptr;
for(unsigned int i = 0; i < edge->Children.size(); i++){
std::vector<Edge *> &ic = edge->Children[i]->Incoming;
for(std::vector<Edge *>::iterator it = ic.begin(), en = ic.end(); it != en; ++it){
@ -705,7 +705,7 @@ namespace Duality {
/** Get the constraint tree (but don't solve it) */
TermTree *GetConstraintTree(Node *root, Node *skip_descendant = 0);
TermTree *GetConstraintTree(Node *root, Node *skip_descendant = nullptr);
/** Dispose of the dual model (counterexample) if there is one. */
@ -715,7 +715,7 @@ namespace Duality {
* Solve, except no primal solution (interpolant) is generated in the unsat case. */
check_result Check(Node *root, std::vector<Node *> underapproxes = std::vector<Node *>(),
std::vector<Node *> *underapprox_core = 0);
std::vector<Node *> *underapprox_core = nullptr);
/** Update the model, attempting to make the propositional literals in assumps true. If possible,
return sat, else return unsat and keep the old model. */
@ -841,7 +841,7 @@ namespace Duality {
#ifdef _WINDOWS
__declspec(dllexport)
#endif
void FromClauses(const std::vector<Term> &clauses, const std::vector<unsigned> *bounds = 0);
void FromClauses(const std::vector<Term> &clauses, const std::vector<unsigned> *bounds = nullptr);
void FromFixpointContext(fixedpoint fp, std::vector<Term> &queries);
@ -927,7 +927,7 @@ namespace Duality {
void ClearProofCore(){
if(proof_core)
delete proof_core;
proof_core = 0;
proof_core = nullptr;
}
Term SuffixVariable(const Term &t, int n);
@ -944,7 +944,7 @@ namespace Duality {
Term ReducedDualEdge(Edge *e);
TermTree *ToTermTree(Node *root, Node *skip_descendant = 0);
TermTree *ToTermTree(Node *root, Node *skip_descendant = nullptr);
TermTree *ToGoalTree(Node *root);
@ -1096,12 +1096,12 @@ namespace Duality {
virtual void slvr_push();
virtual check_result slvr_check(unsigned n = 0, expr * const assumptions = 0, unsigned *core_size = 0, expr *core = 0);
virtual check_result slvr_check(unsigned n = 0, expr * const assumptions = nullptr, unsigned *core_size = nullptr, expr *core = nullptr);
virtual lbool ls_interpolate_tree(TermTree *assumptions,
TermTree *&interpolants,
model &_model,
TermTree *goals = 0,
TermTree *goals = nullptr,
bool weak = false);
virtual bool proof_core_contains(const expr &e);
@ -1121,8 +1121,8 @@ namespace Duality {
RPFP::Node *root;
public:
Counterexample(){
tree = 0;
root = 0;
tree = nullptr;
root = nullptr;
}
Counterexample(RPFP *_tree, RPFP::Node *_root){
tree = _tree;
@ -1142,7 +1142,7 @@ namespace Duality {
}
void clear(){
if(tree) delete tree;
tree = 0;
tree = nullptr;
}
RPFP *get_tree() const {return tree;}
RPFP::Node *get_root() const {return root;}
@ -1313,7 +1313,7 @@ namespace Duality {
void GetAssumptionLits(const expr &fmla, std::vector<expr> &lits, hash_map<ast,expr> *opt_map = 0);
void GetAssumptionLits(const expr &fmla, std::vector<expr> &lits, hash_map<ast,expr> *opt_map = nullptr);
void GreedyReduceCache(std::vector<expr> &assumps, std::vector<expr> &core);
@ -1326,12 +1326,12 @@ namespace Duality {
void slvr_push() override;
check_result slvr_check(unsigned n = 0, expr * const assumptions = 0, unsigned *core_size = 0, expr *core = 0) override;
check_result slvr_check(unsigned n = 0, expr * const assumptions = nullptr, unsigned *core_size = nullptr, expr *core = nullptr) override;
lbool ls_interpolate_tree(TermTree *assumptions,
TermTree *&interpolants,
model &_model,
TermTree *goals = 0,
TermTree *goals = nullptr,
bool weak = false) override;
bool proof_core_contains(const expr &e) override;

2
src/duality/duality_profiling.cpp Executable file → Normal file
View file

@ -55,7 +55,7 @@ namespace Duality {
node::node(){
time = 0;
parent = 0;
parent = nullptr;
}
struct node *current;

14
src/duality/duality_rpfp.cpp Executable file → Normal file
View file

@ -1345,8 +1345,8 @@ namespace Duality {
{
timer_start("Solve");
TermTree *tree = GetConstraintTree(root);
TermTree *interpolant = NULL;
TermTree *goals = NULL;
TermTree *interpolant = nullptr;
TermTree *goals = nullptr;
if(ls->need_goals)
goals = GetGoalTree(root);
ClearProofCore();
@ -1396,11 +1396,11 @@ namespace Duality {
timer_start("Solve");
TermTree *tree = CollapseTermTree(GetConstraintTree(root,node));
tree->getChildren().push_back(CollapseTermTree(ToTermTree(node)));
TermTree *interpolant = NULL;
TermTree *interpolant = nullptr;
ClearProofCore();
timer_start("interpolate_tree");
lbool res = ls_interpolate_tree(tree, interpolant, dualModel,0,true);
lbool res = ls_interpolate_tree(tree, interpolant, dualModel,nullptr,true);
timer_stop("interpolate_tree");
if (res == l_false) {
DecodeTree(node, interpolant->getChildren()[0], 0);
@ -1423,7 +1423,7 @@ namespace Duality {
void RPFP::DisposeDualModel()
{
dualModel = model(ctx,NULL);
dualModel = model(ctx,nullptr);
}
RPFP::Term RPFP::UnderapproxFlag(Node *n){
@ -3281,9 +3281,9 @@ namespace Duality {
{
stack_entry &back = stack.back();
for(std::list<Edge *>::iterator it = back.edges.begin(), en = back.edges.end(); it != en; ++it)
(*it)->dual = expr(ctx,NULL);
(*it)->dual = expr(ctx,nullptr);
for(std::list<Node *>::iterator it = back.nodes.begin(), en = back.nodes.end(); it != en; ++it)
(*it)->dual = expr(ctx,NULL);
(*it)->dual = expr(ctx,nullptr);
for(std::list<std::pair<Edge *,Term> >::iterator it = back.constraints.begin(), en = back.constraints.end(); it != en; ++it)
(*it).first->constraints.pop_back();
stack.pop_back();

View file

@ -126,10 +126,10 @@ namespace Duality {
edges(_rpfp->edges)
{
rpfp = _rpfp;
reporter = 0;
conj_reporter = 0;
heuristic = 0;
unwinding = 0;
reporter = nullptr;
conj_reporter = nullptr;
heuristic = nullptr;
unwinding = nullptr;
FullExpand = false;
NoConj = false;
FeasibleEdges = true;
@ -330,7 +330,7 @@ namespace Duality {
void PreSolve(){
reporter = Report ? CreateStdoutReporter(rpfp) : new Reporter(rpfp);
conj_reporter = ConjectureFile.empty() ? 0 : CreateConjectureFileReporter(rpfp,ConjectureFile);
conj_reporter = ConjectureFile.empty() ? nullptr : CreateConjectureFileReporter(rpfp,ConjectureFile);
#ifndef LOCALIZE_CONJECTURES
heuristic = !cex.get_tree() ? new Heuristic(rpfp) : new ReplayHeuristic(rpfp,cex);
#else
@ -524,7 +524,7 @@ namespace Duality {
node->Annotation.SetFull(); // allow this node to cover others
else
updated_nodes.insert(node);
e->map = 0;
e->map = nullptr;
reporter->Extend(node);
#ifdef EARLY_EXPAND
if(!do_not_expand)
@ -537,7 +537,7 @@ namespace Duality {
node->Annotation.SetFull();
Edge *e = unwinding->CreateLowerBoundEdge(node);
overapproxes.insert(node);
e->map = 0;
e->map = nullptr;
}
/** We start the unwinding with leaves that under-approximate
@ -1144,14 +1144,14 @@ namespace Duality {
Edge *e = unwinding->CreateLowerBoundEdge(under_node);
under_node->Annotation.SetFull(); // allow this node to cover others
back_edges[under_node] = back_edges[node];
e->map = 0;
e->map = nullptr;
reporter->Extend(under_node);
return under_node;
}
/** Try to prove a conjecture about a node. If successful
update the unwinding annotation appropriately. */
bool ProveConjecture(Node *node, const RPFP::Transformer &t,Node *other = 0, Counterexample *_cex = 0){
bool ProveConjecture(Node *node, const RPFP::Transformer &t,Node *other = nullptr, Counterexample *_cex = nullptr){
reporter->Conjecture(node,t);
timer_start("ProveConjecture");
RPFP::Transformer save = node->Bound;
@ -1245,7 +1245,7 @@ namespace Duality {
marker_disjunction = marker_disjunction || marker;
}
bool GenNodeSolutionWithMarkers(Node *node, RPFP::Transformer &annot, bool expanded_only = false, Node *other_node = 0){
bool GenNodeSolutionWithMarkers(Node *node, RPFP::Transformer &annot, bool expanded_only = false, Node *other_node = nullptr){
bool res = false;
annot.SetFull();
expr marker_disjunction = ctx.bool_val(false);
@ -1267,14 +1267,14 @@ namespace Duality {
Node *root = checker->CloneNode(edge->Parent);
GenNodeSolutionFromIndSet(edge->Parent, root->Bound);
if(root->Bound.IsFull())
return 0;
return nullptr;
checker->AssertNode(root);
std::vector<Node *> cs;
for(unsigned j = 0; j < edge->Children.size(); j++){
Node *oc = edge->Children[j];
Node *nc = checker->CloneNode(oc);
if(!GenNodeSolutionWithMarkers(oc,nc->Annotation,expanded_only))
return 0;
return nullptr;
Edge *e = checker->CreateLowerBoundEdge(nc);
checker->AssertEdge(e);
cs.push_back(nc);
@ -1873,7 +1873,7 @@ namespace Duality {
mode.
*/
bool Derive(RPFP *rpfp, RPFP::Node *root, bool _underapprox, bool _constrained = false, RPFP *_tree = 0){
bool Derive(RPFP *rpfp, RPFP::Node *root, bool _underapprox, bool _constrained = false, RPFP *_tree = nullptr){
underapprox = _underapprox;
constrained = _constrained;
false_approx = true;
@ -2608,7 +2608,7 @@ namespace Duality {
bool dominated;
std::set<Node *> dominates;
cover_info(){
covered_by = 0;
covered_by = nullptr;
dominated = false;
}
};
@ -2708,7 +2708,7 @@ namespace Duality {
for(std::vector<Node *>::iterator it = cs.begin(), en = cs.end(); it != en; it++){
Node *other = *it;
if(covered_by(other) && CoverOrder(node,other)){
covered_by(other) = 0;
covered_by(other) = nullptr;
reporter()->RemoveCover(*it,node);
}
}
@ -2934,7 +2934,7 @@ namespace Duality {
#else
Node *GetSimilarNode(Node *node){
if(!some_updates)
return 0;
return nullptr;
std::vector<Node *> &insts = insts_of_node(node->map);
for(int i = insts.size() - 1; i >= 0; i--){
Node *other = insts[i];
@ -2942,19 +2942,19 @@ namespace Duality {
&& !IsCovered(other))
return other;
}
return 0;
return nullptr;
}
#endif
bool Dominates(Node * node, Node *other){
if(node == other) return false;
if(other->Outgoing->map == 0) return true;
if(other->Outgoing->map == nullptr) return true;
if(node->Outgoing->map == other->Outgoing->map){
assert(node->Outgoing->Children.size() == other->Outgoing->Children.size());
for(unsigned i = 0; i < node->Outgoing->Children.size(); i++){
Node *nc = node->Outgoing->Children[i];
Node *oc = other->Outgoing->Children[i];
if(!(nc == oc || oc->Outgoing->map ==0 || dominates(nc,oc)))
if(!(nc == oc || oc->Outgoing->map ==nullptr || dominates(nc,oc)))
return false;
}
return true;
@ -3088,7 +3088,7 @@ namespace Duality {
LocalHeuristic(RPFP *_rpfp)
: Heuristic(_rpfp)
{
old_node = 0;
old_node = nullptr;
}
void SetOldNode(RPFP::Node *_old_node){
@ -3100,7 +3100,7 @@ namespace Duality {
hash_map<Node *, Node*> cex_map;
void ChooseExpand(const std::set<RPFP::Node *> &choices, std::set<RPFP::Node *> &best, bool, bool) override {
if(old_node == 0){
if(old_node == nullptr){
Heuristic::ChooseExpand(choices,best);
return;
}

16
src/duality/duality_wrapper.cpp Executable file → Normal file
View file

@ -111,7 +111,7 @@ namespace Duality {
}
expr context::mki(family_id fid, ::decl_kind dk, int n, ::expr **args){
return cook(m().mk_app(fid, dk, 0, 0, n, (::expr **)args));
return cook(m().mk_app(fid, dk, 0, nullptr, n, (::expr **)args));
}
expr context::make(decl_kind op, const std::vector<expr> &args){
@ -120,11 +120,11 @@ namespace Duality {
a.resize(args.size());
for(unsigned i = 0; i < args.size(); i++)
a[i] = to_expr(args[i].raw());
return make(op,args.size(), args.size() ? VEC2PTR(a) : 0);
return make(op,args.size(), args.size() ? VEC2PTR(a) : nullptr);
}
expr context::make(decl_kind op){
return make(op,0,0);
return make(op,0,nullptr);
}
expr context::make(decl_kind op, const expr &arg0){
@ -173,8 +173,8 @@ namespace Duality {
0,
::symbol(),
::symbol(),
0, 0,
0, 0
0, nullptr,
0, nullptr
);
return cook(result.get());
}
@ -199,8 +199,8 @@ namespace Duality {
0,
::symbol(),
::symbol(),
0, 0,
0, 0
0, nullptr,
0, nullptr
);
return cook(result.get());
}
@ -422,7 +422,7 @@ namespace Duality {
func_decl context::fresh_func_decl(char const * prefix, sort const & range){
::func_decl* d = m().mk_fresh_func_decl(prefix,
0,
0,
nullptr,
to_sort(range.raw()));
return func_decl(*this,d);
}

View file

@ -276,7 +276,7 @@ namespace Duality {
protected:
context * m_ctx;
public:
object(): m_ctx((context *)0) {}
object(): m_ctx((context *)nullptr) {}
object(context & c):m_ctx(&c) {}
object(object const & s):m_ctx(s.m_ctx) {}
context & ctx() const { return *m_ctx; }
@ -317,9 +317,9 @@ namespace Duality {
::ast *_ast;
public:
::ast * const &raw() const {return _ast;}
ast_i(context & c, ::ast *a = 0) : object(c) {_ast = a;}
ast_i(context & c, ::ast *a = nullptr) : object(c) {_ast = a;}
ast_i(){_ast = 0;}
ast_i(){_ast = nullptr;}
bool eq(const ast_i &other) const {
return _ast == other._ast;
}
@ -346,7 +346,7 @@ namespace Duality {
friend bool eq(ast const & a, ast const & b) { return a.raw() == b.raw(); }
ast(context &c, ::ast *a = 0) : ast_i(c,a) {
ast(context &c, ::ast *a = nullptr) : ast_i(c,a) {
if(_ast)
m().inc_ref(a);
}
@ -729,7 +729,7 @@ namespace Duality {
m_model = m;
}
public:
model(context & c, ::model * m = 0):object(c), m_model(m) { }
model(context & c, ::model * m = nullptr):object(c), m_model(m) { }
model(model const & s):object(s), m_model(s.m_model) { }
~model() { }
operator ::model *() const { return m_model.get(); }
@ -869,28 +869,28 @@ namespace Duality {
check_result check() {
scoped_proof_mode spm(m(),m_mode);
checkpoint();
lbool r = m_solver->check_sat(0,0);
lbool r = m_solver->check_sat(0,nullptr);
model_ref m;
m_solver->get_model(m);
the_model = m.get();
return to_check_result(r);
}
check_result check_keep_model(unsigned n, expr * const assumptions, unsigned *core_size = 0, expr *core = 0) {
check_result check_keep_model(unsigned n, expr * const assumptions, unsigned *core_size = nullptr, expr *core = nullptr) {
scoped_proof_mode spm(m(),m_mode);
model old_model(the_model);
check_result res = check(n,assumptions,core_size,core);
if(the_model == 0)
if(the_model == nullptr)
the_model = old_model;
return res;
}
check_result check(unsigned n, expr * const assumptions, unsigned *core_size = 0, expr *core = 0) {
check_result check(unsigned n, expr * const assumptions, unsigned *core_size = nullptr, expr *core = nullptr) {
scoped_proof_mode spm(m(),m_mode);
checkpoint();
std::vector< ::expr *> _assumptions(n);
for (unsigned i = 0; i < n; i++) {
_assumptions[i] = to_expr(assumptions[i]);
}
the_model = 0;
the_model = nullptr;
lbool r = m_solver->check_sat(n, VEC2PTR(_assumptions));
if(core_size && core){
@ -1228,7 +1228,7 @@ namespace Duality {
return operator()(args.size(), VEC2PTR(args));
}
inline expr func_decl::operator()() const {
return operator()(0,0);
return operator()(0,nullptr);
}
inline expr func_decl::operator()(expr const & a) const {
return operator()(1,&a);
@ -1413,7 +1413,7 @@ namespace Duality {
template <class X> class uptr {
public:
X *ptr;
uptr(){ptr = 0;}
uptr(){ptr = nullptr;}
void set(X *_ptr){
if(ptr) delete ptr;
ptr = _ptr;