11/-
22Copyright (c) 2022 Yury Kudryashov. All rights reserved.
33Released under Apache 2.0 license as described in the file LICENSE.
4- Authors: Yury Kudryashov
4+ Authors: Yury Kudryashov, Louis (Yiyang) Liu
55-/
66module
77
@@ -18,6 +18,8 @@ formulas for this average:
1818* `interval_average_eq`: `⨍ x in a..b, f x = (b - a)⁻¹ • ∫ x in a..b, f x`;
1919* `interval_average_eq_div`: `⨍ x in a..b, f x = (∫ x in a..b, f x) / (b - a)`;
2020* `exists_eq_interval_average`: `∃ c, f c = ⨍ (x : ℝ) in a..b, f x`.
21+ * `exists_eq_interval_average_of_measure`: `∃ c, f c = ⨍ x in (uIoc a b), f x ∂μ`.
22+ * `exists_eq_interval_average_of_NoAtoms`: `∃ c, f c = ⨍ x in (uIoc a b), f x ∂μ`.
2123
2224 We also prove that `⨍ x in a..b, f x = ⨍ x in b..a, f x`, see `interval_average_symm`.
2325
@@ -109,3 +111,136 @@ theorem exists_eq_interval_average
109111 have h_ave : ave ∈ Icc (f c1) (f c2) := ⟨hc1_le,hc2_ge⟩
110112 have h_image := intermediate_value_uIcc (hf.mono h_interval') (Icc_subset_uIcc h_ave)
111113 exact ((mem_image f (uIcc c1 c2) ave).mp (h_image)).imp (fun c hc => ⟨h_interval hc.1 , hc.2 ⟩)
114+
115+ /-- If `f : ℝ → ℝ` is continuous on `uIcc a b`, the interval has finite and nonzero `μ`-measure,
116+ then there exists `c ∈ uIcc a b` such that
117+ `f c = ⨍ x in (uIoc a b), f x ∂μ`. -/
118+ theorem exists_eq_interval_average_of_measure
119+ {f : ℝ → ℝ} {a b : ℝ} {μ : Measure ℝ}
120+ (hf : ContinuousOn f (uIcc a b))
121+ (hμfin : μ (uIoc a b) ≠ ⊤)
122+ (hμ0 : μ (uIoc a b) ≠ 0 ) :
123+ ∃ c ∈ uIcc a b, f c = ⨍ x in (uIoc a b), f x ∂μ := by
124+ wlog h : a ≤ b generalizing a b
125+ · simp at h
126+ specialize this
127+ (a := b) (b := a) (by rwa [uIcc_comm])
128+ (by rwa [uIoc_comm]) (by rwa [uIoc_comm])
129+ (h.le)
130+ rcases this with ⟨c, hc, hEq⟩
131+ refine ⟨c, by rwa [uIcc_comm], by rwa [uIoc_comm]⟩
132+ let ave := average (μ.restrict (uIoc a b)) f
133+ let S₁ := {x | x ∈ uIoc a b ∧ f x ≤ ave}
134+ let S₂ := {x | x ∈ uIoc a b ∧ ave ≤ f x}
135+ have hint : IntegrableOn f (uIoc a b) μ := by
136+ have hsubset : uIoc a b ⊆ uIcc a b := uIoc_subset_uIcc
137+ have hcomp : IsCompact (uIcc a b) := isCompact_uIcc
138+ obtain ⟨c, hc, hmax⟩ := hcomp.exists_isMaxOn nonempty_uIcc (hf.norm)
139+ apply IntegrableOn.of_bound ?_ ?_ (|f c|) ?_
140+ · rwa [lt_top_iff_ne_top]
141+ · apply ContinuousOn.aestronglyMeasurable
142+ · exact ContinuousOn.mono hf hsubset
143+ · exact measurableSet_uIoc
144+ · rw [ae_restrict_iff' measurableSet_uIoc]
145+ apply ae_of_all
146+ intro m hm
147+ apply hmax
148+ exact hsubset hm
149+ have hS₁ : 0 < μ S₁ := measure_le_setAverage_pos hμ0 hμfin hint
150+ have hS₂ : 0 < μ S₂ := measure_setAverage_le_pos hμ0 hμfin hint
151+ have hS₁nonempty : S₁.Nonempty := nonempty_of_measure_ne_zero hS₁.ne'
152+ have hS₂nonempty : S₂.Nonempty := nonempty_of_measure_ne_zero hS₂.ne'
153+ rw [nonempty_def] at *
154+ rcases hS₁nonempty with ⟨c₁, hc₁⟩
155+ rcases hS₂nonempty with ⟨c₂, hc₂⟩
156+ have hc₁Ioc : c₁ ∈ Ioc a b := by
157+ simpa [h] using hc₁.1
158+ have hc₂Ioc : c₂ ∈ Ioc a b := by
159+ simpa [h] using hc₂.1
160+ have h_subset : uIcc c₁ c₂ ⊆ Icc a b := by
161+ intro x hx
162+ rw [mem_uIcc] at hx
163+ grind
164+ have h_ivt : ∃ c ∈ uIcc c₁ c₂, f c = ave := by
165+ apply intermediate_value_uIcc
166+ · refine ContinuousOn.mono hf ?_
167+ rwa [uIcc_of_le h]
168+ · rw [mem_uIcc]
169+ grind
170+ rcases h_ivt with ⟨c, hc_mem, hfc⟩
171+ refine ⟨c, ?_, hfc⟩
172+ rw [mem_uIcc]
173+ grind
174+
175+ /-- If `f : ℝ → ℝ` is continuous on `uIcc a b`, the interval has finite and nonzero `μ`-measure,
176+ and `μ` has no atoms, then there exists `c ∈ uIoo a b` such that
177+ `f c = ⨍ x in (uIoc a b), f x ∂μ`. -/
178+ theorem exists_eq_interval_average_of_NoAtoms
179+ {f : ℝ → ℝ} {a b : ℝ}
180+ {μ : Measure ℝ} [NoAtoms μ]
181+ (hf : ContinuousOn f (uIcc a b))
182+ (hμfin : μ (uIoc a b) ≠ ⊤)
183+ (hμ0 : μ (uIoc a b) ≠ 0 ) :
184+ ∃ c ∈ uIoo a b, f c = ⨍ x in (uIoc a b), f x ∂μ := by
185+ wlog h : a ≤ b generalizing a b
186+ · simp at h
187+ specialize this
188+ (a := b) (b := a) (by rwa [uIcc_comm])
189+ (by rwa [uIoc_comm]) (by rwa [uIoc_comm]) (h.le)
190+ rcases this with ⟨c, hc, hEq⟩
191+ refine ⟨c, ?_, ?_⟩
192+ · simpa [uIoo_comm] using hc
193+ · have hswap : Ι a b = Ι b a := uIoc_comm a b
194+ rwa [hswap]
195+ let ave := average (μ.restrict (uIoc a b)) f
196+ let S₁ := {x | x ∈ uIoc a b ∧ f x ≤ ave}
197+ let S₂ := {x | x ∈ uIoc a b ∧ ave ≤ f x}
198+ have hint : IntegrableOn f (uIoc a b) μ := by
199+ have hsubset : uIoc a b ⊆ uIcc a b := uIoc_subset_uIcc
200+ have hcomp : IsCompact (uIcc a b) := isCompact_uIcc
201+ obtain ⟨c, hc, hmax⟩ := hcomp.exists_isMaxOn nonempty_uIcc hf.norm
202+ apply IntegrableOn.of_bound ?_ ?_ (|f c|) ?_
203+ · rwa [lt_top_iff_ne_top]
204+ · apply ContinuousOn.aestronglyMeasurable
205+ · exact ContinuousOn.mono hf hsubset
206+ · exact measurableSet_uIoc
207+ · rw [ae_restrict_iff' measurableSet_uIoc]
208+ apply ae_of_all
209+ intro m hm
210+ apply hmax
211+ exact hsubset hm
212+ have hS₁ : 0 < μ S₁ := measure_le_setAverage_pos hμ0 hμfin hint
213+ have hS₂ : 0 < μ S₂ := measure_setAverage_le_pos hμ0 hμfin hint
214+ have hb0 : μ {b} = 0 := measure_singleton b
215+ have hS₁pos' : 0 < μ (S₁ \ {b}) := by
216+ have hcap0 : μ (S₁ ∩ {b}) = 0 := measure_inter_null_of_null_right S₁ hb0
217+ have : μ (S₁ \ {b}) = μ S₁ := AEDisjoint.measure_diff_left hcap0
218+ grind
219+ have hS₂pos' : 0 < μ (S₂ \ {b}) := by
220+ have hcap0 : μ (S₂ ∩ {b}) = 0 := measure_inter_null_of_null_right S₂ hb0
221+ have : μ (S₂ \ {b}) = μ S₂ := AEDisjoint.measure_diff_left hcap0
222+ grind
223+ have hS₁nonempty : (S₁ \ {b}).Nonempty := nonempty_of_measure_ne_zero hS₁pos'.ne'
224+ have hS₂nonempty : (S₂ \ {b}).Nonempty := nonempty_of_measure_ne_zero hS₂pos'.ne'
225+ rcases hS₁nonempty with ⟨c₁, hc₁⟩
226+ rcases hS₂nonempty with ⟨c₂, hc₂⟩
227+ have hc₁Ioc : c₁ ∈ Ioc a b := by
228+ simpa [h] using (hc₁.1 : c₁ ∈ S₁).1
229+ have hc₂Ioc : c₂ ∈ Ioc a b := by
230+ simpa [h] using (hc₂.1 : c₂ ∈ S₂).1
231+ have h_subset : uIcc c₁ c₂ ⊆ Icc a b := by
232+ intro x hx
233+ rw [mem_uIcc] at hx
234+ grind
235+ have h_ivt : ∃ c ∈ uIcc c₁ c₂, f c = ave := by
236+ apply intermediate_value_uIcc
237+ · refine ContinuousOn.mono hf ?_
238+ rwa [uIcc_of_le h]
239+ · rw [mem_uIcc]
240+ grind
241+ rcases h_ivt with ⟨c, hc_mem, hfc⟩
242+ refine ⟨c, ?_, hfc⟩
243+ rw [mem_uIcc] at hc_mem
244+ apply mem_uIoo_of_lt
245+ · grind
246+ · grind
0 commit comments