Pratik Patil

UniformEndpoint.lean

1module23public import SubentropyCertificates.ClassicalCurve4public import Mathlib.NumberTheory.Harmonic.Defs56/-! Evaluation at the uniform spectrum in every finite dimension. -/78@[expose] public section9noncomputable section10set_option autoImplicit false11set_option backward.isDefEq.respectTransparency false12open Matrix MeasureTheory Set Filter13open scoped BigOperators Topology1415namespace SubentropyCertificates.ClassicalCurve16open D5.S3.Quantum.Subentropy.Basic17open D5.S3.Quantum.Subentropy.UniformIntegrals1819def ratio (a t : ℝ) : ℝ := t / (t + a)2021theorem ratio_limit (a : ℝ) : Tendsto (ratio a) atTop (𝓝 1) := by22  have hshift : Tendsto (fun t : ℝ => t + a) atTop atTop := by23    apply tendsto_atTop.224    intro b25    filter_upwards [eventually_ge_atTop (b - a)] with t ht26    linarith27  have h : Tendsto (fun t : ℝ => 1 - a * (t + a)⁻¹) atTop (𝓝 1) := by28    simpa only [Function.comp_def, mul_zero, sub_zero] using29      tendsto_const_nhds.sub (tendsto_const_nhds.mul (tendsto_inv_atTop_zero.comp hshift))30  apply h.congr'31  filter_upwards [eventually_gt_atTop (-a)] with t ht32  have hta : t + a β‰  0 := by linarith33  dsimp [ratio]34  field_simp35  ring3637theorem integral_ratio_power (a : ℝ) (ha : 0 < a) (n : β„•) :38    IntegrableOn (fun t => (ratio a t)^n / (t + a)^2) (Ioi 0) ∧39      (∫ t in Ioi (0 : ℝ), (ratio a t)^n / (t + a)^2) =40        1 / (a * (n + 1 : β„•)) := by41  have hd : βˆ€ t ∈ Ici (0 : ℝ), HasDerivAt42      (fun t => (ratio a t)^(n + 1) / (a * (n + 1 : β„•)))43      ((ratio a t)^n / (t + a)^2) t := by44    intro t ht45    have hta : t + a β‰  0 := by linarith [ht.out]46    have hn : ((n + 1 : β„•) : ℝ) β‰  0 := by positivity47    have hr : HasDerivAt (ratio a) (a / (t + a)^2) t := by48      convert (hasDerivAt_id t).div ((hasDerivAt_id t).add_const a) hta using 149      all_goals first | (funext x; rfl) | (dsimp; ring)50    convert (hr.pow (n + 1)).div_const (a * (n + 1 : β„•)) using 151    simp only [Nat.add_sub_cancel, Nat.cast_add, Nat.cast_one]52    field_simp53  have hp : βˆ€ t ∈ Ioi (0 : ℝ), 0 ≀ (ratio a t)^n / (t + a)^2 := by54    intro t ht55    exact div_nonneg (pow_nonneg (div_nonneg ht.le (by linarith [ht.out])) _) (sq_nonneg _)56  have hl : Tendsto (fun t => (ratio a t)^(n + 1) / (a * (n + 1 : β„•)))57      atTop (𝓝 (1 / (a * (n + 1 : β„•)))) := by58    simpa only [one_pow] using ((ratio_limit a).pow (n + 1)).div_const (a * (n + 1 : β„•))59  refine ⟨integrableOn_Ioi_deriv_of_nonneg' hd hp hl, ?_⟩60  have hv := integral_Ioi_of_hasDerivAt_of_nonneg' hd hp hl61  simpa [ratio] using hv6263def uniformCorrection (n : β„•) (a t : ℝ) : ℝ :=64  (1 - (ratio a t)^n) / (t + a)6566theorem uniformCorrection_succ (n : β„•) (a t : ℝ) (hta : t + a β‰  0) :67    uniformCorrection (n + 1) a t = uniformCorrection n a t +68      a * ((ratio a t)^n / (t + a)^2) := by69  simp only [uniformCorrection, ratio, pow_succ]70  field_simp71  ring7273theorem integral_uniformCorrection (n : β„•) (a : ℝ) (ha : 0 < a) :74    IntegrableOn (uniformCorrection n a) (Ioi 0) ∧75      (∫ t in Ioi (0 : ℝ), uniformCorrection n a t) = (harmonic n : ℝ) := by76  induction n with77  | zero =>78    have hz : uniformCorrection 0 a = fun _ : ℝ => 0 := by79      funext t80      simp [uniformCorrection]81    rw [hz]82    simp83  | succ n ih =>84    have hi := integral_ratio_power a ha n85    have heq : uniformCorrection (n + 1) a =ᡐ[volume.restrict (Ioi (0 : ℝ))]86        fun t => uniformCorrection n a t + a * ((ratio a t)^n / (t + a)^2) := by87      filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht88      exact uniformCorrection_succ n a t (by linarith [ht.out])89    refine ⟨(ih.1.add (hi.1.const_mul a)).congr heq.symm, ?_⟩90    rw [integral_congr_ae heq, integral_add ih.1 (hi.1.const_mul a),91      integral_const_mul, ih.2, hi.2, harmonic_succ]92    push_cast93    have hn : ((n + 1 : β„•) : ℝ) β‰  0 := by positivity94    field_simp9596def scaledUniformKernel (n : β„•) (a t : ℝ) : ℝ :=97  1 - (n : ℝ) * a / (t + 1) - (ratio a t)^n9899theorem scaledUniformKernel_succ (n : β„•) (a t : ℝ) (hta : t + a β‰  0) :100    scaledUniformKernel (n + 1) a t = scaledUniformKernel n a t +101      a * (1 / (t + a) - 1 / (t + 1)) - a * uniformCorrection n a t := by102  simp only [scaledUniformKernel, uniformCorrection, ratio, pow_succ, Nat.cast_add,103    Nat.cast_one]104  field_simp105  ring106107theorem integral_scaledUniformKernel (n : β„•) (a : ℝ) (ha : 0 < a) (ha1 : a ≀ 1) :108    IntegrableOn (scaledUniformKernel n a) (Ioi 0) ∧109      (∫ t in Ioi (0 : ℝ), scaledUniformKernel n a t) =110        (n : ℝ) * a * (-Real.log a - (harmonic n : ℝ) + 1) := by111  induction n with112  | zero =>113    have hz : scaledUniformKernel 0 a = fun _ : ℝ => 0 := by114      funext t115      simp [scaledUniformKernel]116    rw [hz]117    simp118  | succ n ih =>119    have hi := reciprocal_difference a 1 ha ha1120    have hc := integral_uniformCorrection n a ha121    have heq : scaledUniformKernel (n + 1) a =ᡐ[volume.restrict (Ioi (0 : ℝ))]122        fun t => scaledUniformKernel n a t +123          a * (1 / (t + a) - 1 / (t + 1)) - a * uniformCorrection n a t := by124      filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht125      exact scaledUniformKernel_succ n a t (by linarith [ht.out])126    refine ⟨((ih.1.add (hi.1.const_mul a)).sub (hc.1.const_mul a)).congr heq.symm, ?_⟩127    have hia : IntegrableOn (fun t => scaledUniformKernel n a t +128        a * (1 / (t + a) - 1 / (t + 1))) (Ioi 0) := ih.1.add (hi.1.const_mul a)129    rw [integral_congr_ae heq, integral_sub hia130      (hc.1.const_mul a), integral_add ih.1 (hi.1.const_mul a),131      integral_const_mul, integral_const_mul, ih.2, hi.2, hc.2, harmonic_succ]132    simp only [Real.log_one, zero_sub]133    push_cast134    have hn : ((n + 1 : β„•) : ℝ) β‰  0 := by positivity135    push_cast at hn136    field_simp137    ring138139theorem classical_subentropy_uniform {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ]140    (hn : 0 < Fintype.card ΞΉ) :141    classicalSubentropy (fun _ : ΞΉ => (1 : ℝ) / Fintype.card ΞΉ) =142      Real.log (Fintype.card ΞΉ) - (harmonic (Fintype.card ΞΉ) : ℝ) + 1 := by143  let n := Fintype.card ΞΉ144  have hnR : 0 < (n : ℝ) := by exact_mod_cast hn145  have hn1 : 1 ≀ (n : ℝ) := by exact_mod_cast hn146  have h := integral_scaledUniformKernel n (1 / n) (by positivity)147    (by exact (div_le_one hnR).mpr hn1)148  have heq : βˆ€ t ∈ Ioi (0 : ℝ),149      subentropyKernel (diagonal (fun _ : ΞΉ => ((1 / (n : ℝ) : ℝ) : β„‚))) t =150        scaledUniformKernel n (1 / n) t := by151    intro t ht152    rw [kernel_diagonal _ t ht.ne']153    simp only [Finset.prod_const, Finset.card_univ, scaledUniformKernel, ratio]154    have ht1 : t + 1 β‰  0 := by linarith [ht.out]155    have ht2 : 1 + t β‰  0 := by linarith [ht.out]156    field_simp157    ring158  unfold classicalSubentropy matrixSubentropy159  rw [setIntegral_congr_fun measurableSet_Ioi heq, h.2]160  rw [Real.log_div one_ne_zero hnR.ne', Real.log_one]161  field_simp162  simp [n]163164theorem phi_uniform_endpoint (m : β„•) :165    phi m (uniformError m) = Real.log (m + 2 : β„•) - (harmonic (m + 2) : ℝ) + 1 := by166  rw [phi, extremal_uniform]167  simpa [Nat.add_assoc]168    using classical_subentropy_uniform (ΞΉ := Option (Fin (m + 1))) (by simp)169170def zeroPad {ΞΉ : Type*} (p : ΞΉ β†’ ℝ) : Option ΞΉ β†’ ℝ171  | none => 0172  | some i => p i173174theorem classical_subentropy_zero_pad {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ]175    (p : ΞΉ β†’ ℝ) : classicalSubentropy (zeroPad p) = classicalSubentropy p := by176  unfold classicalSubentropy matrixSubentropy177  apply setIntegral_congr_fun measurableSet_Ioi178  intro t ht179  rw [kernel_diagonal _ t ht.ne', kernel_diagonal _ t ht.ne']180  simp only [Fintype.prod_option, zeroPad, add_zero, div_self ht.ne', one_mul]181182theorem phi_one (m : β„•) :183    phi m 1 = Real.log (m + 1 : β„•) - (harmonic (m + 1) : ℝ) + 1 := by184  have hv : extremalVector m 1 = zeroPad (fun _ : Fin (m + 1) => (1 : ℝ) / (m + 1 : β„•)) := by185    funext i186    cases i <;> simp only [extremalVector, zeroPad, sub_self]187  rw [phi, hv, classical_subentropy_zero_pad]188  simpa only [Fintype.card_fin] using classical_subentropy_uniform (ΞΉ := Fin (m + 1)) (by simp)189190end SubentropyCertificates.ClassicalCurve

Axioms used

Choose a statement to see which axioms its proof uses.