Skip to content

Commit bae12f5

Browse files
committed
complete the fix
- include rebase
1 parent 944eda7 commit bae12f5

File tree

6 files changed

+83
-84
lines changed

6 files changed

+83
-84
lines changed

CHANGELOG_UNRELEASED.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,23 @@
66

77
### Changed
88

9-
- in `topology.v`:
10-
+ lemmas `subspace_pm_ball_center`, `subspace_pm_ball_sym`,
11-
`subspace_pm_ball_triangle`, `subspace_pm_entourage` turned
12-
into local `Let`'s
13-
149
- in `lebesgue_integral.v`:
15-
+ lemma `cst_mfun_subproof` now a `Let`
10+
+ structure `SimpleFun` now inside a module `HBSimple`
11+
+ structure `NonNegSimpleFun` now inside a module `HBNNSimple`
12+
+ lemma `cst_nnfun_subproof` has now a different statement
13+
+ lemma `indic_nnfun_subproof` has now a different statement
14+
1615

1716
### Renamed
1817

1918
### Generalized
2019

2120
- in `lebesgue_integral.v`:
22-
+ generalized from `sigmaRingType`/`realType` to `sigmaRingType`
21+
+ generalized from `sigmaRingType`/`realType` to `sigmaRingType`/`sigmaRingType`
2322
* mixin `isMeasurableFun`
2423
* structure `MeasurableFun`
2524
* definition `mfun`
2625
* lemmas `mfun_rect`, `mfun_valP`, `mfuneqP`
27-
+ generalized from `measurableType`/`realType` to `sigmaRingType`/`realType`
28-
* lemmas `cst_mfun_subproof`, `mfun_cst`
29-
* definition `cst_mfun`
3026

3127
### Deprecated
3228

@@ -36,6 +32,14 @@
3632
+ definition `cst_mfun`
3733
+ lemma `mfun_cst`
3834

35+
- in `cardinality.v`:
36+
+ lemma `cst_fimfun_subproof`
37+
38+
- in `lebesgue_integral.v`:
39+
+ lemma `cst_mfun_subproof` (use lemma `measurable_cst` instead)
40+
+ lemma `cst_nnfun_subproof` (turned into a `Let`)
41+
+ lemma `indic_mfun_subproof` (use lemma `measurable_fun_indic` instead)
42+
3943
### Infrastructure
4044

4145
### Misc

classical/cardinality.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,9 +1324,9 @@ suff -> : cst x @` [set: aT] = [set x] by apply: finite_set1.
13241324
by apply/predeqP => y; split=> [[t' _ <-]//|->//] /=; exists point.
13251325
Qed.
13261326

1327-
Lemma cst_fimfun_subproof aT rT x : @FiniteImage aT rT (cst x).
1328-
Proof. by split; exact: finite_image_cst. Qed.
1329-
HB.instance Definition _ aT rT x := @cst_fimfun_subproof aT rT x.
1327+
HB.instance Definition _ aT rT x :=
1328+
FiniteImage.Build aT rT (cst x) (@finite_image_cst aT rT x).
1329+
13301330
Definition cst_fimfun {aT rT} x := [the {fimfun aT >-> rT} of cst x].
13311331

13321332
Lemma fimfun_cst aT rT x : @cst_fimfun aT rT x =1 cst x. Proof. by []. Qed.

theories/charge.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,8 @@ Implicit Types f : T -> \bar R.
19141914

19151915
Local Notation "'d nu '/d mu" := (f nu mu).
19161916

1917+
Import HBNNSimple.
1918+
19171919
Lemma change_of_variables f E : (forall x, 0 <= f x) ->
19181920
measurable E -> measurable_fun E f ->
19191921
\int[mu]_(x in E) (f x * ('d nu '/d mu) x) = \int[nu]_(x in E) f x.

theories/kernel.v

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ Section measurable_fun_integral_finite_sfinite.
504504
Context d d' (X : measurableType d) (Y : measurableType d') (R : realType).
505505
Variable k : X * Y -> \bar R.
506506

507+
Import HBNNSimple.
508+
507509
Lemma measurable_fun_xsection_integral
508510
(l : X -> {measure set Y -> \bar R})
509511
(k_ : {nnsfun (X * Y) >-> R}^nat)
@@ -949,6 +951,7 @@ HB.export KCOMP_SFINITE_KERNEL.
949951

950952
Section measurable_fun_preimage_integral.
951953
Context d d' (X : measurableType d) (Y : measurableType d') (R : realType).
954+
Import HBNNSimple.
952955
Variables (k : Y -> \bar R)
953956
(k_ : ({nnsfun Y >-> R}) ^nat)
954957
(ndk_ : nondecreasing_seq (k_ : (Y -> R)^nat))
@@ -992,6 +995,10 @@ Qed.
992995

993996
End measurable_fun_preimage_integral.
994997

998+
Section measurable_fun_integral_kernel.
999+
1000+
Import HBNNSimple.
1001+
9951002
Lemma measurable_fun_integral_kernel
9961003
d d' (X : measurableType d) (Y : measurableType d') (R : realType)
9971004
(l : X -> {measure set Y -> \bar R})
@@ -1004,6 +1011,8 @@ have [k_ [ndk_ k_k]] := approximation measurableT mk (fun x _ => k0 x).
10041011
by apply: (measurable_fun_preimage_integral ndk_ k_k) => n r; exact/ml.
10051012
Qed.
10061013

1014+
End measurable_fun_integral_kernel.
1015+
10071016
Section integral_kcomp.
10081017
Context d d2 d3 (X : measurableType d) (Y : measurableType d2)
10091018
(Z : measurableType d3) (R : realType).
@@ -1017,6 +1026,8 @@ rewrite integral_indic//= /kcomp.
10171026
by apply: eq_integral => y _; rewrite integral_indic.
10181027
Qed.
10191028

1029+
Import HBNNSimple.
1030+
10201031
Let integral_kcomp_nnsfun x (f : {nnsfun Z >-> R}) :
10211032
\int[kcomp l k x]_z (f z)%:E = \int[l x]_y (\int[k (x, y)]_z (f z)%:E).
10221033
Proof.

theories/lebesgue_integral.v

Lines changed: 51 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ From mathcomp Require Import lebesgue_measure numfun realfun function_spaces.
7777
(* nicely_shrinking x E == the sequence of sets E is nicely shrinking to x *)
7878
(* ```` *)
7979
(* *)
80+
(* About the use of simple functions: *)
81+
(* Because of a limitation of HB <= 1.8.0, we need some care to be able to *)
82+
(* use simple functions. *)
83+
(* The structure SimpleFun (resp. NonNegSimpleFun) is located inside the *)
84+
(* module HBSimple (resp. HBNNSimple). *)
85+
(* As a consequence, we need to import HBSimple (resp. HBNNSimple) to use the *)
86+
(* coercion from simple functions (resp. non-negative simple functions) to *)
87+
(* Coq functions. *)
88+
(* Also, assume that f (e.g., cst, indic) is equipped with the structure of *)
89+
(* MeasurableFun. For f to be equipped with the structure of SimpleFun *)
90+
(* (resp. NonNegSimpleFun), one need locallu to import HBSimple (resp. *)
91+
(* HBNNSimple) and to instantiate FiniteImage (resp. NonNegFun) locally. *)
92+
(* *)
8093
(******************************************************************************)
8194

8295
Set Implicit Arguments.
@@ -204,11 +217,8 @@ Proof. by split=> [->//|fg]; apply/val_inj/funext. Qed.
204217

205218
HB.instance Definition _ := [Choice of {mfun aT >-> rT} by <:].
206219

207-
Lemma cst_mfun_subproof x : @measurable_fun d _ aT rT [set: aT] (cst x).
208-
Proof. by []. Qed.
209-
210220
HB.instance Definition _ x := isMeasurableFun.Build d _ aT rT (cst x)
211-
(@cst_mfun_subproof x).
221+
(@measurable_cst _ _ aT rT setT x).
212222

213223
End mfun.
214224

@@ -245,8 +255,8 @@ split=> [|f g|f g]; rewrite !inE/=.
245255
- exact: measurable_funB.
246256
- exact: measurable_funM.
247257
Qed.
248-
HB.instance Definition _ := GRing.isSubringClosed.Build _ (@mfun d default_measure_display aT rT)
249-
mfun_subring_closed.
258+
HB.instance Definition _ := GRing.isSubringClosed.Build _
259+
(@mfun d default_measure_display aT rT) mfun_subring_closed.
250260
HB.instance Definition _ := [SubChoice_isSubComRing of {mfun aT >-> rT} by <:].
251261

252262
Implicit Types (f g : {mfun aT >-> rT}).
@@ -272,22 +282,13 @@ HB.instance Definition _ f g := MeasurableFun.copy (f \- g) (f - g).
272282
HB.instance Definition _ f g := MeasurableFun.copy (f \* g) (f * g).
273283

274284
Definition mindic (D : set aT) of measurable D : aT -> rT := \1_D.
285+
275286
Lemma mindicE (D : set aT) (mD : measurable D) :
276287
mindic mD = (fun x => (x \in D)%:R).
277288
Proof. by rewrite /mindic funeqE => t; rewrite indicE. Qed.
278-
HB.instance Definition _ (D : set aT) (mD : measurable D) :
279-
@FImFun aT rT (mindic mD) := FImFun.on (mindic mD).
280-
Lemma indic_mfun_subproof (D : set aT) (mD : measurable D) :
281-
@isMeasurableFun d _ aT rT (mindic mD).
282-
Proof.
283-
split=> mA /= B mB; rewrite preimage_indic.
284-
case: ifPn => B1; case: ifPn => B0 //.
285-
- by rewrite setIT.
286-
- exact: measurableI.
287-
- by apply: measurableI => //; apply: measurableC.
288-
- by rewrite setI0.
289-
Qed.
290-
HB.instance Definition _ D mD := @indic_mfun_subproof D mD.
289+
290+
HB.instance Definition _ D mD := @isMeasurableFun.Build _ _ aT rT (mindic mD)
291+
(@measurable_fun_indic _ aT rT setT D mD).
291292

292293
Definition indic_mfun (D : set aT) (mD : measurable D) :=
293294
[the {mfun aT >-> rT} of mindic mD].
@@ -297,7 +298,9 @@ Definition scale_mfun k f := [the {mfun aT >-> rT} of k \o* f].
297298

298299
Lemma max_mfun_subproof f g : @isMeasurableFun d _ aT rT (f \max g).
299300
Proof. by split; apply: measurable_maxr. Qed.
301+
300302
HB.instance Definition _ f g := max_mfun_subproof f g.
303+
301304
Definition max_mfun f g := [the {mfun aT >-> _} of f \max g].
302305

303306
End ring.
@@ -362,11 +365,8 @@ Proof. by split=> [->//|fg]; apply/val_inj/funext. Qed.
362365

363366
HB.instance Definition _ := [Choice of {sfun aT >-> rT} by <:].
364367

365-
(* TODO: BUG: HB *)
366-
(* HB.instance Definition _ (x : rT) := @cst_mfun_subproof aT rT x. *)
367-
368-
(* NB: duplicate from cardinality.v *)
369-
HB.instance Definition _ x := @cst_fimfun_subproof aT rT x.
368+
(* NB: already instantiated in cardinality.v *)
369+
HB.instance Definition _ x : @FImFun aT rT (cst x) := FImFun.on (cst x).
370370

371371
Definition cst_sfun x := [the {sfun aT >-> rT} of cst x].
372372

@@ -425,7 +425,7 @@ HB.instance Definition _ f g := MeasurableFun.copy (f \- g) (f - g).
425425
HB.instance Definition _ f g := MeasurableFun.copy (f \* g) (f * g).
426426

427427
Import HBSimple.
428-
(* NB: duplicate from lebesgue_integral.v *)
428+
(* NB: already instantiated in lebesgue_integral.v *)
429429
HB.instance Definition _ (D : set aT) (mD : measurable D) :
430430
@FImFun aT rT (mindic _ mD) := FImFun.on (mindic _ mD).
431431

@@ -495,23 +495,23 @@ Context d (T : measurableType d) (R : realType).
495495

496496
Import HBNNSimple.
497497

498-
Lemma cst_nnfun_subproof (x : {nonneg R}) : @isNonNegFun T R (cst x%:num).
499-
Proof. by split=> /=. Qed.
500-
HB.instance Definition _ x := @cst_nnfun_subproof x.
501-
502-
HB.instance Definition _ x := isMeasurableFun.Build d _ T R (cst x)
503-
(@cst_mfun_subproof _ _ _ _ x).
498+
Lemma cst_nnfun_subproof (x : {nonneg R}) : forall t : T, 0 <= cst x%:num t.
499+
Proof. by move=> /=. Qed.
500+
HB.instance Definition _ x := @isNonNegFun.Build T R (cst x%:num)
501+
(cst_nnfun_subproof x).
504502

505-
(* NB: duplicate from cardinality.v *)
506-
HB.instance Definition _ x := @cst_fimfun_subproof T R x.
503+
(* NB: already instantiated in cardinality.v *)
504+
HB.instance Definition _ x : @FImFun T R (cst x) := FImFun.on (cst x).
507505

508506
Definition cst_nnsfun (r : {nonneg R}) := [the {nnsfun T >-> R} of cst r%:num].
509507

510508
Definition nnsfun0 : {nnsfun T >-> R} := cst_nnsfun 0%R%:nng.
511509

512-
Lemma indic_nnfun_subproof (D : set T) : @isNonNegFun T R (\1_D).
513-
Proof. by split=> //=; rewrite /indic. Qed.
514-
HB.instance Definition _ D := @indic_nnfun_subproof D.
510+
Lemma indic_nnfun_subproof (D : set T) : forall x, 0 <= (\1_D) x :> R.
511+
Proof. by []. Qed.
512+
513+
HB.instance Definition _ D := @isNonNegFun.Build T R \1_D
514+
(indic_nnfun_subproof D).
515515

516516
HB.instance Definition _ D (mD : measurable D) :
517517
@NonNegFun T R (mindic R mD) := NonNegFun.on (mindic R mD).
@@ -824,7 +824,7 @@ Qed.
824824

825825
End le_sintegral.
826826

827-
Section tmp.
827+
Section is_cvg_sintegral.
828828
Import HBNNSimple.
829829

830830
Lemma is_cvg_sintegral d (T : measurableType d) (R : realType)
@@ -835,13 +835,13 @@ move=> nd_f; apply/cvg_ex; eexists; apply/ereal_nondecreasing_cvgn => a b ab.
835835
by apply: le_sintegral => // => x; exact/nd_f.
836836
Qed.
837837

838-
End tmp.
838+
End is_cvg_sintegral.
839839

840840
Definition proj_nnsfun d (T : measurableType d) (R : realType)
841841
(f : {nnsfun T >-> R}) (A : set T) (mA : measurable A) :=
842842
mul_nnsfun f (indic_nnsfun R mA).
843843

844-
Section tmp.
844+
Section mrestrict.
845845
Import HBNNSimple.
846846

847847
Definition mrestrict d (T : measurableType d) (R : realType) (f : {nnsfun T >-> R})
@@ -851,7 +851,7 @@ apply/funext => x /=; rewrite /patch mindicE.
851851
by case: ifP; rewrite (mulr0, mulr1).
852852
Qed.
853853

854-
End tmp.
854+
End mrestrict.
855855

856856
Definition scale_nnsfun d (T : measurableType d) (R : realType)
857857
(f : {nnsfun T >-> R}) (k : R) (k0 : 0 <= k) :=
@@ -1749,10 +1749,13 @@ Context d (T : measurableType d) (R : realType) (f : T -> \bar R).
17491749
Variables (D : set T) (mD : measurable D) (mf : measurable_fun D f).
17501750

17511751
Import HBSimple.
1752-
(* duplicate *)
1753-
HB.instance Definition _ x := @cst_fimfun_subproof T R x.
1754-
HB.instance Definition _ x := isMeasurableFun.Build d _ T R (cst x)
1755-
(@cst_mfun_subproof _ _ _ _ x).
1752+
(* NB: already instantiated in cardinality.v *)
1753+
HB.instance Definition _ x : @FImFun T R (cst x) := FImFun.on (cst x).
1754+
1755+
Import HBNNSimple.
1756+
(* NB: already instantiated in lebesgue_integral.v *)
1757+
HB.instance Definition _ x : @NonNegFun T R (cst x%:num) :=
1758+
NonNegFun.on (cst x%:num).
17561759

17571760
Lemma approximation_sfun :
17581761
exists g : {sfun T >-> R}^nat, (forall x, D x -> EFin \o g ^~ x @ \oo --> f x).
@@ -1761,14 +1764,6 @@ have [fp_ [fp_nd fp_cvg]] :=
17611764
approximation mD (measurable_funepos mf) (fun=> ltac:(by [])).
17621765
have [fn_ [fn_nd fn_cvg]] :=
17631766
approximation mD (measurable_funeneg mf) (fun=> ltac:(by [])).
1764-
1765-
Import HBNNSimple.
1766-
(* duplicate *)
1767-
HB.instance Definition _ x := @cst_fimfun_subproof T R x.
1768-
HB.instance Definition _ x := isMeasurableFun.Build d _ T R (cst x)
1769-
(@cst_mfun_subproof _ _ _ _ x).
1770-
HB.instance Definition _ x := @cst_nnfun_subproof _ T R x.
1771-
17721767
exists (fun n => [the {sfun T >-> R} of fp_ n \+ cst (-1) \* fn_ n]) => x /=.
17731768
rewrite [X in X @ \oo --> _](_ : _ =
17741769
EFin \o fp_^~ x \+ (-%E \o EFin \o fn_^~ x))%E; last first.
@@ -2790,8 +2785,7 @@ Qed.
27902785

27912786
End integral_measure_sum_nnsfun.
27922787

2793-
Section tmp.
2794-
2788+
Section integral_measure_add_nnsfun.
27952789
Import HBNNSimple.
27962790

27972791
Lemma integral_measure_add_nnsfun d (T : measurableType d) (R : realType)
@@ -2804,7 +2798,7 @@ rewrite /measureD integral_measure_sum_nnsfun// 2!big_ord_recl/= big_ord0.
28042798
by rewrite adde0.
28052799
Qed.
28062800

2807-
End tmp.
2801+
End integral_measure_add_nnsfun.
28082802

28092803
Section integral_mfun_measure_sum.
28102804
Local Open Scope ereal_scope.
@@ -3824,20 +3818,6 @@ exists N; split => // t /= /not_implyP[_].
38243818
by rewrite patchE; case: ifPn => //; rewrite inE.
38253819
Qed.
38263820

3827-
Import HBNNSimple.
3828-
3829-
Lemma funID (N : set T) (mN : measurable N) (f : T -> \bar R) :
3830-
let oneCN := [the {nnsfun T >-> R} of mindic R (measurableC mN)] in
3831-
let oneN := [the {nnsfun T >-> R} of mindic R mN] in
3832-
f = (fun x => f x * (oneCN x)%:E) \+ (fun x => f x * (oneN x)%:E).
3833-
Proof.
3834-
move=> oneCN oneN; rewrite funeqE => x.
3835-
rewrite /oneCN /oneN/= /mindic !indicE.
3836-
have [xN|xN] := boolP (x \in N).
3837-
by rewrite mule1 in_setC xN mule0 add0e.
3838-
by rewrite in_setC xN mule0 adde0 mule1.
3839-
Qed.
3840-
38413821
Lemma negligible_integrable (D N : set T) (f : T -> \bar R) :
38423822
measurable N -> measurable D -> measurable_fun D f ->
38433823
mu N = 0 -> mu.-integrable D f <-> mu.-integrable (D `\` N) f.
@@ -3860,7 +3840,7 @@ have h1 : mu.-integrable D f <-> mu.-integrable D (f \_ ~` N).
38603840
rewrite -integral_mkcondr; case: intf => _; apply: le_lt_trans.
38613841
by apply: ge0_subset_integral => //=; [exact:measurableI|
38623842
exact:measurableT_comp].
3863-
apply/integrableP; split => //; rewrite (ereal.funID N f).
3843+
apply/integrableP; split => //; rewrite (funID N f).
38643844
have ? : measurable_fun D (f \_ ~` N).
38653845
by apply/measurable_restrict => //; exact: measurable_funS mf.
38663846
have ? : measurable_fun D (f \_ N).
@@ -3898,7 +3878,7 @@ Lemma ge0_negligible_integral (D N : set T) (f : T -> \bar R) :
38983878
mu N = 0 -> \int[mu]_(x in D) f x = \int[mu]_(x in D `\` N) f x.
38993879
Proof.
39003880
move=> mN mD mf f0 muN0.
3901-
rewrite {1}(ereal.funID N f) ge0_integralD//; last 4 first.
3881+
rewrite {1}(funID N f) ge0_integralD//; last 4 first.
39023882
- by move=> x Dx; rewrite patchE; case: ifPn => // _; exact: f0.
39033883
- apply/measurable_restrict => //; first exact/measurableC.
39043884
exact: measurable_funS mf.

theories/probability.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,8 @@ move=> mE; rewrite integral_indic//= /uniform_prob setIT -ge0_integralZl//=.
12891289
- by rewrite lee_fin invr_ge0// ltW// subr_gt0.
12901290
Qed.
12911291

1292+
Import HBNNSimple.
1293+
12921294
Let integral_uniform_nnsfun (f : {nnsfun _ >-> R}) :
12931295
(\int[uniform_prob ab]_x (f x)%:E =
12941296
(b - a)^-1%:E * \int[mu]_(x in `[a, b]) (f x)%:E)%E.

0 commit comments

Comments
 (0)