aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Prod.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2016-10-07 17:41:31 -0400
committerGravatar Jason Gross <jgross@mit.edu>2016-10-07 17:41:41 -0400
commite7b3d3713e895639c7b9e2c3388d7168d15514ba (patch)
treef6ec4c142b417e1be7b48f8f9c5602650834e033 /src/Util/Prod.v
parent02fdc5064ad6f73acc228081e62d363a20f15477 (diff)
Add eta_expand to Prod.v
Diffstat (limited to 'src/Util/Prod.v')
-rw-r--r--src/Util/Prod.v17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Util/Prod.v b/src/Util/Prod.v
index 39e32865f..b83aea68f 100644
--- a/src/Util/Prod.v
+++ b/src/Util/Prod.v
@@ -91,3 +91,20 @@ Ltac inversion_prod_step :=
=> induction_path_prod H
end.
Ltac inversion_prod := repeat inversion_prod_step.
+
+(** This turns a goal like [x = let v := p in let '(x, y) := f v in x
+ + y)] into a goal like [x = fst (f p) + snd (f p)]. Note that it
+ inlines [let ... in ...] as well as destructuring lets. *)
+Ltac only_eta_expand_and_contract :=
+ repeat match goal with
+ | [ |- context[let '(x, y) := ?e in _] ]
+ => rewrite (surjective_pairing e)
+ | _ => rewrite <- !surjective_pairing
+ end.
+Ltac eta_expand :=
+ repeat match goal with
+ | _ => progress cbv beta iota zeta
+ | [ |- context[let '(x, y) := ?e in _] ]
+ => rewrite (surjective_pairing e)
+ | _ => rewrite <- !surjective_pairing
+ end.