/- Copyright (c) 2026 Marcel Morgenstern. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marcel Morgenstern -/ module public import ErgodicTheory.Multifractal.Bernoulli.Entropy public import ErgodicTheory.Multifractal.Bernoulli.Ergodic /-! # Hausdorff dimension of Bernoulli measures on the full shift The theorem `dimH_eq_ksEntropy_div_log_two` (`ErgodicTheory/Multifractal/SymbolicDimension.lean`) states, for an ergodic shift-invariant probability measure `μ` on the one-sided full shift `Shift α₀` with positive coordinate-partition Kolmogorov–Sinai entropy, that some full-measure set has Hausdorff dimension `h_μ(σ) / log 2`. For a Bernoulli measure both hypotheses hold: * ergodicity is `ergodic_shiftMap_bern` (Kolmogorov's 0–1 law, `Multifractal/Bernoulli/Ergodic.lean`); * the system entropy is the single-symbol Shannon entropy `Hnu ν` (`ksEntropy_bern_eq` / `ksEntropyPartition_coordPartition_bern_eq`, `Multifractal/Bernoulli/Entropy.lean`), which is strictly positive once `ν` charges two distinct symbols (`Hnu_pos`). Hence, for any Bernoulli measure `bern ν` whose single-symbol law `ν` charges two distinct symbols, there is a `bern ν`-conull set whose Hausdorff dimension is `Hnu ν / log 2`. ## Main results * `ErgodicTheory.Multifractal.dimH_bern_eq_Hnu_div_log_two`: for a biased Bernoulli measure `bern ν` (two distinct symbols of positive mass), a `bern ν`-conull set has Hausdorff dimension `Hnu ν / log 2`. * `ErgodicTheory.Multifractal.measureDimH_bern_eq_Hnu_div_log_two`: the Hausdorff dimension of the measure `bern ν` (least `dimH` of a conull set) and its lower Hausdorff dimension (least `dimH` of a set of positive measure) both equal `Hnu ν / log 2`, for every probability measure `ν` (the point-mass case, of entropy and dimension `0`, included). -/ @[expose] public section open MeasureTheory Filter Topology Function Set open scoped ENNReal NNReal namespace ErgodicTheory.Multifractal open ErgodicTheory.Entropy variable {α₀ : Type*} [Fintype α₀] [Nonempty α₀] [TopologicalSpace α₀] [DiscreteTopology α₀] [MeasurableSpace α₀] [MeasurableSingletonClass α₀] -- The `PiNat` ultrametric on the shift (needed to speak of `dimH`) is a *local* instance, as in -- `SymbolicDimension.lean`. attribute [local instance] PiNat.metricSpace omit [Nonempty α₀] in /-- **Entropy and Hausdorff dimension of a Bernoulli measure.** For a biased Bernoulli measure `bern ν` on the one-sided full shift — the i.i.d. product of a single-symbol law `ν` that charges two *distinct* symbols `i ≠ j` with positive mass — there is a `bern ν`-conull set `s` whose Hausdorff dimension equals `Hnu ν / log 2`, with `Hnu ν = ∑ a, negMulLog (ν {a}).toReal` the single-symbol Shannon entropy (which is the system's Kolmogorov–Sinai entropy). This is `dimH_eq_ksEntropy_div_log_two` applied to the Bernoulli measure: ergodicity of the shift is `ergodic_shiftMap_bern` (Kolmogorov's 0–1 law) and positivity of the entropy is `Hnu_pos` (the two charged symbols force `0 < Hnu ν`). The system entropy `ksEntropy` is identified with `Hnu ν` by `ksEntropy_bern_eq`. The base `log 2` is fixed by the `PiNat` ultrametric. -/ theorem dimH_bern_eq_Hnu_div_log_two (ν : Measure α₀) [IsProbabilityMeasure ν] {i j : α₀} (hij : i ≠ j) (hi : 0 < (ν {i}).toReal) (hj : 0 < (ν {j}).toReal) : ∃ s : Set (Shift α₀), bern ν sᶜ = 0 ∧ dimH s = ENNReal.ofReal (Hnu ν / Real.log 2) := by -- Ergodicity (Kolmogorov 0–1). have hσ := ergodic_shiftMap_bern ν -- Positive entropy: `ksEntropyPartition (coordPartition) = Hnu ν > 0`. have hpos : 0 < ksEntropyPartition hσ.toMeasurePreserving (coordPartition (bern ν)) := by have hE : ksEntropyPartition hσ.toMeasurePreserving (coordPartition (bern ν)) = Hnu ν := ksEntropyPartition_coordPartition_bern_eq ν rw [hE] exact Hnu_pos ν hij hi hj -- Apply the abstract identity. obtain ⟨s, hconull, hdim⟩ := dimH_eq_ksEntropy_div_log_two hσ hpos refine ⟨s, hconull, ?_⟩ -- The system entropy `ksEntropy` is the single-symbol Shannon entropy `Hnu ν`. have hkse : (ErgodicTheory.Entropy.ksEntropy hσ.toMeasurePreserving).toReal = Hnu ν := ksEntropy_bern_eq ν rw [hdim, hkse] omit [Nonempty α₀] in /-- **The Hausdorff dimension of a Bernoulli measure.** For a biased Bernoulli measure `bern ν` on the one-sided full shift (two distinct symbols of positive mass), the Hausdorff dimension of the measure — the least Hausdorff dimension of a `bern ν`-conull set — equals `Hnu ν / log 2`, and so does its lower Hausdorff dimension (the least Hausdorff dimension of a set of positive `bern ν`-measure): `dim_H (bern ν) = dim_* (bern ν) = H(ν) / log 2`. In particular every set of positive `bern ν`-measure has Hausdorff dimension at least `H(ν) / log 2`. -/ theorem measureDimH_bern_eq_Hnu_div_log_two_of_ne (ν : Measure α₀) [IsProbabilityMeasure ν] {i j : α₀} (hij : i ≠ j) (hi : 0 < (ν {i}).toReal) (hj : 0 < (ν {j}).toReal) : measureDimH (bern ν) = ENNReal.ofReal (Hnu ν / Real.log 2) ∧ measureLowerDimH (bern ν) = ENNReal.ofReal (Hnu ν / Real.log 2) := by have hσ := ergodic_shiftMap_bern ν have hpos : 0 < ksEntropyPartition hσ.toMeasurePreserving (coordPartition (bern ν)) := by rw [ksEntropyPartition_coordPartition_bern_eq ν] exact Hnu_pos ν hij hi hj have hkse : (ErgodicTheory.Entropy.ksEntropy hσ.toMeasurePreserving).toReal = Hnu ν := ksEntropy_bern_eq ν rw [← hkse] exact measureDimH_eq_ksEntropy_div_log_two hσ hpos omit [Fintype α₀] [Nonempty α₀] [TopologicalSpace α₀] [DiscreteTopology α₀] [MeasurableSingletonClass α₀] in /-- The Bernoulli measure of a point mass `δ_a` is the point mass at the constant sequence `a`. -/ theorem bern_dirac (a : α₀) : bern (Measure.dirac a) = Measure.dirac (fun _ : ℕ => a) := Measure.infinitePi_dirac (fun _ : ℕ => a) omit [Nonempty α₀] [TopologicalSpace α₀] [DiscreteTopology α₀] in /-- A point mass has zero single-symbol entropy. -/ theorem Hnu_dirac (a : α₀) : Hnu (Measure.dirac a) = 0 := by unfold Hnu refine Finset.sum_eq_zero fun b _ => ?_ by_cases h : b = a · subst h; simp · simp [Measure.dirac_apply' _ (measurableSet_singleton b), Ne.symm h] omit [Fintype α₀] [Nonempty α₀] in /-- A point mass on the shift has Hausdorff dimension `0`: the singleton carrying it is conull. -/ theorem measureDimH_dirac (c : Shift α₀) : measureDimH (Measure.dirac c) = 0 := by refine le_antisymm ((iInf₂_le {c} ?_).trans (dimH_singleton c).le) bot_le simp [Measure.dirac_apply' _ (measurableSet_singleton c).compl] omit [Fintype α₀] [Nonempty α₀] [MeasurableSingletonClass α₀] in /-- A point mass on the shift has lower Hausdorff dimension `0`: the singleton carrying it has positive mass. -/ theorem measureLowerDimH_dirac (c : Shift α₀) : measureLowerDimH (Measure.dirac c) = 0 := by refine le_antisymm ((iInf₂_le {c} ?_).trans (dimH_singleton c).le) bot_le simp [Measure.dirac_apply_of_mem (Set.mem_singleton c)] omit [Fintype α₀] [Nonempty α₀] [TopologicalSpace α₀] [DiscreteTopology α₀] in /-- A probability measure on a finite alphabet either charges two distinct symbols or is a point mass. -/ theorem exists_ne_pos_or_eq_dirac [Finite α₀] (ν : Measure α₀) [IsProbabilityMeasure ν] : (∃ i j : α₀, i ≠ j ∧ 0 < (ν {i}).toReal ∧ 0 < (ν {j}).toReal) ∨ ∃ a : α₀, ν = Measure.dirac a := by have := Fintype.ofFinite α₀ by_cases h : ∃ i j : α₀, i ≠ j ∧ 0 < (ν {i}).toReal ∧ 0 < (ν {j}).toReal · exact Or.inl h refine Or.inr ?_ push Not at h have hpos : ∀ b, ν {b} ≠ 0 → 0 < (ν {b}).toReal := fun b hb => ENNReal.toReal_pos hb (measure_ne_top _ _) obtain ⟨a, ha⟩ : ∃ a : α₀, ν {a} ≠ 0 := by by_contra! h0 have huniv : ∑ b : α₀, ν {b} = ν Set.univ := by simp simp [h0] at huniv have hzero : ∀ b, b ≠ a → ν {b} = 0 := fun b hb => by by_contra hb0 exact (h b a hb (hpos b hb0)).not_gt (hpos a ha) have hone : ν {a} = 1 := by have huniv : ∑ b : α₀, ν {b} = ν Set.univ := by simp rwa [Finset.sum_eq_single a (fun b _ hb => hzero b hb) (by simp), measure_univ] at huniv refine ⟨a, Measure.ext_of_singleton fun b => ?_⟩ by_cases hb : b = a · subst hb; simp [hone] · rw [hzero b hb, Measure.dirac_apply' _ (measurableSet_singleton b)] simp [Ne.symm hb] omit [Nonempty α₀] in /-- **The Hausdorff dimension of a Bernoulli measure.** For every Bernoulli measure `bern ν` on the one-sided full shift, the Hausdorff dimension and the lower Hausdorff dimension of the measure both equal `Hnu ν / log 2`. If `ν` charges two distinct symbols this is `measureDimH_bern_eq_Hnu_div_log_two_of_ne`; otherwise `ν` is a point mass, `Hnu ν = 0`, and `bern ν` is a point mass, of dimension `0`. -/ theorem measureDimH_bern_eq_Hnu_div_log_two (ν : Measure α₀) [IsProbabilityMeasure ν] : measureDimH (bern ν) = ENNReal.ofReal (Hnu ν / Real.log 2) ∧ measureLowerDimH (bern ν) = ENNReal.ofReal (Hnu ν / Real.log 2) := by rcases exists_ne_pos_or_eq_dirac ν with ⟨i, j, hij, hi, hj⟩ | ⟨a, rfl⟩ · exact measureDimH_bern_eq_Hnu_div_log_two_of_ne ν hij hi hj · rw [bern_dirac, Hnu_dirac, zero_div, ENNReal.ofReal_zero] exact ⟨measureDimH_dirac _, measureLowerDimH_dirac _⟩ end ErgodicTheory.Multifractal