diff --git a/src/library/tactic/induction_tactic.cpp b/src/library/tactic/induction_tactic.cpp index 8cb2c56ecc..93a8c1e59a 100644 --- a/src/library/tactic/induction_tactic.cpp +++ b/src/library/tactic/induction_tactic.cpp @@ -332,8 +332,21 @@ public: return execute(g, H, H_type, *m_rec_name); } else if (inductive::is_inductive_decl(m_env, const_name(I))) { return execute(g, H, H_type, inductive::get_elim_name(const_name(I))); - } else if (auto rs = get_recursors_for(m_env, const_name(I))) { - return execute(g, H, H_type, head(rs)); + } else if (list rs = get_recursors_for(m_env, const_name(I))) { + while (rs) { + name r = head(rs); + rs = tail(rs); + if (!rs) { + // last one + return execute(g, H, H_type, r); + } else { + try { + flet> save_ids(m_ids, m_ids); + flet save_cs(m_cs, m_cs); + return execute(g, H, H_type, r); + } catch (exception &) {} + } + } } } throw tactic_exception(sstream() << "invalid 'induction' tactic, hypothesis '" << m_h_name diff --git a/tests/lean/hott/615.hlean b/tests/lean/hott/615.hlean new file mode 100644 index 0000000000..d712a7debc --- /dev/null +++ b/tests/lean/hott/615.hlean @@ -0,0 +1,21 @@ +-- HoTT +import hit.circle +open circle eq int + +attribute circle.rec circle.elim [recursor 4] + +protected definition my_code (x : circle) : Type₀ := +begin + induction x, + { exact ℤ}, + { apply ua, apply equiv_succ} +end + +protected definition my_decode {x : circle} : my_code x → base = x := +begin + induction x, + { exact power loop}, + { apply eq_of_homotopy, intro a, + refine !arrow.arrow_transport ⬝ !transport_eq_r ⬝ _, + rewrite [transport_code_loop_inv,power_con,succ_pred]} +end