aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Tactics/RewriteHyp.v
blob: ba24d35c7ca45e4b580a1084b276928d9e37b324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Require Export Crypto.Util.FixCoqMistakes.
Require Import Crypto.Util.Tactics.DoWithHyp.


(** Rewrite with any applicable hypothesis. *)
Tactic Notation "rewrite_hyp" "*" := do_with_hyp' ltac:(fun H => rewrite H).
Tactic Notation "rewrite_hyp" "->" "*" := do_with_hyp' ltac:(fun H => rewrite -> H).
Tactic Notation "rewrite_hyp" "<-" "*" := do_with_hyp' ltac:(fun H => rewrite <- H).
Tactic Notation "rewrite_hyp" "?*" := repeat do_with_hyp' ltac:(fun H => rewrite !H).
Tactic Notation "rewrite_hyp" "->" "?*" := repeat do_with_hyp' ltac:(fun H => rewrite -> !H).
Tactic Notation "rewrite_hyp" "<-" "?*" := repeat do_with_hyp' ltac:(fun H => rewrite <- !H).
Tactic Notation "rewrite_hyp" "!*" := progress rewrite_hyp ?*.
Tactic Notation "rewrite_hyp" "->" "!*" := progress rewrite_hyp -> ?*.
Tactic Notation "rewrite_hyp" "<-" "!*" := progress rewrite_hyp <- ?*.

Tactic Notation "rewrite_hyp" "*" "in" "*" := do_with_hyp' ltac:(fun H => rewrite H in * ).
Tactic Notation "rewrite_hyp" "->" "*" "in" "*" := do_with_hyp' ltac:(fun H => rewrite -> H in * ).
Tactic Notation "rewrite_hyp" "<-" "*" "in" "*" := do_with_hyp' ltac:(fun H => rewrite <- H in * ).
Tactic Notation "rewrite_hyp" "?*" "in" "*" := repeat do_with_hyp' ltac:(fun H => rewrite !H in * ).
Tactic Notation "rewrite_hyp" "->" "?*" "in" "*" := repeat do_with_hyp' ltac:(fun H => rewrite -> !H in * ).
Tactic Notation "rewrite_hyp" "<-" "?*" "in" "*" := repeat do_with_hyp' ltac:(fun H => rewrite <- !H in * ).
Tactic Notation "rewrite_hyp" "!*" "in" "*" := progress rewrite_hyp ?* in *.
Tactic Notation "rewrite_hyp" "->" "!*" "in" "*" := progress rewrite_hyp -> ?* in *.
Tactic Notation "rewrite_hyp" "<-" "!*" "in" "*" := progress rewrite_hyp <- ?* in *.

Tactic Notation "erewrite_hyp" "*" := do_with_hyp' ltac:(fun H => erewrite H).
Tactic Notation "erewrite_hyp" "->" "*" := do_with_hyp' ltac:(fun H => erewrite -> H).
Tactic Notation "erewrite_hyp" "<-" "*" := do_with_hyp' ltac:(fun H => erewrite <- H).
Tactic Notation "erewrite_hyp" "?*" := repeat do_with_hyp' ltac:(fun H => erewrite !H).
Tactic Notation "erewrite_hyp" "->" "?*" := repeat do_with_hyp' ltac:(fun H => erewrite -> !H).
Tactic Notation "erewrite_hyp" "<-" "?*" := repeat do_with_hyp' ltac:(fun H => erewrite <- !H).
Tactic Notation "erewrite_hyp" "!*" := progress erewrite_hyp ?*.
Tactic Notation "erewrite_hyp" "->" "!*" := progress erewrite_hyp -> ?*.
Tactic Notation "erewrite_hyp" "<-" "!*" := progress erewrite_hyp <- ?*.

Tactic Notation "erewrite_hyp" "*" "in" "*" := do_with_hyp' ltac:(fun H => erewrite H in * ).
Tactic Notation "erewrite_hyp" "->" "*" "in" "*" := do_with_hyp' ltac:(fun H => erewrite -> H in * ).
Tactic Notation "erewrite_hyp" "<-" "*" "in" "*" := do_with_hyp' ltac:(fun H => erewrite <- H in * ).
Tactic Notation "erewrite_hyp" "?*" "in" "*" := repeat do_with_hyp' ltac:(fun H => erewrite !H in * ).
Tactic Notation "erewrite_hyp" "->" "?*" "in" "*" := repeat do_with_hyp' ltac:(fun H => erewrite -> !H in * ).
Tactic Notation "erewrite_hyp" "<-" "?*" "in" "*" := repeat do_with_hyp' ltac:(fun H => erewrite <- !H in * ).
Tactic Notation "erewrite_hyp" "!*" "in" "*" := progress erewrite_hyp ?* in *.
Tactic Notation "erewrite_hyp" "->" "!*" "in" "*" := progress erewrite_hyp -> ?* in *.
Tactic Notation "erewrite_hyp" "<-" "!*" "in" "*" := progress erewrite_hyp <- ?* in *.

Tactic Notation "rewrite_hyp" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => rewrite H by tac).
Tactic Notation "rewrite_hyp" "->" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => rewrite -> H by tac).
Tactic Notation "rewrite_hyp" "<-" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => rewrite <- H by tac).
Tactic Notation "rewrite_hyp" "?*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => rewrite !H by tac).
Tactic Notation "rewrite_hyp" "->" "?*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => rewrite -> !H by tac).
Tactic Notation "rewrite_hyp" "<-" "?*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => rewrite <- !H by tac).
Tactic Notation "rewrite_hyp" "!*" "by" tactic3(tac) := progress rewrite_hyp ?* by tac.
Tactic Notation "rewrite_hyp" "->" "!*" "by" tactic3(tac) := progress rewrite_hyp -> ?* by tac.
Tactic Notation "rewrite_hyp" "<-" "!*" "by" tactic3(tac) := progress rewrite_hyp <- ?* by tac.

Tactic Notation "rewrite_hyp" "*" "in" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => rewrite H in * by tac).
Tactic Notation "rewrite_hyp" "->" "*" "in" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => rewrite -> H in * by tac).
Tactic Notation "rewrite_hyp" "<-" "*" "in" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => rewrite <- H in * by tac).
Tactic Notation "rewrite_hyp" "?*" "in" "*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => rewrite !H in * by tac).
Tactic Notation "rewrite_hyp" "->" "?*" "in" "*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => rewrite -> !H in * by tac).
Tactic Notation "rewrite_hyp" "<-" "?*" "in" "*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => rewrite <- !H in * by tac).
Tactic Notation "rewrite_hyp" "!*" "in" "*" "by" tactic3(tac) := progress rewrite_hyp ?* in * by tac.
Tactic Notation "rewrite_hyp" "->" "!*" "in" "*" "by" tactic3(tac) := progress rewrite_hyp -> ?* in * by tac.
Tactic Notation "rewrite_hyp" "<-" "!*" "in" "*" "by" tactic3(tac) := progress rewrite_hyp <- ?* in * by tac.

Tactic Notation "erewrite_hyp" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => erewrite H by tac).
Tactic Notation "erewrite_hyp" "->" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => erewrite -> H by tac).
Tactic Notation "erewrite_hyp" "<-" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => erewrite <- H by tac).
Tactic Notation "erewrite_hyp" "?*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => erewrite !H by tac).
Tactic Notation "erewrite_hyp" "->" "?*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => erewrite -> !H by tac).
Tactic Notation "erewrite_hyp" "<-" "?*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => erewrite <- !H by tac).
Tactic Notation "erewrite_hyp" "!*" "by" tactic3(tac) := progress erewrite_hyp ?* by tac.
Tactic Notation "erewrite_hyp" "->" "!*" "by" tactic3(tac) := progress erewrite_hyp -> ?* by tac.
Tactic Notation "erewrite_hyp" "<-" "!*" "by" tactic3(tac) := progress erewrite_hyp <- ?* by tac.

Tactic Notation "erewrite_hyp" "*" "in" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => erewrite H in * by tac).
Tactic Notation "erewrite_hyp" "->" "*" "in" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => erewrite -> H in * by tac).
Tactic Notation "erewrite_hyp" "<-" "*" "in" "*" "by" tactic3(tac) := do_with_hyp' ltac:(fun H => erewrite <- H in * by tac).
Tactic Notation "erewrite_hyp" "?*" "in" "*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => erewrite !H in * by tac).
Tactic Notation "erewrite_hyp" "->" "?*" "in" "*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => erewrite -> !H in * by tac).
Tactic Notation "erewrite_hyp" "<-" "?*" "in" "*" "by" tactic3(tac) := repeat do_with_hyp' ltac:(fun H => erewrite <- !H in * by tac).
Tactic Notation "erewrite_hyp" "!*" "in" "*" "by" tactic3(tac) := progress erewrite_hyp ?* in * by tac.
Tactic Notation "erewrite_hyp" "->" "!*" "in" "*" "by" tactic3(tac) := progress erewrite_hyp -> ?* in * by tac.
Tactic Notation "erewrite_hyp" "<-" "!*" "in" "*" "by" tactic3(tac) := progress erewrite_hyp <- ?* in * by tac.