Skip to content

Commit 5562031

Browse files
committed
nitpicks
1 parent de39db2 commit 5562031

File tree

3 files changed

+165
-179
lines changed

3 files changed

+165
-179
lines changed

CHANGELOG_UNRELEASED.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
`card_big_setU`
1010

1111
- file `pnt.v`
12-
+ definitions `prime_search`, `prime_seq`
12+
+ definitions `next_prime`, `prime_seq`
1313
+ lemmas `leq_prime_seq`, `mem_prime_seq`
1414
+ theorem `DivergenceSumInversePrimeNumbers`
1515

classical/unstable.v

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,45 @@ Unset Printing Implicit Defensive.
3535
Import Order.TTheory GRing.Theory Num.Theory.
3636
Local Open Scope ring_scope.
3737

38-
Lemma coprime_prodr (I : Type) (r : seq I) (P : {pred I}) (F : I -> nat) (a : I) (l : seq I) :
38+
Lemma coprime_prodr (I : Type) (r : seq I) (P : {pred I}) (F : I -> nat) (a : I)
39+
(l : seq I) :
3940
all (coprime (F a)) [seq F i | i <- [seq i <- l | P i]] ->
4041
coprime (F a) (\prod_(j <- l | P j) F j).
4142
Proof.
42-
elim: l => /= [_|a0 l HI].
43-
by rewrite big_nil coprimen1.
44-
rewrite big_cons. case: (P a0) => //.
45-
rewrite map_cons => /= /andP [] ? ?.
46-
rewrite coprimeMr. apply/andP. split=> //.
47-
exact: HI.
43+
elim: l => /= [_|h t ih]; first by rewrite big_nil coprimen1.
44+
rewrite big_cons; case: ifPn => // Ph.
45+
rewrite map_cons => /= /andP[FaFh FatP].
46+
by rewrite coprimeMr FaFh/= ih.
4847
Qed.
4948

50-
Lemma Gauss_dvd_prod (I : eqType) (r : seq I) (P : {pred I}) (F : I -> nat) (n : nat) :
49+
Lemma Gauss_dvd_prod (I : eqType) (r : seq I) (P : {pred I}) (F : I -> nat)
50+
(n : nat) :
5151
pairwise coprime [seq F i | i <- [seq i <- r | P i]] ->
5252
reflect (forall i, i \in r -> P i -> F i %| n)
53-
(\prod_(i <- r | P i) F i %| n).
53+
(\prod_(i <- r | P i) F i %| n).
5454
Proof.
5555
elim: r => /= [_|a l HI].
5656
by rewrite big_nil dvd1n; apply: ReflectT => i; rewrite in_nil.
57-
rewrite big_cons.
58-
case: (boolP (P a)) => [Pa|]; last first.
59-
rewrite -eqbF_neg => /eqP nPa pairwisecoprime.
60-
apply: (equivP (HI pairwisecoprime)).
61-
split; last first => [Fidvdn i iinl|Fidvdn i].
62-
by apply: Fidvdn; rewrite in_cons; apply/orP; right.
63-
rewrite in_cons => /orP [/eqP ->|]; first by rewrite nPa.
64-
exact: Fidvdn.
65-
rewrite map_cons pairwise_cons => /andP [] allcoprimea pairwisecoprime.
57+
rewrite big_cons; case: ifP => [Pa|nPa]; last first.
58+
move/HI/equivP; apply; split=> [Fidvdn i|Fidvdn i il].
59+
by rewrite in_cons => /predU1P[->|]; [rewrite nPa|exact: Fidvdn].
60+
by apply: Fidvdn; rewrite in_cons il orbT.
61+
rewrite map_cons pairwise_cons => /andP[allcoprimea pairwisecoprime].
6662
rewrite Gauss_dvd; last exact: coprime_prodr.
6763
apply: (equivP (andPP idP (HI pairwisecoprime))).
68-
split=> [[] Fadvdn Fidvdn i|Fidvdn].
69-
by rewrite in_cons => /orP [/eqP ->|]; last exact: Fidvdn.
70-
split=> [|i iinl].
71-
apply: Fidvdn => //; first exact: mem_head.
72-
by apply: Fidvdn; rewrite in_cons; apply/orP; right.
64+
split=> [[Fadvdn Fidvdn] i|Fidvdn].
65+
by rewrite in_cons => /predU1P[->//|]; exact: Fidvdn.
66+
split=> [|i il].
67+
by apply: Fidvdn => //; exact: mem_head.
68+
by apply: Fidvdn; rewrite in_cons il orbT.
7369
Qed.
7470

75-
Lemma expn_prod (I : eqType) (r : seq I) (P : {pred I}) (F : I -> nat) (n : nat) :
71+
Lemma expn_prod (I : eqType) (r : seq I) (P : {pred I}) (F : I -> nat)
72+
(n : nat) :
7673
((\prod_(i <- r | P i) F i) ^ n = \prod_(i <- r | P i) (F i) ^ n)%N.
7774
Proof.
7875
elim: r => [|a l]; first by rewrite !big_nil exp1n.
79-
by rewrite !big_cons; case: (P a) => <- //; rewrite expnMn.
76+
by rewrite !big_cons; case: ifPn => // Pa <-; rewrite expnMn.
8077
Qed.
8178

8279
Section max_min.
@@ -141,11 +138,10 @@ Qed.
141138
Definition monotonous d (T : porderType d) (pT : predType T) (A : pT) (f : T -> T) :=
142139
{in A &, {mono f : x y / (x <= y)%O}} \/ {in A &, {mono f : x y /~ (x <= y)%O}}.
143140

144-
Lemma mono_ext: forall f, {mono f : m n / (m <= n)%N} -> forall n : nat, (n <= f n)%N.
141+
Lemma mono_ext f : {mono f : m n / (m <= n)%N} -> forall n, (n <= f n)%N.
145142
Proof.
146-
move=> f fincr. elim=> [//| n HR]. apply: (leq_ltn_trans HR).
147-
rewrite ltn_neqAle fincr (inj_eq (incn_inj fincr)) -ltn_neqAle.
148-
exact: ltnSn.
143+
move=> fincr; elim=> [//| n HR]; rewrite (leq_ltn_trans HR)//.
144+
by rewrite ltn_neqAle fincr (inj_eq (incn_inj fincr)) -ltn_neqAle.
149145
Qed.
150146

151147
(* NB: these lemmas have been introduced to develop the theory of bounded variation *)
@@ -228,13 +224,12 @@ Arguments big_rmcond_in {R idx op I r} P.
228224

229225
Reserved Notation "`1- x" (format "`1- x", at level 2).
230226

231-
Lemma card_big_setU (I : Type) (T : finType) (r : seq I) (P : {pred I}) (F : I -> {set T}) :
227+
Lemma card_big_setU (I : Type) (T : finType) (r : seq I) (P : {pred I})
228+
(F : I -> {set T}) :
232229
(#|\bigcup_(i <- r | P i) F i| <= \sum_(i <- r | P i) #|F i|)%N.
233230
Proof.
234-
elim: r => [|a l HI]; first by rewrite !big_nil cards0.
235-
rewrite !big_cons. case: (P a); last exact: HI.
236-
apply: (leq_trans (leq_card_setU (F a) _)).
237-
by rewrite leq_add2l.
231+
elim/big_ind2 : _ => // [|m A n B Am Bn]; first by rewrite cards0.
232+
by rewrite (leq_trans (leq_card_setU _ _))// leq_add.
238233
Qed.
239234

240235
Section onem.

0 commit comments

Comments
 (0)