Solve a compressed least-squares problem produced by a sketch.
Definition
Definition (Sketch-and-solve least squares). Replace the original problem by \min_{\mathbf{x}}\|\mathbf{S}\mathbf{A}\mathbf{x}-\mathbf{S}\mathbf{b}\|_2 and return the minimum-norm solution
The solution minimizes the sketched residual. Relating it to the original residual requires assumptions on the sketch.
Lean statement and details
NLAlib.sketchAndSolve.{u_1, u_3, u_4, u_5, u_6} {𝕜 : Type u_1} [RCLike 𝕜] {m : Type u_3}
{n : Type u_4} [Fintype m] [Fintype n] {k : Type u_5} {p : Type u_6} [Fintype k]
(A : Matrix m n 𝕜) (S : Matrix k m 𝕜) (B : Matrix m p 𝕜) : Matrix n p 𝕜
for \mathbf{Q} with orthonormal columns and \operatorname{rank}(\mathbf{S}\mathbf{Q}) = \operatorname{rank}\mathbf{Q} (full column rank of \mathbf{S}\mathbf{Q}), the sketched core is the exact core plus noise, \mathsf{sketchAndSolve}(\mathbf{Q}, \mathbf{S}, \mathbf{B}) = \mathbf{Q}^{\mathsf{H}}\mathbf{B} + \mathsf{sketchAndSolve}(\mathbf{Q}, \mathbf{S}, (\mathbf{I}-\mathbf{Q}\mathbf{Q}^{\mathsf{H}})\mathbf{B})\,. [TroppYurtseverUdellCevher2017, Lemma A.4]; [CamanoEpperlyMeyerTropp2025, Lemma 2.6]; there with a complement frame.
Lean statement and details
NLAlib.HasOrthonormalCols.sketchAndSolve_eq_add.{u_1, u_3, u_5, u_6, u_7} {𝕜 : Type u_1} [RCLike 𝕜]
{m : Type u_3} [Fintype m] {k : Type u_5} {p : Type u_6} {q : Type u_7} [Fintype k]
{S : Matrix k m 𝕜} [Fintype q] [DecidableEq m] [DecidableEq q] {Q : Matrix m q 𝕜}
(hQ : HasOrthonormalCols Q) (h : (S * Q).rank = Q.rank) (B : Matrix m p 𝕜) :
sketchAndSolve Q S B = Qᴴ * B + sketchAndSolve Q S ((1 - Q * Qᴴ) * B)
for a standard Gaussian p\times m sketch \mathbf{S}, r=\operatorname{rank}\mathbf{A}, r+2\le p and a real \varepsilon with r\le\varepsilon(p-r-1) (for \varepsilon>0: p\ge r+1+r/\varepsilon), \mathbb{E}\|\mathbf{B}-\mathbf{A}\,\mathsf{sketchAndSolve}(\mathbf{A},\mathbf{S},\mathbf{B}) \|_{\mathsf{F}}^2\le(1+\varepsilon)\|(\mathbf{I}-\mathbf{P}_{\mathbf{A}})\mathbf{B} \|_{\mathsf{F}}^2\,. The right side uses the optimal squared residual, for any rank of \mathbf{A} and any matrix right-hand side. [EpperlyWebber2026, Theorem 2.1 and §2.1]; the real Gaussian identity there, here its sufficient-size corollary. Integrability is NLAlib.integrable_frobNorm_sub_mul_sketchAndSolve_sq_of_hasLaw_gaussianMatrix. Asymptotic form: NLAlib.exists_forall_integral_frobNorm_sub_mul_sketchAndSolve_sq_le_of_hasLaw_gaussianMatrix.
General form: sizes are index types
Lean statement and details
NLAlib.integral_frobNorm_sub_mul_sketchAndSolve_sq_le_one_add_mul_of_hasLaw_gaussianMatrix.{u_1,
u_2, u_3, u_4, u_5}
{Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {m : Type u_2} {n : Type u_3}
{p : Type u_4} {r : Type u_5} [Fintype m] [Fintype n] [Fintype p] [Fintype r] [DecidableEq m]
{S : Ω → Matrix p m ℝ} (hS : HasLaw S (gaussianMatrix p m) μ) (A : Matrix m n ℝ)
(B : Matrix m r ℝ) {ε : ℝ} (hA : A.rank + 2 ≤ Fintype.card p)
(hp : ↑A.rank ≤ ε * (↑(Fintype.card p) - ↑A.rank - 1)) :
∫ (ω : Ω), frobNorm (B - A * sketchAndSolve A (S ω) B) ^ 2 ∂μ ≤
(1 + ε) * frobNorm ((1 - rangeProjector A) * B) ^ 2
Theorem (No random sketch beats a random orthonormal one).
(Epperly and Webber's minimax lower bound for sketch-and-solve): for a random sketch \mathbf{\Omega} \in \mathbb{R}^{m \times \ell} of any law with full column rank almost surely, \mathbf{A} \in \mathbb{R}^{m \times n} with r = \operatorname{rank}\mathbf{A}, r + 2 \le \ell and any \mathbf{B}, there is an orthogonal \mathbf{U} with \Bigl(1 + \frac{m - \ell}{m - r}\cdot\frac{r}{\ell - r - 1}\Bigr) \|(\mathbf{I} - \mathbf{P}_{\mathbf{A}})\mathbf{B}\|_{\mathsf{F}}^2 \le \mathbb{E}\|\mathbf{U}\mathbf{B} - \mathbf{U}\mathbf{A}\,\mathsf{sketchAndSolve}(\mathbf{U}\mathbf{A}, \mathbf{\Omega}^{\mathsf{H}}, \mathbf{U}\mathbf{B})\|_{\mathsf{F}}^2\,, in extended reals (the expectation may be infinite). With NLAlib.integral_frobNorm_sub_mul_sketchAndSolve_sq_of_hasLaw_haarFrame (equality for a Haar sketch): the random orthonormal sketch is minimax optimal. [EpperlyWebber2026, Theorem 2.2]; there as a supremum over problems of rank r.
General form: sizes are index types
Lean statement and details
NLAlib.exists_hasOrthonormalCols_le_lintegral_frobNorm_mul_sub_mul_sketchAndSolve_sq.{u_1, u_2, u_3,
u_4, u_6}
{Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {m : Type u_2} {n : Type u_3}
{l : Type u_4} [Fintype m] [Fintype n] [Fintype l] [DecidableEq m] {r' : Type u_6} [Fintype r']
[IsProbabilityMeasure μ] {X : Ω → Matrix m l ℝ} (hX : AEMeasurable X μ)
(hXr : ∀ᵐ (ω : Ω) ∂μ, (X ω).rank = Fintype.card l) {A : Matrix m n ℝ}
(hA : A.rank + 2 ≤ Fintype.card l) (B : Matrix m r' ℝ) :
∃ U,
HasOrthonormalCols U ∧
ENNReal.ofReal
(haarProjectionFactor (Fintype.card m) (Fintype.card l) A.rank *
frobNorm ((1 - rangeProjector A) * B) ^ 2) ≤
∫⁻ (ω : Ω),
ENNReal.ofReal (frobNorm (U * B - U * A * sketchAndSolve (U * A) (X ω)ᴴ (U * B)) ^ 2) ∂μ
Theorem (Sketch-and-solve: tail bound for the relative residual).
for a standard Gaussian p\times m sketch \mathbf{G}, r=\operatorname{rank}\mathbf{A} and \varepsilon,\delta>0, if p\ge\frac{4(\sqrt{r}+\sqrt{2\log(1/(\delta/2))})^2}{(1/2)^2} and p\ge16(r+1)/(\varepsilon\delta), then \mathbb{P}\bigl[(1+\varepsilon)\|(\mathbf{I}-\mathbf{P}_{\mathbf{A}})\mathbf{B} \|_{\mathsf{F}}^2<\|\mathbf{B}-\mathbf{A}\,\mathsf{sketchAndSolve}(\mathbf{A},\mathbf{G}, \mathbf{B})\|_{\mathsf{F}}^2\bigr]\le\delta\,. No full-rank assumption on \mathbf{A} is needed; \mathbf{B} may have several columns. The first size is NLAlib.gaussianInjectionDim A.rank (1 / 2) (δ / 2). [Woodruff2014, proof of Theorem 23]; the injection-plus-multiplication route there, here with a Gaussian sketch's second JL moment and a squared matrix residual. This is a sufficient second-moment rate, rather than an optimal Gaussian failure dependence. Incomparable with its \log(1/\delta) twin measureReal_frobNorm_sub_mul_sketchAndSolve_sq_gt_le_of_hasLaw_gaussianMatrix_of_jlMomentDim_le (rule 4): this one needs fewer rows at constant \delta, the twin for small \delta; the asymptotic form exists_forall_measureReal_frobNorm_sub_mul_sketchAndSolve_sq_gt_le_of_hasLaw_gaussianMatrix is proved from the twin.
General form: sizes are index types
Lean statement and details
NLAlib.measureReal_frobNorm_sub_mul_sketchAndSolve_sq_gt_le_of_hasLaw_gaussianMatrix.{u_1, u_2, u_3,
u_4, u_5}
{Ω : Type u_1} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {m : Type u_2} {n : Type u_3}
{r : Type u_4} {p : Type u_5} [Fintype m] [Fintype n] [Fintype r] [Fintype p] [DecidableEq m]
{G : Ω → Matrix p m ℝ} (hG : HasLaw G (gaussianMatrix p m) μ) (A : Matrix m n ℝ)
(B : Matrix m r ℝ) {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ)
(hp : gaussianInjectionDim A.rank (1 / 2) (δ / 2) ≤ ↑(Fintype.card p))
(hp' : 16 * (↑A.rank + 1) ≤ ε * δ * ↑(Fintype.card p)) :
μ.real
{ω |
(1 + ε) * frobNorm ((1 - rangeProjector A) * B) ^ 2 <
frobNorm (B - A * sketchAndSolve A (G ω) B) ^ 2} ≤
δ