/- 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.Examples.ChebyshevPesin public import Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.RootsExtrema public import Mathlib.Analysis.SpecialFunctions.Arcosh public import Mathlib.Analysis.Calculus.ContDiff.Polynomial public import Mathlib.Analysis.Calculus.Deriv.Polynomial public import Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.Basic /-! # Pesin's entropy formula for the Chebyshev maps of every degree For `n ≥ 2` the Chebyshev polynomial `Tₙ` (`Tₙ(cos θ) = cos (nθ)`) is a self-map of `EuclideanSpace ℝ (Fin 1)` preserving the arcsine law `μ = dx / (π √(1 - x²))`: it is the factor of the map `θ ↦ n θ` on the circle through `θ ↦ cos (2πθ)`. We verify the hypotheses of the abstract theorem `ErgodicTheory.pesin_entropy_formula_of_ae_eq` and conclude `h_μ(Tₙ) = λ = log n`. The measure-theoretic input (the arcsine law as the image of Haar measure, its density and the integrability of its logarithm) is shared with the degree-two case `ErgodicTheory.Examples.Chebyshev.ksEntropy_cheb`, and `chebN 2 = cheb`. * **Ergodicity** is inherited from `θ ↦ n θ` (`AddCircle.ergodic_nsmul`). * **Derivative.** `Tₙ' = n Uₙ₋₁`, and `Uₙ₋₁(cos θ) sin θ = sin (nθ)`, so the critical points of `Tₙ` (the `n - 1` zeros of `Uₙ₋₁`) form a `μ`-null set, and `log |Tₙ'(cos 2πr)| = log n + log |sin (2πnr)| - log |sin (2πr)|` for almost every `r`. * **Exponent.** `∫ log |Tₙ'| dμ = log n`, because `∫₀¹ log |sin (2πnr)| dr = ∫₀¹ log |sin (2πr)| dr` by periodicity. * **Injectivity domains.** `Tₙ` is injective on each of the `n` sets `{x | arccos x ∈ [kπ/n, (k+1)π/n]}` (`k < n`): inside `[-1, 1]` this is the monotonicity of `cos (n ·)` on `[kπ, (k+1)π]`; for `|x| > 1` one uses `Tₙ(cosh s) = cosh (ns)`. The file also provides the one-dimensional lifting `liftMap f` of a real function `f` to `EuclideanSpace ℝ (Fin 1)` and the corrected scalar cocycle `scalarCocycle g` (equal to `g` off its zeros and to `1` on them), with their derivative and integrability lemmas. ## Main results * `ErgodicTheory.Examples.Chebyshev.ergodic_chebN`: `Tₙ` is ergodic for the arcsine law. * `ErgodicTheory.Examples.Chebyshev.integral_log_abs_chebPolyDeriv`: `∫ log |Tₙ'| dμ = log n`. * `ErgodicTheory.Examples.Chebyshev.pesin_formula_chebN`: `h_μ(Tₙ) = ∑ λᵢ⁺`, obtained from `pesin_entropy_formula_of_ae_eq`. * `ErgodicTheory.Examples.Chebyshev.ksEntropy_chebN`: `h_μ(Tₙ) = log n`. ## References * S. M. Ulam, J. von Neumann, *On combination of stochastic and deterministic processes*, Bull. Amer. Math. Soc. **53** (1947) 1120. * T. J. Rivlin, *Chebyshev Polynomials*, 2nd ed., Wiley, 1990. -/ @[expose] public section open MeasureTheory Filter Topology Set Real open scoped ENNReal Matrix.Norms.L2Operator namespace ErgodicTheory.Examples.Chebyshev /-! ## Maps of `EuclideanSpace ℝ (Fin 1)` induced by real functions -/ /-- The self-map `v ↦ f (v₀)` of `EuclideanSpace ℝ (Fin 1)` induced by `f : ℝ → ℝ`. -/ noncomputable def liftMap (f : ℝ → ℝ) (v : EuclideanSpace ℝ (Fin 1)) : EuclideanSpace ℝ (Fin 1) := emb (f (v 0)) /-- `liftMap f` in the standard basis. -/ lemma liftMap_eq (f : ℝ → ℝ) : liftMap f = fun w => f (EuclideanSpace.proj (0 : Fin 1) w) • emb 1 := by funext w; rw [liftMap, emb_eq_smul]; rfl /-- `liftMap f` is continuous if `f` is. -/ lemma continuous_liftMap {f : ℝ → ℝ} (hf : Continuous f) : Continuous (liftMap f) := by rw [liftMap_eq] exact (hf.comp (EuclideanSpace.proj (0 : Fin 1) : EuclideanSpace ℝ (Fin 1) →L[ℝ] ℝ).continuous).smul continuous_const /-- `liftMap f` is `C¹` if `f` is. -/ lemma contDiff_liftMap {f : ℝ → ℝ} (hf : ContDiff ℝ 1 f) : ContDiff ℝ 1 (liftMap f) := by rw [liftMap_eq] exact (hf.comp (EuclideanSpace.proj (0 : Fin 1) : EuclideanSpace ℝ (Fin 1) →L[ℝ] ℝ).contDiff).smul contDiff_const /-- The derivative of `liftMap f` at `v` is multiplication by `f'(v₀)`. -/ lemma hasFDerivAt_liftMap {f : ℝ → ℝ} {f' : ℝ} {v : EuclideanSpace ℝ (Fin 1)} (hf : HasDerivAt f f' (v 0)) : HasFDerivAt (liftMap f) ((f' • (EuclideanSpace.proj (0 : Fin 1) : EuclideanSpace ℝ (Fin 1) →L[ℝ] ℝ)).smulRight (emb 1)) v := by rw [liftMap_eq] exact (hf.comp_hasFDerivAt v (EuclideanSpace.proj (0 : Fin 1) : EuclideanSpace ℝ (Fin 1) →L[ℝ] ℝ).hasFDerivAt).smul_const (emb 1) /-- The derivative matrix of `liftMap f` at `v` is `(f'(v₀))`. -/ lemma derivativeCocycle_liftMap {f : ℝ → ℝ} {f' : ℝ} {v : EuclideanSpace ℝ (Fin 1)} (hf : HasDerivAt f f' (v 0)) : derivativeCocycle (liftMap f) v = !![f'] := by rw [derivativeCocycle, (hasFDerivAt_liftMap hf).fderiv, (Matrix.toEuclideanCLM (𝕜 := ℝ) (n := Fin 1)).symm_apply_eq] refine ContinuousLinearMap.ext fun w => ?_ ext i fin_cases i have h := congrFun (Matrix.ofLp_toEuclideanCLM (!![f'] : Matrix (Fin 1) (Fin 1) ℝ) w) 0 change _ = ((Matrix.toEuclideanCLM (𝕜 := ℝ) !![f']) w).ofLp 0 rw [h] simp [Matrix.mulVec, dotProduct] /-! ## Scalar cocycles corrected at the zeros -/ /-- The gain `g t`, replaced by `1` where `g t = 0`. -/ noncomputable def scalarGain (g : ℝ → ℝ) (t : ℝ) : ℝ := if g t = 0 then 1 else g t /-- The corrected gain never vanishes. -/ lemma scalarGain_ne_zero (g : ℝ → ℝ) (t : ℝ) : scalarGain g t ≠ 0 := by unfold scalarGain; split_ifs with h · exact one_ne_zero · exact h /-- Correcting the zeros does not change `log |g|` (since `log 0 = log 1 = 0`). -/ lemma log_abs_scalarGain (g : ℝ → ℝ) (t : ℝ) : Real.log |scalarGain g t| = Real.log |g t| := by unfold scalarGain; split_ifs with h · simp [h] · rfl /-- The corrected gain of a measurable function is measurable. -/ lemma measurable_scalarGain {g : ℝ → ℝ} (hg : Measurable g) : Measurable (scalarGain g) := Measurable.ite (measurableSet_eq_fun hg measurable_const) measurable_const hg /-- The scalar cocycle `v ↦ (scalarGain g (v₀))`. -/ noncomputable def scalarCocycle (g : ℝ → ℝ) (v : EuclideanSpace ℝ (Fin 1)) : Matrix (Fin 1) (Fin 1) ℝ := !![scalarGain g (v 0)] /-- The determinant of the scalar cocycle is the corrected gain. -/ lemma det_scalarCocycle (g : ℝ → ℝ) (v : EuclideanSpace ℝ (Fin 1)) : (scalarCocycle g v).det = scalarGain g (v 0) := by rw [scalarCocycle, Matrix.det_fin_one_of] /-- The scalar cocycle is invertible. -/ lemma scalarCocycle_det_ne_zero (g : ℝ → ℝ) (v : EuclideanSpace ℝ (Fin 1)) : (scalarCocycle g v).det ≠ 0 := by rw [det_scalarCocycle]; exact scalarGain_ne_zero _ _ /-- The scalar cocycle of a measurable function is measurable. -/ lemma measurable_scalarCocycle {g : ℝ → ℝ} (hg : Measurable g) : Measurable (scalarCocycle g) := by refine measurable_pi_iff.2 fun i => measurable_pi_iff.2 fun j => ?_ fin_cases i; fin_cases j exact (measurable_scalarGain hg).comp measurable_coord /-- The inverse of the scalar cocycle is the reciprocal gain. -/ lemma inv_scalarCocycle (g : ℝ → ℝ) (v : EuclideanSpace ℝ (Fin 1)) : (scalarCocycle g v)⁻¹ = !![(scalarGain g (v 0))⁻¹] := by refine Matrix.inv_eq_left_inv ?_ ext i j; fin_cases i; fin_cases j simp [scalarCocycle, scalarGain_ne_zero] /-- `v ↦ log |g (v₀)|` is measurable for measurable `g`. -/ lemma measurable_log_abs_comp_coord {g : ℝ → ℝ} (hg : Measurable g) : Measurable fun v : EuclideanSpace ℝ (Fin 1) => Real.log |g (v 0)| := Real.measurable_log.comp (continuous_abs.measurable.comp (hg.comp measurable_coord)) variable {μ : Measure (EuclideanSpace ℝ (Fin 1))} /-- If `log |g (v₀)|` is integrable, then the scalar cocycle satisfies `log⁺ ‖A‖ ∈ L¹`. -/ lemma integrableLogNorm_scalarCocycle {g : ℝ → ℝ} (hg : Measurable g) (hint : Integrable (fun v => Real.log |g (v 0)|) μ) : IntegrableLogNorm (scalarCocycle g) μ := by have hm : Measurable fun v => Real.posLog ‖scalarCocycle g v‖ := Real.continuous_posLog.measurable.comp (continuous_norm.measurable.comp (measurable_scalarCocycle hg)) refine Integrable.mono' hint.abs hm.aestronglyMeasurable ?_ filter_upwards with v rw [scalarCocycle, norm_fin_one, Real.norm_of_nonneg Real.posLog_nonneg, ← log_abs_scalarGain g (v 0)] exact posLog_le_abs_log _ /-- If `log |g (v₀)|` is integrable, then the scalar cocycle satisfies `log⁺ ‖A⁻¹‖ ∈ L¹`. -/ lemma integrableLogNorm_inv_scalarCocycle {g : ℝ → ℝ} (hg : Measurable g) (hint : Integrable (fun v => Real.log |g (v 0)|) μ) : IntegrableLogNorm (fun v => (scalarCocycle g v)⁻¹) μ := by have hm : Measurable fun v => Real.posLog ‖(scalarCocycle g v)⁻¹‖ := Real.continuous_posLog.measurable.comp (continuous_norm.measurable.comp (measurable_inv_matrix.comp (measurable_scalarCocycle hg))) refine Integrable.mono' hint.abs hm.aestronglyMeasurable ?_ filter_upwards with v rw [inv_scalarCocycle, norm_fin_one, Real.norm_of_nonneg Real.posLog_nonneg, abs_inv, ← log_abs_scalarGain g (v 0), ← abs_neg (Real.log |scalarGain g (v 0)|), ← Real.log_inv] exact posLog_le_abs_log _ /-- If `f' ≠ 0` almost everywhere, the corrected cocycle of `f'` agrees with the derivative of `liftMap f` almost everywhere. -/ lemma ae_scalarCocycle_eq {f f' : ℝ → ℝ} (hf : ∀ t, HasDerivAt f (f' t) t) (hnull : ∀ᵐ v ∂μ, f' (v 0) ≠ 0) : ∀ᵐ v ∂μ, scalarCocycle f' v = derivativeCocycle (liftMap f) v := by filter_upwards [hnull] with v hv rw [scalarCocycle, derivativeCocycle_liftMap (hf (v 0)), scalarGain, ite_eq_right_iff.2 fun h => absurd h hv] /-! ## The Chebyshev polynomials as real functions -/ /-- The Chebyshev polynomial `Tₙ` as a function `ℝ → ℝ`. -/ noncomputable def chebPoly (n : ℕ) (t : ℝ) : ℝ := (Polynomial.Chebyshev.T ℝ n).eval t /-- The derivative `Tₙ'` as a function `ℝ → ℝ`. -/ noncomputable def chebPolyDeriv (n : ℕ) (t : ℝ) : ℝ := (Polynomial.derivative (Polynomial.Chebyshev.T ℝ n)).eval t /-- The derivative of `Tₙ` is `Tₙ'`. -/ lemma hasDerivAt_chebPoly (n : ℕ) (t : ℝ) : HasDerivAt (chebPoly n) (chebPolyDeriv n t) t := Polynomial.hasDerivAt _ t /-- `Tₙ` is `C¹`. -/ lemma contDiff_chebPoly (n : ℕ) : ContDiff ℝ 1 (chebPoly n) := by have h := Polynomial.contDiff_aeval (𝕜 := ℝ) (Polynomial.Chebyshev.T ℝ n) 1 have heq : (fun t : ℝ => Polynomial.aeval t (Polynomial.Chebyshev.T ℝ n)) = chebPoly n := by funext t rw [chebPoly, Polynomial.aeval_def, Polynomial.eval₂_eq_eval_map, Algebra.algebraMap_self, Polynomial.map_id] rwa [heq] at h /-- `Tₙ` is continuous. -/ lemma continuous_chebPoly (n : ℕ) : Continuous (chebPoly n) := (contDiff_chebPoly n).continuous /-- `Tₙ'` is measurable. -/ lemma measurable_chebPolyDeriv (n : ℕ) : Measurable (chebPolyDeriv n) := (Polynomial.continuous _).measurable /-- `Tₙ(cos θ) = cos (nθ)`. -/ lemma chebPoly_cos (n : ℕ) (θ : ℝ) : chebPoly n (cos θ) = cos (n * θ) := by rw [chebPoly, Polynomial.Chebyshev.T_real_cos]; norm_cast /-- `Tₙ(cosh θ) = cosh (nθ)`. -/ lemma chebPoly_cosh (n : ℕ) (θ : ℝ) : chebPoly n (cosh θ) = cosh (n * θ) := by rw [chebPoly, Polynomial.Chebyshev.T_real_cosh]; norm_cast /-- `T₂(t) = 2t² - 1`. -/ lemma chebPoly_two : chebPoly 2 = fun t => 2 * t ^ 2 - 1 := by funext t rw [chebPoly, show ((2 : ℕ) : ℤ) = 2 from rfl, Polynomial.Chebyshev.T_two] simp /-- `Tₙ'(cos θ) sin θ = n sin (nθ)`. -/ lemma chebPolyDeriv_cos_mul_sin (n : ℕ) (θ : ℝ) : chebPolyDeriv n (cos θ) * sin θ = n * sin (n * θ) := by rw [chebPolyDeriv, Polynomial.Chebyshev.T_derivative_eq_U, Polynomial.eval_mul, Polynomial.eval_intCast, mul_assoc, Polynomial.Chebyshev.U_real_cos] push_cast ring_nf /-! ## Ergodicity -/ /-- `cos 2π(nθ) = Tₙ(cos 2πθ)` on the circle. -/ lemma circleCos_nsmul (n : ℕ) (θ : UnitAddCircle) : circleCos (n • θ) = chebPoly n (circleCos θ) := by induction θ using QuotientAddGroup.induction_on with | H r => rw [← AddCircle.coe_nsmul, circleCos_coe, circleCos_coe, cosParam, cosParam, chebPoly_cos, nsmul_eq_mul] ring_nf /-- The Chebyshev map `v ↦ Tₙ(v₀)` on `EuclideanSpace ℝ (Fin 1)`. -/ noncomputable def chebN (n : ℕ) : EuclideanSpace ℝ (Fin 1) → EuclideanSpace ℝ (Fin 1) := liftMap (chebPoly n) /-- In degree two, `chebN` is the map `cheb : x ↦ 2x² - 1`. -/ lemma chebN_two : chebN 2 = cheb := by funext v; rw [chebN, liftMap, chebPoly_two, cheb] /-- `Tₙ` is semiconjugate to `θ ↦ nθ` by `θ ↦ cos 2πθ`. -/ lemma chebN_emb_circleCos (n : ℕ) (θ : UnitAddCircle) : chebN n (emb (circleCos θ)) = emb (circleCos (n • θ)) := by rw [chebN, liftMap, emb_apply, circleCos_nsmul] /-- **The Chebyshev map of degree `n ≥ 2` is ergodic for the arcsine measure**: it is a factor of `θ ↦ n θ` on the circle. -/ theorem ergodic_chebN {n : ℕ} (hn : 1 < n) : Ergodic (chebN n) arcsineMeasure := measurePreserving_embCircleCos.ergodic_of_ergodic_semiconj (AddCircle.ergodic_nsmul hn) (continuous_liftMap (continuous_chebPoly n)).measurable fun θ => (chebN_emb_circleCos n θ).symm /-! ## The critical set and the exponent -/ /-- The set of `r` with `sin (2πnr) = 0` is Lebesgue-null (`n ≠ 0`). -/ lemma volume_sin_two_pi_mul_eq_zero {n : ℕ} (hn : n ≠ 0) : volume {r : ℝ | sin (2 * π * (n * r)) = 0} = 0 := by have hsub : {r : ℝ | sin (2 * π * (n * r)) = 0} ⊆ range fun k : ℤ => (k : ℝ) / (2 * n) := by intro r hr obtain ⟨k, hk⟩ := Real.sin_eq_zero_iff.1 hr refine ⟨k, ?_⟩ have hpi := pi_pos have hn' : (0 : ℝ) < n := by exact_mod_cast Nat.pos_of_ne_zero hn field_simp nlinarith [hk] exact measure_mono_null hsub ((Set.countable_range _).measure_zero volume) /-- For almost every `r`, `sin (2πnr) ≠ 0` (`n ≠ 0`). -/ lemma ae_sin_ne_zero {n : ℕ} (hn : n ≠ 0) : ∀ᵐ r ∂(volume : Measure ℝ), sin (2 * π * (n * r)) ≠ 0 := measure_eq_zero_iff_ae_notMem.1 (volume_sin_two_pi_mul_eq_zero hn) |>.mono fun _ h => h /-- If `sin (2πnr) ≠ 0`, then `Tₙ'(cos 2πr) ≠ 0`. -/ lemma chebPolyDeriv_cosParam_ne_zero {n : ℕ} (hn : n ≠ 0) {r : ℝ} (hr : sin (2 * π * (n * r)) ≠ 0) : chebPolyDeriv n (cosParam r) ≠ 0 := by intro h have := chebPolyDeriv_cos_mul_sin n (2 * π * r) rw [← cosParam, h, zero_mul, show (n : ℝ) * (2 * π * r) = 2 * π * (n * r) by ring] at this exact hr ((mul_eq_zero.1 this.symm).resolve_left (by exact_mod_cast hn)) /-- The critical points of `Tₙ` form a null set for the arcsine measure. -/ lemma ae_chebPolyDeriv_ne_zero {n : ℕ} (hn : n ≠ 0) : ∀ᵐ v ∂arcsineMeasure, chebPolyDeriv n (v 0) ≠ 0 := by have hm : MeasurableSet {v : EuclideanSpace ℝ (Fin 1) | chebPolyDeriv n (v 0) = 0} := measurableSet_eq_fun ((measurable_chebPolyDeriv n).comp measurable_coord) measurable_const have h0 : arcsineMeasure {v : EuclideanSpace ℝ (Fin 1) | chebPolyDeriv n (v 0) = 0} = 0 := by rw [arcsineMeasure, Measure.map_apply measurable_embCos hm] refine le_antisymm ((Measure.restrict_apply_le _ _).trans (le_of_eq ?_)) zero_le refine measure_mono_null (fun r hr => ?_) (volume_sin_two_pi_mul_eq_zero hn) by_contra h exact chebPolyDeriv_cosParam_ne_zero hn h (by simpa using hr) exact (measure_eq_zero_iff_ae_notMem.1 h0).mono fun v hv => hv /-- On `[0, 1]`, `r ↦ log |sin (2πnr)|` is interval integrable. -/ lemma intervalIntegrable_log_abs_sin_two_pi_mul (n : ℕ) (a b : ℝ) : IntervalIntegrable (fun r => Real.log |sin (2 * π * (n * r))|) volume a b := by rcases Nat.eq_zero_or_pos n with rfl | hn · simp have hpi := pi_pos have hc : (2 * π * n : ℝ) ≠ 0 := by positivity have h := (intervalIntegrable_log_sin (a := 2 * π * n * a) (b := 2 * π * n * b)).comp_mul_left (c := 2 * π * n) (by simp) (by simp) rw [mul_div_cancel_left₀ _ hc, mul_div_cancel_left₀ _ hc] at h refine h.congr fun r _ => ?_ simp only [Function.comp_apply, Real.log_abs] ring_nf /-- `∫₀¹ log |sin (2πnr)| dr = ∫₀¹ log |sin (2πr)| dr` for `n ≥ 1`. -/ lemma integral_log_abs_sin_two_pi_mul {n : ℕ} (hn : n ≠ 0) : ∫ r in (0 : ℝ)..1, Real.log |sin (2 * π * (n * r))| = ∫ r in (0 : ℝ)..1, Real.log |sin (2 * π * r)| := by set F : ℝ → ℝ := fun u => Real.log |sin (2 * π * u)| with hF have hper : Function.Periodic F 1 := by intro u simp only [hF, mul_add, mul_one, sin_add_two_pi] have hint : ∀ t₁ t₂, IntervalIntegrable F volume t₁ t₂ := fun t₁ t₂ => by have := intervalIntegrable_log_abs_sin_two_pi_mul 1 t₁ t₂ simp only [Nat.cast_one, one_mul] at this exact this have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn have h1 := intervalIntegral.integral_comp_mul_left F hn' (a := 0) (b := 1) have h2 := hper.intervalIntegral_add_zsmul_eq (n : ℤ) 0 hint simp only [zero_add, zsmul_eq_mul, Int.cast_natCast, mul_one] at h2 simp only [mul_zero, mul_one] at h1 change ∫ r in (0 : ℝ)..1, F (n * r) = ∫ r in (0 : ℝ)..1, F r rw [h1, h2, smul_eq_mul, ← mul_assoc, inv_mul_cancel₀ hn', one_mul] /-- Off a null set, `log |Tₙ'(cos 2πr)| = log n + log |sin (2πnr)| - log |sin (2πr)|`. -/ lemma ae_log_abs_chebPolyDeriv_cosParam {n : ℕ} (hn : n ≠ 0) : ∀ᵐ r ∂(volume : Measure ℝ), Real.log |chebPolyDeriv n (cosParam r)| = Real.log n + Real.log |sin (2 * π * (n * r))| - Real.log |sin (2 * π * r)| := by filter_upwards [ae_sin_ne_zero hn, ae_sin_ne_zero one_ne_zero] with r hr hr1 simp only [Nat.cast_one, one_mul] at hr1 have h := chebPolyDeriv_cos_mul_sin n (2 * π * r) rw [← cosParam, show (n : ℝ) * (2 * π * r) = 2 * π * (n * r) by ring] at h have hn' : (0 : ℝ) < n := by exact_mod_cast Nat.pos_of_ne_zero hn have hD : chebPolyDeriv n (cosParam r) = n * sin (2 * π * (n * r)) / sin (2 * π * r) := by rw [eq_div_iff hr1, h] rw [hD, abs_div, abs_mul, abs_of_pos hn', Real.log_div (by positivity) (abs_ne_zero.2 hr1), Real.log_mul hn'.ne' (abs_ne_zero.2 hr)] /-- `r ↦ log |sin (2πnr)|` is integrable on `(0, 1]`. -/ lemma integrableOn_log_abs_sin_two_pi_mul (n : ℕ) : IntegrableOn (fun r => Real.log |sin (2 * π * (n * r))|) (Ioc (0 : ℝ) 1) := (intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one).1 (intervalIntegrable_log_abs_sin_two_pi_mul n 0 1) /-- `log |Tₙ'|` is integrable for the arcsine law. -/ lemma integrable_log_abs_chebPolyDeriv {n : ℕ} (hn : n ≠ 0) : Integrable (fun v : EuclideanSpace ℝ (Fin 1) => Real.log |chebPolyDeriv n (v 0)|) arcsineMeasure := by rw [integrable_arcsineMeasure_iff (measurable_log_abs_comp_coord (measurable_chebPolyDeriv n))] have h1 := integrableOn_log_abs_sin_two_pi_mul 1 simp only [Nat.cast_one, one_mul] at h1 have hA : IntegrableOn (fun r : ℝ => Real.log n + Real.log |sin (2 * π * (n * r))|) (Ioc (0 : ℝ) 1) := (integrableOn_const (C := Real.log n) (by simp)).add (integrableOn_log_abs_sin_two_pi_mul n) refine (hA.sub h1).congr ?_ refine ae_restrict_of_ae ?_ filter_upwards [ae_log_abs_chebPolyDeriv_cosParam hn] with r hr simp only [Pi.sub_apply, emb_apply] rw [hr] /-- **The Lyapunov exponent of the Chebyshev map of degree `n`**: `∫ log |Tₙ'| dμ = log n`. -/ theorem integral_log_abs_chebPolyDeriv {n : ℕ} (hn : n ≠ 0) : ∫ v, Real.log |chebPolyDeriv n (v 0)| ∂arcsineMeasure = Real.log n := by rw [integral_arcsineMeasure (measurable_log_abs_comp_coord (measurable_chebPolyDeriv n))] have h1 := integrableOn_log_abs_sin_two_pi_mul 1 simp only [Nat.cast_one, one_mul] at h1 have hae : (fun r => Real.log |chebPolyDeriv n ((emb (cosParam r)) 0)|) =ᵐ[volume.restrict (Ioc (0 : ℝ) 1)] fun r => Real.log n + Real.log |sin (2 * π * (n * r))| - Real.log |sin (2 * π * r)| := ae_restrict_of_ae ((ae_log_abs_chebPolyDeriv_cosParam hn).mono fun r hr => by simp only [emb_apply]; rw [hr]) have hA : IntegrableOn (fun r : ℝ => Real.log n + Real.log |sin (2 * π * (n * r))|) (Ioc (0 : ℝ) 1) := (integrableOn_const (C := Real.log n) (by simp)).add (integrableOn_log_abs_sin_two_pi_mul n) rw [integral_congr_ae hae, integral_sub hA h1, integral_add (integrableOn_const (by simp)) (integrableOn_log_abs_sin_two_pi_mul n), setIntegral_const, Real.volume_real_Ioc, sub_zero, max_eq_left zero_le_one, one_smul, ← intervalIntegral.integral_of_le zero_le_one, ← intervalIntegral.integral_of_le zero_le_one, integral_log_abs_sin_two_pi_mul hn] ring /-! ## The cocycle and its exponent -/ /-- The corrected derivative cocycle of `Tₙ` (equal to `Tₙ'` off the critical points). -/ noncomputable def chebNCocycle (n : ℕ) : EuclideanSpace ℝ (Fin 1) → Matrix (Fin 1) (Fin 1) ℝ := scalarCocycle (chebPolyDeriv n) /-- The corrected cocycle of `Tₙ` is invertible. -/ lemma chebNCocycle_det_ne_zero (n : ℕ) (v : EuclideanSpace ℝ (Fin 1)) : (chebNCocycle n v).det ≠ 0 := scalarCocycle_det_ne_zero _ v /-- The corrected cocycle of `Tₙ` is measurable. -/ lemma measurable_chebNCocycle (n : ℕ) : Measurable (chebNCocycle n) := measurable_scalarCocycle (measurable_chebPolyDeriv n) /-- The corrected cocycle of `Tₙ` satisfies `log⁺ ‖A‖ ∈ L¹`. -/ lemma integrableLogNorm_chebNCocycle {n : ℕ} (hn : 1 < n) : IntegrableLogNorm (chebNCocycle n) arcsineMeasure := integrableLogNorm_scalarCocycle (measurable_chebPolyDeriv n) (integrable_log_abs_chebPolyDeriv (by omega)) /-- The corrected cocycle of `Tₙ` satisfies `log⁺ ‖A⁻¹‖ ∈ L¹`. -/ lemma integrableLogNorm_inv_chebNCocycle {n : ℕ} (hn : 1 < n) : IntegrableLogNorm (fun v => (chebNCocycle n v)⁻¹) arcsineMeasure := integrableLogNorm_inv_scalarCocycle (measurable_chebPolyDeriv n) (integrable_log_abs_chebPolyDeriv (by omega)) /-- The corrected cocycle of `Tₙ` agrees with the derivative matrix almost everywhere. -/ lemma ae_chebNCocycle_eq {n : ℕ} (hn : n ≠ 0) : ∀ᵐ v ∂arcsineMeasure, chebNCocycle n v = derivativeCocycle (chebN n) v := ae_scalarCocycle_eq (hasDerivAt_chebPoly n) (ae_chebPolyDeriv_ne_zero hn) /-- The single Lyapunov exponent of the Chebyshev map of degree `n` is `log n`. -/ lemma sumAllExp_chebN {n : ℕ} (hn : 1 < n) : sumAllExp (ergodic_chebN hn) (chebNCocycle_det_ne_zero n) (measurable_chebNCocycle n) (integrableLogNorm_chebNCocycle hn) (integrableLogNorm_inv_chebNCocycle hn) = Real.log n := by rw [sumAllExp_eq_integral_log_abs_det] simp only [chebNCocycle, det_scalarCocycle, log_abs_scalarGain] exact integral_log_abs_chebPolyDeriv (by omega) /-- The Lyapunov exponent of `Tₙ` is nonnegative. -/ lemma exponents_chebN_nonneg {n : ℕ} (hn : 1 < n) (i : Fin 1) : 0 ≤ exponents (ergodic_chebN hn) (chebNCocycle_det_ne_zero n) (measurable_chebNCocycle n) (integrableLogNorm_chebNCocycle hn) (integrableLogNorm_inv_chebNCocycle hn) i := by have h := sumAllExp_chebN hn rw [sumAllExp, Fin.sum_univ_one] at h rw [Subsingleton.elim i 0, h] exact Real.log_nonneg (by exact_mod_cast hn.le) /-- **The positive-exponent sum of the Chebyshev map of degree `n` is `log n`.** -/ theorem sumPosExp_chebN {n : ℕ} (hn : 1 < n) : sumPosExp (ergodic_chebN hn) (chebNCocycle_det_ne_zero n) (measurable_chebNCocycle n) (integrableLogNorm_chebNCocycle hn) (integrableLogNorm_inv_chebNCocycle hn) = Real.log n := by rw [sumPosExp_eq_sumAllExp_of_nonneg _ _ _ _ _ (exponents_chebN_nonneg hn), sumAllExp_chebN hn] /-! ## The injectivity domains -/ /-- `cos` is injective on `[kπ, (k+1)π]`. -/ lemma injOn_cos_Icc_nat_mul_pi (k : ℕ) : InjOn cos (Icc (k * π) ((k + 1) * π)) := by intro u hu v hv huv have hu' : u - k * π ∈ Icc 0 π := ⟨by linarith [hu.1], by linarith [hu.2]⟩ have hv' : v - k * π ∈ Icc 0 π := ⟨by linarith [hv.1], by linarith [hv.2]⟩ have hc : ∀ w, cos w = (-1) ^ k * cos (w - k * π) := fun w => by rw [← cos_add_nat_mul_pi, sub_add_cancel] rw [hc u, hc v] at huv have := injOn_cos hu' hv' (mul_left_cancel₀ (pow_ne_zero _ (by norm_num)) huv) linarith /-- `Tₙ` is injective on `(1, ∞)`. -/ lemma injOn_chebPoly_Ioi {n : ℕ} (hn : n ≠ 0) : InjOn (chebPoly n) (Ioi 1) := by intro x hx y hy hxy have hx1 : (1 : ℝ) ≤ x := le_of_lt hx have hy1 : (1 : ℝ) ≤ y := le_of_lt hy rw [← cosh_arcosh hx1, ← cosh_arcosh hy1, chebPoly_cosh, chebPoly_cosh] at hxy have hn' : (0 : ℝ) < n := by exact_mod_cast Nat.pos_of_ne_zero hn have h := cosh_injOn (mem_Ici.2 (mul_nonneg hn'.le (arcosh_nonneg hx1))) (mem_Ici.2 (mul_nonneg hn'.le (arcosh_nonneg hy1))) hxy rw [← cosh_arcosh hx1, ← cosh_arcosh hy1, mul_left_cancel₀ hn'.ne' h] /-- `Tₙ(-x) = (-1)ⁿ Tₙ(x)`. -/ lemma chebPoly_neg (n : ℕ) (x : ℝ) : chebPoly n (-x) = ((n : ℤ).negOnePow : ℝ) * chebPoly n x := by rw [chebPoly, chebPoly, Polynomial.Chebyshev.T_eval_neg] /-- `Tₙ` is injective on `(-∞, -1)`. -/ lemma injOn_chebPoly_Iio {n : ℕ} (hn : n ≠ 0) : InjOn (chebPoly n) (Iio (-1)) := by intro x hx y hy hxy have hne : ((n : ℤ).negOnePow : ℝ) ≠ 0 := by rcases Int.units_eq_one_or ((n : ℤ).negOnePow) with h | h <;> simp [h] have h : chebPoly n (-x) = chebPoly n (-y) := by rw [chebPoly_neg, chebPoly_neg, hxy] have := injOn_chebPoly_Ioi hn (show (1 : ℝ) < -x by linarith [mem_Iio.1 hx]) (show (1 : ℝ) < -y by linarith [mem_Iio.1 hy]) h exact neg_inj.1 this /-- The `k`-th injectivity domain `{x | arccos x ∈ [kπ/n, (k+1)π/n]}` of `Tₙ`. -/ def chebNCell (n : ℕ) (k : Fin n) : Set (EuclideanSpace ℝ (Fin 1)) := {v | arccos (v 0) ∈ Icc (k * π / n) ((k + 1) * π / n)} /-- The injectivity domains of `Tₙ` are measurable. -/ lemma measurableSet_chebNCell (n : ℕ) (k : Fin n) : MeasurableSet (chebNCell n k) := (isClosed_Icc.preimage (continuous_arccos.comp ((continuous_apply 0).comp (PiLp.continuous_ofLp 2 _)))).measurableSet /-- `Tₙ` is injective on each domain `chebNCell n k`. -/ lemma injOn_chebPoly_cell {n : ℕ} (hn : 1 < n) (k : ℕ) (hk : k < n) {x y : ℝ} (hx : arccos x ∈ Icc (k * π / n) ((k + 1) * π / n)) (hy : arccos y ∈ Icc (k * π / n) ((k + 1) * π / n)) (hxy : chebPoly n x = chebPoly n y) : x = y := by have hn0 : n ≠ 0 := by omega have hn' : (0 : ℝ) < n := by exact_mod_cast Nat.pos_of_ne_zero hn0 have hpi := pi_pos have hnz : (n : ℤ) ≠ 0 := by exact_mod_cast hn0 -- both points in `[-1, 1]` have hin : ∀ {x y : ℝ}, |x| ≤ 1 → |y| ≤ 1 → arccos x ∈ Icc (k * π / n) ((k + 1) * π / n) → arccos y ∈ Icc (k * π / n) ((k + 1) * π / n) → chebPoly n x = chebPoly n y → x = y := by intro x y hx1 hy1 hx hy hxy obtain ⟨hx1, hx2⟩ := abs_le.1 hx1 obtain ⟨hy1, hy2⟩ := abs_le.1 hy1 rw [← cos_arccos hx1 hx2, ← cos_arccos hy1 hy2, chebPoly_cos, chebPoly_cos] at hxy have hmem : ∀ {a : ℝ}, a ∈ Icc (k * π / n) ((k + 1) * π / n) → (n : ℝ) * a ∈ Icc (k * π) ((k + 1) * π) := by intro a ha refine ⟨?_, ?_⟩ · have := ha.1; rw [div_le_iff₀ hn'] at this; linarith · have := ha.2; rw [le_div_iff₀ hn'] at this; linarith have h := injOn_cos_Icc_nat_mul_pi k (hmem hx) (hmem hy) hxy rw [← cos_arccos hx1 hx2, ← cos_arccos hy1 hy2, mul_left_cancel₀ hn'.ne' h] -- a point in `[-1, 1]` and a point outside cannot have the same image have hmix : ∀ {x y : ℝ}, |x| ≤ 1 → 1 < |y| → chebPoly n x ≠ chebPoly n y := by intro x y hx hy h have h1 := Polynomial.Chebyshev.abs_eval_T_real_le_one (n : ℤ) hx have h2 := Polynomial.Chebyshev.one_lt_abs_eval_T_real hnz hy rw [chebPoly, chebPoly] at h rw [h] at h1 linarith by_cases hx1 : |x| ≤ 1 <;> by_cases hy1 : |y| ≤ 1 · exact hin hx1 hy1 hx hy hxy · exact absurd hxy (hmix hx1 (not_le.1 hy1)) · exact absurd hxy.symm (hmix hy1 (not_le.1 hx1)) push Not at hx1 hy1 -- both outside: they lie on the same side of `[-1, 1]` have hpos : ∀ {z : ℝ}, 1 < z → arccos z ∈ Icc (k * π / n) ((k + 1) * π / n) → k = 0 := by intro z hz hzc have h0 : arccos z = 0 := arccos_eq_zero.2 hz.le have := hzc.1 rw [h0, div_le_iff₀ hn', zero_mul] at this have : (k : ℝ) ≤ 0 := by nlinarith exact_mod_cast le_antisymm (by exact_mod_cast this) (Nat.zero_le k) have hneg : ∀ {z : ℝ}, z < -1 → arccos z ∈ Icc (k * π / n) ((k + 1) * π / n) → n ≤ k + 1 := by intro z hz hzc have h0 : arccos z = π := arccos_eq_pi.2 hz.le have := hzc.2 rw [h0, le_div_iff₀ hn'] at this have : (n : ℝ) ≤ k + 1 := by nlinarith exact_mod_cast this rcases lt_abs.1 hx1 with hx' | hx' <;> rcases lt_abs.1 hy1 with hy' | hy' · exact injOn_chebPoly_Ioi hn0 hx' hy' hxy · have := hpos hx' hx; have := hneg (show y < -1 by linarith) hy; omega · have := hpos hy' hy; have := hneg (show x < -1 by linarith) hx; omega · exact injOn_chebPoly_Iio hn0 (show x < -1 by linarith) (show y < -1 by linarith) hxy /-- Two distinct domains meet only where `arccos x` is an interior node `jπ/n`, a single point. -/ lemma chebNCell_inter_subset {n : ℕ} {i j : Fin n} (hij : i ≠ j) : chebNCell n i ∩ chebNCell n j ⊆ {emb (cos (max (i : ℕ) (j : ℕ) * π / n))} := by have hn' : (0 : ℝ) < n := by exact_mod_cast Nat.pos_of_ne_zero (by omega : n ≠ 0) have hpi := pi_pos rintro v ⟨hvi, hvj⟩ simp only [chebNCell, mem_ofPred_eq] at hvi hvj set a := arccos (v 0) -- the common value is the larger lower endpoint have ha : a = max (i : ℕ) (j : ℕ) * π / n := by rcases lt_or_gt_of_ne (Fin.val_injective.ne hij) with h | h · have hle : ((i : ℕ) : ℝ) + 1 ≤ (j : ℕ) := by exact_mod_cast h rw [max_eq_right h.le] refine le_antisymm (hvi.2.trans ?_) hvj.1 exact div_le_div_of_nonneg_right (by nlinarith) hn'.le · have hle : ((j : ℕ) : ℝ) + 1 ≤ (i : ℕ) := by exact_mod_cast h rw [max_eq_left h.le] refine le_antisymm (hvj.2.trans ?_) hvi.1 exact div_le_div_of_nonneg_right (by nlinarith) hn'.le -- the node lies strictly inside `(0, π)`, so `v₀ ∈ (-1, 1)` and `v₀ = cos a` have hmax_pos : 0 < max (i : ℕ) (j : ℕ) := by rcases Nat.eq_zero_or_pos (i : ℕ) with h | h · have : (j : ℕ) ≠ 0 := fun hj => hij (Fin.ext (h.trans hj.symm)) exact lt_max_of_lt_right (Nat.pos_of_ne_zero this) · exact lt_max_of_lt_left h have hmax_lt : max (i : ℕ) (j : ℕ) < n := max_lt i.isLt j.isLt have ha0 : a ≠ 0 := by rw [ha]; have : (0 : ℝ) < max (i : ℕ) (j : ℕ) := by exact_mod_cast hmax_pos positivity have haπ : a ≠ π := by rw [ha]; intro h have : ((max (i : ℕ) (j : ℕ) : ℕ) : ℝ) < n := by exact_mod_cast hmax_lt rw [div_eq_iff hn'.ne'] at h nlinarith have h1 : -1 < v 0 := by by_contra h; exact haπ (arccos_eq_pi.2 (not_lt.1 h)) have h2 : v 0 < 1 := by by_contra h; exact ha0 (arccos_eq_zero.2 (not_lt.1 h)) rw [mem_singleton_iff, ← emb_coord v, ← cos_arccos h1.le h2.le] congr 2 /-- The partition of `EuclideanSpace ℝ (Fin 1)` into the `n` injectivity domains of `Tₙ`. -/ noncomputable def chebNPartition {n : ℕ} (hn : 1 < n) : Entropy.MeasurePartition arcsineMeasure (Fin n) where cells := chebNCell n measurable := measurableSet_chebNCell n aedisjoint i j hij := by refine measure_mono_null (chebNCell_inter_subset hij) ?_ exact arcsineMeasure_ac (measure_singleton _) cover := by have hn' : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) have hpi := pi_pos refine Set.eq_univ_of_forall fun v => Set.mem_iUnion.2 ?_ set a := arccos (v 0) * n / π with ha have ha0 : 0 ≤ a := by rw [ha]; have := arccos_nonneg (v 0); positivity have han : a ≤ n := by rw [ha, div_le_iff₀ hpi]; nlinarith [arccos_le_pi (v 0)] refine ⟨⟨min ⌊a⌋₊ (n - 1), by omega⟩, ?_, ?_⟩ · -- `kπ/n ≤ arccos v₀` rw [div_le_iff₀ hn'] have hk : ((min ⌊a⌋₊ (n - 1) : ℕ) : ℝ) ≤ a := (Nat.cast_le.2 (min_le_left _ _)).trans (Nat.floor_le ha0) rw [ha, le_div_iff₀ hpi] at hk nlinarith · -- `arccos v₀ ≤ (k+1)π/n` rw [le_div_iff₀ hn'] have hk : a ≤ ((min ⌊a⌋₊ (n - 1) : ℕ) : ℝ) + 1 := by rcases le_total ⌊a⌋₊ (n - 1) with h | h · rw [min_eq_left h]; exact (Nat.lt_floor_add_one a).le · rw [min_eq_right h] have : ((n - 1 : ℕ) : ℝ) + 1 = n := by rw [Nat.cast_sub (by omega), Nat.cast_one]; ring rw [this]; exact han rw [ha, div_le_iff₀ hpi] at hk nlinarith /-- `Tₙ` is injective on each of its `n` domains. -/ lemma isInjectivityPartition_chebN {n : ℕ} (hn : 1 < n) : IsInjectivityPartition arcsineMeasure (chebN n) (chebNPartition hn) where inj k := by intro v hv w hw hvw have h := congrArg (fun u => u 0) hvw simp only [chebN, liftMap, emb_apply] at h rw [← emb_coord v, ← emb_coord w] congr 1 exact injOn_chebPoly_cell hn k k.isLt hv hw h /-! ## Pesin's formula for the Chebyshev map of degree `n` -/ /-- **Pesin's entropy formula for the Chebyshev map of degree `n ≥ 2`**, as an instance of the abstract theorem `ErgodicTheory.pesin_entropy_formula_of_ae_eq`: every hypothesis of that theorem is verified for `Tₙ` and the arcsine law. -/ theorem pesin_formula_chebN {n : ℕ} (hn : 1 < n) : Entropy.ksEntropy (ergodic_chebN hn).toMeasurePreserving = ((sumPosExp (ergodic_chebN hn) (chebNCocycle_det_ne_zero n) (measurable_chebNCocycle n) (integrableLogNorm_chebNCocycle hn) (integrableLogNorm_inv_chebNCocycle hn) : ℝ) : EReal) := haveI : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩ pesin_entropy_formula_of_ae_eq (ergodic_chebN hn) (chebNCocycle_det_ne_zero n) (measurable_chebNCocycle n) (integrableLogNorm_chebNCocycle hn) (integrableLogNorm_inv_chebNCocycle hn) (contDiff_liftMap (contDiff_chebPoly n)) (isCompact_closedBall 0 1) arcsineMeasure_compl_closedBall (ae_chebNCocycle_eq (by omega)) ⟨arcsineMeasure_ac⟩ (isInjectivityPartition_chebN hn) (exponents_chebN_nonneg hn) integrable_log_rnDeriv /-- **The Kolmogorov–Sinai entropy of the Chebyshev map of degree `n ≥ 2` is `log n`**, computed from Pesin's formula. -/ theorem ksEntropy_chebN {n : ℕ} (hn : 1 < n) : Entropy.ksEntropy (ergodic_chebN hn).toMeasurePreserving = ((Real.log n : ℝ) : EReal) := by rw [pesin_formula_chebN hn, sumPosExp_chebN hn] end ErgodicTheory.Examples.Chebyshev