(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* 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. (* Rewriting in all hypothesis. *) Ltac rewrite_all Eq := match type of Eq with ?a = ?b => generalize Eq; clear Eq; match goal with | H : context [a] |- _ => intro Eq; rewrite Eq in H; rewrite_all Eq | _ => intro Eq; try rewrite Eq end end. Ltac rewrite_all_rev Eq := match type of Eq with ?a = ?b => generalize Eq; clear Eq; match goal with | H : context [b] |- _ => intro Eq; rewrite <- Eq in H; rewrite_all_rev Eq | _ => intro Eq; try rewrite <- Eq end end. Tactic Notation "rewrite_all" "<-" constr(H) := rewrite_all_rev H.