Offline · exact source
Exact Lean source

CloningValueExpansionThermal

formalization/Cloning/CloningValueExpansionThermal.lean

Source hash: 67134db43c5543e684f9fff7354e07646653511de2c448e96a417534cdf66f1a

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.CloningValueExpansionAlgebra
2import Cloning.Thermal
3import Mathlib.Analysis.SpecialFunctions.Sqrt
4import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
5 
6/-! Exact one-mode quadratic losses with cubic remainders. -/
7noncomputable section
8open scoped Topology
9open Filter Asymptotics
10namespace Cloning.ValueExpansion
11open Cloning.Thermal
12set_option backward.isDefEq.respectTransparency false
13set_option maxHeartbeats 500000
14 
15def thermalLoss (q x : ℝ) : ℝ :=
16  (Real.sqrt q-Real.sqrt x)/(1-Real.sqrt q*Real.sqrt x)
17 
18theorem fidelity_sq_eq_one_sub_loss_sq {q x : ℝ}
19    (hq : 0<q) (hq1 : q<1) (hx : 0<x) (hx1 : x<1) :
20    fidelity q x^2=1-thermalLoss q x^2 := by
21  have hp : Real.sqrt q*Real.sqrt x<1 := by
22    rw [←Real.sqrt_mul hq.le,Real.sqrt_lt' (by norm_num : (0:ℝ)<1)]
23    simpa using mul_lt_one_of_nonneg_of_lt_one_right hq1.le hx.le hx1
24  rw [fidelity_sq hq.le hq1 hx.le hx1]
25  dsimp only [thermalLoss]
26  field_simp [ne_of_gt (sub_pos.mpr hp)]
27  nlinarith [Real.sq_sqrt hq.le,Real.sq_sqrt hx.le]
28 
29theorem thermalLoss_self {q : ℝ} (hq : 0≤q) : thermalLoss q q=0 := by
30  simp only [thermalLoss,sub_self,zero_div]
31 
32theorem thermalLoss_contDiffAt {q : ℝ} (hq : 0<q) (hq1 : q<1) :
33    ContDiffAt ℝ 2 (thermalLoss q) q := by
34  apply (contDiffAt_const.sub (contDiffAt_id.sqrt hq.ne')).div
35    (contDiffAt_const.sub (contDiffAt_const.mul (contDiffAt_id.sqrt hq.ne')))
36  simp only [id_eq]
37  rw [←pow_two,Real.sq_sqrt hq.le]
38  exact (sub_pos.mpr hq1).ne'
39 
40theorem thermalLoss_hasDerivAt {q : ℝ} (hq : 0<q) (hq1 : q<1) :
41    HasDerivAt (thermalLoss q) (-(1/(2*Real.sqrt q*(1-q)))) q := by
42  have hden : 1-Real.sqrt q*Real.sqrt q≠0 := by
43    rw [←pow_two,Real.sq_sqrt hq.le]
44    exact (sub_pos.mpr hq1).ne'
45  have hs := Real.hasDerivAt_sqrt hq.ne'
46  have h := ((hasDerivAt_const q (Real.sqrt q)).sub hs).div
47    ((hasDerivAt_const q 1).sub (hs.const_mul (Real.sqrt q))) hden
48  convert h using 1
49  simp only [Pi.sub_apply,zero_sub,sub_self,zero_mul,sub_zero,←pow_two,Real.sq_sqrt hq.le]
50  field_simp [hq.ne',ne_of_gt (Real.sqrt_pos.mpr hq),(sub_pos.mpr hq1).ne']
51  <;> ring
52 
53theorem thermal_path_expansion {q v : ℝ} {f : ℝ→ℝ}
54    (hq : 0<q) (hq1 : q<1) (hf : ContDiffAt ℝ 2 f 0)
55    (hf0 : f 0=q) (hd : HasDerivAt f v 0) :
56    HasQuadraticExpansion (fun x=>fidelity q (f x)^2)
57      (v^2/(4*q*(1-q)^2)) := by
58  let a := -(1/(2*Real.sqrt q*(1-q)))*v
59  have hOuter : ContDiffAt ℝ 2 (thermalLoss q) (f 0) := by
60    rw [hf0]
61    exact thermalLoss_contDiffAt hq hq1
62  have hC : ContDiffAt ℝ 2 (fun x=>thermalLoss q (f x)) 0 := hOuter.comp 0 hf
63  have hzero : thermalLoss q (f 0)=0 := by rw [hf0,thermalLoss_self hq.le]
64  have hOuterD : HasDerivAt (thermalLoss q) (-(1/(2*Real.sqrt q*(1-q)))) (f 0) := by
65    rw [hf0]
66    exact thermalLoss_hasDerivAt hq hq1
67  have hD : HasDerivAt (fun x=>thermalLoss q (f x)) a 0 := hOuterD.comp 0 hd
68  have hs := (square_zero_remainder hC hzero hD).neg_left
69  have ha : a^2=v^2/(4*q*(1-q)^2) := by
70    dsimp only [a]
71    rw [mul_pow,neg_sq,div_pow]
72    simp only [one_pow,mul_pow,Real.sq_sqrt hq.le]
73    ring
74  have hft : Tendsto f (𝓝 (0:ℝ)) (𝓝 q) := hf0 ▸ hd.continuousAt
75  have he : ∀ᶠx in 𝓝 (0:ℝ), 0<f x ∧ f x<1 :=
76    hft (Ioo_mem_nhds hq hq1)
77  apply hs.congr' ?_ (Eventually.of_forall (fun _=>rfl))
78  filter_upwards [he] with x hx
79  rw [fidelity_sq_eq_one_sub_loss_sq hq hq1 hx.1 hx.2,←ha]
80  ring
81 
82theorem amplified_path_hasDerivAt (q : ℝ) :
83    HasDerivAt (fun x : ℝ=>amplified (1+x) q) (1-q) 0 := by
84  have h := (hasDerivAt_const 0 1).sub
85    ((hasDerivAt_const 0 (1-q)).div ((hasDerivAt_id 0).const_add 1) (by norm_num))
86  convert h using 1 <;> simp only [amplified,id_eq] <;> ring
87 
88theorem amplified_fidelity_expansion {q : ℝ} (hq : 0<q) (hq1 : q<1) :
89    HasQuadraticExpansion (fun x=>fidelity q (amplified (1+x) q)^2) (1/(4*q)) := by
90  have hc : ContDiffAt ℝ 2 (fun x : ℝ=>amplified (1+x) q) 0 :=
91    contDiffAt_const.sub (contDiffAt_const.div (contDiffAt_const.add contDiffAt_id) (by norm_num))
92  have h0 : amplified (1+(0:ℝ)) q=q := by simp [amplified]
93  convert thermal_path_expansion hq hq1 hc h0 (amplified_path_hasDerivAt q) using 1
94  field_simp [(sub_pos.mpr hq1).ne',hq.ne']
95 
96theorem pct_path_hasDerivAt (q : ℝ) :
97    HasDerivAt (fun x : ℝ=>pct (1+x) q) (1-q^2) 0 := by
98  have hid := (hasDerivAt_id (0:ℝ)).const_add 1
99  have h := ((hid.sub_const 1).add (hid.mul_const q)).div
100    (hid.add ((hid.sub_const 1).mul_const q)) (by norm_num)
101  convert h using 1 <;> simp [pct] <;> ring
102 
103theorem pct_fidelity_expansion {q : ℝ} (hq : 0<q) (hq1 : q<1) :
104    HasQuadraticExpansion (fun x=>fidelity q (pct (1+x) q)^2) ((1+q)^2/(4*q)) := by
105  have hc : ContDiffAt ℝ 2 (fun x : ℝ=>pct (1+x) q) 0 := by
106    unfold pct
107    fun_prop (disch:=norm_num)
108  have h0 : pct (1+(0:ℝ)) q=q := by simp [pct]
109  convert thermal_path_expansion hq hq1 hc h0 (pct_path_hasDerivAt q) using 1
110  field_simp [(sub_pos.mpr hq1).ne',hq.ne']
111  <;> ring
112 
113end Cloning.ValueExpansion