Skip to content

Commit ff6ed0e

Browse files
affeldt-aistlyonel2017t6s
authored andcommitted
Feature esum psum esum only (math-comp#1978)
* Add missing lemmas for distr * use fun{r,e}{pos,neg} instead of f{pos,neg} * esum lemmas from PR math-comp#1954 * new definition of esum * prove __admitted__psumB --------- Co-authored-by: Lionel Blatter <lionel.blatter@wanadoo.fr> Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
1 parent 663296a commit ff6ed0e

19 files changed

Lines changed: 987 additions & 400 deletions

CHANGELOG_UNRELEASED.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,27 @@
112112
+ lemma `diffmx`
113113
+ lemma `is_diff_mx`
114114
+ instance `is_diff_mx`
115+
- in `realsum.v`:
116+
+ lemma `esum_psum`
117+
+ lemma `esum_sum`
118+
119+
- in `constructive_ereal.v`:
120+
+ definition `esg`
121+
+ lemmas `numEesg`, `gte0_esg`, `lte0_esg`, `esg0`
122+
123+
- in `esum.v`:
124+
+ lemmas `esum_eq0P`, `esumZ`, `exchange_esum`
125+
+ lemmas `le_esum`, `esumN`
126+
+ lemmas `summable_le_esum`, `summable_esum_funepos`, `summable_esumN`,
127+
`summableZ`, `summable_esumZ`
128+
+ lemmas `esum_if_eq_op`
129+
+ lemmas `exchange_esum_ereal_sup`
130+
131+
- in `ereal.v`:
132+
+ lemmas `exchange_ereal_sup`, `ge0_ereal_supZl`, `ge0_ereal_supZl_range`
133+
134+
- in `sequences.v`:
135+
+ lemmas `ereal_supD`, `ereal_sup_sum`
115136

116137
- in `reals.v`:
117138
+ lemmas `sup_ge0`, `has_sup_wpZl`, `gt0_has_supZl`, `has_sup_Mn`, `sup_Mn`
@@ -151,6 +172,12 @@
151172
- in `lebesgue_stieltjes_measure.v`:
152173
+ definition `lebesgue_display`
153174

175+
- in `realsum.v`:
176+
+ lemma `esum_summableP`
177+
178+
- in `esum.v`:
179+
+ lemma `fsetsTE`
180+
154181
### Changed
155182

156183
- moved from `measurable_structure.v` to `classical_sets.v`:
@@ -182,6 +209,13 @@
182209
- new files `signed_measure.v` and `radon_nikodym.v`
183210
+ with the contents of `charge.v` (deprecated)
184211

212+
- in `esum.v`:
213+
+ lemma `ge0_esum`
214+
+ lemma `esum_ge`
215+
216+
- in `realsum.v`:
217+
+ lemma `__admitted__psumB` proved and renamed to `psumB`
218+
185219
### Changed
186220

187221
- moved from `measurable_structure.v` to `classical_sets.v`:
@@ -245,6 +279,30 @@
245279
+ lemmas `Radon_NikodymE`, `Radon_Nikodym_fin_num`, `Radon_Nikodym_integrable`,
246280
`ae_eq_Radon_Nikodym_SigmaFinite`, `Radon_Nikodym_change_of_variables`,
247281
`Radon_Nikodym_cscale`, `Radon_Nikodym_cadd`, `Radon_Nikodym_chain_rule`
282+
- in `realsum.v`:
283+
+ the following now use `funrpos` and `funrneg`:
284+
* definition `sum`
285+
* lemmas `summable_funrpos`, `summable_funrneg`
286+
+ lemma `sum0` (now uses `cst`)
287+
288+
- moved from `realsum` to `numfun.v`:
289+
+ now use `funrpos` and `funrneg`:
290+
* lemmas `eq_funrpos`, `eq_funrneg`
291+
* lemma `fpos0` (renamed to `funrpos_cst0`)
292+
* lemma `fneg0` (renamed to `funrneg_cst0`)
293+
* lemmas `funrposZ`, `funrnegZ`
294+
* lemmas `funrpos_natrM`, `funrneg_natrM`
295+
* lemmas `le_funrpos_norm`
296+
297+
- moved from `numfun.v` to `unstable.v`:
298+
+ notations `nondecreasing_fun`, `nonincreasing_fun`,
299+
`decreasing_fun`, `increasing_fun`
300+
301+
- in `esum.v`:
302+
+ definition `esum`
303+
+ lemma `esum_fset`
304+
+ lemma `esum_ge` -> `PosEsum.pos_esum_ge`
305+
+ lemma `le_esum` -> `PosEsum.le_pos_esum`
248306

249307
- moved from `normed_module.v` to `metric_structure.v`
250308
+ lemma `squeeze_cvgr`
@@ -296,6 +354,11 @@
296354

297355
- in `topology_structure.v`:
298356
+ `closure_setC` -> `closureC`
357+
- in `esum.v`:
358+
+ `esum_sum` -> ` exchange_esum_sum`
359+
360+
- in `realsum.v`:
361+
+ `psum` -> `PosSum.psum`
299362

300363
### Generalized
301364

@@ -328,6 +391,12 @@
328391
generalized from `realType` to `sigmaRingType d'`, adding a display parameter `d'`;
329392
generalized from `realType` to `sigmaRingType d'`, adding a display parameter `d'`;
330393

394+
- in `ereal.v`:
395+
+ lemmas `ge0_mule_fsumr`, `ge0_mule_fsuml`
396+
397+
- in `esum.v`:
398+
+ lemma `esum_set1`
399+
331400
### Deprecated
332401

333402
- file `charge.v` (use `measure.v` and/or `lebesgue_integral.v`)
@@ -362,6 +431,12 @@
362431

363432
- in `random_variable.v`:
364433
+ notation `expectationM` (deprecated since 1.8.0)
434+
- in `realsum.v`:
435+
+ definitions `fpos`, `fneg` (use `funrpos`, `funrneg` instead)
436+
+ lemmas `fnegN`, `fposN`
437+
+ lemmas `ge0_pos`, `ge0_neg`
438+
+ lemma `fposBfneg`
439+
+ lemma `funrpos_le`
365440

366441
### Infrastructure
367442

classical/unstable.v

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ From mathcomp Require Import vector archimedean interval.
1616
(* ``` *)
1717
(* swap x := (x.2, x.1) *)
1818
(* map_pair f x := (f x.1, f x.2) *)
19+
(* nondecreasing_fun f == the function f is non-decreasing *)
20+
(* nonincreasing_fun f == the function f is non-increasing *)
21+
(* increasing_fun f == the function f is (strictly) increasing *)
22+
(* decreasing_fun f == the function f is (strictly) decreasing *)
1923
(* monotonic A f := {in A &, {homo f : x y / x <= y}} \/ *)
2024
(* {in A &, {homo f : x y /~ x <= y}} *)
2125
(* strict_monotonic A f := {in A &, {homo f : x y / x < y}} \/ *)
@@ -197,6 +201,15 @@ rewrite -[X in (_ <= X)%N]prednK ?expn_gt0// -[X in (_ <= X)%N]addn1 leq_add2r.
197201
by rewrite (leq_trans h2)// -subn1 leq_subRL ?expn_gt0// add1n ltn_exp2l.
198202
Qed.
199203

204+
Notation "'nondecreasing_fun' f" := ({homo f : n m / (n <= m)%O >-> (n <= m)%O})
205+
(at level 10).
206+
Notation "'nonincreasing_fun' f" := ({homo f : n m / (n <= m)%O >-> (n >= m)%O})
207+
(at level 10).
208+
Notation "'increasing_fun' f" := ({mono f : n m / (n <= m)%O >-> (n <= m)%O})
209+
(at level 10).
210+
Notation "'decreasing_fun' f" := ({mono f : n m / (n <= m)%O >-> (n >= m)%O})
211+
(at level 10).
212+
200213
Definition monotonic d (T : porderType d) d' (T' : porderType d')
201214
(pT : predType T) (A : pT) (f : T -> T') :=
202215
{in A &, nondecreasing f} \/ {in A &, {homo f : x y /~ (x <= y)%O}}.

experimental_reals/distr.v

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Structure distr := Distr {
4646
mu :> T -> R;
4747
_ : forall x, 0 <= mu x;
4848
_ : summable mu;
49-
_ : psum mu <= 1
49+
_ : PosSum.psum mu <= 1
5050
}.
5151

5252
Definition distr_of & phant R & phant T := distr.
@@ -63,7 +63,7 @@ Context {R : realType} (T : choiceType) (mu : {distr T / R}).
6363
Lemma ge0_mu : forall x, 0 <= mu x.
6464
Proof. by case: mu. Qed.
6565

66-
Lemma le1_mu : psum mu <= 1.
66+
Lemma le1_mu : PosSum.psum mu <= 1.
6767
Proof. by case: mu. Qed.
6868

6969
Lemma summable_mu : summable mu.
@@ -119,7 +119,7 @@ Proof. by apply: (iffP idP) => /eqP. Qed.
119119
Lemma dinsuppPn mu x : reflect (mu x = 0) (x \notin dinsupp mu).
120120
Proof. by rewrite -topredE /dinsupp /= negbK; apply/eqP. Qed.
121121

122-
Definition pr mu E := psum (fun x => (E x)%:R * mu x).
122+
Definition pr mu E := PosSum.psum (fun x => (E x)%:R * mu x).
123123
Definition prc mu E A := pr mu [predI E & A] / pr mu A.
124124
Definition esp mu f := sum (fun x => f x * mu x).
125125
Definition espc mu f A := sum (fun x => f x * prc mu (pred1 x) A).
@@ -153,7 +153,7 @@ move=> s /h /(le_trans _); apply; rewrite le_eqVlt; apply/orP.
153153
by left; apply/eqP/eq_bigr=> i _; rewrite ger0_norm ?isd1.
154154
Qed.
155155

156-
Local Lemma isd3 : psum mu <= 1.
156+
Local Lemma isd3 : PosSum.psum mu <= 1.
157157
Proof.
158158
rewrite psumE; [apply/isd1 | apply/isd2 | apply: ge_sup].
159159
by exists 0, fset0; rewrite big_fset0.
@@ -181,7 +181,7 @@ Qed.
181181
Lemma le1_mu1
182182
{R : realType} {T : choiceType} (mu : {distr T / R}) x : mu x <= 1.
183183
Proof.
184-
apply/(@le_trans _ _ (psum mu)) => //; rewrite -[mu x]ger0_norm//.
184+
apply/(@le_trans _ _ (PosSum.psum mu)) => //; rewrite -[mu x]ger0_norm//.
185185
by apply/ger1_psum.
186186
Qed.
187187

@@ -356,7 +356,7 @@ Implicit Types (T U : choiceType).
356356
Section Bind.
357357
Context {T U : choiceType} (f : T -> distr U) (mu : distr T).
358358

359-
Definition mlet := fun y : U => psum (fun x => mu x * f x y).
359+
Definition mlet := fun y : U => PosSum.psum (fun x => mu x * f x y).
360360

361361
Lemma isd_mlet : isdistr mlet.
362362
Proof.
@@ -373,7 +373,7 @@ Qed.
373373

374374
Definition dlet := locked (mkdistr isd_mlet).
375375

376-
Lemma dletE y : dlet y = psum (fun x => mu x * f x y).
376+
Lemma dletE y : dlet y = PosSum.psum (fun x => mu x * f x y).
377377
Proof. by unlock dlet. Qed.
378378
End Bind.
379379

@@ -511,7 +511,7 @@ Lemma __deprecated__dlet_dlet (mu : {distr T / R}) :
511511
Proof.
512512
move=> z; unlock dlet => /=; rewrite /mlet /=.
513513
pose S y x := mu x * (f1 x y * f2 y z).
514-
rewrite (eq_psum (F2 := fun y => psum (S^~ y))) => [x|].
514+
rewrite (eq_psum (F2 := fun y => PosSum.psum (S^~ y))) => [x|].
515515
by rewrite -psumZ //; apply/eq_psum => y /=.
516516
rewrite __admitted__interchange_psum.
517517
+ by move=> x; apply/summableZ/summable_mlet.
@@ -713,7 +713,7 @@ Section MarginalsTh.
713713
Variable (T U V : choiceType).
714714

715715
Lemma dmargin_psumE (mu : {distr T / R}) (f : T -> U) y :
716-
(dmargin f mu) y = psum (fun x => (f x == y)%:R * mu x).
716+
(dmargin f mu) y = PosSum.psum (fun x => (f x == y)%:R * mu x).
717717
Proof.
718718
rewrite dmarginE dletE; apply/eq_psum => x //=.
719719
by rewrite mulrC dunit1E.
@@ -812,7 +812,7 @@ Section DFst.
812812
Context {R : realType} {T U : choiceType}.
813813

814814
Lemma dfstE (mu : {distr (T * U) / R}) x :
815-
dfst mu x = psum (fun y => mu (x, y)).
815+
dfst mu x = PosSum.psum (fun y => mu (x, y)).
816816
Proof.
817817
rewrite dmargin_psumE /=; pose h y : T * U := (x, y).
818818
rewrite (reindex_psum (P := [pred z | z.1 == x]) (h := h)) /=.
@@ -837,7 +837,7 @@ Section DSnd.
837837
Context {R : realType} {T U : choiceType}.
838838

839839
Lemma __deprecated__dsndE (mu : {distr (T * U) / R}) y :
840-
dsnd mu y = psum (fun x => mu (x, y)).
840+
dsnd mu y = PosSum.psum (fun x => mu (x, y)).
841841
Proof. by rewrite -__deprecated__dfst_dswap dfstE; apply/eq_psum=> x; rewrite dswapE. Qed.
842842

843843
Lemma summable_snd (mu : {distr (T * U) / R}) y :
@@ -878,7 +878,7 @@ Qed.
878878
Lemma pr_exp mu (E : pred T) : \P_[mu] E = \E_[mu] (fun m => (E m)%:R).
879879
Proof. by rewrite /pr psum_sum // => x; rewrite mulr_ge0 // ler0n. Qed.
880880

881-
Lemma pr_predT mu : \P_[mu] predT = psum mu.
881+
Lemma pr_predT mu : \P_[mu] predT = PosSum.psum mu.
882882
Proof. by apply/eq_psum=> x; rewrite mul1r. Qed.
883883

884884
Lemma pr_dunit E x : \P_[dunit x] E = (E x)%:R :> R.
@@ -963,7 +963,7 @@ Proof.
963963
rewrite /esp -psum_sum => [x|]; first by rewrite mulr_ge0 ?ge0_pr.
964964
rewrite /pr; unlock dlet => /=; rewrite /mlet /=.
965965
pose F x y := (E x)%:R * (mu y * f y x).
966-
transitivity (psum (fun x => psum (fun y => F x y))); rewrite {}/F.
966+
transitivity (PosSum.psum (fun x => PosSum.psum (fun y => F x y))); rewrite {}/F.
967967
by apply/eq_psum => x; rewrite -psumZ ?ler0n.
968968
rewrite __admitted__interchange_psum /=; last first.
969969
apply/eq_psum=> y /=; rewrite mulrC -psumZ //.
@@ -1048,7 +1048,7 @@ by move/ler_pdivrMr=> ->; rewrite mul1r le_in_pr // => x _ /andP[].
10481048
Qed.
10491049

10501050
Lemma prc_sum A mu : 0 < \P_[mu] A ->
1051-
psum (fun x => \P_[mu, A] (pred1 x)) = 1.
1051+
PosSum.psum (fun x => \P_[mu, A] (pred1 x)) = 1.
10521052
Proof.
10531053
move=> gt0_pE; rewrite psumZr ?(invr_ge0, ge0_pr) //.
10541054
rewrite (eq_psum (F2 := (fun x => (A x)%:R * mu x))); last first.
@@ -1264,5 +1264,3 @@ End Jensen.
12641264
End Jensen.
12651265

12661266
Notation convex f := (convexon \-inf \+inf f).
1267-
1268-
(* -------------------------------------------------------------------- *)

0 commit comments

Comments
 (0)