Skip to content

Commit 84996a4

Browse files
authored
fixes #1551 (move isMeasurable from simple_functions.v to measure.v) (#1695)
* fixes #1551 * fixes #1518
1 parent b5370de commit 84996a4

9 files changed

Lines changed: 235 additions & 208 deletions

File tree

CHANGELOG_UNRELEASED.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,25 @@
6969
+ generalized and renamed:
7070
* `measurable_fun_itv_bndo_bndc` -> `measurable_fun_itv_bndo_bndcP`
7171
* `measurable_fun_itv_obnd_cbnd` -> `measurable_fun_itv_obnd_cbndP`
72+
- moved from `simple_functions.v` to `measure.v`
73+
+ notations `{mfun _ >-> _}`, `[mfun of _]`
74+
+ mixin `isMeasurableFun`, structure `MesurableFun`, lemmas `measurable_funP`
75+
+ definitions `mfun`, `mfun_key`, canonical `mfun_keyed`
76+
+ definitions `mfun_Sub_subproof`, `mfun_Sub`
77+
+ lemmas `mfun_rect`, `mfun_valP`, `mfuneqP`
78+
+ lemma `measurableT_comp_subproof`
79+
80+
- moved from `simple_functions.v` to `measure.v` and renamed:
81+
+ lemma `measurable_sfunP` -> `measurable_funPTI`
82+
83+
- moved from `simple_functions.v` to `measurable_realfun.v`
84+
+ lemmas `mfun_subring_closed`, `mfun0`, `mfun1`, `mfunN`,
85+
`mfunD`, `mfunB`, `mfunM`, `mfunMn`, `mfun_sum`, `mfun_prod`, `mfunX`
86+
+ definitions `mindic`, `indic_mfun`, `scale_mfun`, `max_mfun`
87+
+ lemmas `mindicE`, `max_mfun_subproof`
88+
89+
- moved from `simple_functions.v` to `lebesgue_stieltjes_measure.v` and renamed:
90+
+ lemma `measurable_sfun_inP` -> `measurable_funP1`
7291

7392
### Renamed
7493

@@ -83,6 +102,12 @@
83102
- in `derive.v`:
84103
+ `derivemxE` -> `deriveEjacobian`
85104

105+
- `measurable_sfunP` -> `measurable_funPTI`
106+
(and moved from from `simple_functions.v` to `measure.v`)
107+
108+
- `measurable_sfun_inP` -> `measurable_funP1`
109+
(and moved from `simple_functions.v` to `lebesgue_stieltjes_measure.v`)
110+
86111
### Generalized
87112

88113
- in `functions.v`
@@ -94,6 +119,10 @@
94119

95120
- file `forms.v` (superseded by MathComp's `sesquilinear.v`)
96121

122+
- in `simple_functions.v`:
123+
+ duplicated hints about `measurable_set1`
124+
+ lemma `measurableT_comp_subproof` turned into a `Let` (now in `measure.v`)
125+
97126
### Infrastructure
98127

99128
### Misc

theories/charge.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(* mathcomp analysis (c) 2022 Inria and AIST. License: CeCILL-C. *)
1+
(* mathcomp analysis (c) 2025 Inria and AIST. License: CeCILL-C. *)
22
From HB Require Import structures.
33
From mathcomp Require Import all_ssreflect ssralg ssrnum ssrint interval.
44
From mathcomp Require Import finmap fingroup perm rat.

theories/kernel.v

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,18 +1189,14 @@ Let integral_kcomp_nnsfun x (f : {nnsfun Z >-> R}) :
11891189
Proof.
11901190
under [in LHS]eq_integral do rewrite fimfunE -fsumEFin//.
11911191
rewrite ge0_integral_fsum//; last 2 first.
1192-
- move=> r; apply/measurable_EFinP/measurableT_comp => [//|].
1193-
have fr : measurable (f @^-1` [set r]) by exact/measurable_sfunP.
1194-
by rewrite (_ : \1__ = mindic R fr).
1192+
- by move=> r; exact/measurable_EFinP/measurableT_comp.
11951193
- by move=> r z _; rewrite EFinM nnfun_muleindic_ge0.
11961194
under [in RHS]eq_integral.
11971195
move=> y _.
11981196
under eq_integral.
11991197
by move=> z _; rewrite fimfunE -fsumEFin//; over.
12001198
rewrite /= ge0_integral_fsum//; last 2 first.
1201-
- move=> r; apply/measurable_EFinP/measurableT_comp => [//|].
1202-
have fr : measurable (f @^-1` [set r]) by exact/measurable_sfunP.
1203-
by rewrite (_ : \1__ = mindic R fr).
1199+
- by move=> r; exact/measurable_EFinP/measurableT_comp.
12041200
- by move=> r z _; rewrite EFinM nnfun_muleindic_ge0.
12051201
under eq_fsbigr.
12061202
move=> r _.
@@ -1218,15 +1214,14 @@ rewrite /= ge0_integral_fsum//; last 2 first.
12181214
apply: eq_fsbigr => r _.
12191215
rewrite (integralZl_indic _ (fun r => f @^-1` [set r]))//; last first.
12201216
exact: preimage_nnfun0.
1221-
rewrite /= integral_kcomp_indic; last exact/measurable_sfunP.
1217+
rewrite /= integral_kcomp_indic//.
12221218
have [r0|r0] := leP 0%R r.
1223-
rewrite ge0_integralZl//; last first.
1224-
exact: measurableT_comp (measurable_kernel k (f @^-1` [set r]) _) _.
1225-
by under eq_integral do rewrite integral_indic// setIT.
1226-
rewrite integral0_eq ?mule0; last first.
1227-
move=> y _; rewrite integral0_eq// => z _.
1228-
by rewrite preimage_nnfun0// indic0.
1229-
by rewrite integral0_eq// => y _; rewrite preimage_nnfun0// measure0 mule0.
1219+
rewrite ge0_integralZl//.
1220+
by under eq_integral do rewrite integral_indic// setIT.
1221+
exact: measurableT_comp (measurable_kernel k (f @^-1` [set r]) _) _.
1222+
rewrite integral0_eq ?mule0.
1223+
by rewrite integral0_eq// => y _; rewrite preimage_nnfun0// measure0 mule0.
1224+
by move=> y _; rewrite integral0_eq// => z _; rewrite preimage_nnfun0// indic0.
12301225
Qed.
12311226

12321227
(* [Lemma 3, Staton 2017 ESOP] (4/4) *)

theories/lebesgue_integral_theory/lebesgue_integral_definition.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ rewrite /fleg [X in _ X](_ : _ = \big[setU/set0]_(y <- fset_set (range f))
248248
\big[setU/set0]_(x <- fset_set (range (g n)) | c * y <= x)
249249
(f @^-1` [set y] `&` (g n @^-1` [set x]))).
250250
apply: bigsetU_measurable => r _; apply: bigsetU_measurable => r' crr'.
251-
exact/measurableI/measurable_sfunP.
251+
exact/measurableI.
252252
rewrite predeqE => t; split => [/= cfgn|].
253253
- rewrite -bigcup_seq; exists (f t); first by rewrite /= in_fset_set//= mem_set.
254254
rewrite -bigcup_seq_cond; exists (g n t) => //=.

theories/lebesgue_integral_theory/simple_functions.v

Lines changed: 4 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,8 @@ From mathcomp Require Import function_spaces.
2929
(* *)
3030
(* Detailed contents: *)
3131
(* ```` *)
32-
(* {mfun aT >-> rT} == type of measurable functions *)
33-
(* aT and rT are sigmaRingType's. *)
3432
(* {sfun T >-> R} == type of simple functions *)
35-
(* f \in mfun == holds for f : {mfun _ >-> _} *)
3633
(* {nnsfun T >-> R} == type of non-negative simple functions *)
37-
(* mindic mD := \1_D where mD is a proof that D is measurable *)
38-
(* indic_mfun mD := mindic mD *)
39-
(* scale_mfun k f := k \o* f *)
40-
(* max_mfun f g := f \max g *)
4134
(* indic_sfun mD := mindic _ mD *)
4235
(* cst_sfun r == constant simple function *)
4336
(* max_sfun f g := f \max f *)
@@ -55,10 +48,6 @@ From mathcomp Require Import function_spaces.
5548
(* *)
5649
(******************************************************************************)
5750

58-
Reserved Notation "{ 'mfun' aT >-> T }"
59-
(at level 0, format "{ 'mfun' aT >-> T }").
60-
Reserved Notation "[ 'mfun' 'of' f ]"
61-
(at level 0, format "[ 'mfun' 'of' f ]").
6251
Reserved Notation "{ 'nnfun' aT >-> T }"
6352
(at level 0, format "{ 'nnfun' aT >-> T }").
6453
Reserved Notation "[ 'nnfun' 'of' f ]"
@@ -81,31 +70,6 @@ Import numFieldNormedType.Exports.
8170
Local Open Scope classical_set_scope.
8271
Local Open Scope ring_scope.
8372

84-
#[global]
85-
Hint Extern 0 (measurable [set _]) => solve [apply: measurable_set1] : core.
86-
87-
HB.mixin Record isMeasurableFun d d' (aT : sigmaRingType d) (rT : sigmaRingType d')
88-
(f : aT -> rT) := {
89-
measurable_funPT : measurable_fun [set: aT] f
90-
}.
91-
HB.structure Definition MeasurableFun d d' aT rT :=
92-
{f of @isMeasurableFun d d' aT rT f}.
93-
Arguments measurable_funPT {d d' aT rT} s.
94-
95-
Notation "{ 'mfun' aT >-> T }" := (@MeasurableFun.type _ _ aT T) : form_scope.
96-
Notation "[ 'mfun' 'of' f ]" := [the {mfun _ >-> _} of f] : form_scope.
97-
#[global] Hint Extern 0 (measurable_fun [set: _] _) =>
98-
solve [apply: measurable_funPT] : core.
99-
100-
Lemma measurable_funP {d d' : measure_display}
101-
{aT : measurableType d} {rT : sigmaRingType d'}
102-
(D : set aT) (s : {mfun aT >-> rT}) : measurable_fun D s.
103-
Proof.
104-
move=> mD Y mY; apply: measurableI => //.
105-
by rewrite -(setTI (_ @^-1` _)); exact: measurable_funPT.
106-
Qed.
107-
Arguments measurable_funP {d d' aT rT D} s.
108-
10973
Module HBSimple.
11074

11175
HB.structure Definition SimpleFun d (aT : sigmaRingType d) (rT : realType) :=
@@ -116,10 +80,6 @@ End HBSimple.
11680
Notation "{ 'sfun' aT >-> T }" := (@HBSimple.SimpleFun.type _ aT T) : form_scope.
11781
Notation "[ 'sfun' 'of' f ]" := [the {sfun _ >-> _} of f] : form_scope.
11882

119-
Lemma measurable_sfunP {d d'} {aT : measurableType d} {rT : measurableType d'}
120-
(f : {mfun aT >-> rT}) (Y : set rT) : measurable Y -> measurable (f @^-1` Y).
121-
Proof. by move=> mY; rewrite -[f @^-1` _]setTI; exact: measurable_funP. Qed.
122-
12383
Module HBNNSimple.
12484
Import HBSimple.
12585

@@ -132,137 +92,6 @@ End HBNNSimple.
13292
Notation "{ 'nnsfun' aT >-> T }" := (@HBNNSimple.NonNegSimpleFun.type _ aT%type T) : form_scope.
13393
Notation "[ 'nnsfun' 'of' f ]" := [the {nnsfun _ >-> _} of f] : form_scope.
13494

135-
Section mfun_pred.
136-
Context {d d'} {aT : sigmaRingType d} {rT : sigmaRingType d'}.
137-
Definition mfun : {pred aT -> rT} := mem [set f | measurable_fun setT f].
138-
Definition mfun_key : pred_key mfun. Proof. exact. Qed.
139-
Canonical mfun_keyed := KeyedPred mfun_key.
140-
End mfun_pred.
141-
142-
Section mfun.
143-
Context {d d'} {aT : sigmaRingType d} {rT : sigmaRingType d'}.
144-
Notation T := {mfun aT >-> rT}.
145-
Notation mfun := (@mfun _ _ aT rT).
146-
147-
Section Sub.
148-
Context (f : aT -> rT) (fP : f \in mfun).
149-
Definition mfun_Sub_subproof := @isMeasurableFun.Build d _ aT rT f (set_mem fP).
150-
#[local] HB.instance Definition _ := mfun_Sub_subproof.
151-
Definition mfun_Sub := [mfun of f].
152-
End Sub.
153-
154-
Lemma mfun_rect (K : T -> Type) :
155-
(forall f (Pf : f \in mfun), K (mfun_Sub Pf)) -> forall u : T, K u.
156-
Proof.
157-
move=> Ksub [f [[Pf]]]/=.
158-
by suff -> : Pf = (set_mem (@mem_set _ [set f | _] f Pf)) by apply: Ksub.
159-
Qed.
160-
161-
Lemma mfun_valP f (Pf : f \in mfun) : mfun_Sub Pf = f :> (_ -> _).
162-
Proof. by []. Qed.
163-
164-
HB.instance Definition _ := isSub.Build _ _ T mfun_rect mfun_valP.
165-
166-
Lemma mfuneqP (f g : {mfun aT >-> rT}) : f = g <-> f =1 g.
167-
Proof. by split=> [->//|fg]; apply/val_inj/funext. Qed.
168-
169-
HB.instance Definition _ := [Choice of {mfun aT >-> rT} by <:].
170-
171-
HB.instance Definition _ x := isMeasurableFun.Build d _ aT rT (cst x)
172-
(@measurable_cst _ _ aT rT setT x).
173-
174-
End mfun.
175-
176-
Section mfun_realType.
177-
Context {rT : realType}.
178-
179-
HB.instance Definition _ := @isMeasurableFun.Build _ _ _ rT
180-
(@normr rT rT) (@normr_measurable rT setT).
181-
182-
HB.instance Definition _ :=
183-
isMeasurableFun.Build _ _ _ _ (@expR rT) (@measurable_expR rT).
184-
185-
End mfun_realType.
186-
187-
Section mfun_measurableType.
188-
Context {d1} {T1 : measurableType d1} {d2} {T2 : measurableType d2}
189-
{d3} {T3 : measurableType d3}.
190-
Variables (f : {mfun T2 >-> T3}) (g : {mfun T1 >-> T2}).
191-
192-
Lemma measurableT_comp_subproof : measurable_fun setT (f \o g).
193-
Proof. exact: measurableT_comp. Qed.
194-
195-
HB.instance Definition _ := isMeasurableFun.Build _ _ _ _ (f \o g)
196-
measurableT_comp_subproof.
197-
198-
End mfun_measurableType.
199-
200-
Section ring.
201-
Context d (aT : measurableType d) (rT : realType).
202-
203-
Lemma mfun_subring_closed : subring_closed (@mfun _ _ aT rT).
204-
Proof.
205-
split=> [|f g|f g]; rewrite !inE/=.
206-
- exact: measurable_cst.
207-
- exact: measurable_funB.
208-
- exact: measurable_funM.
209-
Qed.
210-
HB.instance Definition _ := GRing.isSubringClosed.Build _
211-
(@mfun d default_measure_display aT rT) mfun_subring_closed.
212-
HB.instance Definition _ := [SubChoice_isSubComRing of {mfun aT >-> rT} by <:].
213-
214-
Implicit Types (f g : {mfun aT >-> rT}).
215-
216-
Lemma mfun0 : (0 : {mfun aT >-> rT}) =1 cst 0 :> (_ -> _). Proof. by []. Qed.
217-
Lemma mfun1 : (1 : {mfun aT >-> rT}) =1 cst 1 :> (_ -> _). Proof. by []. Qed.
218-
Lemma mfunN f : - f = \- f :> (_ -> _). Proof. by []. Qed.
219-
Lemma mfunD f g : f + g = f \+ g :> (_ -> _). Proof. by []. Qed.
220-
Lemma mfunB f g : f - g = f \- g :> (_ -> _). Proof. by []. Qed.
221-
Lemma mfunM f g : f * g = f \* g :> (_ -> _). Proof. by []. Qed.
222-
Lemma mfunMn f n : (f *+ n) = (fun x => f x *+ n) :> (_ -> _).
223-
Proof. by apply/funext=> x; elim: n => //= n; rewrite !mulrS !mfunD /= => ->. Qed.
224-
Lemma mfun_sum I r (P : {pred I}) (f : I -> {mfun aT >-> rT}) (x : aT) :
225-
(\sum_(i <- r | P i) f i) x = \sum_(i <- r | P i) f i x.
226-
Proof. by elim/big_rec2: _ => //= i y ? Pi <-. Qed.
227-
Lemma mfun_prod I r (P : {pred I}) (f : I -> {mfun aT >-> rT}) (x : aT) :
228-
(\sum_(i <- r | P i) f i) x = \sum_(i <- r | P i) f i x.
229-
Proof. by elim/big_rec2: _ => //= i y ? Pi <-. Qed.
230-
Lemma mfunX f n : f ^+ n = (fun x => f x ^+ n) :> (_ -> _).
231-
Proof. by apply/funext=> x; elim: n => [|n IHn]//; rewrite !exprS mfunM/= IHn. Qed.
232-
233-
HB.instance Definition _ f g := MeasurableFun.copy (f \+ g) (f + g).
234-
HB.instance Definition _ f g := MeasurableFun.copy (\- f) (- f).
235-
HB.instance Definition _ f g := MeasurableFun.copy (f \- g) (f - g).
236-
HB.instance Definition _ f g := MeasurableFun.copy (f \* g) (f * g).
237-
238-
Definition mindic (D : set aT) of measurable D : aT -> rT := \1_D.
239-
240-
Lemma mindicE (D : set aT) (mD : measurable D) :
241-
mindic mD = (fun x => (x \in D)%:R).
242-
Proof. by rewrite /mindic funeqE => t; rewrite indicE. Qed.
243-
244-
HB.instance Definition _ D mD := @isMeasurableFun.Build _ _ aT rT (mindic mD)
245-
(@measurable_indic _ aT rT setT D mD).
246-
247-
Definition indic_mfun (D : set aT) (mD : measurable D) : {mfun aT >-> rT} :=
248-
mindic mD.
249-
250-
HB.instance Definition _ k f := MeasurableFun.copy (k \o* f) (f * cst k).
251-
Definition scale_mfun k f : {mfun aT >-> rT} := k \o* f.
252-
253-
Lemma max_mfun_subproof f g : @isMeasurableFun d _ aT rT (f \max g).
254-
Proof. by split; apply: measurable_maxr. Qed.
255-
256-
HB.instance Definition _ f g := max_mfun_subproof f g.
257-
258-
Definition max_mfun f g : {mfun aT >-> _} := f \max g.
259-
260-
End ring.
261-
Arguments indic_mfun {d aT rT} _.
262-
(* TODO: move earlier?*)
263-
#[global] Hint Extern 0 (measurable_fun _ (\1__ : _ -> _)) =>
264-
(exact: measurable_indic ) : core.
265-
26695
Section sfun_pred.
26796
Context {d} {aT : sigmaRingType d} {rT : realType}.
26897
Definition sfun : {pred _ -> _} := [predI @mfun _ _ aT rT & fimfun].
@@ -311,7 +140,7 @@ Proof. by split=> [->//|fg]; apply/val_inj/funext. Qed.
311140

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

314-
(* NB: already instantiated in cardinality.v *)
143+
(* NB: already in cardinality.v *)
315144
HB.instance Definition _ x : @FImFun aT rT (cst x) := FImFun.on (cst x).
316145

317146
Definition cst_sfun x : {sfun aT >-> rT} := cst x.
@@ -371,16 +200,17 @@ HB.instance Definition _ f g := MeasurableFun.copy (f \- g) (f - g).
371200
HB.instance Definition _ f g := MeasurableFun.copy (f \* g) (f * g).
372201

373202
Import HBSimple.
374-
(* NB: already instantiated in lebesgue_integral.v *)
203+
204+
(* TODO: mv to `measurable_realfun.v`? *)
375205
HB.instance Definition _ (D : set aT) (mD : measurable D) :
376206
@FImFun aT rT (mindic _ mD) := FImFun.on (mindic _ mD).
377-
378207
Definition indic_sfun (D : set aT) (mD : measurable D) : {sfun aT >-> rT} :=
379208
mindic rT mD.
380209

381210
HB.instance Definition _ k f := MeasurableFun.copy (k \o* f) (f * cst_sfun k).
382211
Definition scale_sfun k f : {sfun aT >-> rT} := k \o* f.
383212

213+
(* NB: already in `measurable_realfun.v` *)
384214
HB.instance Definition _ f g := max_mfun_subproof f g.
385215
Definition max_sfun f g : {sfun aT >-> _} := f \max g.
386216

@@ -441,9 +271,6 @@ Proof. by move=> /=. Qed.
441271
HB.instance Definition _ x := @isNonNegFun.Build T R (cst x%:num)
442272
(cst_nnfun_subproof x).
443273

444-
(* NB: already instantiated in cardinality.v *)
445-
HB.instance Definition _ x : @FImFun T R (cst x) := FImFun.on (cst x).
446-
447274
Definition cst_nnsfun (r : {nonneg R}) : {nnsfun T >-> R} := cst r%:num.
448275

449276
Definition nnsfun0 : {nnsfun T >-> R} := cst_nnsfun 0%:nng.
@@ -554,18 +381,6 @@ Qed.
554381

555382
End nnsfun_cover.
556383

557-
(* FIXME: shouldn't we avoid calling [done] in a hint? *)
558-
#[global] Hint Extern 0 (measurable (_ @^-1` [set _])) =>
559-
solve [apply: measurable_sfunP; exact: measurable_set1] : core.
560-
561-
Lemma measurable_sfun_inP {d} {aT : measurableType d} {rT : realType}
562-
(f : {mfun aT >-> rT}) D (y : rT) :
563-
measurable D -> measurable (D `&` f @^-1` [set y]).
564-
Proof. by move=> Dm; exact: measurableI. Qed.
565-
566-
#[global] Hint Extern 0 (measurable (_ `&` _ @^-1` [set _])) =>
567-
solve [apply: measurable_sfun_inP; assumption] : core.
568-
569384
Section measure_fsbig.
570385
Local Open Scope ereal_scope.
571386
Context d (T : measurableType d) (R : realType).

theories/lebesgue_stieltjes_measure.v

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,20 @@ Hint Extern 0 (measurable [set _]) => solve [apply: measurable_set1] : core.
600600
#[global]
601601
Hint Extern 0 (measurable [set` _] ) => exact: measurable_itv : core.
602602

603+
#[global] Hint Extern 0 (measurable (_ @^-1` [set _])) =>
604+
solve [apply: measurable_funPTI; exact: measurable_set1] : core.
605+
606+
Lemma measurable_funP1 {d} {aT : measurableType d} {rT : realType}
607+
(f : {mfun aT >-> rT}) D (y : rT) :
608+
measurable D -> measurable (D `&` f @^-1` [set y]).
609+
Proof. move=> mD; exact: measurable_funP. Qed.
610+
611+
#[deprecated(since="mathcomp-analysis 1.13.0", note="renamed to `measurable_funP1`")]
612+
Notation measurable_sfun_inP := measurable_funP1 (only parsing).
613+
614+
#[global] Hint Extern 0 (measurable (_ `&` _ @^-1` [set _])) =>
615+
solve [apply: measurable_funP1; assumption] : core.
616+
603617
HB.mixin Record isCumulativeBounded (R : numFieldType) (l r : R) (f : R -> R) := {
604618
cumulativeNy : f @ -oo --> l ;
605619
cumulativey : f @ +oo --> r }.

0 commit comments

Comments
 (0)