Library Coq.Init.Tactics
Require Import Notations.
Require Import Logic.
Useful tactics
Tactic Notation "revert" ne_hyp_list(l) := generalize l; clear l.
Ltac absurd_hyp h :=
let T := type of h in
absurd T.
Ltac swap H := intro; apply H; clear H.
Ltac case_eq x := generalize (refl_equal x); pattern x at -1; case x.
Ltac f_equal :=
let cg := try congruence in
let r := try reflexivity in
match goal with
| |- ?f ?a = ?f' ?a' => cut (a=a'); [cg|r]
| |- ?f ?a ?b = ?f' ?a' ?b' =>
cut (b=b');[cut (a=a');[cg|r]|r]
| |- ?f ?a ?b ?c = ?f' ?a' ?b' ?c'=>
cut (c=c');[cut (b=b');[cut (a=a');[cg|r]|r]|r]
| |- ?f ?a ?b ?c ?d= ?f' ?a' ?b' ?c' ?d'=>
cut (d=d');[cut (c=c');[cut (b=b');[cut (a=a');[cg|r]|r]|r]|r]
| |- ?f ?a ?b ?c ?d ?e= ?f' ?a' ?b' ?c' ?d' ?e'=>
cut (e=e');[cut (d=d');[cut (c=c');[cut (b=b');[cut (a=a');[cg|r]|r]|r]|r]|r]
| _ => idtac
end.
Tactic Notation "rewrite_all" constr(eq) := repeat rewrite eq in *.
Tactic Notation "rewrite_all" "<-" constr(eq) := repeat rewrite <- eq in *.
Ltac remembertac x a :=
let x := fresh x in
let H := fresh "Heq" x in
(set (x:=a) in *; assert (H: x=a) by reflexivity; clearbody x).
Tactic Notation "remember" constr(c) "as" ident(x) := remembertac x c.