|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Louis (Yiyang) Liu. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Louis (Yiyang) Liu |
| 5 | +-/ |
| 6 | +module |
| 7 | + |
| 8 | +public import Mathlib.MeasureTheory.Integral.Average.MeanValue |
| 9 | + |
| 10 | +/-! |
| 11 | +# First mean value theorem for set integrals |
| 12 | +
|
| 13 | +We prove versions of the first mean value theorem for set integrals. |
| 14 | +
|
| 15 | +## Main results |
| 16 | +
|
| 17 | +* `exists_eq_const_mul_setIntegral_of_ae_nonneg`: |
| 18 | + `∃ c ∈ s, (∫ x in s, f x * g x ∂μ) = f c * (∫ x in s, g x ∂μ)`. |
| 19 | +* `exists_eq_const_mul_setIntegral_of_nonneg`: |
| 20 | + `∃ c ∈ s, (∫ x in s, f x * g x ∂μ) = f c * (∫ x in s, g x ∂μ)`. |
| 21 | +
|
| 22 | +## Tags |
| 23 | +
|
| 24 | +first mean value theorem, set integral |
| 25 | +-/ |
| 26 | + |
| 27 | +@[expose] public section |
| 28 | + |
| 29 | +open MeasureTheory |
| 30 | + |
| 31 | +variable {α : Type*} [TopologicalSpace α] [MeasurableSpace α] |
| 32 | + {s : Set α} {f g : α → ℝ} {μ : Measure α} |
| 33 | + |
| 34 | +/-- **First mean value theorem for set integrals (a.e. nonnegativity).** |
| 35 | +Let `s` be a connected measurable set. If `f` is continuous on `s`, `g` is integrable on `s`, |
| 36 | +`f * g` is integrable on `s`, and `g` is nonnegative a.e. on `s` w.r.t. `μ.restrict s`, then |
| 37 | +`∃ c ∈ s, (∫ x in s, f x * g x ∂μ) = f c * (∫ x in s, g x ∂μ)`. -/ |
| 38 | +theorem exists_eq_const_mul_setIntegral_of_ae_nonneg |
| 39 | + (hs_conn : IsConnected s) |
| 40 | + (hs_meas : MeasurableSet s) |
| 41 | + (hf : ContinuousOn f s) |
| 42 | + (hg : IntegrableOn g s μ) |
| 43 | + (hfg : IntegrableOn (fun x ↦ f x * g x) s μ) |
| 44 | + (hg0 : ∀ᵐ x ∂(μ.restrict s), 0 ≤ g x) : |
| 45 | + ∃ c ∈ s, (∫ x in s, f x * g x ∂μ) = f c * (∫ x in s, g x ∂μ) := by |
| 46 | + let ρ := fun x ↦ ENNReal.ofReal (g x) |
| 47 | + let ν := μ.withDensity ρ |
| 48 | + have hρ_ae : AEMeasurable ρ (μ.restrict s) := by |
| 49 | + apply AEMeasurable.ennreal_ofReal |
| 50 | + exact hg.aestronglyMeasurable.aemeasurable |
| 51 | + have hρ_top : ∀ᵐ x ∂ μ.restrict s, ρ x < ⊤ := by simp [ρ] |
| 52 | + have h_toReal_ae : (fun x ↦ (ρ x).toReal) =ᵐ[μ.restrict s] g := by |
| 53 | + apply hg0.mono |
| 54 | + intro x hx |
| 55 | + simpa [ρ] |
| 56 | + have heq : ∫ x in s, f x * g x ∂μ = ∫ x in s, f x ∂ν := by |
| 57 | + calc |
| 58 | + _ = ∫ x in s, (ρ x).toReal * f x ∂μ := by |
| 59 | + apply MeasureTheory.integral_congr_ae |
| 60 | + apply h_toReal_ae.mono |
| 61 | + intro x hx |
| 62 | + simp [hx, mul_comm] |
| 63 | + _ = _ := by |
| 64 | + have h := setIntegral_withDensity_eq_setIntegral_toReal_smul₀ hρ_ae hρ_top f hs_meas |
| 65 | + simp [ν, h] |
| 66 | + have hg1 : ∫ x in s, g x ∂μ = ∫ x in s, (1 : ℝ) ∂ν := by |
| 67 | + have h := setIntegral_withDensity_eq_setIntegral_toReal_smul₀ |
| 68 | + hρ_ae hρ_top (fun _ ↦ (1 : ℝ)) hs_meas |
| 69 | + calc |
| 70 | + _ = ∫ x in s, (ρ x).toReal ∂μ := by rw [integral_congr_ae h_toReal_ae] |
| 71 | + _ = _ := by simp [ν, h] |
| 72 | + by_cases hν0 : ∫ x in s, (1 : ℝ) ∂ν = 0 |
| 73 | + · rcases hs_conn.nonempty with ⟨c, hc⟩ |
| 74 | + refine ⟨c, hc, ?_⟩ |
| 75 | + calc |
| 76 | + _ = ∫ x in s, f x ∂ν := heq |
| 77 | + _ = 0 := by |
| 78 | + rw [hν0, setIntegral_eq_zero_iff_of_nonneg_ae hg0 hg] at hg1 |
| 79 | + have heq_zero : ∫ x in s, f x * g x ∂μ = 0 := by |
| 80 | + have heq_ae : (fun x ↦ f x * g x) =ᵐ[μ.restrict s] 0 := by |
| 81 | + apply hg1.mono |
| 82 | + intro x hx |
| 83 | + simp [hx] |
| 84 | + simpa using integral_congr_ae heq_ae |
| 85 | + rw [← heq, heq_zero] |
| 86 | + _ = _ := by simp [hν0, hg1] |
| 87 | + · have hν0' : (ν s).toReal ≠ 0 := by simpa using hν0 |
| 88 | + have hνfin : ν s ≠ ⊤ := by intro this; apply hν0'; simp [this] |
| 89 | + have hν0'' : ν s ≠ 0 := by intro this; apply hν0'; simp [this] |
| 90 | + have hint : IntegrableOn f s ν := by |
| 91 | + have hmul_ae : (fun x ↦ (ρ x).toReal * f x) =ᵐ[μ.restrict s] (fun x ↦ f x * g x) := by |
| 92 | + apply h_toReal_ae.mono |
| 93 | + intro x hx |
| 94 | + simp [hx, mul_comm] |
| 95 | + have h_IntOn : IntegrableOn (fun x ↦ (ρ x).toReal * f x) s μ := by |
| 96 | + rw [integrableOn_congr_fun_ae hmul_ae] |
| 97 | + exact hfg |
| 98 | + have h_Int : Integrable f ((μ.restrict s).withDensity ρ) := by |
| 99 | + rwa [integrable_withDensity_iff_integrable_smul₀' hρ_ae hρ_top, ←IntegrableOn] |
| 100 | + have hνrs : ν.restrict s = (μ.restrict s).withDensity ρ := by |
| 101 | + ext t ht |
| 102 | + have hts : MeasurableSet (t ∩ s) := ht.inter hs_meas |
| 103 | + simp [ν, withDensity_apply, Measure.restrict_apply, ht, hs_meas] |
| 104 | + simpa [IntegrableOn, hνrs] using h_Int |
| 105 | + obtain ⟨c, hc, h_ave⟩ := exists_eq_setAverage hs_conn hf hint hνfin hν0'' |
| 106 | + refine ⟨c, hc, ?_⟩ |
| 107 | + calc |
| 108 | + _ = ∫ x in s, f x ∂ν := heq |
| 109 | + _ = f c * ∫ x in s, (1 : ℝ) ∂ν := by |
| 110 | + rw [h_ave] |
| 111 | + simp [setAverage_eq] |
| 112 | + rw [measureReal_def] |
| 113 | + field_simp |
| 114 | + _ = _ := by simp [hg1] |
| 115 | + |
| 116 | +/-- **First mean value theorem for set integrals (pointwise nonnegativity).** |
| 117 | +Let `s` be a connected measurable set. If `f` is continuous on `s`, `g` is integrable on `s`, |
| 118 | +`f * g` is integrable on `s`, and `g` is nonnegative on `s`, then |
| 119 | +`∃ c ∈ s, (∫ x in s, f x * g x ∂μ) = f c * (∫ x in s, g x ∂μ)` -/ |
| 120 | +theorem exists_eq_const_mul_setIntegral_of_nonneg |
| 121 | + (hs_conn : IsConnected s) |
| 122 | + (hs_meas : MeasurableSet s) |
| 123 | + (hf : ContinuousOn f s) |
| 124 | + (hg : IntegrableOn g s μ) |
| 125 | + (hfg : IntegrableOn (fun x ↦ f x * g x) s μ) |
| 126 | + (hg0 : ∀ x ∈ s, 0 ≤ g x) : |
| 127 | + ∃ c ∈ s, (∫ x in s, f x * g x ∂μ) = f c * (∫ x in s, g x ∂μ) := by |
| 128 | + have hg0_ae : ∀ᵐ x ∂(μ.restrict s), 0 ≤ g x := by |
| 129 | + rw [ae_restrict_iff' hs_meas] |
| 130 | + exact ae_of_all μ hg0 |
| 131 | + exact exists_eq_const_mul_setIntegral_of_ae_nonneg hs_conn hs_meas hf hg hfg hg0_ae |
0 commit comments