Download data/lean/OAI/Probability/EntangledGames/SamplingStrategy.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 22.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/EntangledGames/SamplingStrategy.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/EntangledGames/SamplingStrategy.lean
-
curl -L -o SamplingStrategy.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/EntangledGames/SamplingStrategy.lean
22.6 kB
| import OAI.Probability.EntangledGames.CoherentFilters | |
| namespace OAI | |
| universe u_n u_A u_m u_ΞΉ u_p u_q u_B | |
| open scoped BigOperators ComplexOrder | |
| open scoped MatrixOrder | |
| open Matrix | |
| open MeasureTheory Filter Set | |
| open scoped Topology | |
| open scoped Matrix.Norms.Elementwise | |
| open scoped Interval | |
| open scoped Kronecker | |
| noncomputable section | |
| namespace ThresholdParallelRepetition.QuantumSampling | |
| structure POVM (n : Type u_n) (A : Type u_A) [Fintype n] [DecidableEq n] [Fintype A] where | |
| effect : A β Matrix n n β | |
| pos : β a, (effect a).PosSemidef | |
| total : β a, effect a = 1 | |
| variable {m : Type u_m} {n : Type u_n} {A : Type u_A} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] | |
| [Fintype A] | |
| def POVM.default (aβ : A) : POVM n A := by | |
| classical | |
| exact { effect := fun a => if a = aβ then 1 else 0 | |
| pos := fun a => by split <;> first | exact Matrix.PosSemidef.one | exact Matrix.PosSemidef.zero | |
| total := by simp } | |
| def POVM.pull (P : POVM m A) (K : Matrix m n β) (a : A) : Matrix n n β := | |
| Kα΄΄ * P.effect a * K | |
| omit [DecidableEq n] in | |
| lemma POVM.pull_pos (P : POVM m A) (K : Matrix m n β) (a : A) : | |
| (P.pull K a).PosSemidef := (P.pos a).conjTranspose_mul_mul_same K | |
| omit [Fintype n] [DecidableEq n] in | |
| lemma POVM.pull_sum (P : POVM m A) (K : Matrix m n β) : | |
| β a, P.pull K a = Kα΄΄ * K := by | |
| simp only [POVM.pull, β Matrix.sum_mul, β Matrix.mul_sum, P.total, Matrix.mul_one] | |
| omit [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] in | |
| lemma kronecker_sum_left {ΞΉ : Type u_ΞΉ} [Fintype ΞΉ] (M : ΞΉ β Matrix m m β) | |
| (N : Matrix n n β) : (β i, M i) ββ N = β i, M i ββ N := by | |
| ext i j; simp only [Matrix.kroneckerMap_apply, Matrix.sum_apply, Finset.sum_mul] | |
| omit [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] in | |
| lemma kronecker_sum_right {ΞΉ : Type u_ΞΉ} [Fintype ΞΉ] (M : Matrix m m β) | |
| (N : ΞΉ β Matrix n n β) : M ββ (β i, N i) = β i, M ββ N i := by | |
| ext i j; simp only [Matrix.kroneckerMap_apply, Matrix.sum_apply, Finset.mul_sum] | |
| @[reducible] def Copies (n : Type) : β β Type | |
| | 0 => Unit | |
| | t+1 => n Γ Copies n t | |
| instance copiesFintype {n : Type} [Fintype n] : (t : β) β Fintype (Copies n t) | |
| | 0 => inferInstanceAs (Fintype Unit) | |
| | t+1 => by | |
| letI := copiesFintype (n := n) t | |
| exact inferInstanceAs (Fintype (n Γ Copies n t)) | |
| instance copiesDecidableEq {n : Type} [DecidableEq n] : (t : β) β DecidableEq (Copies n t) | |
| | 0 => inferInstanceAs (DecidableEq Unit) | |
| | t+1 => @instDecidableEqProd n (Copies n t) _ (copiesDecidableEq t) | |
| instance copiesNonempty {n : Type} [Nonempty n] : (t : β) β Nonempty (Copies n t) | |
| | 0 => inferInstanceAs (Nonempty Unit) | |
| | t+1 => by | |
| let := copiesNonempty (n := n) t | |
| exact inferInstanceAs (Nonempty (n Γ Copies n t)) | |
| def tensorPower {m n : Type} (D : Matrix m n β) : (t : β) β Matrix (Copies m t) (Copies n t) β | |
| | 0 => fun _ _ => 1 | |
| | t+1 => D ββ tensorPower D t | |
| lemma hsSq_tensorPower {m n : Type} [Fintype m] [Fintype n] (D : Matrix m n β) (t : β) : | |
| hsSq (tensorPower D t) = hsSq D ^ t := by | |
| induction t with | |
| | zero => simp [tensorPower, hsSq] | |
| | succ t ih => rw [tensorPower, hsSq_kronecker, ih, pow_succ'] | |
| def firstSuccess {m n : Type} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] | |
| {A : Type} [Fintype A] (P : POVM m A) (K : Matrix m n β) | |
| (hK : Kα΄΄*K β€ 1) (aβ : A) : (t : β) β POVM (Copies n t) A | |
| | 0 => POVM.default aβ | |
| | t+1 => { | |
| effect := fun a => P.pull K a ββ 1 + (1-Kα΄΄*K) ββ (firstSuccess P K hK aβ t).effect a | |
| pos := fun a => ((P.pull_pos K a).kronecker Matrix.PosSemidef.one).add | |
| ((Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr hK)).kronecker | |
| ((firstSuccess P K hK aβ t).pos a)) | |
| total := by | |
| rw [Finset.sum_add_distrib, β kronecker_sum_left, β kronecker_sum_right, | |
| P.pull_sum, (firstSuccess P K hK aβ t).total, β Matrix.add_kronecker] | |
| simp only [add_sub_cancel, Matrix.one_kronecker_one] } | |
| lemma eval_submatrix {m : Type u_m} {n : Type u_n} {p : Type u_p} {q : Type u_q} [Fintype m] [Fintype n] [Fintype p] [Fintype q] | |
| (C : Matrix m n β) (U : Matrix m m β) (V : Matrix n n β) (e : p β m) (f : q β n) : | |
| eval (C.submatrix e f) (U.submatrix e e) (V.submatrix f f) = eval C U V := by | |
| simp only [eval_eq_sum, Matrix.submatrix_apply] | |
| apply Fintype.sum_equiv e | |
| intro i | |
| apply Fintype.sum_equiv f | |
| intro j | |
| apply Fintype.sum_equiv e | |
| intro k | |
| exact Fintype.sum_equiv f _ _ (fun _ => rfl) | |
| lemma exists_strategy_of_finite {m n X Y A B : Type} | |
| [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] [Nonempty m] [Nonempty n] | |
| [Fintype A] [Fintype B] (C : Matrix m n β) (hC : hsSq C = 1) | |
| (P : X β POVM m A) (Q : Y β POVM n B) : | |
| β S : Strategy X Y A B, β x y a b, S.born x y a b = prob C ((P x).effect a) ((Q y).effect b) := by | |
| let e : Fin (Fintype.card m - 1 + 1) β m := | |
| (Fintype.equivFinOfCardEq (Nat.sub_add_cancel Fintype.card_pos).symm).symm | |
| let f : Fin (Fintype.card n - 1 + 1) β n := | |
| (Fintype.equivFinOfCardEq (Nat.sub_add_cancel Fintype.card_pos).symm).symm | |
| let S : Strategy X Y A B := { | |
| dimA := Fintype.card m - 1 | |
| dimB := Fintype.card n - 1 | |
| state := vec (C.submatrix e f) | |
| state_unit := by | |
| simp only [vec, Matrix.submatrix_apply, Fintype.sum_prod_type] | |
| rw [show (β i, β j, Complex.normSq (C (e i) (f j))) = hsSq C by | |
| unfold hsSq | |
| apply Fintype.sum_equiv e | |
| intro i | |
| exact Fintype.sum_equiv f _ _ (fun _ => rfl)] | |
| exact hC | |
| alice := fun x a => ((P x).effect a).submatrix e e | |
| bob := fun y b => ((Q y).effect b).submatrix f f | |
| alice_pos := fun x a => ((P x).pos a).submatrix e | |
| bob_pos := fun y b => ((Q y).pos b).submatrix f | |
| alice_total := fun x => by | |
| calc | |
| _ = (β a, (P x).effect a).submatrix e e := by ext i j; simp [Matrix.sum_apply] | |
| _ = 1 := by rw [(P x).total, Matrix.submatrix_one_equiv] | |
| bob_total := fun y => by | |
| calc | |
| _ = (β b, (Q y).effect b).submatrix f f := by ext i j; simp [Matrix.sum_apply] | |
| _ = 1 := by rw [(Q y).total, Matrix.submatrix_one_equiv] } | |
| refine β¨S, ?_β© | |
| intro x y a b | |
| rw [Strategy.born_eq_quadratic] | |
| change prob (C.submatrix e f) (((P x).effect a).submatrix e e) | |
| (((Q y).effect b).submatrix f f) = _ | |
| exact congrArg Complex.re (eval_submatrix C _ _ e f) | |
| lemma prob_first_step_ge {m : Type u_m} {n : Type u_n} {p : Type u_p} {q : Type u_q} [Fintype m] [Fintype n] [Fintype p] [Fintype q] | |
| [DecidableEq p] [DecidableEq q] | |
| (C : Matrix m n β) (D : Matrix p q β) (hD : hsSq D = 1) | |
| {G F : Matrix m m β} {H J : Matrix n n β} {E : Matrix p p β} {T : Matrix q q β} | |
| (hG : G.PosSemidef) (hF : F.PosSemidef) (hH : H.PosSemidef) (hJ : J.PosSemidef) | |
| (hE : E.PosSemidef) (hT : T.PosSemidef) : | |
| prob C G H + prob C F J * prob D E T β€ | |
| prob (C ββ D) (G ββ 1 + F ββ E) (H ββ 1 + J ββ T) := by | |
| rw [prob_add_left, prob_add_right, prob_add_right, | |
| prob_kronecker C D hG hH Matrix.PosSemidef.one Matrix.PosSemidef.one, | |
| prob_one, hD, mul_one, prob_kronecker C D hF hJ hE hT] | |
| have h1 := prob_nonneg (C := C ββ D) (hG.kronecker Matrix.PosSemidef.one) (hJ.kronecker hT) | |
| have h2 := prob_nonneg (C := C ββ D) (hF.kronecker hE) (hH.kronecker Matrix.PosSemidef.one) | |
| linarith | |
| lemma firstSuccess_prob_succ {m n p q A B : Type} [Fintype m] [Fintype n] | |
| [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] | |
| [Fintype A] [Fintype B] | |
| (D : Matrix n q β) (hD : hsSq D = 1) (P : POVM m A) (Q : POVM p B) | |
| (K : Matrix m n β) (L : Matrix p q β) (hK : Kα΄΄*K β€ 1) (hL : Lα΄΄*L β€ 1) | |
| (aβ : A) (bβ : B) (t : β) (a : A) (b : B) : | |
| prob (K*D*Lα΅) (P.effect a) (Q.effect b) + | |
| prob D (1-Kα΄΄*K) (1-Lα΄΄*L) * | |
| prob (tensorPower D t) ((firstSuccess P K hK aβ t).effect a) | |
| ((firstSuccess Q L hL bβ t).effect b) β€ | |
| prob (tensorPower D (t+1)) ((firstSuccess P K hK aβ (t+1)).effect a) | |
| ((firstSuccess Q L hL bβ (t+1)).effect b) := by | |
| change _ β€ prob (D ββ tensorPower D t) | |
| (P.pull K a ββ 1 + (1-Kα΄΄*K) ββ (firstSuccess P K hK aβ t).effect a) | |
| (Q.pull L b ββ 1 + (1-Lα΄΄*L) ββ (firstSuccess Q L hL bβ t).effect b) | |
| have hnorm : hsSq (tensorPower D t) = 1 := by rw [hsSq_tensorPower, hD, one_pow] | |
| have h := prob_first_step_ge D (tensorPower D t) hnorm (P.pull_pos K a) | |
| (Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr hK)) (Q.pull_pos L b) | |
| (Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr hL)) | |
| ((firstSuccess P K hK aβ t).pos a) ((firstSuccess Q L hL bβ t).pos b) | |
| simpa only [POVM.pull, prob_pullback] using h | |
| lemma prob_sum_left {m : Type u_m} {n : Type u_n} {ΞΉ : Type u_ΞΉ} [Fintype m] [Fintype n] [Fintype ΞΉ] | |
| (C : Matrix m n β) (A : ΞΉ β Matrix m m β) (B : Matrix n n β) : | |
| prob C (β i, A i) B = β i, prob C (A i) B := by | |
| simp only [prob, eval_eq_trace, Matrix.sum_mul, Matrix.mul_sum, Matrix.trace_sum, Complex.re_sum] | |
| lemma prob_sum_right {m : Type u_m} {n : Type u_n} {ΞΉ : Type u_ΞΉ} [Fintype m] [Fintype n] [Fintype ΞΉ] | |
| (C : Matrix m n β) (A : Matrix m m β) (B : ΞΉ β Matrix n n β) : | |
| prob C A (β i, B i) = β i, prob C A (B i) := by | |
| simp only [prob, eval_eq_trace, Matrix.transpose_sum, Matrix.mul_sum, | |
| Matrix.trace_sum, Complex.re_sum] | |
| section Payoff | |
| variable {m : Type u_m} {n : Type u_n} {A : Type u_A} {B : Type u_B} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] | |
| [Fintype A] [Fintype B] | |
| def payoff (C : Matrix m n β) (P : POVM m A) (Q : POVM n B) (V : A β B β Bool) : β := | |
| β a, β b, if V a b then prob C (P.effect a) (Q.effect b) else 0 | |
| lemma prob_total (C : Matrix m n β) (P : POVM m A) (Q : POVM n B) : | |
| β a, β b, prob C (P.effect a) (Q.effect b) = hsSq C := by | |
| simp_rw [β prob_sum_right, β prob_sum_left, P.total, Q.total, prob_one] | |
| lemma payoff_nonneg (C : Matrix m n β) (P : POVM m A) (Q : POVM n B) (V : A β B β Bool) : | |
| 0 β€ payoff C P Q V := by | |
| apply Finset.sum_nonneg; intro a _ | |
| apply Finset.sum_nonneg; intro b _ | |
| split | |
| Β· exact prob_nonneg (P.pos a) (Q.pos b) | |
| Β· exact le_rfl | |
| lemma payoff_le_hsSq (C : Matrix m n β) (P : POVM m A) (Q : POVM n B) (V : A β B β Bool) : | |
| payoff C P Q V β€ hsSq C := by | |
| rw [β prob_total C P Q] | |
| apply Finset.sum_le_sum; intro a _ | |
| apply Finset.sum_le_sum; intro b _ | |
| split | |
| Β· exact le_rfl | |
| Β· exact prob_nonneg (P.pos a) (Q.pos b) | |
| end Payoff | |
| lemma firstSuccess_prob_geometric {m n p q A B : Type} [Fintype m] [Fintype n] | |
| [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] | |
| [Fintype A] [Fintype B] | |
| (D : Matrix n q β) (hD : hsSq D = 1) (P : POVM m A) (Q : POVM p B) | |
| (K : Matrix m n β) (L : Matrix p q β) (hK : Kα΄΄*K β€ 1) (hL : Lα΄΄*L β€ 1) | |
| (aβ : A) (bβ : B) (t : β) (a : A) (b : B) : | |
| prob (K*D*Lα΅) (P.effect a) (Q.effect b) * | |
| (β j β Finset.range t, (prob D (1-Kα΄΄*K) (1-Lα΄΄*L))^j) β€ | |
| prob (tensorPower D t) ((firstSuccess P K hK aβ t).effect a) | |
| ((firstSuccess Q L hL bβ t).effect b) := by | |
| let z := prob D (1-Kα΄΄*K) (1-Lα΄΄*L) | |
| have hz : 0 β€ z := prob_nonneg | |
| (Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr hK)) | |
| (Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr hL)) | |
| induction t with | |
| | zero => | |
| simpa only [Finset.range_zero, Finset.sum_empty, mul_zero] using | |
| (prob_nonneg ((firstSuccess P K hK aβ 0).pos a) ((firstSuccess Q L hL bβ 0).pos b) | |
| (C := tensorPower D 0)) | |
| | succ t ih => | |
| calc | |
| _ = prob (K*D*Lα΅) (P.effect a) (Q.effect b) + z * | |
| (prob (K*D*Lα΅) (P.effect a) (Q.effect b) * β j β Finset.range t, z^j) := by | |
| change _ * (β j β Finset.range (t+1), z^j) = _ | |
| rw [Finset.sum_range_succ'] | |
| simp only [pow_succ', β Finset.mul_sum, pow_zero] | |
| ring | |
| _ β€ prob (K*D*Lα΅) (P.effect a) (Q.effect b) + z * | |
| prob (tensorPower D t) ((firstSuccess P K hK aβ t).effect a) | |
| ((firstSuccess Q L hL bβ t).effect b) := | |
| add_le_add le_rfl (mul_le_mul_of_nonneg_left ih hz) | |
| _ β€ _ := firstSuccess_prob_succ D hD P Q K L hK hL aβ bβ t a b | |
| lemma firstSuccess_payoff_geometric {m n p q A B : Type} [Fintype m] [Fintype n] | |
| [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] | |
| [Fintype A] [Fintype B] | |
| (D : Matrix n q β) (hD : hsSq D = 1) (P : POVM m A) (Q : POVM p B) | |
| (K : Matrix m n β) (L : Matrix p q β) (hK : Kα΄΄*K β€ 1) (hL : Lα΄΄*L β€ 1) | |
| (aβ : A) (bβ : B) (t : β) (V : A β B β Bool) : | |
| payoff (K*D*Lα΅) P Q V * | |
| (β j β Finset.range t, (prob D (1-Kα΄΄*K) (1-Lα΄΄*L))^j) β€ | |
| payoff (tensorPower D t) (firstSuccess P K hK aβ t) (firstSuccess Q L hL bβ t) V := by | |
| simp only [payoff, Finset.sum_mul] | |
| apply Finset.sum_le_sum; intro a _ | |
| apply Finset.sum_le_sum; intro b _ | |
| split | |
| Β· exact firstSuccess_prob_geometric D hD P Q K L hK hL aβ bβ t a b | |
| Β· simp | |
| lemma finite_filter_geometric_value {m n p q : Type} [Fintype m] [Fintype n] | |
| [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] | |
| [Nonempty n] [Nonempty q] {x y a b : β} (G : Game x y a b) | |
| (D : Matrix n q β) (hD : hsSq D = 1) | |
| (P : Fin (x+1) β POVM m (Fin (a+1))) (Q : Fin (y+1) β POVM p (Fin (b+1))) | |
| (K : Fin (x+1) β Matrix m n β) (L : Fin (y+1) β Matrix p q β) | |
| (hK : β x, (K x)α΄΄*K x β€ 1) (hL : β y, (L y)α΄΄*L y β€ 1) (t : β) : | |
| (β z : Fin (x+1) Γ Fin (y+1), G.questionProb z * | |
| (payoff (K z.1*D*(L z.2)α΅) (P z.1) (Q z.2) (G.accepts z.1 z.2) * | |
| β j β Finset.range t, (prob D (1-(K z.1)α΄΄*K z.1) (1-(L z.2)α΄΄*L z.2))^j)) β€ | |
| entangledValue G := by | |
| have hnorm : hsSq (tensorPower D t) = 1 := by rw [hsSq_tensorPower, hD, one_pow] | |
| obtain β¨S, hSβ© := exists_strategy_of_finite (tensorPower D t) hnorm | |
| (fun x => firstSuccess (P x) (K x) (hK x) 0 t) | |
| (fun y => firstSuccess (Q y) (L y) (hL y) 0 t) | |
| apply le_trans ?_ (successProbability_le_value G S) | |
| unfold successProbability | |
| apply Finset.sum_le_sum; intro z _ | |
| apply mul_le_mul_of_nonneg_left _ (G.questionProb_nonneg z) | |
| rw [Fintype.sum_prod_type] | |
| simp_rw [hS] | |
| exact firstSuccess_payoff_geometric D hD (P z.1) (Q z.2) (K z.1) (L z.2) | |
| (hK z.1) (hL z.2) 0 0 t (G.accepts z.1 z.2) | |
| section FilterMass | |
| variable {m : Type u_m} {n : Type u_n} {p : Type u_p} {q : Type u_q} [Fintype m] [Fintype n] [Fintype p] [Fintype q] | |
| [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] | |
| omit [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] in | |
| lemma prob_sub_left (C : Matrix m n β) (A A' : Matrix m m β) (B : Matrix n n β) : | |
| prob C (A-A') B = prob C A B - prob C A' B := by | |
| simp only [prob, eval_eq_trace, Matrix.sub_mul, Matrix.mul_sub, Matrix.trace_sub, Complex.sub_re] | |
| omit [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] in | |
| lemma prob_sub_right (C : Matrix m n β) (A : Matrix m m β) (B B' : Matrix n n β) : | |
| prob C A (B-B') = prob C A B - prob C A B' := by | |
| simp only [prob, eval_eq_trace, Matrix.transpose_sub, Matrix.mul_sub, Matrix.trace_sub, Complex.sub_re] | |
| omit [DecidableEq n] [DecidableEq q] in | |
| lemma prob_gram (D : Matrix n q β) (K : Matrix m n β) (L : Matrix p q β) : | |
| prob D (Kα΄΄*K) (Lα΄΄*L) = hsSq (K*D*Lα΅) := by | |
| simpa only [Matrix.mul_one, prob_one] using prob_pullback D K L (1 : Matrix m m β) (1 : Matrix p p β) | |
| omit [Fintype p] [DecidableEq p] [DecidableEq n] in | |
| lemma prob_left_gram (D : Matrix n q β) (K : Matrix m n β) : | |
| prob D (Kα΄΄*K) 1 = hsSq (K*D) := by | |
| simpa only [Matrix.conjTranspose_one, Matrix.one_mul, Matrix.transpose_one, Matrix.mul_one] using | |
| prob_gram D K (1 : Matrix q q β) | |
| omit [Fintype m] [DecidableEq m] [DecidableEq q] in | |
| lemma prob_right_gram (D : Matrix n q β) (L : Matrix p q β) : | |
| prob D 1 (Lα΄΄*L) = hsSq (D*Lα΅) := by | |
| simpa only [Matrix.conjTranspose_one, Matrix.one_mul] using | |
| prob_gram D (1 : Matrix n n β) L | |
| lemma prob_fail (D : Matrix n q β) (K : Matrix m n β) (L : Matrix p q β) : | |
| prob D (1-Kα΄΄*K) (1-Lα΄΄*L) = | |
| hsSq D - hsSq (K*D) - hsSq (D*Lα΅) + hsSq (K*D*Lα΅) := by | |
| rw [prob_sub_left, prob_sub_right, prob_sub_right, prob_one, prob_right_gram, | |
| prob_left_gram, prob_gram] | |
| ring | |
| lemma filter_mass_bounds (D : Matrix n q β) (K : Matrix m n β) (L : Matrix p q β) | |
| (hK : Kα΄΄*K β€ 1) (hL : Lα΄΄*L β€ 1) : | |
| hsSq (K*D*Lα΅) β€ hsSq (K*D) β§ hsSq (K*D*Lα΅) β€ hsSq (D*Lα΅) β§ | |
| hsSq (K*D) β€ hsSq D β§ hsSq (D*Lα΅) β€ hsSq D := by | |
| have hF := Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr hK) | |
| have hJ := Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr hL) | |
| have hG := Matrix.posSemidef_conjTranspose_mul_self K | |
| have hH := Matrix.posSemidef_conjTranspose_mul_self L | |
| have h1 := prob_nonneg (C := D) hG hJ | |
| have h2 := prob_nonneg (C := D) hF hH | |
| have h3 := prob_nonneg (C := D) hF Matrix.PosSemidef.one | |
| have h4 := prob_nonneg (C := D) Matrix.PosSemidef.one hJ | |
| rw [prob_sub_right, prob_left_gram, prob_gram] at h1 | |
| rw [prob_sub_left, prob_right_gram, prob_gram] at h2 | |
| rw [prob_sub_left, prob_one, prob_left_gram] at h3 | |
| rw [prob_sub_right, prob_one, prob_right_gram] at h4 | |
| exact β¨sub_nonneg.mp h1, sub_nonneg.mp h2, sub_nonneg.mp h3, sub_nonneg.mp h4β© | |
| lemma prob_fail_le (D : Matrix n q β) (K : Matrix m n β) (L : Matrix p q β) | |
| (hK : Kα΄΄*K β€ 1) (hL : Lα΄΄*L β€ 1) : | |
| prob D (1-Kα΄΄*K) (1-Lα΄΄*L) β€ hsSq D := by | |
| rw [prob_fail] | |
| have h := (filter_mass_bounds D K L hK hL).1 | |
| have hb := hsSq_nonneg (D*Lα΅) | |
| linarith | |
| lemma output_zero_of_fail_full (D : Matrix n q β) (K : Matrix m n β) (L : Matrix p q β) | |
| (hK : Kα΄΄*K β€ 1) (hL : Lα΄΄*L β€ 1) | |
| (h : prob D (1-Kα΄΄*K) (1-Lα΄΄*L) = hsSq D) : hsSq (K*D*Lα΅) = 0 := by | |
| rw [prob_fail] at h | |
| obtain β¨h1,h2,_,_β© := filter_mass_bounds D K L hK hL | |
| have h0 := hsSq_nonneg (K*D*Lα΅) | |
| linarith | |
| end FilterMass | |
| open Filter Topology | |
| lemma geometric_contribution_tendsto {w z : β} (hz0 : 0 β€ z) (hz1 : z β€ 1) | |
| (hw : z = 1 β w = 0) : | |
| Tendsto (fun t : β => w * β j β Finset.range t, z^j) atTop (π (w/(1-z))) := by | |
| by_cases hz : z = 1 | |
| Β· simp only [hw hz, zero_mul, zero_div] | |
| exact tendsto_const_nhds | |
| Β· simpa only [div_eq_mul_inv] using | |
| ((hasSum_geometric_of_lt_one hz0 (lt_of_le_of_ne hz1 hz)).tendsto_sum_nat.const_mul w) | |
| theorem finite_filter_value {m n p q : Type} [Fintype m] [Fintype n] | |
| [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] | |
| [Nonempty n] [Nonempty q] {x y a b : β} (G : Game x y a b) | |
| (D : Matrix n q β) (hD : hsSq D = 1) | |
| (P : Fin (x+1) β POVM m (Fin (a+1))) (Q : Fin (y+1) β POVM p (Fin (b+1))) | |
| (K : Fin (x+1) β Matrix m n β) (L : Fin (y+1) β Matrix p q β) | |
| (hK : β x, (K x)α΄΄*K x β€ 1) (hL : β y, (L y)α΄΄*L y β€ 1) : | |
| (β z : Fin (x+1) Γ Fin (y+1), G.questionProb z * | |
| (payoff (K z.1*D*(L z.2)α΅) (P z.1) (Q z.2) (G.accepts z.1 z.2) / | |
| (1-prob D (1-(K z.1)α΄΄*K z.1) (1-(L z.2)α΄΄*L z.2)))) β€ entangledValue G := by | |
| apply le_of_tendsto' (x := atTop) (f := fun t : β => β z : Fin (x+1) Γ Fin (y+1), G.questionProb z * | |
| (payoff (K z.1*D*(L z.2)α΅) (P z.1) (Q z.2) (G.accepts z.1 z.2) * | |
| β j β Finset.range t, (prob D (1-(K z.1)α΄΄*K z.1) (1-(L z.2)α΄΄*L z.2))^j)) | |
| Β· apply tendsto_finsetSum | |
| intro z _ | |
| apply Filter.Tendsto.const_mul | |
| apply geometric_contribution_tendsto | |
| Β· exact prob_nonneg (Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr (hK z.1))) | |
| (Matrix.nonneg_iff_posSemidef.mp (sub_nonneg.mpr (hL z.2))) | |
| Β· rw [β hD]; exact prob_fail_le D (K z.1) (L z.2) (hK z.1) (hL z.2) | |
| Β· intro hz | |
| have hn := output_zero_of_fail_full D (K z.1) (L z.2) (hK z.1) (hL z.2) (hz.trans hD.symm) | |
| exact le_antisymm ((payoff_le_hsSq _ _ _ _).trans_eq hn) (payoff_nonneg _ _ _ _) | |
| Β· exact fun t => finite_filter_geometric_value G D hD P Q K L hK hL t | |
| lemma prob_smul {m : Type u_m} {n : Type u_n} [Fintype m] [Fintype n] | |
| (r : β) (C : Matrix m n β) (A : Matrix m m β) (B : Matrix n n β) : | |
| prob (r β’ C) A B = r^2 * prob C A B := by | |
| simp only [prob, eval_eq_trace, Matrix.conjTranspose_smul, star_trivial, | |
| Matrix.smul_mul, Matrix.mul_smul, Matrix.trace_smul, Complex.real_smul, | |
| Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] | |
| ring | |
| lemma payoff_smul {m : Type u_m} {n : Type u_n} {A : Type u_A} {B : Type u_B} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] | |
| [Fintype A] [Fintype B] (r : β) (C : Matrix m n β) (P : POVM m A) (Q : POVM n B) | |
| (V : A β B β Bool) : payoff (r β’ C) P Q V = r^2 * payoff C P Q V := by | |
| simp only [payoff, prob_smul, Finset.mul_sum, mul_ite, mul_zero] | |
| theorem finite_filter_value_unnormalized {m n p q : Type} [Fintype m] [Fintype n] | |
| [Fintype p] [Fintype q] [DecidableEq m] [DecidableEq n] [DecidableEq p] [DecidableEq q] | |
| [Nonempty n] [Nonempty q] {x y a b : β} (G : Game x y a b) | |
| (D : Matrix n q β) (hD : 0 < hsSq D) | |
| (P : Fin (x+1) β POVM m (Fin (a+1))) (Q : Fin (y+1) β POVM p (Fin (b+1))) | |
| (K : Fin (x+1) β Matrix m n β) (L : Fin (y+1) β Matrix p q β) | |
| (hK : β x, (K x)α΄΄*K x β€ 1) (hL : β y, (L y)α΄΄*L y β€ 1) : | |
| (β z : Fin (x+1) Γ Fin (y+1), G.questionProb z * | |
| (payoff (K z.1*D*(L z.2)α΅) (P z.1) (Q z.2) (G.accepts z.1 z.2) / | |
| (hsSq (K z.1*D) + hsSq (D*(L z.2)α΅) - hsSq (K z.1*D*(L z.2)α΅)))) β€ | |
| entangledValue G := by | |
| let r : β := (Real.sqrt (hsSq D))β»ΒΉ | |
| have hr : r^2 = (hsSq D)β»ΒΉ := by | |
| dsimp [r] | |
| rw [inv_pow, Real.sq_sqrt hD.le] | |
| have hnorm : hsSq (r β’ D) = 1 := by | |
| rw [hsSq_smul, hr, inv_mul_cancelβ hD.ne'] | |
| have hv := finite_filter_value G (r β’ D) hnorm P Q K L hK hL | |
| convert hv using 1 | |
| apply Finset.sum_congr rfl; intro z _ | |
| congr 1 | |
| rw [Matrix.mul_smul, Matrix.smul_mul, payoff_smul, prob_smul, hr] | |
| have hden : (1 - (hsSq D)β»ΒΉ * prob D (1-(K z.1)α΄΄*K z.1) (1-(L z.2)α΄΄*L z.2)) = | |
| (hsSq D - prob D (1-(K z.1)α΄΄*K z.1) (1-(L z.2)α΄΄*L z.2)) / hsSq D := by | |
| field_simp | |
| rw [hden, inv_mul_eq_div, div_div_div_cancel_rightβ hD.ne', prob_fail] | |
| congr 1 | |
| ring | |
| end ThresholdParallelRepetition.QuantumSampling | |
| end | |
| end OAI | |