The areas / V34. The tactics of Mathlib
Mathlib.Tactic.Hessenberg.Charpoly
18 declarations. Mathlib docs · Source
The characteristic polynomial recurrence for upper Hessenberg matrices
This file contains a recurrence formula for the characteristic polynomial of an upper Hessenberg
matrix, in a noncomputable and a computable form, and a proof that the recurrence computes
Matrix.charpoly.
The recurrence comes from equation 5.1 of [Rehman-Ipsen][rehmanipsen2011]. For an n × n upper
Hessenberg matrix H it successively computes the characteristic polynomials
pᵢ(X) = det (X * I - Hᵢ) of the leading principal submatrices Hᵢ of order i:
p_0 := 1
p_{k+1} = (X - C H[k][k]) p_k - ∑_{t<k} C (H[t][k] ∏_{j=t}^{k-1} H[j+1][j]) p_t
Main definitions
hessP n H k: the polynomialpₖof the recurrence, inR[X].hessCharpoly n H: the characteristic polynomial computed by the recurrence inR[X].coeffHessCharpoly n H: the characteristic polynomial computed by the recurrence on polynomials represented as lists of coefficients.
We have both hessCharpoly and coeffHessCharpoly so that for a literal matrix H we can produce
the coefficients of the characteristic polynomial by computing coeffHessCharpoly using the kernel.
The theorem ofCoeffList_coeffHessCharpoly interprets the result as hessCharpoly, a polynomial in
R[X].
Main results
ofCoeffList_coeffHessCharpoly: the recurrence on coefficient lists computeshessCharpoly n H.charpoly_eq_hessCharpoly:hessCharpolycomputes the characteristic polynomial of an upper Hessenberg matrix.
Implementation notes
The derivation of the recurrence formula for an n x n upper Hessenberg matrix H follows by
Laplace expansion of the determinant of the characteristic matrix, CH, for H along its last
column.
The minor Hᵢ of CH that omits the last column and the ith row of H has the following
structure:
columns 0 ... i-1 of H columns i ... n-2 of H
[ Mᵢ | * ] rows 0 ... i-1 of H
[ 0 | Tᵢ ] rows i+1 ... n-1 of H
where Mᵢ is the leading principal i × i minor of CH (and so is upper Hessenberg) and Tᵢ is a
n-1-i × n-1-i upper triangular matrix. Therefore
det Hᵢ = det Mᵢ · CH[i+1][i] · CH[i+2][i+1] · ... · CH[n-1][n-2]
and expanding det CH along its last column gives:
det CH = ∑_{i=0}^{n-1} (-1)^(i+n-1) CH[i][n-1] det Hᵢ
Now let pₖ be the characteristic polynomial of Hₖ, it is equal to det CHₖ where CHₖ is the
leading principal k × k minor of CH. In particular pₙ = det CH is the characteristic
polynomial of H.
By definition, we know that CH[n-1][n-1] = X - H[n-1][n-1] and H_{n-1} = CH_{n-1} and so we can
rewrite det CH as:
pₙ = (X - H[n-1][n-1]) p_{n-1} + ∑_{i=0}^{n-2} (-1)^(i+n-1) CH[i][n-1] det Hᵢ
Now consider each term in the tail sum. We can expand Hᵢ into its block form, note that
CH[i][n-1] = -H[i][n-1], and collect negative factors to obtain:
(-1)^(i+n-1) CH[i][n-1] det Hᵢ = -H[i][n-1] · pᵢ · ∏_{j=i}^{n-2} H[j+1][j]
The leading principal submatrices Hᵢ are also upper Hessenberg, so the same expansion applies to
p₀, ..., p_{n-1}, which gives the recurrence formula above.
In the formalization:
Matrix.leadingBlockdefines the leading principal submatrix.IsUpperHessenberg.charmatrixandcharmatrix_leadingBlockshow thatCHis upper Hessenberg withMₖthe characteristic matrix ofHₖ.det_lastColMinoris the formula fordet Hᵢ.det_eq_sum_of_isUpperHessenbergis the expansion ofdet CHalong its last column.charpoly_isUpperHessenbergspecializes the determinant expansion toCH.hessP_eq_charpolyis the proof of the recurrence formula.
References
- [Rizwana Rehman, Ilse C. F. Ipsen, La Budde's method for computing characteristic polynomials][rehmanipsen2011]
The recurrence on coefficient lists
This section defines the recurrence on a polynomial representation (lists of coefficients) that the kernel can compute.
Correctness of the recurrence
The last-column expansion of the determinant of an upper Hessenberg matrix
The recurrence computes the characteristic polynomial
theorem Mathlib.Tactic.Hessenberg.coeffHessStep.match_1.congr_eq_1 E1 #
∀ (motive : ℕ → Sort u_1) (k : ℕ) (h_1 : Unit → motive 0) (h_2 : Unit → motive 1)
(h_3 : (k' : ℕ) → motive k'.succ.succ),
k = 0 →
(match k with
| 0 => h_1 ()
| 1 => h_2 ()
| k'.succ.succ => h_3 k') ≍
h_1 ()
theorem Fin.castLEquiv.congr_simp E1 #
∀ {n m : ℕ} (h : n ≤ m), Fin.castLEquiv h = Fin.castLEquiv h
theorem Mathlib.Tactic.Hessenberg.coeffHessSum.match_1.congr_eq_1 E1 #
∀ {R : Type u_1} (motive : ℕ → R → Array (List R) → Sort u_2) (x : ℕ) (x_1 : R) (x_2 : Array (List R))
(h_1 : (r : R) → (ps : Array (List R)) → motive 0 r ps)
(h_2 : (i : ℕ) → (r : R) → (ps : Array (List R)) → motive i.succ r ps) (r : R) (ps : Array (List R)),
x = 0 →
x_1 = r →
x_2 = ps →
(match x, x_1, x_2 with
| 0, r, ps => h_1 r ps
| i.succ, r, ps => h_2 i r ps) ≍
h_1 r ps
theorem Mathlib.Tactic.Hessenberg.coeffHessSum.match_1.congr_eq_2 E1 #
∀ {R : Type u_1} (motive : ℕ → R → Array (List R) → Sort u_2) (x : ℕ) (x_1 : R) (x_2 : Array (List R))
(h_1 : (r : R) → (ps : Array (List R)) → motive 0 r ps)
(h_2 : (i : ℕ) → (r : R) → (ps : Array (List R)) → motive i.succ r ps) (i : ℕ) (r : R) (ps : Array (List R)),
x = i.succ →
x_1 = r →
x_2 = ps →
(match x, x_1, x_2 with
| 0, r, ps => h_1 r ps
| i.succ, r, ps => h_2 i r ps) ≍
h_2 i r ps
theorem Mathlib.Tactic.Hessenberg.coeffHessStep.match_1.congr_eq_3 E1 #
∀ (motive : ℕ → Sort u_1) (k : ℕ) (h_1 : Unit → motive 0) (h_2 : Unit → motive 1) (h_3 : (k' : ℕ) → motive k'.succ.succ)
(k' : ℕ),
k = k'.succ.succ →
(match k with
| 0 => h_1 ()
| 1 => h_2 ()
| k'.succ.succ => h_3 k') ≍
h_3 k'
theorem Mathlib.Tactic.Hessenberg.coeffHessStep.match_1.congr_eq_2 E1 #
∀ (motive : ℕ → Sort u_1) (k : ℕ) (h_1 : Unit → motive 0) (h_2 : Unit → motive 1)
(h_3 : (k' : ℕ) → motive k'.succ.succ),
k = 1 →
(match k with
| 0 => h_1 ()
| 1 => h_2 ()
| k'.succ.succ => h_3 k') ≍
h_2 ()
def Mathlib.Tactic.Hessenberg.hessP E1 #
{R : Type u_1} → [inst : CommRing R] → ℕ → Array R → ℕ → Polynomial R
The characteristic polynomial of the leading k × k block of the n × n Hessenberg
matrix represented by an array of entries in row-major ordering.
abbrev Mathlib.Tactic.Hessenberg.hessCharpoly E3 #
{R : Type u_1} → [inst : CommRing R] → ℕ → Array R → Polynomial R
The characteristic polynomial of an n × n Hessenberg matrix represented by an array of
entries in row-major ordering.
theorem Mathlib.Tactic.Hessenberg.hessP_zero E1 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} {H : Array R}, Mathlib.Tactic.Hessenberg.hessP n H 0 = 1
theorem Mathlib.Tactic.Hessenberg.hessP_succ E1 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} {H : Array R} (k : ℕ),
Mathlib.Tactic.Hessenberg.hessP n H (k + 1) =
(Polynomial.X - Polynomial.C (H.getD (n * k + k) 0)) * Mathlib.Tactic.Hessenberg.hessP n H k -
∑ t,
Polynomial.C (H.getD (n * ↑t + k) 0 * ∏ j ∈ Finset.Ico (↑t) k, H.getD (n * (j + 1) + j) 0) *
Mathlib.Tactic.Hessenberg.hessP n H ↑t
theorem Mathlib.Tactic.Hessenberg.hessCharpoly_eq E0 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} {H : Array R},
Mathlib.Tactic.Hessenberg.hessCharpoly n H = Mathlib.Tactic.Hessenberg.hessP n H n
def Mathlib.Tactic.Hessenberg.coeffHessSum E1 #
{R : Type u_1} → [CommRing R] → ℕ → Array R → ℕ → ℕ → R → Array (List R) → List R
Compute the coefficients of ∑_{t ≤ i} H[t][k] · r · (∏_{j=t}^{i-1} H[j+1][j]) · p_t by
recursion on i, where p_t is the polynomial defined in the coefficient list ps[t]. r
accumulates the product of H[i+1][i] entries at each step.
def Mathlib.Tactic.Hessenberg.coeffHessStep E1 #
{R : Type u_1} → [CommRing R] → ℕ → Array R → ℕ → Array (List R) → List R
Compute the coefficients of pₖ from the coefficient lists of p₀, ..., p_{k-1}. The
coefficients of each polynomial are stored as a List R in ps.
def Mathlib.Tactic.Hessenberg.coeffHessCharpoly E3 #
{R : Type u_1} → [CommRing R] → ℕ → Array R → List R
Compute the coefficients of hessCharpoly n H.
theorem Mathlib.Tactic.Hessenberg.ofCoeffList_coeffHessSum E1 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} {H : Array R} (k i : ℕ) (r : R) (ps : Array (List R)),
Polynomial.ofCoeffList (Mathlib.Tactic.Hessenberg.coeffHessSum n H k i r ps) =
∑ t,
Polynomial.C (H.getD (n * ↑t + k) 0 * (r * ∏ j ∈ Finset.Ico (↑t) i, H.getD (n * (j + 1) + j) 0)) *
Polynomial.ofCoeffList (ps.getD ↑t [])
theorem Mathlib.Tactic.Hessenberg.ofCoeffList_coeffHessStep E1 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} {H : Array R} (k : ℕ) (ps : Array (List R)),
Polynomial.ofCoeffList (Mathlib.Tactic.Hessenberg.coeffHessStep n H (k + 1) ps) =
(Polynomial.X - Polynomial.C (H.getD (n * k + k) 0)) * Polynomial.ofCoeffList (ps.getD k []) -
∑ t,
Polynomial.C (H.getD (n * ↑t + k) 0 * ∏ j ∈ Finset.Ico (↑t) k, H.getD (n * (j + 1) + j) 0) *
Polynomial.ofCoeffList (ps.getD ↑t [])
theorem Mathlib.Tactic.Hessenberg.ofCoeffList_coeffHessCharpoly E3 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} {H : Array R},
Polynomial.ofCoeffList (Mathlib.Tactic.Hessenberg.coeffHessCharpoly n H) = Mathlib.Tactic.Hessenberg.hessCharpoly n H
theorem Mathlib.Tactic.Hessenberg.charpoly_eq_hessCharpoly E3 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} (H : Matrix (Fin n) (Fin n) R),
H.IsUpperHessenberg → H.charpoly = Mathlib.Tactic.Hessenberg.hessCharpoly n H.toArray
The characteristic polynomial of an upper Hessenberg matrix is computed by the leading-principal-block recurrence on the row-major array of its entries.