Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Affine-Feature Ridge Regression and Finite Removal Laws

Definition
FedRemoval_Model

by Minghui · Sep 28, 2026 · Mathlib c5ea003 (Lean v4.30.0)

convex-optimizationfederated-learningmachine-learningunlearning

The definition bundle supplies fixed affine predictors, normalized ridge objectives on retained index sets, their computed Gram operators, Hessians, linear terms and inverse-defined optima, the exact Newton correction, the server quadratic removal surrogate, its gap and mismatch factor, and finite probability laws with weighted means and mean-square error. Client ownership also defines a retained index set by excluding one client. No theorem is asserted in this bundle.

Notation and hypotheses

The full dataset has nnn records and the server dataset has qqq records. Record iii has a fixed real linear feature map Ai:Rd→RkA_i:\mathbb R^d\to\mathbb R^kAi​:Rd→Rk, offset ai∈Rka_i\in\mathbb R^kai​∈Rk, and target yi∈Rky_i\in\mathbb R^kyi​∈Rk. For a retained subset SSS and regularization μ\muμ, define

LS(w)=12∣S∣∑i∈S∥Aiw+ai−yi∥2+μ2∥w∥2,GS=1∣S∣∑i∈SAi∗Ai,HS=GS+μI,L_S(w)=\frac1{2|S|}\sum_{i\in S}\|A_iw+a_i-y_i\|^2+ \frac\mu2\|w\|^2,\quad G_S=\frac1{|S|}\sum_{i\in S}A_i^*A_i,\quad H_S=G_S+\mu I,LS​(w)=2∣S∣1​i∈S∑​∥Ai​w+ai​−yi​∥2+2μ​∥w∥2,GS​=∣S∣1​i∈S∑​Ai∗​Ai​,HS​=GS​+μI, bS=1∣S∣∑i∈SAi∗(yi−ai),uS=HS−1bS,gS(w)=HSw−bS.b_S=\frac1{|S|}\sum_{i\in S}A_i^*(y_i-a_i),\quad u_S=H_S^{-1}b_S,\quad g_S(w)=H_Sw-b_S.bS​=∣S∣1​i∈S∑​Ai∗​(yi​−ai​),uS​=HS−1​bS​,gS​(w)=HS​w−bS​.

Here uDu_DuD​ uses all full-data indices, and HP,GPH_P,G_PHP​,GP​ use all server indices. Only the server feature maps enter its removal surrogate; server targets and offsets are unused. All norms are Euclidean vector or induced operator norms, as appropriate. The inverse is the total ring inverse; theorems must derive its validity from μ>0\mu>0μ>0, not assume it. Empty empirical averages are defined by Lean's total arithmetic, but the relevant theorems require S≠∅S\ne\varnothingS=∅ and, when server data appear, q>0q>0q>0. Zero parameter or output dimension is allowed.

Set

Fw(v)=12⟨v,HPv⟩−⟨gS(w),v⟩,vP(w)=HP−1gS(w),gap⁡(w,v)=Fw(v)−Fw(vP(w)),κ=∥HP−1∥∥GP−GS∥.F_w(v)=\tfrac12\langle v,H_Pv\rangle-\langle g_S(w),v\rangle, \quad v_P(w)=H_P^{-1}g_S(w),\quad \operatorname{gap}(w,v)=F_w(v)-F_w(v_P(w)), \quad\kappa=\|H_P^{-1}\|\|G_P-G_S\|.Fw​(v)=21​⟨v,HP​v⟩−⟨gS​(w),v⟩,vP​(w)=HP−1​gS​(w),gap(w,v)=Fw​(v)−Fw​(vP​(w)),κ=∥HP−1​∥∥GP​−GS​∥.

The probability model used only by the final target is a finite joint law on Ω={0,…,N−1}\Omega=\{0,\ldots,N-1\}Ω={0,…,N−1}: masses pω≥0p_\omega\ge0pω​≥0 sum to one and E[f]=∑ω∈Ωpωf(ω)\mathbb E[f]=\sum_{\omega\in\Omega}p_\omega f(\omega)E[f]=∑ω∈Ω​pω​f(ω). It allows arbitrary dependence between outputs. No law exists for N=0N=0N=0. The other targets are deterministic and assume no probability model.

Formalization note: the fixed affine-feature model is source-derived from Jin et al., arXiv:2306.02216v3, Section III-A (Section 3), PDF p. 3, equation (3), and PDF p. 4, equations (4)--(5). Arbitrary real targets and nonempty retained subsets explicitly extend the one-hot/client-removal setting. The finite-law error targets are corrected formulations, not transcriptions or proofs of the printed Theorem 2.

Definition code
import Mathlib.Analysis.Calculus.Gradient.Basic
import Mathlib.Analysis.InnerProductSpace.Adjoint
import Mathlib.Analysis.InnerProductSpace.Positive
import Mathlib.Analysis.InnerProductSpace.PiL2

/-!
Affine-feature ridge regression and finite probability laws for the corrected FedRemoval draft.
Source: Jin et al., arXiv:2306.02216v3, Section II-B, PDF p. 3, equation (1);
Sections III-A--III-C, PDF pp. 3--6, equations (3)--(6), Theorem 2;
supplementary Section C5, PDF p. 16. The error targets are explicitly corrected
source-derived statements, not transcriptions of the printed Theorem 2.
-/

noncomputable section

open scoped BigOperators

namespace FedRemoval

abbrev E (d : ℕ) := EuclideanSpace ℝ (Fin d)

/-- Fixed affine features; the offset includes the frozen linearization point. -/
structure Data (n d k : ℕ) where
  feature : Fin n → E d →L[ℝ] E k
  offset : Fin n → E k
  target : Fin n → E k

def predict {n d k : ℕ} (D : Data n d k) (i : Fin n) (w : E d) : E k :=
  D.feature i w + D.offset i

def loss {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n)) (μ : ℝ) (w : E d) : ℝ :=
  (2 * (s.card : ℝ))⁻¹ * (∑ i ∈ s, ‖predict D i w - D.target i‖ ^ 2) +
    μ / 2 * ‖w‖ ^ 2

def gram {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n)) : E d →L[ℝ] E d :=
  (s.card : ℝ)⁻¹ • ∑ i ∈ s, (D.feature i).adjoint.comp (D.feature i)

def rhs {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n)) : E d :=
  (s.card : ℝ)⁻¹ • ∑ i ∈ s, (D.feature i).adjoint (D.target i - D.offset i)

def hessian {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n)) (μ : ℝ) :
    E d →L[ℝ] E d :=
  gram D s + μ • ContinuousLinearMap.id ℝ (E d)

def ridgeGradient {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n))
    (μ : ℝ) (w : E d) : E d :=
  hessian D s μ w - rhs D s

def inverseHessian {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n))
    (μ : ℝ) : E d →L[ℝ] E d :=
  Ring.inverse (hessian D s μ)

def optimum {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n)) (μ : ℝ) : E d :=
  inverseHessian D s μ (rhs D s)

/-- A client's removal is one special case of choosing the retained index set. -/
def retainedIndices {n C : ℕ} (owner : Fin n → Fin C) (c : Fin C) : Finset (Fin n) :=
  Finset.univ.filter (fun i ↦ owner i ≠ c)

def exactCorrection {n d k : ℕ} (D : Data n d k) (s : Finset (Fin n))
    (μ : ℝ) (w : E d) : E d :=
  inverseHessian D s μ (ridgeGradient D s μ w)

def surrogate {n q d k : ℕ} (D : Data n d k) (s : Finset (Fin n))
    (P : Data q d k) (μ : ℝ) (w v : E d) : ℝ :=
  (1 / 2 : ℝ) * inner ℝ v (hessian P Finset.univ μ v) -
    inner ℝ (ridgeGradient D s μ w) v

def surrogateOptimum {n q d k : ℕ} (D : Data n d k) (s : Finset (Fin n))
    (P : Data q d k) (μ : ℝ) (w : E d) : E d :=
  inverseHessian P Finset.univ μ (ridgeGradient D s μ w)

def mismatch {n q d k : ℕ} (D : Data n d k) (s : Finset (Fin n))
    (P : Data q d k) (μ : ℝ) : ℝ :=
  ‖inverseHessian P Finset.univ μ‖ * ‖gram P Finset.univ - gram D s‖

def solverGap {n q d k : ℕ} (D : Data n d k) (s : Finset (Fin n))
    (P : Data q d k) (μ : ℝ) (w v : E d) : ℝ :=
  surrogate D s P μ w v - surrogate D s P μ w (surrogateOptimum D s P μ w)

/-- A finite joint law; its output maps may be dependent. -/
structure Law (N : ℕ) where
  mass : Fin N → ℝ
  nonneg : ∀ i, 0 ≤ mass i
  total : ∑ i, mass i = 1

def mean {N : ℕ} (p : Law N) (f : Fin N → ℝ) : ℝ :=
  ∑ i, p.mass i * f i

def mse {N d : ℕ} (p : Law N) (w : Fin N → E d) (u : E d) : ℝ :=
  mean p (fun i ↦ ‖w i - u‖ ^ 2)

end FedRemoval
Source
Ruinan Jin, Minghui Chen, Qiong Zhang, Xiaoxiao Li, Forgettable Federated Linear Learning with Certified Data Unlearning, IEEE TNNLS (2026), arXiv:2306.02216v3, https://arxiv.org/pdf/2306.02216v3; Section II-B (Section 2), PDF p. 3, equation (1). Section III-A (Section 3), PDF p. 3 and PDF p. 4, equations (3)--(5); supplementary Section C2, PDF p. 13, Condition 5. Section III-B (Section 3), PDF p. 5, equation (6). Section III-C (Section 3), PDF p. 5 and PDF p. 6, Theorem 2; supplementary Section C5, PDF p. 16, unnumbered error-decomposition and inverse-perturbation displays.
Read-back

What the Lean code literally says, in plain math · inherited model (exact model identifier unavailable)

For a natural number ttt, let Ft={0,…,t−1}F_t=\{0,\ldots,t-1\}Ft​={0,…,t−1} and Et=RFtE_t=\mathbb R^{F_t}Et​=RFt​ with the Euclidean inner product and norm; F0F_0F0​ is empty and E0E_0E0​ is the one-element zero vector space. For arbitrary natural numbers n,d,kn,d,kn,d,k, a data object DDD consists of continuous real-linear maps Ai:Ed→EkA_i:E_d\to E_kAi​:Ed​→Ek​, offsets ai∈Eka_i\in E_kai​∈Ek​, and targets yi∈Eky_i\in E_kyi​∈Ek​ for every i∈Fni\in F_ni∈Fn​, without further assumptions. Define pred⁡D(i,w)=Aiw+ai\operatorname{pred}_D(i,w)=A_iw+a_ipredD​(i,w)=Ai​w+ai​. For every finite subset s⊆Fns\subseteq F_ns⊆Fn​, every real μ\muμ, and every w∈Edw\in E_dw∈Ed​, define ℓsD(w)=(2∣s∣)−1∑i∈s∥Aiw+ai−yi∥2+(μ/2)∥w∥2\ell_s^D(w)=(2|s|)^{-1}\sum_{i\in s}\|A_iw+a_i-y_i\|^2+(\mu/2)\|w\|^2ℓsD​(w)=(2∣s∣)−1∑i∈s​∥Ai​w+ai​−yi​∥2+(μ/2)∥w∥2, GsD=∣s∣−1∑i∈sAi∗AiG_s^D=|s|^{-1}\sum_{i\in s}A_i^*A_iGsD​=∣s∣−1∑i∈s​Ai∗​Ai​, bsD=∣s∣−1∑i∈sAi∗(yi−ai)b_s^D=|s|^{-1}\sum_{i\in s}A_i^*(y_i-a_i)bsD​=∣s∣−1∑i∈s​Ai∗​(yi​−ai​), HsD=GsD+μIEdH_s^D=G_s^D+\mu I_{E_d}HsD​=GsD​+μIEd​​, and gsD(w)=HsDw−bsDg_s^D(w)=H_s^Dw-b_s^DgsD​(w)=HsD​w−bsD​, where stars denote Euclidean adjoints and cardinalities are viewed as real numbers. Let I(H)\mathcal I(H)I(H) mean the multiplicative inverse of an invertible continuous linear endomorphism HHH, with value the zero endomorphism when HHH is not invertible. Define RsD=I(HsD)R_s^D=\mathcal I(H_s^D)RsD​=I(HsD​), osD=RsDbsDo_s^D=R_s^Db_s^DosD​=RsD​bsD​, and csD(w)=RsDgsD(w)c_s^D(w)=R_s^Dg_s^D(w)csD​(w)=RsD​gsD​(w), called the inverse Hessian, optimum, and exact correction. These definitions alone assert no gradient, invertibility, or minimization property. For arbitrary natural numbers n,Cn,Cn,C, a function owner⁡:Fn→FC\operatorname{owner}:F_n\to F_Cowner:Fn​→FC​, and c∈FCc\in F_Cc∈FC​, the retained set is {i∈Fn:owner⁡(i)≠c}\{i\in F_n:\operatorname{owner}(i)\ne c\}{i∈Fn​:owner(i)=c}; ownership need not be surjective, and the retained set may be empty or all of FnF_nFn​. Given another arbitrary natural number qqq and data object PPP with index set FqF_qFq​ and the same spaces Ed,EkE_d,E_kEd​,Ek​, form GFqP,HFqP,RFqPG_{F_q}^P,H_{F_q}^P,R_{F_q}^PGFq​P​,HFq​P​,RFq​P​ from its own data using the same formulas and μ\muμ. Define the surrogate Qw(v)=12⟨v,HFqPv⟩−⟨gsD(w),v⟩Q_w(v)=\tfrac12\langle v,H_{F_q}^Pv\rangle-\langle g_s^D(w),v\rangleQw​(v)=21​⟨v,HFq​P​v⟩−⟨gsD​(w),v⟩, its named optimum uw=RFqPgsD(w)u_w=R_{F_q}^Pg_s^D(w)uw​=RFq​P​gsD​(w), the mismatch κ=∥RFqP∥ ∥GFqP−GsD∥\kappa=\|R_{F_q}^P\|\,\|G_{F_q}^P-G_s^D\|κ=∥RFq​P​∥∥GFq​P​−GsD​∥, and the solver gap Δw(v)=Qw(v)−Qw(uw)\Delta_w(v)=Q_w(v)-Q_w(u_w)Δw​(v)=Qw​(v)−Qw​(uw​) for every w,v∈Edw,v\in E_dw,v∈Ed​, with operator norms in κ\kappaκ. The offsets and targets of PPP do not enter these four expressions. All these data definitions permit zero dimensions, empty index sets, empty sss, and zero or negative μ\muμ; empty sums are zero and real inversion satisfies 0−1=00^{-1}=00−1=0. In particular, empty sss gives GsD=bsD=0G_s^D=b_s^D=0GsD​=bsD​=0, HsD=μIEdH_s^D=\mu I_{E_d}HsD​=μIEd​​, ℓsD(w)=(μ/2)∥w∥2\ell_s^D(w)=(\mu/2)\|w\|^2ℓsD​(w)=(μ/2)∥w∥2, and osD=0o_s^D=0osD​=0; the same formulas hold for k=0k=0k=0 even when sss is nonempty. If C=0C=0C=0 there is no possible argument c∈FCc\in F_Cc∈FC​. Finally, for every natural number NNN, a law consists of real masses pi≥0p_i\ge0pi​≥0 for i∈FNi\in F_Ni∈FN​ satisfying ∑i∈FNpi=1\sum_{i\in F_N}p_i=1∑i∈FN​​pi​=1. For every f:FN→Rf:F_N\to\mathbb Rf:FN​→R, its mean is Ep[f]=∑i∈FNpif(i)\mathbb E_p[f]=\sum_{i\in F_N}p_if(i)Ep​[f]=∑i∈FN​​pi​f(i), and for every w:FN→Edw:F_N\to E_dw:FN​→Ed​ and u∈Edu\in E_du∈Ed​ its mean square error is MSE⁡p(w,u)=∑i∈FNpi∥w(i)−u∥2\operatorname{MSE}_p(w,u)=\sum_{i\in F_N}p_i\|w(i)-u\|^2MSEp​(w,u)=∑i∈FN​​pi​∥w(i)−u∥2. Individual masses may vanish, functions on the same law may have arbitrary dependence, N=1N=1N=1 permits a deterministic law, and no law exists for N=0N=0N=0 because the total-mass condition would read 0=10=10=1.

Human review
  • Endorsed by Shuze Chen · Sep 29, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Minghui · Sep 29, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me