diff --git a/CHANGELOG_UNRELEASED.md b/CHANGELOG_UNRELEASED.md index 43da589cbf..94cda9c02b 100644 --- a/CHANGELOG_UNRELEASED.md +++ b/CHANGELOG_UNRELEASED.md @@ -26,6 +26,7 @@ - in `num_topology.v`: + lemmas `at_rightD`, `at_leftD`, `near_at_rightD`, `near_at_leftD`, `at_left_shift`, `at_right_shift` + - in `esum.v`: + lemmas `pos_esum_ge1`, `le_pos_esum_fine`, `sum_esum_ge`, `le_esum_fine`, `subset_esum`, `esum0`, `esum_if_eq_op_set1`, `esum_neq0`, `esum_ge1` @@ -36,6 +37,10 @@ + lemma `esumE` + lemmas `esummable_esumZ`, `esummable_esumD`, `esummableB` +- in `simple_functions.v`: + + lemmas `mem_sfun_comp_pair`, `sfun_submod_closed` + + `{sfun aT >-> rT}` is an `lmodType` when `rT` is a `normedModType` + ### Changed - in `derive.v`: @@ -72,6 +77,10 @@ - in `esum.v`: + lemmma `le_esum` +- in `simple_functions.v`: + + structure `SimpleFun` (and notation `{sfun aT >-> _}`): codomain + generalized from `realType` to `sigmaRingType d'`, adding a display parameter `d'`; + ### Deprecated ### Removed diff --git a/theories/lebesgue_integral_theory/measurable_fun_approximation.v b/theories/lebesgue_integral_theory/measurable_fun_approximation.v index 76d6665226..4444562c1d 100644 --- a/theories/lebesgue_integral_theory/measurable_fun_approximation.v +++ b/theories/lebesgue_integral_theory/measurable_fun_approximation.v @@ -388,6 +388,7 @@ Import HBNNSimple. (*HB.instance Definition _ x : @NonNegFun T R (cst x%:num) := NonNegFun.on (cst x%:num).*) (* generates Warning: HB: no new instance is generated [HB.no-new-instance,HB,elpi,default] *) +Import MeasurableR. Lemma approximation_sfun : exists g : {sfun T >-> R}^nat, (forall x, D x -> EFin \o g ^~ x @ \oo --> f x). diff --git a/theories/lebesgue_integral_theory/simple_functions.v b/theories/lebesgue_integral_theory/simple_functions.v index 04e9cc138a..718f8eddde 100644 --- a/theories/lebesgue_integral_theory/simple_functions.v +++ b/theories/lebesgue_integral_theory/simple_functions.v @@ -6,6 +6,7 @@ From mathcomp Require Import mathcomp_extra boolp classical_sets functions. From mathcomp Require Import cardinality reals fsbigop ereal topology tvs. From mathcomp Require Import normedtype sequences real_interval esum measure. From mathcomp Require Import lebesgue_measure numfun realfun measurable_realfun. +From mathcomp Require Import measurable_function. (**md**************************************************************************) (* # Simple functions *) @@ -73,46 +74,59 @@ Local Open Scope ring_scope. Module HBSimple. Import MeasurableR. -HB.structure Definition SimpleFun d (aT : sigmaRingType d) (rT : realType) := - {f of @isMeasurableFun d _ aT rT f & @FiniteImage aT rT f}. +HB.structure Definition SimpleFun d d' + (aT : sigmaRingType d) (rT : sigmaRingType d') := + {f of @isMeasurableFun d d' aT rT f & @FiniteImage aT rT f}. End HBSimple. -Notation "{ 'sfun' aT >-> T }" := (@HBSimple.SimpleFun.type _ aT T) : form_scope. +Notation "{ 'sfun' aT >-> T }" := + (@HBSimple.SimpleFun.type _ _ aT T) : form_scope. Notation "[ 'sfun' 'of' f ]" := [the {sfun _ >-> _} of f] : form_scope. Module HBNNSimple. Import HBSimple. +Import MeasurableR. HB.structure Definition NonNegSimpleFun d (aT : sigmaRingType d) (rT : realType) := - {f of @SimpleFun d _ _ f & @NonNegFun aT rT f}. + {f of @SimpleFun d _ _ _ f & @NonNegFun aT rT f}. End HBNNSimple. -Notation "{ 'nnsfun' aT >-> T }" := (@HBNNSimple.NonNegSimpleFun.type _ aT%type T) : form_scope. +Notation "{ 'nnsfun' aT >-> T }" := + (@HBNNSimple.NonNegSimpleFun.type _ aT%type T) : form_scope. Notation "[ 'nnsfun' 'of' f ]" := [the {nnsfun _ >-> _} of f] : form_scope. Section sfun_pred. -Context {d} {aT : sigmaRingType d} {rT : realType}. +Context {d d'} {aT : sigmaRingType d} {bT : sigmaRingType d'}. Import MeasurableR. -Definition sfun : {pred _ -> _} := [predI @mfun _ _ aT rT & fimfun]. + +Definition sfun : {pred _ -> _} := [predI @mfun _ _ aT bT & fimfun]. + Definition sfun_key : pred_key sfun. Proof. exact. Qed. + Canonical sfun_keyed := KeyedPred sfun_key. + Lemma sub_sfun_mfun : {subset sfun <= mfun}. Proof. by move=> x /andP[]. Qed. + Lemma sub_sfun_fimfun : {subset sfun <= fimfun}. Proof. by move=> x /andP[]. Qed. + End sfun_pred. Section sfun. -Context {d} {aT : measurableType d} {rT : realType}. +Context {d d'} {aT : measurableType d} {rT : sigmaRingType d'}. Notation T := {sfun aT >-> rT}. -Notation sfun := (@sfun _ aT rT). +Notation sfun := (@sfun _ _ aT rT). Section Sub. Context (f : aT -> rT) (fP : f \in sfun). Import MeasurableR. + Definition sfun_Sub1_subproof := - @isMeasurableFun.Build d _ aT rT f (set_mem (sub_sfun_mfun fP)). + @isMeasurableFun.Build d d' aT rT f (set_mem (sub_sfun_mfun fP)). + #[local] HB.instance Definition _ := sfun_Sub1_subproof. + Definition sfun_Sub2_subproof := @FiniteImage.Build aT rT f (set_mem (sub_sfun_fimfun fP)). @@ -155,9 +169,9 @@ Lemma cst_sfunE x : @cst_sfun x =1 cst x. Proof. by []. Qed. End sfun. (* a better way to refactor function stuffs *) -Lemma fctD (T : Type) (K : pzRingType) (f g : T -> K) : f + g = f \+ g. +Lemma fctD (T : Type) (N : nmodType) (f g : T -> N) : f + g = f \+ g. Proof. by []. Qed. -Lemma fctN (T : Type) (K : pzRingType) (f : T -> K) : - f = \- f. +Lemma fctN (T : Type) (N : zmodType) (f : T -> N) : - f = \- f. Proof. by []. Qed. Lemma fctM (T : Type) (K : pzRingType) (f g : T -> K) : f * g = f \* g. Proof. by []. Qed. @@ -169,15 +183,17 @@ Definition fctWE := (fctD, fctN, fctM, fctZ). Section ring. Context d (aT : measurableType d) (rT : realType). +Import MeasurableR. -Lemma sfun_subring_closed : subring_closed (@sfun d aT rT). +Lemma sfun_subring_closed : subring_closed (@sfun d _ aT rT). Proof. by split=> [|f g|f g]; rewrite ?inE/= ?rpred1//; move=> /andP[/= mf ff] /andP[/= mg fg]; rewrite !(rpredB, rpredM). Qed. -HB.instance Definition _ := GRing.isSubringClosed.Build _ sfun +HB.instance Definition _ := GRing.isSubringClosed.Build _ (@sfun d _ aT rT) sfun_subring_closed. + HB.instance Definition _ := [SubChoice_isSubComPzRing of {sfun aT >-> rT} by <:]. Implicit Types (f g : {sfun aT >-> rT}). @@ -220,6 +236,75 @@ Definition scale_sfun k f : {sfun aT >-> rT} := k \o* f. End ring. Arguments indic_sfun {d aT rT} _. +(* TODO: move, gen bigcap_set1 *) +Lemma singleton_bigcap {R : realType} {V : normedModType R} (x : V) : + [set x] = \bigcap_(k : nat) ball x (k.+1%:R)^-1. +Proof. +apply/seteqP; split => [_ -> k _|y xy]. + by rewrite -ball_normE/= subrr normr0 invr_gt0 ltr0n. +apply/eqP; rewrite eq_sym -subr_eq0 -normr_eq0 eq_le normr_ge0 andbT. +apply/ler_addgt0Pl => e e0; rewrite addr0. +have := xy (truncn e^-1) I; rewrite -ball_normE/= => /ltW/le_trans; apply. +by rewrite invf_ple ?posrE ?ltr0n ?invr_gt0//; apply/ltW/truncnS_gt. +Qed. + +Section sfun_lmodType. +Context d (aT : measurableType d) (R : realType). +Import HBSimple. +Import MeasurableR. + +Let borel_type (T : topologicalType) := g_sigma_algebraType (@open T). + +Lemma mem_sfun_comp_pair (U V W : normedModType R) (f : {sfun aT >-> borel_type U}) + (g : {sfun aT >-> borel_type V}) (h : U * V -> W) : + (fun x => h (f x, g x)) \in @sfun _ _ aT (borel_type W). +Proof. +rewrite inE; apply/andP; split; rewrite inE/=. + move=> _ Y mY; rewrite setTI. + rewrite (_ : _ @^-1` Y = + \bigcup_(a in range f) (\bigcup_(b in range g) + ((f @^-1` [set a] `&` g @^-1` [set b]) `&` [set _ | Y (h (a, b))]))). + apply/seteqP; split=> [x/= Yfg|x [a _] [b _] [[/= <- <-]]//]. + by exists (f x); [exists x|exists (g x); [exists x|]]. + apply: fin_bigcup_measurable; first exact: fimfunP. + move=> a _; apply: fin_bigcup_measurable; first exact: fimfunP. + move=> b _; apply: measurableI. + apply: measurableI. + apply: measurable_funPTI => //. + (* TODO: fix me URGENT *) + rewrite singleton_bigcap//. + apply: bigcap_measurable => // k _. + by apply: sub_sigma_algebra; exact: ball_open. + apply: measurable_funPTI => //. + (* TODO: fix me URGENT *) + rewrite singleton_bigcap//. + apply: bigcap_measurable => // k _. + by apply: sub_sigma_algebra; exact: ball_open. + have [Yhab|Yhab] := pselect (Y (h (a, b))). + by rewrite (_ : [set _ | _] = setT); + [apply/seteqP; split|exact: measurableT]. + rewrite (_ : [set _ | _] = set0); last exact: measurable0. + by apply/seteqP; split. +apply: (@sub_finite_set _ _ (h @` (range f `*` range g))). + by move=> _ [x _ <-]/=; exists (f x, g x) => //; split; exists x. +exact/finite_image/finite_setX/fimfunP. +Qed. + +Lemma sfun_submod_closed (V : normedModType R) : + submod_closed (@sfun _ _ aT (borel_type V)). +Proof. +split=> [|k f g sf sg]; first exact: (valP (cst_sfun (0 : borel_type V))). +exact: (mem_sfun_comp_pair (sfun_Sub sf) (sfun_Sub sg) (fun t => k *: t.1 + t.2)). +Qed. + +HB.instance Definition _ (V : normedModType R) := + GRing.isSubmodClosed.Build _ _ (@sfun _ _ aT (borel_type V)) + (sfun_submod_closed V). +HB.instance Definition _ (V : normedModType R) := + [SubChoice_isSubLmodule of {sfun aT >-> borel_type V} by <:]. + +End sfun_lmodType. + Lemma preimage_nnfun0 T (R : realDomainType) (f : {nnfun T >-> R}) t : t < 0 -> f @^-1` [set t] = set0. Proof. @@ -238,6 +323,7 @@ Section simple_bounded. Context d (T : sigmaRingType d) (R : realType). Import HBSimple. +Import MeasurableR. Lemma simple_bounded (f : {sfun T >-> R}) : bounded_fun f. Proof. diff --git a/theories/measure_theory/measurable_function.v b/theories/measure_theory/measurable_function.v index 0c007ea531..55cb0732d5 100644 --- a/theories/measure_theory/measurable_function.v +++ b/theories/measure_theory/measurable_function.v @@ -66,6 +66,9 @@ Proof. by move=> mY; rewrite -[f @^-1` _]setTI; exact: measurable_funP. Qed. #[deprecated(since="mathcomp-analysis 1.13.0", note="renamed to `measurable_funPTI`")] Notation measurable_sfunP := measurable_funPTI (only parsing). +(*#[global] Hint Extern 0 (measurable (_ @^-1` [set _])) => + solve [apply: measurable_funPTI; exact: measurable1] : core.*) + Section mfun_pred. Context {d d'} {aT : sigmaRingType d} {rT : sigmaRingType d'}. Definition mfun : {pred aT -> rT} := mem [set f | measurable_fun setT f].