diff --git a/CHANGELOG_UNRELEASED.md b/CHANGELOG_UNRELEASED.md index de4c407ce2..421944ebc3 100644 --- a/CHANGELOG_UNRELEASED.md +++ b/CHANGELOG_UNRELEASED.md @@ -15,6 +15,14 @@ + lemmas `zerofctE`, `onefctE` ### Added +- new file `measurable_topology.v`: + + definition `borelType` + + lemmas `singleton_bigcap`, `measurable1` + +- in `simple_functions.v`: + + lemmas `mem_sfun_comp_pair`, `sfun_submod_closed` + + `{sfun aT >-> rT}` is an `lmodType` when `rT` is a `normedModType` + - in `set_interval.v`: + lemmas `setU_itvob1`, `setU_1itvob` @@ -393,6 +401,8 @@ - in `simple_functions.v`: + lemmas `fctD`, `fctN`, `fctM`, `fctZ` + + structure `SimpleFun` (and notation `{sfun aT >-> _}`): codomain + generalized from `realType` to `sigmaRingType d'`, adding a display parameter `d'`; - in `ereal.v`: + lemmas `ge0_mule_fsumr`, `ge0_mule_fsuml` diff --git a/_CoqProject b/_CoqProject index f0b745c7f6..98873fe72a 100644 --- a/_CoqProject +++ b/_CoqProject @@ -99,6 +99,7 @@ theories/derive.v theories/numfun.v theories/measure_theory/measurable_structure.v +theories/measure_theory/measurable_topology.v theories/measure_theory/measure_function.v theories/measure_theory/counting_measure.v theories/measure_theory/dirac_measure.v diff --git a/theories/lebesgue_integral_theory/simple_functions.v b/theories/lebesgue_integral_theory/simple_functions.v index 0029be1576..51487b50b6 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 measurable_topology. (**md**************************************************************************) (* # Simple functions *) @@ -72,12 +73,14 @@ Local Open Scope ring_scope. Module HBSimple. -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. @@ -85,15 +88,16 @@ Import HBSimple. 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} {rT : sigmaRingType d'}. Definition sfun : {pred _ -> _} := [predI @mfun _ _ aT rT & fimfun]. Definition sfun_key : pred_key sfun. Proof. exact. Qed. Canonical sfun_keyed := KeyedPred sfun_key. @@ -102,13 +106,13 @@ 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). 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)). @@ -150,9 +154,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. @@ -165,13 +169,13 @@ Definition fctWE := (fctD, fctN, fctM, fctZ). Section ring. Context d (aT : measurableType d) (rT : realType). -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 <:]. @@ -213,6 +217,50 @@ Definition scale_sfun k f : {sfun aT >-> rT} := k \o* f. End ring. Arguments indic_sfun {d aT rT} _. +Section sfun_lmodType. +Context d (aT : measurableType d) (R : realType). +Import HBSimple. + +Lemma mem_sfun_comp_pair (U V W : normedModType R) (f : {sfun aT >-> U}) + (g : {sfun aT >-> V}) (h : U * V -> W) : + (fun x => h (f x, g x)) \in @sfun _ _ aT 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. + by apply: measurableI; exact/(measurable_funPTI _ (measurable1 _)). + 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 V). +Proof. +split=> [|k f g sf sg]; first exact: (valP (cst_sfun (0 : 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 V) + (sfun_submod_closed V). +HB.instance Definition _ (V : normedModType R) := + [SubChoice_isSubLmodule of {sfun aT >-> V} by <:]. + +End sfun_lmodType. + Lemma preimage_nnfun0 T (R : realDomainType) (f : {nnfun T >-> R}) t : t < 0 -> f @^-1` [set t] = set0. Proof. diff --git a/theories/measure_theory/measurable_function.v b/theories/measure_theory/measurable_function.v index 061d3b958c..9080b4c129 100644 --- a/theories/measure_theory/measurable_function.v +++ b/theories/measure_theory/measurable_function.v @@ -5,7 +5,7 @@ From mathcomp Require Import all_ssreflect_compat algebra. From mathcomp Require Import unstable. From mathcomp Require Import boolp classical_sets functions cardinality reals. From mathcomp Require Import ereal topology normedtype. -From mathcomp Require Import sequences measurable_structure. +From mathcomp Require Import sequences measurable_structure measurable_topology. (**md**************************************************************************) (* # Measurable Functions *) @@ -68,6 +68,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]. diff --git a/theories/measure_theory/measurable_topology.v b/theories/measure_theory/measurable_topology.v new file mode 100644 index 0000000000..0671cdca15 --- /dev/null +++ b/theories/measure_theory/measurable_topology.v @@ -0,0 +1,52 @@ +(* mathcomp analysis (c) 2026 Inria and AIST. License: CeCILL-C. *) +From HB Require Import structures. +From mathcomp Require Import all_ssreflect_compat algebra finmap. +#[warning="-warn-library-file-internal-analysis"] +From mathcomp Require Import unstable. +From mathcomp Require Import boolp classical_sets functions cardinality reals topology. +From mathcomp Require Import measurable_structure normedtype. + +Unset SsrOldRewriteGoalsOrder. (* remove the line when requiring MathComp >= 2.6 *) +Set Implicit Arguments. +Unset Strict Implicit. +Unset Printing Implicit Defensive. + +Import Order.TTheory GRing.Theory Num.Def Num.Theory. +Import numFieldTopology.Exports. + +Local Open Scope classical_set_scope. + +Definition borelType (T : topologicalType) := g_sigma_algebraType (@open T). + +Section borel_normedModType. +Local Open Scope ring_scope. +Context {R : realType} {V : normedModType R}. + +Lemma singleton_bigcap (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. + +Lemma measurable1 (x : borelType V) : measurable [set x]. +Proof. +rewrite singleton_bigcap; apply: bigcap_measurable => // k _. +by apply: sub_sigma_algebra; exact: ball_open. +Qed. +#[local] Hint Resolve measurable1 : core. + +End borel_normedModType. + +#[global] +Hint Extern 0 (measurable [set _]) => solve [apply: measurable1] : core. + +#[non_forgetful_inheritance] +HB.instance Definition _ (R : realType) (V : normedModType R) := + Measurable.copy V (borelType V). + +