feat(library/tactic/inversion_tactic): avoid unnecessary eq.rec's
This commit is contained in:
parent
58f052b1bb
commit
57490a6431
1 changed files with 50 additions and 38 deletions
|
@ -615,6 +615,17 @@ class inversion_tac {
|
|||
hyps.pop_back(); // remove processed equality
|
||||
buffer<expr> non_deps, deps;
|
||||
split_deps(hyps, rhs, non_deps, deps);
|
||||
if (deps.empty() && !depends_on(g_type, rhs)) {
|
||||
// eq.rec is not necessary
|
||||
buffer<expr> & new_hyps = non_deps;
|
||||
expr new_type = g_type;
|
||||
expr new_mvar = mk_metavar(m_ngen.next(), Pi(new_hyps, new_type));
|
||||
expr new_meta = mk_app(new_mvar, new_hyps);
|
||||
goal new_g(new_meta, new_type);
|
||||
expr val = g.abstract(new_meta);
|
||||
assign(g.get_name(), val);
|
||||
return unify_eqs(new_g, neqs-1);
|
||||
} else {
|
||||
expr deps_g_type = Pi(deps, g_type);
|
||||
abstract_locals(m_imps, deps);
|
||||
level eq_rec_lvl1 = sort_level(m_tc.ensure_type(deps_g_type).first);
|
||||
|
@ -654,6 +665,7 @@ class inversion_tac {
|
|||
expr val = g.abstract(mk_app(eq_rec, deps));
|
||||
assign(g.get_name(), val);
|
||||
return unify_eqs(new_g, neqs-1);
|
||||
}
|
||||
} else if (is_local(lhs)) {
|
||||
// flip equation and reduce to previous case
|
||||
if (m_proof_irrel)
|
||||
|
|
Loading…
Reference in a new issue