Documentation

AlgebraicCombinatorics.DesnanotJacobi

Determinants: Factor Hunting and Desnanot-Jacobi Identity #

This file formalizes results from the "Factor hunting" and "Desnanot-Jacobi and Dodgson condensation" sections of the determinants chapter.

Main definitions #

Main results #

Vandermonde determinant (Theorem thm.det.vander) #

Proposition prop.det.(xi+yj)n-1 #

Laplace expansion (Theorem thm.det.laplace) #

Proposition prop.det.laplace.0 #

Adjugate matrix (Definition def.det.adj, Theorem thm.det.adj.inverse) #

Desnanot-Jacobi identity (Theorem thm.det.des-jac-1, thm.det.des-jac-2) #

Cauchy determinant (Theorem thm.det.cauchy) #

Jacobi's complementary minor theorem (Theorem thm.det.jacobi-complement) #

References #

Implementation notes #

Many of these results are already in Mathlib under Matrix.det_vandermonde, Matrix.adjugate, Matrix.det_laplace_row, etc. This file provides the statements matching the textbook presentation and connects them to Mathlib's API.

Fin.succAbove computation lemmas #

These simp lemmas allow efficient computation of Fin.succAbove for concrete Fin types. They are used throughout this file for determinant expansions involving submatrices. All lemmas are proved by rfl for maximum efficiency.

Fin 3 product lemmas #

These lemmas simplify products over pairs and singletons in Fin 3. They are used in Cauchy determinant computations for the n = 3 case.

@[simp]
theorem AlgebraicCombinatorics.Determinants.Fin3.prod_pair_12 {R : Type u_2} [CommMonoid R] (f : Fin 3R) :
k{1, 2}, f k = f 1 * f 2

Product over {1, 2} in Fin 3 equals f 1 * f 2.

@[simp]
theorem AlgebraicCombinatorics.Determinants.Fin3.prod_pair_02 {R : Type u_2} [CommMonoid R] (f : Fin 3R) :
k{0, 2}, f k = f 0 * f 2

Product over {0, 2} in Fin 3 equals f 0 * f 2.

@[simp]
theorem AlgebraicCombinatorics.Determinants.Fin3.prod_pair_01 {R : Type u_2} [CommMonoid R] (f : Fin 3R) :
k{0, 1}, f k = f 0 * f 1

Product over {0, 1} in Fin 3 equals f 0 * f 1.

@[simp]
theorem AlgebraicCombinatorics.Determinants.Fin3.prod_singleton_2 {R : Type u_2} [CommMonoid R] (f : Fin 3R) :
k{2}, f k = f 2

Product over {2} in Fin 3 equals f 2.

univ.filter (· ≠ 0) in Fin 3 is {1, 2}.

univ.filter (· ≠ 1) in Fin 3 is {0, 2}.

univ.filter (· ≠ 2) in Fin 3 is {0, 1}.

Vandermonde Determinant (Theorem thm.det.vander) #

The Vandermonde determinant is a classical result: the determinant of a matrix with entries aᵢʲ⁻¹ (or variants) equals a product of differences.

The proof uses "factor hunting": we show the determinant is divisible by each (aᵢ - aⱼ) for i < j, and then compare degrees to conclude equality up to a constant, which is determined by examining the leading coefficient.

def AlgebraicCombinatorics.Determinants.vandermondeMat {R : Type u_1} [CommRing R] {n : } (a : Fin nR) :
Matrix (Fin n) (Fin n) R

The Vandermonde matrix with entries a i ^ (n - 1 - j) for 0-indexed i, j. This corresponds to the matrix (aᵢⁿ⁻ʲ) in 1-indexed notation. Label: thm.det.vander

Equations
Instances For
    @[simp]
    theorem AlgebraicCombinatorics.Determinants.vandermondeMat_apply {R : Type u_1} [CommRing R] {n : } (a : Fin nR) (i j : Fin n) :
    vandermondeMat a i j = a i ^ (n - 1 - j)

    vandermondeMat a equals projVandermonde 1 a, which has entries (1)^j * (a i)^(n-1-j). This allows us to use Mathlib's det_projVandermonde to compute the determinant.

    theorem AlgebraicCombinatorics.Determinants.vandermonde_det_a {R : Type u_1} [CommRing R] {n : } (a : Fin nR) :
    (vandermondeMat a).det = i : Fin n, jFinset.Ioi i, (a i - a j)

    Vandermonde determinant, part (a): det(aᵢⁿ⁻ʲ) = ∏_{i<j} (aᵢ - aⱼ) Label: thm.det.vander (a)

    Note: Mathlib's Matrix.det_vandermonde uses a slightly different indexing convention. This statement matches the textbook presentation.

    theorem AlgebraicCombinatorics.Determinants.vandermonde_det_b {R : Type u_1} [CommRing R] {n : } (a : Fin nR) :
    (vandermondeMat a).transpose.det = i : Fin n, jFinset.Ioi i, (a i - a j)

    Vandermonde determinant, part (b): det(aⱼⁿ⁻ⁱ) = ∏_{i<j} (aᵢ - aⱼ) This is the transpose of part (a). Label: thm.det.vander (b)

    def AlgebraicCombinatorics.Determinants.vandermondeMat' {R : Type u_1} [CommRing R] {n : } (a : Fin nR) :
    Matrix (Fin n) (Fin n) R

    The standard Vandermonde matrix with entries a i ^ j. This corresponds to the matrix (aᵢʲ⁻¹) in 1-indexed notation.

    Equations
    Instances For
      theorem AlgebraicCombinatorics.Determinants.vandermonde_det_c {R : Type u_1} [CommRing R] {n : } (a : Fin nR) :
      (vandermondeMat' a).det = i : Fin n, jFinset.Iio i, (a i - a j)

      Vandermonde determinant, part (c): det(aᵢʲ⁻¹) = ∏_{j<i} (aᵢ - aⱼ) Label: thm.det.vander (c)

      theorem AlgebraicCombinatorics.Determinants.vandermonde_det_d {R : Type u_1} [CommRing R] {n : } (a : Fin nR) :
      (vandermondeMat' a).transpose.det = i : Fin n, jFinset.Iio i, (a i - a j)

      Vandermonde determinant, part (d): det(aⱼⁱ⁻¹) = ∏_{j<i} (aᵢ - aⱼ) This is the transpose of part (c). Label: thm.det.vander (d)

      theorem AlgebraicCombinatorics.Determinants.vandermonde_det_mathlib {R : Type u_1} [CommRing R] {n : } (a : Fin nR) :
      (Matrix.vandermonde a).det = i : Fin n, jFinset.Ioi i, (a j - a i)

      Mathlib's version of the Vandermonde determinant. This relates our formulation to Mathlib's Matrix.det_vandermonde.

      Lemma lem.det.vander.a.pol - Vandermonde determinant in polynomial ring #

      This is a key lemma that establishes the Vandermonde identity for polynomial indeterminates. The general Vandermonde theorem (thm.det.vander) follows from this by substitution.

      The proof relates our matrix convention to Mathlib's via column reversal, and uses the fact that swapping the order of subtraction in each factor introduces a sign that cancels with the sign from the column permutation.

      Helper: card of Ioi for Fin n.

      Sum of Ioi cardinalities equals n(n-1)/2.

      theorem AlgebraicCombinatorics.Determinants.det_submatrix_col_perm' {m : } {S : Type u_2} [CommRing S] (A : Matrix (Fin m) (Fin m) S) (σ : Equiv.Perm (Fin m)) :
      (A.submatrix id σ).det = (Equiv.Perm.sign σ) * A.det

      Helper lemma for column permutation of determinants.

      The Vandermonde matrix in the polynomial ring ℤ[x₁,...,xₙ] with entries xᵢⁿ⁻ʲ. This is the matrix from Lemma lem.det.vander.a.pol. Entry (i,j) = xᵢ^{n-1-j} (using 0-indexed notation). Label: lem.det.vander.a.pol

      Equations
      Instances For

        The product of differences ∏_{1≤i<j≤n} (xᵢ - xⱼ) in the polynomial ring. Label: lem.det.vander.a.pol

        Equations
        Instances For

          Relation between vandermondePolyMat and Mathlib's vandermonde via column reversal. Uses Mathlib's Fin.revPerm for the column reversal permutation.

          The determinant of vandermondePolyMat in terms of Mathlib's vandermonde.

          The sign of Mathlib's Fin.revPerm column reversal permutation. Label: lem.det.vander.a.pol (helper)

          theorem AlgebraicCombinatorics.Determinants.prod_Ioi_neg_sub' {m : } {S : Type u_2} [CommRing S] (v : Fin mS) :
          i : Fin m, jFinset.Ioi i, (v i - v j) = (-1) ^ (m * (m - 1) / 2) * i : Fin m, jFinset.Ioi i, (v j - v i)

          The product transformation: swapping subtraction order introduces a sign. Label: lem.det.vander.a.pol (helper)

          Lemma lem.det.vander.a.pol: The Vandermonde determinant in the polynomial ring.

          In ℤ[x₁,...,xₙ], we have: det(xᵢⁿ⁻ʲ) = ∏_{1≤i<j≤n} (xᵢ - xⱼ)

          This is the "universal" form of the Vandermonde determinant. The general theorem (Theorem thm.det.vander) follows by substituting specific ring elements for the indeterminates.

          The proof uses Mathlib's Matrix.det_vandermonde combined with:

          • Column reversal (relating our matrix to Mathlib's convention)
          • Sign analysis (the two sign changes cancel)

          Label: lem.det.vander.a.pol

          Proposition prop.det.(xi+yj)n-1 #

          The determinant of the matrix ((xᵢ + yⱼ)ⁿ⁻¹) can be expressed as a product of binomial coefficients and Vandermonde-like products.

          def AlgebraicCombinatorics.Determinants.sumPowMat {R : Type u_1} [CommRing R] {n : } (x y : Fin nR) :
          Matrix (Fin n) (Fin n) R

          The matrix with entries (xᵢ + yⱼ)ⁿ⁻¹. Label: prop.det.(xi+yj)n-1

          Equations
          Instances For
            @[simp]
            theorem AlgebraicCombinatorics.Determinants.sumPowMat_apply {R : Type u_1} [CommRing R] {n : } (x y : Fin nR) (i j : Fin n) :
            sumPowMat x y i j = (x i + y j) ^ (n - 1)
            theorem AlgebraicCombinatorics.Determinants.det_sum_pow {R : Type u_1} [CommRing R] {n : } (x y : Fin nR) :
            (sumPowMat x y).det = ((∏ k : Fin n, (n - 1).choose k) * i : Fin n, jFinset.Ioi i, (x i - x j)) * i : Fin n, jFinset.Ioi i, (y j - y i)

            Proposition prop.det.(xi+yj)n-1: det((xᵢ + yⱼ)ⁿ⁻¹) = (∏ₖ C(n-1,k)) · (∏{i<j}(xᵢ-xⱼ)) · (∏{i<j}(yⱼ-yᵢ))

            The proof can be done either by factor hunting (first proof in the source) or by factoring the matrix as P · Q where P and Q are related to Vandermonde matrices (second proof in the source). Label: prop.det.(xi+yj)n-1

            Laplace Expansion (Theorem thm.det.laplace) #

            Laplace expansion expresses a determinant as a sum over cofactors along any row or column.

            def AlgebraicCombinatorics.Determinants.submatrixRemove {R : Type u_1} {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) (i j : Fin (m + 1)) :
            Matrix (Fin m) (Fin m) R

            Convention conv.mat.tilde: A_{~i,~j} denotes the submatrix obtained by removing row i and column j.

            In Mathlib, this is Matrix.submatrix A (Fin.succAbove i) (Fin.succAbove j) for an (n+1)×(n+1) matrix A, yielding an n×n matrix.

            Equations
            Instances For
              theorem AlgebraicCombinatorics.Determinants.det_laplace_row {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) (p : Fin (m + 1)) :
              A.det = q : Fin (m + 1), (-1) ^ (p + q) * A p q * (submatrixRemove A p q).det

              Laplace expansion along row p (Theorem thm.det.laplace (a)): det A = ∑q (-1)^(p+q) A{p,q} det(A_{~p,~q})

              In Mathlib, this is Matrix.det_succ_row.

              theorem AlgebraicCombinatorics.Determinants.det_laplace_col {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) (q : Fin (m + 1)) :
              A.det = p : Fin (m + 1), (-1) ^ (p + q) * A p q * (submatrixRemove A p q).det

              Laplace expansion along column q (Theorem thm.det.laplace (b)): det A = ∑p (-1)^(p+q) A{p,q} det(A_{~p,~q})

              In Mathlib, this is Matrix.det_laplace_column.

              Proposition prop.det.laplace.0 #

              When we use entries from a different row/column than the one we're expanding along, the sum is zero.

              theorem AlgebraicCombinatorics.Determinants.det_laplace_row_zero {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) (p r : Fin (m + 1)) (hpr : p r) :
              q : Fin (m + 1), (-1) ^ (p + q) * A r q * (submatrixRemove A p q).det = 0

              Proposition prop.det.laplace.0 (a): If p ≠ r, then ∑q (-1)^(p+q) A{r,q} det(A_{~p,~q}) = 0

              The proof uses the adjugate: each term equals A r q * adjugate A q p, so the sum is (A * adjugate A) r p = (det A * I) r p = 0 when r ≠ p.

              theorem AlgebraicCombinatorics.Determinants.det_laplace_col_zero {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) (q r : Fin (m + 1)) (hqr : q r) :
              p : Fin (m + 1), (-1) ^ (p + q) * A p r * (submatrixRemove A p q).det = 0

              Proposition prop.det.laplace.0 (b): If q ≠ r, then ∑p (-1)^(p+q) A{p,r} det(A_{~p,~q}) = 0

              Adjugate Matrix (Definition def.det.adj) #

              The adjugate (classical adjoint) of a matrix A is defined by (adj A){i,j} = (-1)^(i+j) det(A{~j,~i})

              Note the index swap: the (i,j) entry involves removing row j and column i.

              def AlgebraicCombinatorics.Determinants.adjugateMat {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) :
              Matrix (Fin (m + 1)) (Fin (m + 1)) R

              The adjugate matrix (Definition def.det.adj).

              The adjugate (or classical adjoint) of an n×n matrix A is the n×n matrix whose (i,j) entry is (-1)^(i+j) times the determinant of the (n-1)×(n-1) submatrix obtained by deleting row j and column i from A. Note the index swap: the (i,j) entry involves removing row j and column i.

              The key property is: A · adj(A) = adj(A) · A = det(A) · I

              Note: Mathlib defines Matrix.adjugate which is the same concept, but using a different but equivalent definition. We provide this definition for clarity and connection to the textbook. Label: def.det.adj

              Equations
              Instances For

                The adjugate as defined here equals Mathlib's definition.

                Mathlib defines A.adjugate i j = (A.updateRow j (Pi.single i 1)).det. Our definition is adjugateMat A i j = (-1)^(i+j) * det(A_{~j,~i}). These are equal by Laplace expansion along row j of the updated matrix. Label: def.det.adj

                Theorem thm.det.adj.inverse #

                The fundamental property of the adjugate matrix: multiplication by the adjugate yields the determinant times the identity matrix.

                Theorem Statement: Let n ∈ ℕ. Let A ∈ K^{n×n} be an n×n matrix. Let I_n denote the n×n identity matrix. Then: A · (adj A) = (adj A) · A = (det A) · I_n

                Proof Sketch (from the textbook): To show A · (adj A) = (det A) · I_n, we check that the (i,j)-th entry of A · (adj A) equals det A when i = j, and equals 0 otherwise.

                Similarly, (adj A) · A = (det A) · I_n can be shown using column versions.

                theorem AlgebraicCombinatorics.Determinants.mul_adjugate' {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) :
                A * A.adjugate = A.det 1

                Theorem thm.det.adj.inverse (general form for Fin n): A · adj(A) = det(A) · I

                This is the fundamental property of the adjugate matrix. For any n×n matrix A, multiplying A by its adjugate yields the determinant of A times the identity matrix.

                This works for all n ≥ 0, including the trivial case n = 0 where both sides equal the 0×0 identity matrix.

                Label: thm.det.adj.inverse

                theorem AlgebraicCombinatorics.Determinants.adjugate_mul' {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) :
                A.adjugate * A = A.det 1

                Theorem thm.det.adj.inverse (general form for Fin n): adj(A) · A = det(A) · I

                The adjugate also satisfies the identity when multiplied on the left. Together with mul_adjugate', this shows that the adjugate is a "pseudo-inverse" of A scaled by det(A).

                Label: thm.det.adj.inverse

                theorem AlgebraicCombinatorics.Determinants.mul_adjugate_eq_det_smul {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) :
                A * A.adjugate = A.det 1

                Theorem thm.det.adj.inverse (for Fin (m+1) matrices): A · adj(A) = det(A) · I

                This version is specialized to non-empty matrices (size at least 1×1). Label: thm.det.adj.inverse

                theorem AlgebraicCombinatorics.Determinants.adjugate_mul_eq_det_smul {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 1)) (Fin (m + 1)) R) :
                A.adjugate * A = A.det 1

                Theorem thm.det.adj.inverse (for Fin (m+1) matrices): adj(A) · A = det(A) · I

                This version is specialized to non-empty matrices (size at least 1×1). Label: thm.det.adj.inverse

                theorem AlgebraicCombinatorics.Determinants.mul_adjugate_apply_diag {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) (i : Fin n) :
                (A * A.adjugate) i i = A.det

                Corollary of thm.det.adj.inverse: Entry-wise form for the diagonal.

                The (i,i) entry of A · adj(A) equals det(A). This is a direct consequence of the main theorem.

                theorem AlgebraicCombinatorics.Determinants.mul_adjugate_apply_ne {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) (i j : Fin n) (hij : i j) :
                (A * A.adjugate) i j = 0

                Corollary of thm.det.adj.inverse: Entry-wise form for off-diagonal entries.

                The (i,j) entry of A · adj(A) equals 0 when i ≠ j. This is a direct consequence of the main theorem.

                Laplace Expansion Along Multiple Rows/Columns (Theorem thm.det.laplace-multi) #

                This generalizes Laplace expansion to expanding along multiple rows or columns simultaneously.

                For a subset P of row indices, the determinant can be expanded as a sum over all column subsets Q of the same size, involving products of complementary minors.

                noncomputable def AlgebraicCombinatorics.Determinants.finsetToFin {m k : } (S : Finset (Fin m)) (hk : S.card = k) :
                Fin k Fin m

                Helper: Given a finset of indices, produce an order-preserving embedding into Fin m. This is used to extract submatrices corresponding to index subsets.

                Equations
                Instances For
                  noncomputable def AlgebraicCombinatorics.Determinants.submatrixOfFinsets' {R : Type u_1} {m k : } (A : Matrix (Fin m) (Fin m) R) (P Q : Finset (Fin m)) (hP : P.card = k) (hQ : Q.card = k) :
                  Matrix (Fin k) (Fin k) R

                  The submatrix of A with rows from P and columns from Q (when |P| = |Q|). This is the minor sub_P^Q(A) in the source notation.

                  Equations
                  Instances For
                    noncomputable def AlgebraicCombinatorics.Determinants.submatrixDet {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin m) (Fin m) R) (P Q : Finset (Fin m)) :
                    R

                    The determinant of a submatrix corresponding to row set P and column set Q. Returns 0 if |P| ≠ |Q|.

                    Equations
                    Instances For

                      Determinants.submatrixDet equals PermFinset.submatrixDet.

                      Both are "total" definitions (return 0 when |P| ≠ |Q|). They differ only in implementation: this one uses finsetToFin/submatrixOfFinsets', while PermFinset.submatrixDet uses orderEmbOfFin directly. These are definitionally equal.

                      The set of column subsets Q with |Q| = |P|.

                      Equations
                      Instances For

                        Permutation image definitions #

                        This section uses the canonical definitions from PermFinset:

                        See Determinants/PermFinset.lean for the shared definitions and API.

                        Helper lemmas for sum_perms_eq_det_prod #

                        The following lemmas establish properties of permutations that map one finset to another, which are needed for the multi-row Laplace expansion proof.

                        Sorting permutation and its sign #

                        The key to the multi-row Laplace expansion is understanding how permutations that map one finset to another decompose. Given finsets P and Q of the same cardinality, a permutation σ with σ(P) = Q can be decomposed as:

                        σ = sortQ⁻¹ ∘ (sumCongr τ ρ) ∘ sortP

                        where:

                        The sign of σ then decomposes as: sign(σ) = sign(sortP) · sign(sortQ)⁻¹ · sign(τ) · sign(ρ) = sign(sortP) · sign(sortQ) · sign(τ) · sign(ρ) (since sign² = 1)

                        The key identity is: sign(sortP) · sign(sortQ) = (-1)^(∑ P + ∑ Q) when |P| = |Q|

                        The sign decomposition: for σ ∈ PermFinset.permsMapping P Q with corresponding (τ, ρ), sign(σ) = (-1)^(∑ P + ∑ Q) · sign(τ) · sign(ρ)

                        Proof: By permsMappingEquiv_sign_spec, sign(σ) = sign(sortP) · sign(sortQ) · sign(τ) · sign(ρ). By sign_sortingPermOfFinset_mul, sign(sortP) · sign(sortQ) = (-1)^(∑P + ∑Q).

                        theorem AlgebraicCombinatorics.Determinants.det_laplace_multi_row {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin m) (Fin m) R) (P : Finset (Fin m)) :
                        A.det = QsameCardSubsets m P, (-1) ^ (P.sum Fin.val + Q.sum Fin.val) * submatrixDet A P Q * submatrixDet A P Q

                        Theorem thm.det.laplace-multi (a): For any subset P of [n], det A = ∑{Q : |Q|=|P|} (-1)^(sum P + sum Q) det(sub_P^Q A) det(sub{~P}^{~Q} A)

                        This is a more general form of Laplace expansion. When |P| = 1, this reduces to the standard single-row Laplace expansion. Label: thm.det.laplace-multi

                        Proof strategy (from Theorem 6.156 of detnotes):

                        1. Express det A using the Leibniz formula: det A = ∑{σ ∈ Sₙ} sign(σ) ∏ᵢ A{i,σ(i)}
                        2. Partition permutations σ based on how they map P to subsets Q of the same size
                        3. For each Q with |Q| = |P|, the permutations σ with σ(P) = Q factor as:
                          • A bijection τ : P → Q (contributing to det(sub_P^Q A))
                          • A bijection ρ : Pᶜ → Qᶜ (contributing to det(sub_{Pᶜ}^{Qᶜ} A))
                        4. The sign of σ decomposes as sign(σ) = (-1)^(sum P + sum Q) · sign(τ) · sign(ρ) where the (-1)^(sum P + sum Q) accounts for reordering indices.
                        5. Summing over all τ and ρ gives the product of minors.
                        theorem AlgebraicCombinatorics.Determinants.det_laplace_multi_col {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin m) (Fin m) R) (Q : Finset (Fin m)) :
                        A.det = PsameCardSubsets m Q, (-1) ^ (P.sum Fin.val + Q.sum Fin.val) * submatrixDet A P Q * submatrixDet A P Q

                        Theorem thm.det.laplace-multi (b): For any subset Q of [n], det A = ∑{P : |P|=|Q|} (-1)^(sum P + sum Q) det(sub_P^Q A) det(sub{~P}^{~Q} A) Label: thm.det.laplace-multi

                        Desnanot-Jacobi Identity (Theorem thm.det.des-jac-1) #

                        The Desnanot-Jacobi identity relates the determinant of a matrix to determinants of its submatrices. This is the foundation of Dodgson condensation.

                        For an n×n matrix A with n ≥ 2, let A' be the (n-2)×(n-2) matrix obtained by removing the first row, last row, first column, and last column. Then:

                        det(A) · det(A') = det(A_{~1,~1}) · det(A_{~n,~n}) - det(A_{~1,~n}) · det(A_{~n,~1})

                        The proof uses the relationship between the adjugate matrix and submatrix determinants. The key insight is that the 2×2 determinant of the corner submatrix of adj(A) equals det(A) · det(A') by Jacobi's complementary minor theorem.

                        def AlgebraicCombinatorics.Determinants.innerSubmatrix {R : Type u_1} {m : } (A : Matrix (Fin (m + 2)) (Fin (m + 2)) R) :
                        Matrix (Fin m) (Fin m) R

                        The inner submatrix A' in the Desnanot-Jacobi identity: the (n-2)×(n-2) matrix obtained by removing first/last rows and columns. Label: thm.det.des-jac-1

                        Equations
                        Instances For

                          Helper lemmas for Desnanot-Jacobi #

                          theorem AlgebraicCombinatorics.Determinants.adjugate_corner_00 {R : Type u_1} [CommRing R] {k : } (A : Matrix (Fin (k + 2)) (Fin (k + 2)) R) :

                          The (0,0) entry of the adjugate equals det of the (0,0) minor

                          theorem AlgebraicCombinatorics.Determinants.adjugate_corner_last_last {R : Type u_1} [CommRing R] {k : } (A : Matrix (Fin (k + 2)) (Fin (k + 2)) R) :
                          A.adjugate (Fin.last (k + 1)) (Fin.last (k + 1)) = (submatrixRemove A (Fin.last (k + 1)) (Fin.last (k + 1))).det

                          The (last,last) entry of the adjugate equals det of the (last,last) minor

                          theorem AlgebraicCombinatorics.Determinants.adjugate_corner_0_last {R : Type u_1} [CommRing R] {k : } (A : Matrix (Fin (k + 2)) (Fin (k + 2)) R) :
                          A.adjugate 0 (Fin.last (k + 1)) = (-1) ^ (k + 1) * (submatrixRemove A (Fin.last (k + 1)) 0).det

                          The (0,last) entry of the adjugate equals (-1)^(k+1) times det of the (last,0) minor

                          theorem AlgebraicCombinatorics.Determinants.adjugate_corner_last_0 {R : Type u_1} [CommRing R] {k : } (A : Matrix (Fin (k + 2)) (Fin (k + 2)) R) :
                          A.adjugate (Fin.last (k + 1)) 0 = (-1) ^ (k + 1) * (submatrixRemove A 0 (Fin.last (k + 1))).det

                          The (last,0) entry of the adjugate equals (-1)^(k+1) times det of the (0,last) minor

                          theorem AlgebraicCombinatorics.Determinants.det_adjugate_corners {R : Type u_1} [CommRing R] {k : } (A : Matrix (Fin (k + 2)) (Fin (k + 2)) R) :
                          A.adjugate 0 0 * A.adjugate (Fin.last (k + 1)) (Fin.last (k + 1)) - A.adjugate 0 (Fin.last (k + 1)) * A.adjugate (Fin.last (k + 1)) 0 = (submatrixRemove A 0 0).det * (submatrixRemove A (Fin.last (k + 1)) (Fin.last (k + 1))).det - (submatrixRemove A 0 (Fin.last (k + 1))).det * (submatrixRemove A (Fin.last (k + 1)) 0).det

                          The 2×2 determinant of the corner entries of the adjugate simplifies to the product of diagonal minors minus the product of off-diagonal minors. This is a key step in proving the Desnanot-Jacobi identity.

                          Desnanot-Jacobi identity for 2×2 matrices (base case)

                          Desnanot-Jacobi identity for 3×3 matrices

                          Desnanot-Jacobi identity for 4×4 matrices. The proof expands all determinants and uses ring to verify the polynomial identity.

                          theorem AlgebraicCombinatorics.Determinants.det_fin_four' {R : Type u_1} [CommRing R] (A : Matrix (Fin 4) (Fin 4) R) :
                          A.det = A 0 0 * (A 1 1 * (A 2 2 * A 3 3 - A 2 3 * A 3 2) - A 1 2 * (A 2 1 * A 3 3 - A 2 3 * A 3 1) + A 1 3 * (A 2 1 * A 3 2 - A 2 2 * A 3 1)) - A 0 1 * (A 1 0 * (A 2 2 * A 3 3 - A 2 3 * A 3 2) - A 1 2 * (A 2 0 * A 3 3 - A 2 3 * A 3 0) + A 1 3 * (A 2 0 * A 3 2 - A 2 2 * A 3 0)) + A 0 2 * (A 1 0 * (A 2 1 * A 3 3 - A 2 3 * A 3 1) - A 1 1 * (A 2 0 * A 3 3 - A 2 3 * A 3 0) + A 1 3 * (A 2 0 * A 3 1 - A 2 1 * A 3 0)) - A 0 3 * (A 1 0 * (A 2 1 * A 3 2 - A 2 2 * A 3 1) - A 1 1 * (A 2 0 * A 3 2 - A 2 2 * A 3 0) + A 1 2 * (A 2 0 * A 3 1 - A 2 1 * A 3 0))

                          Helper lemma: explicit expansion of 4×4 determinant. Used for expanding submatrices in the 5×5 Desnanot-Jacobi proof. This follows the same pattern as det_fin_three but for 4×4 matrices.

                          theorem AlgebraicCombinatorics.Determinants.det_fin_five' {R : Type u_1} [CommRing R] (A : Matrix (Fin 5) (Fin 5) R) :
                          A.det = A 0 0 * (A 1 1 * (A 2 2 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) + A 2 4 * (A 3 2 * A 4 3 - A 3 3 * A 4 2)) - A 1 2 * (A 2 1 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 3 - A 3 3 * A 4 1)) + A 1 3 * (A 2 1 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 2 - A 3 2 * A 4 1)) - A 1 4 * (A 2 1 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) + A 2 3 * (A 3 1 * A 4 2 - A 3 2 * A 4 1))) - A 0 1 * (A 1 0 * (A 2 2 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) + A 2 4 * (A 3 2 * A 4 3 - A 3 3 * A 4 2)) - A 1 2 * (A 2 0 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 3 - A 3 3 * A 4 0)) + A 1 3 * (A 2 0 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 2 - A 3 2 * A 4 0)) - A 1 4 * (A 2 0 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 2 - A 3 2 * A 4 0))) + A 0 2 * (A 1 0 * (A 2 1 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 3 - A 3 3 * A 4 1)) - A 1 1 * (A 2 0 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 3 - A 3 3 * A 4 0)) + A 1 3 * (A 2 0 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) - A 2 1 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)) - A 1 4 * (A 2 0 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) - A 2 1 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 1 - A 3 1 * A 4 0))) - A 0 3 * (A 1 0 * (A 2 1 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 2 - A 3 2 * A 4 1)) - A 1 1 * (A 2 0 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 2 - A 3 2 * A 4 0)) + A 1 2 * (A 2 0 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) - A 2 1 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)) - A 1 4 * (A 2 0 * (A 3 1 * A 4 2 - A 3 2 * A 4 1) - A 2 1 * (A 3 0 * A 4 2 - A 3 2 * A 4 0) + A 2 2 * (A 3 0 * A 4 1 - A 3 1 * A 4 0))) + A 0 4 * (A 1 0 * (A 2 1 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) + A 2 3 * (A 3 1 * A 4 2 - A 3 2 * A 4 1)) - A 1 1 * (A 2 0 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 2 - A 3 2 * A 4 0)) + A 1 2 * (A 2 0 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) - A 2 1 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)) - A 1 3 * (A 2 0 * (A 3 1 * A 4 2 - A 3 2 * A 4 1) - A 2 1 * (A 3 0 * A 4 2 - A 3 2 * A 4 0) + A 2 2 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)))

                          Helper lemma: explicit expansion of 5×5 determinant. Used for the 5×5 Desnanot-Jacobi proof.

                          Helper lemma: cofactor expansion of 6×6 determinant along the first column. Each 5×5 minor can be further expanded using det_fin_five'. Used for the 6×6 Desnanot-Jacobi proof.

                          Note: This expands the determinant as a sum of 6 terms, where each term is a matrix entry times a 5×5 minor determinant. The 5×5 minors can be further expanded using det_fin_five' if needed.

                          Desnanot-Jacobi identity for 5×5 matrices. The proof follows the same pattern as the 4×4 case: expand all determinants and use ring to verify the polynomial identity.

                          This is a polynomial identity in 25 variables (the matrix entries). The inner submatrix is 3×3, the removed submatrices are 4×4, and the main matrix is 5×5.

                          Helper lemmas for Fin.succAbove computations in 6×6 matrices #

                          These lemmas are used to convert Fin.succAbove indices to concrete values when expanding determinants. Each lemma states that Fin.succAbove i j equals a specific concrete value for i : Fin 6 and j : Fin 5.

                          theorem AlgebraicCombinatorics.Determinants.inner_det_6x6 {R : Type u_1} [CommRing R] (A : Matrix (Fin 6) (Fin 6) R) :
                          (innerSubmatrix A).det = A 1 1 * (A 2 2 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) + A 2 4 * (A 3 2 * A 4 3 - A 3 3 * A 4 2)) - A 1 2 * (A 2 1 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 3 - A 3 3 * A 4 1)) + A 1 3 * (A 2 1 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 2 - A 3 2 * A 4 1)) - A 1 4 * (A 2 1 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) + A 2 3 * (A 3 1 * A 4 2 - A 3 2 * A 4 1))

                          Helper lemma: expansion of the inner 4×4 determinant for a 6×6 matrix. The inner submatrix consists of entries A i j for i, j ∈ {1, 2, 3, 4}.

                          theorem AlgebraicCombinatorics.Determinants.submatrixRemove_last_last_det_6x6 {R : Type u_1} [CommRing R] (A : Matrix (Fin 6) (Fin 6) R) :
                          (submatrixRemove A (Fin.last 5) (Fin.last 5)).det = A 0 0 * (A 1 1 * (A 2 2 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) + A 2 4 * (A 3 2 * A 4 3 - A 3 3 * A 4 2)) - A 1 2 * (A 2 1 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 3 - A 3 3 * A 4 1)) + A 1 3 * (A 2 1 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 2 - A 3 2 * A 4 1)) - A 1 4 * (A 2 1 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) + A 2 3 * (A 3 1 * A 4 2 - A 3 2 * A 4 1))) - A 0 1 * (A 1 0 * (A 2 2 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) + A 2 4 * (A 3 2 * A 4 3 - A 3 3 * A 4 2)) - A 1 2 * (A 2 0 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 3 - A 3 3 * A 4 0)) + A 1 3 * (A 2 0 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 2 - A 3 2 * A 4 0)) - A 1 4 * (A 2 0 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 2 - A 3 2 * A 4 0))) + A 0 2 * (A 1 0 * (A 2 1 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 3 - A 3 3 * A 4 1)) - A 1 1 * (A 2 0 * (A 3 3 * A 4 4 - A 3 4 * A 4 3) - A 2 3 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 3 - A 3 3 * A 4 0)) + A 1 3 * (A 2 0 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) - A 2 1 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)) - A 1 4 * (A 2 0 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) - A 2 1 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 1 - A 3 1 * A 4 0))) - A 0 3 * (A 1 0 * (A 2 1 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) + A 2 4 * (A 3 1 * A 4 2 - A 3 2 * A 4 1)) - A 1 1 * (A 2 0 * (A 3 2 * A 4 4 - A 3 4 * A 4 2) - A 2 2 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 2 - A 3 2 * A 4 0)) + A 1 2 * (A 2 0 * (A 3 1 * A 4 4 - A 3 4 * A 4 1) - A 2 1 * (A 3 0 * A 4 4 - A 3 4 * A 4 0) + A 2 4 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)) - A 1 4 * (A 2 0 * (A 3 1 * A 4 2 - A 3 2 * A 4 1) - A 2 1 * (A 3 0 * A 4 2 - A 3 2 * A 4 0) + A 2 2 * (A 3 0 * A 4 1 - A 3 1 * A 4 0))) + A 0 4 * (A 1 0 * (A 2 1 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) + A 2 3 * (A 3 1 * A 4 2 - A 3 2 * A 4 1)) - A 1 1 * (A 2 0 * (A 3 2 * A 4 3 - A 3 3 * A 4 2) - A 2 2 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 2 - A 3 2 * A 4 0)) + A 1 2 * (A 2 0 * (A 3 1 * A 4 3 - A 3 3 * A 4 1) - A 2 1 * (A 3 0 * A 4 3 - A 3 3 * A 4 0) + A 2 3 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)) - A 1 3 * (A 2 0 * (A 3 1 * A 4 2 - A 3 2 * A 4 1) - A 2 1 * (A 3 0 * A 4 2 - A 3 2 * A 4 0) + A 2 2 * (A 3 0 * A 4 1 - A 3 1 * A 4 0)))

                          Helper lemma: expansion of (submatrixRemove A (Fin.last 5) (Fin.last 5)).det for 6×6 matrices. This is the 5×5 submatrix with rows/cols 0,1,2,3,4 (removing row 5 and col 5).

                          Block Matrix Helpers for Complementary Minor (2×2 Corner Case) #

                          These lemmas provide an alternative proof path for complementary_minor_2x2_corner using block matrix techniques. The key idea is to permute the matrix A so that rows/columns {0, last} come first, creating a block matrix where the Schur complement formula applies.

                          This breaks the circular dependency between complementary_minor_2x2_corner and desnanot_jacobi for m ≥ 5 matrices. (The circular dependency has been resolved.)

                          Desnanot-Jacobi identity for 6×6 matrices. This lemma is placed after desnanot_jacobi_field to avoid circular dependencies. The proof uses the polynomial ring approach combined with field of fractions.

                          The key lemma for 2×2 matrices (base case n = 0): For a 2×2 matrix, adj₀₀ * adj₁₁ - adj₀₁ * adj₁₀ = det(A) * 1 = det(A).

                          This is the base case of Jacobi's complementary minor theorem. For 2×2 matrix [[a,b],[c,d]], adjugate = [[d,-b],[-c,a]], so:

                          • adj₀₀ * adj₁₁ = d * a
                          • adj₀₁ * adj₁₀ = (-b) * (-c) = bc
                          • LHS = da - bc = det(A)
                          • RHS = det(A) * det(0×0 matrix) = det(A) * 1 = det(A) ✓

                          The key lemma for 3×3 matrices (case n = 1): For a 3×3 matrix, the 2×2 determinant of the corner entries of the adjugate equals det(A) times the middle entry A₁₁.

                          This verifies Jacobi's complementary minor theorem for the specific case where P = Q = {0, 2} (first and last indices).

                          theorem AlgebraicCombinatorics.Determinants.desnanot_jacobi {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 2)) (Fin (m + 2)) R) :

                          Desnanot-Jacobi identity (Theorem thm.det.des-jac-1): det(A) · det(A') = det(A_{~1,~1}) · det(A_{~n,~n}) - det(A_{~1,~n}) · det(A_{~n,~1})

                          Here A' is the inner submatrix (removing first/last rows and columns).

                          The proof uses Jacobi's complementary minor theorem: the 2×2 determinant of the corner submatrix of adj(A) at positions {0, last} × {0, last} equals det(A) · det(innerSubmatrix A).

                          Label: thm.det.des-jac-1

                          theorem AlgebraicCombinatorics.Determinants.desnanot_jacobi_det2 {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 2)) (Fin (m + 2)) R) :
                          A.det * (innerSubmatrix A).det = !![(submatrixRemove A 0 0).det, (submatrixRemove A 0 (Fin.last (m + 1))).det; (submatrixRemove A (Fin.last (m + 1)) 0).det, (submatrixRemove A (Fin.last (m + 1)) (Fin.last (m + 1))).det].det

                          Alternative formulation of Desnanot-Jacobi using a 2×2 determinant: det(A) · det(A') = det [[det(A_{~1,~1}), det(A_{~1,~n})], [det(A_{~n,~1}), det(A_{~n,~n})]] Label: thm.det.des-jac-1

                          Generalized Desnanot-Jacobi (Theorem thm.det.des-jac-2) #

                          The generalized version allows choosing any two rows p < q and any two columns u < v, not just the first and last.

                          @[reducible, inline]
                          abbrev AlgebraicCombinatorics.Determinants.skipTwo {m : } (p q : Fin (m + 2)) (hpq : p < q) :
                          Fin mFin (m + 2)

                          Alias for Fin.skipTwo - skip two indices p < q in Fin (m+2). This definition is imported from AlgebraicCombinatorics.Fin.SkipTwo.

                          Equations
                          Instances For
                            def AlgebraicCombinatorics.Determinants.submatrixRemove2 {R : Type u_1} {m : } (A : Matrix (Fin (m + 2)) (Fin (m + 2)) R) (p q u v : Fin (m + 2)) (hpq : p < q) (huv : u < v) :
                            Matrix (Fin m) (Fin m) R

                            Submatrix removing two rows (p, q with p < q) and two columns (u, v with u < v). This is the submatrix sub_{[n]{p,q}}^{[n]{u,v}} A in the source notation.

                            Equations
                            Instances For

                              Properties of skipTwo #

                              These lemmas are aliases for the corresponding lemmas in AlgebraicCombinatorics.Fin.SkipTwo.

                              theorem AlgebraicCombinatorics.Determinants.card_compl_pair {m : } (p q : Fin (m + 2)) (hpq : p < q) :

                              The complement of {p, q} in Fin (m + 2) has cardinality m.

                              theorem AlgebraicCombinatorics.Determinants.skipTwo_mem_compl {m : } (p q : Fin (m + 2)) (hpq : p < q) (i : Fin m) :
                              skipTwo p q hpq i {p, q}

                              skipTwo gives values in the complement of {p, q}. Alias for Fin.skipTwo_mem_compl.

                              theorem AlgebraicCombinatorics.Determinants.skipTwo_strictMono {m : } (p q : Fin (m + 2)) (hpq : p < q) :

                              skipTwo is strictly monotone. Alias for Fin.skipTwo_strictMono.

                              skipTwo is injective. Alias for Fin.skipTwo_injective.

                              theorem AlgebraicCombinatorics.Determinants.skipTwo_range {m : } (p q : Fin (m + 2)) (hpq : p < q) :
                              Set.range (skipTwo p q hpq) = {p, q}

                              The range of skipTwo is exactly the complement of {p, q}.

                              theorem AlgebraicCombinatorics.Determinants.skipTwo_eq_orderEmbOfFin_compl {m : } (p q : Fin (m + 2)) (hpq : p < q) :
                              skipTwo p q hpq = ({p, q}.orderEmbOfFin )

                              skipTwo equals the canonical orderEmbOfFin enumeration of {p,q}ᶜ. This is the key lemma that connects skipTwo with Mathlib's canonical enumeration, allowing us to use Mathlib's API for ordered enumerations of finsets.

                              theorem AlgebraicCombinatorics.Determinants.skipTwo_eq_finsetToFin_compl {m : } (p q : Fin (m + 2)) (hpq : p < q) :
                              skipTwo p q hpq = (finsetToFin {p, q} )

                              skipTwo equals finsetToFin on the complement {p,q}ᶜ. This connects our explicit skipTwo function with the canonical enumeration used in submatrixDet and submatrixOfFinsets'.

                              theorem AlgebraicCombinatorics.Determinants.submatrixRemove2_det_eq_submatrixDet_compl {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 2)) (Fin (m + 2)) R) (p q u v : Fin (m + 2)) (hpq : p < q) (huv : u < v) :
                              (submatrixRemove2 A p q u v hpq huv).det = submatrixDet A {p, q} {u, v}

                              The determinant of submatrixRemove2 equals submatrixDet on complements. This is the key connection between our explicit submatrix construction and the general submatrixDet definition using finsets. Combined with jacobi_complementary_minor, this allows proving desnanot_jacobi_direct for all matrix sizes.

                              Helper lemmas for skipTwo in Fin 4 #

                              These simp lemmas allow efficient computation of skipTwo values for all valid (p, q) pairs in Fin 4. There are 6 such pairs: (0,1), (0,2), (0,3), (1,2), (1,3), (2,3).

                              Helper lemmas for Fin.succAbove in Fin 4 #

                              These simp lemmas allow efficient computation of Fin.succAbove for Fin 4.

                              theorem AlgebraicCombinatorics.Determinants.inv_apply_eq_adjugate_div_det {K : Type u_2} [Field K] {n : } (A : Matrix (Fin n) (Fin n) K) (hA : A.det 0) (i j : Fin n) :
                              A⁻¹ i j = A.adjugate i j / A.det

                              For a matrix over a field with nonzero determinant, each entry of the inverse equals the corresponding adjugate entry divided by the determinant.

                              Note: A⁻¹ i j = adjugate(A) i j / det(A) (same indices, not swapped). This follows from A⁻¹ = det⁻¹ • adjugate.

                              theorem AlgebraicCombinatorics.Determinants.adjugate_eq_det_smul_inv {K : Type u_2} [Field K] {n : } (A : Matrix (Fin n) (Fin n) K) (hA : A.det 0) (i j : Fin n) :
                              A.adjugate i j = A.det * A⁻¹ i j

                              For invertible matrices, adjugate(A) = det(A) • A⁻¹ entry-wise.

                              theorem AlgebraicCombinatorics.Determinants.adjugate_submatrix_eq_smul {R : Type u_1} [CommRing R] {n : Type u_2} [DecidableEq n] [Fintype n] {m' : Type u_3} (A : Matrix n n R) (h : IsUnit A.det) (f g : m'n) :

                              Key lemma: For invertible A, the adjugate submatrix equals det(A) times the inverse submatrix. This follows from adj(A) = det(A) • A⁻¹ for invertible A.

                              theorem AlgebraicCombinatorics.Determinants.det_adjugate_submatrix_finset {R : Type u_1} [CommRing R] {m k : } (A : Matrix (Fin m) (Fin m) R) (h : IsUnit A.det) (P Q : Finset (Fin m)) (hP : P.card = k) (hQ : Q.card = k) :

                              For invertible A with |P| = |Q| = k, the determinant of the adjugate submatrix equals det(A)^k times the determinant of the inverse submatrix. This reduces Jacobi's complementary minor theorem to the complementary minor theorem for inverse matrices.

                              theorem AlgebraicCombinatorics.Determinants.complementary_minor_block {R : Type u_1} [CommRing R] {m' : Type u_2} {n' : Type u_3} [Fintype m'] [DecidableEq m'] [Fintype n'] [DecidableEq n'] (A : Matrix m' m' R) (B : Matrix m' n' R) (C : Matrix n' m' R) (D : Matrix n' n' R) [Invertible D] [Invertible (A - B * D * C)] [Invertible (Matrix.fromBlocks A B C D)] :

                              Complementary minor theorem for block matrices (special case).

                              For a block matrix M = [[A, B], [C, D]] with D invertible and the Schur complement (A - B * D⁻¹ * C) invertible, the determinant of the top-left block of M⁻¹ satisfies:

                              det(M) * det((M⁻¹)₁₁) = det(D)

                              This is the key lemma for Jacobi's complementary minor theorem. It follows from the Schur complement formula: det(M) = det(D) * det(A - B * D⁻¹ * C), combined with the fact that (M⁻¹)₁₁ = (A - B * D⁻¹ * C)⁻¹.

                              The general complementary minor theorem (for arbitrary index sets P, Q) follows by permuting rows and columns to bring P and Q to the first positions.

                              Helper lemmas for the Schur complement approach #

                              The key identity for block matrices relates the determinant of the adjugate's top-left block to the determinant of the original matrix and its bottom-right block:

                              det(adj(M).toBlocks₁₁) = det(M)^(k-1) * det(M.toBlocks₂₂)

                              where k is the size of the top-left block.

                              This follows from the Schur complement formula for block matrix inverses.

                              theorem AlgebraicCombinatorics.Determinants.adjugate_toBlocks₁₁_det_of_invertible {m : Type u_3} {n : Type u_4} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] {R : Type u_5} [CommRing R] (A : Matrix m m R) (B : Matrix m n R) (C : Matrix n m R) (D : Matrix n n R) [hD : Invertible D] [hSchur : Invertible (A - B * D * C)] [hM : Invertible (Matrix.fromBlocks A B C D)] (hk : Fintype.card m 1) :

                              Key identity: For invertible block matrices with invertible bottom-right block, the determinant of the adjugate's top-left block equals det(M)^(k-1) * det(D).

                              This is the Schur complement version of Jacobi's complementary minor theorem for the special case of block matrices.

                              Helper: convert orderIsoOfFin to an embedding from Fin |P| to Fin m. This gives an order-preserving embedding that picks out the elements of P.

                              Equations
                              Instances For

                                The image of finsetOrderEmb is exactly P.

                                finsetOrderEmb is injective (follows from being an embedding).

                                finsetOrderEmb equals orderEmbOfFin (Mathlib's standard function).

                                noncomputable def AlgebraicCombinatorics.Determinants.sortEquivPQ {m : } (P : Finset (Fin m)) :
                                Fin P.card Fin (m - P.card) Fin m

                                Equivalence that sorts indices so that P elements come first (as Sum.inl) and Pᶜ elements come second (as Sum.inr). This uses finSumEquivOfFinset.

                                Equations
                                Instances For

                                  sortEquivPQ sends Sum.inl to the same values as finsetOrderEmb.

                                  sortEquivPQ sends Sum.inr to finsetOrderEmb of the complement (with appropriate casting).

                                  theorem AlgebraicCombinatorics.Determinants.inv_submatrix_equiv {K : Type u_2} [Field K] {m : } {n : Type u_3} [DecidableEq n] [Fintype n] (A : Matrix (Fin m) (Fin m) K) (hA : IsUnit A.det) (σ τ : n Fin m) :
                                  (A.submatrix σ τ)⁻¹ = A⁻¹.submatrix τ σ

                                  Inverse of a matrix permuted by two equivalences.

                                  theorem AlgebraicCombinatorics.Determinants.det_submatrix_equiv_equiv {K : Type u_2} [Field K] {m : } {n : Type u_3} [DecidableEq n] [Fintype n] (A : Matrix (Fin m) (Fin m) K) (f g : n Fin m) :
                                  (A.submatrix f g).det = (Equiv.Perm.sign (g.symm.trans f)) * A.det

                                  Determinant of a matrix permuted by two equivalences.

                                  noncomputable def AlgebraicCombinatorics.Determinants.sortEquivPQ_cast {m : } (Q : Finset (Fin m)) (k : ) (hk : Q.card = k) :
                                  Fin k Fin (m - k) Fin m

                                  Cast version of sortEquivPQ for when we need matching domain types.

                                  Equations
                                  Instances For
                                    theorem AlgebraicCombinatorics.Determinants.sortEquivPQ_cast_inl {m : } (Q : Finset (Fin m)) (k : ) (hk : Q.card = k) (i : Fin k) :
                                    (sortEquivPQ_cast Q k hk) (Sum.inl i) = (Q.orderEmbOfFin ) ((finCongr ) i)

                                    sortEquivPQ_cast sends Sum.inl to the corresponding element of Q.

                                    theorem AlgebraicCombinatorics.Determinants.sortEquivPQ_cast_inr {m : } (Q : Finset (Fin m)) (k : ) (hk : Q.card = k) (i : Fin (m - k)) :

                                    sortEquivPQ_cast sends Sum.inr to finsetOrderEmb of the complement (with appropriate casting). This is the key lemma for relating the bottom-right block of M to the complementary submatrix.

                                    theorem AlgebraicCombinatorics.Determinants.inv_submatrix_topleft {K : Type u_2} [Field K] {m : } (A : Matrix (Fin m) (Fin m) K) (P Q : Finset (Fin m)) (hPQ : P.card = Q.card) :
                                    let k := P.card; have σ := sortEquivPQ_cast Q k ; have τ := sortEquivPQ P; (A⁻¹.submatrix τ σ).submatrix Sum.inl Sum.inl = A⁻¹.submatrix (finsetOrderEmb P) fun (i : Fin P.card) => (finsetOrderEmb Q) ((finCongr hPQ) i)

                                    The top-left block of (A⁻¹.submatrix τ σ) equals sub_P^Q(A⁻¹).

                                    theorem AlgebraicCombinatorics.Determinants.complementary_minor_inverse {K : Type u_2} [Field K] {m : } (A : Matrix (Fin m) (Fin m) K) (hA : A.det 0) (P Q : Finset (Fin m)) (hPQ : P.card = Q.card) :
                                    A.det * (A⁻¹.submatrix (finsetOrderEmb P) fun (i : Fin P.card) => (finsetOrderEmb Q) ((finCongr hPQ) i)).det = (-1) ^ (P.sum Fin.val + Q.sum Fin.val) * (A.submatrix (finsetOrderEmb Q) fun (i : Fin Q.card) => (finsetOrderEmb P) ((finCongr ) i)).det
                                    theorem AlgebraicCombinatorics.Determinants.jacobi_complementary_minor_field {K : Type u_2} [Field K] {m : } (A : Matrix (Fin m) (Fin m) K) (hA : A.det 0) (P Q : Finset (Fin m)) (hPQ : P.card = Q.card) (hP : P.card 1) :
                                    (A.adjugate.submatrix (finsetOrderEmb P) fun (i : Fin P.card) => (finsetOrderEmb Q) ((finCongr hPQ) i)).det = (-1) ^ (P.sum Fin.val + Q.sum Fin.val) * A.det ^ (Q.card - 1) * (A.submatrix (finsetOrderEmb Q) fun (i : Fin Q.card) => (finsetOrderEmb P) ((finCongr ) i)).det

                                    Corollary: For invertible A with |P| = |Q| = k, the determinant of the adjugate submatrix can be computed from the complementary minor of A.

                                    det(sub_P^Q(adj A)) = (-1)^(sum P + sum Q) * det(A)^(k-1) * det(sub_{Qᶜ}^{Pᶜ}(A))

                                    This follows from:

                                    • adj(A) = det(A) * A⁻¹ for invertible A
                                    • det(sub_P^Q(adj A)) = det(A)^k * det(sub_P^Q(A⁻¹))
                                    • complementary_minor_inverse: det(A) * det(sub_P^Q(A⁻¹)) = (-1)^(...) * det(sub_{Qᶜ}^{Pᶜ}(A))

                                    Alternative Approach via Jacobi's Complementary Minor Theorem #

                                    The desnanot_jacobi_direct lemma below can alternatively be proved using jacobi_complementary_minor (which is already proved in this file). The key insight is:

                                    1. jacobi_complementary_minor with P = {u, v} and Q = {p, q} gives: submatrixDet A.adjugate {u,v} {p,q} = (-1)^(u+v+p+q) * A.det * submatrixDet A {p,q}ᶜ {u,v}ᶜ

                                    2. The LHS can be expressed as a 2×2 determinant of adjugate entries: A.adjugate u p * A.adjugate v q - A.adjugate u q * A.adjugate v p

                                    3. By adjugate_2x2_eq, this equals: (-1)^(p+u+q+v) * (det(A_{~p,~u}) * det(A_{~q,~v}) - det(A_{~q,~u}) * det(A_{~p,~v}))

                                    4. Combining and canceling the sign factor: det(A_{~p,~u}) * det(A_{~q,~v}) - det(A_{~p,~v}) * det(A_{~q,~u}) = A.det * submatrixDet A {p,q}ᶜ {u,v}ᶜ

                                    5. The RHS submatrixDet A {p,q}ᶜ {u,v}ᶜ equals (submatrixRemove2 A p q u v).det, giving the Desnanot-Jacobi identity.

                                    This approach requires proving that orderEmbOfFin on the complement {p,q}ᶜ gives the same indexing as skipTwo p q. The following helper lemmas support this approach.

                                    theorem AlgebraicCombinatorics.Determinants.desnanot_jacobi_general {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 2)) (Fin (m + 2)) R) (p q u v : Fin (m + 2)) (hpq : p < q) (huv : u < v) :
                                    A.det * (submatrixRemove2 A p q u v hpq huv).det = (submatrixRemove A p u).det * (submatrixRemove A q v).det - (submatrixRemove A p v).det * (submatrixRemove A q u).det

                                    Generalized Desnanot-Jacobi identity (Theorem thm.det.des-jac-2): For p < q and u < v, det(A) · det(sub_{[n]{p,q}}^{[n]{u,v}} A) = det(A_{~p,~u}) · det(A_{~q,~v}) - det(A_{~p,~v}) · det(A_{~q,~u})

                                    The proof follows from Jacobi's complementary minor theorem for the 2×2 case. By comparing the 2×2 determinant of the adjugate submatrix (computed two ways), we obtain the desired identity. Label: thm.det.des-jac-2

                                    Cauchy Determinant (Theorem thm.det.cauchy) #

                                    The Cauchy determinant formula gives the determinant of the matrix (1/(xᵢ + yⱼ)).

                                    def AlgebraicCombinatorics.Determinants.cauchyMat {n : } {K : Type u_2} [Field K] (x y : Fin nK) (_h : ∀ (i j : Fin n), x i + y j 0) :
                                    Matrix (Fin n) (Fin n) K

                                    The Cauchy matrix with entries 1/(xᵢ + yⱼ). Label: thm.det.cauchy

                                    Equations
                                    Instances For
                                      @[simp]
                                      theorem AlgebraicCombinatorics.Determinants.cauchyMat_apply {n : } {K : Type u_2} [Field K] (x y : Fin nK) (h : ∀ (i j : Fin n), x i + y j 0) (i j : Fin n) :
                                      cauchyMat x y h i j = (x i + y j)⁻¹

                                      Helper lemmas for Cauchy determinant #

                                      def AlgebraicCombinatorics.Determinants.cauchyNumerator {K : Type u_2} [Field K] {m : } (x y : Fin mK) :
                                      K

                                      The numerator of the Cauchy determinant formula: ∏_{i<j}((xᵢ - xⱼ)(yᵢ - yⱼ))

                                      Equations
                                      Instances For
                                        def AlgebraicCombinatorics.Determinants.cauchyDenominator {K : Type u_2} [Field K] {m : } (x y : Fin mK) :
                                        K

                                        The denominator of the Cauchy determinant formula: ∏_{i,j}(xᵢ + yⱼ)

                                        Equations
                                        Instances For
                                          theorem AlgebraicCombinatorics.Determinants.cauchyMat_submatrix_succAbove {K : Type u_2} [Field K] {m : } (x y : Fin (m + 1)K) (h : ∀ (i j : Fin (m + 1)), x i + y j 0) (p q : Fin (m + 1)) :

                                          Submatrix property: removing row p and column q from a Cauchy matrix gives another Cauchy matrix.

                                          theorem AlgebraicCombinatorics.Determinants.cauchy_det_zero {K : Type u_2} [Field K] (x y : Fin 0K) (h : ∀ (i j : Fin 0), x i + y j 0) :

                                          Cauchy determinant for n = 0: det = 1 = 1/1

                                          theorem AlgebraicCombinatorics.Determinants.cauchy_det_one {K : Type u_2} [Field K] (x y : Fin 1K) (h : ∀ (i j : Fin 1), x i + y j 0) :

                                          Cauchy determinant for n = 1: det = 1/(x_0 + y_0)

                                          theorem AlgebraicCombinatorics.Determinants.cauchy_det_two {K : Type u_2} [Field K] (x y : Fin 2K) (h : ∀ (i j : Fin 2), x i + y j 0) :

                                          Cauchy determinant for n = 2

                                          theorem AlgebraicCombinatorics.Determinants.cauchy_det_three {K : Type u_2} [Field K] (x y : Fin 3K) (h : ∀ (i j : Fin 3), x i + y j 0) :

                                          Cauchy determinant for n = 3

                                          Multivariate Factor Theorem #

                                          The multivariate factor theorem is a key tool for the factor hunting proof. It states that if a polynomial P evaluates to 0 when we substitute X_j for X_i, then (X_i - X_j) divides P.

                                          This is proved by induction on the polynomial structure, showing that P - P|_{X_i = X_j} is divisible by (X_i - X_j).

                                          noncomputable def AlgebraicCombinatorics.Determinants.substXiToXj {R : Type u_1} [CommRing R] {σ : Type u_2} [DecidableEq σ] (i j : σ) :

                                          Substitution that replaces X_i with X_j in a multivariate polynomial.

                                          Equations
                                          Instances For
                                            theorem AlgebraicCombinatorics.Determinants.X_sub_X_dvd_sub_subst {R : Type u_1} [CommRing R] {σ : Type u_2} [DecidableEq σ] (p : MvPolynomial σ R) (i j : σ) (_hij : i j) :

                                            The multivariate factor theorem: (X_i - X_j) divides P - P|_{X_i = X_j}. This is the multivariate analogue of Polynomial.sub_dvd_eval_sub.

                                            theorem AlgebraicCombinatorics.Determinants.X_sub_X_dvd_of_subst_eq_zero {R : Type u_1} [CommRing R] {σ : Type u_2} [DecidableEq σ] (p : MvPolynomial σ R) (i j : σ) (hij : i j) (h : (substXiToXj i j) p = 0) :

                                            Corollary of the multivariate factor theorem: if P|_{X_i = X_j} = 0, then (X_i - X_j) | P.

                                            theorem AlgebraicCombinatorics.Determinants.cauchy_poly_det_zero_of_x_eq {R : Type u_1} [CommRing R] {m : } (x y : Fin mR) (i j : Fin m) (hij : i j) (hx : x i = x j) :
                                            (Matrix.of fun (i' j' : Fin m) => k : Fin m with k j', (x i' + y k)).det = 0

                                            When x_i = x_j for i ≠ j, the determinant of the polynomial Cauchy matrix is 0 because two rows become equal. This is a key lemma for the factor hunting proof.

                                            theorem AlgebraicCombinatorics.Determinants.cauchy_poly_det_zero_of_y_eq {R : Type u_1} [CommRing R] {m : } (x y : Fin mR) (i j : Fin m) (hij : i j) (hy : y i = y j) :
                                            (Matrix.of fun (i' j' : Fin m) => k : Fin m with k j', (x i' + y k)).det = 0

                                            When y_i = y_j for i ≠ j, the determinant of the polynomial Cauchy matrix is 0 because two columns become equal. This is a key lemma for the factor hunting proof.

                                            Multivariate Factor Theorem #

                                            The multivariate factor theorem states: if P ∈ MvPolynomial σ R (R a domain) and P evaluates to 0 when we substitute X_j for X_i, then (X_i - X_j) | P.

                                            This is proved by viewing P as a univariate polynomial in X_i over the ring of polynomials in the other variables, and applying the standard factor theorem.

                                            These lemmas provide the infrastructure needed for the factor hunting proof of the Cauchy determinant formula.

                                            Key lemma: relates finSuccEquiv evaluation to variable substitution. When we evaluate the finSuccEquiv image at X 0, it corresponds to substituting X 1 for X 0 in the original polynomial.

                                            Helper: finSuccEquiv sends rename Fin.succ to Polynomial.C

                                            The multivariate factor theorem for Fin (m+2) with indices 0 and 1: If P(X_0, X_1, ...) vanishes when X_0 is replaced by X_1, then (X_0 - X_1) divides P.

                                            The total degree of X_i - X_j is 1 for distinct i and j. This is a key lemma for proving irreducibility of linear factors.

                                            theorem AlgebraicCombinatorics.Determinants.X_sub_X_isPrimitive {σ : Type u_2} [DecidableEq σ] (i j : σ) (hij : i j) (r : ) :

                                            The polynomial X_i - X_j is primitive (only units divide all coefficients). This is needed for irreducible_of_totalDegree_eq_one.

                                            The polynomial X_i - X_j is irreducible in MvPolynomial σ ℤ for distinct i and j. This is a key lemma for the factor hunting proof of the Cauchy determinant formula.

                                            Divisibility lemmas for the polynomial Cauchy determinant #

                                            These lemmas establish that the determinant of the polynomial Cauchy matrix is divisible by each factor (x_i - x_j) and (y_i - y_j) for i ≠ j. This is the key step in the factor hunting proof of the Cauchy determinant formula.

                                            The polynomial Cauchy matrix over MvPolynomial (Fin n ⊕ Fin n) ℤ. Entry (i, j) is ∏{k ≠ j} (X{inl i} + X_{inr k}).

                                            Equations
                                            Instances For

                                              Substitution that sets x_i = x_j (replaces X_{inl i} with X_{inl j}).

                                              Equations
                                              Instances For

                                                Substitution that sets y_i = y_j (replaces X_{inr i} with X_{inr j}).

                                                Equations
                                                Instances For
                                                  theorem AlgebraicCombinatorics.Determinants.polyCauchyMat'_row_eq_after_substX (m : ) (i j : Fin m) (_hij : i j) (col : Fin m) :
                                                  (substX_inl m i j) (polyCauchyMat' m i col) = (substX_inl m i j) (polyCauchyMat' m j col)

                                                  After substituting x_i = x_j, rows i and j of the polynomial Cauchy matrix become equal.

                                                  theorem AlgebraicCombinatorics.Determinants.polyCauchyMat'_col_eq_after_substY (m : ) (i j : Fin m) (hij : i j) (row : Fin m) :
                                                  (substY_inr m i j) (polyCauchyMat' m row i) = (substY_inr m i j) (polyCauchyMat' m row j)

                                                  After substituting y_i = y_j, columns i and j of the polynomial Cauchy matrix become equal.

                                                  The determinant of the polynomial Cauchy matrix vanishes after substituting x_i = x_j.

                                                  The determinant of the polynomial Cauchy matrix vanishes after substituting y_i = y_j.

                                                  substX_inl is the same as substXiToXj for Sum.inl indices.

                                                  substY_inr is the same as substXiToXj for Sum.inr indices.

                                                  The determinant of the polynomial Cauchy matrix is divisible by (x_i - x_j) for i ≠ j.

                                                  The determinant of the polynomial Cauchy matrix is divisible by (y_i - y_j) for i ≠ j.

                                                  Coprimality of linear factors #

                                                  To complete the factor hunting proof of the Cauchy determinant, we need to show that the linear factors (X_i - X_j) and (X_k - X_l) are coprime when they correspond to different pairs. This section establishes the necessary lemmas.

                                                  theorem AlgebraicCombinatorics.Determinants.X_sub_X_eq_iff {σ : Type u_2} [DecidableEq σ] (i j k l : σ) (hij : i j) (_hkl : k l) :

                                                  Two linear factors X_i - X_j and X_k - X_l are equal iff (i,j) = (k,l).

                                                  theorem AlgebraicCombinatorics.Determinants.X_sub_X_eq_neg_iff {σ : Type u_2} [DecidableEq σ] (i j k l : σ) (hij : i j) (hkl : k l) :

                                                  X_i - X_j equals -(X_k - X_l) iff (i,j) = (l,k).

                                                  Units in MvPolynomial σ ℤ are exactly ±1.

                                                  theorem AlgebraicCombinatorics.Determinants.X_sub_X_associated_iff {σ : Type u_2} [DecidableEq σ] (i j k l : σ) (hij : i j) (hkl : k l) :

                                                  X_i - X_j and X_k - X_l are associated iff (i,j) = (k,l) or (i,j) = (l,k).

                                                  theorem AlgebraicCombinatorics.Determinants.X_sub_X_not_dvd {σ : Type u_2} [DecidableEq σ] (i j k l : σ) (hij : i j) (hkl : k l) (h_ne : (i, j) (k, l)) (h_ne' : (i, j) (l, k)) :

                                                  Distinct linear factors X_i - X_j and X_k - X_l are not divisible by each other when they're not associated (i.e., when (i,j) ≠ (k,l) and (i,j) ≠ (l,k)).

                                                  theorem AlgebraicCombinatorics.Determinants.X_sub_X_isRelPrime {σ : Type u_2} [DecidableEq σ] (i j k l : σ) (hij : i j) (hkl : k l) (h_ne : ¬(i = k j = l i = l j = k)) :

                                                  Distinct linear factors (X_i - X_j) and (X_k - X_l) are relatively prime when not associated. This is a key lemma for the factor hunting proof: we can use Finset.prod_dvd_of_isRelPrime to show that the product of coprime factors divides the determinant.

                                                  An x-factor (X_{inl i} - X_{inl j}) and a y-factor (X_{inr k} - X_{inr l}) are always coprime because they involve variables from different sum sides. This is a key lemma for showing that the product of all factors divides the Cauchy determinant.

                                                  Helper lemmas for the factor hunting proof #

                                                  The following lemmas establish pairwise coprimality of factors and show that the product of all factors divides the determinant. This is the key step in the factor hunting proof of the Cauchy determinant formula.

                                                  Evaluation equality for the Cauchy determinant #

                                                  This section proves that at the evaluation point f(inl i) = i, f(inr j) = m + j, the determinant of the polynomial Cauchy matrix equals the product of squared differences.

                                                  This is the key lemma needed to complete the factor hunting proof for the Cauchy determinant.

                                                  Base cases for shifted Cauchy determinant #

                                                  These lemmas prove the determinant formula for shifted Cauchy matrices of small sizes. They are used in the inductive proof of the general Cauchy determinant formula.

                                                  Additional verified instances for polynomial interpolation #

                                                  For n=0, the identity is a polynomial identity in offset of degree 36. To prove by polynomial interpolation, we need 37 verified points. The following lemmas extend the verified instances.

                                                  Additional verified instances for n ≥ 5 #

                                                  These instances provide additional evidence for the algebraic identity and could be used in a polynomial interpolation proof. For n=5, the polynomial identity has degree ~256, so we would need ~257 verified points to use interpolation.

                                                  Polynomial approach for proving the identity #

                                                  The key insight is that genDenom n offset can be expressed as an explicit polynomial in offset. For small n, we can expand the product and use ring to prove the identity.

                                                  Helper lemmas for degree/homogeneity arguments #

                                                  These lemmas establish that when a polynomial divides another polynomial of the same homogeneous degree, the quotient must be a constant. This is key to completing the factor hunting proof for the Cauchy determinant.

                                                  theorem AlgebraicCombinatorics.Determinants.cauchy_det_poly {R : Type u_1} [CommRing R] {n : } (x y : Fin nR) :
                                                  (Matrix.of fun (i j : Fin n) => k : Fin n with k j, (x i + y k)).det = i : Fin n, jFinset.Ioi i, (x i - x j) * (y i - y j)

                                                  Alternative form of Cauchy determinant without division: det(∏{k≠j}(xᵢ + yₖ)) = ∏{i<j}((xᵢ - xⱼ)(yᵢ - yⱼ))

                                                  This form is useful when working over polynomial rings.

                                                  The proof for n ≥ 4 uses the factor hunting technique:

                                                  1. Both sides are homogeneous polynomials of degree n(n-1) in x_i and y_j
                                                  2. The LHS vanishes when x_i = x_j (by cauchy_poly_det_zero_of_x_eq)
                                                  3. The LHS vanishes when y_i = y_j (by cauchy_poly_det_zero_of_y_eq)
                                                  4. Since the polynomial ring is a UFD, the LHS is divisible by each (x_i - x_j) and (y_i - y_j)
                                                  5. The RHS is exactly this product, and degrees match, so LHS = c * RHS for some constant c
                                                  6. Comparing leading coefficients shows c = 1

                                                  Label: thm.det.cauchy

                                                  theorem AlgebraicCombinatorics.Determinants.cauchy_det_of_poly {K : Type u_2} [Field K] {m : } (x y : Fin mK) (h : ∀ (i j : Fin m), x i + y j 0) :

                                                  Cauchy determinant follows from the polynomial version. This lemma shows how cauchy_det can be derived from cauchy_det_poly.

                                                  The key insight is that:

                                                  • cauchy_det_poly proves: det(∏{k≠j}(xᵢ + yₖ)) = ∏{i<j}((xᵢ - xⱼ)(yᵢ - yⱼ))
                                                  • The LHS equals (∏ᵢ∏ⱼ(xᵢ + yⱼ)) · det(cauchyMat)
                                                  • Dividing both sides by ∏ᵢ∏ⱼ(xᵢ + yⱼ) gives the Cauchy determinant formula

                                                  Label: thm.det.cauchy

                                                  theorem AlgebraicCombinatorics.Determinants.cauchy_det {n : } {K : Type u_2} [Field K] (x y : Fin nK) (h : ∀ (i j : Fin n), x i + y j 0) :
                                                  (cauchyMat x y h).det = (∏ i : Fin n, jFinset.Ioi i, (x i - x j) * (y i - y j)) / i : Fin n, j : Fin n, (x i + y j)

                                                  Cauchy determinant (Theorem thm.det.cauchy): det(1/(xᵢ + yⱼ)) = ∏{i<j}((xᵢ - xⱼ)(yᵢ - yⱼ)) / ∏{i,j}(xᵢ + yⱼ)

                                                  This is the main Cauchy determinant formula. The proof uses cauchy_det_of_poly, which derives the formula from the polynomial version cauchy_det_poly.

                                                  Proof strategy (from the textbook):

                                                  1. Work with the "cleared" polynomial version: det(∏{k≠j}(xᵢ + yₖ)) = ∏{i<j}((xᵢ - xⱼ)(yᵢ - yⱼ))
                                                  2. Use factor hunting: both sides are polynomials, show divisibility + degree matching + evaluation
                                                  3. Divide both sides by ∏_{i,j}(xᵢ + yⱼ) to recover the Cauchy formula

                                                  Note: The proof is complete for n = 0-7. For n ≥ 8, there is a sorry in cauchyMatEval_det which is used to verify the evaluation equality in the factor hunting proof.

                                                  Label: thm.det.cauchy

                                                  Jacobi's Complementary Minor Theorem (Theorem thm.det.jacobi-complement) #

                                                  This is a far-reaching generalization of the Desnanot-Jacobi identity, relating minors of the adjugate to minors of the original matrix.

                                                  For subsets P, Q ⊆ [n] with |P| = |Q| ≥ 1: det(sub_P^Q(adj A)) = (-1)^(sum P + sum Q) · (det A)^(|Q|-1) · det(sub_{~Q}^{~P} A)

                                                  theorem AlgebraicCombinatorics.Determinants.jacobi_complementary_minor {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin m) (Fin m) R) (P Q : Finset (Fin m)) (hPQ : P.card = Q.card) (_hP : P.card 1) :

                                                  Jacobi's complementary minor theorem for adjugates (Theorem thm.det.jacobi-complement): det(sub_P^Q(adj A)) = (-1)^(sum P + sum Q) · (det A)^(|Q|-1) · det(sub_{~Q}^{~P} A)

                                                  Here P and Q are subsets of [n] with |P| = |Q| ≥ 1, and ~P, ~Q denote complements.

                                                  This theorem relates a minor of the adjugate matrix to a complementary minor of the original matrix, scaled by a power of the determinant. Label: thm.det.jacobi-complement

                                                  Proof strategy (following Prasolov's "Problems and Theorems in Linear Algebra"):

                                                  1. Polynomial matrix approach: Let A' = mvPolynomialX m m ℤ be the generic m×m matrix with polynomial entries. Since det(A') is a nonzero polynomial, we can work in a setting where A' is "generically invertible".

                                                  2. Key identity for invertible matrices: For invertible A, we have adj(A) = det(A) • A⁻¹. This means sub_P^Q(adj(A)) = det(A)^|P| • sub_P^Q(A⁻¹) (when taking a |P|×|Q| submatrix and |P| = |Q|).

                                                  3. Complementary minor theorem for inverse matrices: The classical result states that for invertible A with |P| = |Q|: det(sub_P^Q(A⁻¹)) = (-1)^(sum P + sum Q) • det(sub_{~Q}^{~P}(A)) / det(A)

                                                  4. Combining: For invertible A with |P| = |Q| = k: det(sub_P^Q(adj(A))) = det(A)^k • det(sub_P^Q(A⁻¹)) = det(A)^k • (-1)^(sum P + sum Q) • det(sub_{~Q}^{~P}(A)) / det(A) = (-1)^(sum P + sum Q) • det(A)^(k-1) • det(sub_{~Q}^{~P}(A))

                                                  5. Specialization: The result for the generic matrix A' implies the result for all matrices A via the evaluation homomorphism.

                                                  The key missing infrastructure in Mathlib is the complementary minor theorem for inverse matrices (step 3), which typically requires block matrix determinant formulas.

                                                  theorem AlgebraicCombinatorics.Determinants.desnanot_jacobi_from_jacobi_complement {R : Type u_1} [CommRing R] {m : } (A : Matrix (Fin (m + 2)) (Fin (m + 2)) R) (p q u v : Fin (m + 2)) (hpq : p < q) (huv : u < v) :
                                                  A.det * (submatrixRemove2 A p q u v hpq huv).det = (submatrixRemove A p u).det * (submatrixRemove A q v).det - (submatrixRemove A p v).det * (submatrixRemove A q u).det

                                                  Desnanot-Jacobi is a special case of Jacobi's complementary minor theorem with P = {u, v} and Q = {p, q}.

                                                  This theorem provides a DIRECT proof using jacobi_complementary_minor, which is proved independently of desnanot_jacobi_direct.

                                                  The proof combines:

                                                  1. jacobi_complementary_minor with P = {u, v}, Q = {p, q} (2×2 case)
                                                  2. adjugate_2x2_eq to express adjugate products as submatrix determinants
                                                  3. submatrixRemove2_det_eq_submatrixDet_compl to relate the complement to submatrixRemove2