Offline · exact source
Exact Lean source

PCTClosedForm

formalization/Cloning/PCTClosedForm.lean

Source hash: a237c4cbc91c79ac818a1a4b7ca3c4445c8e4eba19dd333600b7d727e219c846

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.

In the dependency map: Purify–clone–trace

Paper ↔ Lean correspondence in this module
Declarations in this module
1import Cloning.Main
2 
3/-! The explicit radical form of the PCT fidelity in the manuscript. -/
4noncomputable section
5open scoped BigOperators
6namespace Cloning.Thermal
7 
8theorem fidelity_pct_unrationalized {g q : ℝ} (hg : 1 < g)
9    (hq0 : 0 ≤ q) (hq1 : q < 1) :
10    fidelity q (pct g q) =
11      (1-q)/(Real.sqrt (g+(g-1)*q)-Real.sqrt (q*(g-1+g*q))) := by
12  have hg0 : 0 < g := by linarith
13  have hg1 : 0 ≤ g-1 := by linarith
14  have hdpos : 0 < g+(g-1)*q := add_pos_of_pos_of_nonneg hg0 (mul_nonneg hg1 hq0)
15  have hd : g+(g-1)*q ≠ 0 := hdpos.ne'
16  have hs : Real.sqrt (g+(g-1)*q) ≠ 0 := (Real.sqrt_pos.2 hdpos).ne'
17  have hn : Real.sqrt ((1-q)*(1-pct g q)) = (1-q)/Real.sqrt (g+(g-1)*q) := by
18    have he : (1-q)*(1-pct g q)=(1-q)^2/(g+(g-1)*q) := by
19      unfold pct
20      field_simp [hd]
21      <;> ring
22    rw [he,Real.sqrt_div (sq_nonneg _),Real.sqrt_sq (sub_nonneg.mpr hq1.le)]
23  have hr : Real.sqrt (q*pct g q)=Real.sqrt (q*(g-1+g*q))/Real.sqrt (g+(g-1)*q) := by
24    unfold pct
25    rw [← mul_div_assoc,Real.sqrt_div (mul_nonneg hq0 (by positivity))]
26  unfold fidelity
27  rw [hn,hr]
28  have he : 1-Real.sqrt (q*(g-1+g*q))/Real.sqrt (g+(g-1)*q)=
29      (Real.sqrt (g+(g-1)*q)-Real.sqrt (q*(g-1+g*q)))/Real.sqrt (g+(g-1)*q) := by
30    field_simp [hs]
31  rw [he,div_div_div_cancel_right₀ hs]
32 
33theorem fidelity_pct_closedForm {g q : ℝ} (hg : 1 < g)
34    (hq0 : 0 ≤ q) (hq1 : q < 1) :
35    fidelity q (pct g q)=
36      (Real.sqrt (g+(g-1)*q)+Real.sqrt (q*(g-1+g*q)))/(g*(1+q)) := by
37  have hg0 : 0 < g := by linarith
38  have hg1 : 0 ≤ g-1 := by linarith
39  have hrad : 0 ≤ q*(g-1+g*q) := mul_nonneg hq0 (add_nonneg hg1 (mul_nonneg hg0.le hq0))
40  have hdpos : 0 < g+(g-1)*q := add_pos_of_pos_of_nonneg hg0 (mul_nonneg hg1 hq0)
41  have hsum : 0 < g*(1+q) := by positivity
42  have hradlt : q*(g-1+g*q) < g+(g-1)*q := by
43    have hp := mul_pos (sub_pos.mpr hq1) hsum
44    nlinarith
45  have hd : 0 < Real.sqrt (g+(g-1)*q)-Real.sqrt (q*(g-1+g*q)) :=
46    sub_pos.mpr (Real.sqrt_lt_sqrt hrad hradlt)
47  rw [fidelity_pct_unrationalized hg hq0 hq1]
48  apply (div_eq_div_iff hd.ne' hsum.ne').mpr
49  nlinarith [Real.sq_sqrt hdpos.le,Real.sq_sqrt hrad]
50 
51end Cloning.Thermal
52namespace Cloning
53 
54theorem pctValue_closedForm {d : ℕ} {g : ℝ} (hg : 1<g) (p : SimpleSpectrum d) :
55    pctValue g p=(Real.sqrt (2*g-1)/g)^(((d : ℝ)-1)/2)*
56      ∏ ij : PairIndex d,
57        (Real.sqrt (g+(g-1)*p.ratio ij)+Real.sqrt (p.ratio ij*(g-1+g*p.ratio ij)))/
58          (g*(1+p.ratio ij)) := by
59  have hc : Thermal.classicalBase (2*g-1)=Real.sqrt (2*g-1)/g := by
60    unfold Thermal.classicalBase
61    field_simp
62    <;> ring
63  simp only [pctValue,classicalValue,hc]
64  congr 1
65  apply Finset.prod_congr rfl
66  intro ij _
67  exact Thermal.fidelity_pct_closedForm hg (p.ratio_pos ij).le (p.ratio_lt_one ij)
68 
69end Cloning