Offline · exact source
Exact Lean source

PhysicalFlatRateRounded

formalization/Cloning/PhysicalFlatRateRounded.lean

Source hash: a929246895e48b193f53510f585fa7a59ffa8c8698f477fea99de56cd5579520

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Cloning.PhysicalFlatRate
2import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
3 
4/-! The fixed-ratio finite upper rate for the concrete rounded sample sizes. -/
5noncomputable section
6open scoped Topology
7open Filter Asymptotics
8namespace Cloning.PhysicalFlatConverse
9set_option maxHeartbeats 1000000
10 
11def floorOutput (γ : ℝ) (n : ℕ) : ℕ := ⌊γ*(n:ℝ)⌋₊
12 
13theorem floorOutput_ratio_error (γ : ℝ) (hγ : 0≤γ) (n : ℕ) (hn : 1≤n) :
14    |(floorOutput γ n:ℝ)/(n:ℝ)-γ|≤1/(n:ℝ) := by
15  have hn0 : (0:ℝ)<n := by exact_mod_cast (show 0<n by omega)
16  have he : (floorOutput γ n:ℝ)/(n:ℝ)-γ=
17      ((floorOutput γ n:ℝ)-γ*n)/(n:ℝ) := by field_simp <;> ring
18  rw [he,abs_div,abs_of_pos hn0]
19  exact div_le_div_of_nonneg_right (Nat.abs_floor_sub_le (mul_nonneg hγ (Nat.cast_nonneg n))) hn0.le
20 
21theorem floorOutput_ratio_tendsto (γ : ℝ) (hγ : 0≤γ) :
22    Tendsto (fun n : ℕ=>(floorOutput γ n:ℝ)/(n:ℝ)) atTop (𝓝 γ) := by
23  have hi : Tendsto (fun n : ℕ=>1/(n:ℝ)) atTop (𝓝 0) := by
24    simpa only [one_div] using tendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop
25  have hz : Tendsto (fun n : ℕ=>|(floorOutput γ n:ℝ)/(n:ℝ)-γ|) atTop (𝓝 0) :=
26    squeeze_zero' (Eventually.of_forall (fun _=>abs_nonneg _))
27      (by filter_upwards [eventually_ge_atTop 1] with n hn; exact floorOutput_ratio_error γ hγ n hn) hi
28  exact tendsto_iff_norm_sub_tendsto_zero.mpr (by simpa only [Real.norm_eq_abs] using hz)
29 
30theorem le_floorOutput (γ : ℝ) (hγ : 1≤γ) (n : ℕ) : n≤floorOutput γ n := by
31  apply Nat.le_floor
32  nlinarith [(Nat.cast_nonneg n : (0:ℝ)≤n)]
33 
34/-- For m_n=floor(γn), the all-channel optimum is at most the limiting value
35plus C/n, with C depending only on r,k,γ. -/
36theorem eventually_minimaxValue_floor_rate (r k : ℕ) (hr : 0<r)
37    (γ : ℝ) (hγ : 1<γ) :
38    ∃ C : ℝ,0≤C ∧ ∀ᶠ (n : ℕ) in atTop,
39      minimaxValue r k hr n (floorOutput γ n)≤γ^(-(((r*k:ℕ):ℝ)/2))+C/(n:ℝ) := by
40  let p : ℝ := -(((r*k:ℕ):ℝ)/2)
41  let x : ℕ→ℝ := fun n=>(floorOutput γ n:ℝ)/(n:ℝ)
42  let D := flatConverseRateConstant r k
43  have hD : 0≤D := flatConverseRateConstant_nonneg r k
44  have hg : 0<γ := zero_lt_one.trans hγ
45  have hx : Tendsto x atTop (𝓝 γ) := floorOutput_ratio_tendsto γ hg.le
46  have hd := Real.hasDerivAt_rpow_const (p := p) (Or.inl hg.ne')
47  have ho := hd.isBigO_sub.comp_tendsto hx
48  obtain ⟨L,hL,hLbound⟩ := ho.exists_pos
49  have he : ∀ᶠ (n : ℕ) in atTop,|x n^p-γ^p|≤L/(n:ℝ) := by
50    filter_upwards [hLbound.bound,eventually_ge_atTop 1] with n hbound hn
51    have hb : |x n^p-γ^p|≤L*|x n-γ| := by
52      simpa only [Function.comp_apply,Real.norm_eq_abs] using hbound
53    exact hb.trans (by
54      simpa only [mul_one_div] using mul_le_mul_of_nonneg_left
55        (floorOutput_ratio_error γ hg.le n hn) hL.le)
56  have hpow := hd.continuousAt.tendsto.comp hx
57  have hub : ∀ᶠ (n : ℕ) in atTop,x n^p≤γ^p+1 :=
58    hpow.eventually (eventually_le_nhds (by linarith))
59  refine ⟨L+(γ^p+1)*D,by positivity,?_⟩
60  filter_upwards [he,hub,eventually_minimaxValue_rate r k hr,eventually_ge_atTop 1]
61    with n he hub hbound hn
62  have hn0 : (0:ℝ)<n := by exact_mod_cast (show 0<n by omega)
63  have hf : x n^p≤γ^p+L/(n:ℝ) := by
64    have hh := le_abs_self (x n^p-γ^p)
65    linarith
66  have hm := hbound (floorOutput γ n) (le_floorOutput γ hγ.le n)
67  change minimaxValue r k hr n (floorOutput γ n)≤x n^p*(1+D/(n:ℝ)) at hm
68  apply hm.trans
69  have hm2 := mul_le_mul_of_nonneg_right hub (div_nonneg hD hn0.le)
70  change x n^p*(1+D/(n:ℝ))≤γ^p+(L+(γ^p+1)*D)/(n:ℝ)
71  calc
72    _ = x n^p+x n^p*(D/(n:ℝ)) := by ring
73    _ ≤ (γ^p+L/(n:ℝ))+(γ^p+1)*(D/(n:ℝ)) := add_le_add hf hm2
74    _ = _ := by ring
75 
76end Cloning.PhysicalFlatConverse