The single-step updating formula
ProvedVectorSpaceOpt.estimate_updateWork in the Hilbert space of zero-mean random variables, .
Suppose an optimal estimate of a random -vector has been formed from past data generating a subspace , with error covariance
Now additional measurements arrive,
where the noise has covariance , is orthogonal to , and is uncorrelated with ; assume is invertible. Then the updated optimal estimate is
and the updated error covariance is
Precisely: is the orthogonal projection of onto the enlarged subspace generated by together with the components of .
The structure of the formula is the point. The old estimate is not recomputed; it is corrected by a gain matrix applied to the innovation , the part of the new data orthogonal to the old. This is the single step from which the Kalman recursion is built.
Formalization Note. The gain and the updated estimate are named by defining hypotheses rather than constructed. Being the projection onto the enlarged subspace is expressed as membership in it plus orthogonality of the error to it, which characterizes the projection uniquely.
import Mathlib open Matrix open scoped RealInnerProductSpace
namespace VectorSpaceOpt
theorem estimate_update {H : Type} [NormedAddCommGroup H]
[InnerProductSpace ℝ H] {n m : ℕ} (S : Submodule ℝ H)
(β βh : Fin n → H) (hβh : ∀ i, βh i ∈ S)
(hproj : ∀ i, ∀ s ∈ S, ⟪β i - βh i, s⟫ = 0)
(R : Matrix (Fin n) (Fin n) ℝ) (hR : ∀ i j, ⟪β i - βh i, β j - βh j⟫ = R i j)
(W : Matrix (Fin m) (Fin n) ℝ) (ε : Fin m → H)
(hεS : ∀ i, ∀ s ∈ S, ⟪ε i, s⟫ = 0)
(hεβ : ∀ (i : Fin m) (j : Fin n), ⟪ε i, β j⟫ = 0)
(Q : Matrix (Fin m) (Fin m) ℝ) (hQ : ∀ i j, ⟪ε i, ε j⟫ = Q i j)
(y : Fin m → H) (hy : ∀ i, y i = ∑ j, W i j • β j + ε i)
(hdet : IsUnit (W * R * Wᵀ + Q).det)
(G : Matrix (Fin n) (Fin m) ℝ) (hG : G = R * Wᵀ * (W * R * Wᵀ + Q)⁻¹)
(βt : Fin n → H)
(hβt : ∀ i, βt i = βh i + ∑ k, G i k • (y k - ∑ j, W k j • βh j)) :
(∀ i, βt i ∈ S ⊔ Submodule.span ℝ (Set.range y)) ∧
(∀ i, ∀ s ∈ S ⊔ Submodule.span ℝ (Set.range y), ⟪β i - βt i, s⟫ = 0) ∧
(∀ i j, ⟪β i - βt i, β j - βt j⟫ =
(R - R * Wᵀ * (W * R * Wᵀ + Q)⁻¹ * W * R) i j) := by sorry
end VectorSpaceOptRead-back
What the Lean code literally says, in plain math · claude-fable-5
Read-back of VectorSpaceOpt.estimate_update
This theorem is stated over an arbitrary type carrying the structure of a normed additive commutative group and a real inner product space; below denotes its real inner product. It universally quantifies over natural numbers and (both may be ), a submodule (-linear subspace) , and the following data and hypotheses:
- families of vectors and (indexed by ), with:
- for every ;
- for every and every ;
- a real matrix such that for all ;
- a real matrix and vectors , with:
- for every and every ;
- for every and ;
- a real matrix such that for all ;
- vectors satisfying, for every ,
- the hypothesis that the determinant of the matrix is invertible (i.e. nonzero, so this matrix has a genuine inverse; the symbol below therefore denotes the true matrix inverse rather than a junk value);
- an real matrix defined by the hypothesis
- vectors satisfying, for every ,
Under all of these hypotheses, the theorem asserts the conjunction of three claims, in which denotes the smallest submodule of containing both and the -linear span of the set of values (i.e. their sum as subspaces):
- for every , the vector lies in ;
- for every and every ,
- for all ,
where the right-hand side is written out explicitly in the conclusion (it equals given the defining hypothesis for , but the statement itself repeats the full expression).
Edge cases silently included by the quantifiers: if there are no vectors and all three conclusions are vacuously true; if there are no or , the span is the zero subspace, the sum over in the definition of is empty (so ), and the invertibility hypothesis concerns the empty matrix, whose determinant is , so it holds automatically. The hypotheses do not require to be closed, to be complete or nonzero, or , , to have any properties (such as symmetry or positive semidefiniteness) beyond the stated inner-product identities; the matrices , are constrained only entrywise by those identities, and nothing asserts uniqueness of any of the data.
Confirmed by the mission captain (proposal self-audit).