Checking sparse certificates by row ranges #
The kernel keeps every term it reduces while it checks one declaration, so the memory of a
decide +kernel proof of Cslib.LinearAlgebra.SparseLyapunovCert.check grows with the size of
the certificate. This module splits the check into a cheap head, of shapes and lengths, and a
check of the k rows from row a on, so that each declaration checks a limited range of output
rows.
This limits the rows that one declaration checks, not, in general, what it reads or computes. A
range check reaches its rows by List.drop, and the kernel reduces lazily, so the rows before
a of the recomputed Lyapunov residual are skipped without being multiplied out. But every range
still depends on data outside it:
sparseResidualscales by the lcm of the denominators of all ofA,AᵀandP(sparseLyapunovScale), so each range computes these scales from the whole input;- the zippers of the transpose checks and of the products in the residual read the rows that the stored entries of the range point to, which may lie outside the range, and walk the row lists up to its start;
- the envelope check of row
ireads the data of the rows of its envelope, which may come beforea((List.zipWith rowData c.lower c.diag).take a).
So no memory bound in terms of the range size alone, or independent of n, is claimed. What was
measured, on the benchmark families of #9452 (peak RSS of lake env lean, single-threaded, of
which elaborating the certificate and checking the head take 1.6–2.0 GiB): ranges of 64 rows
took 2.4 GiB against 5.8 GiB for one check (ladder, 512 states) and 3.7 GiB against 13.4 GiB
(coupled ladders, 512 states), and ranges of 128 rows 4.1 GiB against 8.8 GiB (RC tree, 1023
states). With the range size fixed, the peak still grew with n: ranges of 64 rows took 2.0 and
2.4 GiB for ladders of 256 and 512 states, and 3.1 and 3.7 GiB for coupled ladders.
A client checks the head and each range by decide +kernel, in separate theorems, and combines
them with SparseLyapunovCert.checkRows_add and SparseLyapunovCert.check_of_checkRows into
c.check n A P = true, the hypothesis of SparseLyapunovCert.posDef_of_check. The soundness
theorems are therefore the same; a range proof is only a way to evaluate the same checker.
The split is exactly as complete as check
(SparseLyapunovCert.check_iff_checkHead_and_checkRows): check accepts if and only if the head
and every range accept. A remainder may have more than n rows. They do not change the matrix
ofSparse n n, but check still asks them to be diagonally dominant and to agree with the rows
below n that store their columns, so cutting them off would not be harmless. The head checks
them instead (transRows and ddRows from row n on), which costs nothing for the usual
remainder of n rows.
Main definitions #
Cslib.LinearAlgebra.transRows,Cslib.LinearAlgebra.ddRows,Cslib.LinearAlgebra.EnvLDLCert.envRows: the transpose, dominance and envelope checks on a range of rows.Cslib.LinearAlgebra.EnvLDLCert.factorsWithHead,EnvLDLCert.factorsWithRows,EnvLDLCert.factorsHead,EnvLDLCert.factorsRows:factorsWithandfactorssplit.Cslib.LinearAlgebra.SparseLyapunovCert.checkHead,SparseLyapunovCert.checkRows: the sparse Lyapunov check split.
Main results #
Cslib.LinearAlgebra.SparseLyapunovCert.check_iff_checkHead_and_checkRows:checkaccepts if and only if the head and every range accept.SparseLyapunovCert.check_of_checkRows,SparseLyapunovCert.checkRows_add: the head and adjacent ranges covering the rows0, …, n - 1givecheck.EnvLDLCert.factorsWith_iff_rows,EnvLDLCert.factors_iff_rows: the same for the envelope checks, which other sparse certificates (decay, energy) reuse.
Transposes and dominance on a range of rows #
Whether the stored entries of the rows a, …, a + k - 1 of A agree with the transposed
entries of B: the part of transGo 0 [] B A for those rows. The zipper starts with the rows of
B before row a, reversed.
Envelope certificates on a range of rows #
Whether the rows a, …, a + k - 1 of the n × n matrix with sparse rows rows agree with
L * diagonal d * Lᵀ on the envelope and store only zeros left of it: the part of
checkGo [] c.lower c.diag rows for those rows. The data of the rows above row a are those of
the rows 0, …, a - 1 of c.
The checks of factorsWith that do not walk the first n rows: c.lower and c.diag have
n entries, the rows of L reach the diagonal and end in 1, and the rows of the remainder from
row n on, if any, pass the symmetry and dominance checks.
The checks of factorsWith on the rows a, …, a + k - 1: the symmetry and diagonal
dominance of the remainder and the envelope check of M - R.
The head and the range of the first n rows give factorsWith.
An accepted factorsWith accepts the head.
An accepted factorsWith for n rows accepts every range.
Checking factorsWith by ranges. For n rows, factorsWith accepts if and only if the
head and every range accept.
The checks of factors that do not walk the first n rows: the shape of rows and
factorsWithHead.
The checks of factors on the rows a, …, a + k - 1: the symmetry of rows and
factorsWithRows.
The head and the range of the first n rows give factors.
Checking factors by ranges. factors accepts if and only if the head and every range
accept.
Sparse Lyapunov certificates on a range of rows #
The checks of check that do not walk the first n rows: the shapes of A, Aᵀ and P,
the heads of both envelope certificates, and the signs of their pivots.
The checks of check on the rows a, …, a + k - 1: that c.At is the transpose of A, and
the envelope checks of P and of the residual -(Aᵀ * P + P * A), which is recomputed only on
those rows.
Checking by ranges. The head and the range of all rows give check, so that
posDef_of_check and its clients apply. Adjacent ranges combine by checkRows_add.
Checking by ranges is exactly as complete as check. check accepts if and only if the
head and every range of rows accept.