File size: 3,155 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import OAI.Combinatorics.MatchingPSD.GoodCells

namespace OAI

universe u_1

namespace PerfectMatchingPSD
open Matrix
open scoped BigOperators MatrixOrder
attribute [local instance] Classical.propDecidable

lemma domination_decoder {R : Type u_1} [Fintype R] [DecidableEq R] {q : β„•}
    (Q : (Fin q β†’ Bool) β†’ Matrix R R ℝ)
    (T : Fin q β†’ Bool β†’ Matrix R R ℝ) (P E : Fin q β†’ Matrix R R ℝ)
    (S : Matrix R R ℝ)
    (hQ : βˆ€ y, (Q y).PosSemidef) (hT : βˆ€ i b, (T i b).PosSemidef)
    (hP : βˆ€ i, (P i).PosSemidef) (hE : βˆ€ i, (E i).PosSemidef) (hS : S.PosSemidef)
    (hdom : βˆ€ i, T i false + T i true ≀ S+(2:ℝ) β€’ P i+E i)
    (hzero : βˆ€ y i, (Q y*P i).trace=0) (hstar : βˆ€ y, (Q y*S).trace=2)
    (hbit : βˆ€ y i, (Q y*T i (y i)).trace=2)
    {m e Ξ΄ : ℝ} (hΞ΄ : 0 < Ξ΄) (hm : βˆ€ y, (Q y).trace ≀ m)
    (he : βˆ€ y i, (Q y*E i).trace ≀ e)
    (hΞ΅ : 0 ≀ (q:ℝ)*e+Ξ΄*m)
    (hsmall : (q:ℝ)*Real.sqrt ((q:ℝ)*e+Ξ΄*m) ≀ 1/4) :
    (2:ℝ)^q/2 ≀ Fintype.card R := by
  let F := fun i => (2:ℝ) β€’ P i+E i
  have hF (i : Fin q) : (F i).PosSemidef := (hP i).smul (by norm_num) |>.add (hE i)
  let D := S+(βˆ‘ i, F i)+Ξ΄ β€’ (1 : Matrix R R ℝ)
  have hsum : (βˆ‘ i, F i).PosSemidef := matrix_sum_psd _ _ (fun i _ => hF i)
  have hdelt : (Ξ΄ β€’ (1 : Matrix R R ℝ)).PosDef := Matrix.PosDef.one.smul hΞ΄
  have hD : D.PosDef := by
    simpa only [D, add_comm] using hdelt.add_posSemidef (hS.add hsum)
  have hleS : S ≀ D := by
    have he := add_nonneg hsum.nonneg hdelt.posSemidef.nonneg
    dsimp [D]
    simpa only [add_assoc] using le_add_of_nonneg_right he
  have hdomD (i : Fin q) : T i false+T i true ≀ D := by
    apply (hdom i).trans
    have hi : F i ≀ βˆ‘ j, F j := Finset.single_le_sum (fun j _ => (hF j).nonneg) (Finset.mem_univ i)
    calc
      S+(2:ℝ) β€’ P i+E i = S+F i := by dsimp [F]; abel
      _ ≀ S+(βˆ‘ j, F j) := by simpa only [add_comm] using add_le_add_left hi S
      _ ≀ D := le_add_of_nonneg_right hdelt.posSemidef.nonneg
  have htr (y : Fin q β†’ Bool) : 2 ≀ (Q y*D).trace ∧ (Q y*D).trace ≀ 2+((q:ℝ)*e+Ξ΄*m) := by
    constructor
    Β· rw [← hstar y]
      exact trace_mul_le_of_le (hQ y) hleS
    Β· dsimp [D]
      rw [mul_add, mul_add, Matrix.trace_add, Matrix.trace_add, hstar,
        Finset.mul_sum, Matrix.trace_sum, mul_smul_comm, Matrix.trace_smul, mul_one]
      have hsumtr : (βˆ‘ i, (Q y*F i).trace) ≀ (q:ℝ)*e := by
        have hh := Finset.sum_le_sum (s := Finset.univ) (fun i _ => he y i)
        have hFi (i : Fin q) : (Q y*F i).trace = (Q y*E i).trace := by
          simp only [F, mul_add, Matrix.trace_add, mul_smul_comm, Matrix.trace_smul,
            hzero, smul_zero, zero_add]
        simpa only [hFi, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] using hh
      have hΞ΄m := mul_le_mul_of_nonneg_left (hm y) hΞ΄.le
      change _ + Ξ΄*(Q y).trace ≀ _
      linarith
  obtain ⟨ρ,H,hρ,htρ,hH,hpair,hbit'⟩ := states_of_domination Q T D hD hQ hT hdomD
    ((q:ℝ)*e+Ξ΄*m) hΞ΅ htr hbit
  exact nearly_perfect_bit_tests ρ H hρ htρ hH hpair _ hΡ hsmall hbit'

end PerfectMatchingPSD

end OAI