| 1 |
Require Import Crypto.Util.Strings.Show. |
| 2 |
Require Import Ltac2.Ltac2. |
| 3 |
Require Import Ltac2.Printf. |
| 4 |
Require Import Ltac2.Constr. |
| 5 |
Require Import coqutil.Tactics.reference_to_string. |
| 6 |
|
| 7 |
Ltac2 prove_Show_enum () := |
| 8 |
lazy_match! goal with |
| 9 |
| [ |- Show ?ty ] |
| 10 |
=> let t := Fresh.in_goal @t in |
| 11 |
let v := Fresh.in_goal @v in |
| 12 |
intro t; |
| 13 |
pose &t as v; |
| 14 |
(destruct &t) |
| 15 |
> [ let v := (eval cbv delta [&v] in &v) in |
| 16 |
let v := constr_string_basename_of_constr_reference v in |
| 17 |
exact $v |
| 18 |
.. ] |
| 19 |
| [ |- ?g ] |
| 20 |
=> Control.zero (Tactic_failure (Some (fprintf "prove_Show_enum: Goal is not %t: %t" '(Show ?[ty]) g))) |
| 21 |
end. |
| 22 |
|
| 23 |
Ltac prove_Show_enum _ := ltac2:(prove_Show_enum ()). |