fix(library/blast/state): inactive hypotheses should be printed "after" active ones
This commit is contained in:
parent
2a454ce791
commit
f2d4e81889
2 changed files with 17 additions and 3 deletions
|
@ -517,9 +517,21 @@ struct hypothesis_dep_depth_lt {
|
||||||
bool operator()(unsigned hidx1, unsigned hidx2) const {
|
bool operator()(unsigned hidx1, unsigned hidx2) const {
|
||||||
hypothesis const & h1 = m_state.get_hypothesis_decl(hidx1);
|
hypothesis const & h1 = m_state.get_hypothesis_decl(hidx1);
|
||||||
hypothesis const & h2 = m_state.get_hypothesis_decl(hidx2);
|
hypothesis const & h2 = m_state.get_hypothesis_decl(hidx2);
|
||||||
return
|
bool act1 = m_state.is_active(hidx1);
|
||||||
h1.get_dep_depth() < h2.get_dep_depth() &&
|
bool act2 = m_state.is_active(hidx2);
|
||||||
(h1.get_dep_depth() == h2.get_dep_depth() && hidx1 < hidx2);
|
if (act1 != act2) {
|
||||||
|
return act1 && !act2; // active hypotheses should occur before non-active ones
|
||||||
|
} else if (act1) {
|
||||||
|
lean_assert(act1 && act2);
|
||||||
|
if (h1.get_dep_depth() != h2.get_dep_depth())
|
||||||
|
return h1.get_dep_depth() < h2.get_dep_depth();
|
||||||
|
else
|
||||||
|
return hidx1 < hidx2;
|
||||||
|
} else {
|
||||||
|
// for inactive hypotheses we just compare hidx's
|
||||||
|
lean_assert(!act1 && !act2);
|
||||||
|
return hidx1 < hidx2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -301,6 +301,8 @@ public:
|
||||||
optional<hypothesis_idx> select_hypothesis_to_activate();
|
optional<hypothesis_idx> select_hypothesis_to_activate();
|
||||||
void activate_hypothesis(hypothesis_idx hidx);
|
void activate_hypothesis(hypothesis_idx hidx);
|
||||||
|
|
||||||
|
bool is_active(hypothesis_idx hidx) const { return m_branch.m_active.contains(hidx); }
|
||||||
|
|
||||||
/** \brief Deactivate all active hypotheses */
|
/** \brief Deactivate all active hypotheses */
|
||||||
void deactivate_all();
|
void deactivate_all();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue