Documentation

CslibFrontier.Algorithms.LinearAlgebra.SparseDescriptorCertificate

Structured index-one decouplings of sparse descriptor systems #

Cslib.LinearAlgebra.DecouplingCert asks an untrusted tool for the dense matrices P, Q of the Weierstrass form and their inverses, and checks eleven dense products. For a circuit, E and F are very sparse, but P and Q are not: they contain the inverse of the algebraic block. This file checks a decoupling in Schur form instead, and never forms that inverse.

The certificate Cslib.LinearAlgebra.SparseDecouplingCert consists of sparse transforms T, U of the rows and of the unknowns, with sparse inverses Tᵢ, Uᵢ, such that

T E U = [[E₁₁, 0], [0, 0]], T F U = [[F₁₁, F₁₂], [F₂₁, F₂₂]]

for a k × k block E₁₁, with sparse LU factors of E₁₁ and F₂₂ (so both are invertible), the r × k matrix K = F₂₂⁻¹ F₂₁ and the state matrix A = E₁₁⁻¹ (F₁₁ - F₁₂ K). For a circuit, T is a permutation and U is a permutation followed by a few eliminations for the floating capacitors. The checker SparseDecouplingCert.check takes E and F as sparse rows (read with Cslib.LinearAlgebra.ofSparse; sparseOfRows converts dense rows, and a netlist builds them from its stamps) and recomputes, with sparse rational products,

Tᵢ T = 1, U Uᵢ = 1, the blocks of T E U and T F U, E₁₁ = L U and F₂₂ = L' U' (triangular, with nonzero diagonals), F₂₂ K = F₂₁, E₁₁ A = F₁₁ - F₁₂ K.

Acceptance yields an index-one decoupling of any real system with these E and F (SparseDecouplingCert.toDecoupling) with state matrix A (SparseDecouplingCert.A_toDecoupling), through the general construction DescriptorSystem.IndexOneDecoupling.ofSchur of CslibFrontier.Foundations.Analysis.ODE.Descriptor:

P = [[E₁₁⁻¹, -E₁₁⁻¹ F₁₂ F₂₂⁻¹], [0, F₂₂⁻¹]] T, Q = U [[1, 0], [-K, 1]],

with inverses Tᵢ [[E₁₁, F₁₂], [0, F₂₂]] and [[1, 0], [K, 1]] Uᵢ. These matrices are real and are never computed: only their sparse factors are checked. Every theorem about DescriptorSystem.IndexOneDecoupling applies to the result.

Main definitions #

Main results #

Sparse rows: zero tests, differences and blocks #

theorem Cslib.LinearAlgebra.getD_map_nil {β : Type u_1} {γ : Type u_2} (f : List β → List γ) (hf : f [] = []) (l : List (List β)) (i : ℕ) :
(List.map f l).getD i [] = f (l.getD i [])

List.getD_map with the default [], for a map that sends [] to [].

The sparse form of dense rows, without the zero entries.

Whether every row, with repeated columns merged, stores only zeros.

The rows of X - Y, without merging repeated columns.

Whether X and Y read as the same matrix.

The sparse rows of the n × n identity.

The entries of a sparse row in the columns below k.

The entries of a sparse row in the columns from k on, shifted by k.

theorem Cslib.LinearAlgebra.sparseGet_loCols (k : ℕ) (r : List (ℕ × ℚ)) {j : ℕ} (hj : j < k) :

loCols keeps the entries in the columns below k.

theorem Cslib.LinearAlgebra.sparseGet_hiCols (k : ℕ) (r : List (ℕ × ℚ)) (j : ℕ) :
sparseGet (hiCols k r) j = sparseGet r (k + j)

hiCols shifts the entries in the columns from k on.

The four blocks of sparse rows split after row and column k.

def Cslib.LinearAlgebra.blockEquiv {k r N : ℕ} (h : k + r = N) :
Fin N ≃ Fin k ⊕ Fin r

The split Fin N ≃ Fin k ⊕ Fin r for k + r = N.

Triangular factors #

def Cslib.LinearAlgebra.triGo (lower : Bool) :
ℕ → List (List (ℕ × ℚ)) → Bool

Whether row i + p of rows, for every p, has its columns at most i + p (lower) or at least i + p (otherwise) and a nonzero diagonal entry.

def Cslib.LinearAlgebra.isTriangular (lower : Bool) (n : ℕ) (rows : List (List (ℕ × ℚ))) :

Whether rows is an n × n triangular matrix (lower if lower) with nonzero diagonal.

theorem Cslib.LinearAlgebra.det_ne_zero_of_isTriangular {lower : Bool} {n : ℕ} {rows : List (List (ℕ × ℚ))} (h : isTriangular lower n rows = true) :
(ofSparse n n rows).det ≠ 0

Whether M = L U for an n × n lower triangular L and upper triangular U with nonzero diagonals, so that M is invertible.

theorem Cslib.LinearAlgebra.det_ne_zero_of_isLUOf {n : ℕ} {L U M : List (List (ℕ × ℚ))} (h : isLUOf n L U M = true) :
(ofSparse n n M).det ≠ 0

Structured decoupling certificates #

A proposed index-one decoupling in Schur form of a descriptor system with N = k + r unknowns; see the module documentation. All matrices are sparse rational rows, except the dense state matrix A.

@[reducible, inline]

The sparse rows of T X U.

Whether c is an index-one decoupling in Schur form of the pencil (E, F) with N unknowns, given by sparse rows. All products are sparse and exact over ℚ.

@[reducible, inline]
abbrev Cslib.LinearAlgebra.realOfSparse (m n : ℕ) (rows : List (List (ℕ × ℚ))) :
Matrix (Fin m) (Fin n) ℝ

The real matrix of sparse rational rows.

sparseMul computes the real matrix product when the right factor has at most m rows.

subSparse computes the real difference.

The facts that an accepted certificate provides, as real matrices: the hypotheses of DescriptorSystem.IndexOneDecoupling.ofSchur, and the equation E₁₁ A = F₁₁ - F₁₂ K.

theorem Cslib.LinearAlgebra.SparseDecouplingCert.spec {c : SparseDecouplingCert} {N : ℕ} {E F : List (List (ℕ × ℚ))} (h : c.check N E F = true) :
c.Spec N E F

An accepted certificate satisfies Spec.

noncomputable def Cslib.LinearAlgebra.SparseDecouplingCert.toDecoupling {c : SparseDecouplingCert} {N m : ℕ} {E F : List (List (ℕ × ℚ))} {S : DescriptorSystem (Fin N) (Fin m)} (hE : S.E = realOfSparse N N E) (hF : S.F = realOfSparse N N F) (h : c.check N E F = true) :

Soundness. An accepted certificate for the sparse rows of S.E and S.F gives an index-one decoupling of S, by DescriptorSystem.IndexOneDecoupling.ofSchur.

theorem Cslib.LinearAlgebra.SparseDecouplingCert.A_toDecoupling {c : SparseDecouplingCert} {N m : ℕ} {E F : List (List (ℕ × ℚ))} {S : DescriptorSystem (Fin N) (Fin m)} (hE : S.E = realOfSparse N N E) (hF : S.F = realOfSparse N N F) (h : c.check N E F = true) :
(toDecoupling hE hF h).A = realOfRows c.k c.k c.A

The state matrix of the decoupling is the matrix of the checked SparseDecouplingCert.A.

theorem Cslib.LinearAlgebra.SparseDecouplingCert.Q₁'_toDecoupling {c : SparseDecouplingCert} {N m : ℕ} {E F : List (List (ℕ × ℚ))} {S : DescriptorSystem (Fin N) (Fin m)} (hE : S.E = realOfSparse N N E) (hF : S.F = realOfSparse N N F) (h : c.check N E F = true) :

The differential coordinates of the decoupling are the first c.k rows of Uᵢ.

Descriptor stability from the reduced matrix. If c is an accepted structured decoupling of the sparse rows of S.E and S.F, z₀ is an equilibrium and ẋ = A x is exponentially stable for the checked reduced matrix c.A, then every solution with zero input of S converges to z₀ exponentially, in the Euclidean norm.