fix(library/init/meta/interactive): disallow wildcard in rewrite

This commit is contained in:
Jeremy Avigad 2017-05-29 11:59:11 -04:00 committed by Leonardo de Moura
parent e1c024d4d9
commit 862d23f6b6
2 changed files with 3 additions and 17 deletions

View file

@ -360,12 +360,9 @@ meta def rw_rules : parser rw_rules_t :=
private meta def rw_core (m : transparency) (rs : parse rw_rules) (loca : parse location) : tactic unit :=
match loca with
| loc.wildcard :=
do ls ← local_context,
let ls_names := list.map (fun (l : expr), l.local_pp_name) ls,
ls_names.mfor' (fun loc, try $ rw_hyp m rs.rules loc)
| loc.ns [] := rw_goal m rs.rules
| loc.ns hs := rw_hyps m rs.rules hs
| loc.wildcard := fail "wildcard not allowed with rewrite"
| loc.ns [] := rw_goal m rs.rules
| loc.ns hs := rw_hyps m rs.rules hs
end >> try (reflexivity reducible)
>> (returnopt rs.end_pos >>= save_info <|> skip)

View file

@ -1,11 +0,0 @@
lemma rw_wild_card :
forall (a b c a' b' c' : nat),
(0 + a) = a' ->
(0 + b) = b' ->
(0 + c) = c' ->
a' + b' + c' = a + b + c :=
begin
intros,
rewrite [add_comm, add_zero] at *,
rewrite [a_1, a_2, a_3]
end