roseking commited on
Commit
cdec422
·
verified ·
1 Parent(s): 0dd3af4

Add lean source and binary files (part 84)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. lean/OAI/InformationTheory/Entanglement/MatrixMeasure.lean +72 -0
  2. lean/OAI/InformationTheory/Entanglement/MatrixMeasureChannel.lean +160 -0
  3. lean/OAI/InformationTheory/Entanglement/MatrixPolar.lean +72 -0
  4. lean/OAI/InformationTheory/Entanglement/MatrixTraceMeasure.lean +86 -0
  5. lean/OAI/InformationTheory/Entanglement/MultiTensor.lean +84 -0
  6. lean/OAI/InformationTheory/Entanglement/NormalizeRepresentation.lean +66 -0
  7. lean/OAI/InformationTheory/Entanglement/NormalizedProbe.lean +91 -0
  8. lean/OAI/InformationTheory/Entanglement/NormalizedPurificationConsumer.lean +92 -0
  9. lean/OAI/InformationTheory/Entanglement/OperationalNorm.lean +56 -0
  10. lean/OAI/InformationTheory/Entanglement/ParityData.lean +53 -0
  11. lean/OAI/InformationTheory/Entanglement/ParityObstruction.lean +117 -0
  12. lean/OAI/InformationTheory/Entanglement/PhysicalAdaptiveStep.lean +88 -0
  13. lean/OAI/InformationTheory/Entanglement/PhysicalChronology.lean +69 -0
  14. lean/OAI/InformationTheory/Entanglement/PhysicalConditionalUpdate.lean +87 -0
  15. lean/OAI/InformationTheory/Entanglement/PhysicalExecutionStep.lean +96 -0
  16. lean/OAI/InformationTheory/Entanglement/PhysicalHistoryRealization.lean +53 -0
  17. lean/OAI/InformationTheory/Entanglement/PhysicalProductStep.lean +106 -0
  18. lean/OAI/InformationTheory/Entanglement/PhysicalPublicPrefix.lean +45 -0
  19. lean/OAI/InformationTheory/Entanglement/PhysicalRawPrefix.lean +58 -0
  20. lean/OAI/InformationTheory/Entanglement/PhysicalRightAdaptive.lean +88 -0
  21. lean/OAI/InformationTheory/Entanglement/PhysicalRightRawPrefix.lean +57 -0
  22. lean/OAI/InformationTheory/Entanglement/PhysicalRightStep.lean +117 -0
  23. lean/OAI/InformationTheory/Entanglement/PhysicalVersion.lean +29 -0
  24. lean/OAI/InformationTheory/Entanglement/PolynomialGcdDegree.lean +50 -0
  25. lean/OAI/InformationTheory/Entanglement/PositiveBlock.lean +79 -0
  26. lean/OAI/InformationTheory/Entanglement/PowersStormer.lean +109 -0
  27. lean/OAI/InformationTheory/Entanglement/ProbeDensity.lean +51 -0
  28. lean/OAI/InformationTheory/Entanglement/ProbeFactorization.lean +82 -0
  29. lean/OAI/InformationTheory/Entanglement/ProbeMatrices.lean +52 -0
  30. lean/OAI/InformationTheory/Entanglement/ProbePOVM.lean +84 -0
  31. lean/OAI/InformationTheory/Entanglement/ProbeRescaling.lean +66 -0
  32. lean/OAI/InformationTheory/Entanglement/ProductInstrumentStep.lean +61 -0
  33. lean/OAI/InformationTheory/Entanglement/ProjectionData.lean +118 -0
  34. lean/OAI/InformationTheory/Entanglement/ProjectionMain.lean +51 -0
  35. lean/OAI/InformationTheory/Entanglement/ProjectionReal.lean +104 -0
  36. lean/OAI/InformationTheory/Entanglement/ProjectionRealMain.lean +70 -0
  37. lean/OAI/InformationTheory/Entanglement/ProjectionReindex.lean +73 -0
  38. lean/OAI/InformationTheory/Entanglement/ProjectionSquare.lean +73 -0
  39. lean/OAI/InformationTheory/Entanglement/ProjectionStats.lean +104 -0
  40. lean/OAI/InformationTheory/Entanglement/PublicSampler.lean +44 -0
  41. lean/OAI/InformationTheory/Entanglement/PurificationExpansion.lean +41 -0
  42. lean/OAI/InformationTheory/Entanglement/PurificationSupport.lean +53 -0
  43. lean/OAI/InformationTheory/Entanglement/QuantumStepKernel.lean +55 -0
  44. lean/OAI/InformationTheory/Entanglement/ReferenceFilter.lean +92 -0
  45. lean/OAI/InformationTheory/Entanglement/RestrictedIntersections.lean +67 -0
  46. lean/OAI/InformationTheory/Entanglement/ScalarGap.lean +69 -0
  47. lean/OAI/InformationTheory/Entanglement/SecretDefinitions.lean +32 -0
  48. lean/OAI/InformationTheory/Entanglement/SequentialSampling.lean +172 -0
  49. lean/OAI/InformationTheory/Entanglement/SparseSeparable.lean +129 -0
  50. lean/OAI/InformationTheory/Entanglement/SpectralCut.lean +139 -0
lean/OAI/InformationTheory/Entanglement/MatrixMeasure.lean ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.DensityGap
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder ENNReal MeasureTheory Matrix.Norms.L2Operator
7
+ open Matrix MeasureTheory
8
+ namespace SecretKey
9
+ open ChannelCompletion
10
+ variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
11
+
12
+ lemma complex_setIntegral_rnDeriv (c : ComplexMeasure Ω) [SigmaFinite μ]
13
+ (hc : c ≪ᵥ μ.toENNRealVectorMeasure) {s : Set Ω} (hs : MeasurableSet s) :
14
+ (∫ x in s, c.rnDeriv μ x ∂μ)=c s := by
15
+ have h := (ComplexMeasure.absolutelyContinuous_ennreal_iff c _).mp hc
16
+ have hr := congrArg (fun v : SignedMeasure Ω => v s)
17
+ (SignedMeasure.withDensityᵥ_rnDeriv_eq c.re μ h.1)
18
+ have hi := congrArg (fun v : SignedMeasure Ω => v s)
19
+ (SignedMeasure.withDensityᵥ_rnDeriv_eq c.im μ h.2)
20
+ rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv _ _) hs] at hr hi
21
+ apply Complex.ext
22
+ · exact (integral_re (c.integrable_rnDeriv μ).integrableOn).symm.trans hr
23
+ · exact (integral_im (c.integrable_rnDeriv μ).integrableOn).symm.trans hi
24
+
25
+ lemma measurable_complex_rnDeriv (c : ComplexMeasure Ω) : Measurable (c.rnDeriv μ) := by
26
+ have he : c.rnDeriv μ = fun x => ((c.re.rnDeriv μ x : ℝ) : ℂ) +
27
+ ((c.im.rnDeriv μ x : ℝ) : ℂ)*Complex.I := by funext x; exact (Complex.re_add_im (c.rnDeriv μ x)).symm
28
+ rw [he]
29
+ exact (SignedMeasure.measurable_rnDeriv c.re μ).complex_ofReal.add
30
+ ((SignedMeasure.measurable_rnDeriv c.im μ).complex_ofReal.mul_const _)
31
+
32
+ variable {n : Type} [Fintype n]
33
+
34
+ structure PositiveMatrixMeasure (Ω : Type*) [MeasurableSpace Ω] (n : Type) [Fintype n] where
35
+ entry : Matrix n n (ComplexMeasure Ω)
36
+ positive : ∀ s, MeasurableSet s → Matrix.PosSemidef (fun i j => entry i j s)
37
+ namespace PositiveMatrixMeasure
38
+ variable (W : PositiveMatrixMeasure Ω n)
39
+ def value (s : Set Ω) : Mat n := fun i j => W.entry i j s
40
+ def density (μ : Measure Ω) (x : Ω) : Mat n := fun i j => (W.entry i j).rnDeriv μ x
41
+ lemma density_integrable (i j : n) : Integrable (fun x => W.density μ x i j) μ :=
42
+ (W.entry i j).integrable_rnDeriv μ
43
+ lemma density_measurable : Measurable (W.density μ) := by
44
+ change @Measurable Ω (n → n → ℂ) _ (borel _) _
45
+ rw [← @BorelSpace.measurable_eq (n → n → ℂ) _ MeasurableSpace.pi _]
46
+ exact Measurable.of_eval fun row => Measurable.of_eval fun column =>
47
+ measurable_complex_rnDeriv (W.entry row column)
48
+ lemma entry_absolutelyContinuous
49
+ (hdom : ∀ s, MeasurableSet s → μ s=0 → (Matrix.trace (W.value s)).re=0) (i j : n) :
50
+ W.entry i j ≪ᵥ μ.toENNRealVectorMeasure := by
51
+ intro s hs
52
+ by_cases hsm : MeasurableSet s
53
+ · have hz : μ s=0 := by simpa only [Measure.toENNRealVectorMeasure_apply,ite_eq_left hsm] using hs
54
+ have hp := W.positive s hsm
55
+ have ht : Matrix.trace (W.value s)=0 := by
56
+ apply Complex.ext
57
+ · exact hdom s hsm hz
58
+ · exact (Complex.nonneg_iff.mp hp.trace_nonneg).2.symm
59
+ have hm : W.value s=0 := hp.trace_eq_zero_iff.mp ht
60
+ exact congrArg (fun M : Mat n => M i j) hm
61
+ · exact (W.entry i j).not_measurable hsm
62
+ lemma density_setIntegral [SigmaFinite μ]
63
+ (hdom : ∀ s, MeasurableSet s → μ s=0 → (Matrix.trace (W.value s)).re=0)
64
+ {s : Set Ω} (hs : MeasurableSet s) (i j : n) :
65
+ (∫ x in s, W.density μ x i j ∂μ)=W.value s i j :=
66
+ complex_setIntegral_rnDeriv _ (W.entry_absolutelyContinuous hdom i j) hs
67
+ end PositiveMatrixMeasure
68
+ end SecretKey
69
+
70
+ end
71
+
72
+ end OAI
lean/OAI/InformationTheory/Entanglement/MatrixMeasureChannel.lean ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.FiniteRecovery
2
+ import OAI.InformationTheory.Entanglement.FactorizedLawGap
3
+ import OAI.InformationTheory.Entanglement.ChoiTransfer
4
+
5
+ namespace OAI
6
+
7
+ noncomputable section
8
+ open MeasureTheory Matrix Filter
9
+ open scoped MeasureTheory BigOperators ComplexOrder MatrixOrder
10
+ namespace SecretKey
11
+ open ChannelCompletion TensorCriterion
12
+ variable {T : Type*} [MeasurableSpace T] {n m : Type} [Fintype n] [Fintype m]
13
+ [DecidableEq n] [DecidableEq m]
14
+ namespace PositiveMatrixMeasure
15
+ omit [Fintype m] [DecidableEq m] in
16
+ lemma channel_entry_value (W : PositiveMatrixMeasure T n) (F : Map n m) (s : Set T) :
17
+ (fun a b => (∑ i, ∑ j, F (Matrix.single i j 1) a b • W.entry i j) s)=F (W.value s) := by
18
+ rw [linearMap_entries F (W.value s)]
19
+ ext a b
20
+ simp only [_root_.sum_apply,_root_.smul_apply,smul_eq_mul,Matrix.sum_apply,Matrix.smul_apply,value]
21
+ apply Finset.sum_congr rfl
22
+ intro i _
23
+ apply Finset.sum_congr rfl
24
+ intro j _
25
+ exact mul_comm _ _
26
+
27
+ def channel (W : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) : PositiveMatrixMeasure T m where
28
+ entry a b := ∑ i, ∑ j, F (Matrix.single i j 1) a b • W.entry i j
29
+ positive s hs := by
30
+ rw [channel_entry_value]
31
+ exact cp_positive hF (W.positive s hs)
32
+ omit [DecidableEq m] in
33
+ lemma channel_value (W : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) (s : Set T) :
34
+ (W.channel F hF).value s=F (W.value s) := channel_entry_value W F s
35
+ omit [DecidableEq m] in
36
+ lemma channel_traceMeasure (W : PositiveMatrixMeasure T n) (F : Map n m)
37
+ (hF : CP F) (hT : TracePreserving F) : (W.channel F hF).traceMeasure=W.traceMeasure := by
38
+ apply Measure.ext
39
+ intro s hs
40
+ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp
41
+ change (W.channel F hF).traceMeasure.real s=W.traceMeasure.real s
42
+ rw [traceMeasure_real _ hs,traceMeasure_real _ hs,channel_value,hT]
43
+ omit [Fintype m] [DecidableEq m] in
44
+ lemma channel_entry (F : Map n m) (D : Mat n) (a b : m) :
45
+ F D a b=∑ i, ∑ j, D i j*F (Matrix.single i j 1) a b := by
46
+ rw [linearMap_entries F D]
47
+ simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul]
48
+ omit [Fintype m] [DecidableEq m] in
49
+ lemma channel_density_integrable (F : Map n m) {μ : Measure T} (D : T → Mat n)
50
+ (hi : ∀ a b, Integrable (fun t => D t a b) μ) (a b : m) :
51
+ Integrable (fun t => F (D t) a b) μ := by
52
+ have he : (fun t => F (D t) a b)=(fun t => ∑ i, ∑ j, D t i j*F (Matrix.single i j 1) a b) :=
53
+ funext fun t => channel_entry F (D t) a b
54
+ rw [he]
55
+ exact integrable_finsetSum _ fun i _ => integrable_finsetSum _ fun j _ => (hi i j).mul_const _
56
+ omit [Fintype m] [DecidableEq m] in
57
+ lemma channel_setIntegral (F : Map n m) {μ : Measure T} (D : T → Mat n)
58
+ (hi : ∀ a b, Integrable (fun t => D t a b) μ) (s : Set T) (a b : m) :
59
+ (∫ t in s, F (D t) a b ∂μ)=F (fun i j => ∫ t in s, D t i j ∂μ) a b := by
60
+ have he : (fun t => F (D t) a b)=(fun t => ∑ i, ∑ j, D t i j*F (Matrix.single i j 1) a b) :=
61
+ funext fun t => channel_entry F (D t) a b
62
+ rw [he]
63
+ apply Eq.trans ?_ (channel_entry F (Matrix.of fun i j => ∫ t in s, D t i j ∂μ) a b).symm
64
+ rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun j _ => (hi i j).integrableOn.mul_const _))]
65
+ apply Finset.sum_congr rfl
66
+ intro i _
67
+ rw [integral_finsetSum _ (fun j _ => (hi i j).integrableOn.mul_const _)]
68
+ simp only [integral_mul_const,Matrix.of_apply]
69
+ omit [DecidableEq m] in
70
+ lemma channel_positiveDensity (W : PositiveMatrixMeasure T n) (F : Map n m)
71
+ (hF : CP F) (hT : TracePreserving F) {μ : Measure T} [IsFiniteMeasure μ]
72
+ (hW : W.traceMeasure≪μ) :
73
+ (fun t => F (W.positiveDensity μ t))=ᵐ[μ](W.channel F hF).positiveDensity μ := by
74
+ apply (W.channel F hF).density_unique
75
+ (by simpa only [channel_traceMeasure W F hF hT] using hW)
76
+ · exact channel_density_integrable F _ (W.positiveDensity_integrable hW)
77
+ · intro s hs a b
78
+ rw [channel_setIntegral F _ (W.positiveDensity_integrable hW),channel_value]
79
+ have he : (Matrix.of fun i j => ∫ t in s, W.positiveDensity μ t i j ∂μ)=W.value s := by
80
+ ext i j
81
+ exact W.positiveDensity_setIntegral hW hs i j
82
+ exact congrArg (fun M : Mat n => F M a b) he
83
+ end PositiveMatrixMeasure
84
+ omit [DecidableEq m] in
85
+ lemma bitComparisonMeasure_channel (W : Fin 2 → Fin 2 → PositiveMatrixMeasure T n)
86
+ (σ : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) (hT : TracePreserving F) :
87
+ bitComparisonMeasure (fun i j => (W i j).channel F hF) (σ.channel F hF)=bitComparisonMeasure W σ := by
88
+ simp only [bitComparisonMeasure,familyTraceMeasure,PositiveMatrixMeasure.channel_traceMeasure _ F hF hT]
89
+ omit [Fintype m] [DecidableEq n] [DecidableEq m] in
90
+ lemma measurable_matrix_map (F : Map n m) : Measurable F := by
91
+ exact F.continuous_of_finiteDimensional.measurable
92
+ omit [MeasurableSpace T] [Fintype n] [DecidableEq n] in
93
+ lemma idealDensity_psd (σ : T → Mat n) (hσ : ∀ t, (σ t).PosSemidef) (i j : Fin 2) (t : T) :
94
+ (idealDensity σ i j t).PosSemidef := by
95
+ unfold idealDensity halfDensity
96
+ split_ifs
97
+ · exact (hσ t).smul (by rw [Complex.nonneg_iff]; norm_num)
98
+ · exact Matrix.PosSemidef.zero
99
+ omit [Fintype n] [DecidableEq n] in
100
+ lemma idealDensity_measurable (σ : T → Mat n) (hσ : Measurable σ) (i j : Fin 2) :
101
+ Measurable (idealDensity σ i j) := by
102
+ unfold idealDensity halfDensity
103
+ split_ifs
104
+ · exact hσ.const_smul (1/2 : ℂ)
105
+ · exact measurable_const
106
+ omit [DecidableEq n] in
107
+ lemma idealDensity_trace_integrable (σ : T → Mat n) {μ : Measure T}
108
+ (hσ : Integrable (fun t => (Matrix.trace (σ t)).re) μ) (i j : Fin 2) :
109
+ Integrable (fun t => (Matrix.trace (idealDensity σ i j t)).re) μ := by
110
+ unfold idealDensity
111
+ split_ifs
112
+ · simpa only [halfDensity_trace] using hσ.div_const 2
113
+ · simp only [Matrix.trace_zero,Complex.zero_re]; exact integrable_zero _ _ _
114
+ omit [MeasurableSpace T] [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] in
115
+ lemma channel_idealDensity (F : Map n m) (σ : T → Mat n) (i j : Fin 2) (t : T) :
116
+ F (idealDensity σ i j t)=idealDensity (fun t => F (σ t)) i j t := by
117
+ unfold idealDensity halfDensity
118
+ split_ifs <;> simp only [map_smul,map_zero]
119
+
120
+ theorem cqBitDistance_channel (W : Fin 2 → Fin 2 → PositiveMatrixMeasure T n)
121
+ (σ : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) (hT : TracePreserving F) :
122
+ cqBitDistance (fun i j => (W i j).channel F hF) (σ.channel F hF) ≤ cqBitDistance W σ := by
123
+ have htr : ∀ A, Matrix.trace (F A)=Matrix.trace A := hT
124
+ let μ := bitComparisonMeasure W σ
125
+ have hW (i j : Fin 2) := (W i j).channel_positiveDensity F hF hT (bitComparison_actual_dom W σ i j)
126
+ have hσ := σ.channel_positiveDensity F hF hT (bitComparison_ideal_dom W σ)
127
+ unfold cqBitDistance
128
+ rw [bitComparisonMeasure_channel W σ F hF hT,
129
+ ← bitDistance_congr_ae hW hσ]
130
+ apply Finset.sum_le_sum
131
+ intro i _
132
+ apply Finset.sum_le_sum
133
+ intro j _
134
+ apply integral_mono
135
+ · apply integrable_traceNorm_sub
136
+ · exact (measurable_matrix_map F).comp ((W i j).positiveDensity_measurable μ)
137
+ · exact idealDensity_measurable _ ((measurable_matrix_map F).comp (σ.positiveDensity_measurable μ)) i j
138
+ · intro t; exact cp_positive hF ((W i j).positiveDensity_psd μ t)
139
+ · exact idealDensity_psd _ (fun t => cp_positive hF (σ.positiveDensity_psd μ t)) i j
140
+ · simpa only [htr] using (W i j).positiveDensity_trace_integrable (bitComparison_actual_dom W σ i j)
141
+ · apply idealDensity_trace_integrable
142
+ simpa only [htr] using σ.positiveDensity_trace_integrable (bitComparison_ideal_dom W σ)
143
+ · apply integrable_traceNorm_sub
144
+ · exact (W i j).positiveDensity_measurable μ
145
+ · exact idealDensity_measurable _ (σ.positiveDensity_measurable μ) i j
146
+ · exact (W i j).positiveDensity_psd μ
147
+ · exact idealDensity_psd _ (σ.positiveDensity_psd μ) i j
148
+ · exact (W i j).positiveDensity_trace_integrable (bitComparison_actual_dom W σ i j)
149
+ · exact idealDensity_trace_integrable _ (σ.positiveDensity_trace_integrable (bitComparison_ideal_dom W σ)) i j
150
+ · intro t
151
+ dsimp only
152
+ rw [← channel_idealDensity F (σ.positiveDensity μ) i j t,← map_sub]
153
+ exact traceNorm_cptp F hF hT (((W i j).positiveDensity_psd μ t).isHermitian.sub
154
+ (idealDensity_psd _ (σ.positiveDensity_psd μ) i j t).isHermitian)
155
+
156
+ end SecretKey
157
+
158
+ end
159
+
160
+ end OAI
lean/OAI/InformationTheory/Entanglement/MatrixPolar.lean ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped MatrixOrder ComplexOrder BigOperators
7
+ open Matrix
8
+ namespace MatrixPolar
9
+
10
+ lemma isometry_factor {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V]
11
+ [FiniteDimensional ℂ V] (f g : V →ₗ[ℂ] V)
12
+ (hn : ∀ x, ‖f x‖ = ‖g x‖) :
13
+ ∃ U : V →ₗᵢ[ℂ] V, U.toLinearMap.comp g = f := by
14
+ have hk : g.ker ≤ f.ker := by
15
+ intro x hx
16
+ apply LinearMap.mem_ker.mpr
17
+ apply norm_eq_zero.mp
18
+ rw [hn, LinearMap.mem_ker.mp hx, norm_zero]
19
+ let l : g.range →ₗ[ℂ] V :=
20
+ (g.ker.liftQ f hk).comp g.quotKerEquivRange.symm.toLinearMap
21
+ have hl (x : V) : l ⟨g x, LinearMap.mem_range_self g x⟩ = f x := by
22
+ simp [l]
23
+ have hln (x : g.range) : ‖l x‖ = ‖x‖ := by
24
+ rcases x with ⟨x,hx⟩
25
+ obtain ⟨y,rfl⟩ := hx
26
+ rw [hl]
27
+ exact hn y
28
+ let L : g.range →ₗᵢ[ℂ] V := ⟨l,hln⟩
29
+ refine ⟨L.extend,?_⟩
30
+ ext x
31
+ change L.extend (g x) = f x
32
+ rw [show L.extend (g x) = L ⟨g x, LinearMap.mem_range_self g x⟩ from
33
+ L.extend_apply ⟨g x, LinearMap.mem_range_self g x⟩]
34
+ exact hl x
35
+
36
+ variable {n : Type*} [Fintype n] [DecidableEq n]
37
+ lemma gram_inner (A : Matrix n n ℂ) (x y : EuclideanSpace ℂ n) :
38
+ inner ℂ (Matrix.toEuclideanLin A x) (Matrix.toEuclideanLin A y) =
39
+ inner ℂ x (Matrix.toEuclideanLin (Aᴴ * A) y) := by
40
+ rw [Matrix.toLpLin_mul 2 2 2, Matrix.toEuclideanLin_conjTranspose_eq_adjoint]
41
+ exact (LinearMap.adjoint_inner_right (Matrix.toEuclideanLin A) x
42
+ (Matrix.toEuclideanLin A y)).symm
43
+
44
+ lemma sqrt_gram_norm (A : Matrix n n ℂ) (x : EuclideanSpace ℂ n) :
45
+ ‖Matrix.toEuclideanLin A x‖ =
46
+ ‖Matrix.toEuclideanLin (CFC.sqrt (Aᴴ * A)) x‖ := by
47
+ have h : (CFC.sqrt (Aᴴ * A))ᴴ * CFC.sqrt (Aᴴ * A) = Aᴴ * A := by
48
+ rw [(Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg (Aᴴ * A))).isHermitian.eq]
49
+ exact CFC.sqrt_mul_sqrt_self _ (Matrix.posSemidef_conjTranspose_mul_self A).nonneg
50
+ apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp
51
+ rw [norm_sq_eq_re_inner (𝕜 := ℂ), norm_sq_eq_re_inner (𝕜 := ℂ), gram_inner, gram_inner, h]
52
+
53
+ lemma polar (A : Matrix n n ℂ) :
54
+ ∃ U : Matrix n n ℂ, Uᴴ * U = 1 ∧ A = U * CFC.sqrt (Aᴴ * A) := by
55
+ obtain ⟨l,hl⟩ := isometry_factor (Matrix.toEuclideanLin A)
56
+ (Matrix.toEuclideanLin (CFC.sqrt (Aᴴ * A))) (sqrt_gram_norm A)
57
+ let U := Matrix.toEuclideanLin.symm l.toLinearMap
58
+ have hU : Matrix.toEuclideanLin U = l.toLinearMap := Matrix.toEuclideanLin.apply_symm_apply _
59
+ refine ⟨U,?_,?_⟩
60
+ · apply Matrix.toEuclideanLin.injective
61
+ rw [Matrix.toLpLin_mul 2 2 2, Matrix.toEuclideanLin_conjTranspose_eq_adjoint,
62
+ hU, Matrix.toLpLin_one]
63
+ exact l.adjoint_comp_self'
64
+ · apply Matrix.toEuclideanLin.injective
65
+ rw [Matrix.toLpLin_mul 2 2 2, hU]
66
+ exact hl.symm
67
+
68
+ end MatrixPolar
69
+
70
+ end
71
+
72
+ end OAI
lean/OAI/InformationTheory/Entanglement/MatrixTraceMeasure.lean ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.DensityPositivity
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder ENNReal MeasureTheory Matrix.Norms.L2Operator
7
+ open Matrix MeasureTheory Filter
8
+ attribute [local instance] Classical.propDecidable
9
+ namespace SecretKey
10
+ open ChannelCompletion
11
+ variable {Ω : Type*} [MeasurableSpace Ω] {n : Type} [Fintype n]
12
+ namespace PositiveMatrixMeasure
13
+ variable (W : PositiveMatrixMeasure Ω n)
14
+ def traceSigned : SignedMeasure Ω := ComplexMeasure.re (∑ i, W.entry i i)
15
+ lemma traceSigned_apply (s : Set Ω) : W.traceSigned s=(Matrix.trace (W.value s)).re := by
16
+ change ((∑ i, W.entry i i) s).re=_
17
+ simp only [_root_.sum_apply,value,Matrix.trace,Matrix.diag]
18
+ lemma traceSigned_nonneg : 0 ≤[Set.univ] W.traceSigned := by
19
+ apply VectorMeasure.restrict_le_restrict_of_subset_le
20
+ intro s hs _
21
+ change 0≤W.traceSigned s
22
+ rw [W.traceSigned_apply]
23
+ exact
24
+ (Complex.nonneg_iff.mp (W.positive s hs).trace_nonneg).1
25
+
26
+ def traceMeasure : Measure Ω :=
27
+ W.traceSigned.toMeasureOfZeroLE Set.univ MeasurableSet.univ W.traceSigned_nonneg
28
+ instance : IsFiniteMeasure W.traceMeasure := SignedMeasure.toMeasureOfZeroLE_finite _ _ _
29
+ lemma traceMeasure_real {s : Set Ω} (hs : MeasurableSet s) :
30
+ W.traceMeasure.real s=(Matrix.trace (W.value s)).re := by
31
+ rw [traceMeasure,SignedMeasure.toMeasureOfZeroLE_real_apply _ _ _ hs,Set.univ_inter,
32
+ W.traceSigned_apply]
33
+ lemma trace_domination {μ : Measure Ω} (h : W.traceMeasure≪μ) :
34
+ ∀ s, MeasurableSet s → μ s=0 → (Matrix.trace (W.value s)).re=0 := by
35
+ intro s hs hz
36
+ rw [← W.traceMeasure_real hs,measureReal_def,h hz,ENNReal.toReal_zero]
37
+
38
+ def positiveDensity (μ : Measure Ω) (x : Ω) : Mat n :=
39
+ if (W.density μ x).PosSemidef then W.density μ x else 0
40
+ lemma positiveDensity_psd (μ : Measure Ω) (x : Ω) : (W.positiveDensity μ x).PosSemidef := by
41
+ unfold positiveDensity
42
+ split
43
+ · assumption
44
+ · exact Matrix.PosSemidef.zero
45
+ lemma positiveDensity_measurable [DecidableEq n] (μ : Measure Ω) :
46
+ Measurable (W.positiveDensity μ) := by
47
+ apply (W.density_measurable (μ := μ)).ite _ measurable_const
48
+ simpa only [Matrix.nonneg_iff_posSemidef] using
49
+ measurableSet_le (show Measurable (fun _ : Ω => (0 : Mat n)) from measurable_const)
50
+ (W.density_measurable (μ := μ))
51
+ lemma positiveDensity_ae_eq {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ) :
52
+ W.positiveDensity μ=ᵐ[μ] W.density μ := by
53
+ filter_upwards [W.density_ae_psd (W.trace_domination h)] with x hx
54
+ exact ite_eq_left hx
55
+ lemma positiveDensity_integrable {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ)
56
+ (i j : n) : Integrable (fun x => W.positiveDensity μ x i j) μ := by
57
+ refine (W.density_integrable i j).congr ?_
58
+ filter_upwards [W.positiveDensity_ae_eq h] with x hx
59
+ exact (congrArg (fun M : Mat n => M i j) hx).symm
60
+ lemma positiveDensity_setIntegral {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ)
61
+ {s : Set Ω} (hs : MeasurableSet s) (i j : n) :
62
+ (∫ x in s, W.positiveDensity μ x i j ∂μ)=W.value s i j := by
63
+ rw [integral_congr_ae (ae_restrict_of_ae (W.positiveDensity_ae_eq h |>.mono
64
+ (fun x hx => congrArg (fun M : Mat n => M i j) hx)))]
65
+ exact W.density_setIntegral (W.trace_domination h) hs i j
66
+ lemma positiveDensity_trace_integrable {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ) :
67
+ Integrable (fun x => (Matrix.trace (W.positiveDensity μ x)).re) μ := by
68
+ exact (integrable_finsetSum _ fun i _ => W.positiveDensity_integrable h i i).re
69
+ lemma positiveDensity_trace_setIntegral {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ)
70
+ {s : Set Ω} (hs : MeasurableSet s) :
71
+ (∫ x in s, (Matrix.trace (W.positiveDensity μ x)).re ∂μ)=W.traceMeasure.real s := by
72
+ rw [W.traceMeasure_real hs]
73
+ change (∫ x in s, RCLike.re (Matrix.trace (W.positiveDensity μ x)) ∂μ)=_
74
+ have hi : Integrable (fun x => Matrix.trace (W.positiveDensity μ x)) μ :=
75
+ integrable_finsetSum Finset.univ (fun i _ => W.positiveDensity_integrable h i i)
76
+ rw [integral_re hi.integrableOn]
77
+ exact congrArg Complex.re ((integral_finsetSum Finset.univ
78
+ (fun i _ => (W.positiveDensity_integrable h i i).integrableOn)).trans
79
+ (Finset.sum_congr rfl (fun i _ => W.positiveDensity_setIntegral h hs i i)))
80
+ end PositiveMatrixMeasure
81
+
82
+ end SecretKey
83
+
84
+ end
85
+
86
+ end OAI
lean/OAI/InformationTheory/Entanglement/MultiTensor.lean ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionData
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators
7
+ open Matrix
8
+ namespace FiniteConstruction
9
+ open ChannelCompletion
10
+ variable {S V A : Type} [Fintype S] [Fintype V] [Fintype A]
11
+ [DecidableEq S] [DecidableEq V]
12
+
13
+ def multiTensor (M : S → Mat V) : Mat (S → V) := fun i j => ∏ s, M s (i s) (j s)
14
+ omit [DecidableEq V] in
15
+ lemma multiTensor_mul (M N : S → Mat V) :
16
+ multiTensor M*multiTensor N=multiTensor (fun s => M s*N s) := by
17
+ ext i j
18
+ simp only [Matrix.mul_apply,multiTensor,← Finset.prod_mul_distrib]
19
+ exact (Fintype.prod_sum (fun s : S => fun k : V => M s (i s) k*N s k (j s))).symm
20
+ omit [Fintype V] [DecidableEq S] in
21
+ lemma multiTensor_one : multiTensor (fun _ : S => (1 : Mat V))=1 := by
22
+ ext i j
23
+ simp only [multiTensor,Matrix.one_apply]
24
+ rw [Fintype.prod_boole]
25
+ simp only [funext_iff]
26
+ omit [Fintype V] [DecidableEq S] [DecidableEq V] in
27
+ lemma multiTensor_zero_of (M : S → Mat V) (s : S) (hs : M s=0) : multiTensor M=0 := by
28
+ ext i j
29
+ change (∏ t, M t (i t) (j t))=0
30
+ exact Finset.prod_eq_zero (Finset.mem_univ s) (by rw [hs]; rfl)
31
+ omit [Fintype V] [DecidableEq S] [DecidableEq V] in
32
+ lemma multiTensor_adjoint (M : S → Mat V) :
33
+ (multiTensor M)ᴴ=multiTensor (fun s => (M s)ᴴ) := by
34
+ ext i j
35
+ simp [multiTensor,Matrix.conjTranspose_apply]
36
+ omit [Fintype V] [DecidableEq S] [DecidableEq V] in
37
+ lemma multiTensor_hermitian (M : S → Mat V) (hM : ∀ s, (M s).IsHermitian) :
38
+ (multiTensor M).IsHermitian := by
39
+ rw [Matrix.IsHermitian,multiTensor_adjoint]
40
+ simp_rw [(hM _).eq]
41
+ omit [DecidableEq V] in
42
+ lemma multiTensor_idempotent (M : S → Mat V) (hM : ∀ s, M s*M s=M s) :
43
+ multiTensor M*multiTensor M=multiTensor M := by
44
+ rw [multiTensor_mul]
45
+ simp_rw [hM]
46
+ omit [DecidableEq V] in
47
+ lemma multiTensor_commute (M N : S → Mat V) (h : ∀ s, M s*N s=N s*M s) :
48
+ multiTensor M*multiTensor N=multiTensor N*multiTensor M := by
49
+ rw [multiTensor_mul,multiTensor_mul]
50
+ simp_rw [h]
51
+ omit [DecidableEq V] in
52
+ lemma multiTensor_trace (M : S → Mat V) :
53
+ Matrix.trace (multiTensor M)=∏ s, Matrix.trace (M s) := by
54
+ change (∑ i : S → V, ∏ s, M s (i s) (i s))=∏ s, ∑ i, M s i i
55
+ exact (Fintype.prod_sum (fun s : S => fun i : V => M s i i)).symm
56
+ omit [Fintype V] [DecidableEq V] in
57
+ lemma multiTensor_sum (M : S → A → Mat V) :
58
+ (∑ a : S → A, multiTensor (fun s => M s (a s)))=
59
+ multiTensor (fun s => ∑ a, M s a) := by
60
+ ext i j
61
+ simp only [Matrix.sum_apply,multiTensor]
62
+ exact (Fintype.prod_sum (fun s : S => fun a : A => M s a (i s) (j s))).symm
63
+ omit [Fintype V] in
64
+ lemma multiTensor_complete (M : S → A → Mat V) (hM : ∀ s, ∑ a, M s a=1) :
65
+ (∑ a : S → A, multiTensor (fun s => M s (a s)))=1 := by
66
+ rw [multiTensor_sum]
67
+ simp only [hM,multiTensor_one]
68
+ omit [Fintype A] [DecidableEq V] in
69
+ lemma multiTensor_orthogonal (M : S → A → Mat V)
70
+ (hM : ∀ s a b, a ≠ b → M s a*M s b=0)
71
+ (a b : S → A) (hab : a ≠ b) :
72
+ multiTensor (fun s => M s (a s))*multiTensor (fun s => M s (b s))=0 := by
73
+ rw [multiTensor_mul]
74
+ obtain ⟨s,hs⟩ := Function.ne_iff.mp hab
75
+ exact multiTensor_zero_of _ s (hM s _ _ hs)
76
+ omit [DecidableEq V] in
77
+ lemma multiTensor_trace_mul (M N : S → Mat V) :
78
+ Matrix.trace (multiTensor M*multiTensor N)=∏ s, Matrix.trace (M s*N s) := by
79
+ rw [multiTensor_mul,multiTensor_trace]
80
+ end FiniteConstruction
81
+
82
+ end
83
+
84
+ end OAI
lean/OAI/InformationTheory/Entanglement/NormalizeRepresentation.lean ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.TensorTools
2
+ import OAI.InformationTheory.Entanglement.EffectNormalization
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
8
+ open Matrix
9
+ namespace SecretKey
10
+ open ChannelCompletion TensorCriterion
11
+ variable {n m p q : Type} [Fintype n] [Fintype m] [Fintype p] [Fintype q]
12
+ [DecidableEq n] [DecidableEq m] [DecidableEq p] [DecidableEq q]
13
+
14
+ lemma ad_one : ad (1 : Mat n)=LinearMap.id := by
15
+ ext A i j
16
+ simp [ad_apply]
17
+
18
+ omit [DecidableEq p] [DecidableEq q] in
19
+ lemma tensorMap_ad_left (F : Map n p) (G : Map m q) (S : Mat n) :
20
+ tensorMap (F.comp (ad S)) G=(tensorMap F G).comp (ad (S ⊗ₖ (1 : Mat m))) := by
21
+ rw [← tensorMap_ad,ad_one,tensorMap_comp]
22
+ simp
23
+
24
+ omit [Fintype p] [DecidableEq n] [DecidableEq p] in
25
+ lemma cp_ad_input_transpose {F : Map n p} (hFT : CP (F.comp transposeMap)) (S : Mat n) :
26
+ CP ((F.comp (ad S)).comp transposeMap) := by
27
+ have he : (ad S).comp transposeMap = transposeMap.comp (ad (Sᴴ)ᵀ) := by
28
+ have hs : ((Sᴴ)ᵀ)ᴴ=Sᵀ := by
29
+ ext i j
30
+ simp [Matrix.conjTranspose_apply]
31
+ ext A i j
32
+ simp only [LinearMap.comp_apply,transposeMap_apply,ad_apply,hs,
33
+ Matrix.transpose_mul,Matrix.transpose_transpose,Matrix.mul_assoc]
34
+ rw [LinearMap.comp_assoc,he,← LinearMap.comp_assoc]
35
+ exact cp_comp hFT (cp_ad _)
36
+
37
+ omit [DecidableEq q] in
38
+ lemma normalized_representation (R : Mat (p × q)) (hR : Represented R)
39
+ (X : Fin 2 → Mat p) (hX : ∀ i, (X i).PosSemidef) :
40
+ ∃ r s : ℕ, 0<r ∧ 0<s ∧
41
+ ∃ (L : Map (Fin r) p) (M : Map (Fin s) q) (χ : Fin r × Fin s → ℂ),
42
+ CP L ∧ CP (L.comp transposeMap) ∧ CP M ∧ CP (M.comp transposeMap) ∧
43
+ R=tensorMap L M (projector χ) ∧ Commute (hsAdjoint L (X 0)) (hsAdjoint L (X 1)) := by
44
+ obtain ⟨_,_,r,s,hr,hs,L,M,χ,hL,hLT,hM,hMT,hR⟩ := hR
45
+ have hA (i : Fin 2) := cp_positive (cp_hsAdjoint hL) (hX i)
46
+ obtain ⟨S,T,hST,hTS,hcomm⟩ := commuting_normalization (hA 0) (hA 1)
47
+ refine ⟨r,s,hr,hs,L.comp (ad S),M,(T ⊗ₖ (1 : Mat (Fin s))).mulVec χ,
48
+ cp_comp hL (cp_ad S),cp_ad_input_transpose hLT S,hM,hMT,?_,?_⟩
49
+ · rw [tensorMap_ad_left,LinearMap.comp_apply,← ad_projector,hR]
50
+ congr 1
51
+ symm
52
+ rw [ad_apply,ad_apply]
53
+ have hprod : (S ⊗ₖ (1 : Mat (Fin s)))*(T ⊗ₖ (1 : Mat (Fin s)))=1 := by
54
+ rw [← Matrix.mul_kronecker_mul,hST,Matrix.one_mul,Matrix.one_kronecker_one]
55
+ calc
56
+ (S ⊗ₖ 1) * ((T ⊗ₖ 1) * projector χ * (T ⊗ₖ 1)ᴴ) * (S ⊗ₖ 1)ᴴ =
57
+ ((S ⊗ₖ 1)*(T ⊗ₖ 1))*projector χ*((S ⊗ₖ 1)*(T ⊗ₖ 1))ᴴ := by
58
+ simp only [Matrix.conjTranspose_mul,Matrix.mul_assoc]
59
+ _ = projector χ := by rw [hprod,Matrix.conjTranspose_one,Matrix.one_mul,Matrix.mul_one]
60
+ · rw [hsAdjoint_ad_comp hL,hsAdjoint_ad_comp hL]
61
+ exact hcomm
62
+ end SecretKey
63
+
64
+ end
65
+
66
+ end OAI
lean/OAI/InformationTheory/Entanglement/NormalizedProbe.lean ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.FiniteInputInstrument
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder MeasureTheory Kronecker ENNReal NNReal
7
+ open MeasureTheory Matrix
8
+ namespace SecretKey
9
+ open ChannelCompletion TensorCriterion
10
+ variable {Ω : Type*} [MeasurableSpace Ω]
11
+ variable {n e d : Type} [Fintype n] [Fintype e] [Fintype d]
12
+ [DecidableEq n] [DecidableEq e] [DecidableEq d]
13
+ namespace PositiveMatrixMeasure
14
+
15
+ omit [DecidableEq n] [DecidableEq e] [DecidableEq d] in
16
+ theorem filter_comp (W : PositiveMatrixMeasure Ω n) (B : Matrix e n ℂ)
17
+ (C : Matrix d e ℂ) : (W.filter B).filter C=W.filter (C*B) := by
18
+ apply ext_entry_default
19
+ ext i j s hs
20
+ change ((W.filter B).filter C).value s i j=(W.filter (C*B)).value s i j
21
+ rw [filter_value,filter_value,filter_value,Matrix.conjTranspose_mul]
22
+ simp only [Matrix.mul_assoc]
23
+ end PositiveMatrixMeasure
24
+ namespace FiniteInputInstrument
25
+ variable (I : FiniteInputInstrument n Ω)
26
+
27
+ def normalizedProbe : PositiveMatrixMeasure Ω n :=
28
+ I.rawProbe.filter (((Real.sqrt (Fintype.card n : ℝ) : ℂ)⁻¹) • (1 : Mat n))
29
+ omit [DecidableEq n] in
30
+ lemma sqrt_card_ne_zero [Nonempty n] : (Real.sqrt (Fintype.card n : ℝ) : ℂ)≠0 := by
31
+ exact_mod_cast (Real.sqrt_pos.2 (by exact_mod_cast Fintype.card_pos)).ne'
32
+ omit [DecidableEq n] in
33
+ lemma sqrt_card_mul : (Real.sqrt (Fintype.card n : ℝ) : ℂ)*
34
+ (Real.sqrt (Fintype.card n : ℝ) : ℂ)=(Fintype.card n : ℂ) := by
35
+ rw [← Complex.ofReal_mul,Real.mul_self_sqrt (by positivity),Complex.ofReal_natCast]
36
+
37
+ theorem normalizedProbe_value (s : Set Ω) :
38
+ I.normalizedProbe.value s=(Fintype.card n : ℂ)⁻¹ • I.rawProbe.value s := by
39
+ unfold normalizedProbe
40
+ rw [PositiveMatrixMeasure.filter_value,Matrix.conjTranspose_smul,
41
+ Matrix.conjTranspose_one]
42
+ simp only [map_inv₀,Complex.star_def,Complex.conj_ofReal,Matrix.smul_mul,
43
+ Matrix.one_mul,Matrix.mul_smul,Matrix.mul_one,smul_smul]
44
+ rw [← mul_inv,sqrt_card_mul]
45
+
46
+ omit [DecidableEq e] in
47
+ theorem normalizedProbe_filter [Nonempty n] (B : Matrix e n ℂ) :
48
+ I.normalizedProbe.filter ((Real.sqrt (Fintype.card n : ℝ) : ℂ) • B)=
49
+ I.purificationLaw B := by
50
+ rw [purificationLaw_eq_filter]
51
+ unfold normalizedProbe
52
+ rw [PositiveMatrixMeasure.filter_comp]
53
+ congr 1
54
+ rw [Matrix.smul_mul,Matrix.mul_smul,Matrix.mul_one,smul_smul,
55
+ mul_inv_cancel₀ sqrt_card_ne_zero,one_smul]
56
+ theorem normalizedProbe_trace [Nonempty n] :
57
+ Matrix.trace (I.normalizedProbe.value Set.univ)=1 := by
58
+ rw [normalizedProbe_value,rawProbe_total,Matrix.trace_smul,Matrix.trace_one]
59
+ change (Fintype.card n : ℂ)⁻¹*(Fintype.card n : ℂ)=1
60
+ exact inv_mul_cancel₀ (by exact_mod_cast (Fintype.card_pos : 0<Fintype.card n).ne')
61
+ instance normalizedProbe_probability [Nonempty n] :
62
+ IsProbabilityMeasure I.normalizedProbe.traceMeasure := by
63
+ constructor
64
+ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) ENNReal.one_ne_top).mp
65
+ change I.normalizedProbe.traceMeasure.real Set.univ=(1 : ℝ≥0∞).toReal
66
+ rw [PositiveMatrixMeasure.traceMeasure_real _ MeasurableSet.univ,I.normalizedProbe_trace]
67
+ simp
68
+ end FiniteInputInstrument
69
+
70
+ lemma product_normalized_probe_amplitude {a b : Type} [Fintype a] [Fintype b]
71
+ [DecidableEq a] [DecidableEq b] :
72
+ (((Real.sqrt (Fintype.card a : ℝ) : ℂ)⁻¹ • (1 : Mat a)) ⊗ₖ
73
+ ((Real.sqrt (Fintype.card b : ℝ) : ℂ)⁻¹ • (1 : Mat b)))=
74
+ (Real.sqrt (Fintype.card (a×b) : ℝ) : ℂ)⁻¹ • (1 : Mat (a×b)) := by
75
+ rw [Matrix.smul_kronecker,Matrix.kronecker_smul,smul_smul,Matrix.one_kronecker_one,
76
+ ← mul_inv,← Complex.ofReal_mul,← Real.sqrt_mul (by positivity)]
77
+ simp only [Fintype.card_prod,Nat.cast_mul]
78
+
79
+ theorem normalized_product_probe_filter {a b : Type} [Fintype a] [Fintype b]
80
+ [DecidableEq a] [DecidableEq b] [Nonempty a] [Nonempty b]
81
+ (I : FiniteInputInstrument (a×b) Ω) (R : Mat (a×b)) :
82
+ I.normalizedProbe.filter (canonicalProbeFilter R)=
83
+ I.purificationLaw (CFC.sqrt R)ᵀ := by
84
+ convert I.normalizedProbe_filter (CFC.sqrt R)ᵀ using 1
85
+ simp only [canonicalProbeFilter,Fintype.card_prod,Nat.cast_mul]
86
+
87
+ end SecretKey
88
+
89
+ end
90
+
91
+ end OAI
lean/OAI/InformationTheory/Entanglement/NormalizedPurificationConsumer.lean ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ArbitraryPurificationConsumer
2
+ import OAI.InformationTheory.Entanglement.ProbeRescaling
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped BigOperators ENNReal NNReal MeasureTheory InnerProductSpace ComplexOrder MatrixOrder Kronecker
8
+ open MeasureTheory Matrix ContinuousLinearMap ProbabilityTheory Filter
9
+ namespace SecretKey
10
+ open ChannelCompletion TensorCriterion
11
+ variable {T : Type*} [MeasurableSpace T]
12
+ variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m]
13
+ omit [DecidableEq n] in
14
+ lemma hilbertEmbed_smul_vectors {H : Type*} [NormedAddCommGroup H]
15
+ [InnerProductSpace ℂ H] [CompleteSpace H] (x : n→H) (d : ℂ) (A : Mat n) :
16
+ hilbertEmbed (fun i => d • x i) A=hilbertEmbed x ((d*star d) • A) := by
17
+ ext u
18
+ rw [hilbertEmbed_apply,hilbertEmbed_apply]
19
+ apply Finset.sum_congr rfl; intro i hi
20
+ apply Finset.sum_congr rfl; intro j hj
21
+ simp only [inner_smul_left,smul_smul,Matrix.smul_apply,smul_eq_mul]
22
+ congr 1
23
+ simp only [starRingEnd_apply]
24
+ ring
25
+ omit [DecidableEq n] in
26
+ lemma hilbertEmbed_normalized_filter {H : Type*} [NormedAddCommGroup H]
27
+ [InnerProductSpace ℂ H] [CompleteSpace H] (x : n→H) (A : Mat n) :
28
+ hilbertEmbed (fun i => (Real.sqrt (Fintype.card n : ℝ) : ℂ) • x i) A=
29
+ hilbertEmbed x ((Fintype.card n : ℂ) • A) := by
30
+ rw [hilbertEmbed_smul_vectors,Complex.star_def,Complex.conj_ofReal,
31
+ FiniteInputInstrument.sqrt_card_mul]
32
+
33
+ theorem normalized_purification_tested_gap
34
+ {Ω : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω]
35
+ (ν : Measure Ω) [IsFiniteMeasure ν] (t : Ω→T) (ht : Measurable t)
36
+ {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ)
37
+ (hind : CondIndep (MeasurableSpace.comap t inferInstance) A B ht.comap_le ν)
38
+ (a : Fin 2→Option (PositiveTestIndex n)→Set Ω)
39
+ (q : Fin 2→Option (PositiveTestIndex m)→Set Ω)
40
+ (ha : ∀ i r, MeasurableSet[A] (a i r)) (hq : ∀ j s, MeasurableSet[B] (q j s))
41
+ (M : Fin 2→Fin 2→PositiveMatrixMeasure T (n×m))
42
+ (hdom : ∀ i j, (M i j).traceMeasure ≪ (@Measure.map Ω T mΩ _ t ν))
43
+ (hleft : ∀ i r s, MeasurableSet s →
44
+ (∑ j, (Matrix.trace ((probePOVM r ⊗ₖ (1 : Mat m))*(M i j).value s)).re)=
45
+ ν.real (a i r∩t⁻¹' s))
46
+ (hright : ∀ j g s, MeasurableSet s →
47
+ (∑ i, (Matrix.trace (((1 : Mat n) ⊗ₖ probePOVM g)*(M i j).value s)).re)=
48
+ ν.real (q j g∩t⁻¹' s))
49
+ (hjoint : ∀ i j r g s, MeasurableSet s →
50
+ (Matrix.trace ((probePOVM r ⊗ₖ probePOVM g)*(M i j).value s)).re=
51
+ ν.real ((a i r∩q j g)∩t⁻¹' s))
52
+ {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
53
+ {ι : Type*} (b : HilbertBasis ι ℂ H)
54
+ (R : Mat (n×m)) (hR : Represented R) (i₀ : n×m)
55
+ (x : (n×m)→H) (hxGram : ∀ i j, inner ℂ (x i) (x j)=Rᵀ i j)
56
+ (W : Fin 2→Fin 2→PositiveHilbertMeasure T H b)
57
+ (hW : ∀ i j s, MeasurableSet s → (W i j).value s=
58
+ hilbertEmbed (fun k => (Real.sqrt ((Fintype.card n : ℝ)*Fintype.card m) : ℂ) • x k)
59
+ ((M i j).value s))
60
+ (hW1 : (∑ i, ∑ j, hilbertTrace b ((W i j).value Set.univ))=1)
61
+ (σ : PositiveHilbertMeasure T H b) (hσ1 : σ.traceMeasure Set.univ=1) :
62
+ ENNReal.ofReal (1/5) ≤ hilbertCQDistance b W σ := by
63
+ let c : ℝ≥0 := Fintype.card (n×m)
64
+ let N := fun i j => (M i j).scale (c : ℝ) (NNReal.coe_nonneg c)
65
+ apply arbitrary_purification_tested_gap (c•ν) t ht hA hB
66
+ (condIndep_rescale ht.comap_le hA hB hind c) a q ha hq N
67
+ ?_ ?_ ?_ ?_ b R hR i₀ x hxGram W ?_ hW1 σ hσ1
68
+ · intro i j
69
+ rw [Measure.map_smul c ht.aemeasurable]
70
+ exact (M i j).scale_domination (hdom i j) c
71
+ · intro i r s hs
72
+ simp only [N,PositiveMatrixMeasure.scale_born,← Finset.mul_sum,
73
+ hleft i r s hs,measureReal_nnreal_smul_apply]
74
+ · intro j g s hs
75
+ simp only [N,PositiveMatrixMeasure.scale_born,← Finset.mul_sum,
76
+ hright j g s hs,measureReal_nnreal_smul_apply]
77
+ · intro i j r g s hs
78
+ simp only [N,PositiveMatrixMeasure.scale_born,hjoint i j r g s hs,
79
+ measureReal_nnreal_smul_apply]
80
+ · intro i j s hs
81
+ rw [hW i j s hs]
82
+ have he : (Real.sqrt ((Fintype.card n : ℝ)*Fintype.card m) : ℂ)=
83
+ (Real.sqrt (Fintype.card (n×m) : ℝ) : ℂ) := by
84
+ simp only [Fintype.card_prod,Nat.cast_mul]
85
+ rw [he,hilbertEmbed_normalized_filter]
86
+ rfl
87
+
88
+ end SecretKey
89
+
90
+ end
91
+
92
+ end OAI
lean/OAI/InformationTheory/Entanglement/OperationalNorm.lean ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open Filter
7
+ open scoped Topology
8
+ namespace SecretKey
9
+
10
+ theorem recovered_gap_limit {E : Type*} [SeminormedAddCommGroup E]
11
+ {D : ℕ → Type*} [∀ k, SeminormedAddCommGroup (D k)]
12
+ (τ : ℕ → E) (τlim γ : E) (original : (k : ℕ) → D k)
13
+ (recover : (k : ℕ) → E → D k)
14
+ (hrec : ∀ k, recover k (τ k)=original k)
15
+ (hcontract : ∀ k x y, ‖recover k x-recover k y‖≤‖x-y‖)
16
+ (hgap : ∀ k, 1/5≤‖original k-recover k γ‖)
17
+ (hlim : Tendsto τ atTop (𝓝 τlim)) : 1/5≤‖τlim-γ‖ := by
18
+ have ht : Tendsto (fun k => ‖τ k-γ‖) atTop (𝓝 ‖τlim-γ‖) :=
19
+ (hlim.sub tendsto_const_nhds).norm
20
+ apply ge_of_tendsto ht
21
+ exact Filter.Eventually.of_forall fun k => (hgap k).trans (by simpa only [hrec] using hcontract k (τ k) γ)
22
+
23
+ theorem abort_replacement_bound {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E]
24
+ (δ : ℝ) (hδ0 : 0≤δ) (hδ1 : δ≤1) (ok bad γ : E)
25
+ (hstates : ‖bad-γ‖≤2) :
26
+ ‖((1-δ) • ok+δ • bad)-γ‖≤(1-δ)*‖ok-γ‖+2*δ := by
27
+ have he : ((1-δ) • ok+δ • bad)-γ=(1-δ) • (ok-γ)+δ • (bad-γ) := by
28
+ module
29
+ rw [he]
30
+ calc
31
+ _≤‖(1-δ) • (ok-γ)‖+‖δ • (bad-γ)‖ := norm_add_le _ _
32
+ _=(1-δ)*‖ok-γ‖+δ*‖bad-γ‖ := by
33
+ rw [norm_smul,norm_smul,Real.norm_eq_abs,Real.norm_eq_abs,
34
+ abs_of_nonneg (sub_nonneg.mpr hδ1),abs_of_nonneg hδ0]
35
+ _≤(1-δ)*‖ok-γ‖+2*δ := by nlinarith
36
+
37
+ theorem vanishing_abort_contradicts_gap (δ error replaced : ℕ → ℝ)
38
+ (hδ0 : ∀ k, 0≤δ k) (hδ1 : ∀ k, δ k≤1) (he0 : ∀ k, 0≤error k)
39
+ (hbound : ∀ k, replaced k≤(1-δ k)*error k+2*δ k)
40
+ (hgap : ∀ k, 1/5≤replaced k)
41
+ (hδ : Tendsto δ atTop (𝓝 0)) (he : Tendsto error atTop (𝓝 0)) : False := by
42
+ have herror : Tendsto (fun k => (1-δ k)*error k) atTop (𝓝 0) :=
43
+ squeeze_zero
44
+ (fun k => mul_nonneg (sub_nonneg.mpr (hδ1 k)) (he0 k))
45
+ (fun k => mul_le_of_le_one_left (he0 k) (sub_le_self _ (hδ0 k))) he
46
+ have ht : Tendsto (fun k => (1-δ k)*error k+2*δ k) atTop (𝓝 0) := by
47
+ simpa using herror.add (hδ.const_mul 2)
48
+ have hh : (1:ℝ)/5≤0 := ge_of_tendsto ht
49
+ (Filter.Eventually.of_forall fun k => (hgap k).trans (hbound k))
50
+ norm_num at hh
51
+
52
+ end SecretKey
53
+
54
+ end
55
+
56
+ end OAI
lean/OAI/InformationTheory/Entanglement/ParityData.lean ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionData
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators Kronecker
7
+ open Matrix
8
+ namespace FiniteConstruction
9
+ open ChannelCompletion
10
+ abbrev Four := Fin 2 × Fin 2
11
+ abbrev Outcome := Fin 2 × Fin 2
12
+ def XQ : Matrix (Fin 2) (Fin 2) ℚ := !![0,1;1,0]
13
+ def ZQ : Matrix (Fin 2) (Fin 2) ℚ := !![1,0;0,-1]
14
+ def JQ : Matrix (Fin 2) (Fin 2) ℚ := !![0,-1;1,0]
15
+ def squareQ : Fin 3 → Fin 3 → Matrix Four Four ℚ :=
16
+ ![![XQ ⊗ₖ 1,1 ⊗ₖ XQ,XQ ⊗ₖ XQ],
17
+ ![1 ⊗ₖ ZQ,ZQ ⊗ₖ 1,ZQ ⊗ₖ ZQ],
18
+ ![XQ ⊗ₖ ZQ,ZQ ⊗ₖ XQ,-(JQ ⊗ₖ JQ)]]
19
+ def contextQ : Fin 6 → Fin 3 → Matrix Four Four ℚ :=
20
+ ![squareQ 0,squareQ 1,squareQ 2,
21
+ (fun i => squareQ i 0),(fun i => squareQ i 1),(fun i => squareQ i 2)]
22
+ def signQ (i : Fin 2) : ℚ := if i=0 then -1 else 1
23
+ def eQ (t : Fin 6) : ℚ := if t=5 then -1 else 1
24
+ def hQ (t : Fin 6) (a : Outcome) : Matrix Four Four ℚ :=
25
+ (1/4 : ℚ) • ((1+signQ a.1 • contextQ t 0)*(1+signQ a.2 • contextQ t 1))
26
+ def eigSignQ (t : Fin 6) (a : Outcome) : Fin 3 → ℚ :=
27
+ ![signQ a.1,signQ a.2,eQ t*signQ a.1*signQ a.2]
28
+
29
+ lemma hQ_symmetric (t : Fin 6) (a : Outcome) : (hQ t a)ᵀ=hQ t a := by
30
+ revert t a
31
+ decide +kernel
32
+ lemma hQ_idempotent (t : Fin 6) (a : Outcome) : hQ t a*hQ t a=hQ t a := by
33
+ revert t a
34
+ decide +kernel
35
+ lemma hQ_orthogonal (t : Fin 6) (a b : Outcome) (hab : a ≠ b) : hQ t a*hQ t b=0 := by
36
+ revert t a b
37
+ decide +kernel
38
+ lemma hQ_complete (t : Fin 6) : ∑ a, hQ t a=1 := by
39
+ revert t
40
+ decide +kernel
41
+ lemma hQ_eigen (t : Fin 6) (a : Outcome) (j : Fin 3) :
42
+ contextQ t j*hQ t a=eigSignQ t a j • hQ t a := by
43
+ revert t a j
44
+ decide +kernel
45
+
46
+ def h (t : Fin 6) (a : Outcome) : Mat Four := (hQ t a).map (Rat.castHom ℂ)
47
+ def context (t : Fin 6) (j : Fin 3) : Mat Four := (contextQ t j).map (Rat.castHom ℂ)
48
+ def eigSign (t : Fin 6) (a : Outcome) (j : Fin 3) : ℂ := eigSignQ t a j
49
+ end FiniteConstruction
50
+
51
+ end
52
+
53
+ end OAI
lean/OAI/InformationTheory/Entanglement/ParityObstruction.lean ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ParityData
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators Kronecker
7
+ open Matrix
8
+ namespace FiniteConstruction
9
+ open ChannelCompletion
10
+ lemma ratMatrix_smul (c : ℚ) (A : Matrix Four Four ℚ) :
11
+ (c • A).map (Rat.castHom ℂ)=(c : ℂ) • A.map (Rat.castHom ℂ) := by
12
+ ext i j
13
+ simp
14
+ lemma h_real (t : Fin 6) (a : Outcome) (i j : Four) : star (h t a i j)=h t a i j := by
15
+ simp [h]
16
+ lemma h_hermitian (t : Fin 6) (a : Outcome) : (h t a).IsHermitian := by
17
+ ext i j
18
+ rw [Matrix.conjTranspose_apply,h_real]
19
+ exact congrArg (fun A : Matrix Four Four ℚ => ((A i j : ℚ) : ℂ)) (hQ_symmetric t a)
20
+ lemma h_idempotent (t : Fin 6) (a : Outcome) : h t a*h t a=h t a := by
21
+ simpa only [Matrix.map_mul,h] using congrArg (fun A : Matrix Four Four ℚ => A.map (Rat.castHom ℂ)) (hQ_idempotent t a)
22
+ lemma h_orthogonal (t : Fin 6) (a b : Outcome) (hab : a ≠ b) : h t a*h t b=0 := by
23
+ unfold h
24
+ rw [← Matrix.map_mul,hQ_orthogonal t a b hab]
25
+ ext i j
26
+ simp
27
+ lemma h_complete (t : Fin 6) : ∑ a, h t a=1 := by
28
+ ext i j
29
+ have he := congrArg (fun A : Matrix Four Four ℚ => ((A i j : ℚ) : ℂ)) (hQ_complete t)
30
+ by_cases hij : i=j <;> simpa [h,Matrix.sum_apply,Matrix.one_apply,hij] using he
31
+ lemma h_eigen (t : Fin 6) (a : Outcome) (j : Fin 3) :
32
+ context t j*h t a=eigSign t a j • h t a := by
33
+ simpa only [Matrix.map_mul,ratMatrix_smul,h,context,eigSign] using
34
+ congrArg (fun A : Matrix Four Four ℚ => A.map (Rat.castHom ℂ)) (hQ_eigen t a j)
35
+ lemma contextQ_symmetric (t : Fin 6) (j : Fin 3) : (contextQ t j)ᵀ=contextQ t j := by
36
+ revert t j
37
+ decide +kernel
38
+ lemma context_hermitian (t : Fin 6) (j : Fin 3) : (context t j).IsHermitian := by
39
+ ext i k
40
+ change star ((contextQ t j k i : ℚ) : ℂ)=((contextQ t j i k : ℚ) : ℂ)
41
+ simp only [star_ratCast]
42
+ exact congrArg (fun A : Matrix Four Four ℚ => ((A i k : ℚ) : ℂ)) (contextQ_symmetric t j)
43
+ lemma h_eigen_right (t : Fin 6) (a : Outcome) (j : Fin 3) :
44
+ h t a*context t j=eigSign t a j • h t a := by
45
+ have he := congrArg Matrix.conjTranspose (h_eigen t a j)
46
+ simpa only [Matrix.conjTranspose_mul,(h_hermitian t a).eq,(context_hermitian t j).eq,
47
+ Matrix.conjTranspose_smul,eigSign,star_ratCast] using he
48
+ lemma shared_context (r c : Fin 3) : context (Fin.castLE (by decide) r) c=
49
+ context ⟨3+c.val,by omega⟩ r := by
50
+ have he : contextQ (Fin.castLE (by decide) r) c = contextQ ⟨3+c.val,by omega⟩ r := by
51
+ revert r c
52
+ decide +kernel
53
+ exact congrArg (fun A : Matrix Four Four ℚ => A.map (Rat.castHom ℂ)) he
54
+ lemma eigSignQ_product (t : Fin 6) (a : Outcome) :
55
+ eigSignQ t a 0*eigSignQ t a 1*eigSignQ t a 2=eQ t := by
56
+ revert t a
57
+ decide +kernel
58
+ lemma eigSign_product (t : Fin 6) (a : Outcome) :
59
+ eigSign t a 0*eigSign t a 1*eigSign t a 2=(eQ t : ℂ) := by
60
+ unfold eigSign
61
+ exact_mod_cast eigSignQ_product t a
62
+
63
+ theorem parity_zero_product (a : Fin 6 → Outcome) :
64
+ ∃ t u : Fin 6, t ≠ u ∧ h t (a t)*h u (a u)=0 := by
65
+ by_contra hn
66
+ push Not at hn
67
+ have consistent (r c : Fin 3) :
68
+ eigSign (Fin.castLE (by decide) r) (a (Fin.castLE (by decide) r)) c=
69
+ eigSign ⟨3+c.val,by omega⟩ (a ⟨3+c.val,by omega⟩) r := by
70
+ let t : Fin 6 := Fin.castLE (by decide) r
71
+ let u : Fin 6 := ⟨3+c.val,by omega⟩
72
+ have hne : t ≠ u := by intro he; have := congrArg Fin.val he; dsimp [t,u] at this; omega
73
+ have he : (eigSign t (a t) c-eigSign u (a u) r) • (h t (a t)*h u (a u))=0 := by
74
+ rw [sub_smul,← Matrix.smul_mul,← h_eigen_right,Matrix.mul_assoc,
75
+ shared_context, h_eigen, Matrix.mul_smul,sub_self]
76
+ exact sub_eq_zero.mp ((smul_eq_zero.mp he).resolve_right (hn t u hne))
77
+ have row :
78
+ (eigSign 0 (a 0) 0*eigSign 0 (a 0) 1*eigSign 0 (a 0) 2)*
79
+ (eigSign 1 (a 1) 0*eigSign 1 (a 1) 1*eigSign 1 (a 1) 2)*
80
+ (eigSign 2 (a 2) 0*eigSign 2 (a 2) 1*eigSign 2 (a 2) 2)=1 := by
81
+ rw [eigSign_product,eigSign_product,eigSign_product]
82
+ norm_num [eQ,Fin.ext_iff]
83
+ have col :
84
+ (eigSign 3 (a 3) 0*eigSign 3 (a 3) 1*eigSign 3 (a 3) 2)*
85
+ (eigSign 4 (a 4) 0*eigSign 4 (a 4) 1*eigSign 4 (a 4) 2)*
86
+ (eigSign 5 (a 5) 0*eigSign 5 (a 5) 1*eigSign 5 (a 5) 2)=-1 := by
87
+ rw [eigSign_product,eigSign_product,eigSign_product]
88
+ norm_num [eQ,Fin.ext_iff]
89
+ have hc0 (r : Fin 3) := consistent r 0
90
+ have hc1 (r : Fin 3) := consistent r 1
91
+ have hc2 (r : Fin 3) := consistent r 2
92
+ simp only [show (⟨3+(0:Fin 3).val,by omega⟩ : Fin 6)=3 by rfl] at hc0
93
+ simp only [show (⟨3+(1:Fin 3).val,by omega⟩ : Fin 6)=4 by rfl] at hc1
94
+ simp only [show (⟨3+(2:Fin 3).val,by omega⟩ : Fin 6)=5 by rfl] at hc2
95
+ have h00 := hc0 0
96
+ have h01 := hc1 0
97
+ have h02 := hc2 0
98
+ have h10 := hc0 1
99
+ have h11 := hc1 1
100
+ have h12 := hc2 1
101
+ have h20 := hc0 2
102
+ have h21 := hc1 2
103
+ have h22 := hc2 2
104
+ have ce0 : Fin.castLE (show 3≤6 by decide) (0:Fin 3)=(0:Fin 6) := by decide
105
+ have ce1 : Fin.castLE (show 3≤6 by decide) (1:Fin 3)=(1:Fin 6) := by decide
106
+ have ce2 : Fin.castLE (show 3≤6 by decide) (2:Fin 3)=(2:Fin 6) := by decide
107
+ simp only [ce0,ce1,ce2] at h00 h01 h02 h10 h11 h12 h20 h21 h22
108
+ rw [h00,h01,h02,h10,h11,h12,h20,h21,h22] at row
109
+ have he : (2:ℂ)=0 := by
110
+ linear_combination -row+col
111
+ norm_num at he
112
+
113
+ end FiniteConstruction
114
+
115
+ end
116
+
117
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalAdaptiveStep.lean ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalVersion
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
7
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter
8
+ namespace SecretKey
9
+ variable {H K L : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
13
+ variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X]
14
+
15
+ theorem physical_history_kernel_eq (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
16
+ (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X)
17
+ (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X)
18
+ (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b c d ((J h).event s) ((G h).event s))
19
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
20
+ (R : S→DensityOperator (tensorHilbertBasis b d))
21
+ (μ : Measure S)
22
+ (hR : R=ᵐ[μ](fun h => densityTensor b d (ρ h) (σ h)))
23
+ (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V))
24
+ (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V)) :
25
+ TraceInstrument.historyKernel G R hmg=ᵐ[μ]TraceInstrument.historyKernel J ρ hm := by
26
+ filter_upwards [hR] with h hh
27
+ change (G h).outcome (R h)=(J h).outcome (ρ h)
28
+ rw [hh]
29
+ exact physical_product_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h)
30
+
31
+ theorem physical_adaptive_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
32
+ (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X)
33
+ (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X)
34
+ (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b c d ((J h).event s) ((G h).event s))
35
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
36
+ (R : S→DensityOperator (tensorHilbertBasis b d))
37
+ (μ : Measure S) [IsProbabilityMeasure μ]
38
+ (hR : R=ᵐ[μ](fun h => densityTensor b d (ρ h) (σ h)))
39
+ (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V))
40
+ (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V))
41
+ (U : ∀ h, (G h).ConditionalUpdate (R h))
42
+ (V : ∀ h, (J h).ConditionalUpdate (ρ h))
43
+ (hf : ∀ x y, Measurable (fun p : S×X => inner ℂ x (((U p.1).state p.2).val.val y)))
44
+ (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x
45
+ ((densityTensor c d ((V p.1).state p.2) (σ p.1)).val.val y)))
46
+ (T : DensityOperator (tensorHilbertBasis c d))
47
+ (hmean : ∀ x y, inner ℂ x (T.val.val y)=∫ p, inner ℂ x (((U p.1).state p.2).val.val y)
48
+ ∂(μ ⊗ₘ TraceInstrument.historyKernel G R hmg)) :
49
+ (μ ⊗ₘ TraceInstrument.historyKernel G R hmg)=
50
+ (μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) ∧
51
+ (fun p : S×X => (U p.1).state p.2)=ᵐ[μ ⊗ₘ TraceInstrument.historyKernel G R hmg]
52
+ (fun p => densityTensor c d ((V p.1).state p.2) (σ p.1)) := by
53
+ have hk := physical_history_kernel_eq b c d J G hG ρ σ R μ hR hm hmg
54
+ have hμ := Measure.compProd_congr hk
55
+ refine ⟨hμ,?_⟩
56
+ rw [hμ] at hmean ⊢
57
+ let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm
58
+ let f := fun p : S×X => (U p.1).state p.2
59
+ let q := fun p : S×X => densityTensor c d ((V p.1).state p.2) (σ p.1)
60
+ apply weak_density_ae_unique (tensorHilbertBasis c d) ν f q T hf hp hmean
61
+ intro Z hZ x y
62
+ have hfi := density_coefficient_integrable (tensorHilbertBasis c d) ν f hf x y
63
+ have hqi := density_coefficient_integrable (tensorHilbertBasis c d) ν q hp x y
64
+ have he : ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y))=
65
+ ν.withDensityᵥ (fun p => inner ℂ x ((q p).val.val y)) := by
66
+ apply complexMeasure_ext_rectangles
67
+ intro A B hA hB
68
+ rw [withDensityᵥ_apply hfi (hA.prod hB),withDensityᵥ_apply hqi (hA.prod hB)]
69
+ change (∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm))=_
70
+ rw [Measure.setIntegral_compProd hA hB hfi.integrableOn,
71
+ Measure.setIntegral_compProd hA hB hqi.integrableOn]
72
+ apply setIntegral_congr_ae hA
73
+ filter_upwards [hR] with h hh
74
+ intro _
75
+ change (∫ z in B, inner ℂ x (((U h).state z).val.val y) ∂(J h).outcome (ρ h))=_
76
+ have hlaw : (G h).outcome (R h)=(J h).outcome (ρ h) := by
77
+ rw [hh]
78
+ exact physical_product_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h)
79
+ rw [← hlaw,← (U h).disintegration B hB x y,hh]
80
+ exact physical_disintegration_all b c d (J h) (ρ h) (σ h) (V h) hB ((G h).event B) (hG h B hB) x y
81
+ have hh := congrArg (fun M : ComplexMeasure (S×X) => M Z) he
82
+ simpa only [withDensityᵥ_apply hfi hZ,withDensityᵥ_apply hqi hZ] using hh
83
+
84
+ end SecretKey
85
+
86
+ end
87
+
88
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalChronology.lean ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalExecutionStep
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
7
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter
8
+ namespace SecretKey
9
+ variable {H K : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ variable {ι κ X : Type*} [MeasurableSpace X]
13
+
14
+ theorem physical_chronological_prefixes (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K)
15
+ (W : (n : ℕ)→PositiveHilbertMeasure (Fin n→X) (HilbertTensor H K) (tensorHilbertBasis b d))
16
+ [∀ n, IsProbabilityMeasure (W n).traceMeasure]
17
+ (ρ : (n : ℕ)→(Fin n→X)→DensityOperator b)
18
+ (σ : (n : ℕ)→(Fin n→X)→DensityOperator d)
19
+ (P : (n : ℕ)→Kernel (Fin n→X) X) [∀ n, IsMarkovKernel (P n)]
20
+ (hm : ∀ n x y, Measurable (fun h => inner ℂ x ((densityTensor b d (ρ n h) (σ n h)).val.val y)))
21
+ (hzero : IsWeakDensity (tensorHilbertBasis b d) (W 0) (W 0).traceMeasure
22
+ (fun h => densityTensor b d (ρ 0 h) (σ 0 h)))
23
+ (hstep : ∀ n, PhysicalExecutionStep b d (W n)
24
+ ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable)
25
+ (ρ n) (σ n) (ρ (n+1) ∘ (historyStepEquiv X n).symm)
26
+ (σ (n+1) ∘ (historyStepEquiv X n).symm) (P n)) :
27
+ (∀ n, IsWeakDensity (tensorHilbertBasis b d) (W n) (W n).traceMeasure
28
+ (fun h => densityTensor b d (ρ n h) (σ n h))) ∧
29
+ (∀ n, (W (n+1)).traceMeasure.map (historyStepEquiv X n)=(W n).traceMeasure ⊗ₘ P n) := by
30
+ have hs n (hd : IsWeakDensity (tensorHilbertBasis b d) (W n) (W n).traceMeasure
31
+ (fun h => densityTensor b d (ρ n h) (σ n h))) :=
32
+ physical_execution_step b d (W n)
33
+ ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable)
34
+ (ρ n) (σ n) (ρ (n+1) ∘ (historyStepEquiv X n).symm)
35
+ (σ (n+1) ∘ (historyStepEquiv X n).symm) (P n)
36
+ (hm n) (fun x y => (hm (n+1) x y).comp (historyStepEquiv X n).symm.measurable) hd (hstep n)
37
+ have hd n : IsWeakDensity (tensorHilbertBasis b d) (W n) (W n).traceMeasure
38
+ (fun h => densityTensor b d (ρ n h) (σ n h)) := by
39
+ induction n with
40
+ | zero => exact hzero
41
+ | succ n ih =>
42
+ obtain ⟨hk,hpost⟩ := hs n ih
43
+ apply weakDensity_of_step (tensorHilbertBasis b d) (W (n+1)) (W (n+1)).traceMeasure
44
+ (fun h => densityTensor b d (ρ (n+1) h) (σ (n+1) h)) (hm (n+1))
45
+ change IsWeakDensity (tensorHilbertBasis b d)
46
+ ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable)
47
+ (((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable).traceMeasure) _
48
+ rw [hk]
49
+ exact hpost
50
+ exact ⟨hd,fun n => (hs n (hd n)).1⟩
51
+
52
+ theorem complete_history_kernel_of_prefixes [StandardBorelSpace X] [Nonempty X]
53
+ (W : (n : ℕ)→Measure (Fin n→X))
54
+ (P : (n : ℕ)→Kernel (Fin n→X) X)
55
+ (hs : ∀ n, (W (n+1)).map (historyStepEquiv X n)=W n ⊗ₘ P n)
56
+ (ν : Measure (ℕ→X))
57
+ (hfull : ∀ n, ν.map (recordPrefix n)=W n) :
58
+ ∀ n, ν.map (fun x => (recordPrefix n x,x n))=ν.map (recordPrefix n) ⊗ₘ P n := by
59
+ intro n
60
+ have he : (fun x : ℕ→X => (recordPrefix n x,x n))=
61
+ (historyStepEquiv X n) ∘ recordPrefix (n+1) := rfl
62
+ rw [he,← Measure.map_map (historyStepEquiv X n).measurable (recordPrefix_measurable (n+1)),
63
+ hfull (n+1),hs n,hfull n]
64
+
65
+ end SecretKey
66
+
67
+ end
68
+
69
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalConditionalUpdate.lean ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.WeakTensorMeasurable
2
+ import OAI.InformationTheory.Entanglement.WeakIntegralForm
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped TensorProduct InnerProductSpace ComplexOrder MeasureTheory
8
+ open ContinuousLinearMap UniformSpace MeasureTheory
9
+ namespace SecretKey
10
+ variable {H K L : Type*}
11
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
12
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
13
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
14
+ variable {ι κ υ : Type*}
15
+ variable {X : Type*} [MeasurableSpace X]
16
+ lemma physical_disintegration_all (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
17
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
18
+ (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ)
19
+ {s : Set X} (hs : MeasurableSet s)
20
+ (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d))
21
+ (hG : IsLeftTraceAction b c d (I.event s) G)
22
+ (x y : HilbertTensor K L) :
23
+ inner ℂ x ((G (densityTensor b d ρ σ).val).val y)=
24
+ ∫ z in s, inner ℂ x ((densityTensor c d (U.state z) σ).val.val y) ∂I.outcome ρ := by
25
+ let R := fun z => densityTensor c d (U.state z) σ
26
+ have hR : ∀ a a', Measurable (fun z => inner ℂ a ((R z).val.val a')) :=
27
+ densityTensor_coefficient_measurable c d U.state (fun _ => σ)
28
+ U.coefficient_measurable (fun _ _ => measurable_const)
29
+ let μ := (I.outcome ρ).restrict s
30
+ let T := (G (densityTensor b d ρ σ).val).val
31
+ have hI (a a') : Integrable (fun z => inner ℂ a ((R z).val.val a')) μ :=
32
+ density_coefficient_integrable (tensorHilbertBasis c d) μ R hR a a'
33
+ have hleft (a : K) (v : L) (z : HilbertTensor K L) :
34
+ inner ℂ z (T (hilbertTmul a v))=∫ t, inner ℂ z ((R t).val.val (hilbertTmul a v)) ∂μ := by
35
+ refine Completion.induction_on z (isClosed_eq (by fun_prop)
36
+ (densityIntegral_left_continuous (tensorHilbertBasis c d) μ R hR _)) ?_
37
+ intro t
38
+ induction t using TensorProduct.inductionOn with
39
+ | tmul p q => exact physical_product_disintegration b c d I ρ σ U hs G hG p a q v
40
+ | add p q hp hq =>
41
+ simp only [Completion.coe_add,inner_add_left,integral_add (hI _ _) (hI _ _),hp,hq]
42
+ change inner ℂ x (T y)=∫ t, inner ℂ x ((R t).val.val y) ∂μ
43
+ refine Completion.induction_on y (isClosed_eq (by fun_prop)
44
+ (densityIntegral_right_continuous (tensorHilbertBasis c d) μ R hR x)) ?_
45
+ intro t
46
+ induction t using TensorProduct.inductionOn with
47
+ | tmul p q => exact hleft p q x
48
+ | add p q hp hq =>
49
+ simp only [Completion.coe_add,map_add,inner_add_right,integral_add (hI _ _) (hI _ _),hp,hq]
50
+
51
+ lemma physical_product_outcome (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
52
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
53
+ (G : TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X)
54
+ (hG : ∀ s, MeasurableSet s → IsLeftTraceAction b c d (I.event s) (G.event s))
55
+ (ρ : DensityOperator b) (σ : DensityOperator d) :
56
+ G.outcome (densityTensor b d ρ σ)=I.outcome ρ := by
57
+ apply Measure.ext
58
+ intro s hs
59
+ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp
60
+ change (G.outcome (densityTensor b d ρ σ)).real s=(I.outcome ρ).real s
61
+ rw [G.outcome_born _ hs]
62
+ exact physical_product_born b c d I ρ σ hs (G.event s) (hG s hs)
63
+
64
+ def physical_product_update (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
65
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
66
+ (G : TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X)
67
+ (hG : ∀ s, MeasurableSet s → IsLeftTraceAction b c d (I.event s) (G.event s))
68
+ (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) :
69
+ G.ConditionalUpdate (densityTensor b d ρ σ) where
70
+ state z := densityTensor c d (U.state z) σ
71
+ coefficient_measurable := densityTensor_coefficient_measurable c d U.state (fun _ => σ)
72
+ U.coefficient_measurable (fun _ _ => measurable_const)
73
+ coefficient_integrable x y := by
74
+ rw [physical_product_outcome b c d I G hG ρ σ]
75
+ exact density_coefficient_integrable (tensorHilbertBasis c d) (I.outcome ρ)
76
+ (fun z => densityTensor c d (U.state z) σ)
77
+ (densityTensor_coefficient_measurable c d U.state (fun _ => σ)
78
+ U.coefficient_measurable (fun _ _ => measurable_const)) x y
79
+ disintegration s hs x y := by
80
+ rw [physical_product_outcome b c d I G hG ρ σ]
81
+ exact physical_disintegration_all b c d I ρ σ U hs (G.event s) (hG s hs) x y
82
+
83
+ end SecretKey
84
+
85
+ end
86
+
87
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalExecutionStep.lean ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalPublicPrefix
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
7
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter
8
+ namespace SecretKey
9
+ variable {H K : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ variable {ι κ S X : Type*} [MeasurableSpace S] [MeasurableSpace X]
13
+
14
+ def IsRawInstrumentTransition (b : HilbertBasis ι ℂ H)
15
+ (W : PositiveHilbertMeasure S H b) (V : PositiveHilbertMeasure (S×X) H b)
16
+ (G : S→TraceInstrument b b X) : Prop :=
17
+ ∀ R : S→DensityOperator b,
18
+ (∀ x y, Measurable (fun h => inner ℂ x ((R h).val.val y))) →
19
+ IsWeakDensity b W W.traceMeasure R →
20
+ ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y,
21
+ V.coeff x y (A ×ˢ B)=∫ h in A, inner ℂ x (((G h).event B (R h).val).val y) ∂W.traceMeasure
22
+
23
+ def IsRawPublicTransition (b : HilbertBasis ι ℂ H)
24
+ (W : PositiveHilbertMeasure S H b) (V : PositiveHilbertMeasure (S×X) H b)
25
+ (P : Kernel S X) : Prop :=
26
+ ∀ R : S→DensityOperator b,
27
+ (∀ x y, Measurable (fun h => inner ℂ x ((R h).val.val y))) →
28
+ IsWeakDensity b W W.traceMeasure R →
29
+ ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y,
30
+ V.coeff x y (A ×ˢ B)=∫ h in A, ((P h).real B : ℂ)*inner ℂ x ((R h).val.val y) ∂W.traceMeasure
31
+
32
+ inductive PhysicalExecutionStep (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K)
33
+ (W : PositiveHilbertMeasure S (HilbertTensor H K) (tensorHilbertBasis b d))
34
+ (V : PositiveHilbertMeasure (S×X) (HilbertTensor H K) (tensorHilbertBasis b d))
35
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
36
+ (ρ' : S×X→DensityOperator b) (σ' : S×X→DensityOperator d) (P : Kernel S X) : Prop
37
+ | left
38
+ (J : S→TraceInstrument b b X)
39
+ (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis b d) X)
40
+ (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b b d ((J h).event s) ((G h).event s))
41
+ (hm : ∀ s, MeasurableSet s → Measurable (fun h => (J h).outcome (ρ h) s))
42
+ (U : ∀ h, (J h).ConditionalUpdate (ρ h))
43
+ (hraw : IsRawInstrumentTransition (tensorHilbertBasis b d) W V G)
44
+ (hstateA : ρ'=fun p => (U p.1).state p.2)
45
+ (hstateB : σ'=σ ∘ Prod.fst)
46
+ (hkernel : P=TraceInstrument.historyKernel J ρ hm) :
47
+ PhysicalExecutionStep b d W V ρ σ ρ' σ' P
48
+ | right
49
+ (J : S→TraceInstrument d d X)
50
+ (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis b d) X)
51
+ (hG : ∀ h s, MeasurableSet s → IsRightTraceAction d d b ((J h).event s) ((G h).event s))
52
+ (hm : ∀ s, MeasurableSet s → Measurable (fun h => (J h).outcome (σ h) s))
53
+ (U : ∀ h, (J h).ConditionalUpdate (σ h))
54
+ (hraw : IsRawInstrumentTransition (tensorHilbertBasis b d) W V G)
55
+ (hstateA : ρ'=ρ ∘ Prod.fst)
56
+ (hstateB : σ'=fun p => (U p.1).state p.2)
57
+ (hkernel : P=TraceInstrument.historyKernel J σ hm) :
58
+ PhysicalExecutionStep b d W V ρ σ ρ' σ' P
59
+ | publicDraw
60
+ (hraw : IsRawPublicTransition (tensorHilbertBasis b d) W V P)
61
+ (hstateA : ρ'=ρ ∘ Prod.fst) (hstateB : σ'=σ ∘ Prod.fst) :
62
+ PhysicalExecutionStep b d W V ρ σ ρ' σ' P
63
+ variable (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K)
64
+
65
+ theorem physical_execution_step
66
+ (W : PositiveHilbertMeasure S (HilbertTensor H K) (tensorHilbertBasis b d))
67
+ (V : PositiveHilbertMeasure (S×X) (HilbertTensor H K) (tensorHilbertBasis b d))
68
+ [IsProbabilityMeasure W.traceMeasure] [IsProbabilityMeasure V.traceMeasure]
69
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
70
+ (ρ' : S×X→DensityOperator b) (σ' : S×X→DensityOperator d) (P : Kernel S X) [IsMarkovKernel P]
71
+ (hR : ∀ x y, Measurable (fun h => inner ℂ x ((densityTensor b d (ρ h) (σ h)).val.val y)))
72
+ (hR' : ∀ x y, Measurable (fun p => inner ℂ x ((densityTensor b d (ρ' p) (σ' p)).val.val y)))
73
+ (hd : IsWeakDensity (tensorHilbertBasis b d) W W.traceMeasure (fun h => densityTensor b d (ρ h) (σ h)))
74
+ (hstep : PhysicalExecutionStep b d W V ρ σ ρ' σ' P) :
75
+ V.traceMeasure=W.traceMeasure ⊗ₘ P ∧
76
+ IsWeakDensity (tensorHilbertBasis b d) V (W.traceMeasure ⊗ₘ P)
77
+ (fun p => densityTensor b d (ρ' p) (σ' p)) := by
78
+ cases hstep with
79
+ | left J G hG hm U hraw ha hb hk =>
80
+ subst ρ'; subst σ'; subst P
81
+ exact physical_raw_prefix b b d J G hG ρ σ W.traceMeasure hm U hR' V
82
+ (hraw _ hR hd)
83
+ | right J G hG hm U hraw ha hb hk =>
84
+ subst ρ'; subst σ'; subst P
85
+ exact physical_right_raw_prefix d d b J G hG σ ρ W.traceMeasure hm U hR' V
86
+ (hraw _ hR hd)
87
+ | publicDraw hraw ha hb =>
88
+ subst ρ'; subst σ'
89
+ exact physical_public_raw_prefix (tensorHilbertBasis b d) W.traceMeasure P
90
+ (fun h => densityTensor b d (ρ h) (σ h)) hR V (hraw _ hR hd)
91
+
92
+ end SecretKey
93
+
94
+ end
95
+
96
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalHistoryRealization.lean ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalChronology
2
+ import OAI.InformationTheory.Entanglement.CausalRealization
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped InnerProductSpace ComplexOrder MeasureTheory unitInterval
8
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter Function
9
+ namespace SecretKey
10
+ variable {H K : Type*}
11
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
12
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
13
+ variable {ι κ X : Type*} [MeasurableSpace X] [StandardBorelSpace X] [Nonempty X]
14
+
15
+ theorem physical_history_realization (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K)
16
+ (role : ℕ→TapeRole) (pub : Set ℕ) (x₀ : X)
17
+ (hsource : ∀ n, role n=.source → n∈pub)
18
+ (W : (n : ℕ)→PositiveHilbertMeasure (Fin n→X) (HilbertTensor H K) (tensorHilbertBasis b d))
19
+ [∀ n, IsProbabilityMeasure (W n).traceMeasure]
20
+ (ρ : (n : ℕ)→(Fin n→X)→DensityOperator b)
21
+ (τ : (n : ℕ)→(Fin n→X)→DensityOperator d)
22
+ (P Q : (n : ℕ)→Kernel (Fin n→X) X)
23
+ [∀ n, IsMarkovKernel (P n)] [∀ n, IsMarkovKernel (Q n)]
24
+ (hlocal : ∀ n, P n=visibleKernel role pub x₀ Q n)
25
+ (hm : ∀ n x y, Measurable (fun h => inner ℂ x ((densityTensor b d (ρ n h) (τ n h)).val.val y)))
26
+ (hzero : IsWeakDensity (tensorHilbertBasis b d) (W 0) (W 0).traceMeasure
27
+ (fun h => densityTensor b d (ρ 0 h) (τ 0 h)))
28
+ (hstep : ∀ n, PhysicalExecutionStep b d (W n)
29
+ ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable)
30
+ (ρ n) (τ n) (ρ (n+1) ∘ (historyStepEquiv X n).symm)
31
+ (τ (n+1) ∘ (historyStepEquiv X n).symm) (P n))
32
+ (ν : Measure (ℕ→X)) [IsProbabilityMeasure ν]
33
+ (hfull : ∀ n, ν.map (recordPrefix n)=(W n).traceMeasure) :
34
+ ∃ g : (n : ℕ)→(Fin n→X)→I→X,
35
+ (∀ n, Measurable (uncurry (g n))) ∧
36
+ ν=uniformTapesLaw.map (sampledHistory (causalSampler role pub x₀ g)) ∧
37
+ ∃ hT : Measurable (completeCausalPublic role pub x₀ g),
38
+ CondIndep ((inferInstance : MeasurableSpace (ℕ→X)).comap (completeCausalPublic role pub x₀ g))
39
+ (roleInfo role .alice ⊔ (inferInstance : MeasurableSpace (ℕ→X)).comap (completeCausalPublic role pub x₀ g))
40
+ (roleInfo role .bob ⊔ (inferInstance : MeasurableSpace (ℕ→X)).comap (completeCausalPublic role pub x₀ g))
41
+ hT.comap_le uniformTapesLaw := by
42
+ have hpre := physical_chronological_prefixes b d W ρ τ P hm hzero hstep
43
+ have hν := complete_history_kernel_of_prefixes (fun n => (W n).traceMeasure) P hpre.2 ν hfull
44
+ apply causal_history_realization role pub x₀ hsource Q ν
45
+ intro n
46
+ rw [← hlocal n]
47
+ exact hν n
48
+
49
+ end SecretKey
50
+
51
+ end
52
+
53
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalProductStep.lean ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.TraceTensor
2
+ import OAI.InformationTheory.Entanglement.WeakProductPrefix
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped TensorProduct InnerProductSpace ComplexOrder MeasureTheory
8
+ open ContinuousLinearMap UniformSpace MeasureTheory ProbabilityTheory
9
+ namespace SecretKey
10
+ variable {H K L : Type*}
11
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
12
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
13
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
14
+ variable {ι κ υ : Type*}
15
+ def traceTensorBilinear (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) :
16
+ TraceClass b →ₗ[ℂ] TraceClass c →ₗ[ℂ] TraceClass (tensorHilbertBasis b c) where
17
+ toFun A :=
18
+ { toFun := traceTensor b c A
19
+ map_add' := fun B C => Subtype.ext (hilbertTensorMap_add_right A.val B.val C.val)
20
+ map_smul' := fun s B => Subtype.ext (hilbertTensorMap_smul_right s A.val B.val) }
21
+ map_add' A B := by
22
+ apply LinearMap.ext
23
+ intro C
24
+ apply Subtype.ext
25
+ exact hilbertTensorMap_add_left A.val B.val C.val
26
+ map_smul' s A := by
27
+ apply LinearMap.ext
28
+ intro B
29
+ apply Subtype.ext
30
+ exact hilbertTensorMap_smul_left s A.val B.val
31
+
32
+ def traceTensorEmbedding (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) :
33
+ TraceClass b ⊗[ℂ] TraceClass c →ₗ[ℂ] TraceClass (tensorHilbertBasis b c) :=
34
+ TensorProduct.lift (traceTensorBilinear b c)
35
+ @[simp] lemma traceTensorEmbedding_tmul (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
36
+ (A : TraceClass b) (B : TraceClass c) :
37
+ traceTensorEmbedding b c (A ⊗ₜ[ℂ] B)=traceTensor b c A B := rfl
38
+ lemma traceTensorEmbedding_trace (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) :
39
+ (traceClassTrace (tensorHilbertBasis b c)).comp (traceTensorEmbedding b c)=
40
+ tensorFunctional (traceClassTrace b) (traceClassTrace c) := by
41
+ apply TensorProduct.ext'
42
+ intro A B
43
+ exact traceTensor_trace b c A B
44
+ lemma traceTensorEmbedding_coeff (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
45
+ (x y : H) (u v : K) :
46
+ (traceClassCoefficient (tensorHilbertBasis b c) (hilbertTmul x u) (hilbertTmul y v)).comp
47
+ (traceTensorEmbedding b c)=
48
+ tensorFunctional (traceClassCoefficient b x y) (traceClassCoefficient c u v) := by
49
+ apply TensorProduct.ext'
50
+ intro A B
51
+ change inner ℂ (hilbertTmul x u) (hilbertTensorMap A.val B.val (hilbertTmul y v))=_
52
+ rw [hilbertTensorMap_tmul,hilbertTmul_inner]
53
+ rfl
54
+ def densityTensor (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
55
+ (ρ : DensityOperator b) (σ : DensityOperator c) : DensityOperator (tensorHilbertBasis b c) :=
56
+ ⟨traceTensor b c ρ.val σ.val,hilbertTensorMap_nonneg ρ.property.1 σ.property.1,by
57
+ rw [traceTensor_trace,ρ.property.2,σ.property.2,mul_one]⟩
58
+
59
+ def IsLeftTraceAction (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
60
+ (d : HilbertBasis υ ℂ L) (F : TraceClass b →ₗ[ℂ] TraceClass c)
61
+ (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d)) : Prop :=
62
+ ∀ A B, G (traceTensor b d A B)=traceTensor c d (F A) B
63
+ lemma leftTraceAction_intertwines (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
64
+ (d : HilbertBasis υ ℂ L) (F : TraceClass b →ₗ[ℂ] TraceClass c)
65
+ (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d))
66
+ (hG : IsLeftTraceAction b c d F G) :
67
+ G.comp (traceTensorEmbedding b d)=
68
+ (traceTensorEmbedding c d).comp (TensorProduct.map F LinearMap.id) := by
69
+ apply TensorProduct.ext'
70
+ intro A B
71
+ exact hG A B
72
+ variable {X : Type*} [MeasurableSpace X]
73
+
74
+ theorem physical_product_born (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
75
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
76
+ (ρ : DensityOperator b) (σ : DensityOperator d) {s : Set X} (hs : MeasurableSet s)
77
+ (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d))
78
+ (hG : IsLeftTraceAction b c d (I.event s) G) :
79
+ (traceClassTrace (tensorHilbertBasis c d) (G (densityTensor b d ρ σ).val)).re=
80
+ (I.outcome ρ).real s := by
81
+ change (traceClassTrace (tensorHilbertBasis c d) (G (traceTensor b d ρ.val σ.val))).re=_
82
+ rw [hG,traceTensor_trace,σ.property.2,mul_one,I.outcome_born ρ hs]
83
+
84
+ theorem physical_product_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
85
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
86
+ (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ)
87
+ {s : Set X} (hs : MeasurableSet s)
88
+ (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d))
89
+ (hG : IsLeftTraceAction b c d (I.event s) G) (x y : K) (u v : L) :
90
+ inner ℂ (hilbertTmul x u) ((G (densityTensor b d ρ σ).val).val (hilbertTmul y v))=
91
+ ∫ z in s, inner ℂ (hilbertTmul x u)
92
+ ((densityTensor c d (U.state z) σ).val.val (hilbertTmul y v)) ∂I.outcome ρ := by
93
+ change inner ℂ (hilbertTmul x u) ((G (traceTensor b d ρ.val σ.val)).val (hilbertTmul y v))=_
94
+ rw [hG]
95
+ change inner ℂ (hilbertTmul x u) (hilbertTensorMap (I.event s ρ.val).val σ.val.val (hilbertTmul y v))=_
96
+ rw [hilbertTensorMap_tmul,hilbertTmul_inner,U.disintegration s hs]
97
+ erw [← integral_mul_const]
98
+ apply setIntegral_congr_fun hs
99
+ intro z hz
100
+ simp [densityTensor,traceTensor,hilbertTmul_inner]
101
+
102
+ end SecretKey
103
+
104
+ end
105
+
106
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalPublicPrefix.lean ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalRightRawPrefix
2
+ import OAI.InformationTheory.Entanglement.HilbertRecordMap
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
8
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter
9
+ namespace SecretKey
10
+ variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ variable {ι S X : Type*} [MeasurableSpace S] [MeasurableSpace X]
12
+
13
+ theorem physical_public_raw_prefix (b : HilbertBasis ι ℂ H)
14
+ (μ : Measure S) [IsProbabilityMeasure μ] (κ : Kernel S X) [IsMarkovKernel κ]
15
+ (ρ : S→DensityOperator b)
16
+ (hm : ∀ x y, Measurable (fun h => inner ℂ x ((ρ h).val.val y)))
17
+ (W : PositiveHilbertMeasure (S×X) H b) [IsProbabilityMeasure W.traceMeasure]
18
+ (hEvent : ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y,
19
+ W.coeff x y (A ×ˢ B)=∫ h in A, ((κ h).real B : ℂ)*inner ℂ x ((ρ h).val.val y) ∂μ) :
20
+ W.traceMeasure=μ ⊗ₘ κ ∧ IsWeakDensity b W (μ ⊗ₘ κ) (ρ ∘ Prod.fst) := by
21
+ let ν := μ ⊗ₘ κ
22
+ let f : S×X→DensityOperator b := ρ ∘ Prod.fst
23
+ have hf : ∀ x y, Measurable (fun p : S×X => inner ℂ x ((f p).val.val y)) :=
24
+ fun x y => (hm x y).comp measurable_fst
25
+ have hd : IsWeakDensity b W ν f := by
26
+ intro Z hZ x y
27
+ have hi := density_coefficient_integrable b ν f hf x y
28
+ have he : W.coeff x y=ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y)) := by
29
+ apply complexMeasure_ext_rectangles
30
+ intro A B hA hB
31
+ rw [withDensityᵥ_apply hi (hA.prod hB)]
32
+ change W.coeff x y (A ×ˢ B)=(∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) ∂(μ ⊗ₘ κ))
33
+ rw [Measure.setIntegral_compProd hA hB hi.integrableOn,hEvent A B hA hB x y]
34
+ apply setIntegral_congr_fun hA
35
+ intro h hh
36
+ change ((κ h).real B : ℂ)*inner ℂ x ((ρ h).val.val y)=∫ _ in B, inner ℂ x ((ρ h).val.val y) ∂κ h
37
+ simp only [integral_const,Measure.restrict_apply_univ,Measure.real,Complex.real_smul]
38
+ rw [he,withDensityᵥ_apply hi hZ]
39
+ exact ⟨weak_density_trace_eq b W ν f hf hd,hd⟩
40
+
41
+ end SecretKey
42
+
43
+ end
44
+
45
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalRawPrefix.lean ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalRightAdaptive
2
+ import OAI.InformationTheory.Entanglement.WeakLawTrace
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
8
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter
9
+ namespace SecretKey
10
+ variable {H K L : Type*}
11
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
12
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
13
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
14
+ variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X]
15
+
16
+ theorem physical_raw_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
17
+ (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X)
18
+ (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X)
19
+ (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b c d ((J h).event s) ((G h).event s))
20
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
21
+ (μ : Measure S) [IsProbabilityMeasure μ]
22
+ (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V))
23
+ (U : ∀ h, (J h).ConditionalUpdate (ρ h))
24
+ (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x
25
+ ((densityTensor c d ((U p.1).state p.2) (σ p.1)).val.val y)))
26
+ (W : PositiveHilbertMeasure (S×X) (HilbertTensor K L) (tensorHilbertBasis c d))
27
+ [IsProbabilityMeasure W.traceMeasure]
28
+ (hEvent : ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y,
29
+ W.coeff x y (A ×ˢ B)=∫ h in A,
30
+ inner ℂ x (((G h).event B (densityTensor b d (ρ h) (σ h)).val).val y) ∂μ) :
31
+ W.traceMeasure=μ ⊗ₘ TraceInstrument.historyKernel J ρ hm ∧
32
+ ∀ Z, MeasurableSet Z → ∀ x y, W.coeff x y Z=
33
+ ∫ p in Z, inner ℂ x ((densityTensor c d ((U p.1).state p.2) (σ p.1)).val.val y)
34
+ ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) := by
35
+ let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm
36
+ let f := fun p : S×X => densityTensor c d ((U p.1).state p.2) (σ p.1)
37
+ have hd (Z : Set (S×X)) (hZ : MeasurableSet Z) (x y : HilbertTensor K L) :
38
+ W.coeff x y Z=∫ p in Z, inner ℂ x ((f p).val.val y) ∂ν := by
39
+ have hi := density_coefficient_integrable (tensorHilbertBasis c d) ν f hp x y
40
+ have he : W.coeff x y=ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y)) := by
41
+ apply complexMeasure_ext_rectangles
42
+ intro A B hA hB
43
+ rw [withDensityᵥ_apply hi (hA.prod hB)]
44
+ change W.coeff x y (A ×ˢ B)=(∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y)
45
+ ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm))
46
+ rw [Measure.setIntegral_compProd hA hB hi.integrableOn,hEvent A B hA hB x y]
47
+ apply setIntegral_congr_fun hA
48
+ intro h hh
49
+ exact physical_disintegration_all b c d (J h) (ρ h) (σ h) (U h) hB
50
+ ((G h).event B) (hG h B hB) x y
51
+ rw [he,withDensityᵥ_apply hi hZ]
52
+ exact ⟨weak_density_trace_eq (tensorHilbertBasis c d) W ν f hp hd,hd⟩
53
+
54
+ end SecretKey
55
+
56
+ end
57
+
58
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalRightAdaptive.lean ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalRightStep
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
7
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter
8
+ namespace SecretKey
9
+ variable {H K L : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
13
+ variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X]
14
+
15
+ theorem physical_right_history_kernel_eq (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
16
+ (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X)
17
+ (G : S→TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X)
18
+ (hG : ∀ h s, MeasurableSet s → IsRightTraceAction b c d ((J h).event s) ((G h).event s))
19
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
20
+ (R : S→DensityOperator (tensorHilbertBasis d b))
21
+ (μ : Measure S)
22
+ (hR : R=ᵐ[μ](fun h => densityTensor d b (σ h) (ρ h)))
23
+ (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V))
24
+ (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V)) :
25
+ TraceInstrument.historyKernel G R hmg=ᵐ[μ]TraceInstrument.historyKernel J ρ hm := by
26
+ filter_upwards [hR] with h hh
27
+ change (G h).outcome (R h)=(J h).outcome (ρ h)
28
+ rw [hh]
29
+ exact physical_right_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h)
30
+
31
+ theorem physical_right_adaptive_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
32
+ (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X)
33
+ (G : S→TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X)
34
+ (hG : ∀ h s, MeasurableSet s → IsRightTraceAction b c d ((J h).event s) ((G h).event s))
35
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
36
+ (R : S→DensityOperator (tensorHilbertBasis d b))
37
+ (μ : Measure S) [IsProbabilityMeasure μ]
38
+ (hR : R=ᵐ[μ](fun h => densityTensor d b (σ h) (ρ h)))
39
+ (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V))
40
+ (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V))
41
+ (U : ∀ h, (G h).ConditionalUpdate (R h))
42
+ (V : ∀ h, (J h).ConditionalUpdate (ρ h))
43
+ (hf : ∀ x y, Measurable (fun p : S×X => inner ℂ x (((U p.1).state p.2).val.val y)))
44
+ (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x
45
+ ((densityTensor d c (σ p.1) ((V p.1).state p.2)).val.val y)))
46
+ (T : DensityOperator (tensorHilbertBasis d c))
47
+ (hmean : ∀ x y, inner ℂ x (T.val.val y)=∫ p, inner ℂ x (((U p.1).state p.2).val.val y)
48
+ ∂(μ ⊗ₘ TraceInstrument.historyKernel G R hmg)) :
49
+ (μ ⊗ₘ TraceInstrument.historyKernel G R hmg)=
50
+ (μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) ∧
51
+ (fun p : S×X => (U p.1).state p.2)=ᵐ[μ ⊗ₘ TraceInstrument.historyKernel G R hmg]
52
+ (fun p => densityTensor d c (σ p.1) ((V p.1).state p.2)) := by
53
+ have hk := physical_right_history_kernel_eq b c d J G hG ρ σ R μ hR hm hmg
54
+ have hμ := Measure.compProd_congr hk
55
+ refine ⟨hμ,?_⟩
56
+ rw [hμ] at hmean ⊢
57
+ let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm
58
+ let f := fun p : S×X => (U p.1).state p.2
59
+ let q := fun p : S×X => densityTensor d c (σ p.1) ((V p.1).state p.2)
60
+ apply weak_density_ae_unique (tensorHilbertBasis d c) ν f q T hf hp hmean
61
+ intro Z hZ x y
62
+ have hfi := density_coefficient_integrable (tensorHilbertBasis d c) ν f hf x y
63
+ have hqi := density_coefficient_integrable (tensorHilbertBasis d c) ν q hp x y
64
+ have he : ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y))=
65
+ ν.withDensityᵥ (fun p => inner ℂ x ((q p).val.val y)) := by
66
+ apply complexMeasure_ext_rectangles
67
+ intro A B hA hB
68
+ rw [withDensityᵥ_apply hfi (hA.prod hB),withDensityᵥ_apply hqi (hA.prod hB)]
69
+ change (∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm))=_
70
+ rw [Measure.setIntegral_compProd hA hB hfi.integrableOn,
71
+ Measure.setIntegral_compProd hA hB hqi.integrableOn]
72
+ apply setIntegral_congr_ae hA
73
+ filter_upwards [hR] with h hh
74
+ intro _
75
+ change (∫ z in B, inner ℂ x (((U h).state z).val.val y) ∂(J h).outcome (ρ h))=_
76
+ have hlaw : (G h).outcome (R h)=(J h).outcome (ρ h) := by
77
+ rw [hh]
78
+ exact physical_right_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h)
79
+ rw [← hlaw,← (U h).disintegration B hB x y,hh]
80
+ exact physical_right_disintegration_all b c d (J h) (ρ h) (σ h) (V h) hB ((G h).event B) (hG h B hB) x y
81
+ have hh := congrArg (fun M : ComplexMeasure (S×X) => M Z) he
82
+ simpa only [withDensityᵥ_apply hfi hZ,withDensityᵥ_apply hqi hZ] using hh
83
+
84
+ end SecretKey
85
+
86
+ end
87
+
88
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalRightRawPrefix.lean ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalRawPrefix
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
7
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter
8
+ namespace SecretKey
9
+ variable {H K L : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
13
+ variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X]
14
+
15
+ theorem physical_right_raw_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
16
+ (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X)
17
+ (G : S→TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X)
18
+ (hG : ∀ h s, MeasurableSet s → IsRightTraceAction b c d ((J h).event s) ((G h).event s))
19
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
20
+ (μ : Measure S) [IsProbabilityMeasure μ]
21
+ (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V))
22
+ (U : ∀ h, (J h).ConditionalUpdate (ρ h))
23
+ (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x
24
+ ((densityTensor d c (σ p.1) ((U p.1).state p.2)).val.val y)))
25
+ (W : PositiveHilbertMeasure (S×X) (HilbertTensor L K) (tensorHilbertBasis d c))
26
+ [IsProbabilityMeasure W.traceMeasure]
27
+ (hEvent : ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y,
28
+ W.coeff x y (A ×ˢ B)=∫ h in A,
29
+ inner ℂ x (((G h).event B (densityTensor d b (σ h) (ρ h)).val).val y) ∂μ) :
30
+ W.traceMeasure=μ ⊗ₘ TraceInstrument.historyKernel J ρ hm ∧
31
+ ∀ Z, MeasurableSet Z → ∀ x y, W.coeff x y Z=
32
+ ∫ p in Z, inner ℂ x ((densityTensor d c (σ p.1) ((U p.1).state p.2)).val.val y)
33
+ ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) := by
34
+ let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm
35
+ let f := fun p : S×X => densityTensor d c (σ p.1) ((U p.1).state p.2)
36
+ have hd (Z : Set (S×X)) (hZ : MeasurableSet Z) (x y : HilbertTensor L K) :
37
+ W.coeff x y Z=∫ p in Z, inner ℂ x ((f p).val.val y) ∂ν := by
38
+ have hi := density_coefficient_integrable (tensorHilbertBasis d c) ν f hp x y
39
+ have he : W.coeff x y=ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y)) := by
40
+ apply complexMeasure_ext_rectangles
41
+ intro A B hA hB
42
+ rw [withDensityᵥ_apply hi (hA.prod hB)]
43
+ change W.coeff x y (A ×ˢ B)=(∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y)
44
+ ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm))
45
+ rw [Measure.setIntegral_compProd hA hB hi.integrableOn,hEvent A B hA hB x y]
46
+ apply setIntegral_congr_fun hA
47
+ intro h hh
48
+ exact physical_right_disintegration_all b c d (J h) (ρ h) (σ h) (U h) hB
49
+ ((G h).event B) (hG h B hB) x y
50
+ rw [he,withDensityᵥ_apply hi hZ]
51
+ exact ⟨weak_density_trace_eq (tensorHilbertBasis d c) W ν f hp hd,hd⟩
52
+
53
+ end SecretKey
54
+
55
+ end
56
+
57
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalRightStep.lean ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PhysicalAdaptiveStep
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped TensorProduct InnerProductSpace ComplexOrder MeasureTheory
7
+ open ContinuousLinearMap UniformSpace MeasureTheory ProbabilityTheory
8
+ namespace SecretKey
9
+ variable {H K L : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
13
+ variable {ι κ υ : Type*}
14
+
15
+ def IsRightTraceAction (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
16
+ (d : HilbertBasis υ ℂ L) (F : TraceClass b →ₗ[ℂ] TraceClass c)
17
+ (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c)) : Prop :=
18
+ ∀ A B, G (traceTensor d b B A)=traceTensor d c B (F A)
19
+ variable {X : Type*} [MeasurableSpace X]
20
+ lemma physical_right_born (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
21
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
22
+ (ρ : DensityOperator b) (σ : DensityOperator d) {s : Set X} (hs : MeasurableSet s)
23
+ (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c))
24
+ (hG : IsRightTraceAction b c d (I.event s) G) :
25
+ (traceClassTrace (tensorHilbertBasis d c) (G (densityTensor d b σ ρ).val)).re=
26
+ (I.outcome ρ).real s := by
27
+ change (traceClassTrace (tensorHilbertBasis d c) (G (traceTensor d b σ.val ρ.val))).re=_
28
+ rw [hG,traceTensor_trace,σ.property.2,one_mul,I.outcome_born ρ hs]
29
+ lemma physical_right_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
30
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
31
+ (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ)
32
+ {s : Set X} (hs : MeasurableSet s)
33
+ (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c))
34
+ (hG : IsRightTraceAction b c d (I.event s) G) (x y : K) (u v : L) :
35
+ inner ℂ (hilbertTmul u x) ((G (densityTensor d b σ ρ).val).val (hilbertTmul v y))=
36
+ ∫ z in s, inner ℂ (hilbertTmul u x)
37
+ ((densityTensor d c σ (U.state z)).val.val (hilbertTmul v y)) ∂I.outcome ρ := by
38
+ change inner ℂ (hilbertTmul u x) ((G (traceTensor d b σ.val ρ.val)).val (hilbertTmul v y))=_
39
+ rw [hG]
40
+ change inner ℂ (hilbertTmul u x) (hilbertTensorMap σ.val.val (I.event s ρ.val).val (hilbertTmul v y))=_
41
+ rw [hilbertTensorMap_tmul,hilbertTmul_inner,U.disintegration s hs]
42
+ erw [← integral_const_mul]
43
+ apply setIntegral_congr_fun hs
44
+ intro z hz
45
+ simp [densityTensor,traceTensor,hilbertTmul_inner]
46
+ lemma physical_right_disintegration_all (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
47
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
48
+ (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ)
49
+ {s : Set X} (hs : MeasurableSet s)
50
+ (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c))
51
+ (hG : IsRightTraceAction b c d (I.event s) G)
52
+ (x y : HilbertTensor L K) :
53
+ inner ℂ x ((G (densityTensor d b σ ρ).val).val y)=
54
+ ∫ z in s, inner ℂ x ((densityTensor d c σ (U.state z)).val.val y) ∂I.outcome ρ := by
55
+ let R := fun z => densityTensor d c σ (U.state z)
56
+ have hR : ∀ a a', Measurable (fun z => inner ℂ a ((R z).val.val a')) :=
57
+ densityTensor_coefficient_measurable d c (fun _ => σ) U.state
58
+ (fun _ _ => measurable_const) U.coefficient_measurable
59
+ let μ := (I.outcome ρ).restrict s
60
+ let T := (G (densityTensor d b σ ρ).val).val
61
+ have hI (a a') : Integrable (fun z => inner ℂ a ((R z).val.val a')) μ :=
62
+ density_coefficient_integrable (tensorHilbertBasis d c) μ R hR a a'
63
+ have hleft (a : L) (v : K) (z : HilbertTensor L K) :
64
+ inner ℂ z (T (hilbertTmul a v))=∫ t, inner ℂ z ((R t).val.val (hilbertTmul a v)) ∂μ := by
65
+ refine Completion.induction_on z (isClosed_eq (by fun_prop)
66
+ (densityIntegral_left_continuous (tensorHilbertBasis d c) μ R hR _)) ?_
67
+ intro t
68
+ induction t using TensorProduct.inductionOn with
69
+ | tmul p q => exact physical_right_disintegration b c d I ρ σ U hs G hG q v p a
70
+ | add p q hp hq =>
71
+ simp only [Completion.coe_add,inner_add_left,integral_add (hI _ _) (hI _ _),hp,hq]
72
+ change inner ℂ x (T y)=∫ t, inner ℂ x ((R t).val.val y) ∂μ
73
+ refine Completion.induction_on y (isClosed_eq (by fun_prop)
74
+ (densityIntegral_right_continuous (tensorHilbertBasis d c) μ R hR x)) ?_
75
+ intro t
76
+ induction t using TensorProduct.inductionOn with
77
+ | tmul p q => exact hleft p q x
78
+ | add p q hp hq =>
79
+ simp only [Completion.coe_add,map_add,inner_add_right,integral_add (hI _ _) (hI _ _),hp,hq]
80
+
81
+ lemma physical_right_outcome (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
82
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
83
+ (G : TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X)
84
+ (hG : ∀ s, MeasurableSet s → IsRightTraceAction b c d (I.event s) (G.event s))
85
+ (ρ : DensityOperator b) (σ : DensityOperator d) :
86
+ G.outcome (densityTensor d b σ ρ)=I.outcome ρ := by
87
+ apply Measure.ext
88
+ intro s hs
89
+ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp
90
+ change (G.outcome (densityTensor d b σ ρ)).real s=(I.outcome ρ).real s
91
+ rw [G.outcome_born _ hs]
92
+ exact physical_right_born b c d I ρ σ hs (G.event s) (hG s hs)
93
+
94
+ def physical_right_update (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
95
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
96
+ (G : TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X)
97
+ (hG : ∀ s, MeasurableSet s → IsRightTraceAction b c d (I.event s) (G.event s))
98
+ (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) :
99
+ G.ConditionalUpdate (densityTensor d b σ ρ) where
100
+ state z := densityTensor d c σ (U.state z)
101
+ coefficient_measurable := densityTensor_coefficient_measurable d c (fun _ => σ) U.state
102
+ (fun _ _ => measurable_const) U.coefficient_measurable
103
+ coefficient_integrable x y := by
104
+ rw [physical_right_outcome b c d I G hG ρ σ]
105
+ exact density_coefficient_integrable (tensorHilbertBasis d c) (I.outcome ρ)
106
+ (fun z => densityTensor d c σ (U.state z))
107
+ (densityTensor_coefficient_measurable d c (fun _ => σ) U.state
108
+ (fun _ _ => measurable_const) U.coefficient_measurable) x y
109
+ disintegration s hs x y := by
110
+ rw [physical_right_outcome b c d I G hG ρ σ]
111
+ exact physical_right_disintegration_all b c d I ρ σ U hs (G.event s) (hG s hs) x y
112
+
113
+ end SecretKey
114
+
115
+ end
116
+
117
+ end OAI
lean/OAI/InformationTheory/Entanglement/PhysicalVersion.lean ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.WeakStateUnique
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped InnerProductSpace ComplexOrder MeasureTheory
7
+ open ContinuousLinearMap MeasureTheory
8
+ namespace SecretKey
9
+ variable {H K L : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
13
+ variable {ι κ υ X : Type*} [MeasurableSpace X]
14
+
15
+ theorem physical_product_version (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
16
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
17
+ (G : TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X)
18
+ (hG : ∀ s, MeasurableSet s → IsLeftTraceAction b c d (I.event s) (G.event s))
19
+ (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ)
20
+ (V : G.ConditionalUpdate (densityTensor b d ρ σ)) :
21
+ V.state=ᵐ[G.outcome (densityTensor b d ρ σ)]
22
+ (fun z => densityTensor c d (U.state z) σ) :=
23
+ V.ae_unique (physical_product_update b c d I G hG ρ σ U)
24
+
25
+ end SecretKey
26
+
27
+ end
28
+
29
+ end OAI
lean/OAI/InformationTheory/Entanglement/PolynomialGcdDegree.lean ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.Analysis.Quantum.PPTSquare.Mod131Powers01
2
+ import OAI.Analysis.Quantum.PPTSquare.Mod131Powers02
3
+ import OAI.Analysis.Quantum.PPTSquare.Mod131Powers03
4
+ import OAI.Analysis.Quantum.PPTSquare.Mod131Powers04
5
+ import OAI.Analysis.Quantum.PPTSquare.Mod131Data
6
+ import OAI.Analysis.Quantum.PPTSquare.Mod131Products
7
+ import OAI.Analysis.Quantum.PPTSquare.Mod131Reduction
8
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Powers01
9
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Powers02
10
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Powers03
11
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Powers04
12
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Powers05
13
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Data
14
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Products
15
+ import OAI.Analysis.Quantum.PPTSquare.Mod139Reduction
16
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Powers01
17
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Powers02
18
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Powers03
19
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Powers04
20
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Powers05
21
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Powers06
22
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Data
23
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Products
24
+ import OAI.Analysis.Quantum.PPTSquare.Mod41Reduction
25
+ import OAI.Analysis.Quantum.PPTSquare.ModularSupport
26
+ import OAI.Analysis.Quantum.PPTSquare.GaloisAction
27
+
28
+ namespace OAI
29
+
30
+ open Polynomial
31
+ noncomputable section
32
+ namespace PolynomialGcdDegree
33
+ attribute [local instance] Classical.propDecidable
34
+ local instance : Fact (Nat.Prime 41) := ⟨by decide⟩
35
+ def dg (e : ℕ) : Prop := (EuclideanDomain.gcd ModularPencil.P41.f (X^e-X)).natDegree = 0
36
+ def dgc (e : ℕ) : Prop := by
37
+ classical
38
+ exact (EuclideanDomain.gcd ModularPencil.P41.f (X^e-X)).natDegree = 0
39
+ lemma bridge (e n : ℕ) (h : ModularPencil.P41.degreeCert e n) :
40
+ (EuclideanDomain.gcd ModularPencil.P41.f (X^e-X)).natDegree = n := by
41
+ unfold ModularPencil.P41.degreeCert at h
42
+ convert h using 2
43
+ lemma concrete : dg (41^4) := by
44
+ exact bridge (41^4) 0 ModularPencil.P41.gcd_degree4
45
+
46
+ end PolynomialGcdDegree
47
+
48
+ end
49
+
50
+ end OAI
lean/OAI/InformationTheory/Entanglement/PositiveBlock.lean ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.TraceNorm
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped MatrixOrder ComplexOrder BigOperators Kronecker
7
+ open Matrix
8
+ namespace SecretKey
9
+ variable {n m k : Type} [Fintype n] [Fintype m] [Fintype k]
10
+
11
+ def hsVector (A : Matrix n m ℂ) : EuclideanSpace ℂ (n × m) :=
12
+ WithLp.toLp 2 (fun p => A p.1 p.2)
13
+ def hsNorm (A : Matrix n m ℂ) : ℝ := ‖hsVector A‖
14
+
15
+ lemma trace_mul_conj_eq_inner (A B : Matrix n m ℂ) :
16
+ Matrix.trace (A * Bᴴ) = inner ℂ (hsVector B) (hsVector A) := by
17
+ simp [Matrix.trace, Matrix.mul_apply, Matrix.conjTranspose_apply, hsVector,
18
+ PiLp.inner_apply, Fintype.sum_prod_type, RCLike.inner_apply]
19
+
20
+ lemma hsNorm_sq (A : Matrix n m ℂ) :
21
+ hsNorm A ^ 2 = (Matrix.trace (A * Aᴴ)).re := by
22
+ rw [trace_mul_conj_eq_inner]
23
+ exact norm_sq_eq_re_inner (𝕜 := ℂ) _
24
+
25
+ lemma trace_mul_conj_norm_le (A B : Matrix n m ℂ) :
26
+ ‖Matrix.trace (A * Bᴴ)‖ ≤ hsNorm A * hsNorm B := by
27
+ rw [trace_mul_conj_eq_inner]
28
+ simpa [hsNorm, mul_comm] using norm_inner_le_norm (hsVector B) (hsVector A)
29
+
30
+ lemma hsNorm_unitary [DecidableEq n] {U : Matrix n n ℂ} (hU : Uᴴ * U = 1)
31
+ (A : Matrix n m ℂ) : hsNorm (U * A) = hsNorm A := by
32
+ apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp
33
+ change hsNorm (U * A) ^ 2 = hsNorm A ^ 2
34
+ rw [hsNorm_sq, hsNorm_sq, Matrix.conjTranspose_mul]
35
+ congr 1
36
+ calc
37
+ Matrix.trace (U * A * (Aᴴ * Uᴴ)) = Matrix.trace (U * (A * Aᴴ) * Uᴴ) := by
38
+ simp only [Matrix.mul_assoc]
39
+ _ = Matrix.trace (Uᴴ * U * (A * Aᴴ)) := Matrix.trace_mul_cycle _ _ _
40
+ _ = Matrix.trace (A * Aᴴ) := by rw [hU, Matrix.one_mul]
41
+
42
+ lemma traceNorm_mul_conj_le [DecidableEq n] (A B : Matrix n m ℂ) :
43
+ traceNorm (A * Bᴴ) ≤ hsNorm A * hsNorm B := by
44
+ obtain ⟨U,hU,he⟩ := traceNorm_witness (A * Bᴴ)
45
+ rw [he, ← Matrix.mul_assoc]
46
+ exact (Complex.re_le_norm _).trans
47
+ ((trace_mul_conj_norm_le (U * A) B).trans_eq (by rw [hsNorm_unitary hU]))
48
+
49
+ lemma traceNorm_mul_conj_le_sqrt [DecidableEq n] (A B : Matrix n m ℂ) :
50
+ traceNorm (A * Bᴴ) ≤ Real.sqrt ((Matrix.trace (A * Aᴴ)).re * (Matrix.trace (B * Bᴴ)).re) := by
51
+ rw [← hsNorm_sq, ← hsNorm_sq, ← mul_pow, Real.sqrt_sq_eq_abs, abs_of_nonneg (show 0 ≤ hsNorm A * hsNorm B from mul_nonneg (norm_nonneg _) (norm_nonneg _))]
52
+ exact traceNorm_mul_conj_le A B
53
+
54
+ lemma positive_block [DecidableEq n] (H J Z : Matrix n n ℂ)
55
+ (h : (Matrix.fromBlocks H Z Zᴴ J).PosSemidef) :
56
+ traceNorm Z ≤ Real.sqrt ((Matrix.trace H).re * (Matrix.trace J).re) := by
57
+ let Q := CFC.sqrt (Matrix.fromBlocks H Z Zᴴ J)
58
+ have hQh : Qᴴ = Q :=
59
+ (Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg _)).isHermitian.eq
60
+ have hQ : Q * Qᴴ = Matrix.fromBlocks H Z Zᴴ J := by
61
+ rw [hQh]
62
+ exact CFC.sqrt_mul_sqrt_self _ h.nonneg
63
+ let A : Matrix n (n ⊕ n) ℂ := fun i j => Q (Sum.inl i) j
64
+ let B : Matrix n (n ⊕ n) ℂ := fun i j => Q (Sum.inr i) j
65
+ have hA : A * Aᴴ = H := by
66
+ ext i j
67
+ exact congrArg (fun M => M (Sum.inl i) (Sum.inl j)) hQ
68
+ have hB : B * Bᴴ = J := by
69
+ ext i j
70
+ exact congrArg (fun M => M (Sum.inr i) (Sum.inr j)) hQ
71
+ have hZ : A * Bᴴ = Z := by
72
+ ext i j
73
+ exact congrArg (fun M => M (Sum.inl i) (Sum.inr j)) hQ
74
+ simpa only [hA,hB,hZ] using traceNorm_mul_conj_le_sqrt A B
75
+ end SecretKey
76
+
77
+ end
78
+
79
+ end OAI
lean/OAI/InformationTheory/Entanglement/PowersStormer.lean ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.FidelityTools
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
7
+ open Matrix
8
+ namespace SecretKey
9
+ open ChannelCompletion TensorCriterion
10
+ variable {n : Type} [Fintype n] [DecidableEq n]
11
+
12
+ omit [Fintype n] [DecidableEq n] in
13
+ lemma psd_diagonal_real {A : Mat n} (hA : A.PosSemidef) (i : n) :
14
+ 0≤(A i i).re := (Complex.nonneg_iff.mp (hA.diag_nonneg (i := i))).1
15
+
16
+ lemma powers_stormer_diagonal {A B : Mat n} (hA : A.PosSemidef) (hB : B.PosSemidef)
17
+ (z : n → ℝ) (hz : A-B=Matrix.diagonal (fun i => (z i : ℂ))) :
18
+ ∑ i, (z i)^2 ≤ traceNorm (A*A-B*B) := by
19
+ let ε : n → ℝ := fun i => if z i<0 then -1 else 1
20
+ have hε (i : n) : ε i * z i=|z i| := by
21
+ dsimp [ε]
22
+ split_ifs with hi
23
+ · rw [abs_of_neg hi]; ring
24
+ · rw [abs_of_nonneg (le_of_not_gt hi)]; ring
25
+ have hεsq (i : n) : ε i*ε i=1 := by dsimp [ε]; split_ifs <;> norm_num
26
+ let S : Mat n := Matrix.diagonal (fun i => (ε i : ℂ))
27
+ have hS : Sᴴ*S=1 := by
28
+ simp only [S,Matrix.diagonal_conjTranspose,
29
+ Matrix.diagonal_mul_diagonal]
30
+ ext i j
31
+ by_cases h : i=j
32
+ · subst j
33
+ simp only [Matrix.diagonal_apply_eq,Matrix.one_apply_eq,Pi.star_apply,Complex.star_def,Complex.conj_ofReal,← Complex.ofReal_mul,hεsq,
34
+ Complex.ofReal_one]
35
+ · simp [Matrix.diagonal_apply_ne _ h,Matrix.one_apply_ne h]
36
+ have he : A*A-B*B=(A-B)*A+B*(A-B) := by noncomm_ring
37
+ have ht : (Matrix.trace (S*(A*A-B*B))).re =
38
+ ∑ i, |z i| *((A i i).re+(B i i).re) := by
39
+ rw [he,hz]
40
+ change (∑ i, (S*((diagonal (fun j => (z j : ℂ)))*A+B*diagonal (fun j => (z j : ℂ)))) i i).re = _
41
+ rw [Complex.re_sum]
42
+ apply Finset.sum_congr rfl
43
+ intro i _
44
+ simp only [S,Matrix.add_apply,Matrix.diagonal_mul,Matrix.mul_diagonal,
45
+ Complex.add_re,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,mul_zero,
46
+ sub_zero]
47
+ calc
48
+ ε i * (z i*(A i i).re+(B i i).re*z i)=
49
+ (ε i*z i)*((A i i).re+(B i i).re) := by ring
50
+ _ = _ := by rw [hε]
51
+ have hdiag (i : n) : (A i i).re-(B i i).re=z i := by
52
+ have h := congrArg (fun M : Mat n => (M i i).re) hz
53
+ simpa only [Matrix.sub_apply,Complex.sub_re,Matrix.diagonal_apply_eq,Complex.ofReal_re] using h
54
+ have hi (i : n) : (z i)^2 ≤ |z i| *((A i i).re+(B i i).re) := by
55
+ have habs : |z i| ≤ (A i i).re+(B i i).re := abs_le.mpr ⟨by
56
+ linarith [hdiag i,psd_diagonal_real hA i,psd_diagonal_real hB i],by
57
+ linarith [hdiag i,psd_diagonal_real hA i,psd_diagonal_real hB i]⟩
58
+ have h := mul_le_mul_of_nonneg_left habs (abs_nonneg (z i))
59
+ nlinarith [sq_abs (z i)]
60
+ calc
61
+ ∑ i, (z i)^2 ≤ ∑ i, |z i| *((A i i).re+(B i i).re) :=
62
+ Finset.sum_le_sum (fun i _ => hi i)
63
+ _ = (Matrix.trace (S*(A*A-B*B))).re := ht.symm
64
+ _ ≤ ‖Matrix.trace (S*(A*A-B*B))‖ := Complex.re_le_norm _
65
+ _ ≤ traceNorm (A*A-B*B) := trace_unitary_norm_le _ hS
66
+
67
+ lemma powers_stormer {A B : Mat n} (hA : A.PosSemidef) (hB : B.PosSemidef) :
68
+ (Matrix.trace ((A-B)*(A-B))).re ≤ traceNorm (A*A-B*B) := by
69
+ let Z := A-B
70
+ have hZ : Z.IsHermitian := hA.isHermitian.sub hB.isHermitian
71
+ obtain ⟨U,hU,hdiag⟩ := unitary_spectral hZ
72
+ let a := Uᴴ*A*U
73
+ let b := Uᴴ*B*U
74
+ have ha : a.PosSemidef := hA.conjTranspose_mul_mul_same U
75
+ have hb : b.PosSemidef := hB.conjTranspose_mul_mul_same U
76
+ have hab : a-b=diagonal (fun i => (hZ.eigenvalues i : ℂ)) := by
77
+ rw [← hdiag]
78
+ simp only [a,b,Z,Matrix.mul_sub,Matrix.sub_mul]
79
+ have h := powers_stormer_diagonal ha hb hZ.eigenvalues hab
80
+ have he : a*a-b*b=Uᴴ*(A*A-B*B)*U := by
81
+ dsimp only [a,b]
82
+ rw [unitary_conj_mul hU,unitary_conj_mul hU,Matrix.mul_sub,Matrix.sub_mul]
83
+ rw [he,unitary_traceNorm_conj hU] at h
84
+ have ht : (Matrix.trace ((A-B)*(A-B))).re=∑ i, (hZ.eigenvalues i)^2 := by
85
+ rw [← unitary_trace_conj hU ((A-B)*(A-B)),← unitary_conj_mul hU]
86
+ change (Matrix.trace ((Uᴴ*Z*U)*(Uᴴ*Z*U))).re=_
87
+ rw [hdiag,Matrix.diagonal_mul_diagonal,Matrix.trace_diagonal,Complex.re_sum]
88
+ simp only [Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,mul_zero,sub_zero,pow_two]
89
+ rwa [ht]
90
+
91
+ lemma fidelity_lower {H J : Mat n} (hH : H.PosSemidef) (hJ : J.PosSemidef) :
92
+ ((Matrix.trace H).re+(Matrix.trace J).re-traceNorm (H-J))/2 ≤ fidelity H J := by
93
+ have h := powers_stormer (sqrt_psd H) (sqrt_psd J)
94
+ rw [CFC.sqrt_mul_sqrt_self H hH.nonneg,CFC.sqrt_mul_sqrt_self J hJ.nonneg] at h
95
+ have he : (Matrix.trace ((CFC.sqrt H-CFC.sqrt J)*(CFC.sqrt H-CFC.sqrt J))).re =
96
+ (Matrix.trace H).re+(Matrix.trace J).re-2*(Matrix.trace (CFC.sqrt H*CFC.sqrt J)).re := by
97
+ simp only [Matrix.mul_sub,Matrix.sub_mul,Matrix.trace_sub,Complex.sub_re,
98
+ CFC.sqrt_mul_sqrt_self H hH.nonneg,CFC.sqrt_mul_sqrt_self J hJ.nonneg]
99
+ rw [Matrix.trace_mul_comm (CFC.sqrt J)]
100
+ ring
101
+ rw [he] at h
102
+ have hf := trace_re_le_traceNorm (CFC.sqrt H*CFC.sqrt J)
103
+ dsimp [fidelity]
104
+ linarith
105
+ end SecretKey
106
+
107
+ end
108
+
109
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProbeDensity.lean ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ConditionalUpdate
2
+ import OAI.InformationTheory.Entanglement.MatrixFamilyDensity
3
+ import OAI.InformationTheory.Entanglement.ProbePOVM
4
+
5
+ namespace OAI
6
+
7
+ noncomputable section
8
+ open MeasureTheory ProbabilityTheory Filter Set
9
+ open scoped BigOperators MeasureTheory ProbabilityTheory
10
+ namespace SecretKey
11
+ variable {Ω T : Type*} {mΩ : MeasurableSpace Ω} [MeasurableSpace T]
12
+ variable {ν : Measure Ω} [IsFiniteMeasure ν] {t : Ω → T} (ht : Measurable t)
13
+ include ht in
14
+
15
+ lemma transcript_density_condExp {a : Set Ω} (ha : MeasurableSet a)
16
+ {f : T → ℝ} (hfm : Measurable f) (hfi : Integrable f ((@Measure.map Ω T mΩ _ t ν)))
17
+ (hf : ∀ s, MeasurableSet s → (∫ u in s, f u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real (a∩t⁻¹' s)) :
18
+ (fun x => f (t x)) =ᵐ[ν] (ν⟦a | MeasurableSpace.comap t inferInstance⟧) := by
19
+ have hsub : MeasurableSpace.comap t inferInstance ≤ mΩ := ht.comap_le
20
+ have hcomp : Integrable (fun x => f (t x)) ν := (integrable_map_measure hfm.aestronglyMeasurable ht.aemeasurable).mp hfi
21
+ apply ae_eq_condExp_of_forall_setIntegral_eq hsub ((integrable_const (1 : ℝ)).indicator ha)
22
+ · intro s hs _
23
+ exact hcomp.integrableOn
24
+ · intro s hs _
25
+ obtain ⟨u,hu,rfl⟩ := hs
26
+ rw [← setIntegral_map hu hfm.aestronglyMeasurable ht.aemeasurable,hf u hu]
27
+ simp [integral_indicator ha, measureReal_def, Measure.restrict_apply ha,Set.inter_comm]
28
+ · exact (hfm.comp (comap_measurable t)).stronglyMeasurable.aestronglyMeasurable
29
+
30
+ lemma independent_transcript_densities [StandardBorelSpace Ω]
31
+ {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ)
32
+ (hind : CondIndep (MeasurableSpace.comap t inferInstance) A B ht.comap_le ν)
33
+ {a b : Set Ω} (ha : MeasurableSet[A] a) (hb : MeasurableSet[B] b)
34
+ {f g h : T → ℝ} (hfm : Measurable f) (hgm : Measurable g) (hhm : Measurable h)
35
+ (hfi : Integrable f ((@Measure.map Ω T mΩ _ t ν))) (hgi : Integrable g ((@Measure.map Ω T mΩ _ t ν)))
36
+ (hhi : Integrable h ((@Measure.map Ω T mΩ _ t ν)))
37
+ (hf : ∀ s, MeasurableSet s → (∫ u in s, f u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real (a∩t⁻¹' s))
38
+ (hg : ∀ s, MeasurableSet s → (∫ u in s, g u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real (b∩t⁻¹' s))
39
+ (hh : ∀ s, MeasurableSet s → (∫ u in s, h u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real ((a∩b)∩t⁻¹' s)) :
40
+ h =ᵐ[(@Measure.map Ω T mΩ _ t ν)] f*g := by
41
+ have he := (condIndep_iff _ _ _ ht.comap_le hA hB ν).mp hind a b ha hb
42
+ have hf' := transcript_density_condExp ht (hA a ha) hfm hfi hf
43
+ have hg' := transcript_density_condExp ht (hB b hb) hgm hgi hg
44
+ have hh' := transcript_density_condExp ht ((hA a ha).inter (hB b hb)) hhm hhi hh
45
+ apply (ae_map_iff ht.aemeasurable (measurableSet_eq_fun hhm (hfm.mul hgm))).mpr
46
+ exact hh'.trans (he.trans (hf'.mul hg').symm)
47
+ end SecretKey
48
+
49
+ end
50
+
51
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProbeFactorization.lean ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProbeDensity
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
7
+ open Matrix MeasureTheory ProbabilityTheory Filter Set
8
+ namespace SecretKey
9
+ open ChannelCompletion
10
+ variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m]
11
+ lemma trace_mul_psd_eq_real {E W : Mat n} (hE : E.PosSemidef) (hW : W.PosSemidef) :
12
+ Matrix.trace (E*W)=((Matrix.trace (E*W)).re : ℂ) := by
13
+ apply Complex.ext
14
+ · rfl
15
+ rw [Complex.ofReal_im]
16
+ rw [← trace_filter hE]
17
+ exact (Complex.nonneg_iff.mp (hW.mul_mul_conjTranspose_same _).trace_nonneg).2.symm
18
+ variable {T : Type*} [MeasurableSpace T] {μ : Measure T}
19
+ omit [DecidableEq n] in
20
+ lemma integrable_test_trace (E : Mat n) {W : T → Mat n}
21
+ (hW : ∀ a b, Integrable (fun t => W t a b) μ) :
22
+ Integrable (fun t => (Matrix.trace (E*W t)).re) μ := by
23
+ have h : Integrable (fun t => Matrix.trace (E*W t)) μ := by
24
+ simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply]
25
+ exact integrable_finsetSum _ fun a _ => integrable_finsetSum _ fun b _ => (hW b a).const_mul _
26
+ exact h.re
27
+ omit [DecidableEq n] in
28
+ lemma measurable_test_trace (E : Mat n) {W : T → Mat n} (hW : Measurable W) :
29
+ Measurable (fun t => (Matrix.trace (E*W t)).re) := by
30
+ have hc : Continuous (fun M : Mat n => (Matrix.trace (E*M)).re) := by fun_prop
31
+ exact hc.measurable.comp hW
32
+ variable {Ω : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω]
33
+ variable {ν : Measure Ω} [IsFiniteMeasure ν] {t : Ω → T}
34
+
35
+ theorem probe_density_product (ht : Measurable t)
36
+ {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ)
37
+ (hind : CondIndep (MeasurableSpace.comap t inferInstance) A B ht.comap_le ν)
38
+ (a : Fin 2 → Option (PositiveTestIndex n) → Set Ω)
39
+ (b : Fin 2 → Option (PositiveTestIndex m) → Set Ω)
40
+ (ha : ∀ i e, MeasurableSet[A] (a i e)) (hb : ∀ j g, MeasurableSet[B] (b j g))
41
+ (U : Fin 2 → T → Mat n) (V : Fin 2 → T → Mat m)
42
+ (W : Fin 2 → Fin 2 → T → Mat (n×m))
43
+ (hUp : ∀ i u, (U i u).PosSemidef) (hVp : ∀ j u, (V j u).PosSemidef)
44
+ (hWp : ∀ i j u, (W i j u).PosSemidef)
45
+ (hUm : ∀ i, Measurable (U i)) (hVm : ∀ j, Measurable (V j))
46
+ (hWm : ∀ i j, Measurable (W i j))
47
+ (hUi : ∀ i a b, Integrable (fun u => U i u a b) (@Measure.map Ω T mΩ _ t ν))
48
+ (hVi : ∀ j a b, Integrable (fun u => V j u a b) (@Measure.map Ω T mΩ _ t ν))
49
+ (hWi : ∀ i j a b, Integrable (fun u => W i j u a b) (@Measure.map Ω T mΩ _ t ν))
50
+ (hUlaw : ∀ i e s, MeasurableSet s →
51
+ (∫ u in s, (Matrix.trace (probePOVM e*U i u)).re ∂(@Measure.map Ω T mΩ _ t ν))=
52
+ ν.real (a i e∩t⁻¹' s))
53
+ (hVlaw : ∀ j g s, MeasurableSet s →
54
+ (∫ u in s, (Matrix.trace (probePOVM g*V j u)).re ∂(@Measure.map Ω T mΩ _ t ν))=
55
+ ν.real (b j g∩t⁻¹' s))
56
+ (hWlaw : ∀ i j e g s, MeasurableSet s →
57
+ (∫ u in s, (Matrix.trace ((probePOVM e ⊗ₖ probePOVM g)*W i j u)).re
58
+ ∂(@Measure.map Ω T mΩ _ t ν))=ν.real ((a i e∩b j g)∩t⁻¹' s)) :
59
+ ∀ᵐ u ∂(@Measure.map Ω T mΩ _ t ν), ∀ i j, W i j u=U i u ⊗ₖ V j u := by
60
+ have he (i j : Fin 2) (e : Option (PositiveTestIndex n)) (g : Option (PositiveTestIndex m)) :
61
+ (fun u => (Matrix.trace ((probePOVM e ⊗ₖ probePOVM g)*W i j u)).re)=ᵐ[(@Measure.map Ω T mΩ _ t ν)]
62
+ (fun u => (Matrix.trace (probePOVM e*U i u)).re*(Matrix.trace (probePOVM g*V j u)).re) := by
63
+ exact independent_transcript_densities ht hA hB hind (ha i e) (hb j g)
64
+ (measurable_test_trace _ (hUm i)) (measurable_test_trace _ (hVm j))
65
+ (measurable_test_trace _ (hWm i j))
66
+ (integrable_test_trace _ (hUi i)) (integrable_test_trace _ (hVi j))
67
+ (integrable_test_trace _ (hWi i j)) (hUlaw i e) (hVlaw j g) (hWlaw i j e g)
68
+ have hall := ae_all_iff.mpr (fun i => ae_all_iff.mpr (fun j =>
69
+ ae_all_iff.mpr (fun e => ae_all_iff.mpr (he i j e))))
70
+ filter_upwards [hall] with u hu
71
+ intro i j
72
+ apply tensor_product_of_probePOVM
73
+ intro e g
74
+ rw [trace_mul_psd_eq_real ((probePOVM_psd e).kronecker (probePOVM_psd g)) (hWp i j u),
75
+ trace_mul_psd_eq_real (probePOVM_psd e) (hUp i u),
76
+ trace_mul_psd_eq_real (probePOVM_psd g) (hVp j u),← Complex.ofReal_mul,hu i j e g]
77
+
78
+ end SecretKey
79
+
80
+ end
81
+
82
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProbeMatrices.lean ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProbeDensity
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
7
+ open Matrix MeasureTheory Filter
8
+ namespace SecretKey
9
+ open ChannelCompletion
10
+ variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m]
11
+ def marginalLeft (W : Mat (n×m)) : Mat n := fun i j => ∑ a, W (i,a) (j,a)
12
+ def marginalRight (W : Mat (n×m)) : Mat m := fun a b => ∑ i, W (i,a) (i,b)
13
+ omit [DecidableEq n] [DecidableEq m] in
14
+ lemma marginalLeft_psd {W : Mat (n×m)} (hW : W.PosSemidef) : (marginalLeft W).PosSemidef :=
15
+ partial_trace_psd hW
16
+ omit [Fintype m] [DecidableEq n] [DecidableEq m] in
17
+ lemma marginalRight_psd {W : Mat (n×m)} (hW : W.PosSemidef) : (marginalRight W).PosSemidef := by
18
+ have he : marginalRight W=∑ i, W.submatrix (fun a => (i,a)) (fun a => (i,a)) := by ext a b; simp [marginalRight,Matrix.sum_apply,Matrix.submatrix_apply]
19
+ rw [he]
20
+ exact Matrix.posSemidef_sum _ (fun i _ => hW.submatrix _)
21
+ omit [DecidableEq n] in
22
+ lemma trace_test_left (E : Mat n) (W : Mat (n×m)) :
23
+ Matrix.trace (E*marginalLeft W)=Matrix.trace ((E ⊗ₖ (1 : Mat m))*W) := by
24
+ simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply,marginalLeft,Matrix.kronecker_apply,
25
+ Fintype.sum_prod_type,Matrix.one_apply,mul_ite,mul_one,mul_zero,ite_mul,zero_mul,Finset.sum_ite_eq,
26
+ Finset.mem_univ,ite_true,Finset.mul_sum]
27
+ exact Finset.sum_congr rfl (fun i _ => Finset.sum_comm)
28
+ omit [DecidableEq m] in
29
+ lemma trace_test_right (G : Mat m) (W : Mat (n×m)) :
30
+ Matrix.trace (G*marginalRight W)=Matrix.trace (((1 : Mat n) ⊗ₖ G)*W) := by
31
+ have hh (i : n) (a : m) :
32
+ (∑ k : n, ∑ b : m, if i=k then G a b*W (k,b) (i,a) else 0)=
33
+ ∑ b : m, G a b*W (i,b) (i,a) := by
34
+ rw [Finset.sum_eq_single i]
35
+ · simp
36
+ · intro k _ hk
37
+ simp [Ne.symm hk]
38
+ · simp
39
+ simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply,marginalRight,Matrix.kronecker_apply,
40
+ Fintype.sum_prod_type,Matrix.one_apply,ite_mul,one_mul,zero_mul,Finset.mul_sum]
41
+ change (∑ a : m, ∑ b : m, ∑ i : n, G a b*W (i,b) (i,a))=
42
+ ∑ i : n, ∑ a : m, ∑ k : n, ∑ b : m, if i=k then G a b*W (k,b) (i,a) else 0
43
+ simp_rw [hh]
44
+ calc
45
+ _=∑ a : m, ∑ i : n, ∑ b : m, G a b*W (i,b) (i,a) :=
46
+ Finset.sum_congr rfl (fun a _ => Finset.sum_comm)
47
+ _=_ := Finset.sum_comm
48
+ end SecretKey
49
+
50
+ end
51
+
52
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProbePOVM.lean ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.InformationalComplete
2
+ import OAI.Analysis.Quantum.PPTSquare.ChannelModel
3
+ import OAI.Analysis.Quantum.PPTSquare.TraceCompletion
4
+ import OAI.Analysis.Quantum.PPTSquare.Compression
5
+ import OAI.Analysis.Quantum.PPTSquare.ChannelCompletion
6
+
7
+ namespace OAI
8
+
9
+ noncomputable section
10
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
11
+ open Matrix
12
+ namespace SecretKey
13
+ open ChannelCompletion
14
+ variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m]
15
+ def testSum (n : Type) [Fintype n] [DecidableEq n] : Mat n :=
16
+ ∑ k : PositiveTestIndex n, positiveTest k
17
+ lemma testSum_psd : (testSum n).PosSemidef := by
18
+ exact Matrix.posSemidef_sum _ (fun k _ => positiveTest_psd k)
19
+ def probeScale (n : Type) [Fintype n] [DecidableEq n] : ℝ :=
20
+ (1+(Matrix.trace (testSum n)).re)⁻¹
21
+ lemma probeScale_pos : 0<probeScale n := by
22
+ apply inv_pos.mpr
23
+ have h := (Complex.nonneg_iff.mp (testSum_psd (n := n)).trace_nonneg).1
24
+ linarith
25
+ lemma probeScale_mul_trace : probeScale n+(probeScale n)*(Matrix.trace (testSum n)).re=1 := by
26
+ unfold probeScale
27
+ have h := (Complex.nonneg_iff.mp (testSum_psd (n := n)).trace_nonneg).1
28
+ field_simp
29
+
30
+ def probePOVM : Option (PositiveTestIndex n) → Mat n
31
+ | some k => (probeScale n : ℂ) • positiveTest k
32
+ | none => 1-(probeScale n : ℂ) • testSum n
33
+ lemma probePOVM_psd (k : Option (PositiveTestIndex n)) : (probePOVM k).PosSemidef := by
34
+ cases k with
35
+ | some k => exact (positiveTest_psd k).smul (by exact_mod_cast (probeScale_pos (n := n)).le)
36
+ | none =>
37
+ have htrace : ((Matrix.trace (testSum n)).re : ℂ)=Matrix.trace (testSum n) := by
38
+ exact Complex.ext rfl (by simpa using (Complex.nonneg_iff.mp (testSum_psd (n := n)).trace_nonneg).2)
39
+ have he : (1-(probeScale n : ℂ) • testSum n) =
40
+ (probeScale n : ℂ) • (1 : Mat n)+
41
+ (probeScale n : ℂ) • (Matrix.trace (testSum n) • (1 : Mat n)-testSum n) := by
42
+ rw [smul_sub,smul_smul,← add_sub_assoc,← add_smul]
43
+ have hc : (probeScale n : ℂ)+(probeScale n : ℂ)*Matrix.trace (testSum n)=1 := by
44
+ rw [← htrace,← Complex.ofReal_mul,← Complex.ofReal_add,probeScale_mul_trace]
45
+ rfl
46
+ rw [hc,one_smul]
47
+ change (1-(probeScale n : ℂ) • testSum n).PosSemidef
48
+ rw [he]
49
+ exact (Matrix.PosSemidef.one.smul (by exact_mod_cast (probeScale_pos (n := n)).le)).add
50
+ ((psd_trace_bound testSum_psd).smul (by exact_mod_cast (probeScale_pos (n := n)).le))
51
+ lemma probePOVM_sum : (∑ k : Option (PositiveTestIndex n), probePOVM k) = 1 := by
52
+ rw [Fintype.sum_option]
53
+ simp only [probePOVM,← Finset.smul_sum,testSum]
54
+ abel
55
+ lemma linear_eq_zero_of_probePOVM (L : Mat n →ₗ[ℂ] ℂ)
56
+ (h : ∀ k, L (probePOVM k)=0) : L=0 := by
57
+ apply linear_eq_zero_of_positive_tests L
58
+ intro k
59
+ have hk := h (some k)
60
+ change L ((probeScale n : ℂ) • positiveTest k)=0 at hk
61
+ rw [map_smul,smul_eq_mul] at hk
62
+ exact (mul_eq_zero.mp hk).resolve_left (by exact_mod_cast (probeScale_pos (n := n)).ne')
63
+
64
+ theorem tensor_product_of_probePOVM (W : Mat (n×m)) (X : Mat n) (Y : Mat m)
65
+ (htest : ∀ e : Option (PositiveTestIndex n), ∀ g : Option (PositiveTestIndex m),
66
+ Matrix.trace ((probePOVM e ⊗ₖ probePOVM g)*W)=
67
+ Matrix.trace (probePOVM e*X)*Matrix.trace (probePOVM g*Y)) :
68
+ W=X ⊗ₖ Y := by
69
+ apply tensor_product_of_positive_tests
70
+ intro e g
71
+ have h := htest (some e) (some g)
72
+ simp only [probePOVM,Matrix.smul_kronecker,Matrix.kronecker_smul,Matrix.smul_mul,
73
+ Matrix.trace_smul,smul_eq_mul] at h
74
+ have hc : (probeScale n : ℂ) ≠ 0 := by exact_mod_cast (probeScale_pos (n := n)).ne'
75
+ have hd : (probeScale m : ℂ) ≠ 0 := by exact_mod_cast (probeScale_pos (n := m)).ne'
76
+ apply mul_left_cancel₀ hc
77
+ apply mul_left_cancel₀ hd
78
+ linear_combination h
79
+
80
+ end SecretKey
81
+
82
+ end
83
+
84
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProbeRescaling.lean ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.NormalizedProbe
2
+ import OAI.InformationTheory.Entanglement.ConditionedLaw
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open MeasureTheory ProbabilityTheory Filter Set
8
+ open scoped MeasureTheory ProbabilityTheory ENNReal NNReal
9
+ namespace SecretKey
10
+ variable {Ω : Type*} {mΩ : MeasurableSpace Ω}
11
+
12
+ lemma condExp_rescale {μ : Measure Ω} [IsFiniteMeasure μ]
13
+ {F : MeasurableSpace Ω} (hF : F ≤ mΩ) {f : Ω→ℝ} (hf : Integrable f μ)
14
+ (c : ℝ≥0) : μ[f|F]=ᵐ[c•μ] (c•μ)[f|F] := by
15
+ apply ae_eq_condExp_of_forall_setIntegral_eq hF hf.smul_measure_nnreal
16
+ · intro s hs hfin
17
+ exact (integrable_condExp.smul_measure_nnreal (c := c)).integrableOn
18
+ · intro s hs hfin
19
+ rw [Measure.restrict_smul,integral_smul_nnreal_measure,integral_smul_nnreal_measure,
20
+ setIntegral_condExp hF hf hs]
21
+ · exact stronglyMeasurable_condExp.aestronglyMeasurable
22
+ lemma condIndep_rescale {μ : Measure Ω} [IsFiniteMeasure μ]
23
+ [StandardBorelSpace Ω] {F A B : MeasurableSpace Ω}
24
+ (hF : F ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ)
25
+ (hind : CondIndep F A B hF μ) (c : ℝ≥0) : CondIndep F A B hF (c•μ) := by
26
+ rw [condIndep_iff _ _ _ hF hA hB] at hind ⊢
27
+ intro s t hs ht
28
+ have hi (u : Set Ω) (hu : MeasurableSet[mΩ] u) : Integrable (u.indicator (fun _ => (1 : ℝ))) μ :=
29
+ (integrable_const 1).indicator hu
30
+ have hst := condExp_rescale hF (hi (s∩t) ((hA s hs).inter (hB t ht))) c
31
+ have hsa := condExp_rescale hF (hi s (hA s hs)) c
32
+ have htb := condExp_rescale hF (hi t (hB t ht)) c
33
+ filter_upwards [hst,hsa,htb,Measure.ae_smul_measure (hind s t hs ht) c] with x hx hy hz hc
34
+ simp only [Pi.mul_apply] at hc ⊢
35
+ rw [← hx,← hy,← hz]
36
+ exact hc
37
+ namespace PositiveMatrixMeasure
38
+ open ChannelCompletion Matrix
39
+ variable {n : Type} [Fintype n]
40
+
41
+ lemma scale_traceMeasure (W : PositiveMatrixMeasure Ω n) (c : ℝ≥0) :
42
+ (W.scale (c : ℝ) (NNReal.coe_nonneg c)).traceMeasure=c • W.traceMeasure := by
43
+ apply Measure.ext
44
+ intro s hs
45
+ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp
46
+ change (W.scale (c : ℝ) (NNReal.coe_nonneg c)).traceMeasure.real s=(c • W.traceMeasure).real s
47
+ rw [traceMeasure_real _ hs,scale_value,Matrix.trace_smul,
48
+ measureReal_nnreal_smul_apply,traceMeasure_real _ hs]
49
+ simp [smul_eq_mul]
50
+ lemma scale_domination (W : PositiveMatrixMeasure Ω n) {μ : Measure Ω}
51
+ (h : W.traceMeasure ≪ μ) (c : ℝ≥0) :
52
+ (W.scale (c : ℝ) (NNReal.coe_nonneg c)).traceMeasure ≪ c • μ := by
53
+ rw [scale_traceMeasure]
54
+ exact h.smul c
55
+ lemma scale_born (W : PositiveMatrixMeasure Ω n) (E : Mat n) (s : Set Ω) (c : ℝ≥0) :
56
+ (Matrix.trace (E*(W.scale (c : ℝ) (NNReal.coe_nonneg c)).value s)).re=
57
+ c*(Matrix.trace (E*W.value s)).re := by
58
+ rw [scale_value,Matrix.mul_smul,Matrix.trace_smul]
59
+ simp [smul_eq_mul]
60
+ end PositiveMatrixMeasure
61
+
62
+ end SecretKey
63
+
64
+ end
65
+
66
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProductInstrumentStep.lean ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.TraceInstrument
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators InnerProductSpace ComplexOrder ENNReal MeasureTheory TensorProduct
7
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory
8
+ namespace SecretKey
9
+ variable {H K L : Type*}
10
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
11
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
12
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
13
+ variable {ι κ υ : Type*} {X : Type*} [MeasurableSpace X]
14
+
15
+ def traceClassCoefficient (b : HilbertBasis ι ℂ H) (x y : H) : TraceClass b →ₗ[ℂ] ℂ where
16
+ toFun A := inner ℂ x ((A : H →L[ℂ] H) y)
17
+ map_add' A B := by simp
18
+ map_smul' c A := by simp
19
+
20
+ omit [CompleteSpace H] [CompleteSpace L] in
21
+ theorem local_product_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
22
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
23
+ (ρ : DensityOperator b) (σ : DensityOperator d)
24
+ (U : I.ConditionalUpdate ρ) {s : Set X} (hs : MeasurableSet s)
25
+ (x y : K) (u v : L) :
26
+ tensorFunctional (traceClassCoefficient c x y) (traceClassCoefficient d u v)
27
+ (TensorProduct.map (I.event s) LinearMap.id (ρ.val ⊗ₜ[ℂ] σ.val))=
28
+ ∫ z in s, tensorFunctional (traceClassCoefficient c x y) (traceClassCoefficient d u v)
29
+ ((U.state z).val ⊗ₜ[ℂ] σ.val) ∂I.outcome ρ := by
30
+ simp only [local_product_event,tensorFunctional_tmul,traceClassCoefficient,LinearMap.coe_mk,
31
+ AddHom.coe_mk]
32
+ rw [U.disintegration s hs x y,integral_mul_const]
33
+
34
+ omit [CompleteSpace H] [CompleteSpace L] in
35
+ theorem right_product_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
36
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
37
+ (ρ : DensityOperator b) (σ : DensityOperator d)
38
+ (U : I.ConditionalUpdate ρ) {s : Set X} (hs : MeasurableSet s)
39
+ (x y : K) (u v : L) :
40
+ tensorFunctional (traceClassCoefficient d u v) (traceClassCoefficient c x y)
41
+ (TensorProduct.map LinearMap.id (I.event s) (σ.val ⊗ₜ[ℂ] ρ.val))=
42
+ ∫ z in s, tensorFunctional (traceClassCoefficient d u v) (traceClassCoefficient c x y)
43
+ (σ.val ⊗ₜ[ℂ] (U.state z).val) ∂I.outcome ρ := by
44
+ simp only [TensorProduct.map_tmul,tensorFunctional_tmul,LinearMap.id_apply,
45
+ traceClassCoefficient,LinearMap.coe_mk,AddHom.coe_mk]
46
+ rw [U.disintegration s hs x y,integral_const_mul]
47
+
48
+ omit [CompleteSpace H] [CompleteSpace L] in
49
+ lemma conditional_product_trace (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
50
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
51
+ (ρ : DensityOperator b) (σ : DensityOperator d)
52
+ (U : I.ConditionalUpdate ρ) (z : X) :
53
+ tensorFunctional (traceClassTrace c) (traceClassTrace d)
54
+ ((U.state z).val ⊗ₜ[ℂ] σ.val)=1 := by
55
+ rw [tensorFunctional_tmul,(U.state z).property.2,σ.property.2,mul_one]
56
+
57
+ end SecretKey
58
+
59
+ end
60
+
61
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProjectionData.lean ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.TensorTools
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
7
+ open Matrix
8
+ namespace ProjectionCriterion
9
+ open ChannelCompletion TensorCriterion
10
+ variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I]
11
+ [DecidableEq Q] [DecidableEq D] [DecidableEq I]
12
+
13
+ def correlation (u : Q → K → ℝ) (q r : Q) : ℝ := ∑ a, u q a * u r a
14
+
15
+ structure Data (Q K D I : Type) [Fintype Q] [Fintype K] [Fintype D] [Fintype I]
16
+ [DecidableEq Q] [DecidableEq D] where
17
+ question : I → Q
18
+ u : Q → K → ℝ
19
+ unit : ∀ q, ∑ a, u q a * u q a = 1
20
+ P : I → Mat D
21
+ hermitian : ∀ i, (P i).IsHermitian
22
+ idempotent : ∀ i, P i * P i = P i
23
+ orthogonal : ∀ i j, question i = question j → i ≠ j → P i * P j = 0
24
+ complete : ∀ q, ∑ i with question i = q, P i = 1
25
+ commute : ∀ i j, correlation u (question i) (question j) ≠ 0 → P i * P j = P j * P i
26
+ κ : ℝ
27
+ gap : κ < (Fintype.card Q : ℝ) / Fintype.card K
28
+ clique : ∀ J : Finset I,
29
+ (∀ i ∈ J, ∀ j ∈ J, i ≠ j → 0 < (Matrix.trace (P i * P j)).re) →
30
+ (J.card : ℝ) ≤ κ
31
+
32
+ namespace Data
33
+ variable (d : Data Q K D I)
34
+ def c (i j : I) : ℝ := correlation d.u (d.question i) (d.question j)
35
+ def H (i j : I) : Mat D := (d.c i j : ℂ) • (d.P i * d.P j)
36
+ def Psi : Map I D where
37
+ toFun X := ∑ i, ∑ j, X i j • d.H i j
38
+ map_add' X Y := by simp [add_smul,Finset.sum_add_distrib]
39
+ map_smul' a X := by simp [smul_smul,Finset.smul_sum]
40
+ def C : Mat (I × I) := choi ((hsAdjoint d.Psi).comp d.Psi)
41
+ def B : Mat I := fun i j => d.C (i,i) (j,j)
42
+
43
+ omit [DecidableEq I] in
44
+ lemma c_symm (i j : I) : d.c i j = d.c j i := by
45
+ simp only [c,correlation,mul_comm]
46
+ omit [DecidableEq I] in
47
+ lemma c_self (i : I) : d.c i i = 1 := d.unit (d.question i)
48
+ omit [DecidableEq I] in
49
+ lemma P_psd (i : I) : (d.P i).PosSemidef := by
50
+ have h := Matrix.posSemidef_conjTranspose_mul_self (d.P i)
51
+ simpa only [(d.hermitian i).eq,d.idempotent] using h
52
+ omit [DecidableEq I] in
53
+ lemma H_self (i : I) : d.H i i = d.P i := by simp [H,d.c_self,d.idempotent]
54
+ omit [DecidableEq I] in
55
+ lemma H_symm (i j : I) : d.H i j = d.H j i := by
56
+ by_cases h : d.c i j = 0
57
+ · simp [H,h,← d.c_symm i j]
58
+ · rw [H,H,← d.c_symm i j,d.commute i j h]
59
+ omit [DecidableEq I] in
60
+ lemma H_adjoint (i j : I) : (d.H i j)ᴴ = d.H j i := by
61
+ simp only [H,Matrix.conjTranspose_smul,Matrix.conjTranspose_mul,
62
+ (d.hermitian i).eq,(d.hermitian j).eq,Complex.star_def,Complex.conj_ofReal,d.c_symm i j]
63
+ omit [DecidableEq I] in
64
+ lemma H_hermitian (i j : I) : (d.H i j).IsHermitian := by
65
+ rw [Matrix.IsHermitian,d.H_adjoint,d.H_symm]
66
+ lemma Psi_single (i j : I) : d.Psi (Matrix.single i j 1) = d.H i j := by
67
+ simp [Psi,Matrix.single_apply,ite_and,ite_smul]
68
+ lemma choi_Psi : choi d.Psi = fun a b => d.H a.1 b.1 a.2 b.2 := by
69
+ ext ⟨i,a⟩ ⟨j,b⟩
70
+ exact congrArg (fun X : Mat D => X a b) (d.Psi_single i j)
71
+
72
+ def gramFactor : Matrix (K × D) (I × D) ℂ :=
73
+ fun a b => (d.u (d.question b.1) a.1 : ℂ) * d.P b.1 a.2 b.2
74
+ lemma choi_gram : choi d.Psi = d.gramFactorᴴ * d.gramFactor := by
75
+ rw [d.choi_Psi]
76
+ ext ⟨i,a⟩ ⟨j,b⟩
77
+ change (d.c i j : ℂ) * (∑ e, d.P i a e * d.P j e b) = _
78
+ simp only [Matrix.mul_apply,Matrix.conjTranspose_apply,gramFactor,star_mul,
79
+ Complex.star_def,Complex.conj_ofReal,Fintype.sum_prod_type]
80
+ have hp (e : D) : star (d.P i e a) = d.P i a e := (d.hermitian i).apply a e
81
+ simp only [← Complex.star_def,hp]
82
+ rw [c,correlation,Complex.ofReal_sum]
83
+ simp only [Complex.ofReal_mul,Finset.sum_mul,Finset.mul_sum]
84
+ rw [Finset.sum_comm]
85
+ apply Finset.sum_congr rfl
86
+ intro k _
87
+ apply Finset.sum_congr rfl
88
+ intro e _
89
+ ring
90
+ lemma Psi_cp : CP d.Psi := by
91
+ apply cp_of_choi
92
+ rw [d.choi_gram]
93
+ exact Matrix.posSemidef_conjTranspose_mul_self _
94
+ omit [DecidableEq I] in
95
+ lemma Psi_input_transpose : d.Psi.comp transposeMap = d.Psi := by
96
+ ext X a b
97
+ change (∑ i, ∑ j, X j i • d.H i j) a b = (∑ i, ∑ j, X i j • d.H i j) a b
98
+ rw [Finset.sum_comm]
99
+ simp only [Matrix.sum_apply,Matrix.smul_apply]
100
+ apply Finset.sum_congr rfl
101
+ intro i _
102
+ apply Finset.sum_congr rfl
103
+ intro j _
104
+ rw [d.H_symm]
105
+ lemma Psi_ppt : PPT d.Psi := by
106
+ refine ⟨d.Psi_cp,?_⟩
107
+ have h := cp_simultaneous_transpose d.Psi_cp
108
+ rwa [d.Psi_input_transpose] at h
109
+ lemma adjoint_ppt : PPT (hsAdjoint d.Psi) := ppt_hsAdjoint d.Psi_ppt
110
+ lemma adjoint_output_transpose : transposeMap.comp (hsAdjoint d.Psi) = hsAdjoint d.Psi := by
111
+ rw [← hsAdjoint_input_transpose,d.Psi_input_transpose]
112
+
113
+ end Data
114
+ end ProjectionCriterion
115
+
116
+ end
117
+
118
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProjectionMain.lean ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionStats
2
+ import OAI.InformationTheory.Entanglement.CorrelationBound
3
+ import OAI.InformationTheory.Entanglement.SparseSeparable
4
+
5
+ namespace OAI
6
+
7
+ noncomputable section
8
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
9
+ open Matrix
10
+ namespace ProjectionCriterion
11
+ open ChannelCompletion TensorCriterion
12
+ variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I]
13
+ [DecidableEq Q] [DecidableEq K] [DecidableEq D] [DecidableEq I]
14
+ [Nonempty Q] [Nonempty K] [Nonempty D]
15
+
16
+ namespace Data
17
+ variable (d : Data Q K D I)
18
+ lemma C_nonseparable : ¬ Separable d.C := by
19
+ intro hsep
20
+ have hu := separable_compression_bound hsep d.κ (fun J hJ => d.clique J (by
21
+ simpa only [d.C_diag] using hJ))
22
+ have ht : compressionTrace d.C=(Fintype.card Q : ℝ)*(Fintype.card D : ℝ) := by
23
+ change (Matrix.trace d.B).re = _
24
+ rw [d.B_trace]
25
+ simp
26
+ have hs : compressionSum d.C=(∑ q, ∑ r, (correlation d.u q r)^2)*(Fintype.card D : ℝ) := by
27
+ change (∑ i, ∑ j, d.B i j).re = _
28
+ rw [d.B_sum]
29
+ simp [-Complex.ofReal_pow]
30
+ rw [ht,hs] at hu
31
+ have hD : 0 < (Fintype.card D : ℝ) := Nat.cast_pos.mpr Fintype.card_pos
32
+ have hQ : 0 < (Fintype.card Q : ℝ) := Nat.cast_pos.mpr Fintype.card_pos
33
+ have hlo := mul_le_mul_of_nonneg_right (correlation_lower d.u d.unit) hD.le
34
+ have hhi := mul_lt_mul_of_pos_right d.gap (mul_pos hQ hD)
35
+ have he : (Fintype.card Q : ℝ)/Fintype.card K*
36
+ ((Fintype.card Q : ℝ)*Fintype.card D) =
37
+ (Fintype.card Q : ℝ)^2/Fintype.card K*Fintype.card D := by ring
38
+ rw [he] at hhi
39
+ exact (not_lt_of_ge (hlo.trans hu)) hhi
40
+ end Data
41
+
42
+ theorem rectangular_projection_criterion (d : Data Q K D I) :
43
+ PPT d.Psi ∧ PPT (hsAdjoint d.Psi) ∧ ¬ Separable d.C ∧
44
+ Matrix.trace d.C=(Fintype.card Q : ℂ)^2*(Fintype.card D : ℂ) := by
45
+ exact ⟨d.Psi_ppt,d.adjoint_ppt,d.C_nonseparable,d.C_trace⟩
46
+
47
+ end ProjectionCriterion
48
+
49
+ end
50
+
51
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProjectionReal.lean ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionMain
2
+ import OAI.InformationTheory.Entanglement.ChoiTransfer
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
8
+ open Matrix
9
+ namespace ProjectionCriterion
10
+ open ChannelCompletion TensorCriterion SecretKey
11
+ namespace Data
12
+ variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I]
13
+ [DecidableEq Q] [DecidableEq K] [DecidableEq D] [DecidableEq I]
14
+ variable (d : Data Q K D I)
15
+
16
+ def RealProjections : Prop := ∀ i a b, (d.P i a b).im=0
17
+ omit [DecidableEq K] [DecidableEq I] in
18
+ lemma P_transpose (hr : d.RealProjections) (i : I) : (d.P i)ᵀ=d.P i := by
19
+ ext a b
20
+ have he := (d.hermitian i).apply a b
21
+ rw [Complex.ext_iff] at he ⊢
22
+ exact ⟨he.1,by change (d.P i b a).im=(d.P i a b).im; rw [hr i b a,hr i a b]⟩
23
+ omit [DecidableEq K] [DecidableEq I] in
24
+ lemma H_transpose (hr : d.RealProjections) (i j : I) : (d.H i j)ᵀ=d.H i j := by
25
+ simp only [H,Matrix.transpose_smul,Matrix.transpose_mul,d.P_transpose hr]
26
+ by_cases hc : d.c i j=0
27
+ · simp [hc]
28
+ · rw [d.commute i j hc]
29
+ omit [DecidableEq K] in
30
+ lemma adjoint_input_transpose (hr : d.RealProjections) :
31
+ (hsAdjoint d.Psi).comp transposeMap=hsAdjoint d.Psi := by
32
+ ext A i j
33
+ change hsAdjoint d.Psi Aᵀ i j=hsAdjoint d.Psi A i j
34
+ simp only [d.adjoint_apply,(d.H_hermitian i j).eq]
35
+ rw [← d.H_transpose hr i j,Matrix.trace_transpose_mul,d.H_transpose hr i j]
36
+ omit [DecidableEq K] in
37
+ lemma adjoint_trace (A : Mat D) :
38
+ Matrix.trace (hsAdjoint d.Psi A)=(Fintype.card Q : ℂ)*Matrix.trace A := by
39
+ change (∑ i, hsAdjoint d.Psi A i i)=_
40
+ simp_rw [d.adjoint_apply,d.H_self,(d.hermitian _).eq,Matrix.trace_mul_comm (d.P _) A]
41
+ simpa only [one_mul,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one]
42
+ using d.weighted_trace (fun _ => 1) A
43
+ omit [DecidableEq K] in
44
+ lemma choi_real (hr : d.RealProjections) :
45
+ d.C=tensorMap (hsAdjoint d.Psi) (hsAdjoint d.Psi) (projector (omega (n := D))) := by
46
+ change choi ((hsAdjoint d.Psi).comp d.Psi)=_
47
+ rw [choi_transfer d.Psi_cp]
48
+ have he : sharp d.Psi=hsAdjoint d.Psi := by
49
+ rw [sharp,d.adjoint_input_transpose hr,d.adjoint_output_transpose]
50
+ rw [he]
51
+
52
+ def localChannel : Map D I := (((Fintype.card Q : ℝ)⁻¹ : ℝ) : ℂ) • hsAdjoint d.Psi
53
+ def rho : Mat (I × I) := ((((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ))⁻¹ : ℝ) : ℂ) • d.C
54
+
55
+ omit [DecidableEq K] in
56
+ lemma localChannel_ppt : PPT d.localChannel := by
57
+ refine ⟨cp_smul d.adjoint_ppt.1 (inv_nonneg.mpr (Nat.cast_nonneg _)),?_⟩
58
+ change CP ((((Fintype.card Q : ℝ)⁻¹ : ℝ) : ℂ) • (transposeMap.comp (hsAdjoint d.Psi)))
59
+ exact cp_smul d.adjoint_ppt.2 (inv_nonneg.mpr (Nat.cast_nonneg _))
60
+ omit [DecidableEq K] in
61
+ lemma localChannel_tp [Nonempty Q] : TracePreserving d.localChannel := by
62
+ intro A
63
+ change Matrix.trace ((((Fintype.card Q : ℝ)⁻¹ : ℝ) : ℂ) • hsAdjoint d.Psi A)=_
64
+ rw [Matrix.trace_smul,d.adjoint_trace,smul_eq_mul]
65
+ have hq : (Fintype.card Q : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos)
66
+ push_cast
67
+ field_simp
68
+
69
+ omit [DecidableEq K] in
70
+ lemma rho_psd : d.rho.PosSemidef :=
71
+ (cp_choi (cp_comp d.adjoint_ppt.1 d.Psi_cp)).smul (by
72
+ change (0 : ℂ) ≤ (((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ))⁻¹ : ℝ)
73
+ have hn : 0 ≤ ((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ))⁻¹ := by positivity
74
+ exact_mod_cast hn)
75
+ omit [DecidableEq K] in
76
+ lemma rho_trace [Nonempty Q] [Nonempty D] : Matrix.trace d.rho=1 := by
77
+ rw [rho,Matrix.trace_smul,d.C_trace,smul_eq_mul]
78
+ have hq : (Fintype.card Q : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos)
79
+ have hd : (Fintype.card D : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos)
80
+ push_cast
81
+ field_simp
82
+
83
+ omit [Fintype I] [DecidableEq I] in
84
+ lemma separable_scaling {Z : Mat (I × I)} (hZ : Separable Z) {a : ℝ} (ha : 0 ≤ a) :
85
+ Separable ((a : ℂ) • Z) := by
86
+ obtain ⟨r,A,B,hA,hB,rfl⟩ := hZ
87
+ refine ⟨r,fun i => (a : ℂ) • A i,B,fun i => (hA i).smul (by exact_mod_cast ha),hB,?_⟩
88
+ simp only [Finset.smul_sum,Matrix.smul_kronecker]
89
+ lemma rho_nonseparable [Nonempty Q] [Nonempty K] [Nonempty D] : ¬ Separable d.rho := by
90
+ intro h
91
+ have hq : (Fintype.card Q : ℝ)≠0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos)
92
+ have hd : (Fintype.card D : ℝ)≠0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos)
93
+ have hz := separable_scaling h (mul_nonneg (sq_nonneg (Fintype.card Q : ℝ)) (Nat.cast_nonneg (Fintype.card D)))
94
+ have he : ((((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ)) : ℝ) : ℂ) • d.rho=d.C := by
95
+ rw [rho,smul_smul,← Complex.ofReal_mul,mul_inv_cancel₀ (mul_ne_zero (pow_ne_zero _ hq) hd)]
96
+ simp
97
+ rw [he] at hz
98
+ exact d.C_nonseparable hz
99
+ end Data
100
+ end ProjectionCriterion
101
+
102
+ end
103
+
104
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProjectionRealMain.lean ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionReal
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
7
+ open Matrix
8
+ namespace ProjectionCriterion
9
+ open ChannelCompletion TensorCriterion SecretKey
10
+
11
+ lemma projector_real_smul {n : Type} (r : ℝ) (v : n → ℂ) :
12
+ projector ((r : ℂ) • v)=((r^2 : ℝ) : ℂ) • projector v := by
13
+ ext i j
14
+ simp only [projector,Matrix.vecMulVec_apply,Pi.smul_apply,Pi.star_apply,smul_eq_mul,
15
+ star_mul,Complex.star_def,Complex.conj_ofReal,Matrix.smul_apply,Complex.ofReal_pow]
16
+ ring
17
+
18
+ def Phi (D : ℕ) : Fin D × Fin D → ℂ := (((Real.sqrt (D : ℝ))⁻¹ : ℝ) : ℂ) • omega
19
+ lemma Phi_projector (D : ℕ) : projector (Phi D)=(((D : ℝ)⁻¹ : ℝ) : ℂ) • projector (omega (n := Fin D)) := by
20
+ rw [Phi,projector_real_smul,inv_pow,Real.sq_sqrt (Nat.cast_nonneg D)]
21
+
22
+ namespace Data
23
+ variable {Q K I : Type} [Fintype Q] [Fintype K] [Fintype I]
24
+ [DecidableEq Q] [DecidableEq K] [DecidableEq I]
25
+ [Nonempty Q] [Nonempty K] {D : ℕ} [NeZero D]
26
+ variable (d : Data Q K (Fin D) I)
27
+ omit [DecidableEq K] [Nonempty Q] [Nonempty K] [NeZero D] in
28
+ lemma localChannel_input_transpose (hr : d.RealProjections) :
29
+ d.localChannel.comp transposeMap=d.localChannel := by
30
+ unfold localChannel
31
+ rw [LinearMap.smul_comp,d.adjoint_input_transpose hr]
32
+
33
+ omit [DecidableEq K] [Nonempty Q] [Nonempty K] [NeZero D] in
34
+ lemma rho_identification (hr : d.RealProjections) :
35
+ d.rho=tensorMap d.localChannel d.localChannel (projector (Phi D)) := by
36
+ rw [Phi_projector,localChannel,tensorMap_smul]
37
+ simp only [LinearMap.smul_apply,map_smul,smul_smul]
38
+ rw [← d.choi_real hr]
39
+ unfold rho
40
+ congr 1
41
+ simp only [Fintype.card_fin,Complex.ofReal_inv,Complex.ofReal_natCast,
42
+ Complex.ofReal_mul,mul_inv,pow_two,mul_assoc]
43
+ ring
44
+
45
+ omit [DecidableEq K] [Nonempty K] in
46
+ lemma rho_represented (hr : d.RealProjections) : Represented d.rho := by
47
+ refine ⟨d.rho_psd,d.rho_trace,D,D,Nat.pos_of_ne_zero (NeZero.ne D),
48
+ Nat.pos_of_ne_zero (NeZero.ne D),d.localChannel,d.localChannel,Phi D,
49
+ d.localChannel_ppt.1,?_,d.localChannel_ppt.1,?_,d.rho_identification hr⟩
50
+ all_goals rw [d.localChannel_input_transpose hr]; exact d.localChannel_ppt.1
51
+ end Data
52
+
53
+ theorem real_channel {Q K I : Type} [Fintype Q] [Fintype K] [Fintype I]
54
+ [DecidableEq Q] [DecidableEq K] [DecidableEq I] [Nonempty Q] [Nonempty K]
55
+ {D : ℕ} [NeZero D] (d : Data Q K (Fin D) I) (hr : d.RealProjections) :
56
+ (hsAdjoint d.Psi).comp transposeMap=hsAdjoint d.Psi ∧
57
+ transposeMap.comp (hsAdjoint d.Psi)=hsAdjoint d.Psi ∧
58
+ (∀ A, Matrix.trace (hsAdjoint d.Psi A)=(Fintype.card Q : ℂ)*Matrix.trace A) ∧
59
+ PPT d.localChannel ∧ TracePreserving d.localChannel ∧
60
+ d.rho=tensorMap d.localChannel d.localChannel (projector (Phi D)) ∧
61
+ Represented d.rho ∧ ¬ Separable d.rho := by
62
+ exact ⟨d.adjoint_input_transpose hr,d.adjoint_output_transpose,d.adjoint_trace,
63
+ d.localChannel_ppt,d.localChannel_tp,d.rho_identification hr,d.rho_represented hr,
64
+ d.rho_nonseparable⟩
65
+
66
+ end ProjectionCriterion
67
+
68
+ end
69
+
70
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProjectionReindex.lean ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionData
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators
7
+ open Matrix
8
+ namespace ProjectionCriterion
9
+ open ChannelCompletion
10
+ variable {Q K D I D' I' : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I]
11
+ [Fintype D'] [Fintype I'] [DecidableEq Q] [DecidableEq K] [DecidableEq D]
12
+ [DecidableEq I] [DecidableEq D'] [DecidableEq I']
13
+ omit [DecidableEq D] [DecidableEq D'] in
14
+ lemma trace_reindex (e : D' ≃ D) (A : Mat D) :
15
+ Matrix.trace (A.submatrix e e)=Matrix.trace A :=
16
+ e.sum_comp (fun i => A i i)
17
+ namespace Data
18
+ variable (d : Data Q K D I) (eD : D' ≃ D) (eI : I' ≃ I)
19
+ def reindexP (i : I') : Mat D' := (d.P (eI i)).submatrix eD eD
20
+ omit [Fintype I'] [DecidableEq K] [DecidableEq I] [DecidableEq D'] [DecidableEq I'] in
21
+ lemma reindexP_overlap (i j : I') :
22
+ Matrix.trace (d.reindexP eD eI i*d.reindexP eD eI j)=
23
+ Matrix.trace (d.P (eI i)*d.P (eI j)) := by
24
+ rw [reindexP,reindexP,Matrix.submatrix_mul_equiv,trace_reindex]
25
+ omit [Fintype D'] [DecidableEq K] [DecidableEq I] [DecidableEq I'] in
26
+ lemma reindexP_complete (q : Q) :
27
+ ∑ i : I' with d.question (eI i)=q, d.reindexP eD eI i=1 := by
28
+ rw [Finset.sum_filter]
29
+ calc
30
+ _ = ∑ i : I, if d.question i=q then (d.P i).submatrix eD eD else 0 :=
31
+ eI.sum_comp _
32
+ _ = (∑ i : I with d.question i=q, d.P i).submatrix eD eD := by
33
+ ext a b
34
+ simp only [Matrix.sum_apply,Matrix.submatrix_apply,Finset.sum_filter]
35
+ apply Finset.sum_congr rfl
36
+ intro c hc
37
+ split_ifs <;> rfl
38
+ _ = 1 := by rw [d.complete,Matrix.submatrix_one_equiv]
39
+ omit [Fintype I'] [DecidableEq K] [DecidableEq D'] [DecidableEq I'] in
40
+ lemma reindexP_clique (J : Finset I')
41
+ (hJ : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → 0 < (Matrix.trace (d.reindexP eD eI i*d.reindexP eD eI j)).re) :
42
+ (J.card : ℝ) ≤ d.κ := by
43
+ have hh := d.clique (J.image eI) (by
44
+ intro i hi j hj hij
45
+ obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hi
46
+ obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp hj
47
+ rw [← d.reindexP_overlap eD eI]
48
+ exact hJ a ha b hb (fun he => hij (he ▸ rfl)))
49
+ simpa only [Finset.card_image_of_injective _ eI.injective] using hh
50
+
51
+ def reindex : Data Q K D' I' where
52
+ question i := d.question (eI i)
53
+ u := d.u
54
+ unit := d.unit
55
+ P := d.reindexP eD eI
56
+ hermitian i := (d.hermitian (eI i)).submatrix eD
57
+ idempotent i := by rw [reindexP,Matrix.submatrix_mul_equiv,d.idempotent]
58
+ orthogonal i j hq hij := by
59
+ rw [reindexP,reindexP,Matrix.submatrix_mul_equiv,
60
+ d.orthogonal (eI i) (eI j) hq (eI.injective.ne hij)]
61
+ rfl
62
+ complete := d.reindexP_complete eD eI
63
+ commute i j h := by
64
+ rw [reindexP,reindexP,Matrix.submatrix_mul_equiv,Matrix.submatrix_mul_equiv,d.commute _ _ h]
65
+ κ := d.κ
66
+ gap := d.gap
67
+ clique := d.reindexP_clique eD eI
68
+ end Data
69
+ end ProjectionCriterion
70
+
71
+ end
72
+
73
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProjectionSquare.lean ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionMain
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
7
+ open Matrix
8
+ namespace ProjectionCriterion
9
+ open ChannelCompletion TensorCriterion
10
+
11
+ lemma hsAdjoint_left_ad {n m p : Type} [Fintype n] [Fintype m] [Fintype p]
12
+ [DecidableEq n] {F : Map n m} (hF : CP F) (S : Matrix p m ℂ) :
13
+ hsAdjoint ((ad S).comp F)=(hsAdjoint F).comp (ad Sᴴ) := by
14
+ ext X i j
15
+ have he (Y : Mat n) : Matrix.trace (Y*hsAdjoint ((ad S).comp F) X)=
16
+ Matrix.trace (Y*hsAdjoint F (ad Sᴴ X)) := by
17
+ rw [trace_hsAdjoint (cp_comp (cp_ad S) hF),trace_hsAdjoint hF]
18
+ simp only [LinearMap.comp_apply,ad_apply,Matrix.conjTranspose_conjTranspose]
19
+ calc
20
+ Matrix.trace (S*F Y*Sᴴ*X)=Matrix.trace (S*(F Y*Sᴴ*X)) := by simp only [Matrix.mul_assoc]
21
+ _ = Matrix.trace ((F Y*Sᴴ*X)*S) := Matrix.trace_mul_comm _ _
22
+ _ = _ := by simp only [Matrix.mul_assoc]
23
+ change hsAdjoint ((ad S).comp F) X i j=hsAdjoint F (ad Sᴴ X) i j
24
+ simpa only [Matrix.trace_single_mul,one_smul] using he (Matrix.single j i 1)
25
+
26
+ namespace Data
27
+ variable {Q K : Type} [Fintype Q] [Fintype K] [DecidableEq Q] [DecidableEq K]
28
+ {D n : ℕ} (d : Data Q K (Fin D) (Fin n)) (h : D ≤ n)
29
+
30
+ def firstCoordinates (_d : Data Q K (Fin D) (Fin n)) (h : D ≤ n) :
31
+ Matrix (Fin n) (Fin D) ℂ := coord (Fin.castLE h)
32
+ def Xi1 : Map (Fin n) (Fin n) := (ad (d.firstCoordinates h)).comp d.Psi
33
+ def Xi2 : Map (Fin n) (Fin n) := (hsAdjoint d.Psi).comp (ad (d.firstCoordinates h)ᴴ)
34
+
35
+ omit [DecidableEq K] in
36
+ lemma Xi1_ppt : PPT (d.Xi1 h) := ppt_ad_comp d.Psi_ppt _
37
+ omit [DecidableEq K] in
38
+ lemma Xi2_ppt : PPT (d.Xi2 h) := ppt_comp_cp d.adjoint_ppt (cp_ad _)
39
+ omit [DecidableEq K] in
40
+ lemma Xi2_adjoint : d.Xi2 h=hsAdjoint (d.Xi1 h) := (hsAdjoint_left_ad d.Psi_cp _).symm
41
+ omit [DecidableEq K] in
42
+ lemma Xi_composite : (d.Xi2 h).comp (d.Xi1 h)=(hsAdjoint d.Psi).comp d.Psi := by
43
+ ext X a b
44
+ simp only [Xi1,Xi2,LinearMap.comp_apply,ad_apply,Matrix.conjTranspose_conjTranspose]
45
+ have hh : (d.firstCoordinates h)ᴴ*d.firstCoordinates h=1 :=
46
+ coord_isometry _ (Fin.castLE_injective h)
47
+ have he : (d.firstCoordinates h)ᴴ*((d.firstCoordinates h)*d.Psi X*(d.firstCoordinates h)ᴴ)*
48
+ (d.firstCoordinates h)=d.Psi X := by
49
+ calc
50
+ _ = ((d.firstCoordinates h)ᴴ*d.firstCoordinates h)*d.Psi X*
51
+ ((d.firstCoordinates h)ᴴ*d.firstCoordinates h) := by simp only [Matrix.mul_assoc]
52
+ _ = _ := by rw [hh,Matrix.one_mul,Matrix.mul_one]
53
+ rw [he]
54
+ lemma Xi_not_eb [Nonempty Q] [Nonempty K] [NeZero D] :
55
+ ¬ EntanglementBreaking ((d.Xi2 h).comp (d.Xi1 h)) := by
56
+ intro heb
57
+ rw [d.Xi_composite h] at heb
58
+ exact d.C_nonseparable (eb_choi heb)
59
+ end Data
60
+
61
+ theorem square_embedding {Q K : Type} [Fintype Q] [Fintype K]
62
+ [DecidableEq Q] [DecidableEq K] [Nonempty Q] [Nonempty K]
63
+ {D n : ℕ} [NeZero D] (d : Data Q K (Fin D) (Fin n)) (h : D ≤ n) :
64
+ PPT (d.Xi1 h) ∧ PPT (d.Xi2 h) ∧ d.Xi2 h=hsAdjoint (d.Xi1 h) ∧
65
+ (d.Xi2 h).comp (d.Xi1 h)=(hsAdjoint d.Psi).comp d.Psi ∧
66
+ ¬ EntanglementBreaking ((d.Xi2 h).comp (d.Xi1 h)) := by
67
+ exact ⟨d.Xi1_ppt h,d.Xi2_ppt h,d.Xi2_adjoint h,d.Xi_composite h,d.Xi_not_eb h⟩
68
+
69
+ end ProjectionCriterion
70
+
71
+ end
72
+
73
+ end OAI
lean/OAI/InformationTheory/Entanglement/ProjectionStats.lean ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProjectionData
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
7
+ open Matrix
8
+ namespace ProjectionCriterion
9
+ open ChannelCompletion TensorCriterion
10
+ namespace Data
11
+ variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I]
12
+ [DecidableEq Q] [DecidableEq D] [DecidableEq I]
13
+ variable (d : Data Q K D I)
14
+
15
+ lemma adjoint_apply (A : Mat D) (i j : I) :
16
+ hsAdjoint d.Psi A i j = Matrix.trace ((d.H i j)ᴴ * A) := by
17
+ simp only [hsAdjoint,d.Psi_single]
18
+ change (∑ a, ∑ b, star (d.H i j a b)*A a b) =
19
+ ∑ a, ∑ b, star (d.H i j b a)*A b a
20
+ rw [Finset.sum_comm]
21
+ lemma C_entry (i j a b : I) : d.C (i,a) (j,b) = Matrix.trace ((d.H a b)ᴴ*d.H i j) := by
22
+ change hsAdjoint d.Psi (d.Psi (Matrix.single i j 1)) a b = _
23
+ rw [d.Psi_single,d.adjoint_apply]
24
+ lemma C_diag (i j : I) : d.C (i,j) (i,j) = Matrix.trace (d.P i*d.P j) := by
25
+ rw [d.C_entry,d.H_self,d.H_self,(d.hermitian j).eq,Matrix.trace_mul_comm]
26
+ omit [DecidableEq I] in
27
+ lemma overlap_gram (i j : I) :
28
+ Matrix.trace ((d.P i*d.P j)ᴴ*(d.P i*d.P j))=Matrix.trace (d.P i*d.P j) := by
29
+ rw [Matrix.conjTranspose_mul,(d.hermitian i).eq,(d.hermitian j).eq]
30
+ calc
31
+ Matrix.trace (d.P j*d.P i*(d.P i*d.P j)) =
32
+ Matrix.trace (d.P j*(d.P i*d.P i)*d.P j) := by simp only [Matrix.mul_assoc]
33
+ _ = Matrix.trace (d.P j*d.P i*d.P j) := by rw [d.idempotent]
34
+ _ = Matrix.trace (d.P j*d.P j*d.P i) := Matrix.trace_mul_cycle _ _ _
35
+ _ = Matrix.trace (d.P i*d.P j) := by rw [d.idempotent,Matrix.trace_mul_comm]
36
+ omit [DecidableEq I] in
37
+ lemma overlap_nonneg (i j : I) : 0 ≤ (Matrix.trace (d.P i*d.P j)).re := by
38
+ rw [← d.overlap_gram]
39
+ exact (Complex.nonneg_iff.mp (Matrix.posSemidef_conjTranspose_mul_self (d.P i*d.P j)).trace_nonneg).1
40
+ omit [DecidableEq I] in
41
+ lemma overlap_im (i j : I) : (Matrix.trace (d.P i*d.P j)).im=0 := by
42
+ rw [← d.overlap_gram]
43
+ exact (Complex.nonneg_iff.mp (Matrix.posSemidef_conjTranspose_mul_self (d.P i*d.P j)).trace_nonneg).2.symm
44
+ lemma B_entry (i j : I) : d.B i j = ((d.c i j)^2 : ℂ) * Matrix.trace (d.P i*d.P j) := by
45
+ change d.C (i,i) (j,j) = _
46
+ rw [d.C_entry]
47
+ simp only [H,Matrix.conjTranspose_smul,Complex.star_def,Complex.conj_ofReal,
48
+ Matrix.smul_mul,Matrix.mul_smul,smul_smul,Matrix.trace_smul,smul_eq_mul]
49
+ rw [d.overlap_gram]
50
+ ring
51
+ omit [DecidableEq I] in
52
+ lemma weighted_trace (f : Q → ℂ) (A : Mat D) :
53
+ (∑ i, f (d.question i)*Matrix.trace (A*d.P i)) =
54
+ (∑ q, f q)*Matrix.trace A := by
55
+ rw [← Finset.sum_fiberwise Finset.univ d.question]
56
+ calc
57
+ (∑ q, ∑ i with d.question i=q, f (d.question i)*Matrix.trace (A*d.P i)) =
58
+ ∑ q, f q * Matrix.trace A := by
59
+ apply Finset.sum_congr rfl
60
+ intro q _
61
+ calc
62
+ (∑ i with d.question i=q, f (d.question i)*Matrix.trace (A*d.P i)) =
63
+ ∑ i with d.question i=q, f q*Matrix.trace (A*d.P i) := by
64
+ apply Finset.sum_congr rfl
65
+ intro i hi
66
+ rw [(Finset.mem_filter.mp hi).2]
67
+ _ = f q*Matrix.trace (A*(∑ i with d.question i=q, d.P i)) := by
68
+ simp only [Matrix.trace_sum,Finset.mul_sum]
69
+ _ = f q*Matrix.trace A := by rw [d.complete,Matrix.mul_one]
70
+ _ = _ := (Finset.sum_mul ..).symm
71
+ omit [DecidableEq I] in
72
+ lemma weighted_projector_trace (f : Q → ℂ) :
73
+ (∑ i, f (d.question i)*Matrix.trace (d.P i)) =
74
+ (∑ q, f q)*(Fintype.card D : ℂ) := by
75
+ simpa only [Matrix.one_mul,Matrix.trace_one] using d.weighted_trace f 1
76
+ omit [DecidableEq I] in
77
+ lemma weighted_overlap (f : Q → Q → ℂ) :
78
+ (∑ i, ∑ j, f (d.question i) (d.question j)*Matrix.trace (d.P i*d.P j)) =
79
+ (∑ q, ∑ r, f q r)*(Fintype.card D : ℂ) := by
80
+ simp_rw [d.weighted_trace]
81
+ exact d.weighted_projector_trace (fun q => ∑ r, f q r)
82
+ lemma C_trace : Matrix.trace d.C = (Fintype.card Q : ℂ)^2*(Fintype.card D : ℂ) := by
83
+ change (∑ ij, d.C ij ij) = _
84
+ rw [Fintype.sum_prod_type]
85
+ simp_rw [d.C_diag]
86
+ have h := d.weighted_overlap (fun _ _ => 1)
87
+ simpa only [one_mul,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one,pow_two] using h
88
+ lemma B_trace : Matrix.trace d.B = (Fintype.card Q : ℂ)*(Fintype.card D : ℂ) := by
89
+ change (∑ i, d.C (i,i) (i,i)) = _
90
+ simp_rw [d.C_diag,d.idempotent]
91
+ have h := d.weighted_projector_trace (fun _ => 1)
92
+ simpa only [one_mul,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] using h
93
+ lemma B_sum : (∑ i, ∑ j, d.B i j) =
94
+ ((∑ q, ∑ r, (correlation d.u q r)^2 : ℝ) : ℂ)*(Fintype.card D : ℂ) := by
95
+ simp only [d.B_entry,c]
96
+ rw [d.weighted_overlap (fun q r => (correlation d.u q r : ℂ)^2)]
97
+ push_cast
98
+ rfl
99
+ end Data
100
+ end ProjectionCriterion
101
+
102
+ end
103
+
104
+ end OAI
lean/OAI/InformationTheory/Entanglement/PublicSampler.lean ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.IndependentTapes
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open MeasureTheory ProbabilityTheory Filter Function
7
+ open scoped MeasureTheory ProbabilityTheory unitInterval
8
+ namespace SecretKey
9
+ variable {Ω S T Y : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω]
10
+ variable [MeasurableSpace S] [MeasurableSpace T] [MeasurableSpace Y]
11
+ variable [StandardBorelSpace Y] [Nonempty Y]
12
+ variable {μ : Measure Ω} [IsProbabilityMeasure μ]
13
+
14
+ omit [StandardBorelSpace Y] [Nonempty Y] in
15
+ theorem sampled_public_independence
16
+ {F A : MeasurableSpace Ω} (hF : F ≤ mΩ) (_ : A ≤ mΩ)
17
+ (H : Ω → S) (hH : @Measurable Ω S mΩ _ H)
18
+ (hFH : F ≤ (inferInstance : MeasurableSpace S).comap H)
19
+ (hAH : A ≤ (inferInstance : MeasurableSpace S).comap H)
20
+ (g : S → T) (hg : Measurable g) (hpub : Measurable[F] (g ∘ H))
21
+ (U : Ω → I) (hU : @Measurable Ω I mΩ _ U) (hind : IndepFun H U μ)
22
+ (hUlaw : @Measure.map Ω I mΩ _ U μ=volume)
23
+ (κ : Kernel T Y) [IsMarkovKernel κ]
24
+ (f : T → I → Y) (hf : Measurable (uncurry f))
25
+ (hmap : ∀ t, volume.map (f t)=κ t) :
26
+ CondIndep F A ((inferInstance : MeasurableSpace Y).comap (fun ω => f (g (H ω)) (U ω))) hF μ := by
27
+ let : MeasurableSpace Ω := mΩ
28
+ have hC : @Measurable Ω Y mΩ _ (fun ω => f (g (H ω)) (U ω)) :=
29
+ hf.comp ((hg.comp hH).prodMk hU)
30
+ apply independent_of_public_conditional_laws hF hH.comap_le hFH hAH hC.comap_le
31
+ intro b hb
32
+ obtain ⟨E,hE,rfl⟩ := hb
33
+ have hs := sampled_conditional_event H U hH hU hind (fun s u => f (g s) u)
34
+ (hf.comp ((hg.comp measurable_fst).prodMk measurable_snd)) (κ.comap g hg)
35
+ (by intro s; simpa only [hUlaw,Kernel.comap_apply] using hmap (g s)) E hE
36
+ have hm : StronglyMeasurable[F] (fun ω => (κ (g (H ω))).real E) := by
37
+ exact (((κ.measurable_coe hE).comp hpub).ennreal_toReal).stronglyMeasurable
38
+ exact hm.aestronglyMeasurable.congr hs.symm
39
+
40
+ end SecretKey
41
+
42
+ end
43
+
44
+ end OAI
lean/OAI/InformationTheory/Entanglement/PurificationExpansion.lean ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.PurificationSupport
2
+ import OAI.InformationTheory.Entanglement.HilbertEmbeddingOrder
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped BigOperators InnerProductSpace ComplexOrder MatrixOrder
8
+ open Matrix ContinuousLinearMap
9
+ namespace SecretKey
10
+ open ChannelCompletion TensorCriterion
11
+ variable {n : Type} [Fintype n] [DecidableEq n]
12
+ variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
13
+
14
+ omit [DecidableEq n] [CompleteSpace H] in
15
+ theorem purification_orthonormal_expansion (x : n→H) :
16
+ ∃ d : ℕ, ∃ v : Fin d→H, ∃ B : Matrix (Fin d) n ℂ,
17
+ Orthonormal ℂ v ∧ (∀ j, ∑ i, B i j • v i=x j) ∧
18
+ (∀ i j, (Bᴴ*B) i j=inner ℂ (x i) (x j)) := by
19
+ obtain ⟨d,V,B,hx,hg⟩ := purification_finite_span x
20
+ let e := EuclideanSpace.basisFun (Fin d) ℂ
21
+ let v := fun i => V (e i)
22
+ have hv : Orthonormal ℂ v := by
23
+ rw [orthonormal_iff_ite]
24
+ intro i j
25
+ rw [show inner ℂ (v i) (v j)=inner ℂ (e i) (e j) from V.inner_map_map _ _]
26
+ exact orthonormal_iff_ite.mp e.orthonormal i j
27
+ refine ⟨d,v,B,hv,?_,hg⟩
28
+ intro j
29
+ calc
30
+ _=V (∑ i, B i j • e i) := by simp only [map_sum,map_smul]; rfl
31
+ _=V (WithLp.toLp 2 (fun i => B i j)) := by
32
+ congr 1
33
+ simpa only [e,EuclideanSpace.basisFun_repr,WithLp.ofLp_toLp] using
34
+ e.sum_repr (WithLp.toLp 2 (fun i => B i j))
35
+ _=x j := hx j
36
+
37
+ end SecretKey
38
+
39
+ end
40
+
41
+ end OAI
lean/OAI/InformationTheory/Entanglement/PurificationSupport.lean ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.FiniteRecovery
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators InnerProductSpace ComplexOrder MatrixOrder
7
+ open Matrix
8
+ namespace SecretKey
9
+ open ChannelCompletion TensorCriterion
10
+ variable {n : Type} [Fintype n] [DecidableEq n]
11
+ variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H]
12
+
13
+ omit [DecidableEq n] in
14
+ theorem purification_finite_span (x : n → H) :
15
+ ∃ d : ℕ, ∃ V : EuclideanSpace ℂ (Fin d) →ₗᵢ[ℂ] H,
16
+ ∃ B : Matrix (Fin d) n ℂ,
17
+ (∀ j, V (WithLp.toLp 2 (fun a => B a j))=x j) ∧
18
+ (∀ i j, (Bᴴ*B) i j=inner ℂ (x i) (x j)) := by
19
+ let S := Submodule.span ℂ (Set.range x)
20
+ let : FiniteDimensional ℂ S := FiniteDimensional.span_of_finite ℂ (Set.finite_range x)
21
+ let b := stdOrthonormalBasis ℂ S
22
+ let v (j : n) : S := ⟨x j,Submodule.subset_span (Set.mem_range_self j)⟩
23
+ let V : EuclideanSpace ℂ (Fin (Module.finrank ℂ S)) →ₗᵢ[ℂ] H :=
24
+ S.subtypeₗᵢ.comp b.repr.symm.toLinearIsometry
25
+ let B : Matrix (Fin (Module.finrank ℂ S)) n ℂ := fun a j => b.repr (v j) a
26
+ have hv (j : n) : V (WithLp.toLp 2 (fun a => B a j))=x j := by
27
+ change ↑(b.repr.symm (b.repr (v j)))=x j
28
+ rw [b.repr.symm_apply_apply]
29
+ refine ⟨_,V,B,hv,?_⟩
30
+ intro i j
31
+ rw [← hv i,← hv j,V.inner_map_map]
32
+ simp only [EuclideanSpace.inner_eq_star_dotProduct,
33
+ Matrix.mul_apply,Matrix.conjTranspose_apply,dotProduct,Pi.star_apply,mul_comm]
34
+
35
+ theorem purification_support_recovery (i₀ : n) (x : n → H) :
36
+ ∃ d : ℕ, ∃ V : EuclideanSpace ℂ (Fin d) →ₗᵢ[ℂ] H,
37
+ ∃ B : Matrix (Fin d) n ℂ, ∃ F : Map (Fin d) n,
38
+ CP F ∧ TracePreserving F ∧
39
+ (∀ j, V (WithLp.toLp 2 (fun a => B a j))=x j) ∧
40
+ (∀ A : Mat n, F (B*A*Bᴴ)=
41
+ CFC.sqrt (Matrix.of fun i j => inner ℂ (x i) (x j))*A*CFC.sqrt (Matrix.of fun i j => inner ℂ (x i) (x j))) := by
42
+ obtain ⟨d,V,B,hx,hgram⟩ := purification_finite_span x
43
+ obtain ⟨F,hF,hT,hrec⟩ := finite_purification_recovery i₀ B
44
+ have he : Bᴴ*B=Matrix.of (fun i j => inner ℂ (x i) (x j)) := by ext i j; exact hgram i j
45
+ refine ⟨d,V,B,F,hF,hT,hx,?_⟩
46
+ intro A
47
+ simpa only [he] using hrec A
48
+
49
+ end SecretKey
50
+
51
+ end
52
+
53
+ end OAI
lean/OAI/InformationTheory/Entanglement/QuantumStepKernel.lean ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.ProductInstrumentStep
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators InnerProductSpace ComplexOrder ENNReal MeasureTheory TensorProduct
7
+ open ContinuousLinearMap MeasureTheory ProbabilityTheory
8
+ namespace SecretKey
9
+ variable {S X : Type*} [MeasurableSpace S] [MeasurableSpace X]
10
+ lemma compProd_real_rectangle (ν : Measure S) [IsFiniteMeasure ν] (K : Kernel S X)
11
+ [IsMarkovKernel K] {U : Set S} {V : Set X} (hU : MeasurableSet U) (hV : MeasurableSet V) :
12
+ (ν ⊗ₘ K).real (U ×ˢ V)=∫ h in U, (K h).real V ∂ν := by
13
+ rw [Measure.real,Measure.compProd_apply_prod hU hV]
14
+ exact (integral_toReal (K.measurable_coe hV).aemeasurable
15
+ (Filter.Eventually.of_forall (fun h => measure_lt_top (K h) V))).symm
16
+ variable {H K L : Type*}
17
+ [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
18
+ [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K]
19
+ [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L]
20
+ variable {ι κ υ : Type*}
21
+
22
+ omit [CompleteSpace H] [CompleteSpace L] in
23
+ theorem quantum_step_kernel (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
24
+ (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X)
25
+ (ρ : S→DensityOperator b) (σ : S→DensityOperator d)
26
+ (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V))
27
+ (ν : Measure S) [IsFiniteMeasure ν] (ν' : Measure (S×X)) [IsFiniteMeasure ν']
28
+ (hBorn : ∀ U V, MeasurableSet U → MeasurableSet V →
29
+ ν'.real (U ×ˢ V)=∫ h in U,
30
+ (tensorFunctional (traceClassTrace c) (traceClassTrace d)
31
+ (TensorProduct.map ((J h).event V) LinearMap.id ((ρ h).val ⊗ₜ[ℂ] (σ h).val))).re ∂ν) :
32
+ ν'=ν ⊗ₘ TraceInstrument.historyKernel J ρ hm := by
33
+ apply Measure.ext_prod
34
+ intro U V hU hV
35
+ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp
36
+ change ν'.real (U ×ˢ V)=(ν ⊗ₘ TraceInstrument.historyKernel J ρ hm).real (U ×ˢ V)
37
+ rw [hBorn U V hU hV,compProd_real_rectangle ν _ hU hV]
38
+ apply setIntegral_congr_fun hU
39
+ intro h hh
40
+ exact local_product_born b c d (J h) (ρ h) (σ h) hV
41
+
42
+ omit [CompleteSpace H] [CompleteSpace L] in
43
+ lemma right_product_born (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K)
44
+ (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X)
45
+ (ρ : DensityOperator b) (σ : DensityOperator d) {V : Set X} (hV : MeasurableSet V) :
46
+ (tensorFunctional (traceClassTrace d) (traceClassTrace c)
47
+ (TensorProduct.map LinearMap.id (I.event V) (σ.val ⊗ₜ[ℂ] ρ.val))).re=(I.outcome ρ).real V := by
48
+ rw [TensorProduct.map_tmul,tensorFunctional_tmul,LinearMap.id_apply,σ.property.2,one_mul,
49
+ I.outcome_born ρ hV]
50
+
51
+ end SecretKey
52
+
53
+ end
54
+
55
+ end OAI
lean/OAI/InformationTheory/Entanglement/ReferenceFilter.lean ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.MatrixTraceMeasure
2
+ import OAI.InformationTheory.Entanglement.ProbeMatrices
3
+
4
+ namespace OAI
5
+
6
+ noncomputable section
7
+ open scoped BigOperators ComplexOrder MatrixOrder MeasureTheory Kronecker
8
+ open Matrix MeasureTheory
9
+ namespace SecretKey
10
+ open ChannelCompletion
11
+ variable {Ω : Type*} [MeasurableSpace Ω]
12
+ variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m]
13
+ namespace PositiveMatrixMeasure
14
+ omit [Fintype m] [DecidableEq n] [DecidableEq m] in
15
+ lemma filter_entry_value (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ) (s : Set Ω) :
16
+ (fun a b => (∑ i, ∑ j, (K a i*star (K b j)) • W.entry i j) s)=K*W.value s*Kᴴ := by
17
+ ext a b
18
+ simp only [_root_.sum_apply,_root_.smul_apply,smul_eq_mul,Matrix.mul_apply,
19
+ Matrix.conjTranspose_apply,Finset.sum_mul,value]
20
+ rw [Finset.sum_comm]
21
+ apply Finset.sum_congr rfl
22
+ intro i hi
23
+ apply Finset.sum_congr rfl
24
+ intro j hj
25
+ ring
26
+
27
+ def filter (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ) : PositiveMatrixMeasure Ω m where
28
+ entry a b := ∑ i, ∑ j, (K a i*star (K b j)) • W.entry i j
29
+ positive s hs := by
30
+ rw [filter_entry_value]
31
+ exact (W.positive s hs).mul_mul_conjTranspose_same K
32
+ omit [DecidableEq n] [DecidableEq m] in
33
+ lemma filter_value (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ) (s : Set Ω) :
34
+ (W.filter K).value s=K*W.value s*Kᴴ := filter_entry_value W K s
35
+ end PositiveMatrixMeasure
36
+ omit [Fintype m] [DecidableEq n] [DecidableEq m] in
37
+ lemma filter_density_integrable {μ : Measure Ω} {D : Ω → Mat n}
38
+ (hD : ∀ a b, Integrable (fun x => D x a b) μ) (K : Matrix m n ℂ) (a b : m) :
39
+ Integrable (fun x => (K*D x*Kᴴ) a b) μ := by
40
+ simp only [Matrix.mul_apply,Finset.sum_mul]
41
+ exact integrable_finsetSum _ fun j _ => integrable_finsetSum _ fun i _ =>
42
+ ((hD i j).const_mul _).mul_const _
43
+ omit [Fintype m] [DecidableEq n] [DecidableEq m] in
44
+ lemma filter_density_measurable {D : Ω → Mat n} (hD : Measurable D) (K : Matrix m n ℂ) :
45
+ Measurable (fun x => K*D x*Kᴴ) := by
46
+ have hc : Continuous (fun M : Mat n => K*M*Kᴴ) := by fun_prop
47
+ exact hc.measurable.comp hD
48
+ omit [DecidableEq n] [DecidableEq m] in
49
+ lemma filter_setIntegral {μ : Measure Ω} (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ)
50
+ (D : Ω → Mat n) (hD : ∀ a b, Integrable (fun x => D x a b) μ)
51
+ (hs : ∀ s, MeasurableSet s → ∀ a b, (∫ x in s, D x a b ∂μ)=W.value s a b)
52
+ {s : Set Ω} (hsm : MeasurableSet s) (a b : m) :
53
+ (∫ x in s, (K*D x*Kᴴ) a b ∂μ)=(W.filter K).value s a b := by
54
+ rw [PositiveMatrixMeasure.filter_value]
55
+ simp only [Matrix.mul_apply,Finset.sum_mul]
56
+ rw [integral_finsetSum]
57
+ · apply Finset.sum_congr rfl
58
+ intro j hj
59
+ rw [integral_finsetSum]
60
+ · apply Finset.sum_congr rfl
61
+ intro i hi
62
+ rw [integral_mul_const,integral_const_mul, hs s hsm]
63
+ · intro i hi
64
+ exact (((hD i j).const_mul _).mul_const _).integrableOn
65
+ · intro j hj
66
+ exact (integrable_finsetSum _ fun i _ => ((hD i j).const_mul _).mul_const _).integrableOn
67
+
68
+ def canonicalProbeFilter (R : Mat (n×m)) : Mat (n×m) :=
69
+ (Real.sqrt ((Fintype.card n : ℝ)*Fintype.card m) : ℂ) • (CFC.sqrt R)ᵀ
70
+ lemma canonicalProbeFilter_hermitian (R : Mat (n×m)) :
71
+ (canonicalProbeFilter R)ᴴ=canonicalProbeFilter R := by
72
+ unfold canonicalProbeFilter
73
+ rw [Matrix.conjTranspose_smul,Complex.star_def,Complex.conj_ofReal]
74
+ exact congrArg (_ • ·) (sqrt_psd R).isHermitian.transpose.eq
75
+ lemma canonicalProbeFilter_product (R : Mat (n×m)) (U : Mat n) (V : Mat m) :
76
+ canonicalProbeFilter R*(U ⊗ₖ V)*(canonicalProbeFilter R)ᴴ =
77
+ eveBlock R (((Fintype.card n : ℂ) • Uᵀ) ⊗ₖ ((Fintype.card m : ℂ) • Vᵀ)) := by
78
+ rw [canonicalProbeFilter_hermitian]
79
+ unfold canonicalProbeFilter eveBlock
80
+ simp only [Matrix.smul_mul,Matrix.mul_smul,smul_smul]
81
+ rw [← Complex.ofReal_mul,Real.mul_self_sqrt (by positivity)]
82
+ simp only [Complex.ofReal_mul,Complex.ofReal_natCast]
83
+ rw [Matrix.smul_kronecker,Matrix.kronecker_smul,smul_smul,Matrix.mul_smul,Matrix.smul_mul,
84
+ Matrix.transpose_smul,Matrix.transpose_mul,Matrix.transpose_mul,Matrix.kroneckerMap_transpose,
85
+ Matrix.transpose_transpose]
86
+ simp only [Matrix.mul_assoc]
87
+
88
+ end SecretKey
89
+
90
+ end
91
+
92
+ end OAI
lean/OAI/InformationTheory/Entanglement/RestrictedIntersections.lean ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.BooleanSpan
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators
7
+ namespace FiniteConstruction
8
+
9
+ abbrev Base := {A : Finset (Fin 1028) // A.card=514 ∧ (0 : Fin 1028) ∈ A}
10
+ def b : ℕ := Nat.choose 1027 513
11
+ def a₀ : ℕ := ∑ j ∈ Finset.range 257, Nat.choose 1028 j
12
+ instance prime257 : Fact (Nat.Prime 257) := ⟨by norm_num⟩
13
+
14
+ lemma sum_monomial_apply {α β : Type} [Fintype α] [Fintype β]
15
+ [DecidableEq α] [DecidableEq β] (B : β → Finset α) (A : Finset α) (c : β) :
16
+ (∑ a ∈ A, monomial (𝔽 := ZMod 257) B {a}) c=((A ∩ B c).card : ZMod 257) := by
17
+ simp only [Finset.sum_apply,monomial,Finset.singleton_subset_iff]
18
+ simp
19
+
20
+ theorem restricted_intersections (F : Finset Base)
21
+ (h : ∀ A ∈ F, ∀ B ∈ F, A ≠ B → (A.val ∩ B.val).card ≠ 257) :
22
+ F.card ≤ a₀ := by
23
+ let B : F → Finset (Fin 1028) := fun A => A.val.val
24
+ have hm (A : F) : Pi.single A (1 : ZMod 257) ∈ lowDegree B 256 := by
25
+ have hc : (1 : F → ZMod 257) ∈ lowDegree B 256 := by
26
+ simpa only [monomial_empty] using
27
+ monomial_mem (𝔽 := ZMod 257) B (s := ∅) (d := 256) (by simp)
28
+ have hp := sum_power_mem (𝔽 := ZMod 257) B (B A) 256
29
+ have hd := Submodule.sub_mem (lowDegree (𝔽 := ZMod 257) B 256) hc hp
30
+ convert hd using 1
31
+ ext C
32
+ simp only [Pi.single_apply,Pi.sub_apply,Pi.one_apply,Pi.pow_apply,sum_monomial_apply]
33
+ by_cases he : C=A
34
+ · subst C
35
+ have hcard : (B A).card=514 := A.val.property.1
36
+ simp [hcard,show (514 : ZMod 257)=0 by decide]
37
+ · have hne : A.val ≠ C.val := by intro hh; exact he (Subtype.ext hh.symm)
38
+ have hsets : B A ≠ B C := by intro hh; exact hne (Subtype.ext hh)
39
+ have hpos : 0 < (B A ∩ B C).card := Finset.card_pos.mpr ⟨0,
40
+ Finset.mem_inter.mpr ⟨A.val.property.2,C.val.property.2⟩⟩
41
+ have hle : (B A ∩ B C).card ≤ 514 := by
42
+ simpa only [show (B A).card=514 from A.val.property.1] using
43
+ Finset.card_le_card (Finset.inter_subset_left : B A ∩ B C ⊆ B A)
44
+ have hlt : (B A ∩ B C).card < 514 := by
45
+ by_contra hn
46
+ have ha : B A ∩ B C=B A := Finset.eq_of_subset_of_card_le
47
+ Finset.inter_subset_left (by rw [A.val.property.1]; omega)
48
+ have hb : B A ∩ B C=B C := Finset.eq_of_subset_of_card_le
49
+ Finset.inter_subset_right (by rw [C.val.property.1]; omega)
50
+ exact hsets (ha.symm.trans hb)
51
+ have hx : (B A ∩ B C).card ≠ 257 := h A.val A.property C.val C.property hne
52
+ have hnz : ((B A ∩ B C).card : ZMod 257) ≠ 0 := by
53
+ intro hz
54
+ have hdvd := (ZMod.natCast_eq_zero_iff (B A ∩ B C).card 257).mp hz
55
+ obtain ⟨t,ht⟩ := hdvd
56
+ omega
57
+ have hpw := ZMod.pow_card_sub_one_eq_one hnz
58
+ norm_num at hpw
59
+ simp only [he,ite_false,hpw,sub_self]
60
+ have hdim := interpolation_dimension_bound (𝔽 := ZMod 257) B 256 hm
61
+ simpa only [Fintype.card_coe,Fintype.card_fin,show 256+1=257 by rfl,a₀] using hdim
62
+
63
+ end FiniteConstruction
64
+
65
+ end
66
+
67
+ end OAI
lean/OAI/InformationTheory/Entanglement/ScalarGap.lean ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open MeasureTheory
7
+ open scoped BigOperators
8
+ namespace SecretKey
9
+ variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
10
+ lemma sqrt_memLp_two {p : Ω → ℝ} (hp : Integrable p μ) (hn : ∀ x, 0≤p x) :
11
+ MemLp (fun x => Real.sqrt (p x)) 2 μ := by
12
+ apply (memLp_two_iff_integrable_sq hp.1.aemeasurable.sqrt.aestronglyMeasurable).mpr
13
+ simpa only [Real.sq_sqrt (hn _)] using hp
14
+ lemma sqrt_product_integrable {p q : Ω → ℝ} (hp : Integrable p μ) (hq : Integrable q μ)
15
+ (hn : ∀ x, 0≤p x) (hm : ∀ x, 0≤q x) : Integrable (fun x => Real.sqrt (p x*q x)) μ := by
16
+ have hi := (sqrt_memLp_two hp hn).integrable_mul (sqrt_memLp_two hq hm)
17
+ simpa only [Pi.mul_def,Real.sqrt_mul (hn _)] using hi
18
+ lemma integral_sqrt_product_le {p q : Ω → ℝ} (hp : Integrable p μ) (hq : Integrable q μ)
19
+ (hn : ∀ x, 0≤p x) (hm : ∀ x, 0≤q x) :
20
+ (∫ x, Real.sqrt (p x*q x) ∂μ) ≤ Real.sqrt ((∫ x, p x ∂μ)*(∫ x, q x ∂μ)) := by
21
+ have hh : (2 : ℝ).HolderConjugate 2 := by norm_num [Real.holderConjugate_iff]
22
+ have h := integral_mul_le_Lp_mul_Lq_of_nonneg hh
23
+ (f := fun x => Real.sqrt (p x)) (g := fun x => Real.sqrt (q x))
24
+ (Filter.Eventually.of_forall fun _ => Real.sqrt_nonneg _)
25
+ (Filter.Eventually.of_forall fun _ => Real.sqrt_nonneg _)
26
+ (by simpa using sqrt_memLp_two hp hn) (by simpa using sqrt_memLp_two hq hm)
27
+ simpa only [Real.rpow_two,Real.sq_sqrt (hn _),Real.sq_sqrt (hm _),
28
+ ← Real.sqrt_eq_rpow,Real.sqrt_mul (hn _),
29
+ Real.sqrt_mul (integral_nonneg hn)] using h
30
+
31
+ lemma two_sqrt_products_le {a b c d : ℝ} (ha : 0≤a) (hb : 0≤b) (hc : 0≤c) (hd : 0≤d) :
32
+ Real.sqrt (a*b)+Real.sqrt (c*d) ≤ Real.sqrt ((a+d)*(b+c)) := by
33
+ have h := Real.sum_sqrt_mul_sqrt_le (Finset.univ : Finset (Fin 2))
34
+ (f := ![a,d]) (g := ![b,c]) (by intro i; fin_cases i <;> assumption)
35
+ (by intro i; fin_cases i <;> assumption)
36
+ simpa only [Fin.sum_univ_two,Matrix.cons_val_zero,Matrix.cons_val_one,
37
+ Matrix.cons_val_fin_one,← Real.sqrt_mul ha,← Real.sqrt_mul hd,
38
+ ← Real.sqrt_mul (add_nonneg ha hd),mul_comm d c] using h
39
+ lemma two_sqrt_le_add {a b : ℝ} (ha : 0≤a) (hb : 0≤b) : 2*Real.sqrt (a*b)≤a+b := by
40
+ have hs := Real.sq_sqrt (mul_nonneg ha hb)
41
+ have hn := Real.sqrt_nonneg (a*b)
42
+ nlinarith [sq_nonneg (a-b)]
43
+
44
+ theorem scalar_secret_bit_gap {a b c d q η : ℝ}
45
+ (ha : 0≤a) (hb : 0≤b) (hc : 0≤c) (hd : 0≤d)
46
+ (hs : a+b+c+d=1) (he : b+c≤η/2) (hq : q≤η-(b+c))
47
+ (hf : (a+d-q)/2≤Real.sqrt (a*b)+Real.sqrt (c*d)+2*Real.sqrt (b*c)) :
48
+ 1/5≤η := by
49
+ have hu := add_le_add (two_sqrt_products_le ha hb hc hd) (two_sqrt_le_add hb hc)
50
+ have hlow : (1-η)/2≤Real.sqrt ((b+c)*(1-(b+c)))+(b+c) := by
51
+ have hx : (a+d)*(b+c)=(b+c)*(1-(b+c)) := by nlinarith [hs]
52
+ rw [hx] at hu
53
+ linarith
54
+ by_contra hh
55
+ have heta : η<1/5 := lt_of_not_ge hh
56
+ have en : 0≤b+c := add_nonneg hb hc
57
+ have eb : b+c<1/10 := by linarith
58
+ have eone : 0≤1-(b+c) := by linarith
59
+ have hr := Real.sq_sqrt (mul_nonneg en eone)
60
+ have sr := Real.sqrt_nonneg ((b+c)*(1-(b+c)))
61
+ have hprod : (b+c)*(1-(b+c))≤9/100 := by
62
+ nlinarith [mul_nonneg en (by linarith : 0≤1/10-(b+c))]
63
+ have hsqrt : Real.sqrt ((b+c)*(1-(b+c)))≤3/10 := by nlinarith
64
+ linarith
65
+ end SecretKey
66
+
67
+ end
68
+
69
+ end OAI
lean/OAI/InformationTheory/Entanglement/SecretDefinitions.lean ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.Analysis.Quantum.PPTSquare.ChannelModel
2
+ import OAI.Analysis.Quantum.PPTSquare.Compression
3
+ import OAI.Analysis.Quantum.PPTSquare.TensorModel
4
+ import OAI.Analysis.Quantum.PPTSquare.TensorPositivity
5
+ import OAI.Analysis.Quantum.PPTSquare.SymmetricVectors
6
+ import OAI.Analysis.Quantum.PPTSquare.QuadraticCriterion
7
+
8
+ namespace OAI
9
+
10
+ noncomputable section
11
+ open scoped BigOperators ComplexOrder Kronecker MatrixOrder
12
+ open Matrix
13
+ namespace SecretKey
14
+ open ChannelCompletion TensorCriterion
15
+ variable {n m : Type} [Fintype n] [Fintype m]
16
+
17
+ noncomputable def traceNorm (A : Matrix n m ℂ) : ℝ := by
18
+ classical
19
+ exact (Matrix.trace (CFC.sqrt (Aᴴ * A))).re
20
+
21
+ def Represented (R : Mat (n × m)) : Prop :=
22
+ R.PosSemidef ∧ Matrix.trace R = 1 ∧
23
+ ∃ r s : ℕ, 0 < r ∧ 0 < s ∧
24
+ ∃ (L : Map (Fin r) n) (M : Map (Fin s) m) (χ : Fin r × Fin s → ℂ),
25
+ CP L ∧ CP (L.comp transposeMap) ∧ CP M ∧ CP (M.comp transposeMap) ∧
26
+ R = tensorMap L M (Matrix.vecMulVec χ (star χ))
27
+
28
+ end SecretKey
29
+
30
+ end
31
+
32
+ end OAI
lean/OAI/InformationTheory/Entanglement/SequentialSampling.lean ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.IndependentTapes
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open MeasureTheory ProbabilityTheory Filter Function
7
+ open scoped MeasureTheory ProbabilityTheory unitInterval
8
+ namespace SecretKey
9
+ variable {Ω S X : Type*} [MeasurableSpace Ω] [MeasurableSpace S]
10
+ [MeasurableSpace X]
11
+ variable {μ : Measure Ω} [IsProbabilityMeasure μ]
12
+
13
+ theorem sampled_pair_law (H : Ω → S) (U : Ω → I)
14
+ (hH : Measurable H) (hU : Measurable U) (hind : IndepFun H U μ)
15
+ (hUlaw : μ.map U=volume) (κ : Kernel S X) [IsMarkovKernel κ]
16
+ (f : S → I → X) (hf : Measurable (uncurry f))
17
+ (hmap : ∀ s, volume.map (f s)=κ s) :
18
+ μ.map (fun ω => (H ω,f (H ω) (U ω)))=μ.map H ⊗ₘ κ := by
19
+ let g : S×I → S×X := fun p => (p.1,f p.1 p.2)
20
+ have hg : Measurable g := measurable_fst.prodMk hf
21
+ have he : μ.map (fun ω => (H ω,f (H ω) (U ω)))=
22
+ ((μ.map H).prod volume).map g := by
23
+ rw [← hUlaw,← hind.map_prod_eq_prod_map_map hH.aemeasurable hU.aemeasurable,
24
+ Measure.map_map hg (hH.prodMk hU)]
25
+ rfl
26
+ rw [he]
27
+ ext E hE
28
+ rw [Measure.map_apply hg hE,Measure.prod_apply (hg hE),Measure.compProd_apply hE]
29
+ apply lintegral_congr
30
+ intro s
31
+ have hm : Measurable (f s) := hf.comp (measurable_const.prodMk measurable_id)
32
+ rw [← hmap s,Measure.map_apply hm (measurable_prodMk_left hE)]
33
+ rfl
34
+
35
+ variable (f : (k : ℕ) → (Fin k → X) → I → X)
36
+
37
+ def sampledPrefix : (k : ℕ) → UniformTapes ℕ → (Fin k → X)
38
+ | 0,_ => Fin.elim0
39
+ | k+1,ω => Fin.snoc (sampledPrefix k ω) (f k (sampledPrefix k ω) (ω k))
40
+ def sampledHistory (ω : UniformTapes ℕ) (k : ℕ) : X :=
41
+ f k (sampledPrefix f k ω) (ω k)
42
+ omit [MeasurableSpace X] in
43
+ lemma sampledPrefix_succ (k : ℕ) (ω : UniformTapes ℕ) :
44
+ sampledPrefix f (k+1) ω=Fin.snoc (sampledPrefix f k ω) (sampledHistory f ω k) := rfl
45
+ omit [MeasurableSpace X] in
46
+ lemma sampledPrefix_eq (k : ℕ) (ω : UniformTapes ℕ) (i : Fin k) :
47
+ sampledPrefix f k ω i=sampledHistory f ω i := by
48
+ induction k with
49
+ | zero => exact Fin.elim0 i
50
+ | succ k ih =>
51
+ refine Fin.lastCases ?_ (fun j => ?_) i
52
+ · simp only [sampledPrefix_succ,Fin.snoc_last,Fin.val_last]
53
+ · simpa only [sampledPrefix_succ,Fin.snoc_castSucc,Fin.val_castSucc] using ih j
54
+
55
+ lemma measurable_tape_coordinate (s : Set ℕ) (k : ℕ) (hk : k∈s) :
56
+ Measurable[tapeInformation s] (fun ω : UniformTapes ℕ => ω k) := by
57
+ rw [measurable_iff_comap_le]
58
+ exact le_iSup_of_le k (le_iSup_of_le hk le_rfl)
59
+ lemma sampledPrefix_measurable (hf : ∀ k, Measurable (uncurry (f k))) (k : ℕ) :
60
+ Measurable[tapeInformation (Set.Iio k)] (sampledPrefix f k) := by
61
+ induction k with
62
+ | zero =>
63
+ let : MeasurableSpace (UniformTapes ℕ) := tapeInformation (Set.Iio 0)
64
+ apply Measurable.of_eval; intro i; exact Fin.elim0 i
65
+ | succ k ih =>
66
+ let : MeasurableSpace (UniformTapes ℕ) := tapeInformation (Set.Iio (k+1))
67
+ have hp : Measurable[tapeInformation (Set.Iio (k+1))] (sampledPrefix f k) :=
68
+ ih.mono (tapeInformation_mono (fun _ h => Nat.lt_trans h (Nat.lt_succ_self k))) le_rfl
69
+ have hu := measurable_tape_coordinate (Set.Iio (k+1)) k (Nat.lt_succ_self k)
70
+ apply Measurable.of_eval
71
+ intro i
72
+ refine Fin.lastCases ?_ (fun j => ?_) i
73
+ · simpa only [sampledPrefix_succ,sampledHistory,Fin.snoc_last,Function.comp_def,Function.uncurry] using (hf k).comp (hp.prodMk hu)
74
+ · simpa only [sampledPrefix_succ,Fin.snoc_castSucc,Function.comp_def] using (measurable_pi_apply j).comp hp
75
+ lemma sampledPrefix_measurable_global (hf : ∀ k, Measurable (uncurry (f k))) (k : ℕ) :
76
+ Measurable (sampledPrefix f k) :=
77
+ (sampledPrefix_measurable f hf k).mono (tapeInformation_le _) le_rfl
78
+ lemma sampledHistory_measurable (hf : ∀ k, Measurable (uncurry (f k))) :
79
+ Measurable (sampledHistory f) := by
80
+ apply Measurable.of_eval
81
+ intro k
82
+ exact (hf k).comp ((sampledPrefix_measurable_global f hf k).prodMk (measurable_pi_apply k))
83
+
84
+ theorem sampled_history_step (hf : ∀ k, Measurable (uncurry (f k)))
85
+ (κ : (k : ℕ) → Kernel (Fin k → X) X) [∀ k, IsMarkovKernel (κ k)]
86
+ (hmap : ∀ k s, volume.map (f k s)=κ k s) (k : ℕ) :
87
+ uniformTapesLaw.map (fun ω => (sampledPrefix f k ω,sampledHistory f ω k))=
88
+ uniformTapesLaw.map (sampledPrefix f k) ⊗ₘ κ k := by
89
+ apply sampled_pair_law _ _ (sampledPrefix_measurable_global f hf k)
90
+ (measurable_pi_apply k) _ (tape_coordinate_law k) (κ k) (f k) (hf k) (hmap k)
91
+ exact fresh_coordinate_independent (by simp only [Set.mem_Iio]; exact lt_irrefl k) _
92
+ (sampledPrefix_measurable f hf k)
93
+
94
+ end SecretKey
95
+
96
+ namespace SecretKey
97
+ open MeasureTheory ProbabilityTheory Function
98
+ open scoped MeasureTheory ProbabilityTheory unitInterval
99
+ variable {X : Type*} [MeasurableSpace X]
100
+ def recordPrefix (k : ℕ) (x : ℕ → X) : Fin k → X := fun i => x i
101
+ lemma recordPrefix_measurable (k : ℕ) : Measurable (recordPrefix (X := X) k) := by
102
+ apply Measurable.of_eval; intro i; exact measurable_pi_apply i.val
103
+ lemma snoc_measurable (k : ℕ) :
104
+ Measurable (fun p : (Fin k → X)×X => Fin.snoc (α := fun _ : Fin (k+1) => X) p.1 p.2) := by
105
+ apply Measurable.of_eval
106
+ intro i
107
+ refine Fin.lastCases ?_ (fun j => ?_) i
108
+ · simpa only [Fin.snoc_last] using measurable_snd
109
+ · simpa only [Fin.snoc_castSucc,Function.comp_def] using (measurable_pi_apply j).comp measurable_fst
110
+ omit [MeasurableSpace X] in
111
+ lemma recordPrefix_succ (k : ℕ) (x : ℕ → X) :
112
+ recordPrefix (k+1) x=Fin.snoc (recordPrefix k x) (x k) := by
113
+ funext i
114
+ refine Fin.lastCases ?_ (fun j => ?_) i <;> simp [recordPrefix]
115
+
116
+ theorem full_history_law_unique (ν ξ : Measure (ℕ → X)) [IsFiniteMeasure ν]
117
+ (h : ∀ k, ν.map (recordPrefix k)=ξ.map (recordPrefix k)) : ν=ξ := by
118
+ let P := fun J : Finset ℕ => ν.map J.restrict
119
+ have hν : IsProjectiveLimit ν P := fun J => rfl
120
+ have hξ : IsProjectiveLimit ξ P := by
121
+ intro J
122
+ let k := J.sup id+1
123
+ have hb (i : J) : i.val<k := Nat.lt_succ_of_le (Finset.le_sup (f := id) i.property)
124
+ let g : (Fin k → X) → (J → X) := fun x i => x ⟨i.val,hb i⟩
125
+ have hg : Measurable g := by fun_prop
126
+ have he : J.restrict=(g ∘ recordPrefix k : (ℕ → X) → (J → X)) := rfl
127
+ change ξ.map J.restrict=ν.map J.restrict
128
+ rw [he,← Measure.map_map hg (recordPrefix_measurable k),
129
+ ← Measure.map_map hg (recordPrefix_measurable k),h k]
130
+ exact hν.unique hξ
131
+
132
+ theorem sampled_full_history_law
133
+ (f : (k : ℕ) → (Fin k → X) → I → X)
134
+ (hf : ∀ k, Measurable (uncurry (f k)))
135
+ (κ : (k : ℕ) → Kernel (Fin k → X) X) [∀ k, IsMarkovKernel (κ k)]
136
+ (hmap : ∀ k s, volume.map (f k s)=κ k s)
137
+ (ν : Measure (ℕ → X)) [IsProbabilityMeasure ν]
138
+ (hν : ∀ k, ν.map (fun x => (recordPrefix k x,x k))=ν.map (recordPrefix k) ⊗ₘ κ k) :
139
+ ν=uniformTapesLaw.map (sampledHistory f) := by
140
+ have hp : ∀ k, ν.map (recordPrefix k)=uniformTapesLaw.map (sampledPrefix f k) := by
141
+ intro k
142
+ induction k with
143
+ | zero =>
144
+ have he : recordPrefix (X := X) 0=(fun _ : ℕ → X => (Fin.elim0 : Fin 0 → X)) := by
145
+ funext x i; exact Fin.elim0 i
146
+ have hf0 : sampledPrefix f 0=(fun _ : UniformTapes ℕ => (Fin.elim0 : Fin 0 → X)) := rfl
147
+ rw [he,hf0,Measure.map_const,Measure.map_const]
148
+ simp
149
+ | succ k ih =>
150
+ have he : recordPrefix (X := X) (k+1)=
151
+ (fun p : (Fin k → X)×X => Fin.snoc (α := fun _ : Fin (k+1) => X) p.1 p.2) ∘ (fun x => (recordPrefix k x,x k)) := by
152
+ funext x; exact recordPrefix_succ k x
153
+ have hx : Measurable (fun ω : UniformTapes ℕ => sampledHistory f ω k) := by
154
+ simpa only [Function.comp_def] using
155
+ (measurable_pi_apply k).comp (sampledHistory_measurable f hf)
156
+ rw [he,← Measure.map_map (snoc_measurable k)
157
+ ((recordPrefix_measurable k).prodMk (measurable_pi_apply k)),hν k,ih,
158
+ ← sampled_history_step f hf κ hmap k,Measure.map_map (snoc_measurable k)
159
+ ((sampledPrefix_measurable_global f hf k).prodMk hx)]
160
+ rfl
161
+ apply full_history_law_unique
162
+ intro k
163
+ rw [Measure.map_map (recordPrefix_measurable k) (sampledHistory_measurable f hf),hp k]
164
+ congr 1
165
+ funext ω i
166
+ exact sampledPrefix_eq f k ω i
167
+
168
+ end SecretKey
169
+
170
+ end
171
+
172
+ end OAI
lean/OAI/InformationTheory/Entanglement/SparseSeparable.lean ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.Analysis.Quantum.PPTSquare.ChannelModel
2
+ import OAI.Analysis.Quantum.PPTSquare.Compression
3
+ import OAI.Analysis.Quantum.PPTSquare.TensorModel
4
+ import OAI.Analysis.Quantum.PPTSquare.TensorPositivity
5
+ import OAI.Analysis.Quantum.PPTSquare.SymmetricVectors
6
+ import OAI.Analysis.Quantum.PPTSquare.QuadraticCriterion
7
+
8
+ namespace OAI
9
+
10
+ noncomputable section
11
+ open scoped BigOperators ComplexOrder MatrixOrder Kronecker
12
+ open Matrix
13
+ namespace ProjectionCriterion
14
+ open ChannelCompletion TensorCriterion
15
+ variable {n m r : Type} [Fintype n] [Fintype m] [Fintype r]
16
+
17
+ omit [Fintype n] in
18
+ lemma projector_col_sum (A : Matrix n m ℂ) :
19
+ (∑ j, projector (fun i => A i j)) = A*Aᴴ := by
20
+ ext i k
21
+ simp only [Matrix.sum_apply,projector,Matrix.vecMulVec_apply,Pi.star_apply,
22
+ Matrix.mul_apply,Matrix.conjTranspose_apply]
23
+
24
+ lemma separable_rankone {C : Mat (n × m)} [DecidableEq n] [DecidableEq m]
25
+ (hC : Separable C) :
26
+ ∃ (t : ℕ) (x : Fin t × (n × m) → n → ℂ) (y : Fin t × (n × m) → m → ℂ),
27
+ C = ∑ k, projector (product (x k) (y k)) := by
28
+ obtain ⟨t,A,B,hA,hB,rfl⟩ := hC
29
+ let x : Fin t × (n × m) → n → ℂ := fun k i => CFC.sqrt (A k.1) i k.2.1
30
+ let y : Fin t × (n × m) → m → ℂ := fun k i => CFC.sqrt (B k.1) i k.2.2
31
+ refine ⟨t,x,y,?_⟩
32
+ rw [Fintype.sum_prod_type]
33
+ apply Finset.sum_congr rfl
34
+ intro k _
35
+ simp only [Fintype.sum_prod_type,x,y,projector_product]
36
+ have ha : (∑ j, projector (fun i => CFC.sqrt (A k) i j)) = A k :=
37
+ (projector_col_sum _).trans (sqrt_mul_conjTranspose _ (hA k))
38
+ have hb : (∑ j, projector (fun i => CFC.sqrt (B k) i j)) = B k :=
39
+ (projector_col_sum _).trans (sqrt_mul_conjTranspose _ (hB k))
40
+ calc
41
+ A k ⊗ₖ B k = (∑ j, projector (fun i => CFC.sqrt (A k) i j)) ⊗ₖ
42
+ (∑ j, projector (fun i => CFC.sqrt (B k) i j)) := by rw [ha,hb]
43
+ _ = _ := by
44
+ ext ⟨a,c⟩ ⟨b,d⟩
45
+ simp only [Matrix.kroneckerMap_apply,Matrix.sum_apply,Finset.sum_mul,Finset.mul_sum]
46
+ rw [Finset.sum_comm]
47
+
48
+ omit [Fintype n] in
49
+ lemma norm_sq_sum_le_card (s : Finset n) (z : n → ℂ) :
50
+ ‖∑ i ∈ s, z i‖^2 ≤ (s.card : ℝ) * ∑ i ∈ s, ‖z i‖^2 := by
51
+ have h := Finset.sum_mul_sq_le_sq_mul_sq s (fun _ => (1 : ℝ)) (fun i => ‖z i‖)
52
+ simp only [one_mul,one_pow,Finset.sum_const,mul_one,nsmul_eq_mul] at h
53
+ have hn := norm_sum_le s z
54
+ have hx : 0 ≤ ∑ i ∈ s, ‖z i‖ := Finset.sum_nonneg (fun _ _ => norm_nonneg _)
55
+ nlinarith [norm_nonneg (∑ i ∈ s, z i)]
56
+
57
+ lemma norm_sq_sparse_sum [DecidableEq n] (z : n → ℂ) (κ : ℝ)
58
+ (h : ((Finset.univ.filter (fun i => z i ≠ 0)).card : ℝ) ≤ κ) :
59
+ ‖∑ i, z i‖^2 ≤ κ * ∑ i, ‖z i‖^2 := by
60
+ let S := Finset.univ.filter (fun i => z i ≠ 0)
61
+ have hsum : ∑ i ∈ S, z i = ∑ i, z i := by
62
+ apply Finset.sum_subset (Finset.filter_subset _ _)
63
+ intro i _ hi
64
+ simpa [S] using hi
65
+ have hsq : ∑ i ∈ S, ‖z i‖^2 = ∑ i, ‖z i‖^2 := by
66
+ apply Finset.sum_subset (Finset.filter_subset _ _)
67
+ intro i _ hi
68
+ have hz : z i=0 := by simpa [S] using hi
69
+ simp [hz]
70
+ have hc := norm_sq_sum_le_card S z
71
+ rw [hsum,hsq] at hc
72
+ exact hc.trans (mul_le_mul_of_nonneg_right h (Finset.sum_nonneg (fun i _ => sq_nonneg _)))
73
+
74
+ lemma mul_star_re (z : ℂ) : (z * star z).re = ‖z‖^2 := by
75
+ rw [Complex.star_def,Complex.mul_conj,Complex.ofReal_re,Complex.normSq_eq_norm_sq]
76
+
77
+ omit [Fintype n] in
78
+ lemma projector_diagonal (z : n → ℂ) (i : n) : (projector z i i).re = ‖z i‖^2 :=
79
+ mul_star_re _
80
+ lemma projector_all_sum (z : n → ℂ) :
81
+ (∑ i, ∑ j, projector z i j).re = ‖∑ i, z i‖^2 := by
82
+ simp only [projector,Matrix.vecMulVec_apply,Pi.star_apply]
83
+ simp_rw [← Finset.mul_sum]
84
+ rw [← Finset.sum_mul,← star_sum]
85
+ exact mul_star_re _
86
+
87
+ def compressionSum (C : Mat (n × n)) : ℝ := (∑ i, ∑ j, C (i,i) (j,j)).re
88
+ def compressionTrace (C : Mat (n × n)) : ℝ := (∑ i, C (i,i) (i,i)).re
89
+
90
+ theorem separable_compression_bound [DecidableEq n] {C : Mat (n × n)}
91
+ (hC : Separable C) (κ : ℝ)
92
+ (hclique : ∀ J : Finset n,
93
+ (∀ i ∈ J, ∀ j ∈ J, i ≠ j → 0 < (C (i,j) (i,j)).re) → (J.card : ℝ) ≤ κ) :
94
+ compressionSum C ≤ κ * compressionTrace C := by
95
+ obtain ⟨t,x,y,hC⟩ := separable_rankone hC
96
+ let z := fun k i => x k i * y k i
97
+ have hd (i j : n) : (C (i,j) (i,j)).re = ∑ k, ‖x k i * y k j‖^2 := by
98
+ rw [hC]
99
+ simp only [Matrix.sum_apply,Complex.re_sum,projector_diagonal,product]
100
+ have hsupport (k : Fin t × (n × n)) :
101
+ ((Finset.univ.filter (fun i => z k i ≠ 0)).card : ℝ) ≤ κ := by
102
+ apply hclique
103
+ intro i hi j hj _
104
+ have hi' : x k i ≠ 0 := (mul_ne_zero_iff.mp (Finset.mem_filter.mp hi).2).1
105
+ have hj' : y k j ≠ 0 := (mul_ne_zero_iff.mp (Finset.mem_filter.mp hj).2).2
106
+ rw [hd]
107
+ have hle : ‖x k i*y k j‖^2 ≤ ∑ k', ‖x k' i*y k' j‖^2 :=
108
+ Finset.single_le_sum (fun k' _ => sq_nonneg ‖x k' i*y k' j‖) (Finset.mem_univ k)
109
+ exact (sq_pos_of_pos (norm_pos_iff.mpr (mul_ne_zero hi' hj'))).trans_le hle
110
+ have hs : compressionSum C = ∑ k, ‖∑ i, z k i‖^2 := by
111
+ rw [hC]
112
+ simp only [compressionSum,Matrix.sum_apply,Complex.re_sum]
113
+ conv_lhs => arg 2; ext i; rw [Finset.sum_comm]
114
+ rw [Finset.sum_comm]
115
+ apply Finset.sum_congr rfl
116
+ intro k _
117
+ have he (i j : n) : projector (product (x k) (y k)) (i,i) (j,j) = projector (z k) i j := rfl
118
+ simp only [he,← Complex.re_sum,projector_all_sum]
119
+ have ht : compressionTrace C = ∑ k, ∑ i, ‖z k i‖^2 := by
120
+ rw [hC]
121
+ simp only [compressionTrace,Matrix.sum_apply,Complex.re_sum,projector_diagonal,product,z]
122
+ rw [Finset.sum_comm]
123
+ rw [hs,ht,Finset.mul_sum]
124
+ exact Finset.sum_le_sum (fun k _ => norm_sq_sparse_sum (z k) κ (hsupport k))
125
+ end ProjectionCriterion
126
+
127
+ end
128
+
129
+ end OAI
lean/OAI/InformationTheory/Entanglement/SpectralCut.lean ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import OAI.InformationTheory.Entanglement.EffectNormalization
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open scoped BigOperators ComplexOrder MatrixOrder
7
+ open Matrix
8
+ namespace SecretKey
9
+ variable {n : Type} [Fintype n] [DecidableEq n]
10
+
11
+ lemma unitary_conjugate_mul {U : Matrix n n ℂ} (hU : Uᴴ*U=1) (A B : Matrix n n ℂ) :
12
+ (Uᴴ*A*U)*(Uᴴ*B*U)=Uᴴ*(A*B)*U := by
13
+ have hU' := unitary_reverse hU
14
+ simp only [Matrix.mul_assoc]
15
+ rw [← Matrix.mul_assoc U Uᴴ, hU',Matrix.one_mul]
16
+
17
+ lemma unitary_conjugate_cancel {U : Matrix n n ℂ} (hU : Uᴴ*U=1) (A : Matrix n n ℂ) :
18
+ U*(Uᴴ*A*U)*Uᴴ=A := by
19
+ calc
20
+ U*(Uᴴ*A*U)*Uᴴ=(U*Uᴴ)*A*(U*Uᴴ) := by simp only [Matrix.mul_assoc]
21
+ _ = A := by rw [unitary_reverse hU,Matrix.one_mul,Matrix.mul_one]
22
+
23
+ lemma unitary_conjugate_restore {U : Matrix n n ℂ} (hU : Uᴴ*U=1) (A : Matrix n n ℂ) :
24
+ Uᴴ*(U*A*Uᴴ)*U=A := by
25
+ calc
26
+ Uᴴ*(U*A*Uᴴ)*U=(Uᴴ*U)*A*(Uᴴ*U) := by simp only [Matrix.mul_assoc]
27
+ _ = A := by rw [hU,Matrix.one_mul,Matrix.mul_one]
28
+
29
+ lemma spectral_cut {A B : Matrix n n ℂ} (hA : A.IsHermitian) (hB : B.IsHermitian)
30
+ (hAB : Commute A B) :
31
+ ∃ P : Matrix n n ℂ, Pᴴ=P ∧ P*P=P ∧ Commute P A ∧ Commute P B ∧
32
+ (P*(A-B)*P).PosSemidef ∧ ((1-P)*(B-A)*(1-P)).PosSemidef := by
33
+ let C := A-B
34
+ have hC : C.IsHermitian := hA.sub hB
35
+ obtain ⟨U,hU,hdiag⟩ := unitary_spectral hC
36
+ have hU' := unitary_reverse hU
37
+ let eig := hC.eigenvalues
38
+ let a := Uᴴ*A*U
39
+ let b := Uᴴ*B*U
40
+ let D : Matrix n n ℂ := diagonal (fun i => (eig i : ℂ))
41
+ change Uᴴ*C*U=D at hdiag
42
+ have hab : a-b=D := by
43
+ rw [← hdiag]
44
+ simp [a,b,C,Matrix.mul_sub,Matrix.sub_mul]
45
+ have hCA : C*A=A*C := by
46
+ dsimp [C]
47
+ rw [Matrix.sub_mul,Matrix.mul_sub,hAB.eq]
48
+ have hDa : D*a=a*D := by
49
+ rw [← hab]
50
+ change (Uᴴ*A*U-Uᴴ*B*U)*(Uᴴ*A*U)=(Uᴴ*A*U)*(Uᴴ*A*U-Uᴴ*B*U)
51
+ rw [← Matrix.sub_mul,← Matrix.mul_sub]
52
+ rw [unitary_conjugate_mul hU,unitary_conjugate_mul hU,hCA]
53
+ let q : n → ℂ := fun i => if 0 ≤ eig i then 1 else 0
54
+ let Q : Matrix n n ℂ := diagonal q
55
+ have hQ : Qᴴ=Q := by simp [Q,q,Matrix.diagonal_conjTranspose]
56
+ have hQQ : Q*Q=Q := by
57
+ rw [Matrix.diagonal_mul_diagonal]
58
+ congr 1
59
+ funext i
60
+ simp [q]
61
+ have hezero (i j : n) (hne : (0 ≤ eig i) ≠ (0 ≤ eig j)) : a i j=0 := by
62
+ have he := congrArg (fun M => M i j) hDa
63
+ simp only [D,Matrix.diagonal_mul,Matrix.mul_diagonal] at he
64
+ have hz : ((eig i : ℂ) - eig j)*a i j=0 := by linear_combination he
65
+ apply (mul_eq_zero.mp hz).resolve_left
66
+ intro hij
67
+ apply hne
68
+ have hh : eig i=eig j := Complex.ofReal_injective (sub_eq_zero.mp hij)
69
+ rw [hh]
70
+ have hQa : Q*a=a*Q := by
71
+ ext i j
72
+ simp only [Q,Matrix.diagonal_mul,Matrix.mul_diagonal,q]
73
+ split_ifs with hi hj hj
74
+ · simp
75
+ · rw [hezero i j (by simp [hi,hj])]; simp
76
+ · rw [hezero i j (by simp [hi,hj])]; simp
77
+ · simp
78
+ have hQb : Q*b=b*Q := by
79
+ have hb : b=a-D := by rw [← hab]; abel
80
+ rw [hb,Matrix.mul_sub,Matrix.sub_mul,hQa]
81
+ congr 1
82
+ simp [Q,D,Matrix.diagonal_mul_diagonal,mul_comm]
83
+ let P := U*Q*Uᴴ
84
+ have hP : Pᴴ=P := by simp [P,Matrix.conjTranspose_mul,hQ,Matrix.mul_assoc]
85
+ have hP' : Uᴴ*P*U=Q := by
86
+ dsimp [P]
87
+ simp only [← Matrix.mul_assoc,hU,Matrix.one_mul]
88
+ rw [Matrix.mul_assoc,hU,Matrix.mul_one]
89
+ have hstrong (E F : Matrix n n ℂ) (he : Uᴴ*E*U=Uᴴ*F*U) : E=F := by
90
+ have hh := congrArg (fun M => U*M*Uᴴ) he
91
+ simpa only [unitary_conjugate_cancel hU] using hh
92
+ have hPP : P*P=P := by
93
+ apply hstrong
94
+ rw [← unitary_conjugate_mul hU P P,hP',hQQ]
95
+ have hPA : Commute P A := by
96
+ change P*A=A*P
97
+ apply hstrong
98
+ rw [← unitary_conjugate_mul hU P A,← unitary_conjugate_mul hU A P,hP']
99
+ exact hQa
100
+ have hPB : Commute P B := by
101
+ change P*B=B*P
102
+ apply hstrong
103
+ rw [← unitary_conjugate_mul hU P B,← unitary_conjugate_mul hU B P,hP']
104
+ exact hQb
105
+ have hRe : Uᴴ*(1-P)*U=1-Q := by
106
+ rw [Matrix.mul_sub,Matrix.sub_mul,Matrix.mul_one,hU,hP']
107
+ have hpos : (Q*D*Q).PosSemidef := by
108
+ simp only [Q,D,Matrix.diagonal_mul_diagonal]
109
+ apply Matrix.PosSemidef.diagonal
110
+ intro i
111
+ dsimp [q]
112
+ split_ifs with hi
113
+ · simpa using (show (0:ℂ) ≤ eig i from Complex.nonneg_iff.mpr ⟨hi,by simp⟩)
114
+ · simp
115
+ have hneg : ((1-Q)*(-D)*(1-Q)).PosSemidef := by
116
+ have h1 : (1 : Matrix n n ℂ)=diagonal (fun _ => 1) := Matrix.diagonal_one.symm
117
+ simp only [h1,Q,D,Matrix.diagonal_sub,Matrix.diagonal_neg,
118
+ Matrix.diagonal_mul_diagonal,Matrix.diagonal_mul_diagonal]
119
+ apply Matrix.PosSemidef.diagonal
120
+ intro i
121
+ dsimp [q]
122
+ split_ifs with hi
123
+ · simp
124
+ · simpa using (show (0:ℂ) ≤ -(eig i:ℂ) from Complex.nonneg_iff.mpr ⟨by simpa using le_of_lt (neg_pos.mpr (lt_of_not_ge hi)),by simp⟩)
125
+ refine ⟨P,hP,hPP,hPA,hPB,?_,?_⟩
126
+ · have hh := hpos.mul_mul_conjTranspose_same U
127
+ convert hh using 1
128
+ apply hstrong
129
+ rw [← unitary_conjugate_mul hU (P*C) P,← unitary_conjugate_mul hU P C,hP',hdiag,unitary_conjugate_restore hU]
130
+ · have hh := hneg.mul_mul_conjTranspose_same U
131
+ convert hh using 1
132
+ apply hstrong
133
+ have hd : Uᴴ*(B-A)*U = -D := by rw [show B-A= -C from by dsimp [C]; abel, Matrix.mul_neg,Matrix.neg_mul,hdiag]
134
+ rw [← unitary_conjugate_mul hU ((1-P)*(B-A)) (1-P),← unitary_conjugate_mul hU (1-P) (B-A),hRe,hd,unitary_conjugate_restore hU]
135
+ end SecretKey
136
+
137
+ end
138
+
139
+ end OAI