| 1 |
Require Import Crypto.Util.Tactics.AllSuccesses. |
| 2 |
Require Import Crypto.Util.Tactics.CountBinders. |
| 3 |
Require Import Crypto.Util.Tactics.AppendUnderscores. |
| 4 |
|
| 5 |
Ltac all_instances_of tc := |
| 6 |
(eval cbv zeta in |
| 7 |
(ltac:(let v := all_successes ltac:(fun _ => let tc := open_constr:(tc) in |
| 8 |
let H := fresh in |
| 9 |
let __ := multimatch goal with |
| 10 |
| _ => simple notypeclasses refine (let H : tc := _ in _); |
| 11 |
[ typeclasses eauto | ] |
| 12 |
end in |
| 13 |
let v := (eval cbv delta [H] in H) in |
| 14 |
let __ := match goal with _ => clear H end in |
| 15 |
v) |
| 16 |
() in |
| 17 |
exact v))). |
| 18 |
Ltac all_instances_of_family F := |
| 19 |
let T := type of F in |
| 20 |
let underscores := count_binders_hnf T in |
| 21 |
let F := append_underscores F underscores in |
| 22 |
all_instances_of F. |