| 1 |
(** [simplify_projections] reduces terms of the form [fst (_, _)] (for |
| 2 |
any projection from [prod], [sig], [sigT], or [and]) *) |
| 3 |
Ltac pre_simplify_projection proj proj' uproj' := |
| 4 |
pose proj as proj'; |
| 5 |
pose proj as uproj'; |
| 6 |
unfold proj in uproj'; |
| 7 |
change proj with proj'. |
| 8 |
Ltac do_simplify_projection_2Targ_4carg_step proj proj' uproj' construct := |
| 9 |
change proj' with uproj' at 1; |
| 10 |
lazymatch goal with |
| 11 |
| [ |- context[uproj' _ _ (construct _ _ _ _)] ] |
| 12 |
=> cbv beta iota delta [uproj'] |
| 13 |
| _ => change uproj' with proj |
| 14 |
end. |
| 15 |
Ltac do_simplify_projection_2Targ_4carg proj proj' uproj' construct := |
| 16 |
repeat do_simplify_projection_2Targ_4carg_step proj proj' uproj' construct. |
| 17 |
Ltac simplify_projection_2Targ_4carg proj construct := |
| 18 |
let proj' := fresh "proj" in |
| 19 |
let uproj' := fresh "proj" in |
| 20 |
pre_simplify_projection proj proj' uproj'; |
| 21 |
do_simplify_projection_2Targ_4carg proj proj' uproj' construct; |
| 22 |
clear proj' uproj'. |
| 23 |
|
| 24 |
Ltac simplify_projections := |
| 25 |
repeat (simplify_projection_2Targ_4carg @fst @pair |
| 26 |
|| simplify_projection_2Targ_4carg @snd @pair |
| 27 |
|| simplify_projection_2Targ_4carg @proj1_sig @exist |
| 28 |
|| simplify_projection_2Targ_4carg @proj2_sig @exist |
| 29 |
|| simplify_projection_2Targ_4carg @projT1 @existT |
| 30 |
|| simplify_projection_2Targ_4carg @projT2 @existT |
| 31 |
|| simplify_projection_2Targ_4carg @proj1 @conj |
| 32 |
|| simplify_projection_2Targ_4carg @proj2 @conj). |