fact
stringlengths
8
1.54k
type
stringclasses
19 values
library
stringclasses
8 values
imports
listlengths
1
10
filename
stringclasses
98 values
symbolic_name
stringlengths
1
42
docstring
stringclasses
1 value
subset_disjointA B : (A \subset B) = [disjoint A & [predC B]]. Proof. by rewrite disjoint_sym unlock. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
subset_disjoint
disjoint_subsetA B : [disjoint A & B] = (A \subset [predC B]). Proof. by rewrite subset_disjoint; apply: eq_disjoint_r => x; rewrite !inE /= negbK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjoint_subset
disjointFrA B x : [disjoint A & B] -> x \in A -> x \in B = false. Proof. by move/pred0P/(_ x) => /=; case: (x \in A). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjointFr
disjointFlA B x : [disjoint A & B] -> x \in B -> x \in A = false. Proof. rewrite disjoint_sym; exact: disjointFr. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjointFl
disjointWlA B C : A \subset B -> [disjoint B & C] -> [disjoint A & C]. Proof. by rewrite 2!disjoint_subset; apply: subset_trans. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjointWl
disjointWrA B C : A \subset B -> [disjoint C & B] -> [disjoint C & A]. Proof. rewrite ![[disjoint C & _]]disjoint_sym. exact:disjointWl. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjointWr
disjointWA B C D : A \subset B -> C \subset D -> [disjoint B & D] -> [disjoint A & C]. Proof. by move=> subAB subCD BD; apply/(disjointWl subAB)/(disjointWr subCD). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjointW
disjoint0A : [disjoint pred0 & A]. Proof. exact/pred0P. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjoint0
eq_disjoint0A B : A =i pred0 -> [disjoint A & B]. Proof. by move/eq_disjoint->; apply: disjoint0. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_disjoint0
disjoint1x A : [disjoint pred1 x & A] = (x \notin A). Proof. apply/negbRL/(sameP (pred0Pn _))=> /=. apply: introP => [Ax | notAx [_ /andP[/eqP->]]]; last exact: negP. by exists x; rewrite inE eqxx. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjoint1
eq_disjoint1x A B : A =i pred1 x -> [disjoint A & B] = (x \notin B). Proof. by move/eq_disjoint->; apply: disjoint1. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_disjoint1
disjointUA B C : [disjoint predU A B & C] = [disjoint A & C] && [disjoint B & C]. Proof. case: [disjoint A & C] / (pred0P (xpredI A C)) => [A0 | nA0] /=. by congr (_ == 0); apply: eq_card => x; rewrite [x \in _]andb_orl A0. apply/pred0P=> nABC; case: nA0 => x; apply/idPn=> /=; move/(_ x): nABC. by rewrite [_ x]andb_orl; case/norP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjointU
disjointU1x A B : [disjoint predU1 x A & B] = (x \notin B) && [disjoint A & B]. Proof. by rewrite disjointU disjoint1. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjointU1
disjoint_consx s B : [disjoint x :: s & B] = (x \notin B) && [disjoint s & B]. Proof. exact: disjointU1. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjoint_cons
disjoint_hass A : [disjoint s & A] = ~~ has [in A] s. Proof. apply/negbRL; apply/pred0Pn/hasP => [[x /andP[]]|[x]]; exists x => //. exact/andP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjoint_has
disjoint_cats1 s2 A : [disjoint s1 ++ s2 & A] = [disjoint s1 & A] && [disjoint s2 & A]. Proof. by rewrite !disjoint_has has_cat negb_or. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
disjoint_cat
map_subset{T T' : finType} (s1 s2 : seq T) (f : T -> T') : s1 \subset s2 -> [seq f x | x <- s1 ] \subset [seq f x | x <- s2]. Proof. move=> s1s2; apply/subsetP => _ /mapP[y] /[swap] -> ys1. by apply/mapP; exists y => //; move/subsetP : s1s2; exact. Qed. #[global] Hint Resolve subxx_hint : core. Arguments pred0P {T P}. Arguments pred0Pn {T P}. Arguments card_le1P {T A}. Arguments card_le1_eqP {T A}. Arguments card1P {T A}. Arguments fintype_le1P {T}. Arguments fintype1P {T}. Arguments subsetP {T A B}. Arguments subsetPn {T A B}. Arguments subset_eqP {T A B}. Arguments card_uniqP {T s}. Arguments card_geqP {T A n}. Arguments card_gt0P {T A}. Arguments card_gt1P {T A}. Arguments card_gt2P {T A}. Arguments properP {T A B}.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
map_subset
existsPP: reflect (exists x, PP x) [exists x, P x]. Proof. by apply: (iffP pred0Pn) => -[x /viewP]; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
existsPP
forallPP: reflect (forall x, PP x) [forall x, P x]. Proof. by apply: (iffP pred0P) => /= allP x; have /viewP//=-> := allP x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
forallPP
forallPP : reflect (forall x, P x) [forall x, P x]. Proof. exact: 'forall_idP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
forallP
eqfunPf1 f2 : reflect (forall x, f1 x = f2 x) [forall x, f1 x == f2 x]. Proof. exact: 'forall_eqP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eqfunP
forall_inPD P : reflect (forall x, D x -> P x) [forall (x | D x), P x]. Proof. exact: 'forall_implyP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
forall_inP
forall_inPPD P PP : (forall x, reflect (PP x) (P x)) -> reflect (forall x, D x -> PP x) [forall (x | D x), P x]. Proof. by move=> vP; apply: (iffP (forall_inP _ _)) => /(_ _ _) /vP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
forall_inPP
eqfun_inPD f1 f2 : reflect {in D, forall x, f1 x = f2 x} [forall (x | x \in D), f1 x == f2 x]. Proof. exact: (forall_inPP _ (fun=> eqP)). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eqfun_inP
existsPP : reflect (exists x, P x) [exists x, P x]. Proof. exact: 'exists_idP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
existsP
existsbP (x : T) : P x -> [exists x, P x]. Proof. by move=> Px; apply/existsP; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
existsb
exists_eqPf1 f2 : reflect (exists x, f1 x = f2 x) [exists x, f1 x == f2 x]. Proof. exact: 'exists_eqP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
exists_eqP
exists_inPD P : reflect (exists2 x, D x & P x) [exists (x | D x), P x]. Proof. by apply: (iffP 'exists_andP) => [[x []] | [x]]; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
exists_inP
exists_inbD P (x : T) : D x -> P x -> [exists (x | D x), P x]. Proof. by move=> Dx Px; apply/exists_inP; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
exists_inb
exists_inPPD P PP : (forall x, reflect (PP x) (P x)) -> reflect (exists2 x, D x & PP x) [exists (x | D x), P x]. Proof. by move=> vP; apply: (iffP (exists_inP _ _)) => -[x?/vP]; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
exists_inPP
exists_eq_inPD f1 f2 : reflect (exists2 x, D x & f1 x = f2 x) [exists (x | D x), f1 x == f2 x]. Proof. exact: (exists_inPP _ (fun=> eqP)). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
exists_eq_inP
eq_existsbP1 P2 : P1 =1 P2 -> [exists x, P1 x] = [exists x, P2 x]. Proof. by move=> eqP12; congr (_ != 0); apply: eq_card. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_existsb
eq_existsb_inD P1 P2 : (forall x, D x -> P1 x = P2 x) -> [exists (x | D x), P1 x] = [exists (x | D x), P2 x]. Proof. by move=> eqP12; apply: eq_existsb => x; apply: andb_id2l => /eqP12. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_existsb_in
eq_forallbP1 P2 : P1 =1 P2 -> [forall x, P1 x] = [forall x, P2 x]. Proof. by move=> eqP12; apply/negb_inj/eq_existsb=> /= x; rewrite eqP12. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_forallb
eq_forallb_inD P1 P2 : (forall x, D x -> P1 x = P2 x) -> [forall (x | D x), P1 x] = [forall (x | D x), P2 x]. Proof. by move=> eqP12; apply: eq_forallb => i; case Di: (D i); rewrite // eqP12. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_forallb_in
existsbWlP Q : [exists x, P x && Q x] -> [exists x, P x]. Proof. move => /existsP ; case => x /andP [H _] ; apply/existsP ; by exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
existsbWl
existsbWrP Q : [exists x, P x && Q x] -> [exists x, Q x]. Proof. move => /existsP ; case => x /andP [_ H] ; apply/existsP ; by exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
existsbWr
negb_forallP : ~~ [forall x, P x] = [exists x, ~~ P x]. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
negb_forall
negb_forall_inD P : ~~ [forall (x | D x), P x] = [exists (x | D x), ~~ P x]. Proof. by apply: eq_existsb => x; rewrite negb_imply. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
negb_forall_in
negb_existsP : ~~ [exists x, P x] = [forall x, ~~ P x]. Proof. by apply/negbLR/esym/eq_existsb=> x; apply: negbK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
negb_exists
negb_exists_inD P : ~~ [exists (x | D x), P x] = [forall (x | D x), ~~ P x]. Proof. by rewrite negb_exists; apply/eq_forallb => x; rewrite [~~ _]fun_if. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
negb_exists_in
existsPnP : reflect (forall x, ~~ P x) (~~ [exists x, P x]). Proof. rewrite negb_exists. exact: forallP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
existsPn
forallPnP : reflect (exists x, ~~ P x) (~~ [forall x, P x]). Proof. rewrite negb_forall. exact: existsP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
forallPn
exists_inPnD P : reflect (forall x, x \in D -> ~~ P x) (~~ [exists x in D, P x]). Proof. rewrite negb_exists_in. exact: forall_inP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
exists_inPn
forall_inPnD P : reflect (exists2 x, x \in D & ~~ P x) (~~ [forall x in D, P x]). Proof. rewrite negb_forall_in. exact: exists_inP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
forall_inPn
dinjectivebf D := uniq (map f (enum D)).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
dinjectiveb
injectivebf := dinjectiveb f aT.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
injectiveb
dinjectivePnf D : reflect (exists2 x, x \in D & exists2 y, y \in [predD1 D & x] & f x = f y) (~~ dinjectiveb f D). Proof. apply: (iffP idP) => [injf | [x Dx [y Dxy eqfxy]]]; last first. move: Dx; rewrite -(mem_enum D) => /rot_to[i E defE]. rewrite /dinjectiveb -(rot_uniq i) -map_rot defE /=; apply/nandP; left. rewrite inE /= -(mem_enum D) -(mem_rot i) defE inE in Dxy. rewrite andb_orr andbC andbN in Dxy. by rewrite eqfxy map_f //; case/andP: Dxy. pose p := [pred x in D | [exists (y | y \in [predD1 D & x]), f x == f y]]. case: (pickP p) => [x /= /andP[Dx /exists_inP[y Dxy /eqP eqfxy]] | no_p]. by exists x; last exists y. rewrite /dinjectiveb map_inj_in_uniq ?enum_uniq // in injf => x y Dx Dy eqfxy. apply: contraNeq (negbT (no_p x)) => ne_xy /=; rewrite -mem_enum Dx. by apply/existsP; exists y; rewrite /= !inE eq_sym ne_xy -mem_enum Dy eqfxy /=. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
dinjectivePn
dinjectivePf D : reflect {in D &, injective f} (dinjectiveb f D). Proof. rewrite -[dinjectiveb f D]negbK. case: dinjectivePn=> [noinjf | injf]; constructor. case: noinjf => x Dx [y /andP[neqxy /= Dy] eqfxy] injf. by case/eqP: neqxy; apply: injf. move=> x y Dx Dy /= eqfxy; apply/eqP; apply/idPn=> nxy; case: injf. by exists x => //; exists y => //=; rewrite inE /= eq_sym nxy. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
dinjectiveP
eq_dinjectivebf1 f2 D1 D2 : f1 =1 f2 -> D1 =i D2 -> dinjectiveb f1 D1 = dinjectiveb f2 D2. Proof. move=> ef eD; rewrite /dinjectiveb (eq_enum eD). by under eq_map => x do rewrite ef. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_dinjectiveb
injectivePnf : reflect (exists x, exists2 y, x != y & f x = f y) (~~ injectiveb f). Proof. apply: (iffP (dinjectivePn _ _)) => [[x _ [y nxy eqfxy]] | [x [y nxy eqfxy]]]; by exists x => //; exists y => //; rewrite inE /= andbT eq_sym in nxy *. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
injectivePn
injectivePf : reflect (injective f) (injectiveb f). Proof. by apply: (iffP (dinjectiveP _ _)) => injf x y => [|_ _]; apply: injf. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
injectiveP
eq_injectivebf1 f2 : f1 =1 f2 -> injectiveb f1 = injectiveb f2. Proof. move=> ?; exact: eq_dinjectiveb. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
eq_injectiveb
image_memT T' f mA : seq T' := map f (@enum_mem T mA).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image_mem
imagef A := (image_mem f (mem A)).
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image
codomT T' f := @image_mem T T' f (mem T).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
codom
size_imageA : size (image f A) = #|A|. Proof. by rewrite size_map -cardE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
size_image
size_codom: size (codom f) = #|T|. Proof. exact: size_image. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
size_codom
codomE: codom f = map f (enum T). Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
codomE
imagePA y : reflect (exists2 x, x \in A & y = f x) (y \in image f A). Proof. by apply: (iffP mapP) => [] [x Ax y_fx]; exists x; rewrite // mem_enum in Ax *. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
imageP
codomPy : reflect (exists x, y = f x) (y \in codom f). Proof. by apply: (iffP (imageP _ y)) => [][x]; exists x. Qed. Remark iinv_proof A y : y \in image f A -> {x | x \in A & f x = y}. Proof. move=> fy; pose b x := A x && (f x == y). case: (pickP b) => [x /andP[Ax /eqP] | nfy]; first by exists x. by case/negP: fy => /imageP[x Ax fx_y]; case/andP: (nfy x); rewrite fx_y. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
codomP
iinvA y fAy := s2val (@iinv_proof A y fAy).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
iinv
f_iinvA y fAy : f (@iinv A y fAy) = y. Proof. exact: s2valP' (iinv_proof fAy). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
f_iinv
mem_iinvA y fAy : @iinv A y fAy \in A. Proof. exact: s2valP (iinv_proof fAy). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
mem_iinv
in_iinv_fA : {in A &, injective f} -> forall x fAfx, x \in A -> @iinv A (f x) fAfx = x. Proof. by move=> injf x fAfx Ax; apply: injf => //; [apply: mem_iinv | apply: f_iinv]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
in_iinv_f
preim_iinvA B y fAy : preim f B (@iinv A y fAy) = B y. Proof. by rewrite /= f_iinv. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
preim_iinv
image_fA x : x \in A -> f x \in image f A. Proof. by move=> Ax; apply/imageP; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image_f
codom_fx : f x \in codom f. Proof. exact: image_f. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
codom_f
image_codomA : {subset image f A <= codom f}. Proof. by move=> _ /imageP[x _ ->]; apply: codom_f. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image_codom
image_pred0: image f pred0 =i pred0. Proof. by move=> x; rewrite /image_mem /= enum0. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image_pred0
mem_imageA x : (f x \in image f A) = (x \in A). Proof. by rewrite mem_map ?mem_enum. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
mem_image
pre_imageA : [preim f of image f A] =i A. Proof. by move=> x; rewrite inE /= mem_image. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
pre_image
image_iinvA y (fTy : y \in codom f) : (y \in image f A) = (iinv fTy \in A). Proof. by rewrite -mem_image ?f_iinv. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image_iinv
iinv_fx fTfx : @iinv T (f x) fTfx = x. Proof. by apply: in_iinv_f; first apply: in2W. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
iinv_f
image_pre(B : pred T') : image f [preim f of B] =i [predI B & codom f]. Proof. by move=> y; rewrite /image_mem -filter_map /= mem_filter -enumT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image_pre
bij_on_codom(x0 : T) : {on [pred y in codom f], bijective f}. Proof. pose g y := iinv (valP (insigd (codom_f x0) y)). by exists g => [x fAfx | y fAy]; first apply: injf; rewrite f_iinv insubdK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
bij_on_codom
bij_on_imageA (x0 : T) : {on [pred y in image f A], bijective f}. Proof. exact: subon_bij (@image_codom A) (bij_on_codom x0). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
bij_on_image
preim_seqs := if s is y :: s' then (if pick (preim f (pred1 y)) is Some x then cons x else id) (preim_seq s') else [::].
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
preim_seq
map_preim(s : seq T') : {subset s <= codom f} -> map f (preim_seq s) = s. Proof. elim: s => //= y s IHs; case: pickP => [x /eqP fx_y | nfTy] fTs. by rewrite /= fx_y IHs // => z s_z; apply: fTs; apply: predU1r. by case/imageP: (fTs y (mem_head y s)) => x _ fx_y; case/eqP: (nfTy x). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
map_preim
flatten_imageP(aT : finType) (rT : eqType) (A : aT -> seq rT) (P : {pred aT}) (y : rT) : reflect (exists2 x, x \in P & y \in A x) (y \in flatten [seq A x | x in P]). Proof. by apply: (iffP flatten_mapP) => [][x Px]; exists x; rewrite ?mem_enum in Px *. Qed. Arguments flatten_imageP {aT rT A P y}.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
flatten_imageP
leq_image_cardA : #|image f A| <= #|A|. Proof. by rewrite (cardE A) -(size_map f) card_size. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
leq_image_card
card_in_imageA : {in A &, injective f} -> #|image f A| = #|A|. Proof. move=> injf; rewrite (cardE A) -(size_map f); apply/card_uniqP. by rewrite map_inj_in_uniq ?enum_uniq // => x y; rewrite !mem_enum; apply: injf. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
card_in_image
image_injPA : reflect {in A &, injective f} (#|image f A| == #|A|). Proof. apply: (iffP eqP) => [eqfA |]; last exact: card_in_image. by apply/dinjectiveP; apply/card_uniqP; rewrite size_map -cardE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
image_injP
leq_card_inA : {in A &, injective f} -> #|A| <= #|T'|. Proof. by move=> /card_in_image <-; rewrite max_card. Qed. Hypothesis injf : injective f.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
leq_card_in
card_imageA : #|image f A| = #|A|. Proof. by apply: card_in_image; apply: in2W. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
card_image
card_codom: #|codom f| = #|T|. Proof. exact: card_image. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
card_codom
card_preim(B : {pred T'}) : #|[preim f of B]| = #|[predI codom f & B]|. Proof. rewrite -card_image /=; apply: eq_card => y. by rewrite [y \in _]image_pre !inE andbC. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
card_preim
leq_card: #|T| <= #|T'|. Proof. exact: (leq_card_in (in2W _)). Qed. Hypothesis card_range : #|T| >= #|T'|. Let eq_card : #|T| = #|T'|. Proof. by apply/eqP; rewrite eqn_leq leq_card. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
leq_card
inj_card_ontoy : y \in codom f. Proof. by move: y; apply/subset_cardP; rewrite ?card_codom ?subset_predT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
inj_card_onto
inj_card_bij: bijective f. Proof. by exists (fun y => iinv (inj_card_onto y)) => y; rewrite ?iinv_f ?f_iinv. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
inj_card_bij
bij_eq_card(T T' : finType) (f : T -> T') : bijective f -> #|T| = #|T'|. Proof. by move=> [g /can_inj/leq_card + /can_inj/leq_card]; case: ltngtP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
bij_eq_card
injF_ontoy : y \in codom f. Proof. exact: inj_card_onto. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
injF_onto
invFy := iinv (injF_onto y).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
invF
invF_f: cancel f invF. Proof. by move=> x; apply: iinv_f. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
invF_f
f_invF: cancel invF f. Proof. by move=> y; apply: f_iinv. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
f_invF
injF_bij: bijective f. Proof. exact: inj_card_bij. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
injF_bij
canF_sym: cancel g f. Proof. exact/(bij_can_sym (injF_bij (can_inj fK))). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
canF_sym
canF_LRx y : x = g y -> f x = y. Proof. exact: canLR canF_sym. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
canF_LR
canF_RLx y : g x = y -> x = f y. Proof. exact: canRL canF_sym. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
canF_RL
canF_eqx y : (f x == y) = (x == g y). Proof. exact: (can2_eq fK canF_sym). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool ssrnotations eqtype", "From mathcomp Require Import ssrnat seq choice path div" ]
boot/fintype.v
canF_eq