roseking's picture
Add lean source and binary files (part 17)
ddc84c5 verified
Raw History Blame Contribute Delete
4.7 kB
import Mathlib.MeasureTheory.Integral.Bochner.Set
import Mathlib.MeasureTheory.Integral.Pi
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.Algebra.Order.Chebyshev
import Mathlib.Analysis.SpecialFunctions.Exp
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
namespace OAI
namespace FiniteFactor
open MeasureTheory
open scoped ENNReal
noncomputable section
/-- Normalized restriction density, relative to the probability base measure. -/
def intervalDensity {X : Type*} (U : Set X) (length : ℝ) : X → ℝ :=
U.indicator (fun _ => length⁻¹)
variable {X : Type*} [MeasurableSpace X] {μ : Measure X} [IsProbabilityMeasure μ]
theorem intervalDensity_integrable {U : Set X} (hU : MeasurableSet U) (l : ℝ) :
Integrable (intervalDensity U l) μ := (integrable_const _).indicator hU
omit [MeasurableSpace X] in
theorem intervalDensity_nonneg [MeasurableSpace X] {U : Set X} {l : ℝ} (hl : 0 ≤ l) (x : X) :
0 ≤ intervalDensity U l x := by
classical
by_cases hx : x ∈ U <;> simp [intervalDensity, hx, inv_nonneg.mpr hl]
omit [MeasurableSpace X] in
theorem intervalDensity_le [MeasurableSpace X] {U : Set X} {l : ℝ} (hl : 0 ≤ l) (x : X) :
intervalDensity U l x ≤ l⁻¹ := by
classical
by_cases hx : x ∈ U <;> simp [intervalDensity, hx, inv_nonneg.mpr hl]
omit [IsProbabilityMeasure μ] in
theorem intervalDensity_integral [IsProbabilityMeasure μ] {U : Set X} (hU : MeasurableSet U)
{l : ℝ} (hl : 0 < l) (hm : μ.real U = l) :
∫ x, intervalDensity U l x ∂μ = 1 := by
rw [intervalDensity, integral_indicator hU, setIntegral_const, smul_eq_mul, hm]
exact mul_inv_cancel₀ hl.ne'
theorem intervalDensity_sq_integrable {U : Set X} (hU : MeasurableSet U) (l : ℝ) :
Integrable (fun x => intervalDensity U l x ^ 2) μ := by
have heq : (fun x => intervalDensity U l x ^ 2) = U.indicator (fun _ => (l⁻¹)^2) := by
funext x
by_cases hx : x ∈ U <;> simp [intervalDensity, hx]
rw [heq]
exact (integrable_const _).indicator hU
omit [IsProbabilityMeasure μ] in
theorem intervalDensity_sq_integral [IsProbabilityMeasure μ] {U : Set X} (hU : MeasurableSet U)
{l : ℝ} (hl : 0 < l) (hm : μ.real U = l) :
∫ x, intervalDensity U l x ^ 2 ∂μ = l⁻¹ := by
have heq : (fun x => intervalDensity U l x ^ 2) = U.indicator (fun _ => (l⁻¹)^2) := by
funext x
by_cases hx : x ∈ U <;> simp [intervalDensity, hx]
rw [heq, integral_indicator hU, setIntegral_const, smul_eq_mul, hm]
field_simp
/-- The mass-one identity cancels the linear term exactly. -/
theorem density_energy_identity {h : X → ℝ} (hh : Integrable h μ)
(hh2 : Integrable (fun x => h x ^ 2) μ) (hm : ∫ x, h x ∂μ = 1) :
(∫ x, (h x - 1)^2 ∂μ) = (∫ x, h x ^ 2 ∂μ) - 1 := by
have heq : (fun x => (h x - 1)^2) = fun x => h x ^ 2 - 2*h x + 1 := by
funext x; ring
have h₁ := integral_add (hh2.sub (hh.const_mul 2)) (integrable_const (1 : ℝ))
have h₂ := integral_sub hh2 (hh.const_mul 2)
dsimp only [Pi.sub_apply, Pi.add_apply] at h₁ h₂
rw [heq, h₁, h₂, integral_const_mul, hm]
simp
ring
/-- Each normalized interval perturbation has energy exactly 1/length - 1. -/
theorem intervalDensity_energy {U : Set X} (hU : MeasurableSet U)
{l : ℝ} (hl : 0 < l) (hm : μ.real U = l) :
(∫ x, (intervalDensity U l x - 1)^2 ∂μ) = l⁻¹ - 1 := by
rw [density_energy_identity (intervalDensity_integrable hU l)
(intervalDensity_sq_integrable hU l) (intervalDensity_integral hU hl hm),
intervalDensity_sq_integral hU hl hm]
/-- Finite independent endpoint selections: the square integral factors exactly. -/
theorem product_density_sq_integral {ι : Type*} [Fintype ι]
{E : ι → Type*} [∀ i, MeasurableSpace (E i)]
(ν : ∀ i, Measure (E i)) [∀ i, SigmaFinite (ν i)]
(h : ∀ i, E i → ℝ) :
(∫ x, (∏ i, h i (x i))^2 ∂Measure.pi ν) =
∏ i, ∫ x, h i x ^ 2 ∂ν i := by
simp_rw [← Finset.prod_pow]
exact integral_fintype_prod_eq_prod (fun i x => h i x ^ 2)
/-- Finite product estimate used in uniform-product-density; the bound has
no dependence on the choice of endpoint orientation. -/
theorem product_energy_le_exp {ι : Type*} [Fintype ι]
(A e : ι → ℝ) (hA0 : ∀ i, 0 ≤ A i) (hA : ∀ i, A i ≤ 1 + e i) :
(∏ i, A i) ≤ Real.exp (∑ i, e i) := by
calc
(∏ i, A i) ≤ ∏ i, Real.exp (e i) := by
apply Finset.prod_le_prod₀ (fun i _ => hA0 i)
intro i _
exact (hA i).trans (by linarith [Real.add_one_le_exp (e i)])
_ = _ := (Real.exp_sum _ _).symm
end
end FiniteFactor
end OAI