diff --git a/src/frontends/lean/info_manager.cpp b/src/frontends/lean/info_manager.cpp index ea970df4cc..8d77cd067f 100644 --- a/src/frontends/lean/info_manager.cpp +++ b/src/frontends/lean/info_manager.cpp @@ -267,7 +267,15 @@ public: virtual bool is_cheap() const { return false; } virtual void display(io_state_stream const & ios, unsigned line) const { ios << "-- PROOF_STATE|" << line << "|" << get_column() << "\n"; - ios << m_ps << endl; + bool first = true; + substitution s = m_ps.get_subst(); + for (goal const & g : m_ps.get_goals()) { + if (first) + first = false; + else + ios << "--" << endl; + ios << g.instantiate(s) << endl; + } ios << "-- ACK" << endl; } }; diff --git a/src/library/tactic/goal.cpp b/src/library/tactic/goal.cpp index 12941d4db9..657a745df9 100644 --- a/src/library/tactic/goal.cpp +++ b/src/library/tactic/goal.cpp @@ -78,6 +78,11 @@ expr goal::mk_meta(name const & n, expr const & type) const { return copy_tag(m_meta, mk_app(mvar, locals)); } +goal goal::instantiate(substitution const & s) const { + substitution s1(s); + return goal(s1.instantiate_all(m_meta), s1.instantiate_all(m_type)); +} + static bool validate_locals(expr const & r, unsigned num_locals, expr const * locals) { bool failed = false; for_each(r, [&](expr const & e, unsigned) { @@ -122,6 +127,12 @@ list goal::to_context() const { return to_list(locals.begin(), locals.end()); } +io_state_stream const & operator<<(io_state_stream const & out, goal const & g) { + options const & opts = out.get_options(); + out.get_stream() << mk_pair(g.pp(out.get_formatter()), opts); + return out; +} + DECL_UDATA(goal) static int mk_goal(lua_State * L) { return push_goal(L, goal(to_expr(L, 1), to_expr(L, 2))); } diff --git a/src/library/tactic/goal.h b/src/library/tactic/goal.h index 46860541fd..f6570fc7c1 100644 --- a/src/library/tactic/goal.h +++ b/src/library/tactic/goal.h @@ -71,6 +71,9 @@ public: */ list to_context() const; + /** \brief Apply given substitution to goal */ + goal instantiate(substitution const & s) const; + format pp(formatter const & fmt, substitution const & s) const; format pp(formatter const & fmt) const; }; diff --git a/tests/lean/interactive/proof_state_info2.input.expected.out b/tests/lean/interactive/proof_state_info2.input.expected.out index 183ad29319..d3ef665dbe 100644 --- a/tests/lean/interactive/proof_state_info2.input.expected.out +++ b/tests/lean/interactive/proof_state_info2.input.expected.out @@ -24,6 +24,7 @@ c : Prop, Ha : a, Hb : b ⊢ a +-- a : Prop, b : Prop, c : Prop,