Affine-Feature Ridge Regression and Finite Removal Laws
DefinitionFedRemoval_ModelThe 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 records and the server dataset has records. Record has a fixed real linear feature map , offset , and target . For a retained subset and regularization , define
Here uses all full-data indices, and 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 , not assume it. Empty empirical averages are defined by Lean's total arithmetic, but the relevant theorems require and, when server data appear, . Zero parameter or output dimension is allowed.
Set
The probability model used only by the final target is a finite joint law on : masses sum to one and . It allows arbitrary dependence between outputs. No law exists for . 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.
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
Read-back
What the Lean code literally says, in plain math · inherited model (exact model identifier unavailable)
For a natural number , let and with the Euclidean inner product and norm; is empty and is the one-element zero vector space. For arbitrary natural numbers , a data object consists of continuous real-linear maps , offsets , and targets for every , without further assumptions. Define . For every finite subset , every real , and every , define , , , , and , where stars denote Euclidean adjoints and cardinalities are viewed as real numbers. Let mean the multiplicative inverse of an invertible continuous linear endomorphism , with value the zero endomorphism when is not invertible. Define , , and , called the inverse Hessian, optimum, and exact correction. These definitions alone assert no gradient, invertibility, or minimization property. For arbitrary natural numbers , a function , and , the retained set is ; ownership need not be surjective, and the retained set may be empty or all of . Given another arbitrary natural number and data object with index set and the same spaces , form from its own data using the same formulas and . Define the surrogate , its named optimum , the mismatch , and the solver gap for every , with operator norms in . The offsets and targets of do not enter these four expressions. All these data definitions permit zero dimensions, empty index sets, empty , and zero or negative ; empty sums are zero and real inversion satisfies . In particular, empty gives , , , and ; the same formulas hold for even when is nonempty. If there is no possible argument . Finally, for every natural number , a law consists of real masses for satisfying . For every , its mean is , and for every and its mean square error is . Individual masses may vanish, functions on the same law may have arbitrary dependence, permits a deterministic law, and no law exists for because the total-mass condition would read .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.