Documentation

CslibFrontier.Languages.Electrical.SparseDecoupling

Certified stability of circuits through structured decouplings #

The modified nodal equations of a netlist as sparse rows, built in one pass over the branches (Cslib.Electrical.Netlist.eSparse, fSparse), and the circuit-level stability theorem of CslibFrontier.Languages.Electrical.LinearCircuit (Cslib.Electrical.Netlist.isExponentiallyStable_of_decoupling) for an accepted structured certificate (Cslib.LinearAlgebra.SparseDecouplingCert), whose check is sparse and much faster than that of a dense Cslib.LinearAlgebra.DecouplingCert on circuits of more than a few nodes.

With the input data of a Cslib.LinearAlgebra.SparseRealizationCert and the sparse equilibrium check Cslib.LinearAlgebra.isEquilibriumSparse, nothing dense is checked: the checked proper realization ẋ = A x + B u, y - y₀ = C x + D u for selected probes and the input ports (Cslib.Electrical.Netlist.sparseRealization) is the same statement as the dense Cslib.Electrical.Netlist.isTrajectoryOn_iff_realization, and its response kernel gives the zero-state response of the circuit (IsTrajectoryOn.probe_sub_eq_integral_sparse).

Main definitions #

Main results #

Sparse rows of the modified nodal equations #

The sparse row of the voltage φ_p - φ_q, with n potential columns (vrow).

The stamp row of branch b in E.

The stamp row of branch b in F.

The KCL row of node k: -incidence at the current column of each branch, from branch b on.

The rows f b br of the branches from index b on, without random access.

The sparse rows of E, built from the stamps in one pass over the branches.

The sparse rows of F, built from the stamps in one pass over the branches per row.

theorem Cslib.Electrical.Netlist.isExponentiallyStable_of_sparseCheck {c : Netlist} {d : LinearAlgebra.SparseDecouplingCert} {z₀ : List ℚ} (hc : c.check = true) (hd : d.check c.size c.eSparse c.fSparse = true) (hz : LinearAlgebra.isEquilibriumRows c.size c.fRows c.bList z₀ = true) (hA : (Matrix.toEuclideanCLM (LinearAlgebra.realOfRows d.k d.k d.A)).IsExponentiallyStable) :
c.IsTrajectoryOn 0 (fun (x : ℝ) (j : Fin c.nodes) => LinearAlgebra.realOfList c.size z₀ (Fin.castAdd c.branches.length j)) (fun (x : ℝ) (b : Fin c.branches.length) => LinearAlgebra.realOfList c.size z₀ (Fin.natAdd c.nodes b)) (Set.Ici 0) ∧ (∀ (x₀ : Fin d.k → ℝ), ∃ (φ : ℝ → Fin c.nodes → ℝ) (i : ℝ → Fin c.branches.length → ℝ), c.IsTrajectoryOn 0 φ i (Set.Ici 0) ∧ (LinearAlgebra.realOfSparse d.k c.size d.Uᵢ).mulVec (Fin.append (φ 0) (i 0)) = x₀) ∧ ∃ (M : ℝ) (α : ℝ), 0 < α ∧ ∀ (φ : ℝ → Fin c.nodes → ℝ) (i : ℝ → Fin c.branches.length → ℝ), c.IsTrajectoryOn 0 φ i (Set.Ici 0) → ∀ t ≥ 0, ‖WithLp.toLp 2 (Fin.append (φ t) (i t) - LinearAlgebra.realOfList c.size z₀)‖ ≤ M * Real.exp (-(α * t)) * ‖WithLp.toLp 2 (Fin.append (φ 0) (i 0) - LinearAlgebra.realOfList c.size z₀)‖

Certified exponential stability of a circuit, structured certificate. The conclusions of isExponentiallyStable_of_decoupling for an accepted structured decoupling d, an exactly checked equilibrium z₀ and the checked reduced matrix d.A; the differential coordinates are the first d.k rows of d.Uᵢ.

theorem Cslib.Electrical.Netlist.isExponentiallyStable_of_sparseChecks {c : Netlist} {d : LinearAlgebra.SparseDecouplingCert} {z₀ : List ℚ} (hc : c.check = true) (hd : d.check c.size c.eSparse c.fSparse = true) (hz : LinearAlgebra.isEquilibriumSparse c.size c.fSparse c.bList z₀ = true) (hA : (Matrix.toEuclideanCLM (LinearAlgebra.realOfRows d.k d.k d.A)).IsExponentiallyStable) :
c.IsTrajectoryOn 0 (fun (x : ℝ) (j : Fin c.nodes) => LinearAlgebra.realOfList c.size z₀ (Fin.castAdd c.branches.length j)) (fun (x : ℝ) (b : Fin c.branches.length) => LinearAlgebra.realOfList c.size z₀ (Fin.natAdd c.nodes b)) (Set.Ici 0) ∧ (∀ (x₀ : Fin d.k → ℝ), ∃ (φ : ℝ → Fin c.nodes → ℝ) (i : ℝ → Fin c.branches.length → ℝ), c.IsTrajectoryOn 0 φ i (Set.Ici 0) ∧ (LinearAlgebra.realOfSparse d.k c.size d.Uᵢ).mulVec (Fin.append (φ 0) (i 0)) = x₀) ∧ ∃ (M : ℝ) (α : ℝ), 0 < α ∧ ∀ (φ : ℝ → Fin c.nodes → ℝ) (i : ℝ → Fin c.branches.length → ℝ), c.IsTrajectoryOn 0 φ i (Set.Ici 0) → ∀ t ≥ 0, ‖WithLp.toLp 2 (Fin.append (φ t) (i t) - LinearAlgebra.realOfList c.size z₀)‖ ≤ M * Real.exp (-(α * t)) * ‖WithLp.toLp 2 (Fin.append (φ 0) (i 0) - LinearAlgebra.realOfList c.size z₀)‖

Certified exponential stability of a circuit, fully sparse. The conclusions of isExponentiallyStable_of_sparseCheck, with the equilibrium checked against the sparse rows of F (isEquilibriumSparse) instead of the dense rows.

Checked realizations through structured decouplings #

The sparse rows of the input matrix G.

The sparse rows of the output map of a list of probes.

The input matrix of the modified nodal equations from its sparse rows.

The checked realization of a circuit through a structured decoupling d with input data e, for the probes probes and the input ports of the circuit: ẋ = A x + B u, y = C x + D u with A = d.A, B = e.B, C = H Q₁ and D = -H Q₂ P₂ G computed from sparse rows (SparseRealizationCert.outputRows, feedthroughRows).

Checked proper realization, structured certificate. Let the netlist be well formed, d an accepted structured decoupling, e accepted input data for it and z₀ a checked equilibrium. On a time set with unique derivatives and for every input signal u, (φ, i) is a circuit trajectory exactly when

  1. z = (φ, i) is reconstructed from the state x = Uᵢ₁ (z - z₀) (the first d.k rows of d.Uᵢ) and the input: z = z₀ + Q₁ x - (Q₂ P₂ G) u, with the sparse rows d.stateRows of Q₁ and e.inputRows d of Q₂ P₂ G, and
  2. x solves ẋ = A x + B u of c.sparseRealization d e probes.

The probed outputs then satisfy y - y₀ = C x + D u (IsTrajectoryOn.probe_sub_eq_sparse).

theorem Cslib.Electrical.Netlist.IsTrajectoryOn.probe_sub_eq_sparse {c : Netlist} {d : LinearAlgebra.SparseDecouplingCert} {e : LinearAlgebra.SparseRealizationCert} {z₀ : List ℚ} (hc : c.check = true) (hd : d.check c.size c.eSparse c.fSparse = true) (he : e.check d c.size c.eSparse c.fSparse c.gSparse = true) (hz : LinearAlgebra.isEquilibriumSparse c.size c.fSparse c.bList z₀ = true) (probes : List Probe) {s : Set ℝ} (hs : UniqueDiffOn ℝ s) {u : ℝ → Fin c.inputs → ℝ} {φ : ℝ → Fin c.nodes → ℝ} {i : ℝ → Fin c.branches.length → ℝ} (h : c.IsTrajectoryOn u φ i s) {t : ℝ} (ht : t ∈ s) :
((fun (o : Fin probes.length) => Probe.eval (φ t) (i t) (probes.get o)) - fun (o : Fin probes.length) => Probe.eval (fun (j : Fin c.nodes) => LinearAlgebra.realOfList c.size z₀ (Fin.castAdd c.branches.length j)) (fun (b : Fin c.branches.length) => LinearAlgebra.realOfList c.size z₀ (Fin.natAdd c.nodes b)) (probes.get o)) = (c.sparseRealization d e probes).C.mulVec ((LinearAlgebra.realOfSparse d.k c.size d.Uᵢ).mulVec (Fin.append (φ t) (i t) - LinearAlgebra.realOfList c.size z₀)) + (c.sparseRealization d e probes).D.mulVec (u t)

Output equation, structured certificate. Along a circuit trajectory, the probed outputs differ from their values at the operating point by C x + D u, where x = Uᵢ₁ (z - z₀) is the state of c.sparseRealization d e probes.

theorem Cslib.Electrical.Netlist.IsTrajectoryOn.probe_sub_eq_integral_sparse {c : Netlist} {d : LinearAlgebra.SparseDecouplingCert} {e : LinearAlgebra.SparseRealizationCert} {z₀ : List ℚ} (hc : c.check = true) (hd : d.check c.size c.eSparse c.fSparse = true) (he : e.check d c.size c.eSparse c.fSparse c.gSparse = true) (hz : LinearAlgebra.isEquilibriumSparse c.size c.fSparse c.bList z₀ = true) (probes : List Probe) {u : ℝ → Fin c.inputs → ℝ} (hu : ContinuousOn u (Set.Ici 0)) {φ : ℝ → Fin c.nodes → ℝ} {i : ℝ → Fin c.branches.length → ℝ} (h : c.IsTrajectoryOn u φ i (Set.Ici 0)) (h₀ : (LinearAlgebra.realOfSparse d.k c.size d.Uᵢ).mulVec (Fin.append (φ 0) (i 0) - LinearAlgebra.realOfList c.size z₀) = 0) {t : ℝ} (ht : 0 ≤ t) :
((fun (o : Fin probes.length) => Probe.eval (φ t) (i t) (probes.get o)) - fun (o : Fin probes.length) => Probe.eval (fun (j : Fin c.nodes) => LinearAlgebra.realOfList c.size z₀ (Fin.castAdd c.branches.length j)) (fun (b : Fin c.branches.length) => LinearAlgebra.realOfList c.size z₀ (Fin.natAdd c.nodes b)) (probes.get o)) = (c.sparseRealization d e probes).D.mulVec (u t) + ∫ (s : ℝ) in 0..t, ((c.sparseRealization d e probes).responseKernel (t - s)).mulVec (u s)

Zero-state response of a circuit, structured certificate. For an input u continuous on [0, ∞) and a circuit trajectory on [0, ∞) that starts at the operating point state (x 0 = Uᵢ₁ (z 0 - z₀) = 0), the probed outputs are, for t ≥ 0,

y t - y₀ = D u t + ∫ s in 0..t, h (t - s) u s,

with the response kernel h t = C exp (t A) B (LTISystem.responseKernel) and the direct feedthrough D of c.sparseRealization d e probes.