feat(frontends/lean/elaborator): include number of unsolved goals
See #509
This commit is contained in:
parent
abcc56a2a7
commit
242f8ba048
5 changed files with 21 additions and 6 deletions
|
@ -1506,6 +1506,19 @@ void elaborator::display_tactic_exception(tactic_exception const & ex, proof_sta
|
|||
out << ps.pp(env(), ios()) << "\n";
|
||||
}
|
||||
|
||||
void elaborator::display_unsolved_subgoals(expr const & mvar, proof_state const & ps, expr const & pos) {
|
||||
unsigned ngoals = length(ps.get_goals());
|
||||
sstream s;
|
||||
s << ngoals << " unsolved subgoal";
|
||||
if (ngoals > 1) s << "s";
|
||||
display_unsolved_proof_state(mvar, ps, s.str().c_str(), pos);
|
||||
}
|
||||
|
||||
void elaborator::display_unsolved_subgoals(expr const & mvar, proof_state const & ps) {
|
||||
display_unsolved_subgoals(mvar, ps, mvar);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Try to instantiate meta-variable \c mvar (modulo its state ps) using the given tactic.
|
||||
If it succeeds, then update subst with the solution.
|
||||
Return true iff the metavariable \c mvar has been assigned.
|
||||
|
@ -1530,7 +1543,7 @@ bool elaborator::try_using(substitution & subst, expr const & mvar, proof_state
|
|||
} else if (!empty(r->first.get_goals())) {
|
||||
// tactic contains unsolved subgoals
|
||||
if (show_failure)
|
||||
display_unsolved_proof_state(mvar, r->first, "unsolved subgoals");
|
||||
display_unsolved_subgoals(mvar, r->first);
|
||||
return false;
|
||||
} else {
|
||||
subst = r->first.get_subst();
|
||||
|
@ -1612,7 +1625,7 @@ bool elaborator::try_using_begin_end(substitution & subst, expr const & mvar, pr
|
|||
}
|
||||
|
||||
if (!empty(ps.get_goals())) {
|
||||
display_unsolved_proof_state(mvar, ps, "unsolved subgoals", pre_tac);
|
||||
display_unsolved_subgoals(mvar, ps, pre_tac);
|
||||
return false;
|
||||
} else {
|
||||
subst = ps.get_subst();
|
||||
|
|
|
@ -144,6 +144,8 @@ class elaborator : public coercion_info_manager {
|
|||
unify_result_seq solve(constraint_seq const & cs);
|
||||
void display_unsolved_proof_state(expr const & mvar, proof_state const & ps, char const * msg, expr const & pos);
|
||||
void display_unsolved_proof_state(expr const & mvar, proof_state const & ps, char const * msg);
|
||||
void display_unsolved_subgoals(expr const & mvar, proof_state const & ps, expr const & pos);
|
||||
void display_unsolved_subgoals(expr const & mvar, proof_state const & ps);
|
||||
void display_tactic_exception(tactic_exception const & ex, proof_state const & ps, expr const & pre_tac);
|
||||
optional<expr> get_pre_tactic_for(expr const & mvar);
|
||||
optional<tactic> pre_tactic_to_tactic(expr const & pre_tac);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
487.hlean:18:56: error: unsolved subgoals
|
||||
487.hlean:18:56: error: 1 unsolved subgoal
|
||||
A : Type,
|
||||
B : Type,
|
||||
f : A → B,
|
||||
g : B → A,
|
||||
ε : Π (b : B), f (g b) = b,
|
||||
b b' : B
|
||||
⊢ (ε b) ⁻¹ ⬝ refl (f (g b)) ⬝ ε b = refl b
|
||||
⊢ (ε b)⁻¹ ⬝ refl (f (g b)) ⬝ ε b = refl b
|
||||
487.hlean:19:0: error: failed to add declaration 'foo' to environment, value has metavariables
|
||||
remark: set 'formatter.hide_full_terms' to false to see the complete term
|
||||
λ (A : Type) (B : Type) (f : …) (g : …) (ε : …) (b b' : B),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
goals1.lean:9:0: error: unsolved subgoals
|
||||
goals1.lean:9:0: error: 1 unsolved subgoal
|
||||
A : Type,
|
||||
a b c : A,
|
||||
Hab : eq a b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
inv_del.lean:15:2: error: unsolved subgoals
|
||||
inv_del.lean:15:2: error: 1 unsolved subgoal
|
||||
A : Type,
|
||||
P : vec A 1 → Type,
|
||||
H : Π (a : A), P (vone a),
|
||||
|
|
Loading…
Reference in a new issue