diff --git a/library/init/data/list/instances.lean b/library/init/data/list/instances.lean index 5b269354de..4d298e3055 100644 --- a/library/init/data/list/instances.lean +++ b/library/init/data/list/instances.lean @@ -72,7 +72,7 @@ lemma mem_bind {b : β} {l : list α} {f : α → list β} {a} (al : a ∈ l) (h mem_bind_iff.2 ⟨a, al, h⟩ instance decidable_bex : ∀ (l : list α), decidable (∃ x ∈ l, p x) -| [] := is_false (by intro; cases a; cases a_2; cases a) +| [] := is_false (by intro; cases a; cases a_1; cases a_1) | (x::xs) := if hx : p x then is_true ⟨x, or.inl rfl, hx⟩ diff --git a/src/library/tactic/induction_tactic.cpp b/src/library/tactic/induction_tactic.cpp index e82c4dddb9..2a335a11c9 100644 --- a/src/library/tactic/induction_tactic.cpp +++ b/src/library/tactic/induction_tactic.cpp @@ -272,9 +272,11 @@ list induction(environment const & env, options const & opts, transparency unsigned nextra = to_revert.size() - indices.size() - 1; /* extra dependencies that have been reverted */ expr new_M = ctx2.mk_metavar_decl(ctx2.lctx(), annotated_head_beta_reduce(new_type)); expr aux_M; + /* Clear hypothesis in the new goal. */ + set_clear(aux_M, ctx2, new_M, H2); buffer param_names; buffer extra_names; /* Introduce constructor parameter for new goal associated with minor premise. */ - set_intron(aux_M, ctx2, new_M, nparams, ns, param_names, true); + set_intron(aux_M, ctx2, aux_M, nparams, ns, param_names, true); /* Introduce hypothesis that had to be reverted because they depended on indices and/or major premise. */ set_intron(aux_M, ctx2, aux_M, nextra, extra_names, false); local_context aux_M_lctx = ctx2.mctx().get_metavar_decl(aux_M).get_context(); @@ -294,8 +296,6 @@ list induction(environment const & env, options const & opts, transparency } subst_buffer.push_back(S); } - /* Clear hypothesis in the new goal. */ - set_clear(aux_M, ctx2, aux_M, H2); new_goals.push_back(aux_M); rec_arg = new_M; } diff --git a/tests/lean/cases_induction_fresh.lean b/tests/lean/cases_induction_fresh.lean index 169e73accc..7c27773163 100644 --- a/tests/lean/cases_induction_fresh.lean +++ b/tests/lean/cases_induction_fresh.lean @@ -7,6 +7,15 @@ begin constructor; assumption end +example (p q r s: Prop): p ∧ q → r ∧ s → s ∧ q := +begin + intros a a_1, + cases a, + cases a_1, + trace_state, + constructor; assumption +end + #print "------------" example (p q r s: Prop): p ∧ q → r ∧ s → s ∧ q := @@ -17,3 +26,12 @@ begin trace_state, constructor; assumption end + +example (p q r s: Prop): p ∧ q → r ∧ s → s ∧ q := +begin + intros a a_1, + induction a, + induction a_1, + trace_state, + constructor; assumption +end diff --git a/tests/lean/cases_induction_fresh.lean.expected.out b/tests/lean/cases_induction_fresh.lean.expected.out index 6bcd41bc57..fb7bbc2c4c 100644 --- a/tests/lean/cases_induction_fresh.lean.expected.out +++ b/tests/lean/cases_induction_fresh.lean.expected.out @@ -4,6 +4,12 @@ a_1 : q, a_2 : r, a_3 : s ⊢ s ∧ q +p q r s : Prop, +a : p, +a_2 : q, +a_1 : r, +a_3 : s +⊢ s ∧ q ------------ p q r s : Prop, a : p, @@ -11,3 +17,9 @@ a_1 : q, a_2 : r, a_3 : s ⊢ s ∧ q +p q r s : Prop, +a : p, +a_2 : q, +a_1 : r, +a_3 : s +⊢ s ∧ q diff --git a/tests/lean/run/aexp.lean b/tests/lean/run/aexp.lean index b4dfa099a1..b6e2dd5714 100644 --- a/tests/lean/run/aexp.lean +++ b/tests/lean/run/aexp.lean @@ -58,13 +58,13 @@ meta def not_done : tactic unit := fail_if_success done lemma aval_asimp_const (a : aexp) (s : state) : aval (asimp_const a) s = aval a s := begin [smt] induction a, - all_goals {destruct (asimp_const a_1), all_goals {destruct (asimp_const a_2), eblast}} + all_goals {destruct (asimp_const a_1), all_goals {destruct (asimp_const a), eblast}} end lemma ex2 (a : aexp) (s : state) : aval (asimp_const a) s = aval a s := begin [smt] induction a, - all_goals {destruct (asimp_const a_1), all_goals {destruct (asimp_const a_2), eblast_using [asimp_const, aval]}} + all_goals {destruct (asimp_const a_1), all_goals {destruct (asimp_const a), eblast_using [asimp_const, aval]}} end end imp diff --git a/tests/lean/run/smt_tests3.lean b/tests/lean/run/smt_tests3.lean index 7815a0371d..61ef65195c 100644 --- a/tests/lean/run/smt_tests3.lean +++ b/tests/lean/run/smt_tests3.lean @@ -7,7 +7,7 @@ begin induction a, dsimp [f], intro x, contradiction, dsimp [f], - change nat.succ (f a_1) ≠ 0, + change nat.succ (f a) ≠ 0, apply nat.succ_ne_zero end