aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Sigma/Associativity.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2017-04-03 15:14:17 -0400
committerGravatar Jason Gross <jgross@mit.edu>2017-04-03 15:14:17 -0400
commit9009ddf4261bbf489874c4619a8c0397eb3f989d (patch)
treeb1fa7b5ff05300f1cca6f1eaf19b9fe3c601f6bf /src/Util/Sigma/Associativity.v
parenteb20555b72dc38d4675cfb1e68203ad9be56a3d3 (diff)
Split off liftn_sig, add lift{3,4}_sig
Diffstat (limited to 'src/Util/Sigma/Associativity.v')
-rw-r--r--src/Util/Sigma/Associativity.v18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Util/Sigma/Associativity.v b/src/Util/Sigma/Associativity.v
new file mode 100644
index 000000000..fbebf2584
--- /dev/null
+++ b/src/Util/Sigma/Associativity.v
@@ -0,0 +1,18 @@
+(** * Reassociation of [sig] *)
+Definition sig_sig_assoc {A} {P : A -> Prop} {Q}
+ : { a : A | P a /\ Q a } -> { ap : { a : A | P a } | Q (proj1_sig ap) }
+ := fun apq => exist _ (exist _ (proj1_sig apq) (proj1 (proj2_sig apq))) (proj2 (proj2_sig apq)).
+Ltac sig_sig_assoc :=
+ lazymatch goal with
+ | [ |- { a : ?A | ?P } ]
+ => let P'' := fresh a in
+ let P' := fresh P'' in
+ let term := constr:(fun a : A => match P with
+ | P' => ltac:(let v := (eval cbv [P'] in P') in
+ lazymatch eval pattern (proj1_sig a) in v with
+ | ?P _ => exact P
+ end)
+ end) in
+ let Q := lazymatch (eval cbv beta in term) with fun _ => ?term => term end in
+ apply (@sig_sig_assoc _ _ Q)
+ end.