Lean / Reader
Lean readerKemptonGrowth.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports KemptonTrees, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import KemptonTreesnamespace Kemptonopen MeasureTheory Filteropen scoped Topologydef after (j : ℕ) := 2 * block j + 2def beforeNext (j : ℕ) := 2 * block (j+1) + 1private def child (j : ℕ) (u : Fin (block j) → Bool) :Ball bursts zeroSeq (after j) :=⟨[code (block j) u], ⟨⟨⟨rfl,j,u,rfl⟩,trivial⟩,by simp [weight,code,after]⟩⟩private theorem child_injective (j : ℕ) : Function.Injective (child j) := byintro u v hehave e : code (block j) u = code (block j) v := byhave := congrArg Subtype.val hesimpa [child] using thisfunext ⟨i,hi⟩let k := block jhave h := congrArg (fun w => prepend w zeroSeq (k+1+i)) ehave hk : i < k := hisimpa [prepend, code, ←show k = block j from rfl, show k+1+i < 2*k+1 by omega,show ¬k+1+i < k by omega, show k+1+i ≠ k by omega] using htheorem highCount (j : ℕ) : 2 ^ block j ≤ Nat.card (Ball bursts zeroSeq (after j)) := bysimpa [Nat.card_eq_fintype_card] using Nat.card_le_card_of_injective _ (child_injective j)theorem lowCount (j : ℕ) :Nat.card (Ball bursts zeroSeq (beforeNext j)) ≤ 2 ^ (2 * block j + 2) := bylet m := 2 * block j + 1have hb : ∀ w ∈ bursts zeroSeq, w.1 < beforeNext j → w.1 ≤ m := byrintro _ ⟨_,i,u,rfl⟩ hwchange 2*block i+1 < 2*block (j+1)+1 at hwhave hi : i ≤ j := byby_contra! hhave : block (j+1) ≤ block i := block_mono.monotone homegahave : block i ≤ block j := block_mono.monotone hichange 2*block i+1 ≤ 2*block j+1omegahave h := Nat.card_le_card_of_injective _ (compress_injective hb)simp only [Nat.card_eq_fintype_card, Fintype.card_option, Fintype.card_fun, Fintype.card_bool,Fintype.card_fin] at happly h.transchange 2^m + 1 ≤ 2^(m+1)rw [pow_succ 2 m]have : 0 < 2^m := by positivityomegatheorem highGrowth (j : ℕ) : Real.log 2 / 4 ≤ growth bursts zeroSeq (after j) := byhave h : (2:ℝ)^block j ≤ (Nat.card (Ball bursts zeroSeq (after j)) : ℝ) := byexact_mod_cast highCount jhave hlog := Real.log_le_log (by positivity) hrw [Real.log_pow] at hloghave hk : 1 ≤ (block j : ℝ) := by exact_mod_cast block_pos jhave hconst : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num)unfold growthapply (le_div_iff₀ (by unfold after; positivity)).mprsimp only [after, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] at *nlinarith [mul_nonneg (sub_nonneg.mpr hk) hconst]theorem lowGrowth (j : ℕ) : growth bursts zeroSeq (beforeNext j) ≤ Real.log 2 / 8 := byhave h : (Nat.card (Ball bursts zeroSeq (beforeNext j)) : ℝ) ≤ (2:ℝ)^(2*block j+2) := byexact_mod_cast lowCount jhave hc : 0 < Nat.card (Ball bursts zeroSeq (beforeNext j)) := byhave hn : 0 < beforeNext j := by unfold beforeNext; omegaletI : Nonempty (Ball bursts zeroSeq (beforeNext j)) := ⟨⟨[],trivial,hn⟩⟩exact Nat.card_poshave hlog := Real.log_le_log (by exact_mod_cast hc) hrw [Real.log_pow] at hloghave hk : 1 ≤ (block j : ℝ) := by exact_mod_cast block_pos jhave hconst : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num)have hnext : block (j+1) = 16 * block j := by simp [block,pow_succ,Nat.mul_comm]unfold growthapply (div_le_iff₀ (by unfold beforeNext; positivity)).mprsimp only [beforeNext, hnext, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one] at *nlinarith [mul_nonneg (sub_nonneg.mpr hk) hconst]theorem no_limit : ¬ ∃ L : ℝ, Tendsto (growth bursts zeroSeq) atTop (𝓝 L) := byrintro ⟨L,hL⟩have ht₁ : Tendsto after atTop atTop :=tendsto_atTop_mono (fun j => byhave hj := Nat.lt_pow_self (n := j) (a := 16) (by decide)change j ≤ 2 * 16^j + 2; omega) tendsto_idhave ht₂ : Tendsto beforeNext atTop atTop :=tendsto_atTop_mono (fun j => byhave hj := Nat.lt_pow_self (n := j+1) (a := 16) (by decide)change j ≤ 2 * 16^(j+1) + 1; omega) tendsto_idhave hhi := ge_of_tendsto (hL.comp ht₁) (.of_forall highGrowth)have hlo := le_of_tendsto (hL.comp ht₂) (.of_forall lowGrowth)have : 0 < Real.log 2 := Real.log_pos (by norm_num)linarith/-- A continuous countable family of mutually disjoint binary cylinders, and ashift-invariant probability measure under which almost-everywhere convergence fails. -/theorem counterexample : ∃ (F : Family) (μ : Measure Seq), Admissible F ∧IsProbabilityMeasure μ ∧ MeasurePreserving shift μ μ ∧¬ (∀ᵐ a ∂μ, ∃ L : ℝ, Tendsto (growth F a) atTop (𝓝 L)) := byrefine ⟨bursts,Measure.dirac zeroSeq,admissible,inferInstance,?_,?_⟩· have hs : Measurable shift := measurable_pi_lambda _ fun i => measurable_pi_apply (i+1)exact ⟨hs, Measure.map_dirac hs zeroSeq⟩· simpa [Filter.Eventually, ae_dirac_eq] using no_limit#print axioms counterexampleend Kempton