Skip to content

Commit

Permalink
na
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Sep 2, 2020
1 parent 4b22434 commit 95493f7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
24 changes: 21 additions & 3 deletions src/sat/smt/sat_th.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Module Name:
Abstract:
Theory plugins
Theory plugin base classes
Author:
Expand All @@ -26,12 +26,30 @@ namespace euf {
ctx(ctx)
{}

theory_var th_euf_solver::mk_var(enode * n) {
SASSERT(!is_attached_to_var(n));
euf::theory_var v = m_var2enode.size();
m_var2enode.push_back(n);
return v;
}

bool th_euf_solver::is_attached_to_var(enode* n) const {
theory_var v = n->get_th_var(get_id());
return v != null_theory_var && get_enode(v) == n;
}

theory_var th_euf_solver::get_th_var(expr* e) const {
return get_th_var(ctx.get_enode(e));
}

void th_euf_solver::push() {
m_var2enode_lim.push_back(m_var2enode.size());
}



void th_euf_solver::pop(unsigned num_scopes) {
unsigned new_lvl = m_var2enode_lim.size() - num_scopes;
m_var2enode.shrink(m_var2enode_lim[new_lvl]);
m_var2enode_lim.shrink(new_lvl);
}

}
21 changes: 5 additions & 16 deletions src/sat/smt/sat_th.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,17 @@ namespace euf {
euf::enode_vector m_var2enode;
unsigned_vector m_var2enode_lim;
public:
th_euf_solver(euf::solver& ctx, euf::theory_id id);
virtual ~th_euf_solver() {}

th_euf_solver(euf::solver& ctx, euf::theory_id id);

virtual euf::theory_var mk_var(enode * n) {
SASSERT(!is_attached_to_var(n));
euf::theory_var v = m_var2enode.size();
m_var2enode.push_back(n);
return v;
}

virtual theory_var mk_var(enode * n);
unsigned get_num_vars() const { return m_var2enode.size();}
enode* get_enode(theory_var v) const { return m_var2enode[v]; }
expr* get_expr(theory_var v) const { return get_enode(v)->get_owner(); }
theory_var get_th_var(enode* n) const { return n->get_th_var(get_id()); }
theory_var get_th_var(expr* e) const;

bool is_attached_to_var(enode* n) const {
theory_var v = n->get_th_var(get_id());
return v != null_theory_var && get_enode(v) == n;
}

bool is_attached_to_var(enode* n) const;
void push() override;
void pop(unsigned n) override;
};


Expand Down

0 comments on commit 95493f7

Please sign in to comment.