From e8e5e5445d4b0e73fc2d38fc0e4caef2d793827a Mon Sep 17 00:00:00 2001 From: Remy Degenne Date: Mon, 15 Jun 2026 12:13:11 +0200 Subject: [PATCH] review lemma vs theorem --- .../Online/Bandit/RewardByCountMeasure.lean | 2 +- .../Probability/Independence/CondDistrib.lean | 2 +- .../Probability/Independence/IndepInfinitePi.lean | 2 +- .../Probability/Kernel/IonescuTulcea/Traj.lean | 8 ++++---- LeanMachineLearning/SequentialLearning/FiniteActions.lean | 4 ++-- .../SequentialLearning/IonescuTulceaSpace.lean | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/LeanMachineLearning/Online/Bandit/RewardByCountMeasure.lean b/LeanMachineLearning/Online/Bandit/RewardByCountMeasure.lean index 44e91fdc..0b615176 100644 --- a/LeanMachineLearning/Online/Bandit/RewardByCountMeasure.lean +++ b/LeanMachineLearning/Online/Bandit/RewardByCountMeasure.lean @@ -157,7 +157,7 @@ lemma reward_cond_stepsUntil [StandardBorelSpace Ξ©] [Countable 𝓐] /-- The conditional distribution of the reward received at the `m`-th pull of action `a` given the time at which number of pulls is `m` is the constant kernel with value `Ξ½ a`. -/ -theorem condDistrib_rewardByCount_stepsUntil [StandardBorelSpace Ξ©] [Countable 𝓐] +lemma condDistrib_rewardByCount_stepsUntil [StandardBorelSpace Ξ©] [Countable 𝓐] (h : IsAlgEnvSeq A R alg (stationaryEnv Ξ½) P) (a : 𝓐) (m : β„•) (hm : m β‰  0) : condDistrib (rewardByCount A R a m) (fun Ο‰ ↦ stepsUntil A a m Ο‰.1) 𝔓 =ᡐ[(𝔓).map (fun Ο‰ ↦ stepsUntil A a m Ο‰.1)] Kernel.const _ (Ξ½ a) := by diff --git a/LeanMachineLearning/Probability/Independence/CondDistrib.lean b/LeanMachineLearning/Probability/Independence/CondDistrib.lean index 78696b15..25d8470a 100644 --- a/LeanMachineLearning/Probability/Independence/CondDistrib.lean +++ b/LeanMachineLearning/Probability/Independence/CondDistrib.lean @@ -212,7 +212,7 @@ lemma FiniteMeasure.sub_def (ΞΌ Ξ½ : FiniteMeasure Ξ±) : rfl @[simp, norm_cast] -theorem FiniteMeasure.toMeasure_sub (ΞΌ Ξ½ : FiniteMeasure Ξ±) : ↑(ΞΌ - Ξ½) = (↑μ - ↑ν : Measure Ξ±) := +lemma FiniteMeasure.toMeasure_sub (ΞΌ Ξ½ : FiniteMeasure Ξ±) : ↑(ΞΌ - Ξ½) = (↑μ - ↑ν : Measure Ξ±) := rfl instance : CanonicallyOrderedAdd (FiniteMeasure Ξ±) where diff --git a/LeanMachineLearning/Probability/Independence/IndepInfinitePi.lean b/LeanMachineLearning/Probability/Independence/IndepInfinitePi.lean index 78ffa84a..d73ec59e 100644 --- a/LeanMachineLearning/Probability/Independence/IndepInfinitePi.lean +++ b/LeanMachineLearning/Probability/Independence/IndepInfinitePi.lean @@ -19,7 +19,7 @@ namespace MeasurableSpace variable {Ξ΄ : Type*} {X : Ξ΄ β†’ Type*} [m : βˆ€ a, MeasurableSpace (X a)] {Ξ± : Type*} -- Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean -theorem comap_pi {g : Ξ± β†’ βˆ€ a, X a} : pi.comap g = ⨆ a, (m a).comap (fun x ↦ g x a) := by +lemma comap_pi {g : Ξ± β†’ βˆ€ a, X a} : pi.comap g = ⨆ a, (m a).comap (fun x ↦ g x a) := by simp_rw [pi, comap_iSup, comap_comp, comp_def] end MeasurableSpace diff --git a/LeanMachineLearning/Probability/Kernel/IonescuTulcea/Traj.lean b/LeanMachineLearning/Probability/Kernel/IonescuTulcea/Traj.lean index 098fb002..d63260e3 100644 --- a/LeanMachineLearning/Probability/Kernel/IonescuTulcea/Traj.lean +++ b/LeanMachineLearning/Probability/Kernel/IonescuTulcea/Traj.lean @@ -67,7 +67,7 @@ lemma MeasurableEquiv.coe_refl {Ξ± : Type*} {mΞ± : MeasurableSpace Ξ±} : (MeasurableEquiv.refl Ξ± : Ξ± β†’ Ξ±) = id := rfl set_option backward.isDefEq.respectTransparency false in -theorem hasLaw_Iic_of_forall_hasCondDistrib' [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] +lemma hasLaw_Iic_of_forall_hasCondDistrib' [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] {Y : (n : β„•) β†’ Ξ© β†’ X n} (h0 : HasLaw (Y 0) ΞΌβ‚€ P) {N n : β„•} (h_condDistrib : βˆ€ n < N, HasCondDistrib (Y (n + 1)) (fun Ο‰ ↦ fun i : Iic n ↦ Y i Ο‰) (ΞΊ n) P) (hn : n ≀ N) : @@ -121,7 +121,7 @@ theorem hasLaw_Iic_of_forall_hasCondDistrib' [βˆ€ n, StandardBorelSpace (X n)] [ congr simp [MeasurableEquiv.coe_refl] -theorem hasLaw_Iic_of_forall_hasCondDistrib [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] +lemma hasLaw_Iic_of_forall_hasCondDistrib [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] {Y : (n : β„•) β†’ Ξ© β†’ X n} (h0 : HasLaw (Y 0) ΞΌβ‚€ P) (h_condDistrib : βˆ€ n, HasCondDistrib (Y (n + 1)) (fun Ο‰ ↦ fun i : Iic n ↦ Y i Ο‰) (ΞΊ n) P) (n : β„•) : @@ -136,7 +136,7 @@ lemma trajMeasure_map_frestrictLe (n : β„•) : rw [trajMeasure, ← Measure.deterministic_comp_eq_map (by fun_prop), Measure.comp_assoc, Kernel.deterministic_comp_eq_map, traj_map_frestrictLe] -theorem eq_trajMeasure_map_frestrictLe [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] +lemma eq_trajMeasure_map_frestrictLe [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] {Y : (n : β„•) β†’ Ξ© β†’ X n} (h0 : HasLaw (Y 0) ΞΌβ‚€ P) {N : β„•} (h_condDistrib : βˆ€ n < N, HasCondDistrib (Y (n + 1)) (fun Ο‰ ↦ fun i : Iic n ↦ Y i Ο‰) (ΞΊ n) P) : @@ -146,7 +146,7 @@ theorem eq_trajMeasure_map_frestrictLe [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, -- todo: switch to `HasLaw` /-- Uniqueness of `trajMeasure`. -/ -theorem eq_trajMeasure [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] +lemma eq_trajMeasure [βˆ€ n, StandardBorelSpace (X n)] [βˆ€ n, Nonempty (X n)] {Y : (n : β„•) β†’ Ξ© β†’ X n} (hY_meas : βˆ€ n, Measurable (Y n)) (h0 : HasLaw (Y 0) ΞΌβ‚€ P) (h_condDistrib : βˆ€ n, HasCondDistrib (Y (n + 1)) (fun Ο‰ ↦ fun i : Iic n ↦ Y i Ο‰) (ΞΊ n) P) : diff --git a/LeanMachineLearning/SequentialLearning/FiniteActions.lean b/LeanMachineLearning/SequentialLearning/FiniteActions.lean index e6b9fc54..369e862b 100644 --- a/LeanMachineLearning/SequentialLearning/FiniteActions.lean +++ b/LeanMachineLearning/SequentialLearning/FiniteActions.lean @@ -641,7 +641,7 @@ lemma measurableSet_stepsUntil_eq [MeasurableSingletonClass 𝓐] exact measurable_comap_indicator_stepsUntil_eq hA hR' a m n /-- `stepsUntil a m` is a stopping time with respect to the filtration `filtrationAction`. -/ -theorem isStoppingTime_stepsUntil_filtrationAction [MeasurableSingletonClass 𝓐] +lemma isStoppingTime_stepsUntil_filtrationAction [MeasurableSingletonClass 𝓐] (hA : βˆ€ n, Measurable (A n)) (hR' : βˆ€ n, Measurable (R' n)) (a : 𝓐) (m : β„•) : IsStoppingTime (IsAlgEnvSeq.filtrationAction hA hR') (stepsUntil A a m) := by refine isStoppingTime_of_measurableSet_eq fun n ↦ ?_ @@ -980,7 +980,7 @@ section CopiedFromPR open Set -theorem _root_.MeasureTheory.StronglyMeasurable.divβ‚€' {𝓐 Ξ² : Type*} +lemma _root_.MeasureTheory.StronglyMeasurable.divβ‚€' {𝓐 Ξ² : Type*} {m𝓐 : MeasurableSpace 𝓐} [TopologicalSpace Ξ²] [GroupWithZero Ξ²] [ContinuousMul Ξ²] [ContinuousInvβ‚€ Ξ²] [TopologicalSpace.PseudoMetrizableSpace Ξ²] diff --git a/LeanMachineLearning/SequentialLearning/IonescuTulceaSpace.lean b/LeanMachineLearning/SequentialLearning/IonescuTulceaSpace.lean index 9825e1fa..d36d9ef8 100644 --- a/LeanMachineLearning/SequentialLearning/IonescuTulceaSpace.lean +++ b/LeanMachineLearning/SequentialLearning/IonescuTulceaSpace.lean @@ -50,7 +50,7 @@ variable {Ξ© Ξ©' : Type*} {mΞ© : MeasurableSpace Ξ©} {mΞ©' : MeasurableSpace Ξ©' {P : Measure Ξ©} [IsProbabilityMeasure P] {P' : Measure Ξ©'} [IsProbabilityMeasure P'] {A₁ : β„• β†’ Ξ© β†’ 𝓐} {R₁ : β„• β†’ Ξ© β†’ 𝓨} {Aβ‚‚ : β„• β†’ Ξ©' β†’ 𝓐} {Rβ‚‚ : β„• β†’ Ξ©' β†’ 𝓨} {N : β„•} -theorem eq_trajMeasure_of_isAlgEnvSeq (h : IsAlgEnvSeq A₁ R₁ alg env P) : +lemma eq_trajMeasure_of_isAlgEnvSeq (h : IsAlgEnvSeq A₁ R₁ alg env P) : P.map (fun Ο‰ n ↦ (A₁ n Ο‰, R₁ n Ο‰)) = trajMeasure alg env := by rw [trajMeasure] have h := Kernel.eq_trajMeasure (Y := fun n Ο‰ ↦ (A₁ n Ο‰, R₁ n Ο‰)) (P := P) @@ -75,14 +75,14 @@ lemma eq_trajMeasure_map_frestrictLe_of_isAlgEnvSeqUntil /-- The law of the sequence of actions and observations generated by an algorithm-environment pair is unique: it does not depend on the probability space used. -/ -theorem isAlgEnvSeq_unique (h1 : IsAlgEnvSeq A₁ R₁ alg env P) +lemma isAlgEnvSeq_unique (h1 : IsAlgEnvSeq A₁ R₁ alg env P) (h2 : IsAlgEnvSeq Aβ‚‚ Rβ‚‚ alg env P') : P.map (fun Ο‰ n ↦ (A₁ n Ο‰, R₁ n Ο‰)) = P'.map (fun Ο‰ n ↦ (Aβ‚‚ n Ο‰, Rβ‚‚ n Ο‰)) := by rw [eq_trajMeasure_of_isAlgEnvSeq h1, eq_trajMeasure_of_isAlgEnvSeq h2] /-- The law of the sequence of actions and observations generated by an algorithm-environment pair is unique: it does not depend on the probability space used. -/ -lemma IsAlgEnvSeq.identDistrib_trajectory (h1 : IsAlgEnvSeq A₁ R₁ alg env P) +theorem IsAlgEnvSeq.identDistrib_trajectory (h1 : IsAlgEnvSeq A₁ R₁ alg env P) (h2 : IsAlgEnvSeq Aβ‚‚ Rβ‚‚ alg env P') : IdentDistrib (fun Ο‰ n ↦ (A₁ n Ο‰, R₁ n Ο‰)) (fun Ο‰' n ↦ (Aβ‚‚ n Ο‰', Rβ‚‚ n Ο‰')) P P' where aemeasurable_fst := (measurable_pi_iff.2 fun n ↦ (h1.measurable_action n).prodMk @@ -91,7 +91,7 @@ lemma IsAlgEnvSeq.identDistrib_trajectory (h1 : IsAlgEnvSeq A₁ R₁ alg env P) (h2.measurable_feedback n)).aemeasurable map_eq := isAlgEnvSeq_unique h1 h2 -theorem isAlgEnvSeqUntil_unique (h1 : IsAlgEnvSeqUntil A₁ R₁ alg env P N) +lemma isAlgEnvSeqUntil_unique (h1 : IsAlgEnvSeqUntil A₁ R₁ alg env P N) (h2 : IsAlgEnvSeqUntil Aβ‚‚ Rβ‚‚ alg env P' N) : P.map (fun Ο‰ (n : Iic N) ↦ (A₁ n Ο‰, R₁ n Ο‰)) = P'.map (fun Ο‰ (n : Iic N) ↦ (Aβ‚‚ n Ο‰, Rβ‚‚ n Ο‰)) := by