| 1 |
(* example from bug 5345 *) |
| 2 |
Ltac break_tuple := |
| 3 |
match goal with |
| 4 |
| [ H: context[let '(n, m) := ?a in _] |- _ ] => |
| 5 |
let n := fresh n in |
| 6 |
let m := fresh m in |
| 7 |
destruct a as [n m] |
| 8 |
end. |
| 9 |
|
| 10 |
(* desugared version of break_tuple *) |
| 11 |
Ltac break_tuple' := |
| 12 |
match goal with |
| 13 |
| [ H: context[match ?a with | pair n m => _ end] |- _ ] => |
| 14 |
let n := fresh n in |
| 15 |
let m := fresh m in |
| 16 |
idtac |
| 17 |
end. |
| 18 |
|
| 19 |
Ltac multiple_branches := |
| 20 |
match goal with |
| 21 |
| [ H: match _ with |
| 22 |
| left P => _ |
| 23 |
| right Q => _ |
| 24 |
end |- _ ] => |
| 25 |
let P := fresh P in |
| 26 |
let Q := fresh Q in |
| 27 |
idtac |
| 28 |
end. |