feat(library/blast/backward/backward_action): display lemma name in backward action

This commit is contained in:
Leonardo de Moura 2015-12-09 11:07:53 -08:00
parent 1b80dc0df6
commit f9a669665a
2 changed files with 15 additions and 10 deletions

View file

@ -94,12 +94,13 @@ static action_result try_lemma(gexpr const & e, bool prop_only_branches) {
} }
class backward_choice_point_cell : public choice_point_cell { class backward_choice_point_cell : public choice_point_cell {
state m_state; char const * m_action_name;
list<gexpr> m_lemmas; state m_state;
bool m_prop_only; list<gexpr> m_lemmas;
bool m_prop_only;
public: public:
backward_choice_point_cell(state const & s, list<gexpr> const & lemmas, bool prop_only): backward_choice_point_cell(char const * a, state const & s, list<gexpr> const & lemmas, bool prop_only):
m_state(s), m_lemmas(lemmas), m_prop_only(prop_only) {} m_action_name(a), m_state(s), m_lemmas(lemmas), m_prop_only(prop_only) {}
virtual action_result next() { virtual action_result next() {
while (!empty(m_lemmas)) { while (!empty(m_lemmas)) {
@ -107,8 +108,10 @@ public:
gexpr lemma = head(m_lemmas); gexpr lemma = head(m_lemmas);
m_lemmas = tail(m_lemmas); m_lemmas = tail(m_lemmas);
action_result r = try_lemma(lemma, m_prop_only); action_result r = try_lemma(lemma, m_prop_only);
if (!failed(r)) if (!failed(r)) {
lean_trace(name({"blast", "action"}), tout() << m_action_name << " (next) " << lemma << "\n";);
return r; return r;
}
} }
return action_result::failed(); return action_result::failed();
} }
@ -118,13 +121,14 @@ action_result backward_action_core(list<gexpr> const & lemmas, bool prop_only_br
state s = curr_state(); state s = curr_state();
auto it = lemmas; auto it = lemmas;
while (!empty(it)) { while (!empty(it)) {
action_result r = try_lemma(head(it), prop_only_branches); gexpr H = head(it);
action_result r = try_lemma(H, prop_only_branches);
it = tail(it); it = tail(it);
if (!failed(r)) { if (!failed(r)) {
// create choice point // create choice point
if (!cut && !empty(it)) if (!cut && !empty(it))
push_choice_point(choice_point(new backward_choice_point_cell(s, it, prop_only_branches))); push_choice_point(choice_point(new backward_choice_point_cell(action_name, s, it, prop_only_branches)));
trace_action(action_name); lean_trace(name({"blast", "action"}), tout() << action_name << " " << H << "\n";);
return r; return r;
} }
curr_state() = s; curr_state() = s;

View file

@ -6,6 +6,7 @@ Author: Leonardo de Moura
*/ */
#include "library/blast/gexpr.h" #include "library/blast/gexpr.h"
#include "library/blast/blast.h" #include "library/blast/blast.h"
#include "library/blast/trace.h"
namespace lean { namespace lean {
namespace blast { namespace blast {
@ -36,7 +37,7 @@ std::ostream & operator<<(std::ostream & out, gexpr const & ge) {
} }
io_state_stream const & operator<<(io_state_stream const & out, gexpr const & ge) { io_state_stream const & operator<<(io_state_stream const & out, gexpr const & ge) {
out << ge.m_expr; out << ppb(ge.m_expr);
if (ge.is_universe_polymorphic()) out << " (poly)"; if (ge.is_universe_polymorphic()) out << " (poly)";
return out; return out;
} }