import Mathlib/-!# Ratio limit for a centered integer random walk under logarithmic time shiftsSource: https://mathoverflow.net/questions/511513 (Leonard Euler)Credit: @OriRuneThe variables are indexed from zero rather than one. The shift is the numberof steps removed, and the support condition is the one specified in the post.There is no assumption of finite variance.-/namespace OMA.S_mo_511513open Filter MeasureTheory ProbabilityTheorydef HasSpanOne (support : Set ℤ) : Prop :=∀ a b : ℤ, 1 < a → ∃ z ∈ support, ¬ a ∣ (z - b)def walk {Ω : Type} (X : ℕ → Ω → ℤ) (n : ℕ) (ω : Ω) : ℤ :=∑ i ∈ Finset.range n, X i ωdef claim : Prop :=∀ (Ω : Type) [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P],∀ X : ℕ → Ω → ℤ,(∀ i, Measurable (X i)) →iIndepFun X P →(∀ i, Measure.map (X i) P = Measure.map (X 0) P) →Integrable (fun ω => (X 0 ω : ℝ)) P →(∫ ω, (X 0 ω : ℝ) ∂P) = 0 →HasSpanOne {z | 0 < P {ω | X 0 ω = z}} →∀ (s : ℕ → ℕ) (z : ℕ → ℤ),(∃ C : ℝ, ∀ᶠ n : ℕ in atTop, (s n : ℝ) ≤ C * Real.log (n : ℝ)) →(∃ B : ℤ, ∀ᶠ n : ℕ in atTop, |z n| ≤ B) →Tendsto (fun n =>(P {ω | walk X (n - s n) ω = -z n}).toReal /(P {ω | walk X n ω = 0}).toReal) atTop (nhds 1)end OMA.S_mo_511513/-! Finite-stage elementary estimates for the sparse centered random-walk counterexample. -/noncomputable sectionopen Finset Filter Realopen scoped Topology BigOperatorsnamespace SparseWalk/-- A positive exponentially small sequence has unbounded backward ratios atany prescribed divergent sequence of time shifts. -/theorem unbounded_ratios (b : ℕ → ℝ) (hb : ∀ n, 0 < b n){ρ : ℝ} (hρ₀ : 0 < ρ) (hρ₁ : ρ < 1) (hdecay : ∀ n, b n ≤ ρ^n)(s : ℕ → ℕ) (hs : Tendsto s atTop atTop) (hlo : ∀ᶠ n in atTop, 1 ≤ s n)(hhi : ∀ᶠ n in atTop, s n ≤ n) {M : ℝ} (hM : 0 < M)(N : ℕ) : ∃ n ≥ N, M < b (n - s n) / b n := byby_contra! Hobtain ⟨r,hρr,hr₁⟩ := exists_between hρ₁have hr₀ := hρ₀.trans hρrhave hsmall := (tendsto_pow_atTop_nhds_zero_of_lt_one hr₀.le hr₁).comp hsobtain ⟨K,hK⟩ := eventually_atTop.mp((eventually_ge_atTop N).and (hlo.and (hhi.and (hsmall.eventually_lt_const (inv_pos.mpr hM)))))let C := (Finset.range (K+1)).inf' (by simp) (fun j ↦ b j / r^j)have hC : 0 < C := (Finset.lt_inf'_iff _).2 (fun j _ ↦ div_pos (hb j) (pow_pos hr₀ _))have lower (n : ℕ) : C * r^n ≤ b n := byinduction n using Nat.strong_induction_on with| h n ih =>by_cases hn : n < K· apply (le_div_iff₀ (pow_pos hr₀ _)).mpexact Finset.inf'_le _ (mem_range.mpr (by omega : n < K+1))· obtain ⟨hnN,hn₁,hn₂,hn₃⟩ := hK n (by omega)have l := ih (n-s n) (by omega)have hbound := (div_le_iff₀ (hb n)).mp (H n hnN)have hpow : r ^ n = r^(n-s n) * r^(s n) := byrw [← pow_add, Nat.sub_add_cancel hn₂]have hpart : r^(s n) * M ≤ 1 := byhave := (lt_div_iff₀ hM).mp (show r^(s n) < 1 / M by simpa using hn₃)linarithrw [hpow]apply (mul_le_mul_iff_left₀ hM).mpcalc(C * (r^(n-s n)*r^(s n))) * M = (C*r^(n-s n))*(r^(s n)*M) := by ring_ ≤ (C*r^(n-s n))*1 := mul_le_mul_of_nonneg_left hpart (by positivity)_ ≤ b n * M := by simpa [mul_comm] using l.trans hboundhave hg (n : ℕ) : C ≤ (ρ/r)^n := byrw [div_pow]exact (le_div_iff₀ (pow_pos hr₀ _)).2 ((lower n).trans (hdecay n))have ht := tendsto_pow_atTop_nhds_zero_of_lt_one (div_nonneg hρ₀.le hr₀.le)((div_lt_one hr₀).2 hρr)exact (not_lt_of_ge (le_of_tendsto_of_tendsto' tendsto_const_nhds ht hg)) hCabbrev Atom := ℤ × ℝ/-- Unnormalized integration against a finite list of weighted atoms. -/def integrate : List Atom → (ℤ → ℝ) → ℝ| [], _ => 0| (x,w)::rest, f => w*f x + integrate rest fdef raw (L : List Atom) : ℕ → ℤ → ℝ| 0, k => if k=0 then 1 else 0| n+1, k => integrate L (fun x ↦ raw L n (k-x))def positive (L : List Atom) := ∀ a ∈ L, 0 ≤ a.2lemma integrate_mono {L : List Atom} (hL : positive L) (f g : ℤ → ℝ)(hfg : ∀ a ∈ L, f a.1 ≤ g a.1) : integrate L f ≤ integrate L g := byinduction L with| nil => rfl| cons a L ih =>exact add_le_add (mul_le_mul_of_nonneg_left (hfg a (by simp)) (hL a (by simp)))(ih (fun z hz ↦ hL z (by simp [hz])) (fun z hz ↦ hfg z (by simp [hz])))lemma integrate_scale (L : List Atom) (f : ℤ → ℝ) (c : ℝ) :integrate L (fun x ↦ c*f x) = c*integrate L f := byinduction L with| nil => simp [integrate]| cons a L ih => cases a; simp only [integrate, ih]; ringlemma integrate_drift_deriv (L : List Atom) :HasDerivAt (fun t : ℝ ↦ integrate L (fun x ↦ Real.exp (-t*x))) (-integrate L Int.cast) 0 := byinduction L with| nil => simpa [integrate] using (hasDerivAt_const (x := (0:ℝ)) (c := (0:ℝ)))| cons a L ih =>rcases a with ⟨x,w⟩have h := (((hasDerivAt_id (0:ℝ)).neg.mul_const (x:ℝ)).exp.const_mul w).add ihconvert h using 1 <;> first | rfl | (simp [integrate]; ring)lemma strictly_tilt {L : List Atom} (h : 0 < integrate L Int.cast) :∃ t : ℝ, integrate L (fun x ↦ Real.exp (-t*x)) < integrate L (fun _ ↦ 1) := byhave hd := integrate_drift_deriv Lby_contra! Hhave hm : IsLocalMin (fun t : ℝ ↦ integrate L (fun x ↦ Real.exp (-t*x))) 0 := byapply IsMinOn.isLocalMin (s := Set.univ) _ Filter.univ_memapply isMinOn_univ_iff.mprintro tsimpa using H thave hz := hm.hasDerivAt_eq_zero hdlinarithlemma raw_tilt_bound (L : List Atom) (hL : positive L) (t : ℝ)(n : ℕ) (k : ℤ) :raw L n k ≤ Real.exp (t*k) * (integrate L (fun x ↦ Real.exp (-t*x)))^n := byinduction n generalizing k with| zero => by_cases hk : k=0 <;> simp [raw,hk, (Real.exp_pos _).le]| succ n ih =>rw [raw, pow_succ]calc_ ≤ integrate L (fun x ↦ Real.exp (t*(k-x)) * (integrate L (fun x ↦ Real.exp (-t*x)))^n) := byapply integrate_mono hLintro a _simpa using ih (k-a.1)_ = integrate L (fun x ↦ (Real.exp (t*k)*(integrate L (fun x ↦ Real.exp (-t*x)))^n) *Real.exp (-t*x)) := bycongr 1funext xrw [show t*((k:ℝ)-x) = t*k + (-t*x) by ring, Real.exp_add]ring_ = _ := by rw [integrate_scale]; ringdef atomWeight (i A : ℕ) : ℝ := (1/2 : ℝ)^(i+1) / (A:ℝ)def stageAtoms (a : ℕ → ℕ) : ℕ → List Atom| 0 => [(0,1),(1,1)]| j+1 => (-(a j : ℤ), atomWeight j (a j)) :: stageAtoms a jdef stageMass (a : ℕ → ℕ) (j : ℕ) : ℝ := integrate (stageAtoms a j) (fun _ ↦ 1)lemma stage_positive (a : ℕ → ℕ) (j : ℕ) : positive (stageAtoms a j) := byinduction j with| zero => intro x hx; simp [stageAtoms] at hx; rcases hx with rfl | rfl <;> norm_num| succ j ih =>intro x hxrcases List.mem_cons.mp hx with h | h· rw [h]; unfold atomWeight; positivity· exact ih x hlemma stage_le_one (a : ℕ → ℕ) (j : ℕ) : ∀ x ∈ stageAtoms a j, x.1 ≤ 1 := byinduction j with| zero => intro x hx; simp [stageAtoms] at hx; rcases hx with rfl | rfl <;> norm_num| succ j ih =>intro x hxrcases List.mem_cons.mp hx with h | h· rw [h]; simp· exact ih x hlemma integrate_congr (L : List Atom) (f g : ℤ → ℝ) (h : ∀ x ∈ L, f x.1 = g x.1) :integrate L f = integrate L g := byinduction L with| nil => rfl| cons a L ih =>rcases a with ⟨x,w⟩simp only [integrate]rw [h (x,w) (by simp), ih (fun u hu ↦ h u (by simp [hu]))]lemma integrate_zero (L : List Atom) : integrate L (fun _ ↦ 0) = 0 := byinduction L with| nil => rfl| cons a L ih => cases a; simp [integrate,ih]lemma overshoot_zero (L : List Atom) (hL : ∀ x ∈ L, x.1 ≤ 1) (n : ℕ) (k : ℤ)(hk : (n:ℤ) < k) : raw L n k = 0 := byinduction n generalizing k with| zero => simp [raw, ne_of_gt (show 0 < k by simpa using hk)]| succ n ih =>rw [raw, ← integrate_zero L]apply integrate_congrintro x hxapply ihhave := hL x hxomega/-- Extra negative atoms of magnitude at least A are invisible up to a time mat endpoints k ≥ m−A. All other increments are at most one. -/theorem cutoff_stable (a : ℕ → ℕ) (ha : Monotone a) (j l : ℕ) (hjl : j ≤ l)(m : ℕ) (k : ℤ) (hk : (m:ℤ)-(a j:ℤ) ≤ k) :raw (stageAtoms a l) m k = raw (stageAtoms a j) m k := byinduction m generalizing k with| zero => rfl| succ m ih =>rw [raw, raw]have trim (v : ℕ) (hv : j ≤ v) :integrate (stageAtoms a v) (fun x ↦ raw (stageAtoms a l) m (k-x)) =integrate (stageAtoms a j) (fun x ↦ raw (stageAtoms a l) m (k-x)) := byinduction v, hv using Nat.le_induction with| base => rfl| succ v hv ihv =>have hav : (a j : ℤ) ≤ a v := by exact_mod_cast ha hvhave eq := overshoot_zero (stageAtoms a l) (stage_le_one a l) m(k-(-(a v:ℤ))) (by omega)simp only [stageAtoms,integrate,eq,mul_zero,zero_add,ihv]rw [trim l hjl]apply integrate_congrintro x hxapply ihhave := stage_le_one a j x hxomegalemma stage_mass_gt (a : ℕ → ℕ) (j : ℕ) : 0 < stageMass a j := byinduction j with| zero => norm_num [stageMass,stageAtoms,integrate]| succ j ih =>change 0 < atomWeight j (a j) * 1 + stageMass a jhave : 0 ≤ atomWeight j (a j) := by unfold atomWeight; positivitylinarithlemma stage_drift (a : ℕ → ℕ) (ha : ∀ j, 0 < a j) (j : ℕ) :integrate (stageAtoms a j) Int.cast = (1/2 : ℝ)^j := byinduction j with| zero => norm_num [stageAtoms,integrate]| succ j ih =>simp only [stageAtoms, integrate, ih, atomWeight, Int.cast_neg, Int.cast_natCast,pow_succ]have h : (a j:ℝ) ≠ 0 := by exact_mod_cast (ha j).ne'field_simpringlemma integrate_nonneg {L : List Atom} (hL : positive L) {f : ℤ → ℝ}(hf : ∀ a ∈ L, 0 ≤ f a.1) : 0 ≤ integrate L f := byrw [← integrate_zero L]exact integrate_mono hL _ _ hflemma integrate_pos_of_atom {L : List Atom} (hL : positive L) {f : ℤ → ℝ}(hf : ∀ a ∈ L, 0 ≤ f a.1) (x : Atom) (hx : x ∈ L)(hw : 0 < x.2) (hfx : 0 < f x.1) : 0 < integrate L f := byinduction L with| nil => simp at hx| cons a L ih =>have hp : positive L := fun y hy ↦ hL y (by simp [hy])have hrest : ∀ y ∈ L, 0 ≤ f y.1 := fun y hy ↦ hf y (by simp [hy])change 0 < a.2 * f a.1 + integrate L frcases List.mem_cons.mp hx with h | h· subst aexact add_pos_of_pos_of_nonneg (mul_pos hw hfx) (integrate_nonneg hp hrest)· exact add_pos_of_nonneg_of_pos (mul_nonneg (hL a (by simp)) (hf a (by simp))) (ih hp hrest h)lemma raw_nonneg {L : List Atom} (hL : positive L) (n : ℕ) (k : ℤ) : 0 ≤ raw L n k := byinduction n generalizing k with| zero => simp [raw,apply_ite]| succ n ih => exact integrate_nonneg hL (fun _ _ ↦ ih _)lemma base_atom (a : ℕ → ℕ) (j : ℕ) : ((0,1) : Atom) ∈ stageAtoms a j := byinduction j with| zero => simp [stageAtoms]| succ j ih => simp [stageAtoms,ih]lemma raw_pos (a : ℕ → ℕ) (j n : ℕ) : 0 < raw (stageAtoms a j) n 0 := byinduction n with| zero => norm_num [raw]| succ n ih =>rw [raw]apply integrate_pos_of_atom (f := fun x ↦ raw (stageAtoms a j) n (0-x))(stage_positive a j) (fun _ _ ↦ raw_nonneg (stage_positive a j) _ _)(0,1) (base_atom a j) (by norm_num)simpa using ihdef normalized (a : ℕ → ℕ) (j n : ℕ) : ℝ := raw (stageAtoms a j) n 0 / (stageMass a j)^ntheorem stage_bad (a : ℕ → ℕ) (ha : ∀ i, 0 < a i) (j : ℕ)(s : ℕ → ℕ) (hs : Tendsto s atTop atTop) (hlo : ∀ᶠ n in atTop, 1 ≤ s n)(hhi : ∀ᶠ n in atTop, s n ≤ n) (M : ℝ) (hM : 0 < M) (N : ℕ) :∃ n ≥ N, M < normalized a j (n-s n) / normalized a j n := byhave h := stage_drift a ha jhave hd : 0 < integrate (stageAtoms a j) Int.cast := by rw [h]; positivityobtain ⟨t,ht⟩ := strictly_tilt hdlet z := integrate (stageAtoms a j) (fun x ↦ Real.exp (-t*x))have hz : 0 < z := integrate_pos_of_atom (stage_positive a j)(fun _ _ ↦ (Real.exp_pos _).le) (0,1) (base_atom a j) (by norm_num) (Real.exp_pos _)have hW := stage_mass_gt a japply unbounded_ratios (normalized a j) (fun n ↦ div_pos (raw_pos a j n) (pow_pos hW n))(ρ := z / stageMass a j) (div_pos hz hW) ((div_lt_one hW).mpr ht) _ s hs hlo hhi hM Nintro nrw [normalized,div_pow]apply div_le_div_of_nonneg_right _ (pow_nonneg hW.le _)simpa [z] using raw_tilt_bound (stageAtoms a j) (stage_positive a j) t n 0end SparseWalk/-! A diagonal distribution whose finite-stage return ratios grow without bound. -/noncomputable sectionopen Filteropen scoped Topologynamespace SparseWalkdef admissibleTime (a : ℕ → ℕ) (s : ℕ → ℕ) (j n : ℕ) : Prop :=j+1 ≤ n ∧ a j < n ∧ s n ≤ n ∧(j+1 : ℕ) < normalized a (j+1) (n-s n) / normalized a (j+1) nlemma exists_time (a s : ℕ → ℕ) (ha : ∀ i, 0 < a i) (hs : Tendsto s atTop atTop)(hhi : ∀ᶠ n in atTop, s n ≤ n) (j : ℕ) : ∃ n, admissibleTime a s j n := byobtain ⟨K,hK⟩ := eventually_atTop.mp hhiobtain ⟨n,hn,hr⟩ := stage_bad a ha (j+1) s hs (hs.eventually_ge_atTop 1) hhi(j+1 : ℕ) (by positivity) (max K (max (j+1) (a j+1)))exact ⟨n,by unfold admissibleTime; exact ⟨by omega,by omega,hK n (by omega),hr⟩⟩open Classical indef chooseTime (a s : ℕ → ℕ) (j : ℕ) : ℕ :=if h : ∃ n, admissibleTime a s j n then Nat.find h else 0lemma chooseTime_spec (a s : ℕ → ℕ) (ha : ∀ i, 0 < a i) (hs : Tendsto s atTop atTop)(hhi : ∀ᶠ n in atTop, s n ≤ n) (j : ℕ) :admissibleTime a s j (chooseTime a s j) := byclassicalhave h := exists_time a s ha hs hhi jsimpa [chooseTime, dif_pos h] using Nat.find_spec h/-- On advancing a stage, retain the prefix and fill the unused tail with thenew jump length. The dummy tail never enters the stage's convolution. -/def approxLaw (s : ℕ → ℕ) : ℕ → ℕ → ℕ| 0, _ => 1| j+1, i => if i ≤ j then approxLaw s j i else chooseTime (approxLaw s j) s j + 1def magnitude (s : ℕ → ℕ) (i : ℕ) := approxLaw s i idef witnessTime (s : ℕ → ℕ) (j : ℕ) := chooseTime (approxLaw s j) s jlemma approx_pos (s : ℕ → ℕ) (j i : ℕ) : 0 < approxLaw s j i := byinduction j generalizing i with| zero => simp [approxLaw]| succ j ih => simp only [approxLaw]; split <;> first | apply ih | omegalemma magnitude_pos (s : ℕ → ℕ) (i : ℕ) : 0 < magnitude s i := approx_pos s i ilemma approx_eq (s : ℕ → ℕ) {i j : ℕ} (h : i ≤ j) :approxLaw s j i = magnitude s i := byinduction j, h using Nat.le_induction with| base => rfl| succ j hj ih => simpa [approxLaw,hj] using ihlemma next_magnitude (s : ℕ → ℕ) (j : ℕ) : magnitude s (j+1) = witnessTime s j + 1 := bysimp [magnitude,approxLaw,witnessTime]lemma stage_congr {a b : ℕ → ℕ} (j : ℕ) (h : ∀ i < j, a i = b i) :stageAtoms a j = stageAtoms b j := byinduction j with| zero => rfl| succ j ih => simp [stageAtoms,h j (by omega),ih (fun i hi ↦ h i (by omega))]lemma witness_spec (s : ℕ → ℕ) (hs : Tendsto s atTop atTop) (hhi : ∀ᶠ n in atTop, s n ≤ n)(j : ℕ) : admissibleTime (magnitude s) s j (witnessTime s j) := byhave h := chooseTime_spec (approxLaw s j) s (approx_pos s j) hs hhi jhave heq := stage_congr (a := approxLaw s j) (b := magnitude s) (j+1)(fun i hi ↦ approx_eq s (by omega))simpa only [admissibleTime, normalized, stageMass, heq, magnitude, witnessTime] using hlemma magnitude_strictMono (s : ℕ → ℕ) (hs : Tendsto s atTop atTop)(hhi : ∀ᶠ n in atTop, s n ≤ n) : StrictMono (magnitude s) := byapply strictMono_nat_of_lt_succintro jrw [next_magnitude]exact (witness_spec s hs hhi j).2.1.trans (Nat.lt_succ_self _)/-- The inequality survives renormalization by any larger positive mass. -/lemma normalization_ratio (A B m n : ℝ) (hA : 0 < A) (hB : 0 < B) (hm : 0 < m)(hmn : m ≤ n) (t d : ℕ) :(A/m^t)/(B/m^(t+d)) ≤ (A/n^t)/(B/n^(t+d)) := byhave hn := hm.trans_le hmnhave eq (u : ℝ) (hu : 0 < u) : (A/u^t)/(B/u^(t+d)) = (A/B)*u^d := byrw [pow_add]field_simprw [eq m hm,eq n hn]exact mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hm.le hmn d) (div_pos hA hB).le/-- An arbitrary normalized return law agreeing with all applicable cutoffshas infinitely many arbitrarily large backward ratios. -/theorem arbitrarily_bad_full (s : ℕ → ℕ) (hs : Tendsto s atTop atTop)(hhi : ∀ᶠ n in atTop, s n ≤ n) (W : ℝ)(hW : ∀ j, stageMass (magnitude s) j ≤ W) (p : ℕ → ℝ)(hp : ∀ j m, m ≤ magnitude s j → p m = raw (stageAtoms (magnitude s) j) m 0 / W^m)(j : ℕ) : ∃ n ≥ j+1, (j+1 : ℕ) < p (n-s n) / p n := bylet n := witnessTime s jobtain ⟨hjn,_,hsn,hbad⟩ := witness_spec s hs hhi jhave hb : n ≤ magnitude s (j+1) := by rw [next_magnitude]; exact Nat.le_succ _refine ⟨n,hjn,?_⟩rw [hp (j+1) n hb, hp (j+1) (n-s n) ((Nat.sub_le ..).trans hb)]apply hbad.trans_leunfold normalizedhave hm := stage_mass_gt (magnitude s) (j+1)have he := normalization_ratio _ _ _ _ (raw_pos (magnitude s) (j+1) (n-s n))(raw_pos (magnitude s) (j+1) n) hm (hW (j+1)) (n-s n) (s n)have hsn' : s n ≤ n := hsnsimpa only [Nat.sub_add_cancel hsn'] using hetheorem full_not_tendsto (s : ℕ → ℕ) (hs : Tendsto s atTop atTop)(hhi : ∀ᶠ n in atTop, s n ≤ n) (W : ℝ)(hW : ∀ j, stageMass (magnitude s) j ≤ W) (p : ℕ → ℝ)(hp : ∀ j m, m ≤ magnitude s j → p m = raw (stageAtoms (magnitude s) j) m 0 / W^m) :¬ Tendsto (fun n ↦ p (n-s n) / p n) atTop (𝓝 1) := byintro htobtain ⟨K,hK⟩ := eventually_atTop.mp (ht.eventually_lt_const (by norm_num : (1:ℝ)<2))obtain ⟨n,hn,hr⟩ := arbitrarily_bad_full s hs hhi W hW p hp (K+2)have he := hK n (by omega)norm_num only [Nat.cast_add,Nat.cast_ofNat,Nat.cast_one] at hrlinarith [Nat.cast_nonneg (α := ℝ) K]/-- The concrete time shift in the disproof of the question. -/def logShift (n : ℕ) : ℕ := ⌊Real.log (n:ℝ)⌋₊lemma logShift_tendsto : Tendsto logShift atTop atTop :=tendsto_nat_floor_atTop.comp (Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop)lemma logShift_le (n : ℕ) : logShift n ≤ n :=Nat.floor_le_of_le (Real.log_le_self (Nat.cast_nonneg n))lemma logShift_growth : ∃ C : ℝ, ∀ᶠ n : ℕ in atTop, (logShift n : ℝ) ≤ C * Real.log (n:ℝ) := byrefine ⟨1,?_⟩filter_upwards [eventually_ge_atTop (1:ℕ)] with n hnsimpa [logShift] using Nat.floor_le (Real.log_nonneg (show (1:ℝ) ≤ n by exact_mod_cast hn))end SparseWalkopen scoped BigOperators ENNReal NNRealopen MeasureTheorynamespace SparseWalkdef jump (a : ℕ → ℕ) : ℕ → ℤ| 0 => 0| 1 => 1| i + 2 => -(a i : ℤ)noncomputable def labelWeight (a : ℕ → ℕ) : ℕ → ℝ| 0 => 1| 1 => 1| i + 2 => (1 / 2 : ℝ) ^ (i + 1) / (a i : ℝ)noncomputable def totalMass (a : ℕ → ℕ) : ℝ :=2 + ∑' i, (1 / 2 : ℝ) ^ (i + 1) / (a i : ℝ)noncomputable def labelLaw (a : ℕ → ℕ) : Measure ℕ :=Measure.sum (fun m => ENNReal.ofReal (labelWeight a m / totalMass a) • Measure.dirac m)theorem geometric_jump_mass : HasSum (fun i : ℕ => (1 / 2 : ℝ) ^ (i + 1)) 1 := bysimpa [pow_succ] using hasSum_geometric_two.mul_right (1 / 2 : ℝ)theorem negative_weights_summable {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) :Summable (fun i => (1 / 2 : ℝ) ^ (i + 1) / (a i : ℝ)) := byapply Summable.of_nonneg_of_le (fun i => by positivity) _ geometric_jump_mass.summableintro iexact div_le_self (by positivity) (by exact_mod_cast ha i)theorem labelWeight_nonneg (a : ℕ → ℕ) (m : ℕ) : 0 ≤ labelWeight a m := bymatch m with| 0 | 1 => norm_num [labelWeight]| n + 2 => simp only [labelWeight]; positivitytheorem totalMass_ge_two (a : ℕ → ℕ) : 2 ≤ totalMass a := byhave h : 0 ≤ ∑' i, (1 / 2 : ℝ) ^ (i + 1) / (a i : ℝ) :=tsum_nonneg (fun i => by positivity)unfold totalMasslinariththeorem labelWeight_summable {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) :Summable (labelWeight a) :=(summable_nat_add_iff 2).mp (negative_weights_summable ha)theorem tsum_labelWeight {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) :∑' m, labelWeight a m = totalMass a := byrw [← (labelWeight_summable ha).sum_add_tsum_nat_add 2]norm_num [Finset.sum_range_succ, labelWeight, totalMass]theorem truncated_mass_le {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) (j : ℕ) :2 + ∑ i ∈ Finset.range j, (1 / 2 : ℝ) ^ (i + 1) / (a i : ℝ) ≤ totalMass a := byexact add_le_add_right ((negative_weights_summable ha).sum_le_tsum _ (fun i _ => by positivity)) 2theorem labelLaw_singleton (a : ℕ → ℕ) (m : ℕ) :labelLaw a {m} = ENNReal.ofReal (labelWeight a m / totalMass a) := byclassicalrw [labelLaw, Measure.sum_apply _ (measurableSet_singleton _), tsum_eq_single m]· simp· intro b hbsimp [Measure.dirac_apply' _ (measurableSet_singleton _), hb]theorem labelLaw_real_singleton (a : ℕ → ℕ) (m : ℕ) :(labelLaw a).real {m} = labelWeight a m / totalMass a := byrw [Measure.real, labelLaw_singleton, ENNReal.toReal_ofReal]exact div_nonneg (labelWeight_nonneg a m) (by linarith [totalMass_ge_two a])theorem labelLaw_probability {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) :IsProbabilityMeasure (labelLaw a) := byconstructorrw [labelLaw, Measure.sum_apply _ MeasurableSet.univ]simp only [Measure.smul_apply, measure_univ, smul_eq_mul, mul_one]rw [← ENNReal.ofReal_tsum_of_nonneg (fun i => div_nonneg (labelWeight_nonneg a i)(by linarith [totalMass_ge_two a])) ((labelWeight_summable ha).div_const _),tsum_div_const, tsum_labelWeight ha, div_self (by linarith [totalMass_ge_two a]),ENNReal.ofReal_one]theorem jump_integrable {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) :Integrable (fun m => (jump a m : ℝ)) (labelLaw a) := byapply integrable_sum_dirac (fun _ => ENNReal.ofReal_ne_top)apply (summable_nat_add_iff 2).mprefine (geometric_jump_mass.summable.div_const (totalMass a)).congr (fun i => ?_)have hai : 0 < (a i : ℝ) := by exact_mod_cast ha irw [ENNReal.toReal_ofReal (div_nonneg (labelWeight_nonneg a _) (by linarith [totalMass_ge_two a]))]simp [jump, labelWeight]field_simptheorem jump_integral {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) :∫ m, (jump a m : ℝ) ∂labelLaw a = 0 := byrw [labelLaw, integral_sum_dirac (fun _ => ENNReal.ofReal_ne_top)]simp only [ENNReal.toReal_ofReal (div_nonneg (labelWeight_nonneg a _) (by linarith [totalMass_ge_two a])),smul_eq_mul]let f := fun m => labelWeight a m / totalMass a * (jump a m : ℝ)change ∑' m, f m = 0have ht : HasSum (fun i => f (i + 2)) (-(1 / totalMass a)) := byhave eqfun : (fun i => f (i + 2)) = (fun i : ℕ => -((1/2 : ℝ)^(i+1) / totalMass a)) := byfunext ihave hai : 0 < (a i : ℝ) := by exact_mod_cast ha isimp [f, labelWeight, jump]field_simprw [eqfun]exact (geometric_jump_mass.div_const (totalMass a)).neghave hs : Summable f := (summable_nat_add_iff 2).mp ht.summablerw [← hs.sum_add_tsum_nat_add 2, ht.tsum_eq]simp [Finset.sum_range_succ, f, jump, labelWeight]theorem stageMass_eq_sum (a : ℕ → ℕ) (j : ℕ) :stageMass a j = 2 + ∑ i ∈ Finset.range j, (1 / 2 : ℝ) ^ (i + 1) / (a i : ℝ) := byinduction j with| zero => norm_num [stageMass, stageAtoms, integrate]| succ i ih =>change atomWeight i (a i) * 1 + stageMass a i = _rw [ih, Finset.sum_range_succ]unfold atomWeightringtheorem stageMass_le_totalMass {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) (j : ℕ) :stageMass a j ≤ totalMass a := byrw [stageMass_eq_sum]exact truncated_mass_le ha jtheorem totalMass_sub_stageMass {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) (j : ℕ) :totalMass a - stageMass a j =∑' i : ℕ, (1 / 2 : ℝ) ^ (i + j + 1) / (a (i + j) : ℝ) := byrw [stageMass_eq_sum, totalMass, ← (negative_weights_summable ha).sum_add_tsum_nat_add j]ringtheorem totalMass_sub_stageMass_le {a : ℕ → ℕ} (ha : ∀ i, 0 < a i) (hm : Monotone a) (j : ℕ) :totalMass a - stageMass a j ≤ (1/2 : ℝ)^j / (a j : ℝ) := byrw [totalMass_sub_stageMass ha]have hg : HasSum (fun i : ℕ => (1 / 2 : ℝ) ^ (i + j + 1)) ((1 / 2 : ℝ)^j) := bysimpa only [show ∀ i : ℕ, i + j + 1 = i + 1 + j by omega, pow_add _ (_ + 1), one_mul] usinggeometric_jump_mass.mul_right ((1/2 : ℝ)^j)rw [← (hg.div_const (a j : ℝ)).tsum_eq]apply Summable.tsum_le_tsum _ ((summable_nat_add_iff j).mpr (negative_weights_summable ha))(hg.div_const (a j : ℝ)).summableintro iexact div_le_div_of_nonneg_left (by positivity) (by exact_mod_cast ha j)(by exact_mod_cast hm (Nat.le_add_left j i))end SparseWalk/-! Independent increments on their countable product sample space andfinite convolution after the impossible negative jumps have been discarded. -/noncomputable sectionopen Filter Finset MeasureTheory ProbabilityTheoryopen scoped BigOperators Topology ENNRealnamespace SparseWalkabbrev labelProduct (μ : Measure ℕ) [IsProbabilityMeasure μ] : Measure (ℕ → ℕ) :=Measure.infinitePi fun _ : ℕ ↦ μdef posAt (v : ℕ → ℤ) (n : ℕ) (ω : ℕ → ℕ) : ℤ := ∑ i ∈ range n, v (ω i)lemma pos_meas (v : ℕ → ℤ) (n : ℕ) : Measurable (posAt v n) := byapply Finset.measurable_fun_sumintro i _exact (measurable_of_countable v).comp (measurable_pi_apply i)lemma pos_bound {v : ℕ → ℤ} (hv : ∀ m, v m ≤ 1) (n : ℕ) (ω : ℕ → ℕ) :posAt v n ω ≤ n := bycalc_ ≤ ∑ _i ∈ range n, (1:ℤ) := Finset.sum_le_sum fun i _ ↦ hv (ω i)_ = _ := by simplemma pos_succ (v : ℕ → ℤ) (n : ℕ) (ω : ℕ → ℕ) :posAt v (n+1) ω = posAt v n ω + v (ω n) := Finset.sum_range_succ _ _lemma label_indep (μ : Measure ℕ) [IsProbabilityMeasure μ] (v : ℕ → ℤ) :iIndepFun (fun i (ω : ℕ → ℕ) ↦ v (ω i)) (labelProduct μ) :=iIndepFun_infinitePi (fun _ ↦ measurable_of_countable v)lemma label_map (μ : Measure ℕ) [IsProbabilityMeasure μ] (v : ℕ → ℤ) (i : ℕ) :(labelProduct μ).map (fun ω ↦ v (ω i)) = μ.map v := bycalc_ = ((labelProduct μ).map (fun ω ↦ ω i)).map v :=(Measure.map_map (measurable_of_countable v) (measurable_pi_apply i)).symm_ = _ := congrArg (Measure.map v) (Measure.infinitePi_map_eval (fun _ : ℕ ↦ μ) i)lemma past_indep (μ : Measure ℕ) [IsProbabilityMeasure μ] (v : ℕ → ℤ) (n : ℕ) :IndepFun (fun ω : ℕ → ℕ ↦ ω n) (posAt v n) (labelProduct μ) := byhave h : iIndepFun (fun i (ω : ℕ → ℕ) ↦ ω i) (labelProduct μ) :=iIndepFun_infinitePi (X := fun _ ↦ id) (fun _ ↦ measurable_id)have hp := h.indepFun_finset ({n} : Finset ℕ) (range n) (by simp) (fun i ↦ measurable_pi_apply i)let left : ((i : ({n} : Finset ℕ)) → ℕ) → ℕ := fun H ↦ H ⟨n, by simp⟩let right : ((i : range n) → ℕ) → ℤ := fun H ↦ ∑ i, v (H i)have hright : Measurable right :=Finset.measurable_fun_sum _ (fun i _ ↦ (measurable_of_countable v).comp (measurable_pi_apply i))have hh := hp.comp (show Measurable left from measurable_pi_apply _) hrightchange IndepFun (fun ω : ℕ → ℕ ↦ ω n) (fun ω ↦ ∑ i : range n, v (ω i)) _ at hhhave he (ω : ℕ → ℕ) : (∑ i : range n, v (ω i)) = posAt v n ω := byexact Finset.sum_attach (range n) (fun i ↦ v (ω i))simpa only [he] using hhlemma coordinate_mass (μ : Measure ℕ) [IsProbabilityMeasure μ] (n m : ℕ) :(labelProduct μ) {ω | ω n = m} = μ {m} := byhave h := congrArg (fun ν : Measure ℕ ↦ ν {m}) (Measure.infinitePi_map_eval (fun _ : ℕ ↦ μ) n)exact (Measure.map_apply (measurable_pi_apply n) (measurableSet_singleton m)).symm.trans hlemma finite_step (μ : Measure ℕ) [IsProbabilityMeasure μ] (v : ℕ → ℤ)(hv : ∀ m, v m ≤ 1) (n : ℕ) (k : ℤ) (L : ℕ)(outside : ∀ m ≥ L, (n : ℤ) + v m < k) :(labelProduct μ).real {ω | posAt v (n+1) ω = k} =∑ m ∈ range L, μ.real {m} * (labelProduct μ).real {ω | posAt v n ω = k - v m} := bylet E (m : ℕ) : Set (ℕ → ℕ) := {ω | ω n = m} ∩ {ω | posAt v n ω = k - v m}have heq : {ω | posAt v (n+1) ω = k} = ⋃ m ∈ range L, E m := byext ωsimp only [Set.mem_ofPred_eq, Set.mem_iUnion, Finset.mem_range, exists_prop, E, Set.mem_inter_iff]rw [pos_succ]constructor· intro hrefine ⟨ω n, ?_, rfl, by omega⟩by_contra! hlargehave := outside (ω n) hlargehave := pos_bound hv n ωomega· rintro ⟨m, _, rfl, hm⟩omegahave hd : Set.PairwiseDisjoint (↑(range L)) E := byintro i _ j _ hijexact Set.disjoint_left.mpr fun ω hi hj ↦ hij (hi.1.symm.trans hj.1)have hm (i : ℕ) : MeasurableSet (E i) :=(measurableSet_eq_fun (measurable_pi_apply n) measurable_const).inter(measurableSet_eq_fun (pos_meas v n) measurable_const)rw [heq, measureReal_biUnion_finset hd (fun i _ ↦ hm i)]apply Finset.sum_congr rflintro m _have h := (past_indep μ v n).measure_inter_preimage_eq_mul {m} {k-v m}(measurableSet_singleton _) (measurableSet_singleton _)change ((labelProduct μ) (E m)).toReal = _ * _change (labelProduct μ) (E m) = (labelProduct μ) {ω | ω n = m} * _ at hrw [h, ENNReal.toReal_mul, coordinate_mass]rfllemma jump_le_one (a : ℕ → ℕ) (m : ℕ) : jump a m ≤ 1 := byrcases m with _ | (_ | i) <;> simp [jump]lemma sum_stage (a : ℕ → ℕ) (j : ℕ) (f : ℤ → ℝ) :(∑ m ∈ range (j+2), labelWeight a m * f (jump a m)) = integrate (stageAtoms a j) f := byinduction j with| zero => simp [Finset.sum_range_succ, labelWeight, jump, stageAtoms, integrate]| succ j ih =>rw [show j+1+2 = (j+2)+1 by omega, Finset.sum_range_succ, ih]simp [labelWeight, jump, stageAtoms, integrate, atomWeight, add_comm]lemma true_cutoff (μ : Measure ℕ) [IsProbabilityMeasure μ] (a : ℕ → ℕ) (ha : Monotone a)(W : ℝ) (_hW : 0 < W) (hm : ∀ m, μ.real {m} = labelWeight a m / W)(j n : ℕ) (k : ℤ) (hk : (n : ℤ) - a j ≤ k) :(labelProduct μ).real {ω | posAt (jump a) n ω = k} = raw (stageAtoms a j) n k / W^n := byinduction n generalizing k with| zero =>by_cases hz : k = 0· subst ksimp [posAt, raw]· simp [posAt, raw, hz, Ne.symm hz]| succ n ih =>have hout (m : ℕ) (hm' : j+2 ≤ m) : (n : ℤ) + jump a m < k := byobtain ⟨i, rfl⟩ := Nat.exists_eq_add_of_le' (show 2 ≤ m by omega)have hai : a j ≤ a i := ha (by omega)simp only [jump]omegarw [finite_step μ _ (jump_le_one a) n k (j+2) hout]calc_ = ∑ m ∈ range (j+2), (labelWeight a m * raw (stageAtoms a j) n (k - jump a m)) / W^(n+1) := byapply Finset.sum_congr rflintro m _have := jump_le_one a mrw [hm, ih _ (by omega), pow_succ]ring_ = _ := by rw [← Finset.sum_div, sum_stage a j (fun x ↦ raw (stageAtoms a j) n (k-x)), raw]end SparseWalk/-! The negation is stated with the two definitions of the official statement unfolded.This lets the module be checked without importing the official placeholder. -/noncomputable sectionopen Filter Finset MeasureTheory ProbabilityTheoryopen scoped BigOperators Topology ENNRealnamespace SparseWalk/-- For every prescribed time shift going to infinity, one span-one, integrable,centered integer walk has strictly positive return probabilities and arbitrarilylarge backward return ratios at arbitrarily late times. The law may depend on s. -/theorem unbounded_returns_for_shift (s : ℕ → ℕ) (hs : Tendsto s atTop atTop)(hle : ∀ᶠ n in atTop, s n ≤ n) :∃ (P : Measure (ℕ → ℕ)) (X : ℕ → (ℕ → ℕ) → ℤ),IsProbabilityMeasure P ∧ (∀ i, Measurable (X i)) ∧ iIndepFun X P ∧(∀ i, Measure.map (X i) P = Measure.map (X 0) P) ∧Integrable (fun ω => (X 0 ω : ℝ)) P ∧ (∫ ω, (X 0 ω : ℝ) ∂P) = 0 ∧0 < P {ω | X 0 ω = 0} ∧ 0 < P {ω | X 0 ω = 1} ∧(∀ u b : ℤ, 1 < u → ∃ z ∈ {z | 0 < P {ω | X 0 ω = z}}, ¬u ∣ z-b) ∧(∀ n, 0 < P.real {ω | (∑ i ∈ range n, X i ω) = 0}) ∧(∀ j : ℕ, ∃ n ≥ j+1, (j+1 : ℕ) <P.real {ω | (∑ i ∈ range (n-s n), X i ω) = 0} /P.real {ω | (∑ i ∈ range n, X i ω) = 0}) := bylet a := magnitude shave ha : ∀ i, 0 < a i := magnitude_pos shave ham : Monotone a := (magnitude_strictMono _ hs hle).monotonelet μ := labelLaw alet _ : IsProbabilityMeasure μ := labelLaw_probability halet P := labelProduct μlet X := fun (i : ℕ) (ω : ℕ → ℕ) => jump a (ω i)let g := fun m => (jump a m : ℝ)let e := fun ω : ℕ → ℕ => ω 0have hme : Measurable e := measurable_pi_apply 0have hmg : Measurable g := measurable_of_countable _have hmap : P.map e = μ := Measure.infinitePi_map_eval (fun _ : ℕ ↦ μ) 0have hi : Integrable (fun ω => (X 0 ω : ℝ)) P := byhave h : Integrable g (P.map e) := by rw [hmap]; exact jump_integrable haexact (integrable_map_measure hmg.aestronglyMeasurable hme.aemeasurable).mp hhave hmean : ∫ ω, (X 0 ω : ℝ) ∂P = 0 := bycalc_ = ∫ m, g m ∂(P.map e) := (integral_map hme.aemeasurable hmg.aestronglyMeasurable).symm_ = 0 := by rw [hmap]; exact jump_integral hahave hW : 0 < totalMass a := by linarith [totalMass_ge_two a]have atom (m : ℕ) (hm : labelWeight a m = 1) : 0 < P {ω | X 0 ω = jump a m} := byhave hp : 0 < P {ω | ω 0 = m} := byrw [show P {ω | ω 0 = m} = μ {m} from coordinate_mass μ 0 m,show μ {m} = _ from labelLaw_singleton a m, hm]exact ENNReal.ofReal_pos.mpr (one_div_pos.mpr hW)exact hp.trans_le (measure_mono (fun ω h => congrArg (jump a) h))have span : ∀ u b : ℤ, 1 < u → ∃ z ∈ {z | 0 < P {ω | X 0 ω = z}}, ¬u ∣ z-b := byintro u b huby_cases hd : u ∣ 0-b· refine ⟨1, atom 1 rfl, ?_⟩intro hhhave h1 : u ∣ 1 := by simpa using Int.dvd_sub hh hdexact (not_le_of_gt hu) (Int.le_of_dvd (by norm_num) h1)· exact ⟨0, atom 0 rfl, hd⟩let p := fun n => P.real {ω | posAt (jump a) n ω = 0}have hp (j m : ℕ) (hm : m ≤ a j) : p m = raw (stageAtoms a j) m 0 / (totalMass a)^m := byapply true_cutoff μ a ham _ hW (labelLaw_real_singleton a) j m 0exact sub_nonpos.mpr (by exact_mod_cast hm)refine ⟨P, X, inferInstance, fun i =>(measurable_of_countable (jump a)).comp (measurable_pi_apply i),label_indep μ (jump a), fun i => (label_map μ (jump a) i).trans(label_map μ (jump a) 0).symm, hi, hmean, atom 0 rfl, atom 1 rfl, span, ?_, ?_⟩· intro nchange 0 < p nrw [hp n n ((magnitude_strictMono s hs hle).id_le n)]exact div_pos (raw_pos a n n) (pow_pos hW n)· exact arbitrarily_bad_full s hs hle (totalMass a) (stageMass_le_totalMass ha) p hptheorem fullDisproof :¬ (∀ (Ω : Type) [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P],∀ X : ℕ → Ω → ℤ,(∀ i, Measurable (X i)) →iIndepFun X P →(∀ i, Measure.map (X i) P = Measure.map (X 0) P) →Integrable (fun ω => (X 0 ω : ℝ)) P →(∫ ω, (X 0 ω : ℝ) ∂P) = 0 →(∀ u b : ℤ, 1 < u → ∃ z ∈ {z | 0 < P {ω | X 0 ω = z}}, ¬u ∣ z-b) →∀ (s : ℕ → ℕ) (z : ℕ → ℤ),(∃ C : ℝ, ∀ᶠ n : ℕ in atTop, (s n : ℝ) ≤ C * Real.log (n : ℝ)) →(∃ B : ℤ, ∀ᶠ n : ℕ in atTop, |z n| ≤ B) →Tendsto (fun n =>(P {ω | (∑ i ∈ range (n-s n), X i ω) = -z n}).toReal /(P {ω | (∑ i ∈ range n, X i ω) = 0}).toReal) atTop (𝓝 1)) := byintro Hobtain ⟨P, X, hP, hm, hI, hD, hi, hmean, _, _, span, _, hbad⟩ :=unbounded_returns_for_shift logShift logShift_tendsto (.of_forall logShift_le)let _ := hPhave ht := H (ℕ → ℕ) P X hm hI hD hi hmean span logShift (fun _ => 0)logShift_growth ⟨0, .of_forall (fun _ => by simp)⟩obtain ⟨K,hK⟩ := eventually_atTop.mp (ht.eventually_lt_const (by norm_num : (1:ℝ)<2))obtain ⟨n,hn,hr⟩ := hbad (K+2)have he := hK n (by omega)simp only [neg_zero] at hesimp only [Measure.real] at hrnorm_num only [Nat.cast_add,Nat.cast_ofNat,Nat.cast_one] at hrlinarith [Nat.cast_nonneg (α := ℝ) K]end SparseWalk#print axioms SparseWalk.unbounded_returns_for_shift#print axioms SparseWalk.fullDisprooftheorem OMA.disproof : ¬ OMA.S_mo_511513.claim := SparseWalk.fullDisproof#print axioms SparseWalk.unbounded_returns_for_shift#print axioms OMA.disproof#print axioms SparseWalk.unbounded_ratios