| 1 |
Require Export Crypto.Util.FixCoqMistakes. |
| 2 |
|
| 3 |
Ltac find_hyp_eq a b := match goal with _ => constr_eq_nounivs a b end. |
| 4 |
(* Work around https://github.com/coq/coq/issues/15554 *) |
| 5 |
Ltac find_hyp T := |
| 6 |
lazymatch T with |
| 7 |
| T |
| 8 |
=> (* we're not in https://github.com/coq/coq/issues/15554 *) |
| 9 |
multimatch goal with |
| 10 |
| [ H : T |- _ ] => H |
| 11 |
end |
| 12 |
| _ |
| 13 |
=> (* https://github.com/coq/coq/issues/15554 *) |
| 14 |
multimatch goal with |
| 15 |
| [ H : ?T' |- _ ] => let __ := find_hyp_eq T T' in |
| 16 |
H |
| 17 |
end |
| 18 |
end. |
| 19 |
|
| 20 |
Ltac find_hyp_with_body body := |
| 21 |
lazymatch body with |
| 22 |
| body |
| 23 |
=> (* we're not in https://github.com/coq/coq/issues/15554 *) |
| 24 |
multimatch goal with |
| 25 |
| [ H := body |- _ ] => H |
| 26 |
end |
| 27 |
| _ |
| 28 |
=> (* https://github.com/coq/coq/issues/15554 *) |
| 29 |
multimatch goal with |
| 30 |
| [ H := ?body' |- _ ] => let __ := find_hyp_eq body body' in |
| 31 |
H |
| 32 |
end |
| 33 |
end. |