@@ -5,18 +5,47 @@ From mathcomp Require Import mathcomp_extra boolp classical_sets functions.
55From mathcomp Require Import cardinality reals fsbigop ereal topology tvs.
66From mathcomp Require Import normedtype sequences real_interval esum measure.
77From mathcomp Require Import lebesgue_measure numfun realfun measurable_realfun.
8- From mathcomp Require Import normed_module measurable_structure.
9-
10- Unset SsrOldRewriteGoalsOrder. (* remove the line when requiring MathComp >= 2.6 *)
11- Set Implicit Arguments .
12- Unset Strict Implicit .
13- Unset Printing Implicit Defensive.
14- Import Order.TTheory GRing.Theory Num.Def Num.Theory.
15- Import numFieldNormedType.Exports.
16-
17- Local Open Scope classical_set_scope.
18- Local Open Scope ring_scope.
19- Local Open Scope measure_display_scope.
8+ From mathcomp Require Import borel_hierarchy.
9+
10+ (**md************************************************************************* *)
11+ (* # Simple functions *)
12+ (* *)
13+ (* This file contains a formalization of simple functions and with basic *)
14+ (* properties (addition, etc.). *)
15+ (* *)
16+ (* About the use of simple functions: *)
17+ (* Because of a limitation of HB <= 1.8.0, we need some care to be able to *)
18+ (* use simple functions. *)
19+ (* The structure SimpleFun (resp. NonNegSimpleFun) is located inside the *)
20+ (* module HBSimple (resp. HBNNSimple). *)
21+ (* As a consequence, we need to import HBSimple (resp. HBNNSimple) to use the *)
22+ (* coercion from simple functions (resp. non-negative simple functions) to *)
23+ (* Rocq functions. *)
24+ (* Also, assume that f (e.g., cst, indic) is equipped with the structure of *)
25+ (* MeasurableFun. For f to be equipped with the structure of SimpleFun *)
26+ (* (resp. NonNegSimpleFun), one need locally to import HBSimple (resp. *)
27+ (* HBNNSimple) and to instantiate FiniteImage (resp. NonNegFun) locally. *)
28+ (* *)
29+ (* Detailed contents: *)
30+ (* ```` *)
31+ (* {sfun T >-> R} == type of simple functions *)
32+ (* They form a (potentially zero) ring. *)
33+ (* {nnsfun T >-> R} == type of non-negative simple functions *)
34+ (* indic_sfun mD := mindic _ mD *)
35+ (* cst_sfun r == constant simple function *)
36+ (* cst_nnsfun r == constant simple function *)
37+ (* nnsfun0 := cst_nnsfun 0 *)
38+ (* add_nnsfun f g := f \+ g *)
39+ (* mul_nnsfun f g := f \* g *)
40+ (* max_nnsfun f g := f \max g *)
41+ (* proj_nssfun f mA == projection of the function f to the set A *)
42+ (* mA is a proof that A is measurable *)
43+ (* scale_nnsfun k f == scales f by the non-negative real number k *)
44+ (* sum_nnsfun f n := \big[add_nnsfun/nnsfun0]_(i < n) f i *)
45+ (* bigmax_nnsfun f n := \big[max_nnsfun/nnsfun0]_(i < n) f i *)
46+ (* ```` *)
47+ (* *)
48+ (***************************************************************************** *)
2049
2150Reserved Notation "{ 'nnfun' aT >-> T }"
2251 (at level 0, format "{ 'nnfun' aT >-> T }").
@@ -209,6 +238,55 @@ Definition scale_sfun k f : {sfun aT >-> rT} := k \o* f.
209238End ring.
210239Arguments indic_sfun {d aT rT} _.
211240
241+ Section sfun_lmodType.
242+ Context d (aT : measurableType d) (R : realType).
243+ Import HBSimple.
244+
245+ HB.instance Definition _ (V : normedModType R) := GRing.Lmodule.on (borel_type V).
246+
247+ Lemma sfun_op (U V W : normedModType R)
248+ (f : {sfun aT >-> borel_type U}) (g : {sfun aT >-> borel_type V})
249+ (h : U * V -> W) :
250+ (fun x => h (f x, g x)) \in @sfun _ _ aT (borel_type W).
251+ Proof .
252+ rewrite inE; apply/andP; split; rewrite inE/=.
253+ move=> _ Y mY; rewrite setTI.
254+ rewrite (_ : _ @^-1` Y =
255+ \bigcup_(a in range f) (\bigcup_(b in range g)
256+ ((f @^-1` [set a] `&` g @^-1` [set b]) `&` [set _ | Y (h (a, b))]))).
257+ apply/seteqP; split=> [x/= Yfg|x [a _] [b _] [[/= <- <-]]//].
258+ by exists (f x); [exists x|exists (g x); [exists x|split]].
259+ apply: fin_bigcup_measurable; first exact: fimfunP.
260+ move=> a _; apply: fin_bigcup_measurable; first exact: fimfunP.
261+ move=> b _; apply: measurableI; last first.
262+ have [Yhab|Yhab] := pselect (Y (h (a, b))).
263+ by rewrite (_ : [set _ | _] = setT);
264+ [apply/seteqP; split|exact: measurableT].
265+ rewrite (_ : [set _ | _] = set0); last exact: measurable0.
266+ by apply/seteqP; split.
267+ apply: measurableI.
268+ exact: (measurable_funPTI f (measurable1 a)).
269+ exact: (measurable_funPTI g (measurable1 b)).
270+ apply: (sub_finite_set (B := h @` (range f `*` range g))).
271+ by move=> _ [x _ <-]/=; exists (f x, g x) => //; split; exists x.
272+ by apply: finite_image; apply: finite_setX; exact: fimfunP.
273+ Qed .
274+
275+ Lemma sfun_submod_closed (V : normedModType R) :
276+ submod_closed (@sfun _ _ aT (borel_type V)).
277+ Proof .
278+ split=> [|k f g sf sg]; first exact: (valP (cst_sfun (0 : borel_type V))).
279+ exact: (sfun_op (sfun_Sub sf) (sfun_Sub sg) (fun t => k *: t.1 + t.2)).
280+ Qed .
281+
282+ HB.instance Definition _ (V : normedModType R) :=
283+ GRing.isSubmodClosed.Build _ _ (@sfun _ _ aT (borel_type V))
284+ (sfun_submod_closed V).
285+ HB.instance Definition _ (V : normedModType R) :=
286+ [SubChoice_isSubLmodule of {sfun aT >-> borel_type V} by <:].
287+
288+ End sfun_lmodType.
289+
212290Lemma preimage_nnfun0 T (R : realDomainType) (f : {nnfun T >-> R}) t :
213291 t < 0 -> f @^-1` [set t] = set0.
214292Proof .
0 commit comments