AFTD Auto-Formalizing Theoretical Domains

op_1992_rank_one_no_bapat_sunder_counterexample

theoremverifiedformalization

There does not exist a real positive semidefinite counterexample to the Bapat-Sunder eigenvalue conjecture of rank 1.

Statement

theorem op_1992_rank_one_no_bapat_sunder_counterexample :
    ¬ has_real_bapat_sunder_counterexample_of_rank 1
Formalizes
arXiv:2611.23269, Section 1 and Section 5
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
  • has_real_bapat_sunder_counterexample_of_rankFor a natural number r, has_real_bapat_sunder_counterexample_of_rank r holds if there exist a natural number n and a real positive…
  • is_real_bapat_sunder_counterexampleA real square matrix A of size (n+1) x (n+1) is a positive semidefinite counterexample to the Bapat-Sunder eigenvalue conjecture if A is…
  • matrix_permanent_succ_rowFor any commutative semiring R, any natural number n, any square matrix A of size (n+1) x (n+1) over R, and any row index i : Fin (n+1),…
  • bapat_sunder_matrixFor any commutative semiring R, any natural number n, and any square matrix A of size (n+1) x (n+1) over R, the Bapat-Sunder matrix of A…

Read back from the Lean

There does not exist a natural number $n$ and an $(n+1) \times (n+1)$ real matrix $A$ such that $A$ has rank 1 and $A$ is a real Bapat-Sunder counterexample. Here, $A$ being a real Bapat-Sunder counterexample means that $A$ is positive semidefinite and there exists a vector $x \in \mathbb{R}^{n+1}$ such that $x^\top B(A) x > \operatorname{per}(A) (x^\top x)$, where $B(A)$ is the Bapat-Sunder matrix whose $(i, j)$-th entry is $A_{i, j} \operatorname{per}(A_{\hat{i}, \hat{j}})$, with $A_{\hat{i}, \hat{j}}$ being the $n \times n$ submatrix of $A$ obtained by deleting the $i$-th row and $j$-th column.

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 proof shows by contradiction that no rank-1 positive semidefinite matrix can counter the Bapat-Sunder conjecture. Factoring any rank-1 matrix A as an outer product u vᵀ reveals that all entries of its Bapat-Sunder matrix are equal to a constant c = n! ∏ A_{kk}, which is nonnegative because PSD matrices have nonnegative diagonal entries. Laplace expansion of the permanent gives per(A) = (n + 1)c, while the quadratic form evaluates to c (∑ x_i)², which by Cauchy-Schwarz is bounded by c(n + 1)(x · x) = per(A)(x · x), contradicting the existence of any counterexample.

  1. (∑ i, x i)^2 ≤ (n + 1) * (x ⬝ᵥ x)

    Applying the Cauchy-Schwarz inequality for sums (Finset.sum_mul_sq_le_sq_mul_sq) to the constant vector 1 and x over Fin (n + 1) yields (∑ x_i)^2 ≤ (∑ 1^2) * (∑ x_i^2). The sum of 1^2 over Fin (n + 1) evaluates to n + 1, and the sum ∑ x_i^2 equals the dot product x ⬝ᵥ x, proving the inequality.

    lines 4–10

    uses Finset.sum_mul_sq_le_sq_mul_sq

      have h := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ (fun _ => (1 : ℝ)) x
      simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, mul_one, one_pow,
        one_mul, Nat.cast_add, Nat.cast_one] at h
      have hd : (∑ i, x i ^ 2) = x ⬝ᵥ x := by
        simp [dotProduct, sq]
      rw [hd] at h
      exact h
  2. Every rank-1 matrix A has its column range spanned by a single nonzero vector w

    Since the rank of A is 1, the range of A.mulVecLin has dimension 1. A 1-dimensional subspace is nontrivial (Module.nontrivial_of_finrank_pos) and thus contains a nonzero vector w (exists_ne). Because the dimension is 1, w spans the range (exists_smul_eq_of_finrank_eq_one). Applying this to each basis column image A(e_j) gives coefficients c j such that column j equals c j • w.

    lines 15–23

    uses Module.nontrivial_of_finrank_pos, exists_ne, exists_smul_eq_of_finrank_eq_one, LinearMap.mem_range_self

      dsimp [Matrix.rank] at h
      have h_pos : 0 < Module.finrank ℝ A.mulVecLin.range := by omega
      have : Nontrivial A.mulVecLin.range := Module.nontrivial_of_finrank_pos h_pos
      obtain ⟨⟨w, hw⟩, hw0⟩ := exists_ne (0 : A.mulVecLin.range)
      have hw_ne : (⟨w, hw⟩ : A.mulVecLin.range) ≠ 0 := hw0
      have h_span := fun (y : A.mulVecLin.range) => exists_smul_eq_of_finrank_eq_one h hw_ne y
      choose c hc using fun (j : Fin n) =>
        h_span ⟨A.mulVecLin (Pi.single j 1), LinearMap.mem_range_self _ _⟩
      use w, c
  3. The matrix entries factor as A i j = w i * c j

    Evaluating the vector equation c j • w = A(e_j) at coordinate i, the left-hand side is c j * w i while the right-hand side is A i j. Commuting multiplication (mul_comm) yields A i j = w i * c j.

    lines 24–33

    uses mul_comm

      intro i j
      have hj := hc j
      apply_fun Subtype.val at hj
      change c j • w = A.mulVecLin (Pi.single j 1) at hj
      apply_fun (fun f => f i) at hj
      simp only [Pi.smul_apply, smul_eq_mul] at hj
      have h_col : A.mulVecLin (Pi.single j 1) i = A i j := by
        simp [mulVec, dotProduct, Pi.single_apply]
      rw [h_col] at hj
      rw [← hj, mul_comm]
  4. For any permutation σ, the product of matrix entries ∏ i, (u (σ i) * v i) equals (∏ i, u i) * (∏ j, v j)

    Expanding the product across each entry factors it into (∏ i, u (σ i)) * (∏ i, v i) via Finset.prod_mul_distrib. Reindexing the product over u by the permutation σ leaves the product unchanged (Equiv.prod_comp).

    lines 40–45

    uses Finset.prod_mul_distrib, Equiv.prod_comp

      unfold Matrix.permanent
      have hσ : ∀ σ : Equiv.Perm (Fin n), (∏ i, Matrix.of (fun i j => u i * v j) (σ i) i) = (∏ i, u i) * (∏ j, v j) := by
        intro σ
        simp only [of_apply, Finset.prod_mul_distrib]
        congr 1
        exact Equiv.prod_comp σ u
  5. The permanent of the rank-1 matrix with entries u i * v j equals n! * (∏ i, u i) * (∏ j, v j)

    Since every permutation contributes the exact same product, summing over all n! permutations (Fintype.card_perm) reduces by Finset.sum_const, Fintype.card_fin, and nsmul_eq_mul to n! * (∏ i, u i) * (∏ j, v j).

    lines 46–49

    uses Finset.sum_const, Fintype.card_perm, Fintype.card_fin, nsmul_eq_mul

      have : (fun σ : Equiv.Perm (Fin n) => ∏ i, Matrix.of (fun i j => u i * v j) (σ i) i) =
             (fun _ => (∏ i, u i) * (∏ j, v j)) := funext hσ
      rw [this]
      rw [Finset.sum_const, Finset.card_univ, Fintype.card_perm, Fintype.card_fin, nsmul_eq_mul]
  6. The (i, j)-th entry of bapat_sunder_matrix A is u i * v j * (n! * (∏ a, u (i.succAbove a)) * (∏ b, v (j.succAbove b)))

    By definition, the (i, j)-th entry of the Bapat-Sunder matrix is A i j times the permanent of the submatrix obtained by deleting row i and column j. Since A i j = u i * v j, this submatrix is an n × n rank-1 matrix formed by the vectors u ∘ i.succAbove and v ∘ j.succAbove. Applying the rank-1 permanent formula (op_1992_rank_one_permanent_rank_one) evaluates its permanent.

    lines 56–62

    uses op_1992_rank_one_permanent_rank_one

      dsimp [bapat_sunder_matrix]
      rw [hA]
      have hsub : A.submatrix i.succAbove j.succAbove =
          Matrix.of (fun a b => (u ∘ i.succAbove) a * (v ∘ j.succAbove) b) := by
        ext a b
        simp [submatrix_apply, hA]
      rw [hsub, op_1992_rank_one_permanent_rank_one]
  7. bapat_sunder_matrix A i j = n! * (∏ k, u k) * (∏ k, v k)

    Using Fin.prod_univ_succAbove, multiplying u i by the product of u omitting i restores the full product ∏ k, u k, and similarly for v j. Rearranging factors via ring algebra shows that the (i, j)-th entry equals n! * (∏ k, u k) * (∏ k, v k), independent of i and j.

    lines 63–68

    uses Fin.prod_univ_succAbove

      have hu : u i * ∏ a, (u ∘ i.succAbove) a = ∏ k, u k := (Fin.prod_univ_succAbove u i).symm
      have hv : v j * ∏ b, (v ∘ j.succAbove) b = ∏ k, v k := (Fin.prod_univ_succAbove v j).symm
      calc
        u i * v j * ((Nat.factorial n : ℝ) * ((∏ a, (u ∘ i.succAbove) a) * (∏ b, (v ∘ j.succAbove) b)))
          = (Nat.factorial n : ℝ) * (u i * ∏ a, (u ∘ i.succAbove) a) * (v j * ∏ b, (v ∘ j.succAbove) b) := by ring
        _ = (Nat.factorial n : ℝ) * (∏ k, u k) * (∏ k, v k) := by rw [hu, hv]
  8. Diagonal entries of a positive semidefinite matrix are nonnegative: 0 ≤ A k k

    Evaluating the positive semidefiniteness condition hA on the standard basis vector e_k (represented by Finsupp.single k 1), the double sum collapses by Finsupp.sum_single_index to 1 * A k k * 1 = A k k, which must be nonnegative.

    lines 73–79

    uses Finsupp.sum_single_index

      have h := hA.2 (Finsupp.single k (1 : ℝ))
      rw [Finsupp.sum_single_index] at h
      · rw [Finsupp.sum_single_index] at h
        · simp at h
          exact h
        · simp
      · simp
  9. Assume there exists a rank-1 PSD counterexample A with vector x, factor A as A i j = u i * v j, and define c = n! * (∏ u) * (∏ v)

    Assume for contradiction that a counterexample exists, consisting of dimension n + 1, a positive semidefinite matrix A of rank 1, and a vector x satisfying the strict counterexample inequality. By rank-1 factorization (op_1992_rank_one_matrix_rank_one_eq), write A i j = u i * v j for some vectors u and v, and define the constant c := n! * (∏ k, u k) * (∏ k, v k).

    lines 84–86

    uses op_1992_rank_one_matrix_rank_one_eq

      intro ⟨n, A, h_rank, h_psd, x, hx⟩
      obtain ⟨u, v, hA⟩ := op_1992_rank_one_matrix_rank_one_eq A h_rank
      set c := (Nat.factorial n : ℝ) * (∏ k, u k) * (∏ k, v k) with hc_def
  10. Every entry of the Bapat-Sunder matrix of A equals the constant c

    Applying op_1992_rank_one_bapat_sunder_matrix_rank_one to each entry (i, j), the Bapat-Sunder matrix entry simplifies to n! * (∏ k, u k) * (∏ k, v k), which is c. Thus bapat_sunder_matrix A is the constant matrix with all entries c.

    lines 87–90

    uses op_1992_rank_one_bapat_sunder_matrix_rank_one

      have hF : bapat_sunder_matrix A = Matrix.of (fun _ _ => c) := by
        ext i j
        simp only [Matrix.of_apply]
        exact op_1992_rank_one_bapat_sunder_matrix_rank_one u v A hA i j
  11. The product (∏ k, u k) * (∏ k, v k) equals the product of diagonal entries ∏ k, A k k

    Distribute the product of products into the product of pointwise products u k * v k using Finset.prod_mul_distrib, and substitute u k * v k = A k k.

    lines 91–95

    uses Finset.prod_mul_distrib

      have h_prod : (∏ k, u k) * (∏ k, v k) = ∏ k, A k k := by
        rw [← Finset.prod_mul_distrib]
        congr 1
        ext k
        exact (hA k k).symm
  12. The constant c is nonnegative

    Rewrite c as n! * ∏ k, A k k. Since n! ≥ 0 by Nat.cast_nonneg and each diagonal entry A k k ≥ 0 by positive semidefiniteness (op_1992_rank_one_posSemidef_diag_nonneg), the product of diagonal entries is nonnegative by Finset.prod_nonneg, and the product of two nonnegative numbers is nonnegative by mul_nonneg.

    lines 96–100

    uses Nat.cast_nonneg, Finset.prod_nonneg, op_1992_rank_one_posSemidef_diag_nonneg, mul_nonneg

      have hc_nonneg : 0 ≤ c := by
        rw [hc_def, mul_assoc, h_prod]
        have h1 : 0 ≤ (Nat.factorial n : ℝ) := Nat.cast_nonneg _
        have h2 : 0 ≤ ∏ k, A k k := Finset.prod_nonneg (fun k _ => op_1992_rank_one_posSemidef_diag_nonneg A h_psd k)
        exact mul_nonneg h1 h2
  13. The sum of the first row of the Bapat-Sunder matrix equals the permanent of A

    This is row expansion of the permanent along row 0, which is matrix_permanent_succ_row.

    lines 101–103

    uses matrix_permanent_succ_row

      have h_sum : ∑ j : Fin (n + 1), bapat_sunder_matrix A 0 j = A.permanent := by
        dsimp [bapat_sunder_matrix]
        exact (matrix_permanent_succ_row A 0).symm
  14. (n + 1) * c = A.permanent

    Since every entry of the Bapat-Sunder matrix is c, the sum over the n + 1 entries of the first row is (n + 1) * c by Finset.sum_const, Fintype.card_fin, and nsmul_eq_mul. By the previous step, this sum is equal to A.permanent.

    lines 104–109

    uses Finset.sum_const, Fintype.card_fin, nsmul_eq_mul

      have h_per : (n + 1 : ℝ) * c = A.permanent := by
        rw [← h_sum]
        have : ∀ j : Fin (n + 1), bapat_sunder_matrix A 0 j = c := fun j => by
          rw [hF]; simp
        simp_rw [this]
        simp [Finset.sum_const, Fintype.card_fin, nsmul_eq_mul]
  15. The quadratic form x ⬝ᵥ (bapat_sunder_matrix A *ᵥ x) equals c * (∑ i, x i) ^ 2

    Substituting the constant matrix for bapat_sunder_matrix A, the matrix-vector product yields (mulVec A x) i = c * ∑ j, x j for each i. Taking the dot product with x and factoring out c across both summations gives c * (∑ i, x i)^2, using Finset.mul_sum and Finset.sum_mul.

    lines 110–115

    uses Finset.mul_sum, Finset.sum_mul

      have h_quad : x ⬝ᵥ (bapat_sunder_matrix A).mulVec x = c * (∑ i, x i) ^ 2 := by
        rw [hF]
        simp only [dotProduct, Matrix.mulVec, Matrix.of_apply, sq]
        simp_rw [← Finset.mul_sum]
        rw [← Finset.sum_mul]
        ring
  16. (∑ i, x i) ^ 2 ≤ (n + 1) * (x ⬝ᵥ x)

    Apply the Cauchy-Schwarz inequality with the all-ones vector using op_1992_rank_one_cauchy_schwarz_ones.

    line 116

    uses op_1992_rank_one_cauchy_schwarz_ones

      have h_cs : (∑ i, x i) ^ 2 ≤ (n + 1 : ℝ) * (x ⬝ᵥ x) := op_1992_rank_one_cauchy_schwarz_ones x
  17. c * (∑ i, x i) ^ 2 ≤ A.permanent * (x ⬝ᵥ x)

    Multiply the Cauchy-Schwarz bound by c ≥ 0 using mul_le_mul_of_nonneg_left to get c * (∑ i, x i)^2 ≤ c * (n + 1) * (x ⬝ᵥ x), then rewrite c * (n + 1) as A.permanent.

    lines 117–121

    uses mul_le_mul_of_nonneg_left

      have h_le : c * (∑ i, x i) ^ 2 ≤ A.permanent * (x ⬝ᵥ x) := by
        calc
          c * (∑ i, x i) ^ 2 ≤ c * ((n + 1 : ℝ) * (x ⬝ᵥ x)) := mul_le_mul_of_nonneg_left h_cs hc_nonneg
          _ = ((n + 1 : ℝ) * c) * (x ⬝ᵥ x) := by ring
          _ = A.permanent * (x ⬝ᵥ x) := by rw [h_per]
  18. Contradiction: the assumed counterexample inequality cannot hold automation

    The counterexample assumption hx states that x ⬝ᵥ (bapat_sunder_matrix A *ᵥ x) > A.permanent * (x ⬝ᵥ x), but we have established that x ⬝ᵥ (bapat_sunder_matrix A *ᵥ x) = c * (∑ i, x i)^2 ≤ A.permanent * (x ⬝ᵥ x). Linear arithmetic detects this contradiction.

    line 122

      linarith
Finset.sum_mul_sq_le_sq_mul_sq
Cauchy-Schwarz inequality for sums: (∑ f(i) * g(i))² ≤ (∑ f(i)²) * (∑ g(i)²).
Module.nontrivial_of_finrank_pos
A module over a nontrivial ring with positive finite dimension has at least two elements.
exists_ne
Every nontrivial type contains an element distinct from any specified element.
exists_smul_eq_of_finrank_eq_one
In a 1-dimensional vector space, any nonzero vector spans the entire space by scalar multiplication.
LinearMap.mem_range_self
The image of an element under a linear map belongs to the range of the linear map.
mul_comm
Multiplication in a commutative magma is commutative: a * b = b * a.
Finset.prod_mul_distrib
The product of pointwise products over a finite set equals the product of the two products: ∏ (f(x) * g(x)) = (∏ f(x)) * (∏ g(x)).
Equiv.prod_comp
Reindexing a product by a permutation of the finite domain leaves the product unchanged: ∏ g(σ(i)) = ∏ g(i).
Finset.sum_const
The sum of a constant value over a finite set equals the cardinality of the set scalar-multiplied by that value.
Fintype.card_perm
The number of permutations of a finite set of cardinality n is n!.
Fintype.card_fin
The cardinality of Fin n is n.
nsmul_eq_mul
Scalar multiplication by a natural number n equals multiplication by the cast of n.
op_1992_rank_one_permanent_rank_one
The permanent of an n × n rank-1 matrix with entries u_i * v_j equals n! * (∏ u_i) * (∏ v_j).
Fin.prod_univ_succAbove
Extracting the x-th factor from a product over Fin (n + 1) leaves the product over the remaining n indices: ∏ f(i) = f(x) * ∏ f(x.succAbove(i)).
Finsupp.sum_single_index
Summing a finitely supported function with a single nonzero index evaluates to the function value at that index.
op_1992_rank_one_matrix_rank_one_eq
Every rank-1 matrix can be factored as an outer product A_{ij} = u_i * v_j.
op_1992_rank_one_bapat_sunder_matrix_rank_one
For a rank-1 matrix A_{ij} = u_i * v_j of size (n + 1) × (n + 1), every entry of its Bapat-Sunder matrix equals n! * (∏ u_k) * (∏ v_k).
Nat.cast_nonneg
The cast of any natural number into an ordered semiring is nonnegative.
Finset.prod_nonneg
A product of nonnegative elements over a finite set is nonnegative.
op_1992_rank_one_posSemidef_diag_nonneg
The diagonal entries of a real positive semidefinite matrix are nonnegative.
mul_nonneg
The product of two nonnegative elements is nonnegative.
matrix_permanent_succ_row
Laplace expansion of the permanent along the first row: per(A) = ∑_j A_{0j} * per(A(0 | j)).
Finset.mul_sum
Multiplication distributes over finite summation: a * ∑ x_i = ∑ (a * x_i).
Finset.sum_mul
Finite summation distributes over multiplication: (∑ x_i) * a = ∑ (x_i * a).
op_1992_rank_one_cauchy_schwarz_ones
For any vector x of dimension n + 1, (∑ x_i)² ≤ (n + 1) * (x · x).
mul_le_mul_of_nonneg_left
Multiplying an inequality b ≤ c on the left by a nonnegative element a gives a * b ≤ a * c.

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 Matrix inlemma op_1992_rank_one_cauchy_schwarz_ones {n : ℕ} (x : Fin (n + 1) → ℝ) :    (∑ i, x i) ^ 2 ≤ (n + 1 : ℝ) * (x ⬝ᵥ x) := by  have h := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ (fun _ => (1 : ℝ)) x  simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, mul_one, one_pow,    one_mul, Nat.cast_add, Nat.cast_one] at h  have hd : (∑ i, x i ^ 2) = x ⬝ᵥ x := by    simp [dotProduct, sq]  rw [hd] at h  exact hopen Matrix inlemma op_1992_rank_one_matrix_rank_one_eq {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℝ) (h : A.rank = 1) :    ∃ (u : Fin m → ℝ) (v : Fin n → ℝ), ∀ i j, A i j = u i * v j := by  dsimp [Matrix.rank] at h  have h_pos : 0 < Module.finrank ℝ A.mulVecLin.range := by omega  have : Nontrivial A.mulVecLin.range := Module.nontrivial_of_finrank_pos h_pos  obtain ⟨⟨w, hw⟩, hw0⟩ := exists_ne (0 : A.mulVecLin.range)  have hw_ne : (⟨w, hw⟩ : A.mulVecLin.range) ≠ 0 := hw0  have h_span := fun (y : A.mulVecLin.range) => exists_smul_eq_of_finrank_eq_one h hw_ne y  choose c hc using fun (j : Fin n) =>    h_span ⟨A.mulVecLin (Pi.single j 1), LinearMap.mem_range_self _ _⟩  use w, c  intro i j  have hj := hc j  apply_fun Subtype.val at hj  change c j • w = A.mulVecLin (Pi.single j 1) at hj  apply_fun (fun f => f i) at hj  simp only [Pi.smul_apply, smul_eq_mul] at hj  have h_col : A.mulVecLin (Pi.single j 1) i = A i j := by    simp [mulVec, dotProduct, Pi.single_apply]  rw [h_col] at hj  rw [← hj, mul_comm]open Matrix inlemma op_1992_rank_one_permanent_rank_one {n : ℕ} {R : Type*} [CommRing R]    (u v : Fin n → R) :    (Matrix.of (fun i j => u i * v j)).permanent =    (Nat.factorial n : R) * ((∏ i, u i) * (∏ j, v j)) := by  unfold Matrix.permanent  have hσ : ∀ σ : Equiv.Perm (Fin n), (∏ i, Matrix.of (fun i j => u i * v j) (σ i) i) = (∏ i, u i) * (∏ j, v j) := by    intro σ    simp only [of_apply, Finset.prod_mul_distrib]    congr 1    exact Equiv.prod_comp σ u  have : (fun σ : Equiv.Perm (Fin n) => ∏ i, Matrix.of (fun i j => u i * v j) (σ i) i) =         (fun _ => (∏ i, u i) * (∏ j, v j)) := funext hσ  rw [this]  rw [Finset.sum_const, Finset.card_univ, Fintype.card_perm, Fintype.card_fin, nsmul_eq_mul]open Matrix inlemma op_1992_rank_one_bapat_sunder_matrix_rank_one {n : ℕ} (u v : Fin (n + 1) → ℝ)    (A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (hA : ∀ i j, A i j = u i * v j)    (i j : Fin (n + 1)) :    bapat_sunder_matrix A i j = (Nat.factorial n : ℝ) * (∏ k, u k) * (∏ k, v k) := by  dsimp [bapat_sunder_matrix]  rw [hA]  have hsub : A.submatrix i.succAbove j.succAbove =      Matrix.of (fun a b => (u ∘ i.succAbove) a * (v ∘ j.succAbove) b) := by    ext a b    simp [submatrix_apply, hA]  rw [hsub, op_1992_rank_one_permanent_rank_one]  have hu : u i * ∏ a, (u ∘ i.succAbove) a = ∏ k, u k := (Fin.prod_univ_succAbove u i).symm  have hv : v j * ∏ b, (v ∘ j.succAbove) b = ∏ k, v k := (Fin.prod_univ_succAbove v j).symm  calc    u i * v j * ((Nat.factorial n : ℝ) * ((∏ a, (u ∘ i.succAbove) a) * (∏ b, (v ∘ j.succAbove) b)))      = (Nat.factorial n : ℝ) * (u i * ∏ a, (u ∘ i.succAbove) a) * (v j * ∏ b, (v ∘ j.succAbove) b) := by ring    _ = (Nat.factorial n : ℝ) * (∏ k, u k) * (∏ k, v k) := by rw [hu, hv]open Matrix inlemma op_1992_rank_one_posSemidef_diag_nonneg {n : ℕ} (A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ)    (hA : A.PosSemidef) (k : Fin (n + 1)) : 0 ≤ A k k := by  have h := hA.2 (Finsupp.single k (1 : ℝ))  rw [Finsupp.sum_single_index] at h  · rw [Finsupp.sum_single_index] at h    · simp at h      exact h    · simp  · simp/-- No real positive semidefinite matrix of rank 1 is a Bapat-Sunder counterexample. -/theorem op_1992_rank_one_no_bapat_sunder_counterexample :    ¬ has_real_bapat_sunder_counterexample_of_rank 1 := by  intro ⟨n, A, h_rank, h_psd, x, hx⟩  obtain ⟨u, v, hA⟩ := op_1992_rank_one_matrix_rank_one_eq A h_rank  set c := (Nat.factorial n : ℝ) * (∏ k, u k) * (∏ k, v k) with hc_def  have hF : bapat_sunder_matrix A = Matrix.of (fun _ _ => c) := by    ext i j    simp only [Matrix.of_apply]    exact op_1992_rank_one_bapat_sunder_matrix_rank_one u v A hA i j  have h_prod : (∏ k, u k) * (∏ k, v k) = ∏ k, A k k := by    rw [← Finset.prod_mul_distrib]    congr 1    ext k    exact (hA k k).symm  have hc_nonneg : 0 ≤ c := by    rw [hc_def, mul_assoc, h_prod]    have h1 : 0 ≤ (Nat.factorial n : ℝ) := Nat.cast_nonneg _    have h2 : 0 ≤ ∏ k, A k k := Finset.prod_nonneg (fun k _ => op_1992_rank_one_posSemidef_diag_nonneg A h_psd k)    exact mul_nonneg h1 h2  have h_sum : ∑ j : Fin (n + 1), bapat_sunder_matrix A 0 j = A.permanent := by    dsimp [bapat_sunder_matrix]    exact (matrix_permanent_succ_row A 0).symm  have h_per : (n + 1 : ℝ) * c = A.permanent := by    rw [← h_sum]    have : ∀ j : Fin (n + 1), bapat_sunder_matrix A 0 j = c := fun j => by      rw [hF]; simp    simp_rw [this]    simp [Finset.sum_const, Fintype.card_fin, nsmul_eq_mul]  have h_quad : x ⬝ᵥ (bapat_sunder_matrix A).mulVec x = c * (∑ i, x i) ^ 2 := by    rw [hF]    simp only [dotProduct, Matrix.mulVec, Matrix.of_apply, sq]    simp_rw [← Finset.mul_sum]    rw [← Finset.sum_mul]    ring  have h_cs : (∑ i, x i) ^ 2 ≤ (n + 1 : ℝ) * (x ⬝ᵥ x) := op_1992_rank_one_cauchy_schwarz_ones x  have h_le : c * (∑ i, x i) ^ 2 ≤ A.permanent * (x ⬝ᵥ x) := by    calc      c * (∑ i, x i) ^ 2 ≤ c * ((n + 1 : ℝ) * (x ⬝ᵥ x)) := mul_le_mul_of_nonneg_left h_cs hc_nonneg      _ = ((n + 1 : ℝ) * c) * (x ⬝ᵥ x) := by ring      _ = A.permanent * (x ⬝ᵥ x) := by rw [h_per]  linarith
See it in the graphDiscuss this resultChallenge it