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
partition0P D : partition P D -> set0 \in P = false. Proof. case/and3P => _ _. by apply: contraNF. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partition0
partition_neq0P D B : partition P D -> B \in P -> B != set0. Proof. by move=> partP; apply: contraTneq => ->; rewrite (partition0 partP). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partition_neq0
partition_trivIsetP D : partition P D -> trivIset P. Proof. by case/and3P. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partition_trivIset
partitionSP D B : partition P D -> B \in P -> B \subset D. Proof. by move=> partP BP; rewrite -(cover_partition partP); apply: bigcup_max BP _. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partitionS
partitionD1P D B : partition P D -> B \in P -> partition (P :\ B) (D :\: B). Proof. case/and3P => /eqP covP trivP set0P SP. by rewrite /partition inE (negbTE set0P) trivIsetD ?coverD1 -?covP ?eqxx ?andbF. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partitionD1
partitionU1P D B : partition P D -> B != set0 -> [disjoint B & D] -> partition (B |: P) (B :|: D). Proof. case/and3P => /eqP covP trivP set0P BD0 disSD. rewrite /partition !inE (negbTE set0P) orbF [_ == B]eq_sym BD0 andbT. rewrite /cover bigcup_setU /= big_set1 -covP eqxx /=. by move: disSD; rewrite -covP=> /bigcup_disjointP/trivIsetU1 => -[]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partitionU1
partition_set0P : partition P set0 = (P == set0). Proof. apply/and3P/eqP => [[/bigcup0P covP _ ]|->]; last first. by rewrite /partition inE /trivIset/cover !big_set0 cards0 !eqxx. by apply: contraNeq => /set0Pn[B BP]; rewrite -(covP B BP). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partition_set0
card_partitionP D : partition P D -> #|D| = \sum_(A in P) #|A|. Proof. by case/and3P=> /eqP <- /eqnP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
card_partition
card_uniform_partitionn P D : {in P, forall A, #|A| = n} -> partition P D -> #|D| = #|P| * n. Proof. by move=> uniP /card_partition->; rewrite -sum_nat_const; apply: eq_bigr. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
card_uniform_partition
partition_pigeonholeP D A : partition P D -> #|P| <= #|A| -> A \subset D -> {in P, forall B, #|A :&: B| <= 1} -> {in P, forall B, A :&: B != set0}. Proof. move=> partP card_A_P /subsetP subAD sub1; apply/forall_inP. apply: contraTT card_A_P => /forall_inPn [B BP]; rewrite negbK => AB0. rewrite -!ltnNge -(setD1K BP) cardsU1 !inE eqxx /= add1n ltnS. have [tP covP] := (partition_trivIset partP,cover_partition partP). have APx x : x \in A -> x \in pblock P x by rewrite mem_pblock covP; apply: subAD. have inj_f : {in A &, injective (pblock P)}. move=> x y xA yA /eqP; rewrite eq_pblock ?covP ?subAD // => Pxy. apply: (@card_le1_eqP _ (A :&: pblock P x)); rewrite ?inE ?Pxy ?APx ?andbT //. by apply: sub1; rewrite pblock_mem ?covP ?subAD. rewrite -(card_in_imset inj_f); apply: subset_leq_card. apply/subsetP => ? /imsetP[x xA ->]. rewrite !inE pblock_mem ?covP ?subAD ?andbT //. by apply: contraTneq AB0 => <-; apply/set0Pn; exists x; rewrite inE APx ?andbT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partition_pigeonhole
big_trivIset_condP (K : pred T) (E : T -> R) : trivIset P -> \big[op/idx]_(x in cover P | K x) E x = rhs_cond P K E. Proof. move=> tiP; rewrite (partition_big (pblock P) [in P]) -/op => /= [|x]. apply: eq_bigr => A PA; apply: eq_bigl => x; rewrite andbAC; congr (_ && _). rewrite -mem_pblock; apply/andP/idP=> [[Px /eqP <- //] | Ax]. by rewrite (def_pblock tiP PA Ax). by case/andP=> Px _; apply: pblock_mem. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
big_trivIset_cond
big_trivIsetP (E : T -> R) : trivIset P -> \big[op/idx]_(x in cover P) E x = rhs P E. Proof. have biginT := eq_bigl _ _ (fun _ => andbT _) => tiP. by rewrite -biginT big_trivIset_cond //; apply: eq_bigr => A _; apply: biginT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
big_trivIset
set_partition_big_condP D (K : pred T) (E : T -> R) : partition P D -> \big[op/idx]_(x in D | K x) E x = rhs_cond P K E. Proof. by case/and3P=> /eqP <- tI_P _; apply: big_trivIset_cond. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
set_partition_big_cond
set_partition_bigP D (E : T -> R) : partition P D -> \big[op/idx]_(x in D) E x = rhs P E. Proof. by case/and3P=> /eqP <- tI_P _; apply: big_trivIset. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
set_partition_big
partition_disjoint_bigcup(F : I -> {set T}) E : (forall i j, i != j -> [disjoint F i & F j]) -> \big[op/idx]_(x in \bigcup_i F i) E x = \big[op/idx]_i \big[op/idx]_(x in F i) E x. Proof. move=> disjF; pose P := [set F i | i in I & F i != set0]. have trivP: trivIset P. apply/trivIsetP=> _ _ /imsetP[i _ ->] /imsetP[j _ ->] neqFij. by apply: disjF; apply: contraNneq neqFij => ->. have ->: \bigcup_i F i = cover P. apply/esym; rewrite cover_imset big_mkcond; apply: eq_bigr => i _. by rewrite inE; case: eqP. rewrite big_trivIset // /rhs big_imset => [|i j _ /setIdP[_ notFj0] eqFij]. rewrite big_mkcond; apply: eq_bigr => i _; rewrite inE. by case: eqP => //= ->; rewrite big_set0. by apply: contraNeq (disjF _ _) _; rewrite -setI_eq0 eqFij setIid. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partition_disjoint_bigcup
equivalence_partition:= [set Px x | x in D]. Local Notation P := equivalence_partition. Hypothesis eqiR : {in D & &, equivalence_rel R}. Let Pxx x : x \in D -> x \in Px x. Proof. by move=> Dx; rewrite !inE Dx (eqiR Dx Dx). Qed. Let PPx x : x \in D -> Px x \in P := fun Dx => imset_f _ Dx.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
equivalence_partition
equivalence_partitionP: partition P D. Proof. have defD: cover P == D. rewrite eqEsubset; apply/andP; split. by apply/bigcupsP=> _ /imsetP[x Dx ->]; rewrite /Px setIdE subsetIl. by apply/subsetP=> x Dx; apply/bigcupP; exists (Px x); rewrite (Pxx, PPx). have tiP: trivIset P. apply/trivIsetP=> _ _ /imsetP[x Dx ->] /imsetP[y Dy ->]; apply: contraR. case/pred0Pn=> z /andP[] /[!inE] /andP[Dz Rxz] /andP[_ Ryz]. apply/eqP/setP=> t /[!inE]; apply: andb_id2l => Dt. by rewrite (eqiR Dx Dz Dt) // (eqiR Dy Dz Dt). rewrite /partition tiP defD /=. by apply/imsetP=> [[x /Pxx Px_x Px0]]; rewrite -Px0 inE in Px_x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
equivalence_partitionP
pblock_equivalence_partition: {in D &, forall x y, (y \in pblock P x) = R x y}. Proof. have [_ tiP _] := and3P equivalence_partitionP. by move=> x y Dx Dy; rewrite /= (def_pblock tiP (PPx Dx) (Pxx Dx)) inE Dy. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
pblock_equivalence_partition
pblock_equivalenceP D : partition P D -> {in D & &, equivalence_rel (fun x y => y \in pblock P x)}. Proof. case/and3P=> /eqP <- tiP _ x y z Px Py Pz. by rewrite mem_pblock; split=> // /same_pblock->. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
pblock_equivalence
equivalence_partition_pblockP D : partition P D -> equivalence_partition (fun x y => y \in pblock P x) D = P. Proof. case/and3P=> /eqP <-{D} tiP notP0; apply/setP=> B /=; set D := cover P. have defP x: x \in D -> [set y in D | y \in pblock P x] = pblock P x. by move=> Dx; apply/setIidPr; rewrite (bigcup_max (pblock P x)) ?pblock_mem. apply/imsetP/idP=> [[x Px ->{B}] | PB]; first by rewrite defP ?pblock_mem. have /set0Pn[x Bx]: B != set0 := memPn notP0 B PB. have Px: x \in cover P by apply/bigcupP; exists B. by exists x; rewrite // defP // (def_pblock tiP PB Bx). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
equivalence_partition_pblock
preim_partition:= equivalence_partition (fun x y => f x == f y).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
preim_partition
preim_partitionPD : partition (preim_partition D) D. Proof. by apply/equivalence_partitionP; split=> // /eqP->. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
preim_partitionP
preim_partition_pblockP D : partition P D -> preim_partition (pblock P) D = P. Proof. move=> partP; have [/eqP defD tiP _] := and3P partP. rewrite -{2}(equivalence_partition_pblock partP); apply: eq_in_imset => x Dx. by apply/setP=> y; rewrite !inE eq_pblock ?defD. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
preim_partition_pblock
transversalPP D : partition P D -> is_transversal (transversal P D) P D. Proof. case/and3P=> /eqP <- tiP notP0; apply/and3P; split; first exact/and3P. apply/subsetP=> _ /imsetP[x Px ->]; case: pickP => //= y Pxy. by apply/bigcupP; exists (pblock P x); rewrite ?pblock_mem //. apply/forall_inP=> B PB; have /set0Pn[x Bx]: B != set0 := memPn notP0 B PB. apply/cards1P; exists (odflt x [pick y in pblock P x]); apply/esym/eqP. rewrite eqEsubset sub1set !inE -andbA; apply/andP; split. by apply/imset_f/bigcupP; exists B. rewrite (def_pblock tiP PB Bx); case def_y: _ / pickP => [y By | /(_ x)/idP//]. rewrite By /=; apply/subsetP=> _ /setIP[/imsetP[z Pz ->]]. case: {1}_ / pickP => [t zPt Bt | /(_ z)/idP[]]; last by rewrite mem_pblock. by rewrite -(same_pblock tiP zPt) (def_pblock tiP PB Bt) def_y inE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
transversalP
transversal_sub: X \subset D. Proof. by case/and3P: trPX. Qed. Let tiP : trivIset P. Proof. by case/andP: trPX => /and3P[]. Qed. Let sXP : {subset X <= cover P}. Proof. by case/and3P: trPX => /andP[/eqP-> _] /subsetP. Qed. Let trX : {in P, forall B, #|X :&: B| == 1}. Proof. by case/and3P: trPX => _ _ /forall_inP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
transversal_sub
setI_transversal_pblockx0 B : B \in P -> X :&: B = [set transversal_repr x0 X B]. Proof. by case/trX/cards1P=> x defXB; rewrite /transversal_repr defXB /pick enum_set1. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
setI_transversal_pblock
repr_mem_pblockx0 B : B \in P -> transversal_repr x0 X B \in B. Proof. by move=> PB; rewrite -sub1set -setI_transversal_pblock ?subsetIr. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
repr_mem_pblock
repr_mem_transversalx0 B : B \in P -> transversal_repr x0 X B \in X. Proof. by move=> PB; rewrite -sub1set -setI_transversal_pblock ?subsetIl. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
repr_mem_transversal
transversal_reprKx0 : {in P, cancel (transversal_repr x0 X) (pblock P)}. Proof. by move=> B PB; rewrite /= (def_pblock tiP PB) ?repr_mem_pblock. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
transversal_reprK
pblockKx0 : {in X, cancel (pblock P) (transversal_repr x0 X)}. Proof. move=> x Xx; have /bigcupP[B PB Bx] := sXP Xx; rewrite (def_pblock tiP PB Bx). by apply/esym/set1P; rewrite -setI_transversal_pblock // inE Xx. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
pblockK
pblock_inj: {in X &, injective (pblock P)}. Proof. by move=> x0; apply: (can_in_inj (pblockK x0)). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
pblock_inj
pblock_transversal: pblock P @: X = P. Proof. apply/setP=> B; apply/imsetP/idP=> [[x Xx ->] | PB]. by rewrite pblock_mem ?sXP. have /cards1P[x0 _] := trX PB; set x := transversal_repr x0 X B. by exists x; rewrite ?transversal_reprK ?repr_mem_transversal. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
pblock_transversal
card_transversal: #|X| = #|P|. Proof. by rewrite -pblock_transversal card_in_imset //; apply: pblock_inj. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
card_transversal
im_transversal_reprx0 : transversal_repr x0 X @: P = X. Proof. rewrite -{2}[X]imset_id -pblock_transversal -imset_comp. by apply: eq_in_imset; apply: pblockK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
im_transversal_repr
partition_partition(T : finType) (D : {set T}) P Q : partition P D -> partition Q P -> partition (cover @: Q) D /\ {in Q &, injective cover}. Proof. move=> /and3P[/eqP defG tiP notP0] /and3P[/eqP defP tiQ notQ0]. have sQP E: E \in Q -> {subset E <= P}. by move=> Q_E; apply/subsetP; rewrite -defP (bigcup_max E). rewrite /partition cover_imset -(big_trivIset _ tiQ) defP -defG eqxx /= andbC. have{} notQ0: set0 \notin cover @: Q. apply: contra notP0 => /imsetP[E Q_E E0]. have /set0Pn[/= A E_A] := memPn notQ0 E Q_E. congr (_ \in P): (sQP E Q_E A E_A). by apply/eqP; rewrite -subset0 E0 (bigcup_max A). rewrite notQ0; apply: trivIimset => // E F Q_E Q_F. apply: contraR => /pred0Pn[x /andP[/bigcupP[A E_A Ax] /bigcupP[B F_B Bx]]]. rewrite -(def_pblock tiQ Q_E E_A) -(def_pblock tiP _ Ax) ?(sQP E) //. by rewrite -(def_pblock tiQ Q_F F_B) -(def_pblock tiP _ Bx) ?(sQP F). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
partition_partition
indexed_partition(I T : finType) (J : {pred I}) (B : I -> {set T}) : let P := [set B i | i in J] in {in J &, forall i j : I, j != i -> [disjoint B i & B j]} -> (forall i : I, J i -> B i != set0) -> partition P (cover P) /\ {in J &, injective B}. Proof. move=> P disjB inhB; have s0NP : set0 \notin P. by apply/negP => /imsetP[x xI /eqP]; apply/negP; rewrite eq_sym inhB. by rewrite /partition eqxx s0NP andbT /=; apply: trivIimset. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
indexed_partition
imset_trivIset: trivIset fP = trivIset P. Proof. apply/trivIsetP/trivIsetP => [trivP A B AP BP|]. - rewrite -(imset_disjoint inj_f) -(inj_eq (imset_inj inj_f)). by apply: trivP; rewrite imset_f. - move=> trivP ? ? /imsetP[A AP ->] /imsetP[B BP ->]. by rewrite (inj_eq (imset_inj inj_f)) imset_disjoint //; apply: trivP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
imset_trivIset
imset0mem: (set0 \in fP) = (set0 \in P). Proof. apply/imsetP/idP => [[A AP /esym/eqP]|P0]; last by exists set0; rewrite ?imset0. by rewrite imset_eq0 => /eqP<-. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
imset0mem
imset_partition: partition fP (f @: D) = partition P D. Proof. suff cov: (cover fP == f @:D) = (cover P == D). by rewrite /partition -imset_trivIset imset0mem cov. by rewrite /fP cover_imset -imset_cover (inj_eq (imset_inj inj_f)). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
imset_partition
sT:= {set T}. Implicit Types A B C : sT. Implicit Type P : pred sT.
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
sT
minsetP A := [forall (B : sT | B \subset A), (B == A) == P B].
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minset
minset_eqP1 P2 A : P1 =1 P2 -> minset P1 A = minset P2 A. Proof. by move=> eP12; apply: eq_forallb => B; rewrite eP12. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minset_eq
minsetPP A : reflect ((P A) /\ (forall B, P B -> B \subset A -> B = A)) (minset P A). Proof. apply: (iffP forallP) => [minA | [PA minA] B]. split; first by have:= minA A; rewrite subxx eqxx /= => /eqP. by move=> B PB sBA; have:= minA B; rewrite PB sBA /= eqb_id => /eqP. by apply/implyP=> sBA; apply/eqP; apply/eqP/idP=> [-> // | /minA]; apply. Qed. Arguments minsetP {P A}.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minsetP
minsetpP A : minset P A -> P A. Proof. by case/minsetP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minsetp
minsetinfP A B : minset P A -> P B -> B \subset A -> B = A. Proof. by case/minsetP=> _; apply. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minsetinf
ex_minsetP : (exists A, P A) -> {A | minset P A}. Proof. move=> exP; pose pS n := [pred B | P B & #|B| == n]. pose p n := ~~ pred0b (pS n); have{exP}: exists n, p n. by case: exP => A PA; exists #|A|; apply/existsP; exists A; rewrite /= PA /=. case/ex_minnP=> n /pred0P; case: (pickP (pS n)) => // A /andP[PA] /eqP <-{n} _. move=> minA; exists A => //; apply/minsetP; split=> // B PB sBA; apply/eqP. by rewrite eqEcard sBA minA //; apply/pred0Pn; exists B; rewrite /= PB /=. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
ex_minset
minset_existsP C : P C -> {A | minset P A & A \subset C}. Proof. move=> PC; have{PC}: exists A, P A && (A \subset C) by exists C; rewrite PC /=. case/ex_minset=> A /minsetP[/andP[PA sAC] minA]; exists A => //; apply/minsetP. by split=> // B PB sBA; rewrite (minA B) // PB (subset_trans sBA). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minset_exists
maxsetP A := minset (fun B => locked_with maxset_key P (~: B)) (~: A).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxset
maxset_eqP1 P2 A : P1 =1 P2 -> maxset P1 A = maxset P2 A. Proof. by move=> eP12; apply: minset_eq => x /=; rewrite !unlock_with eP12. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxset_eq
maxminsetP A : maxset P A = minset [pred B | P (~: B)] (~: A). Proof. by rewrite /maxset unlock. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxminset
minmaxsetP A : minset P A = maxset [pred B | P (~: B)] (~: A). Proof. by rewrite /maxset unlock setCK; apply: minset_eq => B /=; rewrite setCK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minmaxset
maxsetPP A : reflect ((P A) /\ (forall B, P B -> A \subset B -> B = A)) (maxset P A). Proof. apply: (iffP minsetP); rewrite ?setCK unlock_with => [] [PA minA]. by split=> // B PB sAB; rewrite -[B]setCK [~: B]minA (setCK, setCS). by split=> // B PB' sBA'; rewrite -(minA _ PB') -1?setCS setCK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxsetP
maxsetpP A : maxset P A -> P A. Proof. by case/maxsetP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxsetp
maxsetsupP A B : maxset P A -> P B -> A \subset B -> B = A. Proof. by case/maxsetP=> _; apply. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxsetsup
ex_maxsetP : (exists A, P A) -> {A | maxset P A}. Proof. move=> exP; have{exP}: exists A, P (~: A). by case: exP => A PA; exists (~: A); rewrite setCK. by case/ex_minset=> A minA; exists (~: A); rewrite /maxset unlock setCK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
ex_maxset
maxset_existsP C : P C -> {A : sT | maxset P A & C \subset A}. Proof. move=> PC; pose P' B := P (~: B); have: P' (~: C) by rewrite /P' setCK. case/minset_exists=> B; rewrite -[B]setCK setCS. by exists (~: B); rewrite // /maxset unlock. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxset_exists
subset_iterSi : iterF i \subset iterF i.+1. Proof. by elim: i => [| i IHi]; rewrite /= ?sub0set ?F_mono. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
subset_iterS
subset_iter: {homo iterF : i j / i <= j >-> i \subset j}. Proof. by apply: homo_leq => //[? ? ?|]; [apply: subset_trans|apply: subset_iterS]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
subset_iter
fixset:= iterF n.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fixset
fixsetK: F fixset = fixset. Proof. suff /'exists_eqP[x /= e]: [exists k : 'I_n.+1, iterF k == iterF k.+1]. by rewrite /fixset -(subnK (leq_ord x)) /iterF iterD iter_fix. apply: contraT => /existsPn /(_ (Ordinal _)) /= neq_iter. suff iter_big k : k <= n.+1 -> k <= #|iter k F set0|. by have := iter_big _ (leqnn _); rewrite ltnNge max_card. elim: k => [|k IHk] k_lt //=; apply: (leq_ltn_trans (IHk (ltnW k_lt))). by rewrite proper_card// properEneq// subset_iterS neq_iter. Qed. Hint Resolve fixsetK : core.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fixsetK
minset_fix: minset [pred X | F X == X] fixset. Proof. apply/minsetP; rewrite inE fixsetK eqxx; split=> // X /eqP FXeqX Xsubfix. apply/eqP; rewrite eqEsubset Xsubfix/=. suff: fixset \subset iter n F X by rewrite iter_fix. by rewrite /fixset; elim: n => //= [|m IHm]; rewrite ?sub0set ?F_mono. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
minset_fix
fixsetKnk : iter k F fixset = fixset. Proof. by rewrite iter_fix. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fixsetKn
iter_sub_fixk : iterF k \subset fixset. Proof. have [/subset_iter //|/ltnW/subnK<-] := leqP k n; by rewrite /iterF iterD fixsetKn. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
iter_sub_fix
fix_order_proofx : x \in fixset -> exists n, x \in iterF n. Proof. by move=> x_fix; exists n. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fix_order_proof
fix_order(x : T) := if (x \in fixset) =P true isn't ReflectT x_fix then 0 else (ex_minn (fix_order_proof x_fix)).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fix_order
fix_order_le_max(x : T) : fix_order x <= n. Proof. rewrite /fix_order; case: eqP => //= x_in. by case: ex_minnP => //= ? ?; apply. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fix_order_le_max
in_iter_fix_orderE(x : T) : (x \in iterF (fix_order x)) = (x \in fixset). Proof. rewrite /fix_order; case: eqP => [x_in | /negP/negPf-> /[1!inE]//]. by case: ex_minnP => m ->; rewrite x_in. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
in_iter_fix_orderE
fix_order_gt0(x : T) : (fix_order x > 0) = (x \in fixset). Proof. rewrite /fix_order; case: eqP => [x_in | /negP/negPf->//]. by rewrite x_in; case: ex_minnP => -[/[!inE] | m]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fix_order_gt0
fix_order_eq0(x : T) : (fix_order x == 0) = (x \notin fixset). Proof. by rewrite -fix_order_gt0 -ltnNge ltnS leqn0. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fix_order_eq0
in_iter_fixE(x : T) k : (x \in iterF k) = (0 < fix_order x <= k). Proof. rewrite /fix_order; case: eqP => //= [x_in|/negP xNin]; last first. by apply: contraNF xNin; apply/subsetP/iter_sub_fix. case: ex_minnP => -[/[!inE]//|m] xm mP. by apply/idP/idP=> [/mP//|lt_mk]; apply: subsetP xm; apply: subset_iter. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
in_iter_fixE
in_iter(x : T) k : x \in fixset -> fix_order x <= k -> x \in iterF k. Proof. by move=> x_in xk; rewrite in_iter_fixE fix_order_gt0 x_in xk. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
in_iter
notin_iter(x : T) k : k < fix_order x -> x \notin iterF k. Proof. by move=> k_le; rewrite in_iter_fixE negb_and orbC -ltnNge k_le. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
notin_iter
fix_order_smallx k : x \in iterF k -> fix_order x <= k. Proof. by rewrite in_iter_fixE => /andP[]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fix_order_small
fix_order_bigx k : x \in fixset -> x \notin iterF k -> fix_order x > k. Proof. by move=> x_in; rewrite in_iter_fixE fix_order_gt0 x_in /= -ltnNge. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fix_order_big
le_fix_order(x y : T) : y \in iterF (fix_order x) -> fix_order y <= fix_order x. Proof. exact: fix_order_small. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
le_fix_order
funsetCX := ~: (F (~: X)).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
funsetC
funsetC_mono: {homo funsetC : X Y / X \subset Y}. Proof. by move=> *; rewrite subCset setCK F_mono// subCset setCK. Qed. Hint Resolve funsetC_mono : core.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
funsetC_mono
cofixset:= ~: fixset funsetC.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
cofixset
cofixsetK: F cofixset = cofixset. Proof. by rewrite /cofixset -[in RHS]fixsetK ?setCK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
cofixsetK
maxset_cofix: maxset [pred X | F X == X] cofixset. Proof. rewrite maxminset setCK. rewrite (@minset_eq _ _ [pred X | funsetC X == X]) ?minset_fix//. by move=> X /=; rewrite (can2_eq setCK setCK). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
maxset_cofix
card_fprod: #|fprod T_| = \prod_(i : I) #|T_ i|. Proof. rewrite card_sub (card_family (tagged_with T_)) foldrE big_image/=. apply: eq_bigr => i _/=; rewrite -card_sig; apply/esym. exact: bij_eq_card (tag_with_bij T_ i). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
card_fprod
fprod_pick: 0 < #|fprod T_| -> forall i : I, T_ i. Proof. by rewrite card_fprod => /[swap] i /gt0_prodn/(_ i isT) /card_gt0P/sigW[]. Qed.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
fprod_pick
ftagged(T_gt0 : 0 < #|fprod T_|) (f : {ffun I -> {i : I & T_ i}}) (i : I) := @untag I T_ (T_ i) (fprod_pick T_gt0 i) i id (f i).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
ftagged
ftaggedEt T_gt0 i : ftagged T_gt0 (fprod_fun t) i = t i. Proof. by rewrite /ftagged untagE ?tag_fprod_fun// => e; rewrite etaggedE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
ftaggedE
big_tag_cond(Q_ : forall i, {pred T_ i}) (P_ : forall i : I, T_ i -> R) (i : I) : \big[op/idx]_(j in Q_ i) P_ i j = \big[op/idx]_(j in tagged_with T_ i | untag true (Q_ i) j) untag idx (P_ i) j. Proof. rewrite (big_sub_cond (tagged_with T_ i)). rewrite (reindex (tag_with i)); last exact/onW_bij/tag_with_bij. by apply: eq_big => [x|x Qix]; rewrite ?untagE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
big_tag_cond
big_tag(P_ : forall i : I, T_ i -> R) (i : I) : \big[op/idx]_(j : T_ i) P_ i j = \big[op/idx]_(j in tagged_with T_ i) untag idx (P_ i) j. Proof. by rewrite big_tag_cond; under eq_bigl do rewrite untag_cst ?andbT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
big_tag
big_fprod_dep(Q : {pred {ffun I -> {i : I & (T_ i)}}}) : \big[plus/zero]_(t : T | Q (fprod_fun t)) \big[times/one]_(i : I) P_ i (t i) = \big[plus/zero]_(g in family (tagged_with T_) | Q g) \big[times/one]_(i : I) (untag zero (P_ i) (g i)). Proof. rewrite (reindex (@of_family_tagged_with _ T_)); last first. exact/onW_bij/of_family_tagged_with_bij. rewrite [in RHS]big_sub_cond; apply/esym/eq_bigr => -[/= f fP] Qf. apply: eq_bigr => i _; rewrite /fun_of_fprod/=. by case: (f i) ('forall_eqP _ _) => //= j t; case: _ /; rewrite untagE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
big_fprod_dep
big_fprod: \big[plus/zero]_(t : T) \big[times/one]_(i in I) P_ i (t i) = \big[plus/zero]_(g in family (tagged_with T_)) \big[times/one]_(i : I) (untag zero (P_ i) (g i)). Proof. by rewrite (big_fprod_dep predT) big_mkcondr. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat div seq", "From mathcomp Require Import choice fintype finfun bigop" ]
boot/finset.v
big_fprod
finite_axiom(T : eqType) e := forall x : T, count_mem x e = 1. HB.mixin Record isFinite T of Equality T := { enum_subdef : seq T; enumP_subdef : finite_axiom enum_subdef }.
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
finite_axiom
DefinitionFinite := {T of isFinite T & Countable T }.
HB.structure
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
Definition
axiom:= finite_axiom.
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
axiom
uniq_enumP(T : eqType) e : uniq e -> e =i T -> axiom e. Proof. by move=> Ue sT x; rewrite count_uniq_mem ?sT. 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
uniq_enumP
count_enum:= pmap (@pickle_inv T) (iota 0 n). Hypothesis ubT : forall x : T, pickle x < n.
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
count_enum
count_enumP: axiom count_enum. Proof. apply: uniq_enumP (pmap_uniq (@pickle_invK T) (iota_uniq _ _)) _ => x. by rewrite mem_pmap -pickleK_inv map_f // mem_iota ubT. 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
count_enumP
finEnum_unlock:= Unlockable Finite.enum.unlock.
Canonical
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
finEnum_unlock
fin_typeof finite_axiom s : Type := T. Variable (f : finite_axiom s).
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
fin_type
fT:= (fin_type f).
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
fT
fin_pickle(x : fT) : nat := index x s.
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
fin_pickle
fin_unpickle(n : nat) : option fT := nth None (map some s) n.
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
fin_unpickle
fin_pickleK: pcancel fin_pickle fin_unpickle. Proof. move=> x; rewrite /fin_pickle/fin_unpickle. rewrite -(index_map Some_inj) nth_index ?map_f//. by apply/count_memPn=> /eqP; rewrite f. Qed. HB.instance Definition _ := Equality.on fT. HB.instance Definition _ := isCountable.Build fT fin_pickleK. HB.instance Definition _ := isFinite.Build fT 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
fin_pickleK