refactor(assumption_justification): move to the kernel

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-10-26 14:21:29 -07:00
parent 4bed9f85b0
commit eaccdcb558
5 changed files with 22 additions and 27 deletions

View file

@ -39,6 +39,13 @@ bool justification::has_children() const {
return !r.empty();
}
assumption_justification::assumption_justification(unsigned idx):m_idx(idx) {}
void assumption_justification::get_children(buffer<justification_cell*> &) const {}
expr const & assumption_justification::get_main_expr() const { return expr::null(); }
format assumption_justification::pp_header(formatter const &, options const &) const {
return format{format("assumption"), space(), format(m_idx)};
}
bool depends_on(justification const & t, justification const & d) {
buffer<justification_cell *> todo;
buffer<justification_cell *> children;

View file

@ -37,6 +37,18 @@ public:
bool is_shared() const { return get_rc() > 1; }
};
/**
\brief Base class for justification objects used to justify case-splits.
*/
class assumption_justification : public justification_cell {
unsigned m_idx;
public:
assumption_justification(unsigned idx);
virtual void get_children(buffer<justification_cell*> &) const;
virtual expr const & get_main_expr() const;
virtual format pp_header(formatter const &, options const &) const;
};
/**
\brief Smart pointer for justification_cell's
*/
@ -66,6 +78,8 @@ public:
bool has_children() const;
};
inline justification mk_assumption_justification(unsigned idx) { return justification(new assumption_justification(idx)); }
/**
\brief Return true iff \c t depends on \c d.
That is \c t is a descendant of \c d.

View file

@ -164,7 +164,7 @@ class elaborator::imp {
justification mk_assumption() {
unsigned id = m_next_id;
m_next_id++;
return justification(new assumption_justification(id));
return mk_assumption_justification(id);
}
/** \brief Add given constraint to the front of the current constraint queue */

View file

@ -18,20 +18,6 @@ static void append(buffer<justification_cell*> & r, T const & s) {
push_back(r, t);
}
// -------------------------
// Assumptions
// -------------------------
assumption_justification::assumption_justification(unsigned idx):m_idx(idx) {
}
void assumption_justification::get_children(buffer<justification_cell*> &) const {
}
expr const & assumption_justification::get_main_expr() const {
return expr::null();
}
format assumption_justification::pp_header(formatter const &, options const &) const {
return format{format("assumption"), space(), format(m_idx)};
}
// -------------------------
// Propagation justification
// -------------------------

View file

@ -9,18 +9,6 @@ Author: Leonardo de Moura
#include "kernel/unification_constraint.h"
namespace lean {
/**
\brief Base class for justification objects used to justify case-splits.
*/
class assumption_justification : public justification_cell {
unsigned m_idx;
public:
assumption_justification(unsigned idx);
virtual void get_children(buffer<justification_cell*> &) const;
virtual expr const & get_main_expr() const;
virtual format pp_header(formatter const &, options const &) const;
};
/**
\brief Base class for justifying propagations and failures
*/