Download data/lean/OAI/Probability/FKMaps/Offspring.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 75.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FKMaps/Offspring.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FKMaps/Offspring.lean
-
curl -L -o Offspring.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FKMaps/Offspring.lean
75.3 kB
import OAI.Probability.FKMaps.PathCLT
namespace OAI
noncomputable section
open Set Filter MeasureTheory ProbabilityTheory
open scoped Topology BigOperators ENNReal NNReal
namespace FKCRT.TreeCoding
local instance : MeasurableSpace C(unitInterval, ā) := borel _
local instance : BorelSpace C(unitInterval, ā) := āØrflā©
structure CriticalEvenOffspring where
mass : ā ā ā
nonneg : ā k, 0 ⤠mass k
total : HasSum mass 1
even_support : ā k, Odd k ā mass k = 0
zero_pos : 0 < mass 0
two_pos : 0 < mass 2
mean : HasSum (fun k : ā => (k : ā) * mass k) 1
second : Summable (fun k : ā => (k : ā)^2 * mass k)
def CriticalEvenOffspring.variance (p : CriticalEvenOffspring) : ā :=
ā' k : ā, ((k : ā) - 1)^2 * p.mass k
def CriticalEvenOffspring.sigma (p : CriticalEvenOffspring) : ā :=
Real.sqrt p.variance
lemma CriticalEvenOffspring.summable_variance (p : CriticalEvenOffspring) :
Summable (fun k : ā => ((k : ā) - 1)^2 * p.mass k) := by
apply Summable.of_nonneg_of_le (fun k : ā => mul_nonneg (sq_nonneg _) (p.nonneg k))
(f := fun k : ā => (k : ā)^2 * p.mass k + p.mass k)
Ā· intro k
have hk : (0 : ā) ⤠k := Nat.cast_nonneg k
nlinarith [p.nonneg k, mul_nonneg hk (p.nonneg k)]
Ā· exact p.second.add p.total.summable
lemma CriticalEvenOffspring.variance_pos (p : CriticalEvenOffspring) : 0 < p.variance := by
have hle := p.summable_variance.le_tsum 0
(fun k _ => mul_nonneg (sq_nonneg _) (p.nonneg k))
simp only [Nat.cast_zero, zero_sub, neg_sq, one_pow, one_mul] at hle
exact p.zero_pos.trans_le hle
lemma CriticalEvenOffspring.sigma_pos (p : CriticalEvenOffspring) : 0 < p.sigma :=
Real.sqrt_pos.mpr p.variance_pos
def CriticalEvenOffspring.law (p : CriticalEvenOffspring) : PMF ā :=
āØfun k => ((NNReal.mk (p.mass k) (p.nonneg k)) : āā„0ā), by
apply ENNReal.hasSum_coe.mpr
apply NNReal.hasSum_coe.mp
exact p.totalā©
@[simp] lemma CriticalEvenOffspring.law_apply (p : CriticalEvenOffspring) (k : ā) :
p.law k = ENNReal.ofReal (p.mass k) := by
rw [ENNReal.ofReal_eq_coe_nnreal (p.nonneg k)]
rfl
@[simp] lemma CriticalEvenOffspring.law_singleton (p : CriticalEvenOffspring) (k : ā) :
p.law.toMeasure {k} = ENNReal.ofReal (p.mass k) := by
rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton k), p.law_apply]
@[simp] lemma CriticalEvenOffspring.law_real_singleton (p : CriticalEvenOffspring) (k : ā) :
p.law.toMeasure.real {k} = p.mass k := by
simp [measureReal_def, p.nonneg]
lemma CriticalEvenOffspring.integrable_iff {E : Type*} [NormedAddCommGroup E]
(p : CriticalEvenOffspring) (f : ā ā E) :
Integrable f p.law.toMeasure ā Summable (fun k => p.mass k * āf kā) := by
rw [ā Measure.sum_smul_dirac p.law.toMeasure, integrable_sum_dirac_iff]
Ā· simp only [p.law_singleton, ENNReal.toReal_ofReal (p.nonneg _)]
Ā· intro k
simp
lemma CriticalEvenOffspring.integral_eq_tsum {E : Type*} [NormedAddCommGroup E]
[NormedSpace ā E] [CompleteSpace E] (p : CriticalEvenOffspring) (f : ā ā E)
(hf : Summable (fun k => p.mass k * āf kā)) :
ā« k, f k āp.law.toMeasure = ā' k, p.mass k ⢠f k := by
rw [integral_countable ((p.integrable_iff f).mpr hf)]
simp only [p.law_real_singleton]
lemma CriticalEvenOffspring.integrable_id (p : CriticalEvenOffspring) :
Integrable (fun k : ā => (k : ā)) p.law.toMeasure := by
apply (p.integrable_iff _).mpr
simpa [Real.norm_natCast, mul_comm] using p.mean.summable
lemma CriticalEvenOffspring.integrable_sq (p : CriticalEvenOffspring) :
Integrable (fun k : ā => (k : ā)^2) p.law.toMeasure := by
apply (p.integrable_iff _).mpr
simpa [Real.norm_eq_abs, abs_sq, mul_comm] using p.second
lemma CriticalEvenOffspring.integral_id (p : CriticalEvenOffspring) :
ā« k : ā, (k : ā) āp.law.toMeasure = 1 := by
rw [integral_countable p.integrable_id]
simpa [mul_comm] using p.mean.tsum_eq
lemma CriticalEvenOffspring.integrable_step (p : CriticalEvenOffspring) :
Integrable (fun k : ā => (k : ā) - 1) p.law.toMeasure :=
p.integrable_id.sub (integrable_const 1)
lemma CriticalEvenOffspring.integral_step (p : CriticalEvenOffspring) :
ā« k : ā, ((k : ā) - 1) āp.law.toMeasure = 0 := by
rw [integral_sub p.integrable_id (integrable_const 1), p.integral_id]
simp
lemma CriticalEvenOffspring.integrable_step_sq (p : CriticalEvenOffspring) :
Integrable (fun k : ā => ((k : ā) - 1)^2) p.law.toMeasure := by
apply (p.integrable_iff _).mpr
simpa [Real.norm_eq_abs, abs_sq, mul_comm] using p.summable_variance
lemma CriticalEvenOffspring.integral_step_sq (p : CriticalEvenOffspring) :
ā« k : ā, ((k : ā) - 1)^2 āp.law.toMeasure = p.variance := by
rw [integral_countable p.integrable_step_sq]
simp only [p.law_real_singleton, smul_eq_mul, variance, mul_comm]
def CriticalEvenOffspring.standardStep (p : CriticalEvenOffspring) (k : ā) : ā :=
((k : ā) - 1) / p.sigma
lemma CriticalEvenOffspring.integral_standardStep (p : CriticalEvenOffspring) :
ā« k, p.standardStep k āp.law.toMeasure = 0 := by
simp [standardStep, integral_div, p.integral_step]
lemma CriticalEvenOffspring.integral_standardStep_sq (p : CriticalEvenOffspring) :
ā« k, p.standardStep k ^ 2 āp.law.toMeasure = 1 := by
simp only [standardStep, div_pow, integral_div, p.integral_step_sq, sigma,
Real.sq_sqrt p.variance_pos.le, div_self p.variance_pos.ne']
lemma CriticalEvenOffspring.charFun_power_limit (p : CriticalEvenOffspring) (t : ā) :
Tendsto (fun n : ā =>
(charFun (p.law.toMeasure.map p.standardStep) ((Real.sqrt n)ā»Ā¹ * t)) ^ n)
atTop (š (Complex.exp (- (t : ā)^2 / 2))) := by
exact tendsto_charFun_inv_sqrt_mul_pow
(by fun_prop) p.integral_standardStep p.integral_standardStep_sq t
lemma CriticalEvenOffspring.charFun_gaussian_bound (p : CriticalEvenOffspring) :
ā Ī“ : ā, 0 < Ī“ ā§ ā t : ā, |t| ⤠Γ ā
ācharFun (p.law.toMeasure.map p.standardStep) tā ⤠Real.exp (-t^2/4) := by
have ho := taylor_charFun_two (P := p.law.toMeasure) (X := p.standardStep)
(by fun_prop) p.integral_standardStep p.integral_standardStep_sq
have hb := ho.bound (by norm_num : (0 : ā) < 1/4)
obtain āØr, hr, hboundā© := Metric.eventually_nhds_iff.mp hb
refine āØmin (r/2) 1, lt_min (by positivity) zero_lt_one, ?_ā©
intro t ht
have ht1 : |t| ⤠1 := ht.trans (min_le_right _ _)
have htr : dist t 0 < r := by
rw [Real.dist_eq, sub_zero]
exact (ht.trans (min_le_left _ _)).trans_lt (by linarith)
have hsq : t^2 ⤠1 := (sq_le_one_iff_abs_le_one t).mpr ht1
have he := hbound htr
have hn : ā(1 - (t : ā)^2 / 2)ā = 1 - t^2/2 := by
have heq : (1 - (t : ā)^2 / 2) = ((1 - t^2/2 : ā) : ā) := by push_cast; rfl
rw [heq, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith)]
rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg t)] at he
calc
ācharFun (p.law.toMeasure.map p.standardStep) tā ā¤
ācharFun (p.law.toMeasure.map p.standardStep) t - (1 - (t : ā)^2/2)ā +
ā1 - (t : ā)^2/2ā := by
simpa only [add_comm] using (norm_le_insert'
(charFun (p.law.toMeasure.map p.standardStep) t) (1 - (t : ā)^2/2))
_ ⤠1 - t^2/4 := by rw [hn]; linarith
_ ⤠Real.exp (-t^2/4) := by
linarith [Real.add_one_le_exp (-t^2/4)]
def CriticalEvenOffspring.iidLaw (p : CriticalEvenOffspring) (N : ā) :
Measure (Fin N ā ā) := Measure.pi (fun _ : Fin N => p.law.toMeasure)
instance (p : CriticalEvenOffspring) (N : ā) : IsProbabilityMeasure (p.iidLaw N) := by
unfold CriticalEvenOffspring.iidLaw
infer_instance
def totalStep {N : ā} (d : Fin N ā ā) : ⤠:= ā i, ((d i : ā¤) - 1)
lemma totalStep_eq_sum_sub {N : ā} (d : Fin N ā ā) :
totalStep d = (ā i, d i : ā) - (N : ā¤) := by
simp [totalStep, Finset.sum_sub_distrib]
lemma totalStep_measurable (N : ā) : Measurable (@totalStep N) := by
unfold totalStep
fun_prop
lemma CriticalEvenOffspring.ae_even (p : CriticalEvenOffspring) :
āįµ k āp.law.toMeasure, Even k := by
rw [ae_iff, p.law.toMeasure_apply_eq_zero_iff (by measurability), Set.disjoint_left]
intro k hk hn
have hzero : p.law k = 0 := by
rw [p.law_apply, p.even_support k (Nat.not_even_iff_odd.mp hn), ENNReal.ofReal_zero]
exact (p.law.mem_support_iff k).mp hk hzero
lemma CriticalEvenOffspring.iid_ae_even (p : CriticalEvenOffspring) (N : ā) :
āįµ d āp.iidLaw N, ā i, Even (d i) := by
apply ae_all_iff.mpr
intro i
exact (measurePreserving_eval (fun _ : Fin N => p.law.toMeasure) i).quasiMeasurePreserving.ae p.ae_even
lemma CriticalEvenOffspring.iid_totalStep_parity (p : CriticalEvenOffspring) (N : ā)
{j : ā¤} (hj : Even ((N : ā¤) + j)) :
āįµ d āp.iidLaw N, Even (totalStep d - j) := by
filter_upwards [p.iid_ae_even N] with d hd
rw [totalStep_eq_sum_sub, sub_sub]
apply Even.sub _ hj
exact_mod_cast Finset.even_sum d (fun i _ => hd i)
lemma CriticalEvenOffspring.iid_marginal_map (p : CriticalEvenOffspring) (N : ā)
(i : Fin N) (f : ā ā ā) :
(p.iidLaw N).map (fun d => f (d i)) = p.law.toMeasure.map f := by
have hf : Measurable f := measurable_of_countable f
rw [ā (measurePreserving_eval (fun _ : Fin N => p.law.toMeasure) i).map_eq,
Measure.map_map hf (measurable_pi_apply i)]
rfl
lemma CriticalEvenOffspring.charFun_step_scale (p : CriticalEvenOffspring) (t : ā) :
charFun (p.law.toMeasure.map (fun k : ā => (k : ā) - 1)) t =
charFun (p.law.toMeasure.map p.standardStep) (p.sigma * t) := by
rw [charFun_apply_real, charFun_apply_real,
integral_map (by fun_prop) (by fun_prop), integral_map (by fun_prop) (by fun_prop)]
congr 1
ext k
congr 2
simp only [standardStep]
push_cast
field_simp [p.sigma_pos.ne']
lemma CriticalEvenOffspring.iid_charFun (p : CriticalEvenOffspring) (N : ā) (t : ā) :
charFun ((p.iidLaw N).map (fun d => (totalStep d : ā))) t =
(charFun (p.law.toMeasure.map p.standardStep) (p.sigma * t))^N := by
have heq : (fun d : Fin N ā ā => (totalStep d : ā)) =
fun d => ā i, ((d i : ā) - 1) := by
ext d
simp [totalStep]
rw [heq]
have hind : iIndepFun (fun i (d : Fin N ā ā) => (d i : ā) - 1) (p.iidLaw N) :=
iIndepFun_pi (μ := fun _ : Fin N => p.law.toMeasure)
(X := fun _ k => (k : ā) - 1) (fun _ => by fun_prop)
have hm (i : Fin N) : AEMeasurable (fun d : Fin N ā ā => (d i : ā) - 1) (p.iidLaw N) :=
((measurable_of_countable (fun k : ā => (k : ā) - 1)).comp
(measurable_pi_apply i)).aemeasurable
rw [congrFun (hind.charFun_map_fun_sum_eq_prod hm) t]
simp only [Finset.prod_apply]
simp_rw [p.iid_marginal_map N _ (fun k : ā => (k : ā) - 1), p.charFun_step_scale]
simp
def CriticalEvenOffspring.streamLaw (p : CriticalEvenOffspring) : Measure (ā ā ā) :=
Measure.infinitePi (fun _ : ā => p.law.toMeasure)
instance (p : CriticalEvenOffspring) : IsProbabilityMeasure p.streamLaw := by
unfold CriticalEvenOffspring.streamLaw
infer_instance
def CriticalEvenOffspring.streamStep (p : CriticalEvenOffspring) (j : ā) (Ļ : ā ā ā) : ā :=
p.standardStep (Ļ j)
lemma CriticalEvenOffspring.standardStep_memLp (p : CriticalEvenOffspring) :
MemLp p.standardStep 2 p.law.toMeasure := by
apply (memLp_two_iff_integrable_sq (by fun_prop)).mpr
simpa only [standardStep, div_pow] using p.integrable_step_sq.div_const (p.sigma^2)
lemma CriticalEvenOffspring.streamStep_memLp (p : CriticalEvenOffspring) (j : ā) :
MemLp (p.streamStep j) 2 p.streamLaw :=
p.standardStep_memLp.comp_measurePreserving
(measurePreserving_eval_infinitePi (fun _ : ā => p.law.toMeasure) j)
lemma CriticalEvenOffspring.streamStep_indep (p : CriticalEvenOffspring) :
iIndepFun p.streamStep p.streamLaw :=
iIndepFun_infinitePi (fun _ => measurable_of_countable p.standardStep)
lemma CriticalEvenOffspring.streamStep_ident (p : CriticalEvenOffspring) (j : ā) :
IdentDistrib (p.streamStep j) (p.streamStep 0) p.streamLaw p.streamLaw :=
((measurePreserving_eval_infinitePi (fun _ : ā => p.law.toMeasure) j).hasLaw.identDistrib
(measurePreserving_eval_infinitePi (fun _ : ā => p.law.toMeasure) 0).hasLaw).comp
(measurable_of_countable p.standardStep)
lemma CriticalEvenOffspring.streamStep_integral (p : CriticalEvenOffspring) (j : ā) :
ā« Ļ, p.streamStep j Ļ āp.streamLaw = 0 := by
calc
_ = ā« k, p.standardStep k āp.law.toMeasure :=
(measurePreserving_eval_infinitePi (fun _ : ā => p.law.toMeasure) j).hasLaw.integral_comp
(by fun_prop)
_ = 0 := p.integral_standardStep
lemma CriticalEvenOffspring.streamStep_integral_sq (p : CriticalEvenOffspring) (j : ā) :
ā« Ļ, p.streamStep j Ļ ^ 2 āp.streamLaw = 1 := by
calc
_ = ā« k, p.standardStep k ^ 2 āp.law.toMeasure :=
(measurePreserving_eval_infinitePi (fun _ : ā => p.law.toMeasure) j).hasLaw.integral_comp
(by fun_prop)
_ = 1 := p.integral_standardStep_sq
theorem CriticalEvenOffspring.streamWalk_CLT (p : CriticalEvenOffspring)
{Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} [IsProbabilityMeasure ν]
{B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B ν) :
TendstoInDistribution (scaledWalk p.streamStep) atTop (brownianPath B)
(fun _ => p.streamLaw) ν :=
iid_scaledWalk_CLT p.streamStep (fun _ => by unfold streamStep; fun_prop)
(p.streamStep_memLp 0) (p.streamStep_integral 0) (p.streamStep_integral_sq 0)
p.streamStep_indep p.streamStep_ident hB
def CriticalEvenOffspring.iidWalk (p : CriticalEvenOffspring) (N : ā)
(d : Fin N ā ā) : C(unitInterval, ā) :=
interpolation N (fun i =>
(ā j : Fin N, if j.val < i.val then p.standardStep (d j) else 0) / Real.sqrt N)
lemma CriticalEvenOffspring.iidWalk_measurable (p : CriticalEvenOffspring) (N : ā) :
@Measurable (Fin N ā ā) C(unitInterval, ā) _ (borel _) (p.iidWalk N) :=
measurable_of_countable _
lemma CriticalEvenOffspring.stream_restrict_law (p : CriticalEvenOffspring) (N : ā) :
HasLaw (fun Ļ : ā ā ā => fun i : Fin N => Ļ i.val) (p.iidLaw N) p.streamLaw := by
refine āØ(Measurable.of_eval (fun index => measurable_pi_apply index.val)).aemeasurable, ?_ā©
simpa only [streamLaw, iidLaw, Measure.infinitePi_eq_pi] using
(Measure.map_infinitePi_infinitePi_of_inj (P := fun _ : ā => p.law.toMeasure)
(@Fin.val_injective N))
lemma CriticalEvenOffspring.iidWalk_restrict (p : CriticalEvenOffspring) (N : ā) (Ļ : ā ā ā) :
p.iidWalk N (fun i => Ļ i.val) = scaledWalk p.streamStep N Ļ := by
unfold iidWalk scaledWalk
congr 1
funext i
congr 1
rw [ā Finset.sum_filter]
apply Finset.sum_bij (fun j _ => j.val)
Ā· intro j hj
exact Finset.mem_range.mpr (Finset.mem_filter.mp hj).2
Ā· intro a ha b hb hab
exact Fin.ext hab
Ā· intro j hj
have hjN : j < N := (Finset.mem_range.mp hj).trans_le (Nat.le_of_lt_succ i.isLt)
exact āØāØj,hjNā©, Finset.mem_filter.mpr āØFinset.mem_univ _, Finset.mem_range.mp hjā©, rflā©
Ā· intro j hj
rfl
theorem CriticalEvenOffspring.iidWalk_CLT (p : CriticalEvenOffspring)
{Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} [IsProbabilityMeasure ν]
{B : āā„0 ā Ī© ā ā} (hB : IsBrownianReal B ν) :
TendstoInDistribution p.iidWalk atTop (brownianPath B) p.iidLaw ν := by
refine āØfun n => (p.iidWalk_measurable n).aemeasurable,
brownianPath_aemeasurable hB, ?_ā©
have heq (N : ā) : (p.iidLaw N).map (p.iidWalk N) =
p.streamLaw.map (scaledWalk p.streamStep N) := by
rw [ā (p.stream_restrict_law N).map_eq, Measure.map_map (p.iidWalk_measurable N)
(Measurable.of_eval (fun index => measurable_pi_apply index.val))]
congr 1
funext Ļ
exact p.iidWalk_restrict N Ļ
simpa only [heq] using (p.streamWalk_CLT hB).tendsto
def iidSplit (m r : ā) : (Fin (m+r) ā ā) āįµ ((Fin m ā ā) Ć (Fin r ā ā)) :=
(MeasurableEquiv.piCongrLeft (fun _ : Fin (m+r) => ā) finSumFinEquiv).symm.trans
(MeasurableEquiv.sumPiEquivProdPi (fun _ : Fin m ā Fin r => ā))
@[simp] lemma iidSplit_fst (m r : ā) (d : Fin (m+r) ā ā) :
(iidSplit m r d).1 = fun i => d (Fin.castAdd r i) := rfl
@[simp] lemma iidSplit_snd (m r : ā) (d : Fin (m+r) ā ā) :
(iidSplit m r d).2 = fun i => d (Fin.natAdd m i) := rfl
def stopTime (t : unitInterval) : C(unitInterval,unitInterval) where
toFun s := min s t
continuous_toFun := continuous_id.min continuous_const
def stopPath (t : unitInterval) (f : C(unitInterval,ā)) : C(unitInterval,ā) :=
f.comp (stopTime t)
lemma stopPath_apply (t s : unitInterval) (f : C(unitInterval,ā)) :
stopPath t f s = f (min s t) := rfl
lemma stopPath_lipschitz (t : unitInterval) : LipschitzWith 1 (stopPath t) := by
apply LipschitzWith.of_dist_le_mul
intro f g
simp only [NNReal.coe_one,one_mul]
apply (ContinuousMap.dist_le (dist_nonneg)).mpr
intro s
exact ContinuousMap.dist_apply_le_dist (min s t)
lemma continuous_stopPath (t : unitInterval) : Continuous (stopPath t) :=
(stopPath_lipschitz t).continuous
lemma CriticalEvenOffspring.iidWalk_endpoint (p : CriticalEvenOffspring) {N : ā}
(hN : 0 < N) (d : Fin N ā ā) :
p.iidWalk N d 1 = (totalStep d:ā)/(p.sigma*Real.sqrt N) := by
have hg : gridPoint N (Fin.last N) = 1 := by
apply Subtype.ext
simp [gridPoint,hN.ne']
unfold iidWalk
rw [ā hg,interpolation_gridPoint hN]
simp only [Fin.val_last,Fin.is_lt,ite_true]
simp_rw [standardStep]
rw [ā Finset.sum_div]
have he : (ā j : Fin N, ((d j:ā)-1)) = (totalStep d:ā) := by
simp [totalStep]
rw [he,div_div]
lemma CriticalEvenOffspring.iidWalk_agree_prefix (p : CriticalEvenOffspring)
{N m : ā} {d e : Fin N ā ā} {t : unitInterval}
(ht : (N:ā)*(t:ā) ⤠m) (hde : ā j : Fin N, j.val < m ā d j=e j) :
stopPath t (p.iidWalk N d) = stopPath t (p.iidWalk N e) := by
ext s
change interpolation N _ (min s t) = interpolation N _ (min s t)
rw [interpolation_apply,interpolation_apply]
apply Finset.sum_congr rfl
intro i _
by_cases hz : hat N i.val (min s t)=0
Ā· simp only [hz,mul_zero]
Ā· have hi := hat_support hz
have hist : ((min s t:unitInterval):ā) ⤠(t:ā) := by exact min_le_right s t
have hi' : i.val ⤠m := by
have hh : (i.val:ā) < (m:ā)+1 := by
have hai := (abs_lt.mp hi).1
have hmul := mul_le_mul_of_nonneg_left hist (Nat.cast_nonneg N (α := ā))
linarith
exact Nat.le_of_lt_succ (by exact_mod_cast hh)
congr 1
congr 1
apply Finset.sum_congr rfl
intro j _
by_cases hj : j.val < i.val
Ā· rw [ite_eq_left hj,ite_eq_left hj,hde j (hj.trans_le hi')]
Ā· simp only [ite_eq_right hj]
def CriticalEvenOffspring.prefixWalk (p : CriticalEvenOffspring) (m r : ā)
(t : unitInterval) (d : Fin m ā ā) : C(unitInterval,ā) :=
stopPath t (p.iidWalk (m+r) ((iidSplit m r).symm (d,fun _ => 1)))
lemma CriticalEvenOffspring.prefixWalk_eq (p : CriticalEvenOffspring) (m r : ā)
{t : unitInterval} (ht : ((m+r:ā):ā)*(t:ā) ⤠m) (d : Fin (m+r) ā ā) :
p.prefixWalk m r t (iidSplit m r d).1 = stopPath t (p.iidWalk (m+r) d) := by
apply p.iidWalk_agree_prefix ht
intro j hj
let i : Fin m := āØj.val,hjā©
have he : Fin.castAdd r i = j := Fin.ext rfl
rw [ā he]
exact congrFun (congrArg Prod.fst ((iidSplit m r).apply_symm_apply
((iidSplit m r d).1,fun _ => 1))) i
lemma norm_tsum_smul_lt_one {α : Type*} [DecidableEq α]
(w : α ā ā) (hw : ā k, 0 ⤠w k) (hs : HasSum w 1)
(z : α ā ā) (hz : ā k, āz kā = 1)
{a b : α} (hab : a ā b) (ha : 0 < w a) (hb : 0 < w b)
(hne : z a ā z b) : āā' k, w k ⢠z kā < 1 := by
have hnorm : ā k, āw k ⢠z kā = w k := by
intro k
rw [norm_smul, Real.norm_of_nonneg (hw k), hz, mul_one]
have hsumNorm : Summable (fun k => āw k ⢠z kā) := by simpa only [hnorm] using hs.summable
have hsum : Summable (fun k => w k ⢠z k) := hsumNorm.of_norm
have hstrict : āw a ⢠z a + w b ⢠z bā < w a + w b := by
have hraw : āw a ⢠z a + w b ⢠z bā < āw a ⢠z aā + āw b ⢠z bā := by
apply norm_add_lt_of_not_sameRay
intro hr
have he := hr.norm_smul_eq
rw [hnorm a, hnorm b, smul_smul, smul_smul, mul_comm (w b) (w a)] at he
exact hne ((smul_right_injective ā (mul_pos ha hb).ne' he).symm)
simpa only [hnorm] using hraw
have hdecomp := hsum.sum_add_tsum_compl (s := {a,b})
have hwdecomp := hs.summable.sum_add_tsum_compl (s := {a,b})
simp only [Finset.sum_pair hab] at hdecomp hwdecomp
rw [hs.tsum_eq] at hwdecomp
rw [ā hdecomp]
calc
āw a ⢠z a + w b ⢠z b + ā' k : {k : α // k ā ({a,b} : Finset α)}, w k.val ⢠z k.valā ā¤
āw a ⢠z a + w b ⢠z bā +
āā' k : {k : α // k ā ({a,b} : Finset α)}, w k.val ⢠z k.valā := norm_add_le _ _
_ < w a + w b + ā' k : {k : α // k ā ({a,b} : Finset α)}, w k.val := by
apply add_lt_add_of_lt_of_le hstrict
simpa only [hnorm] using norm_tsum_le_tsum_norm (hsumNorm.subtype _)
_ = 1 := hwdecomp
lemma CriticalEvenOffspring.charFun_tsum (p : CriticalEvenOffspring) (t : ā) :
charFun (p.law.toMeasure.map p.standardStep) t =
ā' k, p.mass k ⢠Complex.exp ((t * p.standardStep k : ā) * Complex.I) := by
rw [charFun_apply_real, integral_map (by fun_prop) (by fun_prop)]
simp only [ā Complex.ofReal_mul]
apply p.integral_eq_tsum
simpa only [Complex.norm_exp_ofReal_mul_I, mul_one] using p.total.summable
lemma CriticalEvenOffspring.charFun_lt_one (p : CriticalEvenOffspring) {t : ā}
(ht : t ā 0) (hbound : |t| ⤠p.sigma * Real.pi / 2) :
ācharFun (p.law.toMeasure.map p.standardStep) tā < 1 := by
rw [p.charFun_tsum]
apply norm_tsum_smul_lt_one p.mass p.nonneg p.total
(fun k => Complex.exp ((t * p.standardStep k : ā) * Complex.I))
(fun k => Complex.norm_exp_ofReal_mul_I _) (by norm_num : (0 : ā) ā 2)
p.zero_pos p.two_pos
intro he
have hts : |t / p.sigma| ⤠Real.pi / 2 := by
rw [abs_div, abs_of_pos p.sigma_pos, div_le_iffā p.sigma_pos]
nlinarith [hbound]
have hli : -Real.pi < -(t / p.sigma) := by
have := (abs_le.mp hts).2
linarith [Real.pi_pos]
have hui : -(t / p.sigma) ⤠Real.pi := by
have := (abs_le.mp hts).1
linarith [Real.pi_pos]
have hlj : -Real.pi < t / p.sigma := by
have := (abs_le.mp hts).1
linarith [Real.pi_pos]
have huj : t / p.sigma ⤠Real.pi := by
have := (abs_le.mp hts).2
linarith [Real.pi_pos]
have h0 : t * p.standardStep 0 = -(t / p.sigma) := by simp [standardStep, div_eq_mul_inv]
have h2 : t * p.standardStep 2 = t / p.sigma := by norm_num [standardStep, div_eq_mul_inv]
rw [h0, h2] at he
have hx := Complex.exp_inj_of_neg_pi_lt_of_le_pi
(by simpa using hli) (by simpa using hui)
(by simpa using hlj) (by simpa using huj) he
have hi := congrArg Complex.im hx
simp only [Complex.mul_I_im, Complex.ofReal_re] at hi
have hz : t / p.sigma = 0 := by linarith
exact ht ((div_eq_zero_iff).mp hz |>.resolve_right p.sigma_pos.ne')
lemma CriticalEvenOffspring.charFun_compact_gap (p : CriticalEvenOffspring)
{ε : ā} (hε : 0 < ε) :
ā Ļ : ā, 0 ā¤ Ļ ā§ Ļ < 1 ā§ ā t : ā,
ε ⤠|t| ā |t| ⤠p.sigma * Real.pi / 2 ā
ācharFun (p.law.toMeasure.map p.standardStep) tā ā¤ Ļ := by
let K := {t : ā | ε ⤠|t| ā§ |t| ⤠p.sigma * Real.pi / 2}
have hcompact : IsCompact K := by
apply (isCompact_Icc (a := -(p.sigma * Real.pi / 2))
(b := p.sigma * Real.pi / 2)).of_isClosed_subset
Ā· exact (isClosed_le continuous_const continuous_abs).inter
(isClosed_le continuous_abs continuous_const)
Ā· intro t ht
exact abs_le.mp ht.2
by_cases hne : K.Nonempty
Ā· obtain āØt, ht, hmaxā© := hcompact.exists_isMaxOn hne
((continuous_charFun (μ := p.law.toMeasure.map p.standardStep)).norm.continuousOn)
refine āØācharFun (p.law.toMeasure.map p.standardStep) tā, norm_nonneg _, ?_, ?_ā©
Ā· apply p.charFun_lt_one _ ht.2
intro hz
have := ht.1
simp only [hz, abs_zero] at this
linarith
Ā· intro u hu hu'
exact hmax āØhu, hu'ā©
Ā· refine āØ0, le_rfl, zero_lt_one, ?_ā©
intro t ht ht'
exact (hne āØt, ht, ht'ā©).elim
lemma CriticalEvenOffspring.charFun_global_gaussian (p : CriticalEvenOffspring) :
ā c : ā, 0 < c ā§ ā t : ā, |t| ⤠p.sigma * Real.pi / 2 ā
ācharFun (p.law.toMeasure.map p.standardStep) tā ⤠Real.exp (-c * t^2) := by
obtain āØĪ“, hĪ“, hlocalā© := p.charFun_gaussian_bound
obtain āØĻ, _, hĻ, hgapā© := p.charFun_compact_gap hĪ“
let a := p.sigma * Real.pi / 2
have ha : 0 < a := div_pos (mul_pos p.sigma_pos Real.pi_pos) (by norm_num)
let c := min (1/4 : ā) ((1-Ļ)/a^2)
have hc : 0 < c := lt_min (by norm_num) (div_pos (sub_pos.mpr hĻ) (sq_pos_of_pos ha))
refine āØc, hc, ?_ā©
intro t ht
by_cases hsmall : |t| ⤠Γ
Ā· refine (hlocal t hsmall).trans (Real.exp_le_exp.mpr ?_)
have := mul_le_mul_of_nonneg_right (min_le_left (1/4 : ā) ((1-Ļ)/a^2)) (sq_nonneg t)
change c * t^2 ⤠(1/4 : ā) * t^2 at this
linarith
Ā· have hta : t^2 ⤠a^2 := by simpa only [sq_abs] using (sq_le_sqā (abs_nonneg t) ha.le).mpr ht
have hca : c * a^2 ⤠1-Ļ := by
have h := min_le_right (1/4 : ā) ((1-Ļ)/a^2)
exact (le_div_iffā (sq_pos_of_pos ha)).mp h
have hct := mul_le_mul_of_nonneg_left hta hc.le
refine (hgap t (le_of_lt (lt_of_not_ge hsmall)) ht).trans ?_
have hexp := Real.add_one_le_exp (-c*t^2)
linarith
def CriticalEvenOffspring.fourierCutoff (p : CriticalEvenOffspring) (n : ā) (t : ā) : ā :=
if |t| ⤠(p.sigma * Real.pi / 2) * Real.sqrt (n+1) then
(charFun (p.law.toMeasure.map p.standardStep) (t / Real.sqrt (n+1)))^(n+1)
else 0
lemma CriticalEvenOffspring.cutoff_measurable (p : CriticalEvenOffspring) (n : ā) :
Measurable (p.fourierCutoff n) := by
apply Measurable.ite (measurableSet_le measurable_abs measurable_const)
Ā· exact ((continuous_charFun.comp (continuous_id.div_const _)).pow _).measurable
Ā· exact measurable_const
lemma CriticalEvenOffspring.cutoff_pointwise (p : CriticalEvenOffspring) (t : ā) :
Tendsto (fun n => p.fourierCutoff n t) atTop
(š (Complex.exp (-(t:ā)^2/2))) := by
have ha : 0 < p.sigma * Real.pi / 2 := div_pos (mul_pos p.sigma_pos Real.pi_pos) (by norm_num)
have hsqrt : Tendsto (fun n : ā => Real.sqrt (n+1)) atTop atTop :=
Real.tendsto_sqrt_atTop.comp (tendsto_atTop_add_const_right atTop 1 tendsto_natCast_atTop_atTop)
have hbound : āį¶ n : ā in atTop, |t| ⤠(p.sigma * Real.pi / 2) * Real.sqrt (n+1) :=
(hsqrt.const_mul_atTop ha).eventually_ge_atTop |t|
have hp := (p.charFun_power_limit t).comp (tendsto_add_atTop_nat 1)
apply hp.congr'
filter_upwards [hbound] with n hn
rw [fourierCutoff, ite_eq_left hn]
simp only [Function.comp_apply, Nat.cast_add, Nat.cast_one, div_eq_mul_inv, mul_comm]
lemma CriticalEvenOffspring.cutoff_gaussian_bound (p : CriticalEvenOffspring)
{c : ā} (hg : ā t : ā, |t| ⤠p.sigma * Real.pi / 2 ā
ācharFun (p.law.toMeasure.map p.standardStep) tā ⤠Real.exp (-c*t^2))
(n : ā) (t : ā) : āp.fourierCutoff n tā ⤠Real.exp (-c*t^2) := by
have hn : (0:ā) < n+1 := by positivity
have hs : 0 < Real.sqrt (n+1) := Real.sqrt_pos.mpr hn
unfold fourierCutoff
split_ifs with ht
Ā· rw [norm_pow]
have hb : |t / Real.sqrt (n+1)| ⤠p.sigma * Real.pi / 2 := by
rw [abs_div, abs_of_pos hs, div_le_iffā hs]
exact ht
calc
ācharFun (p.law.toMeasure.map p.standardStep) (t / Real.sqrt (n+1))ā^(n+1) ā¤
(Real.exp (-c*(t / Real.sqrt (n+1))^2))^(n+1) :=
pow_le_pow_leftā (norm_nonneg _) (hg _ hb) _
_ = Real.exp (-c*t^2) := by
rw [ā Real.exp_nat_mul]
congr 1
rw [div_pow, Real.sq_sqrt hn.le, Nat.cast_add, Nat.cast_one]
field_simp
Ā· simp only [norm_zero]
exact (Real.exp_pos _).le
lemma CriticalEvenOffspring.cutoff_L1_limit (p : CriticalEvenOffspring) :
Tendsto (fun n : ā => ā« t : ā,
āp.fourierCutoff n t - Complex.exp (-(t:ā)^2/2)ā)
atTop (š 0) := by
obtain āØc, hc, hgā© := p.charFun_global_gaussian
let bound : ā ā ā := fun t => Real.exp (-c*t^2) + Real.exp (-(1/2:ā)*t^2)
have hnorm (t : ā) : āComplex.exp (-(t:ā)^2/2)ā = Real.exp (-(1/2:ā)*t^2) := by
rw [Complex.norm_exp]
congr 1
simp only [Complex.neg_re, ā Complex.ofReal_pow, Complex.ofReal_re, Complex.div_ofNat]
ring
have hd := tendsto_integral_of_dominated_convergence (μ := volume)
(F := fun n t => āp.fourierCutoff n t - Complex.exp (-(t:ā)^2/2)ā)
(f := fun _ => (0:ā)) bound
(fun n => ((p.cutoff_measurable n).sub (by fun_prop)).norm.aestronglyMeasurable)
((integrable_exp_neg_mul_sq hc).add (integrable_exp_neg_mul_sq (by norm_num)))
(fun n => ae_of_all _ fun t => ?_)
(ae_of_all _ fun t => ?_)
Ā· simpa using hd
Ā· rw [Real.norm_of_nonneg (norm_nonneg _)]
exact (norm_sub_le _ _).trans (add_le_add (p.cutoff_gaussian_bound hg n t) (hnorm t).le)
Ā· exact tendsto_iff_norm_sub_tendsto_zero.mp (p.cutoff_pointwise t)
lemma integral_exp_even_int (k : ā¤) :
(ā« t : ā in -(Real.pi / 2)..Real.pi / 2,
Complex.exp ((2 * k : ā) * t * Complex.I)) =
if k = 0 then (Real.pi : ā) else 0 := by
by_cases hk : k = 0
Ā· subst k
simp only [Int.cast_zero, mul_zero, zero_mul, Complex.exp_zero, ite_true,
intervalIntegral.integral_const, sub_neg_eq_add, Complex.real_smul]
push_cast
ring
Ā· rw [ite_eq_right hk]
have hc : (2 * k : ā) * Complex.I ā 0 := by
exact mul_ne_zero (mul_ne_zero (by norm_num) (by exact_mod_cast hk)) Complex.I_ne_zero
simp_rw [mul_right_comm (2 * (k : ā)) _ Complex.I]
rw [integral_exp_mul_complex hc]
have he : Complex.exp (((2 * k : ā) * Complex.I) * (Real.pi / 2 : ā)) =
Complex.exp (((2 * k : ā) * Complex.I) * (-(Real.pi / 2) : ā)) := by
apply Complex.exp_eq_exp_iff_exists_int.mpr
refine āØk, ?_ā©
push_cast
ring
rw [he, sub_self, zero_div]
lemma integral_exp_even_int' {k : ā¤} (hk : Even k) :
(ā« t : ā in -(Real.pi / 2)..Real.pi / 2,
Complex.exp ((k : ā) * t * Complex.I)) =
if k = 0 then (Real.pi : ā) else 0 := by
obtain āØr, rflā© := hk
convert integral_exp_even_int r using 1 <;> simp [two_mul]
lemma spanTwo_inversion {Ī© : Type*} [MeasurableSpace Ī©]
(P : Measure Ī©) [IsProbabilityMeasure P] (X : Ī© ā ā¤) (hX : Measurable X)
(j : ā¤) (hj : āįµ Ļ āP, Even (X Ļ - j)) :
(ā« t : ā in -(Real.pi / 2)..Real.pi / 2,
Complex.exp (-(j : ā) * t * Complex.I) *
charFun (P.map (fun Ļ => (X Ļ : ā))) t) =
(Real.pi : ā) * (P.real {Ļ | X Ļ = j} : ā) := by
let f : ā ā Ī© ā ā := fun t Ļ => Complex.exp (((X Ļ - j : ā¤) : ā) * t * Complex.I)
have hmeas : Measurable (Function.uncurry f) := by
dsimp [f, Function.uncurry]
fun_prop
let : IsFiniteMeasure (volume.restrict (uIoc (-(Real.pi/2)) (Real.pi/2))) :=
āØby simpā©
have hint : Integrable (Function.uncurry f)
((volume.restrict (uIoc (-(Real.pi/2)) (Real.pi/2))).prod P) := by
apply Integrable.of_bound hmeas.aestronglyMeasurable 1
exact ae_of_all _ fun z => by
dsimp [f, Function.uncurry]
have : ((X z.2 - j : ā¤) : ā) * z.1 = (((X z.2 - j : ā¤) : ā) * z.1 : ā) := by
push_cast
rfl
rw [this, Complex.norm_exp_ofReal_mul_I]
have hinner (t : ā) : Complex.exp (-(j : ā) * t * Complex.I) *
charFun (P.map (fun Ļ => (X Ļ : ā))) t = ā« Ļ, f t Ļ āP := by
rw [charFun_apply_real, integral_map (by fun_prop) (by fun_prop), ā integral_const_mul]
apply integral_congr_ae
exact ae_of_all _ fun Ļ => by
dsimp [f]
rw [ā Complex.exp_add]
congr 1
push_cast
ring
simp_rw [hinner]
rw [intervalIntegral_integral_swap hint]
have hcalc : (fun Ļ => ā« t in -(Real.pi/2)..Real.pi/2, f t Ļ) =įµ[P]
fun Ļ => if X Ļ = j then (Real.pi : ā) else 0 := by
filter_upwards [hj] with Ļ hĻ
dsimp [f]
rw [integral_exp_even_int' hĻ]
simp only [sub_eq_zero]
rw [integral_congr_ae hcalc]
have hm : MeasurableSet {Ļ | X Ļ = j} := hX (measurableSet_singleton j)
have heq : (fun Ļ => if X Ļ = j then (Real.pi : ā) else 0) =
{Ļ | X Ļ = j}.indicator (fun _ => (Real.pi : ā)) := by
ext Ļ
simp only [Set.indicator_apply, Set.mem_ofPred_eq]
rw [heq, integral_indicator hm, integral_const]
simp [Measure.real, Complex.real_smul, mul_comm]
def CriticalEvenOffspring.siteFourier (p : CriticalEvenOffspring)
(n : ā) (j : ā¤) (t : ā) : ā :=
p.fourierCutoff n t * Complex.exp ((-(j : ā) * t /
(p.sigma * Real.sqrt (n+1)) : ā) * Complex.I)
lemma CriticalEvenOffspring.siteFourier_integral (p : CriticalEvenOffspring) (n : ā) (j : ā¤) :
(ā« t : ā, p.siteFourier n j t) =
(p.sigma * Real.sqrt (n+1)) ā¢
ā« t : ā in -(Real.pi/2)..Real.pi/2,
Complex.exp (-(j : ā) * t * Complex.I) *
(charFun (p.law.toMeasure.map p.standardStep) (p.sigma * t))^(n+1) := by
let A := (p.sigma * Real.pi / 2) * Real.sqrt (n+1)
let scale := p.sigma * Real.sqrt (n+1)
let f : ā ā ā := fun t =>
(charFun (p.law.toMeasure.map p.standardStep) (t / Real.sqrt (n+1)))^(n+1) *
Complex.exp ((-(j : ā) * t / scale : ā) * Complex.I)
have hsqrt : 0 < Real.sqrt (n+1 : ā) := Real.sqrt_pos.mpr (by positivity)
have hscale : 0 < scale := mul_pos p.sigma_pos hsqrt
have hA : 0 ⤠A := mul_nonneg
(div_nonneg (mul_nonneg p.sigma_pos.le Real.pi_pos.le) (by norm_num)) hsqrt.le
have heq : p.siteFourier n j = (Icc (-A) A).indicator f := by
ext t
simp only [siteFourier, fourierCutoff, Set.indicator_apply, mem_Icc, ā abs_le]
split_ifs <;> simp [f, scale]
rw [heq, integral_indicator measurableSet_Icc, integral_Icc_eq_integral_Ioc,
ā intervalIntegral.integral_of_le (neg_le_self hA)]
have hlo : -(Real.pi/2) * scale = -A := by dsimp [scale, A]; ring
have hhi : (Real.pi/2) * scale = A := by dsimp [scale, A]; ring
have hsub := intervalIntegral.smul_integral_comp_mul_right
(a := -(Real.pi/2)) (b := Real.pi/2) f scale
rw [hlo, hhi] at hsub
rw [ā hsub]
congr 1
apply intervalIntegral.integral_congr
intro t _
dsimp [f]
have he : -(j : ā) * (t * scale) / scale = -(j : ā) * t := by
field_simp
have ht : t * scale / Real.sqrt (n+1) = p.sigma * t := by
dsimp [scale]
field_simp
rw [he, ht]
push_cast
ring
lemma CriticalEvenOffspring.siteFourier_probability (p : CriticalEvenOffspring)
(n : ā) (j : ā¤) (hj : Even (((n+1 : ā) : ā¤) + j)) :
(ā« t : ā, p.siteFourier n j t) =
(p.sigma * Real.sqrt (n+1) * Real.pi *
(p.iidLaw (n+1)).real {d | totalStep d = j} : ā) := by
have hi := spanTwo_inversion (p.iidLaw (n+1)) totalStep
(totalStep_measurable _) j (p.iid_totalStep_parity _ hj)
simp only [p.iid_charFun] at hi
rw [p.siteFourier_integral, hi]
simp only [Complex.real_smul, Complex.ofReal_mul]
ring
lemma CriticalEvenOffspring.iid_site_incompatible (p : CriticalEvenOffspring)
(N : ā) (j : ā¤) (hj : ¬Even ((N : ā¤) + j)) :
(p.iidLaw N).real {d | totalStep d = j} = 0 := by
rw [measureReal_eq_zero_iff]
apply measure_eq_zero_iff_ae_notMem.mpr
filter_upwards [p.iid_ae_even N] with d hd
intro heq
apply hj
have heven : Even (ā i, d i : ā) := Finset.even_sum d (fun i _ => hd i)
have hcast : Even ((ā i, d i : ā) : ā¤) := by exact_mod_cast heven
have hs : (N : ā¤) + j = (ā i, d i : ā) := by
rw [totalStep_eq_sum_sub] at heq
omega
rwa [hs]
theorem CriticalEvenOffspring.iid_site_uniform_bound (p : CriticalEvenOffspring) :
ā C : ā, 0 < C ā§ ā (n : ā) (j : ā¤),
Real.sqrt (n+1) * (p.iidLaw (n+1)).real {d | totalStep d = j} ⤠C := by
obtain āØc, hc, hgā© := p.charFun_global_gaussian
have hs := p.sigma_pos
refine āØReal.sqrt (Real.pi / c) / (p.sigma * Real.pi), by positivity, ?_ā©
intro n j
by_cases hj : Even (((n+1 : ā) : ā¤) + j)
Ā· have hnorm : āā« t : ā, p.siteFourier n j tā ⤠Real.sqrt (Real.pi / c) := by
have hbound : āįµ t āvolume, āp.siteFourier n j tā ⤠Real.exp (-c*t^2) := by
apply ae_of_all
intro t
simpa only [siteFourier, norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one] using
p.cutoff_gaussian_bound hg n t
simpa only [integral_gaussian] using
norm_integral_le_of_norm_le (integrable_exp_neg_mul_sq hc) hbound
rw [p.siteFourier_probability n j hj, Complex.norm_real,
Real.norm_of_nonneg (by positivity)] at hnorm
rw [le_div_iffā (mul_pos p.sigma_pos Real.pi_pos)]
nlinarith
Ā· rw [p.iid_site_incompatible _ _ hj, mul_zero]
positivity
lemma totalStep_succAbove {N : ā} (d : Fin (N+1) ā ā) (i : Fin (N+1)) :
totalStep d = (d i : ā¤) - 1 + totalStep (fun j => d (i.succAbove j)) := by
exact Fin.sum_univ_succAbove (fun j => ((d j : ā¤) - 1)) i
lemma CriticalEvenOffspring.iid_coordinate_site (p : CriticalEvenOffspring)
(N : ā) (i : Fin (N+1)) (k : ā) (j : ā¤) :
(p.iidLaw (N+1)).real {d | d i = k ā§ totalStep d = j} =
p.mass k * (p.iidLaw N).real {d | totalStep d = j - ((k : ā¤) - 1)} := by
let e := MeasurableEquiv.piFinSuccAbove (fun _ : Fin (N+1) => ā) i
have hp : MeasurePreserving e (p.iidLaw (N+1)) (p.law.toMeasure.prod (p.iidLaw N)) :=
measurePreserving_piFinSuccAbove (fun _ => p.law.toMeasure) i
have hset : {d : Fin (N+1) ā ā | d i = k ā§ totalStep d = j} =
e ā»Ā¹' (({k} : Set ā) ĆĖ¢ {d : Fin N ā ā | totalStep d = j - ((k : ā¤) - 1)}) := by
ext d
change (d i = k ā§ totalStep d = j) ā
(d i = k ā§ totalStep (fun a => d (i.succAbove a)) = j - ((k : ā¤) - 1))
rw [totalStep_succAbove d i]
constructor <;> rintro āØhā, hāā© <;> refine āØhā, ?_ā© <;>
rw [hā] at * <;> omega
rw [measureReal_def, hset, hp.measure_preimage (by measurability),
Measure.prod_prod, ENNReal.toReal_mul, p.law_singleton,
ENNReal.toReal_ofReal (p.nonneg _)]
rfl
lemma CriticalEvenOffspring.law_real_set (p : CriticalEvenOffspring) (s : Set ā) :
p.law.toMeasure.real s = ā' k, s.indicator p.mass k := by
classical
rw [measureReal_def, p.law.toMeasure_apply (Set.to_countable s).measurableSet,
ENNReal.tsum_toReal_eq]
Ā· apply tsum_congr
intro k
by_cases hk : k ā s <;> simp [hk, p.nonneg]
Ā· intro k
by_cases hk : k ā s <;> simp [hk]
lemma real_measure_coordinate_decomposition {Ī© : Type*} [MeasurableSpace Ī©]
(μ : Measure Ī©) [IsFiniteMeasure μ] (f : Ī© ā ā) (hf : Measurable f)
(s : Set Ī©) (hs : MeasurableSet s) :
μ.real s = ā' k : ā, μ.real {Ļ | f Ļ = k ā§ Ļ ā s} := by
have hu : s = ā k : ā, {Ļ | f Ļ = k ā§ Ļ ā s} := by ext Ļ; simp
have hd : Pairwise (fun k l : ā => Disjoint {Ļ | f Ļ = k ā§ Ļ ā s}
{Ļ | f Ļ = l ā§ Ļ ā s}) := by
intro k l hkl
rw [Set.disjoint_left]
intro Ļ hĻ hĻ'
exact hkl (hĻ.1.symm.trans hĻ'.1)
conv_lhs => rw [measureReal_def, hu,
measure_iUnion hd (fun k => (hf (measurableSet_singleton k)).inter hs),
ENNReal.tsum_toReal_eq (fun _ => measure_ne_top _ _)]
rfl
lemma CriticalEvenOffspring.iid_coordinate_tail_sum (p : CriticalEvenOffspring)
(N : ā) (i : Fin (N+1)) (R : ā) (j : ā¤) :
(p.iidLaw (N+1)).real {d | R < (d i : ā) ā§ totalStep d = j} =
ā' k : ā, if R < (k : ā) then p.mass k *
(p.iidLaw N).real {d | totalStep d = j - ((k : ā¤) - 1)} else 0 := by
rw [real_measure_coordinate_decomposition _ (fun d => d i) (measurable_pi_apply i) _
(by measurability)]
simp only [Set.mem_ofPred_eq]
apply tsum_congr
intro k
by_cases hk : R < (k : ā)
Ā· rw [ite_eq_left hk]
have hs : {d : Fin (N+1) ā ā | d i = k ā§ R < (d i : ā) ā§ totalStep d = j} =
{d | d i = k ā§ totalStep d = j} := by
ext d
constructor
Ā· exact fun h => āØh.1, h.2.2ā©
Ā· rintro āØhā, hāā©
exact āØhā, hā.symm āø hk, hāā©
rw [hs, p.iid_coordinate_site]
Ā· rw [ite_eq_right hk]
have hs : {d : Fin (N+1) ā ā | d i = k ā§ R < (d i : ā) ā§ totalStep d = j} = ā
:= by
ext d
simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and]
intro hā hā _
exact hk (hā āø hā)
rw [hs, measureReal_empty]
lemma CriticalEvenOffspring.iid_coordinate_tail_bound (p : CriticalEvenOffspring)
{C : ā} (hC : ā (n : ā) (j : ā¤),
Real.sqrt (n+1) * (p.iidLaw (n+1)).real {d | totalStep d = j} ⤠C)
(n : ā) (i : Fin (n+2)) (R : ā) (j : ā¤) :
Real.sqrt (n+1) * (p.iidLaw (n+2)).real
{d | R < (d i : ā) ā§ totalStep d = j} ā¤
C * p.law.toMeasure.real {k | R < (k : ā)} := by
rw [p.iid_coordinate_tail_sum (n+1) i R j, p.law_real_set, ā tsum_mul_left, ā tsum_mul_left]
simp only [Set.indicator_apply, Set.mem_ofPred_eq]
have hmass : Summable (fun k : ā => if R < (k : ā) then p.mass k else 0) :=
p.total.summable.of_nonneg_of_le
(fun k => by split_ifs <;> simp [p.nonneg])
(fun k => by split_ifs <;> simp [p.nonneg])
have hm : Summable (fun k : ā => if R < (k : ā) then p.mass k *
(p.iidLaw (n+1)).real {d | totalStep d = j - ((k : ā¤) - 1)} else 0) := by
apply p.total.summable.of_nonneg_of_le
Ā· intro k
split_ifs
Ā· exact mul_nonneg (p.nonneg _) measureReal_nonneg
Ā· rfl
Ā· intro k
split_ifs
Ā· exact mul_le_of_le_one_right (p.nonneg _) measureReal_le_one
Ā· exact p.nonneg _
apply Summable.tsum_le_tsum _ (hm.mul_left _) (hmass.mul_left _)
intro k
split_ifs
Ā· have h := mul_le_mul_of_nonneg_left (hC n (j - ((k : ā¤) - 1))) (p.nonneg k)
nlinarith
Ā· simp
lemma CriticalEvenOffspring.iid_max_tail_bound (p : CriticalEvenOffspring)
{C : ā} (hC : ā (n : ā) (j : ā¤),
Real.sqrt (n+1) * (p.iidLaw (n+1)).real {d | totalStep d = j} ⤠C)
(n : ā) (R : ā) (j : ā¤) :
Real.sqrt (n+1) * (p.iidLaw (n+2)).real
{d | (ā i, R < (d i : ā)) ā§ totalStep d = j} ā¤
(n+2 : ā) * C * p.law.toMeasure.real {k | R < (k : ā)} := by
have hu : {d : Fin (n+2) ā ā | (ā i, R < (d i : ā)) ā§ totalStep d = j} =
ā i : Fin (n+2), {d | R < (d i : ā) ā§ totalStep d = j} := by
ext d
simp only [Set.mem_ofPred_eq, mem_iUnion]
aesop
rw [hu]
calc
_ ⤠Real.sqrt (n+1) * ā i : Fin (n+2), (p.iidLaw (n+2)).real
{d | R < (d i : ā) ā§ totalStep d = j} :=
mul_le_mul_of_nonneg_left (measureReal_iUnion_fintype_le _) (Real.sqrt_nonneg _)
_ ⤠ā _i : Fin (n+2), C * p.law.toMeasure.real {k | R < (k : ā)} := by
rw [Finset.mul_sum]
apply Finset.sum_le_sum
intro i _
exact p.iid_coordinate_tail_bound hC n i R j
_ = _ := by simp [Nat.cast_add, Nat.cast_ofNat, mul_assoc]
lemma gaussian_fourier_shift (x : ā) :
(ā« t : ā, Complex.exp (-(t:ā)^2/2) *
Complex.exp ((-x*t : ā) * Complex.I)) =
(Real.sqrt (2*Real.pi) * Real.exp (-x^2/2) : ā) := by
have h := fourierIntegral_gaussian (b := (1/2:ā)) (by norm_num) (-(x:ā))
have hpow : (Real.pi / (1/2:ā)) ^ (1/2:ā) = (Real.sqrt (2*Real.pi) : ā) := by
rw [Real.sqrt_eq_rpow, Complex.ofReal_cpow (by positivity)]
push_cast
congr 1
ring
rw [hpow] at h
convert h using 1
Ā· apply integral_congr_ae
filter_upwards [] with t
rw [mul_comm]
congr 2 <;> push_cast <;> ring
Ā· push_cast
congr 2
ring
lemma gaussian_phase_integrable (x : ā) :
Integrable (fun t : ā => Complex.exp (-(t:ā)^2/2) *
Complex.exp ((-x*t : ā) * Complex.I)) := by
apply (integrable_exp_neg_mul_sq (show (0:ā)<1/2 by norm_num)).mono' (by fun_prop)
filter_upwards [] with t
rw [norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one, Complex.norm_exp]
apply le_of_eq
congr 1
simp only [Complex.neg_re, ā Complex.ofReal_pow, Complex.ofReal_re, Complex.div_ofNat]
ring
lemma CriticalEvenOffspring.siteFourier_integrable (p : CriticalEvenOffspring)
(n : ā) (j : ā¤) : Integrable (p.siteFourier n j) := by
obtain āØc, hc, hgā© := p.charFun_global_gaussian
apply (integrable_exp_neg_mul_sq hc).mono' ?_ ?_
Ā· exact ((p.cutoff_measurable n).mul (by fun_prop)).aestronglyMeasurable
Ā· filter_upwards [] with t
simpa only [siteFourier, norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one] using
p.cutoff_gaussian_bound hg n t
def CriticalEvenOffspring.localCLTError (p : CriticalEvenOffspring) (n : ā) : ā :=
ā« t : ā, āp.fourierCutoff n t - Complex.exp (-(t:ā)^2/2)ā
lemma CriticalEvenOffspring.siteFourier_gaussian_error (p : CriticalEvenOffspring)
(n : ā) (j : ā¤) :
ā(ā« t : ā, p.siteFourier n j t) -
(Real.sqrt (2*Real.pi) * Real.exp (-((j:ā)/(p.sigma*Real.sqrt (n+1)))^2/2) : ā)ā ā¤
p.localCLTError n := by
let x : ā := (j:ā)/(p.sigma*Real.sqrt (n+1))
have heq (t : ā) : -(j:ā)*t/(p.sigma*Real.sqrt (n+1)) = -x*t := by
dsimp [x]
ring
change ā(ā« t : ā, p.siteFourier n j t) -
(Real.sqrt (2*Real.pi) * Real.exp (-x^2/2) : ā)ā ⤠_
rw [ā gaussian_fourier_shift x, ā integral_sub (p.siteFourier_integrable n j)
(gaussian_phase_integrable x)]
have hn (t : ā) : āp.siteFourier n j t -
Complex.exp (-(t:ā)^2/2) * Complex.exp ((-x*t:ā)*Complex.I)ā =
āp.fourierCutoff n t - Complex.exp (-(t:ā)^2/2)ā := by
rw [siteFourier, heq, ā sub_mul, norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one]
calc
_ ⤠⫠t : ā, āp.siteFourier n j t -
Complex.exp (-(t:ā)^2/2) * Complex.exp ((-x*t:ā)*Complex.I)ā :=
norm_integral_le_integral_norm _
_ = _ := by simp only [hn, localCLTError]
theorem CriticalEvenOffspring.uniform_local_limit (p : CriticalEvenOffspring) :
ā E : ā ā ā, (ā n, 0 ⤠E n) ā§ Tendsto E atTop (š 0) ā§
ā (n : ā) (j : ā¤), Even (((n+1:ā):ā¤)+j) ā
|Real.sqrt (n+1) * (p.iidLaw (n+1)).real {d | totalStep d = j} -
(Real.sqrt (2*Real.pi)/(p.sigma*Real.pi)) *
Real.exp (-((j:ā)/(p.sigma*Real.sqrt (n+1)))^2/2)| ⤠E n := by
refine āØfun n => p.localCLTError n / (p.sigma*Real.pi), fun n => ?_, ?_, ?_ā©
Ā· exact div_nonneg (integral_nonneg (fun _ => norm_nonneg _))
(mul_pos p.sigma_pos Real.pi_pos).le
Ā· simpa only [zero_div, localCLTError] using p.cutoff_L1_limit.div_const (p.sigma*Real.pi)
Ā· intro n j hj
have h := p.siteFourier_gaussian_error n j
rw [p.siteFourier_probability n j hj, ā Complex.ofReal_sub, Complex.norm_real,
Real.norm_eq_abs] at h
have hs : 0 < p.sigma*Real.pi := mul_pos p.sigma_pos Real.pi_pos
have heq :
(Real.sqrt (n+1) * (p.iidLaw (n+1)).real {d | totalStep d = j} -
(Real.sqrt (2*Real.pi)/(p.sigma*Real.pi)) *
Real.exp (-((j:ā)/(p.sigma*Real.sqrt (n+1)))^2/2)) * (p.sigma*Real.pi) =
p.sigma * Real.sqrt (n+1) * Real.pi * (p.iidLaw (n+1)).real {d | totalStep d = j} -
Real.sqrt (2*Real.pi) * Real.exp (-((j:ā)/(p.sigma*Real.sqrt (n+1)))^2/2) := by
field_simp [p.sigma_pos.ne']
rw [ā heq, abs_mul, abs_of_pos hs] at h
exact (le_div_iffā hs).2 h
lemma gaussianProfile_hasDerivAt (x : ā) :
HasDerivAt (fun y : ā => Real.exp (-y^2/2)) (-x*Real.exp (-x^2/2)) x := by
convert ((((hasDerivAt_id x).pow 2).neg.div_const 2).exp) using 1 <;>
simp only [id_eq, Pi.neg_apply, Pi.pow_apply]
ring
lemma gaussianProfile_deriv_bound (x : ā) : |(-x)*Real.exp (-x^2/2)| ⤠1 := by
have hx : |x| ⤠Real.exp (x^2/2) := by
have he := Real.add_one_le_exp (x^2/2)
have hs := sq_nonneg (|x|-1)
nlinarith [sq_abs x]
have heq : -x^2/2 = -(x^2/2) := by ring
rw [abs_mul,abs_neg,abs_of_pos (Real.exp_pos _), heq, Real.exp_neg, ā div_eq_mul_inv]
exact (div_le_one (Real.exp_pos _)).mpr hx
lemma gaussianProfile_lipschitz : LipschitzWith 1 (fun x : ā => Real.exp (-x^2/2)) := by
apply lipschitzWith_of_nnnorm_deriv_le
(fun x => (gaussianProfile_hasDerivAt x).differentiableAt)
intro x
rw [(gaussianProfile_hasDerivAt x).deriv]
exact_mod_cast gaussianProfile_deriv_bound x
lemma gaussianProfile_sub_bound (x y : ā) :
|Real.exp (-x^2/2)-Real.exp (-y^2/2)| ⤠|x-y| := by
simpa only [NNReal.coe_one,one_mul,Real.dist_eq] using gaussianProfile_lipschitz.dist_le_mul x y
theorem CriticalEvenOffspring.local_limit_oscillation (p : CriticalEvenOffspring) :
ā E : ā ā ā, (ā n, 0 ⤠E n) ā§ Tendsto E atTop (š 0) ā§
ā (n : ā) (j k : ā¤), Even (((n+1:ā):ā¤)+j) ā Even (((n+1:ā):ā¤)+k) ā
|Real.sqrt (n+1) * ((p.iidLaw (n+1)).real {d | totalStep d = j} -
(p.iidLaw (n+1)).real {d | totalStep d = k})| ā¤
2*E n + (Real.sqrt (2*Real.pi)/(p.sigma*Real.pi)) *
|(j:ā)-(k:ā)| /(p.sigma*Real.sqrt (n+1)) := by
obtain āØE,hE,hEt,hboundā© := p.uniform_local_limit
refine āØE,hE,hEt,?_ā©
intro n j k hj hk
let a := p.sigma*Real.sqrt (n+1)
let b := Real.sqrt (2*Real.pi)/(p.sigma*Real.pi)
have ha : 0 < a := mul_pos p.sigma_pos (Real.sqrt_pos.mpr (by positivity))
have hb : 0 ⤠b := div_nonneg (by positivity) (mul_pos p.sigma_pos Real.pi_pos).le
have hg : |b*Real.exp (-((j:ā)/a)^2/2)-b*Real.exp (-((k:ā)/a)^2/2)| ā¤
b*|(j:ā)-(k:ā)| /a := by
rw [ā mul_sub, abs_mul, abs_of_nonneg hb]
have h := mul_le_mul_of_nonneg_left (gaussianProfile_sub_bound ((j:ā)/a) ((k:ā)/a)) hb
rw [ā sub_div,abs_div,abs_of_pos ha] at h
simpa only [mul_div_assoc] using h
have hj' := hbound n j hj
have hk' := hbound n k hk
have htā := abs_sub_le (Real.sqrt (n+1)*(p.iidLaw (n+1)).real {d | totalStep d = j})
(b*Real.exp (-((j:ā)/a)^2/2))
(Real.sqrt (n+1)*(p.iidLaw (n+1)).real {d | totalStep d = k})
have htā := abs_sub_le (b*Real.exp (-((j:ā)/a)^2/2))
(b*Real.exp (-((k:ā)/a)^2/2))
(Real.sqrt (n+1)*(p.iidLaw (n+1)).real {d | totalStep d = k})
rw [abs_sub_comm (b*Real.exp (-((k:ā)/a)^2/2))] at htā
rw [mul_sub]
change _ ⤠2*E n + b*|(j:ā)-(k:ā)| /a
change |_ - b*Real.exp (-((j:ā)/a)^2/2)| ⤠E n at hj'
change |_ - b*Real.exp (-((k:ā)/a)^2/2)| ⤠E n at hk'
linarith
theorem CriticalEvenOffspring.suffix_site_oscillation (p : CriticalEvenOffspring) :
ā E : ā ā ā, (ā n, 0 ⤠E n) ā§ Tendsto E atTop (š 0) ā§
ā (m r : ā) (j k : ā¤), Even (((m+(r+1):ā):ā¤)+j) ā
Even (((m+(r+1):ā):ā¤)+k) ā
āįµ d āp.iidLaw m,
|(p.iidLaw (r+1)).real {b | totalStep b=j-totalStep d} -
(p.iidLaw (r+1)).real {b | totalStep b=k-totalStep d}| ā¤
(2*E r + (Real.sqrt (2*Real.pi)/(p.sigma*Real.pi)) *
|(j:ā)-(k:ā)| /(p.sigma*Real.sqrt (r+1))) / Real.sqrt (r+1) := by
obtain āØE,hE,hEt,hbā© := p.local_limit_oscillation
refine āØE,hE,hEt,?_ā©
intro m r j k hj hk
filter_upwards [p.iid_ae_even m] with d hd
have hp : Even ((m:ā¤)+totalStep d) := by
rw [totalStep_eq_sum_sub]
have he : (m:ā¤)+((ā i, d i : ā):ā¤)-(m:ā¤) = ((ā i, d i : ā):ā¤) := by ring
rw [ā add_sub_assoc,he]
exact_mod_cast Finset.even_sum d (fun i _ => hd i)
have hj' : Even (((r+1:ā):ā¤)+(j-totalStep d)) := by
have he : (((r+1:ā):ā¤)+(j-totalStep d)) =
(((m+(r+1):ā):ā¤)+j)-((m:ā¤)+totalStep d) := by push_cast; ring
rw [he]
exact hj.sub hp
have hk' : Even (((r+1:ā):ā¤)+(k-totalStep d)) := by
have he : (((r+1:ā):ā¤)+(k-totalStep d)) =
(((m+(r+1):ā):ā¤)+k)-((m:ā¤)+totalStep d) := by push_cast; ring
rw [he]
exact hk.sub hp
have h := hb r (j-totalStep d) (k-totalStep d) hj' hk'
have hs : 0 < Real.sqrt (r+1) := Real.sqrt_pos.mpr (by positivity)
rw [abs_mul,abs_of_pos hs] at h
have he : ((j-totalStep d:ā¤):ā)-((k-totalStep d:ā¤):ā) = (j:ā)-(k:ā) := by
push_cast
ring
rw [he] at h
exact (le_div_iffā hs).mpr (by simpa only [mul_comm] using h)
lemma totalStep_split (m r : ā) (d : Fin (m+r) ā ā) :
totalStep d = totalStep (iidSplit m r d).1 + totalStep (iidSplit m r d).2 := by
exact Fin.sum_univ_add _
lemma iidSplit_preserving (μ : Measure ā) [SigmaFinite μ] (m r : ā) :
MeasurePreserving (iidSplit m r) (Measure.pi (fun _ : Fin (m+r) => μ))
((Measure.pi (fun _ : Fin m => μ)).prod (Measure.pi (fun _ : Fin r => μ))) := by
exact (measurePreserving_sumPiEquivProdPi (fun _ : Fin m ā Fin r => μ)).comp
(measurePreserving_piCongrLeft (fun _ : Fin (m+r) => μ) finSumFinEquiv).symm
lemma iid_prefix_test_endpoint (μ : Measure ā) [IsProbabilityMeasure μ]
(m r : ā) (j : ā¤) (F : (Fin m ā ā) ā ā) {M : ā}
(hM : 0 ⤠M) (hF : ā d, |F d| ⤠M) :
(ā« d, (if totalStep d = j then F (iidSplit m r d).1 else 0)
ā(Measure.pi (fun _ : Fin (m+r) => μ))) =
⫠a, F a * (Measure.pi (fun _ : Fin r => μ)).real
{b | totalStep b = j-totalStep a} ā(Measure.pi (fun _ : Fin m => μ)) := by
let f : ((Fin m ā ā) Ć (Fin r ā ā)) ā ā := fun x =>
if totalStep x.1 + totalStep x.2 = j then F x.1 else 0
have hf : Integrable f ((Measure.pi (fun _ : Fin m => μ)).prod
(Measure.pi (fun _ : Fin r => μ))) := by
apply (integrable_const M).mono' (by measurability)
filter_upwards [] with x
dsimp [f]
split
Ā· exact hF _
Ā· simpa only [abs_zero] using hM
have heq : (fun d => if totalStep d = j then F (iidSplit m r d).1 else 0) =
f ā iidSplit m r := by
funext d
simp only [Function.comp_apply,f,totalStep_split]
rw [heq]
change (ā« d, f (iidSplit m r d) ā(Measure.pi (fun _ : Fin (m+r) => μ))) = _
rw [(iidSplit_preserving μ m r).integral_comp' f,integral_prod f hf]
apply integral_congr_ae
filter_upwards [] with a
have hi : (fun b => f (a,b)) =
({b | totalStep b = j-totalStep a} : Set (Fin r ā ā)).indicator (fun _ => F a) := by
funext b
simp only [f, Set.indicator_apply, Set.mem_ofPred_eq]
simp only [show (totalStep a + totalStep b = j) ā
(totalStep b = j-totalStep a) by omega]
rw [hi, integral_indicator (by measurability),setIntegral_const]
simp only [smul_eq_mul, mul_comm]
lemma integral_cond_eq_div {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω)
(E : Set Ī©) (hE : MeasurableSet E) (F : Ī© ā ā) :
(ā« Ļ, F Ļ ācond μ E) = (ā« Ļ, E.indicator F Ļ āμ)/μ.real E := by
rw [ProbabilityTheory.cond,integral_smul_measure,integral_indicator hE,ENNReal.toReal_inv]
simp only [smul_eq_mul,measureReal_def,div_eq_mul_inv,mul_comm]
def endpointWindow (s : Finset ā¤) (w : ⤠ā ā) (z : ā¤) : ā :=
ā j ā s, if z=j then w j else 0
lemma endpointWindow_apply (s : Finset ā¤) (w : ⤠ā ā) (z : ā¤) :
endpointWindow s w z = if z ā s then w z else 0 := by
classical
simp [endpointWindow]
lemma iid_prefix_test_window (μ : Measure ā) [IsProbabilityMeasure μ]
(m r : ā) (s : Finset ā¤) (w : ⤠ā ā) (F : (Fin m ā ā) ā ā) {M : ā}
(hM : 0 ⤠M) (hF : ā d, |F d| ⤠M) :
(ā« d, F (iidSplit m r d).1 * endpointWindow s w (totalStep d)
ā(Measure.pi (fun _ : Fin (m+r) => μ))) =
ā« a, F a * (ā j ā s, w j * (Measure.pi (fun _ : Fin r => μ)).real
{b | totalStep b = j-totalStep a}) ā(Measure.pi (fun _ : Fin m => μ)) := by
classical
have hif (j : ā¤) : Integrable (fun d : Fin (m+r) ā ā =>
if totalStep d=j then F (iidSplit m r d).1 else 0)
(Measure.pi (fun _ : Fin (m+r) => μ)) := by
apply (integrable_const M).mono' (by measurability)
filter_upwards [] with d
split
Ā· exact hF _
Ā· simpa using hM
have hsite (j : ā¤) : Integrable (fun a : Fin m ā ā =>
F a*(Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=j-totalStep a})
(Measure.pi (fun _ : Fin m => μ)) := by
apply (integrable_const M).mono' (by measurability)
filter_upwards [] with a
change |F a*(Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=j-totalStep a}| ⤠M
rw [abs_mul,abs_of_nonneg measureReal_nonneg]
exact (mul_le_mul_of_nonneg_right (hF a) measureReal_nonneg).trans
(mul_le_of_le_one_right hM (measureReal_le_one))
have he (d : Fin (m+r) ā ā) :
F (iidSplit m r d).1 * endpointWindow s w (totalStep d) =
ā j ā s, w j*(if totalStep d=j then F (iidSplit m r d).1 else 0) := by
rw [endpointWindow,Finset.mul_sum]
apply Finset.sum_congr rfl
intro j _
split <;> ring
have he' (a : Fin m ā ā) :
F a * (ā j ā s, w j*(Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=j-totalStep a}) =
ā j ā s, w j*(F a*(Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=j-totalStep a}) := by
rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro j _
ring
simp_rw [he,he']
rw [integral_finsetSum s (fun j _ => (hif j).const_mul (w j)),
integral_finsetSum s (fun j _ => (hsite j).const_mul (w j))]
apply Finset.sum_congr rfl
intro j _
rw [integral_const_mul,integral_const_mul,iid_prefix_test_endpoint μ m r j F hM hF]
lemma normalized_integral_stability {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
{k l F : Ī© ā ā} {M a : ā}
(hk : Integrable k μ) (hl : Integrable l μ)
(hl0 : āįµ Ļ āμ, 0 ⤠l Ļ)
(hK : 0 < ā« Ļ, k Ļ āμ) (hL : 0 < ā« Ļ, l Ļ āμ)
(hF : AEStronglyMeasurable F μ) (hM : 0 ⤠M)
(hFM : āįµ Ļ āμ, |F Ļ| ⤠M)
(ha : ā« Ļ, |k Ļ-l Ļ| āμ ⤠a) :
|(ā« Ļ, F Ļ*k Ļ āμ)/(ā« Ļ, k Ļ āμ) -
(ā« Ļ, F Ļ*l Ļ āμ)/(ā« Ļ, l Ļ āμ)| ā¤
2*M*a/(ā« Ļ, k Ļ āμ) := by
have hFk : Integrable (fun Ļ => F Ļ*k Ļ) μ :=
(hk.norm.const_mul M).mono' (hF.mul hk.aestronglyMeasurable) (by
filter_upwards [hFM] with Ļ hĻ
simpa only [Real.norm_eq_abs,abs_mul] using mul_le_mul_of_nonneg_right hĻ (abs_nonneg (k Ļ)))
have hFl : Integrable (fun Ļ => F Ļ*l Ļ) μ :=
(hl.norm.const_mul M).mono' (hF.mul hl.aestronglyMeasurable) (by
filter_upwards [hFM] with Ļ hĻ
simpa only [Real.norm_eq_abs,abs_mul] using mul_le_mul_of_nonneg_right hĻ (abs_nonneg (l Ļ)))
let K := ā« Ļ, k Ļ āμ
let L := ā« Ļ, l Ļ āμ
let A := ā« Ļ, F Ļ*k Ļ āμ
let D := ā« Ļ, F Ļ*l Ļ āμ
have hAD : |A-D| ⤠M*a := by
rw [show A-D = ā« Ļ, F Ļ*(k Ļ-l Ļ) āμ by
simp only [A,D,mul_sub,integral_sub hFk hFl]]
calc
_ ⤠⫠Ļ, |F Ļ*(k Ļ-l Ļ)| āμ := by
simpa only [Real.norm_eq_abs] using
norm_integral_le_integral_norm (fun Ļ => F Ļ*(k Ļ-l Ļ))
_ ⤠⫠Ļ, M*|k Ļ-l Ļ| āμ := by
apply integral_mono_ae
Ā· simpa only [mul_sub, Pi.sub_apply, Real.norm_eq_abs] using (hFk.sub hFl).norm
Ā· exact (hk.sub hl).norm.const_mul M
Ā· filter_upwards [hFM] with Ļ hĻ
rw [abs_mul]
exact mul_le_mul_of_nonneg_right hĻ (abs_nonneg _)
_ ⤠M*a := by rw [integral_const_mul]; exact mul_le_mul_of_nonneg_left ha hM
have hKL : |L-K| ⤠a := by
calc
_ = |ā« Ļ, k Ļ-l Ļ āμ| := by rw [integral_sub hk hl]; exact abs_sub_comm _ _
_ ⤠⫠Ļ, |k Ļ-l Ļ| āμ := by
simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun Ļ => k Ļ-l Ļ)
_ ⤠a := ha
have hD : |D| ⤠M*L := by
calc
_ ⤠⫠Ļ, |F Ļ*l Ļ| āμ := by
simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun Ļ => F Ļ*l Ļ)
_ ⤠⫠Ļ, M*l Ļ āμ := by
apply integral_mono_ae hFl.norm (hl.const_mul M)
filter_upwards [hFM,hl0] with Ļ hĻ hlĻ
change |F Ļ*l Ļ| ⤠M*l Ļ
rw [abs_mul,abs_of_nonneg hlĻ]
exact mul_le_mul_of_nonneg_right hĻ hlĻ
_ = M*L := integral_const_mul _ _
have hA0 : 0 ⤠a := (integral_nonneg (fun _ => abs_nonneg _)).trans ha
have hK' : K ā 0 := hK.ne'
have hL' : L ā 0 := hL.ne'
have he : A/K-D/L = (A-D)/K + D*(L-K)/(K*L) := by
field_simp [hK',hL']
ring
change |A/K-D/L| ⤠2*M*a/K
rw [he]
calc
_ ⤠|(A-D)/K| + |D*(L-K)/(K*L)| := abs_add_le _ _
_ = |A-D|/K + |D| *|L-K|/(K*L) := by
rw [abs_div,abs_div,abs_mul,abs_of_pos hK,abs_of_pos (mul_pos hK hL)]
_ ⤠(M*a)/K + (M*L)*a/(K*L) := by
exact add_le_add (div_le_div_of_nonneg_right hAD hK.le)
(div_le_div_of_nonneg_right (mul_le_mul hD hKL (abs_nonneg _) (by positivity))
(mul_pos hK hL).le)
_ = _ := by field_simp [hK',hL']; ring
lemma finite_window_stability {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
[IsProbabilityMeasure μ] {ι : Type*} (s : Finset ι) (w : ι ā ā)
(k : ι ā Ī© ā ā) (kā F : Ī© ā ā) {M a : ā}
(hw : ā j ā s, 0 ⤠w j) (hW : 0 < ā j ā s, w j)
(hk : ā j ā s, Integrable (k j) μ) (hkā : Integrable kā μ)
(hk0 : ā j ā s, āįµ Ļ āμ, 0 ⤠k j Ļ)
(hK : 0 < ā« Ļ, kā Ļ āμ)
(hL : 0 < ā« Ļ, (ā j ā s, w j*k j Ļ) āμ)
(hF : AEStronglyMeasurable F μ) (hM : 0 ⤠M)
(hFM : āįµ Ļ āμ, |F Ļ| ⤠M)
(hd : ā j ā s, āįµ Ļ āμ, |kā Ļ-k j Ļ| ⤠a) :
|(ā« Ļ, F Ļ*kā Ļ āμ)/(ā« Ļ, kā Ļ āμ) -
(ā« Ļ, F Ļ*(ā j ā s, w j*k j Ļ) āμ)/
(ā« Ļ, (ā j ā s, w j*k j Ļ) āμ)| ⤠2*M*a/(ā« Ļ, kā Ļ āμ) := by
classical
let W := ā j ā s, w j
let l : Ī© ā ā := fun Ļ => (ā j ā s, w j*k j Ļ)/W
have hl' : Integrable (fun Ļ => ā j ā s, w j*k j Ļ) μ :=
integrable_finsetSum s (fun j hj => (hk j hj).const_mul (w j))
have hl : Integrable l μ := hl'.div_const W
have hl0 : āįµ Ļ āμ, 0 ⤠l Ļ := by
filter_upwards [(s.eventually_all).mpr hk0] with Ļ hĻ
exact div_nonneg (Finset.sum_nonneg (fun j hj => mul_nonneg (hw j hj) (hĻ j hj))) hW.le
have hLp : 0 < ā« Ļ, l Ļ āμ := by
dsimp [l]
rw [integral_div]
exact div_pos hL hW
have hdiff : āįµ Ļ āμ, |kā Ļ-l Ļ| ⤠a := by
filter_upwards [(s.eventually_all).mpr hd] with Ļ hĻ
have he : kā Ļ-l Ļ = (ā j ā s, w j*(kā Ļ-k j Ļ))/W := by
dsimp [l]
simp_rw [mul_sub]
rw [Finset.sum_sub_distrib, ā Finset.sum_mul]
dsimp [W]
field_simp [hW.ne']
rw [he,abs_div,abs_of_pos hW]
apply (div_le_iffā hW).mpr
calc
_ ⤠ā j ā s, |w j*(kā Ļ-k j Ļ)| := Finset.abs_sum_le_sum_abs _ _
_ ⤠ā j ā s, w j*a := by
apply Finset.sum_le_sum
intro j hj
rw [abs_mul,abs_of_nonneg (hw j hj)]
exact mul_le_mul_of_nonneg_left (hĻ j hj) (hw j hj)
_ = a*W := by rw [ā Finset.sum_mul,mul_comm]
have ha : ā« Ļ, |kā Ļ-l Ļ| āμ ⤠a := by
calc
_ ⤠⫠_, a āμ := integral_mono_ae (hkā.sub hl).norm (integrable_const a) (by
filter_upwards [hdiff] with Ļ hĻ
exact hĻ)
_ = a := by simp
have h := normalized_integral_stability hkā hl hl0 hK hLp hF hM hFM ha
have he : (ā« Ļ, F Ļ*l Ļ āμ)/(ā« Ļ, l Ļ āμ) =
(ā« Ļ, F Ļ*(ā j ā s, w j*k j Ļ) āμ)/
(ā« Ļ, (ā j ā s, w j*k j Ļ) āμ) := by
have hn : (ā« Ļ, F Ļ*l Ļ āμ) =
(ā« Ļ, F Ļ*(ā j ā s, w j*k j Ļ) āμ)/W := by
simp_rw [l, ā mul_div_assoc, integral_div]
rw [hn]
dsimp [l]
rw [integral_div]
exact div_div_div_cancel_rightā hW.ne' _ _
rw [he] at h
exact h
lemma iid_site_convolution (μ : Measure ā) [IsProbabilityMeasure μ]
(m r : ā) (j : ā¤) :
(Measure.pi (fun _ : Fin (m+r) => μ)).real {d | totalStep d=j} =
⫠a, (Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=j-totalStep a}
ā(Measure.pi (fun _ : Fin m => μ)) := by
have h := iid_prefix_test_endpoint μ m r j (fun _ => 1) (by norm_num : (0:ā) ⤠1)
(fun _ => by norm_num)
simp only [one_mul] at h
rw [show (fun d : Fin (m+r) ā ā => if totalStep d=j then (1:ā) else 0) =
({d | totalStep d=j} : Set (Fin (m+r) ā ā)).indicator (fun _ => 1) by funext d; simp [Set.indicator_apply],
integral_indicator (by measurability),setIntegral_const] at h
simpa only [smul_eq_mul,mul_one] using h
theorem iid_prefix_window_bound (μ : Measure ā) [IsProbabilityMeasure μ]
(m r : ā) (jā : ā¤) (s : Finset ā¤) (w : ⤠ā ā)
(hjā : jā ā s) (hw : ā j ā s, 0 ⤠w j) (hwā : 0 < w jā)
(hP : 0 < (Measure.pi (fun _ : Fin (m+r) => μ)).real {d | totalStep d=jā})
(F : (Fin m ā ā) ā ā) {M a : ā} (hM : 0 ⤠M) (hF : ā d, |F d| ⤠M)
(hd : ā j ā s, āįµ d ā(Measure.pi (fun _ : Fin m => μ)),
|(Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=jā-totalStep d} -
(Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=j-totalStep d}| ⤠a) :
|(ā« d, F (iidSplit m r d).1 ācond (Measure.pi (fun _ : Fin (m+r) => μ))
{d | totalStep d=jā}) -
(ā« d, F (iidSplit m r d).1 * endpointWindow s w (totalStep d)
ā(Measure.pi (fun _ : Fin (m+r) => μ))) /
(ā« d, endpointWindow s w (totalStep d) ā(Measure.pi (fun _ : Fin (m+r) => μ)))| ā¤
2*M*a/(Measure.pi (fun _ : Fin (m+r) => μ)).real {d | totalStep d=jā} := by
classical
let k : ⤠ā (Fin m ā ā) ā ā := fun j d =>
(Measure.pi (fun _ : Fin r => μ)).real {b | totalStep b=j-totalStep d}
have hk (j : ā¤) : Integrable (k j) (Measure.pi (fun _ : Fin m => μ)) := by
apply (integrable_const (1:ā)).mono' (measurable_of_countable (k j)).aestronglyMeasurable
filter_upwards [] with d
change |k j d| ⤠1
rw [abs_of_nonneg measureReal_nonneg]
exact measureReal_le_one
have hki (j : ā¤) : (ā« d, k j d ā(Measure.pi (fun _ : Fin m => μ))) =
(Measure.pi (fun _ : Fin (m+r) => μ)).real {d | totalStep d=j} :=
(iid_site_convolution μ m r j).symm
have hW : 0 < ā j ā s, w j := hwā.trans_le
(Finset.single_le_sum hw hjā)
have hL : 0 < ā« d, (ā j ā s, w j*k j d) ā(Measure.pi (fun _ : Fin m => μ)) := by
rw [integral_finsetSum s (fun j _ => (hk j).const_mul (w j))]
simp_rw [integral_const_mul,hki]
apply (mul_pos hwā hP).trans_le
apply Finset.single_le_sum _ hjā
intro j hj
exact mul_nonneg (hw j hj) measureReal_nonneg
have h := finite_window_stability s w k (k jā) F hw hW (fun j _ => hk j) (hk jā)
(fun _ _ => ae_of_all _ (fun _ => measureReal_nonneg)) (by rwa [hki]) hL
(by measurability) hM (ae_of_all _ hF) hd
have he : (ā« d, F (iidSplit m r d).1 ācond (Measure.pi (fun _ : Fin (m+r) => μ))
{d | totalStep d=jā}) =
(ā« d, F d*k jā d ā(Measure.pi (fun _ : Fin m => μ))) /
(ā« d, k jā d ā(Measure.pi (fun _ : Fin m => μ))) := by
rw [integral_cond_eq_div _ _ (by measurability)]
simp only [Set.indicator_apply,Set.mem_ofPred_eq]
rw [iid_prefix_test_endpoint μ m r jā F hM hF,hki]
have hn := iid_prefix_test_window μ m r s w F hM hF
have hden := iid_prefix_test_window μ m r s w (fun _ => 1) (by norm_num : (0:ā) ⤠1)
(fun _ => by norm_num)
simp only [one_mul] at hden
rw [he,hn,hden,hki]
rw [hki] at h
simpa only [k] using h
def softCutoff (ε x : ā) : ā := max 0 (1-|x|/ε)
lemma softCutoff_continuous (ε : ā) : Continuous (softCutoff ε) := by
unfold softCutoff
fun_prop
lemma softCutoff_nonneg (ε x : ā) : 0 ⤠softCutoff ε x := le_max_left _ _
lemma softCutoff_le_one {ε : ā} (hε : 0 < ε) (x : ā) : softCutoff ε x ⤠1 := by
apply max_le (by norm_num)
have := div_nonneg (abs_nonneg x) hε.le
linarith
lemma softCutoff_pos_iff {ε x : ā} (hε : 0 < ε) :
0 < softCutoff ε x ā |x| < ε := by
simp only [softCutoff, lt_max_iff, lt_self_iff_false, false_or,
sub_pos, div_lt_one hε]
lemma softCutoff_support {ε : ā} (hε : 0 < ε) :
Function.support (softCutoff ε) = Set.Ioo (-ε) ε := by
ext x
rw [Function.mem_support, ā (softCutoff_nonneg ε x).lt_iff_ne']
simp only [softCutoff_pos_iff hε, abs_lt,Set.mem_Ioo]
lemma softCutoff_integrable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
[IsFiniteMeasure μ] {Y : Ī© ā ā} (hY : AEMeasurable Y μ) {ε : ā} (hε : 0 < ε) :
Integrable (fun Ļ => softCutoff ε (Y Ļ)) μ := by
apply (integrable_const (1:ā)).mono'
((softCutoff_continuous ε).aestronglyMeasurable.comp_aemeasurable hY)
filter_upwards [] with Ļ
change āsoftCutoff ε (Y Ļ)ā ⤠(1:ā)
rw [Real.norm_eq_abs,abs_of_nonneg (softCutoff_nonneg _ _)]
exact softCutoff_le_one hε _
def latticeWindow (N : ā) (R : ā) : Finset ⤠:=
(Finset.Icc (-(āRāā : ā¤)) (āRāā : ā¤)).filter
(fun j => Even ((N:ā¤)+j) ā§ |(j:ā)| < R)
lemma mem_latticeWindow_iff (N : ā) {R : ā} (j : ā¤) :
j ā latticeWindow N R ā Even ((N:ā¤)+j) ā§ |(j:ā)| < R := by
classical
simp only [latticeWindow, Finset.mem_filter, Finset.mem_Icc]
constructor
Ā· exact fun h => h.2
Ā· intro h
have hb : |(j:ā)| ⤠(āRāā:ā) := h.2.le.trans (Nat.le_ceil R)
have hj := abs_le.mp hb
have hl : -(āRāā : ā¤) ⤠j := by exact_mod_cast hj.1
have hr : j ⤠(āRāā : ā¤) := by exact_mod_cast hj.2
exact āØāØhl,hrā©,hā©
lemma softCutoff_scaled_pos_iff {ε a : ā} (hε : 0 < ε) (ha : 0 < a) (j : ā¤) :
0 < softCutoff ε ((j:ā)/a) ā |(j:ā)| < ε*a := by
rw [softCutoff_pos_iff hε,abs_div,abs_of_pos ha,div_lt_iffā ha]
lemma endpointWindow_softCutoff (N : ā) {ε a : ā} (hε : 0 < ε) (ha : 0 < a)
(j : ā¤) (hj : Even ((N:ā¤)+j)) :
endpointWindow (latticeWindow N (ε*a)) (fun k => softCutoff ε ((k:ā)/a)) j =
softCutoff ε ((j:ā)/a) := by
rw [endpointWindow_apply]
split_ifs with h
Ā· rfl
Ā· have hn : ¬|(j:ā)| < ε*a := fun hh => h ((mem_latticeWindow_iff N j).mpr āØhj,hhā©)
have hz := not_lt.mp (fun hh => hn ((softCutoff_scaled_pos_iff hε ha j).mp hh))
exact (le_antisymm hz (softCutoff_nonneg ε _)).symm
lemma CriticalEvenOffspring.iid_endpointWindow_ae (p : CriticalEvenOffspring)
(N : ā) {ε a : ā} (hε : 0 < ε) (ha : 0 < a) :
āįµ d āp.iidLaw N,
endpointWindow (latticeWindow N (ε*a)) (fun k => softCutoff ε ((k:ā)/a)) (totalStep d) =
softCutoff ε ((totalStep d:ā)/a) := by
filter_upwards [p.iid_ae_even N] with d hd
apply endpointWindow_softCutoff N hε ha
rw [totalStep_eq_sum_sub]
have hh : (N:ā¤)+((ā i, d i : ā):ā¤)-(N:ā¤) = ((ā i, d i : ā):ā¤) := by ring
rw [ā add_sub_assoc,hh]
exact_mod_cast Finset.even_sum d (fun i _ => hd i)
theorem CriticalEvenOffspring.prefix_soft_bound (p : CriticalEvenOffspring) :
ā E : ā ā ā, (ā n, 0 ⤠E n) ā§ Tendsto E atTop (š 0) ā§
ā (m r : ā) (ε : ā), 0 < ε ā
Even (((m+(r+1):ā):ā¤)-1) ā
1 < ε*(p.sigma*Real.sqrt (m+(r+1))) ā
0 < (p.iidLaw (m+(r+1))).real {d | totalStep d = -1} ā
ā (F : (Fin m ā ā) ā ā) (M : ā), 0 ⤠M ā (ā d, |F d| ⤠M) ā
|(ā« d, F (iidSplit m (r+1) d).1 ācond (p.iidLaw (m+(r+1))) {d | totalStep d = -1}) -
(ā« d, F (iidSplit m (r+1) d).1 *
softCutoff ε ((totalStep d:ā)/(p.sigma*Real.sqrt (m+(r+1)))) āp.iidLaw (m+(r+1))) /
(ā« d, softCutoff ε ((totalStep d:ā)/(p.sigma*Real.sqrt (m+(r+1)))) āp.iidLaw (m+(r+1)))| ā¤
2*M*((2*E r + (Real.sqrt (2*Real.pi)/(p.sigma*Real.pi)) *
(1+ε*(p.sigma*Real.sqrt (m+(r+1)))) /(p.sigma*Real.sqrt (r+1)))/Real.sqrt (r+1)) /
(p.iidLaw (m+(r+1))).real {d | totalStep d = -1} := by
obtain āØE,hE,hEt,hbā© := p.suffix_site_oscillation
refine āØE,hE,hEt,?_ā©
intro m r ε hε hpar hw hP F M hM hF
let N := m+(r+1)
let a := p.sigma*Real.sqrt N
have ha : 0 < a := mul_pos p.sigma_pos (Real.sqrt_pos.mpr (by dsimp [N]; positivity))
let s := latticeWindow N (ε*a)
let w : ⤠ā ā := fun j => softCutoff ε ((j:ā)/a)
have hmem : (-1:ā¤) ā s := by
apply (mem_latticeWindow_iff N _).mpr
refine āØby simpa only [sub_eq_add_neg,Int.cast_one] using hpar, ?_ā©
simpa only [Int.cast_neg,Int.cast_one,abs_neg,abs_one,a,N,Nat.cast_add,Nat.cast_one] using hw
have hwpos : 0 < w (-1) := by
apply (softCutoff_scaled_pos_iff hε ha (-1)).mpr
simpa only [Int.cast_neg,Int.cast_one,abs_neg,abs_one,a,N,Nat.cast_add,Nat.cast_one] using hw
have hdiff (j : ā¤) (hj : j ā s) :
āįµ d āp.iidLaw m,
|(p.iidLaw (r+1)).real {b | totalStep b=(-1)-totalStep d} -
(p.iidLaw (r+1)).real {b | totalStep b=j-totalStep d}| ā¤
(2*E r + (Real.sqrt (2*Real.pi)/(p.sigma*Real.pi)) *
(1+ε*a)/(p.sigma*Real.sqrt (r+1)))/Real.sqrt (r+1) := by
have hjp := (mem_latticeWindow_iff N j).mp hj
have hpar' : Even (((m+(r+1):ā):ā¤)+(-1)) := by simpa only [sub_eq_add_neg] using hpar
filter_upwards [hb m r (-1) j hpar' hjp.1] with d hd
apply hd.trans
apply div_le_div_of_nonneg_right _ (Real.sqrt_nonneg _)
apply add_le_add_right
apply div_le_div_of_nonneg_right _ (mul_pos p.sigma_pos (Real.sqrt_pos.mpr (by positivity))).le
apply mul_le_mul_of_nonneg_left _ (div_nonneg (Real.sqrt_nonneg _) (mul_pos p.sigma_pos Real.pi_pos).le)
calc
|((-1:ā¤):ā)-(j:ā)| ⤠|((-1:ā¤):ā)|+|(j:ā)| := abs_sub _ _
_ ⤠1+ε*a := by simp only [Int.cast_neg,Int.cast_one,abs_neg,abs_one]; linarith [hjp.2]
have h := iid_prefix_window_bound p.law.toMeasure m (r+1) (-1) s w hmem
(fun j _ => softCutoff_nonneg ε _) hwpos hP F hM hF hdiff
have he := p.iid_endpointWindow_ae N hε ha
have hn : (ā« d, F (iidSplit m (r+1) d).1 * endpointWindow s w (totalStep d) āp.iidLaw N) =
ā« d, F (iidSplit m (r+1) d).1 * softCutoff ε ((totalStep d:ā)/a) āp.iidLaw N := by
apply integral_congr_ae
filter_upwards [he] with d hd
rw [show endpointWindow s w (totalStep d) = softCutoff ε ((totalStep d:ā)/a) from hd]
have hden := integral_congr_ae he
change |_- (ā« d, F (iidSplit m (r+1) d).1 * endpointWindow s w (totalStep d) āp.iidLaw N) /
(ā« d, endpointWindow s w (totalStep d) āp.iidLaw N)| ⤠_ at h
rw [hn,hden] at h
simpa only [a,N,Nat.cast_add,Nat.cast_one,iidLaw] using h
end FKCRT.TreeCoding
end
end OAI
import OAI.Probability.FKMaps.PathCLT
namespace OAI
noncomputable section
open Set Filter MeasureTheory ProbabilityTheory
open scoped Topology BigOperators ENNReal NNReal
namespace FKCRT.TreeCoding
local instance : MeasurableSpace C(unitInterval, ā) := borel _
local instance : BorelSpace C(unitInterval, ā) := āØrflā©
structure CriticalEvenOffspring where
mass : ā ā ā
nonneg : ā k, 0 ⤠mass k
total : HasSum mass 1
even_support : ā k, Odd k ā mass k = 0
zero_pos : 0 < mass 0
two_pos : 0 < mass 2
mean : HasSum (fun k : ā => (k : ā) * mass k) 1
second : Summable (fun k : ā => (k : ā)^2 * mass k)
def CriticalEvenOffspring.variance (p : CriticalEvenOffspring) : ā :=
ā' k : ā, ((k : ā) - 1)^2 * p.mass k
def CriticalEvenOffspring.sigma (p : CriticalEvenOffspring) : ā :=
Real.sqrt p.variance
lemma CriticalEvenOffspring.summable_variance (p : CriticalEvenOffspring) :
Summable (fun k : ā => ((k : ā) - 1)^2 * p.mass k) := by
apply Summable.of_nonneg_of_le (fun k : ā => mul_nonneg (sq_nonneg _) (p.nonneg k))
(f := fun k : ā => (k : ā)^2 * p.mass k + p.mass k)
Ā· intro k
have hk : (0 : ā) ⤠k := Nat.cast_nonneg k
nlinarith [p.nonneg k, mul_nonneg hk (p.nonneg k)]
Ā· exact p.second.add p.total.summable
lemma CriticalEvenOffspring.variance_pos (p : CriticalEvenOffspring) : 0 < p.variance := by
have hle := p.summable_variance.le_tsum 0
(fun k _ => mul_nonneg (sq_nonneg _) (p.nonneg k))
simp only [Nat.cast_zero, zero_sub, neg_sq, one_pow, one_mul] at hle
exact p.zero_pos.trans_le hle
lemma CriticalEvenOffspring.sigma_pos (p : CriticalEvenOffspring) : 0 < p.sigma :=
Real.sqrt_pos.mpr p.variance_pos
def CriticalEvenOffspring.law (p : CriticalEvenOffspring) : PMF ā :=
āØfun k => ((NNReal.mk (p.mass k) (p.nonneg k)) : āā„0ā), by
apply ENNReal.hasSum_coe.mpr
apply NNReal.hasSum_coe.mp
exact p.totalā©
@[simp] lemma CriticalEvenOffspring.law_apply (p : CriticalEvenOffspring) (k : ā) :
p.law k = ENNReal.ofReal (p.mass k) := by
rw [ENNReal.ofReal_eq_coe_nnreal (p.nonneg k)]
rfl
@[simp] lemma CriticalEvenOffspring.law_singleton (p : CriticalEvenOffspring) (k : ā) :
p.law.toMeasure {k} = ENNReal.ofReal (p.mass k) := by
rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton k), p.law_apply]
@[simp] lemma CriticalEvenOffspring.law_real_singleton (p : CriticalEvenOffspring) (k : ā) :
p.law.toMeasure.real {k} = p.mass k := by
simp [measureReal_def, p.nonneg]
lemma CriticalEvenOffspring.integrable_iff {E : Type*} [NormedAddCommGroup E]
(p : CriticalEvenOffspring) (f : ā ā E) :
Integrable f p.law.toMeasure ā Summable (fun k => p.mass k * āf kā) := by
rw [ā Measure.sum_smul_dirac p.law.toMeasure, integrable_sum_dirac_iff]
Ā· simp only [p.law_singleton, ENNReal.toReal_ofReal (p.nonneg _)]
Ā· intro k
simp
lemma CriticalEvenOffspring.integral_eq_tsum {E : Type*} [NormedAddCommGroup E]
[NormedSpace ā E] [CompleteSpace E] (p : CriticalEvenOffspring) (f : ā ā E)
(hf : Summable (fun k => p.mass k * āf kā)) :
ā« k, f k āp.law.toMeasure = ā' k, p.mass k ⢠f k := by
rw [integral_countable ((p.integrable_iff f).mpr hf)]
simp only [p.law_real_singleton]
lemma CriticalEvenOffspring.integrable_id (p : CriticalEvenOffspring) :
Integrable (fun k : ā => (k : ā)) p.law.toMeasure := by
apply (p.integrable_iff _).mpr
simpa [Real.norm_natCast, mul_comm] using p.mean.summable
lemma CriticalEvenOffspring.integrable_sq (p : CriticalEvenOffspring) :
Integrable (fun k : ā => (k : ā)^2) p.law.toMeasure := by