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 |
|---|---|---|---|---|---|---|
leq_sumI r (P : pred I) (E1 E2 : I -> nat) :
(forall i, P i -> E1 i <= E2 i) ->
\sum_(i <- r | P i) E1 i <= \sum_(i <- r | P i) E2 i.
Proof. by move=> leE12; elim/big_ind2: _ => // m1 m2 n1 n2; apply: leq_add. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | leq_sum | |
sumnBI r (P : pred I) (E1 E2 : I -> nat) :
(forall i, P i -> E1 i <= E2 i) ->
\sum_(i <- r | P i) (E2 i - E1 i) =
\sum_(i <- r | P i) E2 i - \sum_(i <- r | P i) E1 i.
Proof. by move=> /(_ _ _)/subnK-/(eq_bigr _)<-; rewrite big_split addnK. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | sumnB | |
sum_nat_eq0(I : finType) (P : pred I) (E : I -> nat) :
(\sum_(i | P i) E i == 0)%N = [forall (i | P i), E i == 0%N].
Proof. by rewrite eq_sym -(@leqif_sum I P _ (fun _ => 0%N) E) ?big1_eq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | sum_nat_eq0 | |
sum_nat_seq_eq0I r (P : pred I) F :
(\sum_(i <- r | P i) F i == 0)%N = all (fun i => P i ==> (F i == 0%N)) r.
Proof. by rewrite (big_morph _ (id1:=true) addn_eq0)// big_all_cond. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | sum_nat_seq_eq0 | |
sum_nat_seq_neq0I r (P : pred I) F :
(\sum_(i <- r | P i) F i != 0)%N = has (fun i => P i && (F i != 0)%N) r.
Proof.
by rewrite sum_nat_seq_eq0// -has_predC; apply: eq_has => x /=; case Px: (P x).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | sum_nat_seq_neq0 | |
sum_nat_eq1(I : finType) (P : pred I) (F : I -> nat) :
reflect
(exists i : I, [/\ P i, F i = 1 & forall j, j != i -> P j -> F j = 0]%N)
(\sum_(i | P i) F i == 1)%N.
Proof.
apply/(iffP idP) => [sumF_eq1 | [i [Pi Fi1 zFj]]]; last first.
rewrite (bigD1 i)//= Fi1 addn_eq1//= orbF sum_nat_eq0.
by apply/forall_... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | sum_nat_eq1 | |
sum_nat_seq_eq1(I : eqType) r (P : pred I) (F : I -> nat) :
(\sum_(i <- r | P i) F i = 1)%N ->
exists i, [/\ i \in r, P i, F i = 1
& forall j, j != i -> j \in r -> P j -> F j = 0]%N.
Proof.
rewrite big_tnth/= => /eqP/sum_nat_eq1[/= i [Pi Fi FNi]].
exists (tnth (in_tuple r) i); split; rewrite //= ?mem... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | sum_nat_seq_eq1 | |
prod_nat_seq_eq0I r (P : pred I) F :
(\prod_(i <- r | P i) F i == 0)%N = has (fun i => P i && (F i == 0%N)) r.
Proof. by rewrite (big_morph _ (id1 := false) muln_eq0)// big_has_cond. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | prod_nat_seq_eq0 | |
prod_nat_seq_neq0I r (P : pred I) F :
(\prod_(i <- r | P i) F i != 0)%N = all (fun i => P i ==> (F i != 0%N)) r.
Proof.
by rewrite prod_nat_seq_eq0 -all_predC; apply: eq_all => i /=; case: (P i).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | prod_nat_seq_neq0 | |
prod_nat_seq_eq1I r (P : pred I) F :
(\prod_(i <- r | P i) F i == 1)%N = all (fun i => P i ==> (F i == 1%N)) r.
Proof. by rewrite (big_morph _ (id1:=true) muln_eq1)// big_all_cond. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | prod_nat_seq_eq1 | |
prod_nat_seq_neq1I r (P : pred I) F :
(\prod_(i <- r | P i) F i != 1)%N = has (fun i => P i && (F i != 1%N)) r.
Proof.
by rewrite prod_nat_seq_eq1 -has_predC; apply: eq_has => i /=; case: (P i).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | prod_nat_seq_neq1 | |
leq_prodI r (P : pred I) (E1 E2 : I -> nat) :
(forall i, P i -> E1 i <= E2 i) ->
\prod_(i <- r | P i) E1 i <= \prod_(i <- r | P i) E2 i.
Proof. by move=> leE12; elim/big_ind2: _ => // m1 m2 n1 n2; apply: leq_mul. Qed.
Arguments leq_prod [I r P E1 E2]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | leq_prod | |
prodn_cond_gt0I r (P : pred I) F :
(forall i, P i -> 0 < F i) -> 0 < \prod_(i <- r | P i) F i.
Proof. by move=> Fpos; elim/big_ind: _ => // n1 n2; rewrite muln_gt0 => ->. Qed.
Arguments prodn_cond_gt0 [I r P F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | prodn_cond_gt0 | |
prodn_gt0I r (P : pred I) F :
(forall i, 0 < F i) -> 0 < \prod_(i <- r | P i) F i.
Proof. by move=> Fpos; apply: prodn_cond_gt0. Qed.
Arguments prodn_gt0 [I r P F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | prodn_gt0 | |
gt0_prodn_seq(I : eqType) r (P : pred I) F :
0 < \prod_(i <- r | P i) F i -> forall i, i \in r -> P i -> 0 < F i.
Proof.
move=> + i ri Pi; rewrite !lt0n; apply: contra_neq => Fi_eq0.
by case: (path.splitP ri) => *; rewrite big_cat big_rcons Pi Fi_eq0/= muln0.
Qed.
Arguments gt0_prodn_seq [I r P F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | gt0_prodn_seq | |
gt0_prodn(I : finType) (P : pred I) F :
0 < \prod_(i | P i) F i -> forall i, P i -> 0 < F i.
Proof. by move=> /gt0_prodn_seq + i => /[apply]; apply. Qed.
Arguments gt0_prodn [I P F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | gt0_prodn | |
leq_bigmax_seq(I : eqType) r (P : pred I) F i0 :
i0 \in r -> P i0 -> F i0 <= \max_(i <- r | P i) F i.
Proof.
move=> + Pi0; elim: r => // h t ih; rewrite inE big_cons.
move=> /predU1P[<-|i0t]; first by rewrite Pi0 leq_maxl.
by case: ifPn => Ph; [rewrite leq_max ih// orbT|rewrite ih].
Qed.
Arguments leq_bigmax_seq [I r... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | leq_bigmax_seq | |
leq_bigmax_cond(I : finType) (P : pred I) F i0 :
P i0 -> F i0 <= \max_(i | P i) F i.
Proof. exact: leq_bigmax_seq. Qed.
Arguments leq_bigmax_cond [I P F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | leq_bigmax_cond | |
leq_bigmax(I : finType) F (i0 : I) : F i0 <= \max_i F i.
Proof. exact: leq_bigmax_cond. Qed.
Arguments leq_bigmax [I F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | leq_bigmax | |
bigmax_leqP(I : finType) (P : pred I) m F :
reflect (forall i, P i -> F i <= m) (\max_(i | P i) F i <= m).
Proof.
apply: (iffP idP) => leFm => [i Pi|].
by apply: leq_trans leFm; apply: leq_bigmax_cond.
by elim/big_ind: _ => // m1 m2; rewrite geq_max => ->.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | bigmax_leqP | |
bigmax_leqP_seq(I : eqType) r (P : pred I) m F :
reflect (forall i, i \in r -> P i -> F i <= m) (\max_(i <- r | P i) F i <= m).
Proof.
apply: (iffP idP) => leFm => [i ri Pi|].
exact/(leq_trans _ leFm)/leq_bigmax_seq.
rewrite big_seq_cond; elim/big_ind: _ => // [m1 m2|i /andP[ri]].
by rewrite geq_max => ->.
exact:... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | bigmax_leqP_seq | |
bigmax_sup(I : finType) i0 (P : pred I) m F :
P i0 -> m <= F i0 -> m <= \max_(i | P i) F i.
Proof. by move=> Pi0 le_m_Fi0; apply: leq_trans (leq_bigmax_cond i0 Pi0). Qed.
Arguments bigmax_sup [I] i0 [P m F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | bigmax_sup | |
bigmaxn_sup_seq(I : eqType) r i0 (P : pred I) m F :
i0 \in r -> P i0 -> m <= F i0 -> m <= \max_(i <- r | P i) F i.
Proof. by move=> i0r Pi0 ?; apply: leq_trans (leq_bigmax_seq i0 _ _). Qed.
Arguments bigmaxn_sup_seq [I r] i0 [P m F].
#[deprecated(since="mathcomp 2.5.0", note="Use bigmaxn_sup_seq instead.")] | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | bigmaxn_sup_seq | |
bigmax_sup_seq:= bigmaxn_sup_seq. | Notation | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | bigmax_sup_seq | |
bigmax_eq_arg(I : finType) i0 (P : pred I) F :
P i0 -> \max_(i | P i) F i = F [arg max_(i > i0 | P i) F i].
Proof.
move=> Pi0; case: arg_maxnP => //= i Pi maxFi.
by apply/eqP; rewrite eqn_leq leq_bigmax_cond // andbT; apply/bigmax_leqP.
Qed.
Arguments bigmax_eq_arg [I] i0 [P F]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | bigmax_eq_arg | |
eq_bigmax_cond(I : finType) (A : pred I) F :
#|A| > 0 -> {i0 | i0 \in A & \max_(i in A) F i = F i0}.
Proof.
case: (pickP A) => [i0 Ai0 _ | ]; last by move/eq_card0->.
by exists [arg max_(i > i0 in A) F i]; [case: arg_maxnP | apply: bigmax_eq_arg].
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | eq_bigmax_cond | |
eq_bigmax(I : finType) F : #|I| > 0 -> {i0 : I | \max_i F i = F i0}.
Proof. by case/(eq_bigmax_cond F) => x _ ->; exists x. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | eq_bigmax | |
expn_summ I r (P : pred I) F :
(m ^ (\sum_(i <- r | P i) F i) = \prod_(i <- r | P i) m ^ F i)%N.
Proof. exact: (big_morph _ (expnD m)). Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | expn_sum | |
dvdn_biglcmP(I : finType) (P : pred I) F m :
reflect (forall i, P i -> F i %| m) (\big[lcmn/1%N]_(i | P i) F i %| m).
Proof.
apply: (iffP idP) => [dvFm i Pi | dvFm].
by rewrite (bigD1 i) // dvdn_lcm in dvFm; case/andP: dvFm.
by elim/big_ind: _ => // p q p_m; rewrite dvdn_lcm p_m.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | dvdn_biglcmP | |
biglcmn_sup(I : finType) i0 (P : pred I) F m :
P i0 -> m %| F i0 -> m %| \big[lcmn/1%N]_(i | P i) F i.
Proof.
by move=> Pi0 m_Fi0; rewrite (dvdn_trans m_Fi0) // (bigD1 i0) ?dvdn_lcml.
Qed.
Arguments biglcmn_sup [I] i0 [P F m]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | biglcmn_sup | |
dvdn_biggcdP(I : finType) (P : pred I) F m :
reflect (forall i, P i -> m %| F i) (m %| \big[gcdn/0]_(i | P i) F i).
Proof.
apply: (iffP idP) => [dvmF i Pi | dvmF].
by rewrite (bigD1 i) // dvdn_gcd in dvmF; case/andP: dvmF.
by elim/big_ind: _ => // p q m_p; rewrite dvdn_gcd m_p.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | dvdn_biggcdP | |
biggcdn_inf(I : finType) i0 (P : pred I) F m :
P i0 -> F i0 %| m -> \big[gcdn/0]_(i | P i) F i %| m.
Proof. by move=> Pi0; apply: dvdn_trans; rewrite (bigD1 i0) ?dvdn_gcdl. Qed.
Arguments biggcdn_inf [I] i0 [P F m]. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun"
] | boot/bigop.v | biggcdn_inf | |
fact_prodn : n`! = \prod_(1 <= i < n.+1) i.
Proof.
elim: n => [|n IHn] //; first by rewrite big_nil.
by apply/esym; rewrite factS IHn // !big_add1 big_nat_recr //= mulnC.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | fact_prod | |
fact_splitn m : m <= n -> n`! = m`! * \prod_(m.+1 <= k < n.+1) k.
Proof. by move=> leq_mn; rewrite !fact_prod -big_cat_nat. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | fact_split | |
logn_factp n : prime p -> logn p n`! = \sum_(1 <= k < n.+1) n %/ p ^ k.
Proof.
move=> p_prime; transitivity (\sum_(1 <= i < n.+1) logn p i).
rewrite big_add1; elim: n => /= [|n IHn]; first by rewrite logn1 big_geq.
by rewrite big_nat_recr // -IHn /= factS mulnC lognM ?fact_gt0.
transitivity (\sum_(1 <= i < n.+1) \s... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | logn_fact | |
Wilsonp : p > 1 -> prime p = (p %| ((p.-1)`!).+1).
Proof.
have dFact n: 0 < n -> (n.-1)`! = \prod_(0 <= i < n | i != 0) i.
move=> n_gt0; rewrite -big_filter fact_prod; symmetry; apply: congr_big => //.
rewrite /index_iota subn1 -[n]prednK //=; apply/all_filterP.
by rewrite all_predC has_pred1 mem_iota.
move=> lt1... | Theorem | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | Wilson | |
ffact_recn m := if m is m'.+1 then n * ffact_rec n.-1 m' else 1. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffact_rec | |
falling_factorial:= ffact_rec.
Arguments falling_factorial : simpl never. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | falling_factorial | |
ffactE: falling_factorial = ffact_rec. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffactE | |
ffactn0n : n ^_ 0 = 1. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffactn0 | |
ffact0nm : 0 ^_ m = (m == 0). Proof. by case: m. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffact0n | |
ffactnSn m : n ^_ m.+1 = n * n.-1 ^_ m. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffactnS | |
ffactSSn m : n.+1 ^_ m.+1 = n.+1 * n ^_ m. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffactSS | |
ffactn1n : n ^_ 1 = n. Proof. exact: muln1. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffactn1 | |
ffactnSrn m : n ^_ m.+1 = n ^_ m * (n - m).
Proof.
elim: n m => [|n IHn] [|m] //=; first by rewrite ffactn1 mul1n.
by rewrite !ffactSS IHn mulnA.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffactnSr | |
ffact_prodn m : n ^_ m = \prod_(i < m) (n - i).
Proof.
elim: m n => [n | m IH [|n] //]; first by rewrite ffactn0 big_ord0.
by rewrite big_ord_recr /= sub0n muln0.
by rewrite ffactSS IH big_ord_recl subn0.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffact_prod | |
ffact_gt0n m : (0 < n ^_ m) = (m <= n).
Proof. by elim: n m => [|n IHn] [|m] //=; rewrite ffactSS muln_gt0 IHn. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffact_gt0 | |
ffact_smalln m : n < m -> n ^_ m = 0.
Proof. by rewrite ltnNge -ffact_gt0; case: posnP. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffact_small | |
ffactnnn : n ^_ n = n`!.
Proof. by elim: n => [|n IHn] //; rewrite ffactnS IHn. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffactnn | |
ffact_factn m : m <= n -> n ^_ m * (n - m)`! = n`!.
Proof.
by elim: n m => [|n IHn] [|m] //= le_m_n; rewrite ?mul1n // -mulnA IHn.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffact_fact | |
ffact_factdn m : m <= n -> n ^_ m = n`! %/ (n - m)`!.
Proof. by move/ffact_fact <-; rewrite mulnK ?fact_gt0. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | ffact_factd | |
binomialn m :=
match n, m with
| n'.+1, m'.+1 => binomial n' m + binomial n' m'
| _, 0 => 1
| 0, _.+1 => 0
end.
Arguments binomial : simpl never. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | binomial | |
binEn m : binomial n m =
match n, m with
| n'.+1, m'.+1 => binomial n' m + binomial n' m'
| _, 0 => 1
| 0, _.+1 => 0
end.
Proof. by case: n. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | binE | |
bin0n : 'C(n, 0) = 1. Proof. by case: n. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin0 | |
bin0nm : 'C(0, m) = (m == 0). Proof. by case: m. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin0n | |
binSn m : 'C(n.+1, m.+1) = 'C(n, m.+1) + 'C(n, m). Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | binS | |
bin1n : 'C(n, 1) = n.
Proof. by elim: n => //= n IHn; rewrite binS bin0 IHn addn1. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin1 | |
bin_gt0n m : (0 < 'C(n, m)) = (m <= n).
Proof.
by elim: n m => [|n IHn] [|m] //; rewrite addn_gt0 !IHn orbC ltn_neqAle andKb.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin_gt0 | |
leq_bin2ln1 n2 m : n1 <= n2 -> 'C(n1, m) <= 'C(n2, m).
Proof.
by elim: n1 n2 m => [|n1 IHn] [|n2] [|n] le_n12 //; rewrite leq_add ?IHn.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | leq_bin2l | |
bin_smalln m : n < m -> 'C(n, m) = 0.
Proof. by rewrite ltnNge -bin_gt0; case: posnP. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin_small | |
binnn : 'C(n, n) = 1.
Proof. by elim: n => [|n IHn] //; rewrite binS bin_small. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | binn | |
mul_bin_diagn m : n * 'C(n.-1, m) = m.+1 * 'C(n, m.+1).
Proof.
rewrite [RHS]mulnC; elim: n m => [|[|n] IHn] [|m] //=; first by rewrite bin1.
by rewrite mulSn [in _ * _]binS mulnDr addnCA !IHn -mulnS -mulnDl -binS.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | mul_bin_diag | |
bin_factn m : m <= n -> 'C(n, m) * (m`! * (n - m)`!) = n`!.
Proof.
elim: n m => [|n IHn] [|m] // le_m_n; first by rewrite bin0 !mul1n.
by rewrite !factS -!mulnA mulnCA mulnA -mul_bin_diag -mulnA IHn.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin_fact | |
bin_factdn m : 0 < n -> 'C(n, m) = n`! %/ (m`! * (n - m)`!).
Proof.
have [/bin_fact<-|*] := leqP m n; first by rewrite mulnK ?muln_gt0 ?fact_gt0.
by rewrite divnMA bin_small ?divn_small ?fact_gt0 ?ltn_fact.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin_factd | |
bin_ffactn m : 'C(n, m) * m`! = n ^_ m.
Proof.
have [lt_n_m | le_m_n] := ltnP n m; first by rewrite bin_small ?ffact_small.
by rewrite ffact_factd // -(bin_fact le_m_n) mulnA mulnK ?fact_gt0.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin_ffact | |
bin_ffactdn m : 'C(n, m) = n ^_ m %/ m`!.
Proof. by rewrite -bin_ffact mulnK ?fact_gt0. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin_ffactd | |
bin_subn m : m <= n -> 'C(n, n - m) = 'C(n, m).
Proof.
by move=> le_m_n; rewrite !bin_ffactd !ffact_factd ?leq_subr // divnAC subKn.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin_sub | |
mul_bin_downn m : n * 'C(n.-1, m) = (n - m) * 'C(n, m).
Proof.
case: n => //= n; have [lt_n_m | le_m_n] := ltnP n m.
by rewrite (eqnP lt_n_m) mulnC bin_small.
by rewrite -!['C(_, m)]bin_sub ?leqW ?subSn ?mul_bin_diag.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | mul_bin_down | |
mul_bin_leftn m : m.+1 * 'C(n, m.+1) = (n - m) * 'C(n, m).
Proof. by rewrite -mul_bin_diag mul_bin_down. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | mul_bin_left | |
binSnn : 'C(n.+1, n) = n.+1.
Proof. by rewrite -bin_sub ?leqnSn // subSnn bin1. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | binSn | |
bin2n : 'C(n, 2) = (n * n.-1)./2.
Proof. by rewrite -[n.-1]bin1 mul_bin_diag -divn2 mulKn. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin2 | |
bin2oddn : odd n -> 'C(n, 2) = n * n.-1./2.
Proof. by case: n => // n oddn; rewrite bin2 -!divn2 muln_divA ?dvdn2. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin2odd | |
prime_dvd_bink p : prime p -> 0 < k < p -> p %| 'C(p, k).
Proof.
move=> p_pr /andP[k_gt0 lt_k_p].
suffices /Gauss_dvdr<-: coprime p (p - k) by rewrite -mul_bin_down dvdn_mulr.
by rewrite prime_coprime // dvdn_subr 1?ltnW // gtnNdvd.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | prime_dvd_bin | |
bin2_sumn : \sum_(0 <= i < n) i = 'C(n, 2).
Proof.
elim: n => [|n IHn]; first by rewrite big_geq.
by rewrite big_nat_recr // IHn binS bin1.
Qed.
#[deprecated(since="mathcomp 2.3.0", note="Use bin2_sum instead.")] | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | bin2_sum | |
triangular_sum:= bin2_sum (only parsing). | Notation | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | triangular_sum | |
textbook_triangular_sumn : \sum_(0 <= i < n) i = 'C(n, 2).
Proof.
rewrite bin2; apply: canRL half_double _.
rewrite -addnn {1}big_nat_rev -big_split big_mkord /= ?add0n.
rewrite (eq_bigr (fun _ => n.-1)); first by rewrite sum_nat_const card_ord.
by case: n => [|n] [i le_i_n] //=; rewrite subSS subnK.
Qed. *) | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | textbook_triangular_sum | |
expnDna b n :
(a + b) ^ n = \sum_(i < n.+1) 'C(n, i) * (a ^ (n - i) * b ^ i).
Proof.
elim: n => [|n IHn]; rewrite big_ord_recl muln1 ?big_ord0 //.
rewrite expnS {}IHn /= mulnDl !big_distrr /= big_ord_recl muln1 subn0.
rewrite !big_ord_recr /= !binn !subnn bin0 !subn0 !mul1n -!expnS -addnA.
congr (_ + _); rewrite addn... | Theorem | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | expnDn | |
Pascal:= expnDn. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | Pascal | |
Vandermondek l i :
\sum_(j < i.+1) 'C(k, j) * 'C(l, i - j) = 'C(k + l , i).
Proof.
pose f k i := \sum_(j < i.+1) 'C(k, j) * 'C(l, i - j).
suffices{k i} fxx k i: f k.+1 i.+1 = f k i.+1 + f k i.
elim: k i => [i | k IHk [|i]]; last by rewrite -/(f _ _) fxx /f !IHk -binS.
by rewrite big_ord_recl big1_eq addn0 mul1n... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | Vandermonde | |
subn_expm n k :
m ^ k - n ^ k = (m - n) * (\sum_(i < k) m ^ (k.-1 -i) * n ^ i).
Proof.
case: k => [|k]; first by rewrite big_ord0 muln0.
rewrite mulnBl !big_distrr big_ord_recl big_ord_recr /= subn0 muln1.
rewrite subnn mul1n -!expnS subnDA; congr (_ - _); apply: canRL (addnK _) _.
congr (_ + _); apply: eq_bigr => i ... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | subn_exp | |
predn_expm k : (m ^ k).-1 = m.-1 * (\sum_(i < k) m ^ i).
Proof.
rewrite -!subn1 -[in LHS](exp1n k) subn_exp; congr (_ * _).
symmetry; rewrite (reindex_inj rev_ord_inj); apply: eq_bigr => i _ /=.
by rewrite -subn1 -subnDA exp1n muln1.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | predn_exp | |
dvdn_pred_predXn e : (n.-1 %| (n ^ e).-1)%N.
Proof. by rewrite predn_exp dvdn_mulr. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | dvdn_pred_predX | |
modn_summI r (P : pred I) F d :
\sum_(i <- r | P i) F i %% d = \sum_(i <- r | P i) F i %[mod d].
Proof.
by apply/eqP; elim/big_rec2: _ => // i m n _; rewrite modnDml eqn_modDl.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | modn_summ | |
prime_modn_expSnp n : prime p -> n.+1 ^ p = (n ^ p).+1 %[mod p].
Proof.
case: p => // p pP.
rewrite -[(_ ^ _).+1]addn0 (expnDn 1) big_ord_recr big_ord_recl /=.
rewrite subnn binn exp1n !mul1n addnAC -modnDmr; congr ((_ + _) %% _).
apply/eqP/dvdn_sum => -[i ?] _; exact/dvdn_mulr/prime_dvd_bin.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | prime_modn_expSn | |
fermat_littlea p : prime p -> a ^ p = a %[mod p].
Proof.
move=> pP.
elim: a => [|a IH]; first by rewrite exp0n // prime_gt0.
by rewrite prime_modn_expSn // -addn1 -modnDml IH modnDml addn1.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | fermat_little | |
card_uniq_tuplesT n (A : pred T) :
#|[set t : n.-tuple T | all A t & uniq t]| = #|A| ^_ n.
Proof.
elim: n A => [|n IHn] A.
by rewrite (@eq_card1 _ [tuple]) // => t; rewrite [t]tuple0 inE.
rewrite -sum1dep_card (partition_big (@thead _ _) A) /= => [|t]; last first.
by case/tupleP: t => x t; do 2!case/andP.
rewrite... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_uniq_tuples | |
card_inj_ffuns_onD T (R : pred T) :
#|[set f : {ffun D -> T} in ffun_on R | injectiveb f]| = #|R| ^_ #|D|.
Proof.
rewrite -card_uniq_tuples.
have bijFF: {on (_ : pred _), bijective (@Finfun D T)}.
by exists fgraph => x _; [apply: FinfunK | apply: fgraphK].
rewrite -(on_card_preimset (bijFF _)); apply: eq_card => /=... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_inj_ffuns_on | |
card_inj_ffunsD T :
#|[set f : {ffun D -> T} | injectiveb f]| = #|T| ^_ #|D|.
Proof.
rewrite -card_inj_ffuns_on; apply: eq_card => f.
by rewrite 2!inE; case: ffun_onP.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_inj_ffuns | |
cards_drawsT (B : {set T}) k :
#|[set A : {set T} | A \subset B & #|A| == k]| = 'C(#|B|, k).
Proof.
have [ltTk | lekT] := ltnP #|B| k.
rewrite bin_small // eq_card0 // => A.
rewrite inE eqn_leq [k <= _]leqNgt.
have [AsubB /=|//] := boolP (A \subset B).
by rewrite (leq_ltn_trans (subset_leq_card AsubB)) ?andbF... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | cards_draws | |
card_drawsT k : #|[set A : {set T} | #|A| == k]| = 'C(#|T|, k).
Proof.
by rewrite -cardsT -cards_draws; apply: eq_card => A; rewrite !inE subsetT.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_draws | |
card_ltn_sorted_tuplesm n :
#|[set t : m.-tuple 'I_n | sorted ltn (map val t)]| = 'C(n, m).
Proof.
have [-> | n_gt0] := posnP n; last pose i0 := Ordinal n_gt0.
case: m => [|m]; last by apply: eq_card0; case/tupleP=> [[]].
by apply: (@eq_card1 _ [tuple]) => t; rewrite [t]tuple0 inE.
rewrite -[n in RHS]card_ord -ca... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_ltn_sorted_tuples | |
card_sorted_tuplesm n :
#|[set t : m.-tuple 'I_n.+1 | sorted leq (map val t)]| = 'C(m + n, m).
Proof.
set In1 := 'I_n.+1; pose x0 : In1 := ord0.
have add_mnP (i : 'I_m) (x : In1) : i + x < m + n.
by rewrite -ltnS -addSn -!addnS leq_add.
pose add_mn t i := Ordinal (add_mnP i (tnth t i)).
pose add_mn_nat (t : m.-tupl... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_sorted_tuples | |
card_partial_ord_partitionsm n :
#|[set t : m.-tuple 'I_n.+1 | \sum_(i <- t) i <= n]| = 'C(m + n, m).
Proof.
symmetry; set In1 := 'I_n.+1; pose x0 : In1 := ord0.
pose add_mn (i j : In1) : In1 := inord (i + j).
pose f_add (t : m.-tuple In1) := [tuple of scanl add_mn x0 t].
rewrite -card_sorted_tuples -!sum1dep_card (r... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_partial_ord_partitions | |
card_ord_partitionsm n :
#|[set t : m.+1.-tuple 'I_n.+1 | \sum_(i <- t) i == n]| = 'C(m + n, m).
Proof.
symmetry; set In1 := 'I_n.+1; pose x0 : In1 := ord0.
pose f_add (t : m.-tuple In1) := [tuple of sub_ord (\sum_(x <- t) x) :: t].
rewrite -card_partial_ord_partitions -!sum1dep_card (reindex f_add) /=.
by apply: e... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import div fintype tuple finfun bigop prime finset"
] | boot/binomial.v | card_ord_partitions | |
code:= foldr (fun n m => 2 ^ n * m.*2.+1) 0. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq"
] | boot/choice.v | code | |
decode_rec(v q r : nat) {struct q} :=
match q, r with
| 0, _ => [:: v]
| q'.+1, 0 => v :: [rec 0, q', q']
| q'.+1, 1 => [rec v.+1, q', q']
| q'.+1, r'.+2 => [rec v, q', r']
end where "[ 'rec' v , q , r ]" := (decode_rec v q r).
Arguments decode_rec : simpl nomatch. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq"
] | boot/choice.v | decode_rec | |
decoden := if n is 0 then [::] else [rec 0, n.-1, n.-1]. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq"
] | boot/choice.v | decode | |
decodeK: cancel decode code.
Proof.
have m2s: forall n, n.*2 - n = n by move=> n; rewrite -addnn addnK.
case=> //= n; rewrite -[n.+1]mul1n -(expn0 2) -[n in RHS]m2s.
elim: n {2 4}n {1 3}0 => [|q IHq] [|[|r]] v //=; rewrite {}IHq ?mul1n ?m2s //.
by rewrite expnSr -mulnA mul2n.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq"
] | boot/choice.v | decodeK | |
codeK: cancel code decode.
Proof.
elim=> //= v s IHs; rewrite -[_ * _]prednK ?muln_gt0 ?expn_gt0 //=.
set two := 2; rewrite -[v in RHS]addn0; elim: v 0 => [|v IHv {IHs}] q.
rewrite mul1n add0n /= -{}[in RHS]IHs; case: (code s) => // u; pose n := u.+1.
by transitivity [rec q, n + u.+1, n.*2]; [rewrite addnn | elim: ... | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq"
] | boot/choice.v | codeK | |
ltn_codes : all (fun j => j < code s) s.
Proof.
elim: s => //= i s IHs; rewrite -[_.+1]muln1 leq_mul 1?ltn_expl //=.
apply: sub_all IHs => j /leqW lejs; rewrite -[j.+1]mul1n leq_mul ?expn_gt0 //.
by rewrite ltnS -[j]mul1n -mul2n leq_mul.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq"
] | boot/choice.v | ltn_code |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.