aboutsummaryrefslogtreecommitdiff
path: root/theories/Program
diff options
context:
space:
mode:
Diffstat (limited to 'theories/Program')
-rw-r--r--theories/Program/Equality.v25
-rw-r--r--theories/Program/Tactics.v15
2 files changed, 27 insertions, 13 deletions
diff --git a/theories/Program/Equality.v b/theories/Program/Equality.v
index 3e0e8ca2be..11f710997e 100644
--- a/theories/Program/Equality.v
+++ b/theories/Program/Equality.v
@@ -189,33 +189,32 @@ Ltac simplify_eqs :=
(** A tactic that tries to remove trivial equality guards in induction hypotheses coming
from [dependent induction]/[generalize_eqs] invocations. *)
-
Ltac simpl_IH_eq H :=
match type of H with
| @JMeq _ ?x _ _ -> _ =>
- specialize (H (JMeq_refl x))
+ refine_hyp (H (JMeq_refl x))
| _ -> @JMeq _ ?x _ _ -> _ =>
- specialize (H _ (JMeq_refl x))
+ refine_hyp (H _ (JMeq_refl x))
| _ -> _ -> @JMeq _ ?x _ _ -> _ =>
- specialize (H _ _ (JMeq_refl x))
+ refine_hyp (H _ _ (JMeq_refl x))
| _ -> _ -> _ -> @JMeq _ ?x _ _ -> _ =>
- specialize (H _ _ _ (JMeq_refl x))
+ refine_hyp (H _ _ _ (JMeq_refl x))
| _ -> _ -> _ -> _ -> @JMeq _ ?x _ _ -> _ =>
- specialize (H _ _ _ _ (JMeq_refl x))
+ refine_hyp (H _ _ _ _ (JMeq_refl x))
| _ -> _ -> _ -> _ -> _ -> @JMeq _ ?x _ _ -> _ =>
- specialize (H _ _ _ _ _ (JMeq_refl x))
+ refine_hyp (H _ _ _ _ _ (JMeq_refl x))
| ?x = _ -> _ =>
- specialize (H (refl_equal x))
+ refine_hyp (H (refl_equal x))
| _ -> ?x = _ -> _ =>
- specialize (H _ (refl_equal x))
+ refine_hyp (H _ (refl_equal x))
| _ -> _ -> ?x = _ -> _ =>
- specialize (H _ _ (refl_equal x))
+ refine_hyp (H _ _ (refl_equal x))
| _ -> _ -> _ -> ?x = _ -> _ =>
- specialize (H _ _ _ (refl_equal x))
+ refine_hyp (H _ _ _ (refl_equal x))
| _ -> _ -> _ -> _ -> ?x = _ -> _ =>
- specialize (H _ _ _ _ (refl_equal x))
+ refine_hyp (H _ _ _ _ (refl_equal x))
| _ -> _ -> _ -> _ -> _ -> ?x = _ -> _ =>
- specialize (H _ _ _ _ _ (refl_equal x))
+ refine_hyp (H _ _ _ _ _ (refl_equal x))
end.
Ltac simpl_IH_eqs H := repeat simpl_IH_eq H.
diff --git a/theories/Program/Tactics.v b/theories/Program/Tactics.v
index 9cb7725c0f..5c904e2194 100644
--- a/theories/Program/Tactics.v
+++ b/theories/Program/Tactics.v
@@ -233,6 +233,21 @@ Ltac replace_hyp H c :=
let H' := fresh "H" in
assert(H' := c) ; clear H ; rename H' into H.
+(** A tactic to refine an hypothesis by supplying some of its arguments. *)
+
+Ltac refine_hyp c :=
+ let tac H := replace_hyp H c in
+ match c with
+ | ?H _ => tac H
+ | ?H _ _ => tac H
+ | ?H _ _ _ => tac H
+ | ?H _ _ _ _ => tac H
+ | ?H _ _ _ _ _ => tac H
+ | ?H _ _ _ _ _ _ => tac H
+ | ?H _ _ _ _ _ _ _ => tac H
+ | ?H _ _ _ _ _ _ _ _ => tac H
+ end.
+
(** The default simplification tactic used by Program is defined by [program_simpl], sometimes [auto]
is not enough, better rebind using [Obligation Tactic := tac] in this case,
possibly using [program_simplify] to use standard goal-cleaning tactics. *)