AFTD Auto-Formalizing Theoretical Domains

prime_convolution_five_two_fifth_entanglement_breaking_iff

theoremverifiedoriginal

For every real t with 0 ≤ t ≤ 1: the matrix prime_convolution_choi 5 2 (two_level_environment 5 (1/5) t) (d = 5, r = 2, p = 1/5) is separable if and only if t ≤ 1/3.

Statement

theorem prime_convolution_five_two_fifth_entanglement_breaking_iff (t : ℝ) (h0 : 0 ≤ t) (h1 : t ≤ 1) :
    matrix_is_separable 5 5 (prime_convolution_choi 5 2 (two_level_environment 5 (1/5) t)) ↔ t ≤ 1 / 3
Related work
OP-2466 (proposed here; it builds on the qutrit convolution channels of arXiv:2609.16200, whose Theorem 8 gives the exact PPT and entanglement-breaking threshold 2/5 on a balanced two-level qutrit slice, and on arXiv:2611.09594, which shows PPT and entanglement breaking differ for another convolution environment). Smallest instance of the entry: d = 5, r = 2, p = 1/5, threshold 1/3; the product-orbit decomposition of experiment 41963, twirled, is checked exactly in experiment 42119.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
  • prime_convolution_choiWith d : ℕ, r : ZMod d and σ : Matrix (Fin d) (Fin d) ℂ (no hypotheses), returns the complex matrix indexed by Fin d × Fin d whose entry…
  • two_level_environmentWith d : ℕ and real numbers p, t, returns the complex d×d matrix (1 − t)·I/d + t·|ψ⟩⟨ψ|, where ψ : Fin d → ℝ has ψ j = √p when the…
  • matrix_is_separableWith dA dB : ℕ explicit arguments, in this order, and ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ, the proposition that ρ is…
  • prime_convolution_separable_imp_thresholdLet d be a prime with d ≥ 5, r ∈ ZMod d with r ≠ 0, r ≠ 1 and 2r ≠ 1 (r is not the inverse of 2), and p, t real numbers in [0, 1]. If…
Used by 2

Read back from the Lean

For any real number $t$ satisfying $0 \le t$ and $t \le 1$, the bipartite matrix on $\mathbb{C}^5 \otimes \mathbb{C}^5$ given by prime_convolution_choi 5 2 (two_level_environment 5 (1/5) t) is separable (according to matrix_is_separable 5 5) if and only if $t \le 1 / 3$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The theorem characterizes when the Choi matrix of the convolution channel with environmental noise σ(t) is separable (entanglement-breaking). For the 'only if' direction, a known general threshold bound (prime_convolution_separable_imp_threshold) implies that separability requires t ≤ 1 / (1 + 5√(1/5 * 4/5)) = 1/3. For the 'if' direction, when 0 ≤ t ≤ 1/3, the environment matrix σ(t) is decomposed into a non-negative linear combination of 9 basis matrices, each of which is explicitly factored as a 'twirled' product state. An explicit separable decomposition with (n+2)² product states is constructed for any twirled Choi matrix using additive character orthogonality on ZMod (n+2). Linearity of the Choi map and convexity of the separable cone then establish separability of the full state.

  1. The entry of the Choi matrix can be written using native Fin (n+2) ring arithmetic.

    By definition, the Choi matrix entry prime_convolution_choi (n+2) r σ x y is (1/(n+2)) ∑_{j, l} σ_{j,l} over pairs (j,l) satisfying convolution constraints cast to ZMod (n+2). Lemma in1243b_cast identifies elements of Fin (n+2) with their natural cast into ZMod (n+2), allowing the summation conditions to be rewritten entirely in Fin (n+2) ring arithmetic.

    lines 10–15

    uses in1243b_cast, Finset.sum_congr, Matrix.of_apply

      simp only [prime_convolution_choi, Matrix.of_apply]
      congr 1
      refine Finset.sum_congr rfl fun j _ => Finset.sum_congr rfl fun l _ => ?_
      have e : ∀ a : Fin (n+2), (((a : ℕ) : ZMod (n+2))) = a := in1243b_cast n
      erw [e x.1, e x.2, e y.1, e y.2, e j, e l]
      rfl
  2. The complex conjugate of an additive character χ(u) is χ(-u).

    For the standard additive character χ on ZMod (n+2), complex conjugation satisfies star(χ(u)) = χ(-u) by the general lemma AddChar.map_neg_eq_conj for characters taking values in the complex unit circle.

    line 26

    uses AddChar.map_neg_eq_conj

      exact (AddChar.map_neg_eq_conj (ZMod.stdAddChar (N := n+2)) (u : ZMod (n+2))).symm
  3. The character sum ∑_{c} χ(c * m) equals n+2 if m = 0 and 0 otherwise.

    This is character orthogonality on ZMod (n+2). The primitive character summation lemma AddChar.sum_mulShift reduces the sum to the cardinality of ZMod (n+2), which is n+2 by ZMod.card, when the shift m is zero, and 0 otherwise. Case splitting on m = 0 completes the equality.

    lines 31–39

    uses AddChar.sum_mulShift, ZMod.isPrimitive_stdAddChar, ZMod.card, if_pos, if_neg, Nat.cast_zero

      have := AddChar.sum_mulShift (R := ZMod (n+2)) (ψ := ZMod.stdAddChar (N := n+2)) (m : ZMod (n+2))
        (ZMod.isPrimitive_stdAddChar (n+2))
      rw [ZMod.card] at this
      refine Eq.trans this ?_
      by_cases h : m = 0
      · rw [if_pos h]
        exact congrArg Nat.cast (if_pos (show (m : ZMod (n+2)) = 0 from h))
      · rw [if_neg h]
        exact (congrArg Nat.cast (if_neg (show ¬ (m : ZMod (n+2)) = 0 from h))).trans Nat.cast_zero
  4. The sum of two separable bipartite matrices is separable.

    Given separable decompositions of sizes N₁ and N₂ for A and B as sums of rank-one product matrices, concatenating the vector families via Fin.append gives a separable decomposition of size N₁ + N₂ for A + B. Splitting the sum via Fin.sum_univ_add shows that the entries add as required.

    lines 44–48

    uses Fin.sum_univ_add, Matrix.add_apply, Fin.append_left, Fin.append_right

      obtain ⟨N1, x1, y1, h1⟩ := hA
      obtain ⟨N2, x2, y2, h2⟩ := hB
      refine ⟨N1 + N2, Fin.append x1 x2, Fin.append y1 y2, fun p q => ?_⟩
      rw [Fin.sum_univ_add, Matrix.add_apply, h1, h2]
      simp only [Fin.append_left, Fin.append_right]
  5. Any non-negative scalar multiple of a separable bipartite matrix is separable.

    Scaling the first factor of each product state by √c scales each rank-one term by (√c)(conj(√c)) = c, since c ≥ 0 implies √c * √c = c via Real.mul_self_sqrt. Distributing the scalar across the sum establishes separability of c • A.

    lines 52–59

    uses Matrix.smul_apply, smul_eq_mul, Finset.mul_sum, Complex.ofReal_mul, Real.mul_self_sqrt, star_mul', Complex.star_def, Complex.conj_ofReal

      obtain ⟨N, x, y, h⟩ := hA
      refine ⟨N, fun i a => (Real.sqrt c : ℂ) * x i a, y, fun p q => ?_⟩
      rw [Matrix.smul_apply, h, smul_eq_mul, Finset.mul_sum]
      refine Finset.sum_congr rfl fun i _ => ?_
      have hs : (Real.sqrt c : ℂ) * (Real.sqrt c : ℂ) = (c : ℂ) := by
        rw [← Complex.ofReal_mul, Real.mul_self_sqrt hc]
      rw [star_mul', Complex.star_def, Complex.conj_ofReal, ← hs]
      ring
  6. Any finite sum of separable bipartite matrices is separable.

    By induction on the finite set s using Finset.induction_on: the empty sum is the zero matrix, which is trivially separable with N = 0, and the inductive step applies in1243_sep_add to add each successive separable matrix.

    lines 64–70

    uses Finset.induction_on, Finset.sum_insert, in1243_sep_add, Finset.mem_insert_self, Finset.mem_insert_of_mem

      classical
      induction s using Finset.induction_on with
      | empty => exact ⟨0, fun _ _ => 0, fun _ _ => 0, fun p q => by simp⟩
      | insert i s hi ih =>
        rw [Finset.sum_insert hi]
        exact in1243_sep_add _ _ _ _ (h i (Finset.mem_insert_self _ _))
          (ih fun j hj => h j (Finset.mem_insert_of_mem hj))
  7. The Choi matrix map is linear with respect to real linear combinations of matrices.

    Entrywise, the Choi matrix is defined by a linear combination of matrix entries with indicator conditions. Substituting the linear combination ∑_{i ∈ s} c_i σ_i into the Choi definition, distributing the multiplication, and exchanging the summation orders using Finset.sum_comm shows that the Choi map preserves finite linear combinations.

    lines 76–89

    uses Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul, Finset.mul_sum, Finset.sum_comm, Finset.sum_congr

      ext x y
      simp only [prime_convolution_choi, Matrix.of_apply, Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul]
      have hite : ∀ (P : Prop) [Decidable P] (g : ι → ℂ),
          (if P then ∑ i ∈ s, g i else 0) = ∑ i ∈ s, if P then g i else 0 := by
        intro P _ g; split_ifs <;> simp
      simp only [hite, Finset.mul_sum]
      calc _ = ∑ j : Fin d, ∑ i ∈ s, ∑ l : Fin d, (1 / (d : ℂ)) * (if ((x.2 : ℕ) : ZMod d) = r * ((x.1 : ℕ) : ZMod d) + ((j : ℕ) : ZMod d) ∧
            ((y.2 : ℕ) : ZMod d) = r * ((y.1 : ℕ) : ZMod d) + ((l : ℕ) : ZMod d) ∧
            ((x.1 : ℕ) : ZMod d) + ((j : ℕ) : ZMod d) = ((y.1 : ℕ) : ZMod d) + ((l : ℕ) : ZMod d)
            then (c i : ℂ) * σ i j l else 0) := Finset.sum_congr rfl fun j _ => Finset.sum_comm
        _ = _ := Finset.sum_comm
        _ = _ := by
          refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Finset.sum_congr rfl fun l _ => ?_
          split_ifs <;> ring
  8. The Choi matrix of a twirled matrix admits an ansatz of (n+2)² product states whose character sum concentrates on the twirling condition.

    We define (n+2)² product vectors indexed by (x, c) ∈ Fin(n+2) × Fin(n+2) via finProdFinEquiv, setting x_{x,c}(i) = (1/(n+2)) a(i-x) χ(c(1-r)i) and y_{x,c}(i) = b(i-rx) χ(ci). Summing over c and applying character conjugation in1243_chi_star and orthogonality in1243_chi_sum, the sum over c collapses: it vanishes unless (1-r)p₁ + p₂ = (1-r)q₁ + q₂, in which case it yields a factor of n+2, leaving (1/(n+2)) a(p₁-x) a(q₁-x) b(p₂-rx) b(q₂-rx).

    lines 95–134

    uses Equiv.sum_comp, Equiv.symm_apply_apply, Fintype.sum_prod_type, star_mul', in1243_chi_star, Complex.star_def, Complex.conj_ofReal, Complex.conj_natCast, in1243_chi_add, Finset.sum_congr, Finset.mul_sum, in1243_chi_sum, if_pos, if_neg

      refine ⟨(n+2) * (n+2),
        fun k i => (1 / ((n+2 : ℕ) : ℂ)) * (a (i - (finProdFinEquiv.symm k).1) : ℂ) *
          ZMod.stdAddChar (N := n+2) (((finProdFinEquiv.symm k).2 * ((1 - r) * i) : Fin (n+2))),
        fun k i => (b (i - r * (finProdFinEquiv.symm k).1) : ℂ) *
          ZMod.stdAddChar (N := n+2) (((finProdFinEquiv.symm k).2 * i : Fin (n+2))), fun p q => ?_⟩
      rw [← Equiv.sum_comp finProdFinEquiv]
      simp only [Equiv.symm_apply_apply]
      rw [Fintype.sum_prod_type]
      have hN : ((n+2 : ℕ) : ℂ) ≠ 0 := by exact_mod_cast (by omega : n + 2 ≠ 0)
      -- the right side
      have hR : ∀ x : Fin (n+2), (∑ c : Fin (n+2),
          (1 / ((n+2 : ℕ) : ℂ)) * (a (p.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * p.1) : Fin (n+2))) *
            star ((1 / ((n+2 : ℕ) : ℂ)) * (a (q.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * q.1) : Fin (n+2)))) *
          ((b (p.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * p.2 : Fin (n+2))) *
            star ((b (q.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * q.2 : Fin (n+2)))))) =
          (1 / ((n+2 : ℕ) : ℂ)) * (if (1 - r) * p.1 + p.2 = (1 - r) * q.1 + q.2 then
            ((a (p.1 - x) * a (q.1 - x) * b (p.2 - r * x) * b (q.2 - r * x) : ℝ) : ℂ) else 0) := by
        intro x
        have hc : ∀ c : Fin (n+2), (1 / ((n+2 : ℕ) : ℂ)) * (a (p.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * p.1) : Fin (n+2))) *
            star ((1 / ((n+2 : ℕ) : ℂ)) * (a (q.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * q.1) : Fin (n+2)))) *
          ((b (p.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * p.2 : Fin (n+2))) *
            star ((b (q.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * q.2 : Fin (n+2))))) =
            (1 / ((n+2 : ℕ) : ℂ)) * (1 / ((n+2 : ℕ) : ℂ)) *
              ((a (p.1 - x) * a (q.1 - x) * b (p.2 - r * x) * b (q.2 - r * x) : ℝ) : ℂ) *
              ZMod.stdAddChar (N := n+2) ((c * (((1 - r) * p.1 + p.2) - ((1 - r) * q.1 + q.2)) : Fin (n+2))) := by
          intro c
          simp only [star_mul', in1243_chi_star, Complex.star_def, Complex.conj_ofReal, map_div₀, map_one,
            Complex.conj_natCast]
          have e : c * (((1 - r) * p.1 + p.2) - ((1 - r) * q.1 + q.2)) =
              c * ((1 - r) * p.1) + -(c * ((1 - r) * q.1)) + (c * p.2 + -(c * q.2)) := by ring
          rw [e, in1243_chi_add, in1243_chi_add, in1243_chi_add]
          push_cast
          ring
        rw [Finset.sum_congr rfl fun c _ => hc c, ← Finset.mul_sum, in1243_chi_sum]
        by_cases hm : (1 - r) * p.1 + p.2 = (1 - r) * q.1 + q.2
        · rw [if_pos (sub_eq_zero.mpr hm), if_pos hm]
          field_simp
        · rw [if_neg (fun h => hm (sub_eq_zero.mp h)), if_neg hm]
          simp
      rw [Finset.sum_congr rfl fun x _ => hR x, ← Finset.mul_sum]
  9. The sum of product states matches the Choi matrix entries, proving separability of any twirled Choi matrix.

    Rewriting the Choi matrix with in1243b_entry, the double sum over (j, l) has non-zero terms only when j = p₂ - r*p₁ and l = q₂ - r*q₁. Isolating these unique indices using Finset.sum_eq_single, the condition (1-r)p₁ + p₂ = (1-r)q₁ + q₂ becomes p₁ + j = q₁ + l. Substituting x' = p₁ - x via Equiv.subLeft transforms the sum over x into the twirled matrix definition, completing the separable decomposition.

    lines 135–170

    uses in1243b_entry, Finset.sum_eq_single, Matrix.of_apply, Complex.ofReal_sum, Equiv.sum_comp, Finset.sum_congr, Equiv.subLeft_apply, if_pos, if_neg

      rw [in1243b_entry]
      congr 1
      rw [Finset.sum_eq_single (p.2 - r * p.1)]
      · rw [Finset.sum_eq_single (q.2 - r * q.1)]
        · by_cases hm : (1 - r) * p.1 + p.2 = (1 - r) * q.1 + q.2
          · have hc : p.2 = r * p.1 + (p.2 - r * p.1) ∧ q.2 = r * q.1 + (q.2 - r * q.1) ∧
                p.1 + (p.2 - r * p.1) = q.1 + (q.2 - r * q.1) :=
              ⟨by ring, by ring, by linear_combination hm⟩
            rw [if_pos hc, Matrix.of_apply]
            simp only [if_pos hm]
            rw [← Complex.ofReal_sum]
            congr 1
            rw [← Equiv.sum_comp (Equiv.subLeft p.1)]
            refine Finset.sum_congr rfl fun x _ => ?_
            simp only [Equiv.subLeft_apply]
            have e1 : r * (p.1 - x) + (p.2 - r * p.1) = p.2 - r * x := by ring
            have e2 : p.1 - x + (p.2 - r * p.1) - (q.2 - r * q.1) = q.1 - x := by linear_combination hm
            rw [e1, e2]
            have e3 : r * (q.1 - x) + (q.2 - r * q.1) = q.2 - r * x := by ring
            rw [e3]
            ring
          · rw [if_neg]
            · simp [hm]
            rintro ⟨_, _, h⟩
            exact hm (by linear_combination h)
        · intro l _ hl
          rw [if_neg]
          rintro ⟨_, h, _⟩
          exact hl (by rw [h]; ring)
        · intro h; exact absurd (Finset.mem_univ _) h
      · intro j _ hj
        refine Finset.sum_eq_zero fun l _ => ?_
        rw [if_neg]
        rintro ⟨h, _, _⟩
        exact hj (by rw [h]; ring)
      · intro h; exact absurd (Finset.mem_univ _) h
  10. Each of the 9 basis matrices equals the twirled matrix formed by its corresponding integer vectors a_k and b_k. automation

    The identity between the convolution sum ∑_{i} a_k(i) b_k(2i+j) a_k(i+j-l) b_k(2(i+j-l)+l) and the explicit 5 × 5 integer matrix table for all k ∈ Fin 9 is a finite arithmetic check, decided by computational evaluation using decide.

    line 179

      decide
  11. The two-level environment matrix decomposes entrywise into a linear combination of the 9 basis matrices. automation

    The environment matrix has (1-t)/5 on the diagonal plus t * v v* where v = (√(1/5), √(4/5), 0, 0, 0). Expanding √(4/5) = 2√(1/5), each of the 25 matrix entries is verified by exhausting index pairs with fin_cases to match the linear combination ∑_{k=0}^8 c_k(t) E_k with coefficients (1-3t)/5 (five times), t/10 (twice), 3t/5, and t/5.

    lines 184–193

    uses Real.sqrt_mul, Real.sqrt_sq, Complex.ofReal_mul, Real.mul_self_sqrt, Complex.ofReal_pow, Real.sq_sqrt, Matrix.of_apply, Fin.sum_univ_succ

      have hs : Real.sqrt (1 - 1/5) = 2 * Real.sqrt (1/5) := by
        rw [show (1:ℝ) - 1/5 = 2^2 * (1/5) by norm_num, Real.sqrt_mul (by norm_num), Real.sqrt_sq (by norm_num)]
      have hss : ((Real.sqrt (1/5) : ℝ) : ℂ) * ((Real.sqrt (1/5) : ℝ) : ℂ) = 1/5 := by
        rw [← Complex.ofReal_mul, Real.mul_self_sqrt (by norm_num)]; push_cast; ring
      have h5 : ((Real.sqrt 5 : ℝ) : ℂ)⁻¹ ^ 2 = 1/5 := by
        rw [inv_pow, ← Complex.ofReal_pow, Real.sq_sqrt (by norm_num)]; push_cast; ring
      simp only [two_level_environment, Matrix.of_apply, hs]
      fin_cases j <;> fin_cases l <;>
        simp [Fin.sum_univ_succ, h5] <;>
        first | ring1 | linear_combination t * h5 | linear_combination 2 * t * h5 | linear_combination 4 * t * h5
  12. The two-level environment matrix equals the linear combination of the 9 twirled matrices.

    Applying in1243_env_decomp and substituting the integer factorisation in1243_eint expresses two_level_environment 5 (1/5) t directly as a sum of 9 twirled matrices scaled by the coefficients c_k(t).

    lines 203–208

    uses in1243_env_decomp, Matrix.sum_apply, Finset.sum_congr, Matrix.smul_apply, smul_eq_mul, Matrix.of_apply, in1243_eint

      ext j l
      rw [in1243_env_decomp, Matrix.sum_apply]
      refine Finset.sum_congr rfl fun k _ => ?_
      rw [Matrix.smul_apply, smul_eq_mul, Matrix.of_apply, ← in1243_eint]
      push_cast
      rfl
  13. For 0 ≤ t ≤ 1/3, the Choi matrix of the convolution channel is separable.

    Using in1243_env_decomp2 and linearity of the Choi map via in1243_choi_linear, the Choi matrix is a sum of 9 terms c_k(t) • Choi(E_k). For 0 ≤ t ≤ 1/3, each coefficient c_k(t) is non-negative (checked by linarith). By in1243_twirl_sep each Choi(E_k) is separable, so by in1243_sep_smul and in1243_sep_sum their positive linear combination is separable.

    lines 212–216

    uses in1243_env_decomp2, in1243_choi_linear, in1243_sep_sum, in1243_sep_smul, in1243_twirl_sep

      rw [in1243_env_decomp2, in1243_choi_linear]
      refine in1243_sep_sum _ _ _ _ fun k _ => in1243_sep_smul _ _ _ ?_ _ ?_
      · fin_cases k <;> simp <;> linarith
      · exact in1243_twirl_sep 3 2 (fun i => ((((![![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) i : ℤ) : ℝ))
          (fun i => ((((![![1, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 1], ![1, -1, 1, 1, 0], ![1, 1, -1, 1, 0], ![0, 1, 0, 0, 0], ![0, 1, -1, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) i : ℤ) : ℝ))
  14. Separability of the Choi matrix implies t ≤ 1/3.

    Assuming the Choi matrix is separable, the general threshold lemma prime_convolution_separable_imp_threshold applies with d = 5, r = 2, and p = 1/5. This yields t ≤ 1 / (1 + 5 √(1/5 * 4/5)). Evaluating √(4/25) = 2/5 via Real.sqrt_sq gives 1 / (1 + 5 * (2/5)) = 1/3, which linear arithmetic simplifies to t ≤ 1/3.

    lines 220–228

    uses prime_convolution_separable_imp_threshold, Real.sqrt_sq

      constructor
      · intro h
        have key := prime_convolution_separable_imp_threshold 5 (by norm_num) le_rfl 2 (by decide) (by decide)
          (by decide) (1/5) t (by norm_num) (by norm_num) h0 h1 h
        have hsq : Real.sqrt (1/5 * (1 - 1/5)) = 2/5 := by
          rw [show (1:ℝ)/5 * (1 - 1/5) = (2/5)^2 by norm_num]; exact Real.sqrt_sq (by norm_num)
        rw [hsq] at key
        norm_num at key
        linarith
  15. Conversely, if t ≤ 1/3 and t ≥ 0, the Choi matrix is separable.

    This is the implication established directly by in1243_five_sep.

    line 229

    uses in1243_five_sep

      · exact in1243_five_sep t h0
AddChar.map_neg_eq_conj
An additive character evaluates on the negative of an element as the complex conjugate of its value on that element.
AddChar.sum_mulShift
The sum of a primitive character shifted by multiples of b equals the cardinality of the ring if b = 0, and 0 otherwise.
Complex.star_def
The involution on complex numbers is complex conjugation.
Complex.conj_ofReal
The complex conjugate of a real number is itself.
Complex.conj_natCast
The complex conjugate of a natural number is itself.
Complex.ofReal_mul
Casting the product of two real numbers to ℂ gives the product of their complex embeddings.
Complex.ofReal_sum
Casting a finite sum of real numbers to ℂ equals the sum of their complex embeddings.
Equiv.sum_comp
Reindexing a sum over a finite type by an equivalence does not change its value.
Equiv.symm_apply_apply
Applying an equivalence after its inverse is the identity.
Equiv.subLeft_apply
The equivalence x ↦ a - x maps x to a - x.
Fin.append_left
The concatenation of two Fin-indexed families evaluated on an index in the left block gives the left family's value.
Fin.append_right
The concatenation of two Fin-indexed families evaluated on an index in the right block gives the right family's value.
Fin.sum_univ_add
A sum over Fin (a + b) splits as the sum over the first a elements plus the sum over the remaining b elements.
Fin.sum_univ_succ
A sum over Fin (n+1) splits into the first term at 0 plus the sum over the remaining n terms.
Finset.induction_on
Induction principle for finite sets: a property holds for all finite sets if it holds for the empty set and is preserved by adjoining a fresh element.
Finset.mem_insert_of_mem
If an element belongs to s, it belongs to insert b s.
Finset.mem_insert_self
An element belongs to the set obtained by inserting it into any finite set.
Finset.mul_sum
Multiplication distributes over a finite sum.
Finset.sum_congr
Two finite sums are equal if their index sets are equal and their summands agree on all elements.
Finset.sum_comm
The order of two independent finite summations can be interchanged.
Finset.sum_eq_single
A sum over a finite set reduces to a single term if all other terms are zero.
Finset.sum_insert
Summing over insert a s equals the term at a plus the sum over s, provided a ∉ s.
Fintype.sum_prod_type
A sum over a product type α × β can be written as an iterated sum over α and then over β.
if_neg
A conditional expression evaluates to its 'else' branch when the condition is false.
if_pos
A conditional expression evaluates to its 'then' branch when the condition holds.
in1243_choi_linear
The Choi matrix map is linear with respect to linear combinations of matrices.
in1243_eint
Algebraic identity verifying that the 9 basis matrices are generated by twirled product forms of integer vectors.
in1243_env_decomp
Entrywise decomposition of the two-level environment matrix into the 9 basis matrices with coefficients depending on t.
in1243_env_decomp2
Matrix-level decomposition of the two-level environment into a linear combination of 9 twirled matrices.
in1243_five_sep
For d = 5, r = 2, and p = 1/5, the Choi matrix of the two-level environment is separable whenever 0 ≤ t ≤ 1/3.
in1243_sep_add
The sum of two separable matrices is separable.
in1243_sep_smul
A non-negative scalar multiple of a separable bipartite matrix is separable.
in1243_sep_sum
A finite sum of separable bipartite matrices is separable.
in1243_twirl_sep
The Choi matrix of any twirled matrix defined from two real vectors is separable.
in1243_chi_add
The standard additive character on Fin (n+2) maps addition to multiplication.
in1243_chi_star
The complex conjugate of the standard additive character at u is the character at -u.
in1243_chi_sum
The sum of the standard additive character over multiples by m equals n+2 when m = 0, and 0 otherwise.
in1243b_cast
The canonical map from Fin (n+2) to ℕ and then into ZMod (n+2) coincides with the identity on Fin (n+2).
in1243b_entry
The Choi matrix entries for prime_convolution_choi can be expressed with Fin (n+2) ring arithmetic.
Matrix.add_apply
The (i, j)-th entry of a matrix sum A + B is the sum of the entries A i j + B i j.
Matrix.of_apply
Evaluating a matrix defined by a function at an index pair (i, j) yields the function applied to (i, j).
Matrix.smul_apply
The (i, j)-th entry of a scalar multiple c • A is c • A i j.
Matrix.sum_apply
The (i, j)-th entry of a finite sum of matrices is the finite sum of their (i, j)-th entries.
Nat.cast_zero
The natural number 0 casts to 0 in any ring.
prime_convolution_separable_imp_threshold
For prime d ≥ 5 and non-degenerate parameters, separability of the Choi matrix implies t ≤ 1 / (1 + d √(p(1-p))).
Real.mul_self_sqrt
For any non-negative real x, (√x) * (√x) = x.
Real.sq_sqrt
The square of the square root of a non-negative real x is x.
Real.sqrt_mul
The square root of a product of non-negative reals is the product of their square roots.
Real.sqrt_sq
The square root of the square of a non-negative real x is x.
smul_eq_mul
Scalar multiplication in a ring or field is ordinary multiplication.
star_mul'
In a commutative ring with involution, star (x * y) = star x * star y.
ZMod.card
The cardinality of ZMod n is n.
ZMod.isPrimitive_stdAddChar
The standard additive character on ZMod N is primitive.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

open Fin.CommRing intheorem in1243b_cast (n : ℕ) (a : Fin (n+2)) : (((a : ℕ) : ZMod (n+2))) = a :=  ZMod.natCast_zmod_val (n := n+2) aopen Fin.CommRing intheorem in1243b_entry (n : ℕ) (r : Fin (n+2)) (σ : Matrix (Fin (n+2)) (Fin (n+2)) ℂ)    (x y : Fin (n+2) × Fin (n+2)) :    prime_convolution_choi (n+2) r σ x y = (1 / ((n+2 : ℕ) : ℂ)) * ∑ j : Fin (n+2), ∑ l : Fin (n+2),      if x.2 = r * x.1 + j ∧ y.2 = r * y.1 + l ∧ x.1 + j = y.1 + l then σ j l else 0 := by  simp only [prime_convolution_choi, Matrix.of_apply]  congr 1  refine Finset.sum_congr rfl fun j _ => Finset.sum_congr rfl fun l _ => ?_  have e : ∀ a : Fin (n+2), (((a : ℕ) : ZMod (n+2))) = a := in1243b_cast n  erw [e x.1, e x.2, e y.1, e y.2, e j, e l]  rflopen Fin.CommRing intheorem in1243_chi_add (n : ℕ) (u v : Fin (n+2)) :    (ZMod.stdAddChar (N := n+2) ((u + v : Fin (n+2)))) = ZMod.stdAddChar (N := n+2) u * ZMod.stdAddChar (N := n+2) v :=  AddChar.map_add_eq_mul _ u vopen Fin.CommRing intheorem in1243_chi_star (n : ℕ) (u : Fin (n+2)) :    star (ZMod.stdAddChar (N := n+2) u) = ZMod.stdAddChar (N := n+2) ((-u : Fin (n+2))) := by  exact (AddChar.map_neg_eq_conj (ZMod.stdAddChar (N := n+2)) (u : ZMod (n+2))).symmopen Fin.CommRing intheorem in1243_chi_sum (n : ℕ) (m : Fin (n+2)) :    ∑ c : Fin (n+2), ZMod.stdAddChar (N := n+2) ((c * m : Fin (n+2))) = if m = 0 then ((n+2 : ℕ) : ℂ) else 0 := by  have := AddChar.sum_mulShift (R := ZMod (n+2)) (ψ := ZMod.stdAddChar (N := n+2)) (m : ZMod (n+2))    (ZMod.isPrimitive_stdAddChar (n+2))  rw [ZMod.card] at this  refine Eq.trans this ?_  by_cases h : m = 0  · rw [if_pos h]    exact congrArg Nat.cast (if_pos (show (m : ZMod (n+2)) = 0 from h))  · rw [if_neg h]    exact (congrArg Nat.cast (if_neg (show ¬ (m : ZMod (n+2)) = 0 from h))).trans Nat.cast_zerotheorem in1243_sep_add (dA dB : ℕ) (A B : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)    (hA : matrix_is_separable dA dB A) (hB : matrix_is_separable dA dB B) :    matrix_is_separable dA dB (A + B) := by  obtain ⟨N1, x1, y1, h1⟩ := hA  obtain ⟨N2, x2, y2, h2⟩ := hB  refine ⟨N1 + N2, Fin.append x1 x2, Fin.append y1 y2, fun p q => ?_⟩  rw [Fin.sum_univ_add, Matrix.add_apply, h1, h2]  simp only [Fin.append_left, Fin.append_right]theorem in1243_sep_smul (dA dB : ℕ) (c : ℝ) (hc : 0 ≤ c) (A : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)    (hA : matrix_is_separable dA dB A) : matrix_is_separable dA dB ((c : ℂ) • A) := by  obtain ⟨N, x, y, h⟩ := hA  refine ⟨N, fun i a => (Real.sqrt c : ℂ) * x i a, y, fun p q => ?_⟩  rw [Matrix.smul_apply, h, smul_eq_mul, Finset.mul_sum]  refine Finset.sum_congr rfl fun i _ => ?_  have hs : (Real.sqrt c : ℂ) * (Real.sqrt c : ℂ) = (c : ℂ) := by    rw [← Complex.ofReal_mul, Real.mul_self_sqrt hc]  rw [star_mul', Complex.star_def, Complex.conj_ofReal, ← hs]  ringtheorem in1243_sep_sum (dA dB : ℕ) {ι : Type*} (s : Finset ι)    (f : ι → Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)    (h : ∀ i ∈ s, matrix_is_separable dA dB (f i)) : matrix_is_separable dA dB (∑ i ∈ s, f i) := by  classical  induction s using Finset.induction_on with  | empty => exact ⟨0, fun _ _ => 0, fun _ _ => 0, fun p q => by simp⟩  | insert i s hi ih =>    rw [Finset.sum_insert hi]    exact in1243_sep_add _ _ _ _ (h i (Finset.mem_insert_self _ _))      (ih fun j hj => h j (Finset.mem_insert_of_mem hj))theorem in1243_choi_linear (d : ℕ) (r : ZMod d) {ι : Type*} (s : Finset ι) (c : ι → ℝ)    (σ : ι → Matrix (Fin d) (Fin d) ℂ) :    prime_convolution_choi d r (∑ i ∈ s, (c i : ℂ) • σ i) =      ∑ i ∈ s, (c i : ℂ) • prime_convolution_choi d r (σ i) := by  ext x y  simp only [prime_convolution_choi, Matrix.of_apply, Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul]  have hite : ∀ (P : Prop) [Decidable P] (g : ι → ℂ),      (if P then ∑ i ∈ s, g i else 0) = ∑ i ∈ s, if P then g i else 0 := by    intro P _ g; split_ifs <;> simp  simp only [hite, Finset.mul_sum]  calc _ = ∑ j : Fin d, ∑ i ∈ s, ∑ l : Fin d, (1 / (d : ℂ)) * (if ((x.2 : ℕ) : ZMod d) = r * ((x.1 : ℕ) : ZMod d) + ((j : ℕ) : ZMod d) ∧        ((y.2 : ℕ) : ZMod d) = r * ((y.1 : ℕ) : ZMod d) + ((l : ℕ) : ZMod d) ∧        ((x.1 : ℕ) : ZMod d) + ((j : ℕ) : ZMod d) = ((y.1 : ℕ) : ZMod d) + ((l : ℕ) : ZMod d)        then (c i : ℂ) * σ i j l else 0) := Finset.sum_congr rfl fun j _ => Finset.sum_comm    _ = _ := Finset.sum_comm    _ = _ := by      refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Finset.sum_congr rfl fun l _ => ?_      split_ifs <;> ringopen Fin.CommRing intheorem in1243_twirl_sep (n : ℕ) (r : Fin (n+2)) (a b : Fin (n+2) → ℝ) :    matrix_is_separable (n+2) (n+2) (prime_convolution_choi (n+2) r (Matrix.of fun j l =>      ((∑ i, a i * b (r * i + j) * a (i + j - l) * b (r * (i + j - l) + l) : ℝ) : ℂ))) := by  refine ⟨(n+2) * (n+2),    fun k i => (1 / ((n+2 : ℕ) : ℂ)) * (a (i - (finProdFinEquiv.symm k).1) : ℂ) *      ZMod.stdAddChar (N := n+2) (((finProdFinEquiv.symm k).2 * ((1 - r) * i) : Fin (n+2))),    fun k i => (b (i - r * (finProdFinEquiv.symm k).1) : ℂ) *      ZMod.stdAddChar (N := n+2) (((finProdFinEquiv.symm k).2 * i : Fin (n+2))), fun p q => ?_⟩  rw [← Equiv.sum_comp finProdFinEquiv]  simp only [Equiv.symm_apply_apply]  rw [Fintype.sum_prod_type]  have hN : ((n+2 : ℕ) : ℂ) ≠ 0 := by exact_mod_cast (by omega : n + 2 ≠ 0)  -- the right side  have hR : ∀ x : Fin (n+2), (∑ c : Fin (n+2),      (1 / ((n+2 : ℕ) : ℂ)) * (a (p.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * p.1) : Fin (n+2))) *        star ((1 / ((n+2 : ℕ) : ℂ)) * (a (q.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * q.1) : Fin (n+2)))) *      ((b (p.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * p.2 : Fin (n+2))) *        star ((b (q.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * q.2 : Fin (n+2)))))) =      (1 / ((n+2 : ℕ) : ℂ)) * (if (1 - r) * p.1 + p.2 = (1 - r) * q.1 + q.2 then        ((a (p.1 - x) * a (q.1 - x) * b (p.2 - r * x) * b (q.2 - r * x) : ℝ) : ℂ) else 0) := by    intro x    have hc : ∀ c : Fin (n+2), (1 / ((n+2 : ℕ) : ℂ)) * (a (p.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * p.1) : Fin (n+2))) *        star ((1 / ((n+2 : ℕ) : ℂ)) * (a (q.1 - x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * ((1 - r) * q.1) : Fin (n+2)))) *      ((b (p.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * p.2 : Fin (n+2))) *        star ((b (q.2 - r * x) : ℂ) * ZMod.stdAddChar (N := n+2) ((c * q.2 : Fin (n+2))))) =        (1 / ((n+2 : ℕ) : ℂ)) * (1 / ((n+2 : ℕ) : ℂ)) *          ((a (p.1 - x) * a (q.1 - x) * b (p.2 - r * x) * b (q.2 - r * x) : ℝ) : ℂ) *          ZMod.stdAddChar (N := n+2) ((c * (((1 - r) * p.1 + p.2) - ((1 - r) * q.1 + q.2)) : Fin (n+2))) := by      intro c      simp only [star_mul', in1243_chi_star, Complex.star_def, Complex.conj_ofReal, map_div₀, map_one,        Complex.conj_natCast]      have e : c * (((1 - r) * p.1 + p.2) - ((1 - r) * q.1 + q.2)) =          c * ((1 - r) * p.1) + -(c * ((1 - r) * q.1)) + (c * p.2 + -(c * q.2)) := by ring      rw [e, in1243_chi_add, in1243_chi_add, in1243_chi_add]      push_cast      ring    rw [Finset.sum_congr rfl fun c _ => hc c, ← Finset.mul_sum, in1243_chi_sum]    by_cases hm : (1 - r) * p.1 + p.2 = (1 - r) * q.1 + q.2    · rw [if_pos (sub_eq_zero.mpr hm), if_pos hm]      field_simp    · rw [if_neg (fun h => hm (sub_eq_zero.mp h)), if_neg hm]      simp  rw [Finset.sum_congr rfl fun x _ => hR x, ← Finset.mul_sum]  rw [in1243b_entry]  congr 1  rw [Finset.sum_eq_single (p.2 - r * p.1)]  · rw [Finset.sum_eq_single (q.2 - r * q.1)]    · by_cases hm : (1 - r) * p.1 + p.2 = (1 - r) * q.1 + q.2      · have hc : p.2 = r * p.1 + (p.2 - r * p.1) ∧ q.2 = r * q.1 + (q.2 - r * q.1) ∧            p.1 + (p.2 - r * p.1) = q.1 + (q.2 - r * q.1) :=          ⟨by ring, by ring, by linear_combination hm⟩        rw [if_pos hc, Matrix.of_apply]        simp only [if_pos hm]        rw [← Complex.ofReal_sum]        congr 1        rw [← Equiv.sum_comp (Equiv.subLeft p.1)]        refine Finset.sum_congr rfl fun x _ => ?_        simp only [Equiv.subLeft_apply]        have e1 : r * (p.1 - x) + (p.2 - r * p.1) = p.2 - r * x := by ring        have e2 : p.1 - x + (p.2 - r * p.1) - (q.2 - r * q.1) = q.1 - x := by linear_combination hm        rw [e1, e2]        have e3 : r * (q.1 - x) + (q.2 - r * q.1) = q.2 - r * x := by ring        rw [e3]        ring      · rw [if_neg]        · simp [hm]        rintro ⟨_, _, h⟩        exact hm (by linear_combination h)    · intro l _ hl      rw [if_neg]      rintro ⟨_, h, _⟩      exact hl (by rw [h]; ring)    · intro h; exact absurd (Finset.mem_univ _) h  · intro j _ hj    refine Finset.sum_eq_zero fun l _ => ?_    rw [if_neg]    rintro ⟨h, _, _⟩    exact hj (by rw [h]; ring)  · intro h; exact absurd (Finset.mem_univ _) hopen Fin.CommRing intheorem in1243_eint : ∀ (k : Fin 9) (j l : Fin 5),    (∑ i : Fin 5, ((![![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) i *        ((![![1, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 1], ![1, -1, 1, 1, 0], ![1, 1, -1, 1, 0], ![0, 1, 0, 0, 0], ![0, 1, -1, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) (2 * i + j) *        ((![![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) (i + j - l) *        ((![![1, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 1], ![1, -1, 1, 1, 0], ![1, 1, -1, 1, 0], ![0, 1, 0, 0, 0], ![0, 1, -1, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) (2 * (i + j - l) + l)) =      (![![![1, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 1]], ![![2, 1, 0, 0, 1], ![1, 2, -1, 0, 0], ![0, -1, 1, 0, 0], ![0, 0, 0, 2, 0], ![1, 0, 0, 0, 1]], ![![2, 1, 0, 0, -1], ![1, 2, 1, 0, 0], ![0, 1, 1, 0, 0], ![0, 0, 0, 2, 0], ![-1, 0, 0, 0, 1]], ![![0, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![1, 1, 0, 0, 0], ![1, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 1]]] : Fin 9 → Fin 5 → Fin 5 → ℤ) k j l := by  decidetheorem in1243_env_decomp (t : ℝ) (j l : Fin 5) :    two_level_environment 5 (1/5) t j l = ∑ k : Fin 9, ((((![(1 - 3 * t) / 5, (1 - 3 * t) / 5, (1 - 3 * t) / 5, (1 - 3 * t) / 5, (1 - 3 * t) / 5, t / 10, t / 10, 3 * t / 5, t / 5] : Fin 9 → ℝ) k) : ℝ) : ℂ) *      (((![![![1, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 0]], ![![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 1]], ![![2, 1, 0, 0, 1], ![1, 2, -1, 0, 0], ![0, -1, 1, 0, 0], ![0, 0, 0, 2, 0], ![1, 0, 0, 0, 1]], ![![2, 1, 0, 0, -1], ![1, 2, 1, 0, 0], ![0, 1, 1, 0, 0], ![0, 0, 0, 2, 0], ![-1, 0, 0, 0, 1]], ![![0, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 0]], ![![1, 1, 0, 0, 0], ![1, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 0, 0], ![0, 0, 0, 0, 1]]] : Fin 9 → Fin 5 → Fin 5 → ℤ) k j l : ℤ) : ℂ) := by  have hs : Real.sqrt (1 - 1/5) = 2 * Real.sqrt (1/5) := by    rw [show (1:ℝ) - 1/5 = 2^2 * (1/5) by norm_num, Real.sqrt_mul (by norm_num), Real.sqrt_sq (by norm_num)]  have hss : ((Real.sqrt (1/5) : ℝ) : ℂ) * ((Real.sqrt (1/5) : ℝ) : ℂ) = 1/5 := by    rw [← Complex.ofReal_mul, Real.mul_self_sqrt (by norm_num)]; push_cast; ring  have h5 : ((Real.sqrt 5 : ℝ) : ℂ)⁻¹ ^ 2 = 1/5 := by    rw [inv_pow, ← Complex.ofReal_pow, Real.sq_sqrt (by norm_num)]; push_cast; ring  simp only [two_level_environment, Matrix.of_apply, hs]  fin_cases j <;> fin_cases l <;>    simp [Fin.sum_univ_succ, h5] <;>    first | ring1 | linear_combination t * h5 | linear_combination 2 * t * h5 | linear_combination 4 * t * h5open Fin.CommRing intheorem in1243_env_decomp2 (t : ℝ) :    two_level_environment 5 (1/5) t = ∑ k : Fin 9, ((((![(1 - 3 * t) / 5, (1 - 3 * t) / 5, (1 - 3 * t) / 5, (1 - 3 * t) / 5, (1 - 3 * t) / 5, t / 10, t / 10, 3 * t / 5, t / 5] : Fin 9 → ℝ) k) : ℝ) : ℂ) •        Matrix.of fun j l => ((∑ i : Fin 5, ((((![![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) i : ℤ) : ℝ) *          ((((![![1, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 1], ![1, -1, 1, 1, 0], ![1, 1, -1, 1, 0], ![0, 1, 0, 0, 0], ![0, 1, -1, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) (2 * i + j) : ℤ) : ℝ) *          ((((![![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) (i + j - l) : ℤ) : ℝ) *          ((((![![1, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 1], ![1, -1, 1, 1, 0], ![1, 1, -1, 1, 0], ![0, 1, 0, 0, 0], ![0, 1, -1, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) (2 * (i + j - l) + l) : ℤ) : ℝ) : ℝ) : ℂ) := by  ext j l  rw [in1243_env_decomp, Matrix.sum_apply]  refine Finset.sum_congr rfl fun k _ => ?_  rw [Matrix.smul_apply, smul_eq_mul, Matrix.of_apply, ← in1243_eint]  push_cast  rflopen Fin.CommRing intheorem in1243_five_sep (t : ℝ) (h0 : 0 ≤ t) (ht : t ≤ 1 / 3) :    matrix_is_separable 5 5 (prime_convolution_choi 5 2 (two_level_environment 5 (1/5) t)) := by  rw [in1243_env_decomp2, in1243_choi_linear]  refine in1243_sep_sum _ _ _ _ fun k _ => in1243_sep_smul _ _ _ ?_ _ ?_  · fin_cases k <;> simp <;> linarith  · exact in1243_twirl_sep 3 2 (fun i => ((((![![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, -1, 0, 0, 0], ![1, 0, 0, 0, 0], ![1, -1, 0, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) i : ℤ) : ℝ))      (fun i => ((((![![1, 0, 0, 0, 0], ![0, 1, 0, 0, 0], ![0, 0, 1, 0, 0], ![0, 0, 0, 1, 0], ![0, 0, 0, 0, 1], ![1, -1, 1, 1, 0], ![1, 1, -1, 1, 0], ![0, 1, 0, 0, 0], ![0, 1, -1, 0, 0]] : Fin 9 → Fin 5 → ℤ) k) i : ℤ) : ℝ))theorem prime_convolution_five_two_fifth_entanglement_breaking_iff (t : ℝ) (h0 : 0 ≤ t) (h1 : t ≤ 1) :    matrix_is_separable 5 5 (prime_convolution_choi 5 2 (two_level_environment 5 (1/5) t)) ↔ t ≤ 1 / 3 := by  constructor  · intro h    have key := prime_convolution_separable_imp_threshold 5 (by norm_num) le_rfl 2 (by decide) (by decide)      (by decide) (1/5) t (by norm_num) (by norm_num) h0 h1 h    have hsq : Real.sqrt (1/5 * (1 - 1/5)) = 2/5 := by      rw [show (1:ℝ)/5 * (1 - 1/5) = (2/5)^2 by norm_num]; exact Real.sqrt_sq (by norm_num)    rw [hsq] at key    norm_num at key    linarith  · exact in1243_five_sep t h0
See it in the graphDiscuss this resultChallenge it