Skip to content

Commit

Permalink
add comments to elim_unconstrained and remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Nov 13, 2022
1 parent efbe0a6 commit 9d09064
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/ast/simplifiers/elim_unconstrained.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ void elim_unconstrained::eliminate() {
}
}

void elim_unconstrained::add_term(expr* t) {
expr_ref_vector terms(m);
terms.push_back(t);
init_terms(terms);
}

expr* elim_unconstrained::get_parent(unsigned n) const {
for (expr* p : get_node(n).m_parents)
if (get_node(p).m_refcount > 0 && get_node(p).m_term == get_node(p).m_orig)
Expand All @@ -128,20 +122,23 @@ void elim_unconstrained::init_nodes() {
terms.push_back(m_fmls[i].fml());
m_trail.append(terms);
m_heap.reset();
m_frozen.reset();

// initialize nodes for terms in the original goal
init_terms(terms);

// top-level terms have reference count > 0
for (expr* e : terms)
inc_ref(e);

// freeze subterms before the head.
// freeze subterms before the already processed head
terms.reset();
for (unsigned i = 0; i < m_qhead; ++i)
terms.push_back(m_fmls[i].fml());
for (expr* e : subterms::all(terms))
m_frozen.mark(e, true);


// freeze subterms that occur with recursive function definitions
recfun::util rec(m);
if (rec.has_rec_defs()) {
for (func_decl* f : rec.get_rec_funs()) {
Expand All @@ -152,6 +149,9 @@ void elim_unconstrained::init_nodes() {
}
}

/**
* Create nodes for all terms in the goal
*/
void elim_unconstrained::init_terms(expr_ref_vector const& terms) {
unsigned max_id = 0;
for (expr* e : subterms::all(terms))
Expand Down
4 changes: 0 additions & 4 deletions src/ast/simplifiers/elim_unconstrained.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,10 @@ class elim_unconstrained : public dependent_expr_simplifier {
void inc_ref(expr* t) { ++get_node(t).m_refcount; if (is_uninterp_const(t)) m_heap.increased(t->get_id()); }
void dec_ref(expr* t) { --get_node(t).m_refcount; if (is_uninterp_const(t)) m_heap.decreased(t->get_id()); }
void gc(expr* t);

expr* get_parent(unsigned n) const;
void init_refcounts();
void dec_refcounts(expr* t);

void add_term(expr* t);
void init_terms(expr_ref_vector const& terms);

void init_nodes();
void eliminate();
void reconstruct_terms();
Expand Down

0 comments on commit 9d09064

Please sign in to comment.