Skip to content

Commit 57a10e3

Browse files
committed
style: consistently put whitespace around pipes in conditional expectation and variance (leanprover-community#33815)
Make mathlib's style consistent by always putting spaces around the pipes. This is more readable when there are long arguments. This inconsistency was exposed by extending the `whitespace` linter to proof bodies in leanprover-community#30658.
1 parent 5f8e867 commit 57a10e3

22 files changed

Lines changed: 247 additions & 239 deletions

File tree

Mathlib/MeasureTheory/Function/ConditionalExpectation/Basic.lean

Lines changed: 58 additions & 57 deletions
Large diffs are not rendered by default.

Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ variable {α E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [Norm
3838
[CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α}
3939

4040
theorem condExp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) :
41-
μ[f|m] =ᵐ[μ.restrict s] 0 := by
41+
μ[f | m] =ᵐ[μ.restrict s] 0 := by
4242
by_cases hm : m ≤ m0
4343
swap; · simp_rw [condExp_of_not_le hm]; rfl
4444
by_cases hμm : SigmaFinite (μ.trim hm)
@@ -62,72 +62,72 @@ theorem condExp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.re
6262

6363
/-- Auxiliary lemma for `condExp_indicator`. -/
6464
theorem condExp_indicator_aux (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict sᶜ] 0) :
65-
μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
65+
μ[s.indicator f | m] =ᵐ[μ] s.indicator (μ[f | m]) := by
6666
by_cases hm : m ≤ m0
6767
swap; · simp_rw [condExp_of_not_le hm, Set.indicator_zero']; rfl
6868
have hsf_zero : ∀ g : α → E, g =ᵐ[μ.restrict sᶜ] 0 → s.indicator g =ᵐ[μ] g := fun g =>
6969
indicator_ae_eq_of_restrict_compl_ae_eq_zero (hm _ hs)
70-
refine ((hsf_zero (μ[f|m]) (condExp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm
70+
refine ((hsf_zero (μ[f | m]) (condExp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm
7171
exact condExp_congr_ae (hsf_zero f hf).symm
7272

7373
/-- The conditional expectation of the indicator of a function over an `m`-measurable set with
7474
respect to the σ-algebra `m` is a.e. equal to the indicator of the conditional expectation. -/
7575
theorem condExp_indicator (hf_int : Integrable f μ) (hs : MeasurableSet[m] s) :
76-
μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
76+
μ[s.indicator f | m] =ᵐ[μ] s.indicator (μ[f | m]) := by
7777
by_cases hm : m ≤ m0
7878
swap; · simp_rw [condExp_of_not_le hm, Set.indicator_zero']; rfl
7979
by_cases hμm : SigmaFinite (μ.trim hm)
8080
swap; · simp_rw [condExp_of_not_sigmaFinite hm hμm, Set.indicator_zero']; rfl
8181
haveI : SigmaFinite (μ.trim hm) := hμm
8282
-- use `have` to perform what should be the first calc step because of an error I don't
8383
-- understand
84-
have : s.indicator (μ[f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) := by
84+
have : s.indicator (μ[f | m]) =ᵐ[μ] s.indicator (μ[s.indicator f + sᶜ.indicator f | m]) := by
8585
rw [Set.indicator_self_add_compl s f]
8686
refine (this.trans ?_).symm
8787
calc
88-
s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) =ᵐ[μ]
89-
s.indicator (μ[s.indicator f|m] + μ[sᶜ.indicator f|m]) := by
88+
s.indicator (μ[s.indicator f + sᶜ.indicator f | m]) =ᵐ[μ]
89+
s.indicator (μ[s.indicator f | m] + μ[sᶜ.indicator f | m]) := by
9090
filter_upwards [condExp_add (hf_int.indicator (hm _ hs)) (hf_int.indicator (hm _ hs.compl)) m]
9191
with x hx
9292
classical rw [Set.indicator_apply, Set.indicator_apply, hx]
93-
_ = s.indicator (μ[s.indicator f|m]) + s.indicator (μ[sᶜ.indicator f|m]) :=
93+
_ = s.indicator (μ[s.indicator f | m]) + s.indicator (μ[sᶜ.indicator f | m]) :=
9494
(s.indicator_add' _ _)
95-
_ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) +
96-
s.indicator (sᶜ.indicator (μ[sᶜ.indicator f|m])) := by
95+
_ =ᵐ[μ] s.indicator (μ[s.indicator f | m]) +
96+
s.indicator (sᶜ.indicator (μ[sᶜ.indicator f | m])) := by
9797
refine Filter.EventuallyEq.rfl.add ?_
98-
have : sᶜ.indicator (μ[sᶜ.indicator f|m]) =ᵐ[μ] μ[sᶜ.indicator f|m] := by
98+
have : sᶜ.indicator (μ[sᶜ.indicator f | m]) =ᵐ[μ] μ[sᶜ.indicator f | m] := by
9999
refine (condExp_indicator_aux hs.compl ?_).symm.trans ?_
100100
· exact indicator_ae_eq_restrict_compl (hm _ hs.compl)
101101
· rw [Set.indicator_indicator, Set.inter_self]
102102
filter_upwards [this] with x hx
103103
by_cases hxs : x ∈ s
104104
· simp only [hx, hxs, Set.indicator_of_mem]
105105
· simp only [hxs, Set.indicator_of_notMem, not_false_iff]
106-
_ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) := by
106+
_ =ᵐ[μ] s.indicator (μ[s.indicator f | m]) := by
107107
rw [Set.indicator_indicator, Set.inter_compl_self, Set.indicator_empty', add_zero]
108-
_ =ᵐ[μ] μ[s.indicator f|m] := by
108+
_ =ᵐ[μ] μ[s.indicator f | m] := by
109109
refine (condExp_indicator_aux hs ?_).symm.trans ?_
110110
· exact indicator_ae_eq_restrict_compl (hm _ hs)
111111
· rw [Set.indicator_indicator, Set.inter_self]
112112

113113
theorem condExp_restrict_ae_eq_restrict (hm : m ≤ m0) [SigmaFinite (μ.trim hm)]
114114
(hs_m : MeasurableSet[m] s) (hf_int : Integrable f μ) :
115-
(μ.restrict s)[f|m] =ᵐ[μ.restrict s] μ[f|m] := by
115+
(μ.restrict s)[f | m] =ᵐ[μ.restrict s] μ[f | m] := by
116116
have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs_m]; infer_instance
117117
rw [ae_eq_restrict_iff_indicator_ae_eq (hm _ hs_m)]
118118
refine EventuallyEq.trans ?_ (condExp_indicator hf_int hs_m)
119119
refine ae_eq_condExp_of_forall_setIntegral_eq hm (hf_int.indicator (hm _ hs_m)) ?_ ?_ ?_
120120
· intro t ht _
121121
rw [← integrable_indicator_iff (hm _ ht), Set.indicator_indicator, Set.inter_comm, ←
122122
Set.indicator_indicator]
123-
suffices h_int_restrict : Integrable (t.indicator ((μ.restrict s)[f|m])) (μ.restrict s) by
123+
suffices h_int_restrict : Integrable (t.indicator ((μ.restrict s)[f | m])) (μ.restrict s) by
124124
rw [integrable_indicator_iff (hm _ hs_m), IntegrableOn]
125125
exact h_int_restrict
126126
exact integrable_condExp.indicator (hm _ ht)
127127
· intro t ht _
128128
calc
129-
∫ x in t, s.indicator ((μ.restrict s)[f|m]) x ∂μ =
130-
∫ x in t, ((μ.restrict s)[f|m]) x ∂μ.restrict s := by
129+
∫ x in t, s.indicator ((μ.restrict s)[f | m]) x ∂μ =
130+
∫ x in t, ((μ.restrict s)[f | m]) x ∂μ.restrict s := by
131131
rw [integral_indicator (hm _ hs_m), Measure.restrict_restrict (hm _ hs_m),
132132
Measure.restrict_restrict (hm _ ht), Set.inter_comm]
133133
_ = ∫ x in t, f x ∂μ.restrict s := setIntegral_condExp hm hf_int.integrableOn ht
@@ -142,7 +142,7 @@ theorem condExp_ae_eq_restrict_of_measurableSpace_eq_on {m m₂ m0 : MeasurableS
142142
{μ : Measure α} (hm : m ≤ m0) (hm₂ : m₂ ≤ m0) [SigmaFinite (μ.trim hm)]
143143
[SigmaFinite (μ.trim hm₂)] (hs_m : MeasurableSet[m] s)
144144
(hs : ∀ t, MeasurableSet[m] (s ∩ t) ↔ MeasurableSet[m₂] (s ∩ t)) :
145-
μ[f|m] =ᵐ[μ.restrict s] μ[f|m₂] := by
145+
μ[f | m] =ᵐ[μ.restrict s] μ[f | m₂] := by
146146
rw [ae_eq_restrict_iff_indicator_ae_eq (hm _ hs_m)]
147147
have hs_m₂ : MeasurableSet[m₂] s := by rwa [← Set.inter_univ s, ← hs Set.univ, Set.inter_univ]
148148
by_cases hf_int : Integrable f μ
@@ -153,19 +153,19 @@ theorem condExp_ae_eq_restrict_of_measurableSpace_eq_on {m m₂ m0 : MeasurableS
153153
(fun s _ _ => integrable_condExp.integrableOn) ?_ ?_
154154
stronglyMeasurable_condExp.aestronglyMeasurable
155155
swap
156-
· have : StronglyMeasurable[m] (μ[s.indicator f|m]) := stronglyMeasurable_condExp
156+
· have : StronglyMeasurable[m] (μ[s.indicator f | m]) := stronglyMeasurable_condExp
157157
refine this.aestronglyMeasurable.of_measurableSpace_le_on hm hs_m (fun t => (hs t).mp) ?_
158158
exact condExp_ae_eq_restrict_zero hs_m.compl (indicator_ae_eq_restrict_compl (hm _ hs_m))
159159
intro t ht _
160-
have : ∫ x in t, (μ[s.indicator f|m]) x ∂μ = ∫ x in s ∩ t, (μ[s.indicator f|m]) x ∂μ := by
160+
have : ∫ x in t, (μ[s.indicator f | m]) x ∂μ = ∫ x in s ∩ t, (μ[s.indicator f | m]) x ∂μ := by
161161
rw [← integral_add_compl (hm _ hs_m) integrable_condExp.integrableOn]
162-
suffices ∫ x in sᶜ, (μ[s.indicator f|m]) x ∂μ.restrict t = 0 by
162+
suffices ∫ x in sᶜ, (μ[s.indicator f | m]) x ∂μ.restrict t = 0 by
163163
rw [this, add_zero, Measure.restrict_restrict (hm _ hs_m)]
164164
rw [Measure.restrict_restrict (MeasurableSet.compl (hm _ hs_m))]
165-
suffices μ[s.indicator f|m] =ᵐ[μ.restrict sᶜ] 0 by
165+
suffices μ[s.indicator f | m] =ᵐ[μ.restrict sᶜ] 0 by
166166
rw [Set.inter_comm, ← Measure.restrict_restrict (hm₂ _ ht)]
167167
calc
168-
∫ x : α in t, (μ[s.indicator f|m]) x ∂μ.restrict sᶜ =
168+
∫ x : α in t, (μ[s.indicator f | m]) x ∂μ.restrict sᶜ =
169169
∫ x : α in t, 0 ∂μ.restrict sᶜ := by
170170
refine setIntegral_congr_ae (hm₂ _ ht) ?_
171171
filter_upwards [this] with x hx _ using hx

0 commit comments

Comments
 (0)