AFTD Auto-Formalizing Theoretical Domains

matrix_is_separable_has_ppt_bosonic_extension

theoremverifiedformalization

For all natural numbers dA, dB, k and every matrix ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ, if ρ is separable (matrix_is_separable dA dB ρ) then ρ has a PPT bosonic k-extension (has_ppt_bosonic_extension dA dB k ρ). So every level of the hierarchy contains the separable operators.

Statement

theorem matrix_is_separable_has_ppt_bosonic_extension (dA dB k : ℕ)
    (ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)
    (hρ : matrix_is_separable dA dB ρ) : has_ppt_bosonic_extension dA dB k ρ
Formalizes
arXiv:quant-ph/0308032 (complete family of separability criteria), Section III: every separable state has a PPT symmetric extension to any number of copies (the easy direction of the hierarchy). Stated for unnormalised operators.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • matrix_is_separableWith dA dB : ℕ explicit arguments, in this order, and ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ, the proposition that ρ is…
  • has_ppt_bosonic_extensionWith dA dB k : ℕ explicit arguments, in this order, and ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ, the proposition that ρ has a PPT…

Read back from the Lean

For all natural numbers dA, dB, and k, and every complex matrix ρ indexed by (Fin dA × Fin dB) × (Fin dA × Fin dB), if ρ is separable across the bipartition (matrix_is_separable dA dB ρ), then ρ admits a PPT bosonic extension of length k (has_ppt_bosonic_extension dA dB k ρ).

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

To construct a PPT bosonic k-extension for a separable bipartite state ρ, we first normalize its decomposition ρ = ∑_i x_i x_i* ⊗ y_i y_i* so that each y_i is a unit vector whenever x_i ≠ 0. We then define the extension on A ⊗ B^⊗k by Ω = ∑_i x_i x_i* ⊗ (y_i y_i*)^⊗k. Permuting the k copies of system B merely permutes the complex factors in a product, giving Bose symmetry; tracing out any k-1 copies of B replaces each copy with Tr(y_i y_i*) = 1, recovering ρ; and taking the partial transpose across any subset of copies preserves the product-state structure, leaving Ω a sum of positive semidefinite rank-one matrices.

  1. Extract a separable decomposition ρ = ∑_i x_i x_i* ⊗ y_i y_i* and re-scale each y_i by its ℓ₂-norm and x_i by that same norm.

    By the assumption of separability, ρ is represented as a finite sum of product terms x_i x_i* ⊗ y_i y_i*. The sum of squared norms ∑_b |y_i(b)|² is non-negative by Finset.sum_nonneg and Complex.normSq_nonneg. We provide witness vectors where each y_i is divided by ||y_i|| = √(∑_b |y_i(b)|²) and each x_i is multiplied by ||y_i||.

    lines 1–11

    uses Finset.sum_nonneg, Complex.normSq_nonneg

    theorem in1187_normalize (dA dB : ℕ) (ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)
        (hρ : matrix_is_separable dA dB ρ) :
        ∃ (N : ℕ) (x : Fin N → Fin dA → ℂ) (y : Fin N → Fin dB → ℂ),
          (∀ i, (∑ b, y i b * star (y i b)) = 1 ∨ x i = 0) ∧
          ∀ p q : Fin dA × Fin dB,
            ρ p q = ∑ i : Fin N, x i p.1 * star (x i q.1) * (y i p.2 * star (y i q.2)) := by
      obtain ⟨N, x, y, h⟩ := hρ
      have hnn : ∀ i, 0 ≤ ∑ b, Complex.normSq (y i b) :=
        fun i => Finset.sum_nonneg fun b _ => Complex.normSq_nonneg _
      refine ⟨N, fun i a => ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) * x i a,
        fun i b => y i b / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ), ?_, ?_⟩
  2. For each i, the rescaled vector y_i has unit norm ∑_b |y_i(b)|² = 1 unless ||y_i|| = 0, in which case the rescaled x_i is zero.

    Case split on whether ||y_i|| = √(∑_b |y_i(b)|²) is 0. If it is 0, the rescaled vector x_i is 0. If it is non-zero, ||y_i|| is real and non-zero, so its conjugate equals itself (Complex.conj_ofReal). Distributing conjugation across division (star_div₀) and factoring the denominator out of the sum (Finset.sum_div), the sum of products y_i(b) star(y_i(b)) = |y_i(b)|² (Complex.mul_conj) equals ||y_i||² (Real.sq_sqrt). Dividing this non-zero value by itself yields 1 (div_self, pow_ne_zero).

    lines 12–32

    uses Complex.conj_ofReal, Complex.ofReal_pow, Real.sq_sqrt, Finset.sum_congr, Complex.star_def, Complex.mul_conj, star_div₀, Finset.sum_div, div_self, pow_ne_zero

      · intro i
        by_cases hr : Real.sqrt (∑ b, Complex.normSq (y i b)) = 0
        · right; funext a; simp [hr]
        · left
          have hrc : ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hr
          have hsr : star ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) =
              ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) := Complex.conj_ofReal _
          have hsum : (∑ b, y i b * star (y i b)) =
              ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ^ 2 := by
            rw [← Complex.ofReal_pow, Real.sq_sqrt (hnn i)]
            push_cast
            refine Finset.sum_congr rfl fun b _ => ?_
            rw [Complex.star_def, Complex.mul_conj]
          have hterm : ∀ b, y i b / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) *
              star (y i b / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ)) =
              (y i b * star (y i b)) / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ^ 2 := by
            intro b
            rw [star_div₀, hsr]; ring
          simp only [hterm]
          rw [← Finset.sum_div, hsum]
          exact div_self (pow_ne_zero 2 hrc)
  3. The rescaled vectors still sum to ρ, preserving the matrix entries.

    For each matrix element (p, q), we verify that each summand matches the original decomposition. If ||y_i|| = 0, the sum of squared norms is zero (Real.sqrt_eq_zero), so y_i(b) = 0 for all b (Finset.sum_eq_zero_iff_of_nonneg, Finset.mem_univ), making both sides zero. If ||y_i|| ≠ 0, the norm is real (Complex.conj_ofReal), and distributing the involution (star_mul', star_div₀) allows the two factors of ||y_i|| in the numerator to cancel the two in the denominator.

    lines 33–49

    uses Real.sqrt_eq_zero, Finset.sum_eq_zero_iff_of_nonneg, Complex.normSq_nonneg, Finset.mem_univ, Complex.conj_ofReal, star_mul', star_div₀

      · intro p q
        rw [h p q]
        refine Finset.sum_congr rfl fun i _ => ?_
        by_cases hr : Real.sqrt (∑ b, Complex.normSq (y i b)) = 0
        · have h0 : ∑ b, Complex.normSq (y i b) = 0 := (Real.sqrt_eq_zero (hnn i)).1 hr
          have hy : ∀ b, y i b = 0 := by
            intro b
            have hb := (Finset.sum_eq_zero_iff_of_nonneg
              (fun b _ => Complex.normSq_nonneg (y i b))).1 h0 b (Finset.mem_univ _)
            exact Complex.normSq_eq_zero.1 hb
          simp [hy, hr]
        · have hrc : ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hr
          have hsr : star ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) =
              ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) := Complex.conj_ofReal _
          rw [star_mul', star_div₀, hsr]
          field_simp
    
  4. Obtain the normalized decomposition of ρ and define the candidate bosonic extension Ω on ℂ^(dA) ⊗ (ℂ^(dB))^⊗k.

    Using the normalization lemma in1187_normalize, we write ρ = ∑_i x_i x_i* ⊗ y_i y_i* where ||y_i||² = 1 whenever x_i ≠ 0. We define the candidate extension Ω entrywise as Matrix.of (fun p q => ∑_i x_i(p.1) star(x_i(q.1)) * ∏_j y_i(p.2 j) star(y_i(q.2 j))), which represents the operator ∑_i x_i x_i* ⊗ (y_i y_i*)^⊗k.

    lines 50–56

    uses in1187_normalize, Matrix.of

    theorem matrix_is_separable_has_ppt_bosonic_extension (dA dB k : ℕ)
        (ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)
        (hρ : matrix_is_separable dA dB ρ) : has_ppt_bosonic_extension dA dB k ρ := by
      open scoped ComplexOrder in
      obtain ⟨N, x, y, hn, h⟩ := in1187_normalize dA dB ρ hρ
      refine ⟨Matrix.of fun p q => ∑ i : Fin N, x i p.1 * star (x i q.1) *
          ∏ j : Fin k, (y i (p.2 j) * star (y i (q.2 j))), ?_, ?_, ?_⟩
  5. Ω is Bose symmetric under any permutation π of the k copies of system B.

    Applying a permutation π to the second coordinate replaces p.2 j with p.2(π j). Factoring the product of products into two separate products (Finset.prod_mul_distrib) and re-indexing the product over Fin k along the permutation π (Equiv.prod_comp) shows that ∏_j y_i(p.2(π j)) = ∏_j y_i(p.2 j), leaving the matrix entry unchanged.

    lines 57–62

    uses Matrix.of_apply, Function.comp_apply, Finset.sum_congr, Finset.prod_mul_distrib, Equiv.prod_comp

      · intro π p q
        simp only [Matrix.of_apply, Function.comp_apply]
        refine Finset.sum_congr rfl fun i _ => ?_
        congr 1
        rw [Finset.prod_mul_distrib, Finset.prod_mul_distrib,
          Equiv.prod_comp π (fun j => y i (p.2 j))]
  6. The marginal condition tracing out all copies except copy i₀ is reformulated entrywise as a product of factors for each j ∈ Fin k.

    For any configuration f : Fin k → Fin dB, if f(i₀) = p.2, the product over j decomposes into y_i(p.2) star(y_i(q.2)) at j = i₀ and |y_i(f j)|² for j ≠ i₀ by Function.update_of_ne. If f(i₀) ≠ p.2, the condition forces the term to zero by Finset.prod_eq_zero and mul_zero.

    lines 63–83

    uses Matrix.of_apply, Finset.sum_congr, Finset.prod_congr, Function.update_of_ne, Finset.sum_eq_zero, Finset.prod_eq_zero, Finset.mem_univ, mul_zero

      · intro i₀ p q
        rw [h p q]
        simp only [Matrix.of_apply]
        have hf : ∀ f : Fin k → Fin dB,
            (if f i₀ = p.2 then ∑ i : Fin N, x i p.1 * star (x i q.1) *
              ∏ j, (y i (f j) * star (y i (Function.update f i₀ q.2 j))) else 0) =
            ∑ i : Fin N, x i p.1 * star (x i q.1) *
              ∏ j, (if j = i₀ then (if f j = p.2 then y i p.2 * star (y i q.2) else 0)
                else y i (f j) * star (y i (f j))) := by
          intro f
          split_ifs with hfi
          · refine Finset.sum_congr rfl fun i _ => ?_
            congr 1
            refine Finset.prod_congr rfl fun j _ => ?_
            by_cases hj : j = i₀
            · subst hj; simp [hfi]
            · simp [hj, Function.update_of_ne hj]
          · symm
            refine Finset.sum_eq_zero fun i _ => ?_
            rw [Finset.prod_eq_zero (Finset.mem_univ i₀) (by simp [hfi]), mul_zero]
        simp only [hf]
  7. Summing over all configurations f evaluates the partial trace, recovering ρ.

    We swap the sum over configurations f and the sum over components i (Finset.sum_comm). Distributing the product over the summation via Finset.prod_univ_sum and Fintype.piFinset_univ factors the sum over f into a product over j ∈ Fin k of sums over c ∈ Fin dB. For j ≠ i₀, the sum equals ∑_c |y_i(c)|² = 1 (by the normalization hypothesis hn), while for j = i₀ the sum collapses to y_i(p.2) star(y_i(q.2)) (Finset.prod_ite_eq', Finset.univ). The product over all j thus simplifies to y_i(p.2) star(y_i(q.2)), matching ρ(p, q).

    lines 84–102

    uses Finset.sum_comm, Finset.sum_congr, Finset.mul_sum, Finset.prod_univ_sum, Finset.univ, Fintype.piFinset_univ, Finset.prod_ite_eq'

        rw [Finset.sum_comm]
        refine Finset.sum_congr rfl fun i _ => ?_
        rw [← Finset.mul_sum]
        have hps := Finset.prod_univ_sum (fun (_ : Fin k) => (Finset.univ : Finset (Fin dB)))
          (fun j c => if j = i₀ then (if c = p.2 then y i p.2 * star (y i q.2) else 0)
            else y i c * star (y i c))
        rw [Fintype.piFinset_univ] at hps
        rw [← hps]
        rcases hn i with h1 | h0
        · have hj : ∀ j : Fin k, (∑ c, (if j = i₀ then (if c = p.2 then y i p.2 * star (y i q.2) else 0)
              else y i c * star (y i c))) = if j = i₀ then y i p.2 * star (y i q.2) else 1 := by
            intro j
            split_ifs with hji
            · simp
            · exact h1
          simp only [hj]
          rw [Finset.prod_ite_eq' Finset.univ i₀ (fun _ => y i p.2 * star (y i q.2))]
          simp
        · simp [h0]
  8. Ω satisfies the PPT condition: for every subset S ⊆ Fin k, the partial transpose of Ω with respect to S is positive semidefinite.

    Transposing subsystems in S swaps the coordinates p.2 j and q.2 j for j ∈ S. We express the partially transposed matrix as a sum of rank-one outer products ∑_i v_i v_i* where v_i(p) = x_i(p.1) * ∏_{j ∈ S} star(y_i(p.2 j)) * ∏_{j ∉ S} y_i(p.2 j) (Matrix.vecMulVec, star_prod, Finset.prod_mul_distrib, mul_comm). Since each rank-one matrix v v* is positive semidefinite (Matrix.posSemidef_vecMulVec_self_star), their finite sum is positive semidefinite (Matrix.posSemidef_sum).

    lines 103–122

    uses Matrix.vecMulVec, Matrix.of_apply, Matrix.sum_apply, Matrix.vecMulVec_apply, Pi.star_apply, Finset.sum_congr, star_mul', star_prod, mul_mul_mul_comm, Finset.prod_mul_distrib, Finset.prod_congr, mul_comm, Matrix.posSemidef_sum, Matrix.posSemidef_vecMulVec_self_star

      · intro S
        have hsum : (Matrix.of fun (p q : Fin dA × (Fin k → Fin dB)) =>
              (Matrix.of fun (p q : Fin dA × (Fin k → Fin dB)) =>
                ∑ i : Fin N, x i p.1 * star (x i q.1) * ∏ j : Fin k, (y i (p.2 j) * star (y i (q.2 j))))
              (p.1, fun i => if i ∈ S then q.2 i else p.2 i)
                (q.1, fun i => if i ∈ S then p.2 i else q.2 i)) =
            ∑ i : Fin N, Matrix.vecMulVec
              (fun p : Fin dA × (Fin k → Fin dB) =>
                x i p.1 * ∏ j : Fin k, (if j ∈ S then star (y i (p.2 j)) else y i (p.2 j)))
              (star (fun p : Fin dA × (Fin k → Fin dB) =>
                x i p.1 * ∏ j : Fin k, (if j ∈ S then star (y i (p.2 j)) else y i (p.2 j)))) := by
          ext p q
          simp only [Matrix.of_apply, Matrix.sum_apply, Matrix.vecMulVec_apply, Pi.star_apply]
          refine Finset.sum_congr rfl fun i _ => ?_
          rw [star_mul', star_prod, mul_mul_mul_comm, ← Finset.prod_mul_distrib]
          congr 1
          refine Finset.prod_congr rfl fun j _ => ?_
          by_cases hj : j ∈ S <;> simp [hj, mul_comm]
        rw [hsum]
        exact Matrix.posSemidef_sum _ fun i _ => Matrix.posSemidef_vecMulVec_self_star _
Finset.sum_nonneg
A finite sum of non-negative elements is non-negative.
Complex.normSq_nonneg
The squared complex norm |z|² is non-negative for any complex number z.
Complex.conj_ofReal
The complex conjugate of a real number (cast to ℂ) is itself.
Complex.ofReal_pow
Casting a power of a real number to ℂ equals the power of the cast.
Real.sq_sqrt
For x ≥ 0, (√x)² = x.
Finset.sum_congr
If two index sets are identical and their summands agree everywhere on the set, the finite sums are equal.
Complex.star_def
The star operation on complex numbers is complex conjugation.
Complex.mul_conj
For any complex number z, z * star z equals the real norm squared cast to ℂ.
star_div₀
In a division ring with involution, star (x / y) = star x / star y.
Finset.sum_div
Dividing a finite sum by a scalar equals summing each term divided by that scalar.
div_self
Any non-zero element divided by itself equals 1.
pow_ne_zero
Any non-zero element raised to a power n is non-zero.
Real.sqrt_eq_zero
For x ≥ 0, √x = 0 if and only if x = 0.
Finset.sum_eq_zero_iff_of_nonneg
A finite sum of non-negative terms is zero if and only if every term is zero.
Finset.mem_univ
Every element of a finite type belongs to the universal finset.
star_mul'
In a commutative star algebra, star (x * y) = star x * star y.
in1187_normalize
Any separable bipartite matrix has a decomposition ρ = ∑_i x_i x_i* ⊗ y_i y_i* where each y_i is normalized (||y_i||² = 1) unless x_i = 0.
Matrix.of
The equivalence between an index-pair function and a Matrix.
Matrix.of_apply
Entrywise application of Matrix.of: (Matrix.of f) i j = f i j.
Function.comp_apply
Evaluation of function composition: (f ∘ g) x = f (g x).
Finset.prod_mul_distrib
A finite product of termwise products distributes into the product of each factor.
Equiv.prod_comp
Re-indexing a finite product by a permutation (equivalence) leaves the product unchanged.
Finset.prod_congr
If two index sets are identical and their factors agree everywhere on the set, the finite products are equal.
Function.update_of_ne
Updating a function at a' does not change its value at a whenever a ≠ a'.
Finset.sum_eq_zero
A finite sum whose terms are all zero equals zero.
Finset.prod_eq_zero
A finite product with at least one zero factor equals zero.
mul_zero
Multiplying by zero on the right gives zero: a * 0 = 0.
Finset.sum_comm
Fubini's theorem for finite sums: exchanging the order of two finite summations preserves the sum.
Finset.mul_sum
Left-distributivity of multiplication over a finite sum: a * ∑_i f i = ∑_i (a * f i).
Finset.prod_univ_sum
Distributivity of products over sums: the product over indices of sums equals the sum over functions of products.
Finset.univ
The finset containing all elements of a finite type.
Fintype.piFinset_univ
The finset of functions into universal sets is the universal set of functions.
Finset.prod_ite_eq'
A product of factors that are all 1 except at a single index evaluates to the factor at that index.
Matrix.vecMulVec
The outer product matrix vecMulVec v w with entries v_i * w_j.
Matrix.sum_apply
Entrywise evaluation of a finite sum of matrices.
Matrix.vecMulVec_apply
Entrywise evaluation of an outer product matrix: (vecMulVec w v) i j = w i * v j.
Pi.star_apply
Componentwise application of the star involution to a function / vector.
star_prod
In a commutative monoid with involution, the star of a finite product is the product of the stars.
mul_mul_mul_comm
In a commutative semigroup, (a * b) * (c * d) = (a * c) * (b * d).
mul_comm
Multiplication is commutative: a * b = b * a.
Matrix.posSemidef_sum
A finite sum of positive semidefinite matrices is positive semidefinite.
Matrix.posSemidef_vecMulVec_self_star
The outer product v v* of any vector with its adjoint is positive semidefinite.

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

theorem in1187_normalize (dA dB : ℕ) (ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)    (hρ : matrix_is_separable dA dB ρ) :    ∃ (N : ℕ) (x : Fin N → Fin dA → ℂ) (y : Fin N → Fin dB → ℂ),      (∀ i, (∑ b, y i b * star (y i b)) = 1 ∨ x i = 0) ∧      ∀ p q : Fin dA × Fin dB,        ρ p q = ∑ i : Fin N, x i p.1 * star (x i q.1) * (y i p.2 * star (y i q.2)) := by  obtain ⟨N, x, y, h⟩ := hρ  have hnn : ∀ i, 0 ≤ ∑ b, Complex.normSq (y i b) :=    fun i => Finset.sum_nonneg fun b _ => Complex.normSq_nonneg _  refine ⟨N, fun i a => ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) * x i a,    fun i b => y i b / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ), ?_, ?_⟩  · intro i    by_cases hr : Real.sqrt (∑ b, Complex.normSq (y i b)) = 0    · right; funext a; simp [hr]    · left      have hrc : ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hr      have hsr : star ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) =          ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) := Complex.conj_ofReal _      have hsum : (∑ b, y i b * star (y i b)) =          ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ^ 2 := by        rw [← Complex.ofReal_pow, Real.sq_sqrt (hnn i)]        push_cast        refine Finset.sum_congr rfl fun b _ => ?_        rw [Complex.star_def, Complex.mul_conj]      have hterm : ∀ b, y i b / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) *          star (y i b / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ)) =          (y i b * star (y i b)) / ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ^ 2 := by        intro b        rw [star_div₀, hsr]; ring      simp only [hterm]      rw [← Finset.sum_div, hsum]      exact div_self (pow_ne_zero 2 hrc)  · intro p q    rw [h p q]    refine Finset.sum_congr rfl fun i _ => ?_    by_cases hr : Real.sqrt (∑ b, Complex.normSq (y i b)) = 0    · have h0 : ∑ b, Complex.normSq (y i b) = 0 := (Real.sqrt_eq_zero (hnn i)).1 hr      have hy : ∀ b, y i b = 0 := by        intro b        have hb := (Finset.sum_eq_zero_iff_of_nonneg          (fun b _ => Complex.normSq_nonneg (y i b))).1 h0 b (Finset.mem_univ _)        exact Complex.normSq_eq_zero.1 hb      simp [hy, hr]    · have hrc : ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hr      have hsr : star ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) =          ((Real.sqrt (∑ b, Complex.normSq (y i b)) : ℝ) : ℂ) := Complex.conj_ofReal _      rw [star_mul', star_div₀, hsr]      field_simptheorem matrix_is_separable_has_ppt_bosonic_extension (dA dB k : ℕ)    (ρ : Matrix (Fin dA × Fin dB) (Fin dA × Fin dB) ℂ)    (hρ : matrix_is_separable dA dB ρ) : has_ppt_bosonic_extension dA dB k ρ := by  open scoped ComplexOrder in  obtain ⟨N, x, y, hn, h⟩ := in1187_normalize dA dB ρ hρ  refine ⟨Matrix.of fun p q => ∑ i : Fin N, x i p.1 * star (x i q.1) *      ∏ j : Fin k, (y i (p.2 j) * star (y i (q.2 j))), ?_, ?_, ?_⟩  · intro π p q    simp only [Matrix.of_apply, Function.comp_apply]    refine Finset.sum_congr rfl fun i _ => ?_    congr 1    rw [Finset.prod_mul_distrib, Finset.prod_mul_distrib,      Equiv.prod_comp π (fun j => y i (p.2 j))]  · intro i₀ p q    rw [h p q]    simp only [Matrix.of_apply]    have hf : ∀ f : Fin k → Fin dB,        (if f i₀ = p.2 then ∑ i : Fin N, x i p.1 * star (x i q.1) *          ∏ j, (y i (f j) * star (y i (Function.update f i₀ q.2 j))) else 0) =        ∑ i : Fin N, x i p.1 * star (x i q.1) *          ∏ j, (if j = i₀ then (if f j = p.2 then y i p.2 * star (y i q.2) else 0)            else y i (f j) * star (y i (f j))) := by      intro f      split_ifs with hfi      · refine Finset.sum_congr rfl fun i _ => ?_        congr 1        refine Finset.prod_congr rfl fun j _ => ?_        by_cases hj : j = i₀        · subst hj; simp [hfi]        · simp [hj, Function.update_of_ne hj]      · symm        refine Finset.sum_eq_zero fun i _ => ?_        rw [Finset.prod_eq_zero (Finset.mem_univ i₀) (by simp [hfi]), mul_zero]    simp only [hf]    rw [Finset.sum_comm]    refine Finset.sum_congr rfl fun i _ => ?_    rw [← Finset.mul_sum]    have hps := Finset.prod_univ_sum (fun (_ : Fin k) => (Finset.univ : Finset (Fin dB)))      (fun j c => if j = i₀ then (if c = p.2 then y i p.2 * star (y i q.2) else 0)        else y i c * star (y i c))    rw [Fintype.piFinset_univ] at hps    rw [← hps]    rcases hn i with h1 | h0    · have hj : ∀ j : Fin k, (∑ c, (if j = i₀ then (if c = p.2 then y i p.2 * star (y i q.2) else 0)          else y i c * star (y i c))) = if j = i₀ then y i p.2 * star (y i q.2) else 1 := by        intro j        split_ifs with hji        · simp        · exact h1      simp only [hj]      rw [Finset.prod_ite_eq' Finset.univ i₀ (fun _ => y i p.2 * star (y i q.2))]      simp    · simp [h0]  · intro S    have hsum : (Matrix.of fun (p q : Fin dA × (Fin k → Fin dB)) =>          (Matrix.of fun (p q : Fin dA × (Fin k → Fin dB)) =>            ∑ i : Fin N, x i p.1 * star (x i q.1) * ∏ j : Fin k, (y i (p.2 j) * star (y i (q.2 j))))          (p.1, fun i => if i ∈ S then q.2 i else p.2 i)            (q.1, fun i => if i ∈ S then p.2 i else q.2 i)) =        ∑ i : Fin N, Matrix.vecMulVec          (fun p : Fin dA × (Fin k → Fin dB) =>            x i p.1 * ∏ j : Fin k, (if j ∈ S then star (y i (p.2 j)) else y i (p.2 j)))          (star (fun p : Fin dA × (Fin k → Fin dB) =>            x i p.1 * ∏ j : Fin k, (if j ∈ S then star (y i (p.2 j)) else y i (p.2 j)))) := by      ext p q      simp only [Matrix.of_apply, Matrix.sum_apply, Matrix.vecMulVec_apply, Pi.star_apply]      refine Finset.sum_congr rfl fun i _ => ?_      rw [star_mul', star_prod, mul_mul_mul_comm, ← Finset.prod_mul_distrib]      congr 1      refine Finset.prod_congr rfl fun j _ => ?_      by_cases hj : j ∈ S <;> simp [hj, mul_comm]    rw [hsum]    exact Matrix.posSemidef_sum _ fun i _ => Matrix.posSemidef_vecMulVec_self_star _
See it in the graphDiscuss this resultChallenge it