Offline · exact source
Exact Lean source

TensorLANEmbeddingMixtureError

formalization/Cloning/TensorLANEmbeddingMixtureError.lean

Source hash: ed6d5246443f106137240d05e9e9346493a2b4a19408cc7e594f84393c5b9049

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.TensorLANEmbeddingSchur
2import Cloning.MixedChannelsBounded
3 
4/-! Trace-norm error algebra for the actual finite classical/quantum mixtures. -/
5noncomputable section
6open scoped BigOperators Topology Classical InnerProductSpace
7open MeasureTheory Filter
8namespace Cloning.Hybrid
9open Cloning.InfiniteTraceClass
10set_option backward.isDefEq.respectTransparency false
11set_option maxHeartbeats 1000000
12variable {ι X H : Type*} [Fintype ι] [MeasurableSpace X] {ν : Measure X}
13  [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
14 
15theorem prepareL1_density_difference_norm (f g : X → ℝ)
16    (hf : Integrable f ν) (hg : Integrable g ν) (A : TraceClass H) :
17    ‖prepareL1 f hf A-prepareL1 g hg A‖ = (∫ x, |f x-g x| ∂ν)*‖A‖ := by
18  rw [L1.norm_eq_integral_norm]
19  calc
20    _ = ∫ x, |f x-g x| * ‖A‖ ∂ν := by
21      apply integral_congr_ae
22      filter_upwards [Lp.coeFn_sub (prepareL1 f hf A) (prepareL1 g hg A),
23        prepareL1_ae f hf A, prepareL1_ae g hg A] with x hx hf hg
24      rw [hx, Pi.sub_apply, hf, hg, ← sub_smul, ← Complex.ofReal_sub,
25        norm_smul, Complex.norm_real, Real.norm_eq_abs]
26    _ = _ := integral_mul_const _ _
27 
28theorem prepareL1_weighted_density_sum (w : ι → ℝ) (g : ι → X → ℝ)
29    (hg : ∀ i, Integrable (g i) ν) (A : TraceClass H) :
30    (∑ i, prepareL1 (g i) (hg i) ((w i : ℂ) • A)) =
31      prepareL1 (fun x => ∑ i, w i*g i x)
32        (integrable_finset_sum _ (fun i _ => (hg i).const_mul (w i))) A := by
33  apply Lp.ext
34  have hall : ∀ᵐ x ∂ν, ∀ i, prepareL1 (g i) (hg i) ((w i : ℂ) • A) x =
35      (g i x : ℂ) • ((w i : ℂ) • A) :=
36    ae_all_iff.mpr fun i => prepareL1_ae _ _ _
37  filter_upwards [Lp_finset_sum_ae Finset.univ
38    (fun i => prepareL1 (g i) (hg i) ((w i : ℂ) • A)), hall,
39    prepareL1_ae (fun x => ∑ i, w i*g i x)
40      (integrable_finset_sum _ (fun i _ => (hg i).const_mul (w i))) A] with x hs hall hf
41  rw [hs,hf,Complex.ofReal_sum,Finset.sum_smul]
42  apply Finset.sum_congr rfl
43  intro i _
44  rw [hall i, smul_smul, Complex.ofReal_mul, mul_comm]
45 
46/-- Quantum mixture errors add with their actual copy probabilities; the
47remaining classical error is exactly scalar L1 distance. -/
48theorem finite_prepared_mixture_error (w : ι → ℝ) (hw : ∀ i, 0 ≤ w i)
49    (g : ι → X → ℝ) (hg : ∀ i, Integrable (g i) ν)
50    (hg0 : ∀ i x, 0 ≤ g i x) (hgi : ∀ i, ∫ x, g i x ∂ν = 1)
51    (A : ι → TraceClass H) (B : TraceClass H) (f : X → ℝ) (hf : Integrable f ν) :
52    ‖(∑ i, prepareL1 (g i) (hg i) ((w i : ℂ) • A i))-prepareL1 f hf B‖ ≤
53      (∑ i, w i*‖A i-B‖) +
54        (∫ x, |(∑ i, w i*g i x)-f x| ∂ν)*‖B‖ := by
55  let C := ∑ i, prepareL1 (g i) (hg i) ((w i : ℂ) • B)
56  have he := norm_sub_le_norm_sub_add_norm_sub
57    (∑ i, prepareL1 (g i) (hg i) ((w i : ℂ) • A i)) C (prepareL1 f hf B)
58  have hq : ‖(∑ i, prepareL1 (g i) (hg i) ((w i : ℂ) • A i))-C‖ ≤
59      ∑ i, w i*‖A i-B‖ := by
60    dsimp only [C]
61    rw [← Finset.sum_sub_distrib]
62    simp_rw [← map_sub, ← smul_sub]
63    apply (norm_sum_le _ _).trans
64    apply Finset.sum_le_sum
65    intro i _
66    rw [norm_prepareL1 _ _ (hg0 i) (hgi i), norm_smul, Complex.norm_real,
67      Real.norm_of_nonneg (hw i)]
68  have hc : ‖C-prepareL1 f hf B‖ =
69      (∫ x, |(∑ i, w i*g i x)-f x| ∂ν)*‖B‖ := by
70    dsimp only [C]
71    rw [prepareL1_weighted_density_sum]
72    exact prepareL1_density_difference_norm _ _ _ _ _
73  rw [hc] at he
74  exact he.trans (add_le_add hq le_rfl)
75 
76theorem weightedL1Integral_prepare (χ f : X → ℝ)
77    (hχ : AEStronglyMeasurable χ ν) {C : ℝ} (hb : ∀ x, ‖χ x‖ ≤ C)
78    (hf : Integrable f ν) (hχf : Integrable (fun x => χ x*f x) ν) (A : TraceClass H) :
79    weightedL1Integral χ hχ hb (prepareL1 f hf A) =
80      ((∫ x, χ x*f x ∂ν : ℝ) : ℂ) • A := by
81  change (∫ x, (χ x : ℂ) • (prepareL1 f hf A) x ∂ν) = _
82  calc
83    _ = ∫ x, ((χ x*f x : ℝ) : ℂ) • A ∂ν := by
84      apply integral_congr_ae
85      filter_upwards [prepareL1_ae f hf A] with x hx
86      rw [hx, smul_smul, Complex.ofReal_mul]
87    _ = _ := by
88      rw [integral_smul_const]
89      congr 1
90      exact Complex.ofRealCLM.integral_comp_comm hχf
91 
92/-- Split any finite probabilistic error average into uniformly good terms
93and a residual controlled only by the true exceptional probability. -/
94theorem weighted_error_good_bad (w E : ι → ℝ) (hw : ∀ i, 0 ≤ w i)
95    (hs : ∑ i, w i = 1) (good : ι → Prop) [DecidablePred good]
96    (ε C : ℝ) (hε : 0 ≤ ε) (hC : 0 ≤ C)
97    (hgood : ∀ i, good i → E i ≤ ε) (hall : ∀ i, E i ≤ C) :
98    (∑ i, w i*E i) ≤ ε+C*(∑ i, if good i then 0 else w i) := by
99  calc
100    _ ≤ ∑ i, (w i*ε + C*(if good i then 0 else w i)) := by
101      apply Finset.sum_le_sum
102      intro i _
103      by_cases hi : good i
104      · simp only [if_pos hi,mul_zero,add_zero]
105        exact mul_le_mul_of_nonneg_left (hgood i hi) (hw i)
106      · simp only [if_neg hi]
107        have hh := mul_le_mul_of_nonneg_left (hall i) (hw i)
108        have hp := mul_nonneg (hw i) hε
109        nlinarith
110    _ = _ := by rw [Finset.sum_add_distrib, ← Finset.sum_mul, hs, one_mul, ← Finset.mul_sum]
111 
112end Cloning.Hybrid