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
canF_invF: g =1 invF (can_inj fK). Proof. by move=> y; apply: (canLR fK); rewrite f_invF. 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_invF
eq_image(A B : {pred T}) (f g : T -> T') : A =i B -> f =1 g -> image f A = image g B. Proof. by move=> eqAB eqfg; rewrite /image_mem (eq_enum eqAB) (eq_map eqfg). 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_image
eq_codom(f g : T -> T') : f =1 g -> codom f = codom g. Proof. exact: eq_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
eq_codom
eq_invFf g injf injg : f =1 g -> @invF T f injf =1 @invF T g injg. Proof. by move=> eq_fg x; apply: (canLR (invF_f injf)); rewrite eq_fg f_invF. 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_invF
unit_enumP: Finite.axiom [::tt]. Proof. by case. Qed. HB.instance Definition _ := isFinite.Build unit unit_enumP.
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
unit_enumP
card_unit: #|{: unit}| = 1. Proof. by rewrite cardT enumT 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
card_unit
bool_enumP: Finite.axiom [:: true; false]. Proof. by case. Qed. HB.instance Definition _ := isFinite.Build bool bool_enumP.
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
bool_enumP
card_bool: #|{: bool}| = 2. Proof. by rewrite cardT enumT 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
card_bool
void_enumP: Finite.axiom (Nil void). Proof. by case. Qed. HB.instance Definition _ := isFinite.Build void void_enumP.
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
void_enumP
card_void: #|{: void}| = 0. Proof. by rewrite cardT enumT unlock. Qed. Local Notation enumF T := (Finite.enum T).
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_void
option_enum:= None :: map some (enumF 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
option_enum
option_enumP: Finite.axiom option_enum. Proof. by case=> [x|]; rewrite /= count_map (count_pred0, enumP). Qed. HB.instance Definition _ := isFinite.Build (option T) option_enumP.
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
option_enumP
card_option: #|{: option T}| = #|T|.+1. Proof. by rewrite !cardT !enumT [in LHS]unlock /= !size_map. 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_option
pcan_enumPg : pcancel f g -> Finite.axiom (undup (pmap g (enumF fT))). Proof. move=> fK x; rewrite count_uniq_mem ?undup_uniq // mem_undup. by rewrite mem_pmap -fK map_f // -enumT 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
pcan_enumP
PCanIsFiniteg fK := @isFinite.Build _ _ (@pcan_enumP g fK).
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
PCanIsFinite
CanIsFiniteg (fK : cancel f g) := PCanIsFinite (can_pcan fK).
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
CanIsFinite
Definition_ (g : fT -> option eT) (fK : pcancel f g) := isFinite.Build (pcan_type fK) (@pcan_enumP (pcan_type fK) fT f g fK). HB.instance Definition _ (g : fT -> eT) (fK : cancel f g) := isFinite.Build (can_type fK) (@pcan_enumP (can_type fK) fT f _ (can_pcan fK)).
HB.instance
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
DefinitionSubFinite (T : Type) (P : pred T) := { sT of Finite sT & isSub T P sT }.
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
codom_valsT x : (x \in codom (val : sT -> T)) = P x. Proof. by apply/codomP/idP=> [[u ->]|Px]; last exists (Sub x Px); rewrite ?valP ?SubK. 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_val
RecordSubCountable_isFinite (T : finType) P (sT : Type) of SubCountable T P sT := { }. HB.builders Context (T : finType) (P : pred T) (sT : Type) (a : SubCountable_isFinite T P sT).
HB.factory
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
Record
sub_enum: seq sT := pmap insub (enumF 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
sub_enum
mem_sub_enumu : u \in sub_enum. Proof. by rewrite mem_pmap_sub -enumT 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_sub_enum
sub_enum_uniq: uniq sub_enum. Proof. by rewrite pmap_sub_uniq // -enumT enum_uniq. 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
sub_enum_uniq
val_sub_enum: map val sub_enum = enum P. Proof. rewrite pmap_filter; last exact: insubK. by apply: eq_filter => x; apply: isSome_insub. Qed. HB.instance Definition SubFinMixin := isFinite.Build sT (Finite.uniq_enumP sub_enum_uniq mem_sub_enum). HB.end.
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
val_sub_enum
Definition_ (T : finType) (P : pred T) (sT : subType P) := (SubCountable_isFinite.Build _ _ (sub_type sT)).
HB.instance
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
card_sub: #|sfT| = #|[pred x | P x]|. Proof. by rewrite -(eq_card (codom_val sfT)) (card_image val_inj). 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_sub
eq_card_sub(A : {pred sfT}) : A =i predT -> #|A| = #|[pred x | P x]|. Proof. exact: eq_card_trans card_sub. 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_card_sub
Definition_ := [Finite of {x | P x} by <:].
HB.instance
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
card_sig: #|{: {x | P x}}| = #|[pred x | P x]|. Proof. exact: card_sub. 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_sig
seq_sub: Type := SeqSub {ssval : T; ssvalP : in_mem ssval (@mem T _ s)}. HB.instance Definition _ := [isSub for ssval]. HB.instance Definition _ := [Equality of seq_sub by <:].
Record
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
seq_sub
seq_sub_enum: seq seq_sub := undup (pmap insub 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
seq_sub_enum
mem_seq_sub_enumx : x \in seq_sub_enum. Proof. by rewrite mem_undup mem_pmap -valK map_f ?ssvalP. 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_seq_sub_enum
val_seq_sub_enum: uniq s -> map val seq_sub_enum = s. Proof. move=> Us; rewrite /seq_sub_enum undup_id ?pmap_sub_uniq //. rewrite (pmap_filter (insubK _)); apply/all_filterP. by apply/allP => x; rewrite isSome_insub. 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
val_seq_sub_enum
seq_sub_picklex := index x seq_sub_enum.
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
seq_sub_pickle
seq_sub_unpicklen := nth None (map some seq_sub_enum) 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
seq_sub_unpickle
seq_sub_pickleK: pcancel seq_sub_pickle seq_sub_unpickle. Proof. rewrite /seq_sub_unpickle => x. by rewrite (nth_map x) ?nth_index ?index_mem ?mem_seq_sub_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
seq_sub_pickleK
seq_sub_isCountable:= isCountable.Build seq_sub seq_sub_pickleK. Fact seq_sub_axiom : Finite.axiom seq_sub_enum. Proof. exact: Finite.uniq_enumP (undup_uniq _) mem_seq_sub_enum. Qed.
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
seq_sub_isCountable
seq_sub_isFinite:= isFinite.Build seq_sub seq_sub_axiom.
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
seq_sub_isFinite
adhoc_seq_sub_choiceType: choiceType := pcan_type seq_sub_pickleK.
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
adhoc_seq_sub_choiceType
adhoc_seq_sub_countType:= HB.pack_for countType seq_sub seq_sub_isCountable (Choice.class adhoc_seq_sub_choiceType).
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
adhoc_seq_sub_countType
adhoc_seq_sub_finType:= HB.pack_for finType seq_sub seq_sub_isFinite seq_sub_isCountable (Choice.class adhoc_seq_sub_choiceType).
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
adhoc_seq_sub_finType
seq_sub_defaults : size s > 0 -> seq_sub s. Proof. by case: s => // x s _; exists x; rewrite mem_head. 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
seq_sub_default
seq_subEs (s_gt0 : size s > 0) : s = map val (map (insubd (seq_sub_default s_gt0)) s : seq (seq_sub s)). Proof. by rewrite -map_comp map_id_in// => x x_in_s /=; rewrite 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
seq_subE
in_sub_seqs_gt0 := (insubd (seq_sub_default s_gt0)).
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
in_sub_seq
Definition_ := [Choice of sT by <:]. HB.instance Definition _ : isCountable sT := seq_sub_isCountable s. HB.instance Definition _ : isFinite sT := seq_sub_isFinite s.
HB.instance
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
card_seq_sub: uniq s -> #|{:sT}| = size s. Proof. by move=> Us; rewrite cardE enumT -(size_map val) unlock val_seq_sub_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
card_seq_sub
extremum_spec{T : eqType} (ord : rel T) {I : finType} (P : pred I) (F : I -> T) : I -> Type := ExtremumSpec (i : I) of P i & (forall j : I, P j -> ord (F i) (F j)) : extremum_spec ord P F i. Let arg_pred {T : eqType} ord {I : finType} (P : pred I) (F : I -> T) := [pred i | P i & [forall (j | P j), ord (F i) (F j)]].
Variant
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
extremum_spec
extremum:= odflt i0 (pick (arg_pred ord P F)). Hypothesis ord_refl : reflexive ord. Hypothesis ord_trans : transitive ord. Hypothesis ord_total : total ord. Hypothesis Pi0 : P i0.
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
extremum
extremumP: extremum_spec ord P F extremum. Proof. rewrite /extremum; case: pickP => [i /andP[Pi /'forall_implyP/= min_i] | no_i]. by split=> // j; apply/implyP. have := sort_sorted ord_total [seq F i | i <- enum P]. set s := sort _ _ => ss; have s_gt0 : size s > 0 by rewrite size_sort size_map -cardE; apply/card_gt0P; exists i0. pose t0 := nth (F i0) s 0; have: t0 \in s by rewrite mem_nth. rewrite mem_sort => /mapP/sig2_eqW[it0]; rewrite mem_enum => it0P def_t0. have /negP[/=] := no_i it0; rewrite [P _]it0P/=; apply/'forall_implyP=> j Pj. have /(nthP (F i0))[k g_lt <-] : F j \in s by rewrite mem_sort map_f ?mem_enum. by rewrite -def_t0 sorted_leq_nth. 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
extremumP
extremum_inP: extremum_spec ord P F (extremum ord i0 P F). Proof. rewrite /extremum; case: pickP => [i /andP[Pi /'forall_implyP/= min_i] | no_i]. by split=> // j; apply/implyP. pose TP := seq_sub [seq F i | i <- enum P]. have FPP (iP : {i | P i}) : F (proj1_sig iP) \in [seq F i | i <- enum P]. by rewrite map_f// mem_enum; apply: valP. pose FP := SeqSub (FPP _). have []//= := @extremumP _ _ (relpre val ord) (exist P i0 Pi0) xpredT FP. - by move=> [/= _/mapP[i iP ->]]; apply: ord_refl; rewrite mem_enum in iP. - move=> [/= _/mapP[j jP ->]] [/= _/mapP[i iP ->]] [/= _/mapP[k kP ->]]. by apply: ord_trans; rewrite !mem_enum in iP jP kP. - move=> [/= _/mapP[i iP ->]] [/= _/mapP[j jP ->]]. by apply: ord_total; rewrite !mem_enum in iP jP. - rewrite /FP => -[/= i Pi] _ /(_ (exist _ _ _))/= ordF. have /negP/negP/= := no_i i; rewrite Pi/= negb_forall => /existsP/sigW[j]. by rewrite negb_imply => /andP[Pj]; rewrite ordF. 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
extremum_inP
arg_min:= extremum leq i0 P F.
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
arg_min
arg_max:= extremum geq i0 P F.
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
arg_max
arg_minnP: extremum_spec leq P F arg_min. Proof. by apply: extremumP => //; [apply: leq_trans|apply: leq_total]. 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
arg_minnP
arg_maxnP: extremum_spec geq P F arg_max. Proof. apply: extremumP => //; first exact: leqnn. by move=> n m p mn np; apply: leq_trans mn. by move=> ??; apply: leq_total. 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
arg_maxnP
ordinal: predArgType := Ordinal m of m < n.
Inductive
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
ordinal
nat_of_ordi := let: Ordinal m _ := i in m. HB.instance Definition _ := [isSub of ordinal for nat_of_ord]. HB.instance Definition _ := [Countable of ordinal by <:].
Coercion
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
nat_of_ord
ltn_ord(i : ordinal) : i < n. Proof. exact: valP i. 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
ltn_ord
ord_inj: injective nat_of_ord. Proof. exact: val_inj. 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
ord_inj
ord_enum: seq ordinal := pmap insub (iota 0 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
ord_enum
val_ord_enum: map val ord_enum = iota 0 n. Proof. rewrite pmap_filter; last exact: insubK. by apply/all_filterP; apply/allP=> i; rewrite mem_iota isSome_insub. 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
val_ord_enum
ord_enum_uniq: uniq ord_enum. Proof. by rewrite pmap_sub_uniq ?iota_uniq. 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
ord_enum_uniq
mem_ord_enumi : i \in ord_enum. Proof. by rewrite -(mem_map ord_inj) val_ord_enum mem_iota ltn_ord. Qed. HB.instance Definition _ := isFinite.Build ordinal (Finite.uniq_enumP ord_enum_uniq mem_ord_enum).
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_ord_enum
val_enum_ord: map val (enum 'I_n) = iota 0 n. Proof. by rewrite enumT unlock val_ord_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
val_enum_ord
size_enum_ord: size (enum 'I_n) = n. Proof. by rewrite -(size_map val) val_enum_ord size_iota. 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_enum_ord
card_ord: #|'I_n| = n. Proof. by rewrite cardE size_enum_ord. 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_ord
nth_enum_ordi0 m : m < n -> nth i0 (enum 'I_n) m = m :> nat. Proof. by move=> ?; rewrite -(nth_map _ 0) (size_enum_ord, val_enum_ord) // nth_iota. 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
nth_enum_ord
nth_ord_enum(i0 i : 'I_n) : nth i0 (enum 'I_n) i = i. Proof. by apply: val_inj; apply: nth_enum_ord. 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
nth_ord_enum
index_enum_ord(i : 'I_n) : index i (enum 'I_n) = i. Proof. by rewrite -[in LHS](nth_ord_enum i i) index_uniq ?(enum_uniq, size_enum_ord). 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
index_enum_ord
mask_enum_ordm : mask m (enum 'I_n) = [seq i <- enum 'I_n | nth false m (val i)]. Proof. rewrite mask_filter ?enum_uniq//; apply: eq_filter => i. by rewrite in_mask ?enum_uniq ?mem_enum// index_enum_ord. 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
mask_enum_ord
enum_ord0: enum 'I_0 = [::]. Proof. by apply/eqP; rewrite -size_eq0 size_enum_ord. 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
enum_ord0
widen_ord_proofn m (i : 'I_n) : n <= m -> i < m. Proof. exact: leq_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
widen_ord_proof
widen_ordn m le_n_m i := Ordinal (@widen_ord_proof n m i le_n_m).
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
widen_ord
cast_ord_proofn m (i : 'I_n) : n = m -> i < m. Proof. by move <-. 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
cast_ord_proof
cast_ordn m eq_n_m i := Ordinal (@cast_ord_proof n m i eq_n_m).
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
cast_ord
cast_ord_idn eq_n i : cast_ord eq_n i = i :> 'I_n. Proof. exact: val_inj. 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
cast_ord_id
cast_ord_compn1 n2 n3 eq_n2 eq_n3 i : @cast_ord n2 n3 eq_n3 (@cast_ord n1 n2 eq_n2 i) = cast_ord (etrans eq_n2 eq_n3) i. Proof. exact: val_inj. 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
cast_ord_comp
cast_ordKn1 n2 eq_n : cancel (@cast_ord n1 n2 eq_n) (cast_ord (esym eq_n)). Proof. by move=> i; apply: val_inj. 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
cast_ordK
cast_ordKVn1 n2 eq_n : cancel (cast_ord (esym eq_n)) (@cast_ord n1 n2 eq_n). Proof. by move=> i; apply: val_inj. 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
cast_ordKV
cast_ord_injn1 n2 eq_n : injective (@cast_ord n1 n2 eq_n). Proof. exact: can_inj (cast_ordK eq_n). Qed. Fact ordS_subproof n (i : 'I_n) : i.+1 %% n < n. Proof. by case: n i => [|n] [m m_lt]//=; rewrite ltn_pmod. 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
cast_ord_inj
ordSn (i : 'I_n) := Ordinal (ordS_subproof i). Fact ord_pred_subproof n (i : 'I_n) : (i + n).-1 %% n < n. Proof. by case: n i => [|n] [m m_lt]//=; rewrite ltn_pmod. Qed.
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
ordS
ord_predn (i : 'I_n) := Ordinal (ord_pred_subproof i).
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
ord_pred
ordSKn : cancel (@ordS n) (@ord_pred n). Proof. move=> [i ilt]; apply/val_inj => /=. case: (ltngtP i.+1) (ilt) => // [Silt|<-]; last by rewrite modnn/= modn_small. by rewrite [i.+1 %% n]modn_small// addSn/= modnDr modn_small. 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
ordSK
ord_predKn : cancel (@ord_pred n) (@ordS n). Proof. move=> [[|i] ilt]; apply/val_inj => /=. by rewrite [n.-1 %% n]modn_small// prednK// modnn. by rewrite modnDr [i %% n]modn_small ?modn_small// ltnW. 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
ord_predK
ordS_bijn : bijective (@ordS n). Proof. exact: (Bijective (@ordSK n) (@ord_predK n)). 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
ordS_bij
ordS_injn : injective (@ordS n). Proof. exact: (bij_inj (ordS_bij n)). 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
ordS_inj
ord_pred_bijn : bijective (@ord_pred n). Proof. exact (Bijective (@ord_predK n) (@ordSK n)). 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
ord_pred_bij
ord_pred_injn : injective (@ord_pred n). Proof. exact: (bij_inj (ord_pred_bij n)). 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
ord_pred_inj
rev_ord_proofn (i : 'I_n) : n - i.+1 < n. Proof. by case: n i => [|n] [i lt_i_n] //; rewrite ltnS subSS leq_subr. 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
rev_ord_proof
rev_ordn i := Ordinal (@rev_ord_proof n i).
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
rev_ord
rev_ordK{n} : involutive (@rev_ord n). Proof. by case: n => [|n] [i lti] //; apply: val_inj; rewrite /= !subSS subKn. 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
rev_ordK
rev_ord_inj{n} : injective (@rev_ord n). Proof. exact: inv_inj rev_ordK. 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
rev_ord_inj
inj_leqm n (f : 'I_m -> 'I_n) : injective f -> m <= n. Proof. by move=> /leq_card; rewrite !card_ord. Qed. Arguments inj_leq [m n] 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
inj_leq
enum_rank_subproof(T : finType) x0 (A : {pred T}) : x0 \in A -> 0 < #|A|. Proof. by move=> Ax0; rewrite (cardD1 x0) Ax0. Qed. HB.lock
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
enum_rank_subproof
enum_rank_in(T : finType) x0 (A : {pred T}) (Ax0 : x0 \in A) x := insubd (Ordinal (@enum_rank_subproof T x0 [eta A] Ax0)) (index x (enum A)).
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
enum_rank_in
unlockable_enum_rank_in:= Unlockable enum_rank_in.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
unlockable_enum_rank_in
enum_rankx := @enum_rank_in T x T (erefl true) x.
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
enum_rank
enum_defaultA : 'I_(#|A|) -> T. Proof. by rewrite cardE; case: (enum 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
enum_default
enum_valA i := nth (@enum_default [eta A] i) (enum A) i. Prenex Implicits enum_val.
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
enum_val
enum_valPA i : @enum_val A i \in A. Proof. by rewrite -mem_enum mem_nth -?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
enum_valP
enum_val_nthA x i : @enum_val A i = nth x (enum A) i. Proof. by apply: set_nth_default; rewrite cardE in i *; apply: ltn_ord. 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
enum_val_nth