aboutsummaryrefslogtreecommitdiff
path: root/mathcomp
diff options
context:
space:
mode:
authorKazuhiko Sakaguchi2019-09-30 17:38:49 +0200
committerKazuhiko Sakaguchi2019-09-30 22:19:55 +0200
commit24f5bdefd58fa3c9e3c31eb26443ff0f5eee30ed (patch)
treeed4d447a5a6a057d6752015988213b26741b4d49 /mathcomp
parent638fad3c620f9bc3bbd883a42adb506ded14232f (diff)
Generalize `allpairs_catr` to non-`eqType`s
Diffstat (limited to 'mathcomp')
-rw-r--r--mathcomp/ssreflect/seq.v18
1 files changed, 9 insertions, 9 deletions
diff --git a/mathcomp/ssreflect/seq.v b/mathcomp/ssreflect/seq.v
index 9581a95..feba604 100644
--- a/mathcomp/ssreflect/seq.v
+++ b/mathcomp/ssreflect/seq.v
@@ -2911,15 +2911,6 @@ move=> eq_s eq_t z; apply/allpairsPdep/allpairsPdep=> -[x [y [sx ty ->]]];
by exists x, y; rewrite -eq_s in sx *; rewrite eq_t in ty *.
Qed.
-Lemma allpairs_catr f s t1 t2 :
- [seq f x y | x <- s, y <- t1 x ++ t2 x] =i
- [seq f x y | x <- s, y <- t1 x] ++ [seq f x y | x <- s, y <- t2 x].
-Proof.
-move=> z; rewrite mem_cat; apply/allpairsPdep/orP=> [[x [y [s_x]]]|].
- by rewrite mem_cat => /orP[]; [left|right]; apply/allpairsPdep; exists x, y.
-by case=>/allpairsPdep[x [y [sx ty ->]]]; exists x, y; rewrite mem_cat ty ?orbT.
-Qed.
-
Lemma allpairs_uniq_dep f s t (st := [seq Tagged T y | x <- s, y <- t x]) :
let g (p : {x : S & T x}) : R := f (tag p) (tagged p) in
uniq s -> {in s, forall x, uniq (t x)} -> {in st &, injective g} ->
@@ -2935,6 +2926,15 @@ Qed.
End EqAllPairsDep.
+Lemma allpairs_catr
+ (S : Type) (T : S -> Type) (R : eqType) (f : forall x, T x -> R) s t1 t2 :
+ [seq f x y | x <- s, y <- t1 x ++ t2 x] =i
+ [seq f x y | x <- s, y <- t1 x] ++ [seq f x y | x <- s, y <- t2 x].
+Proof.
+move=> z; rewrite mem_cat; elim: s => //= x s ih.
+by rewrite map_cat !mem_cat ih !orbA; congr orb; rewrite orbAC.
+Qed.
+
Arguments allpairsPdep {S T R f s t z}.
Section EqAllPairs.