Documentation

CslibFrontier.Foundations.Analysis.InnerProductSpace.GramSchmidtOrtho

Characterization and invariance of the Gram–Schmidt process #

Mathlib's InnerProductSpace.gramSchmidt 𝕜 f orthogonalizes a family f : ι → E indexed by a locally finite linear order. This file adds the facts about it that lattice basis reduction uses.

gramSchmidt 𝕜 f i is the unique vector that differs from f i by an element of the span of the earlier vectors and is orthogonal to that span (InnerProductSpace.eq_gramSchmidt_of_sub_mem_of_mem_orthogonal). It follows that changing each f i by a vector in the span of the earlier ones leaves the process unchanged (InnerProductSpace.gramSchmidt_eq_of_sub_mem_span, InnerProductSpace.gramSchmidt_update_add). Likewise each output vector depends only on the inputs up to its index (InnerProductSpace.gramSchmidt_congr_Iic), and the process commutes with restriction to an initial segment (InnerProductSpace.gramSchmidt_comp).

The coefficient InnerProductSpace.gramSchmidtCoeff 𝕜 f i j = ⟪f*ⱼ, fᵢ⟫ / ‖f*ⱼ‖², where f*ⱼ = gramSchmidt 𝕜 f j, gives fᵢ = f*ᵢ + ∑_{j<i} μᵢⱼ f*ⱼ (InnerProductSpace.gramSchmidt_add_sum_coeff). This is the matrix μ of [LLL82], (1.2)–(1.3). The Gram determinant is the product of the squared lengths of the orthogonalized vectors (InnerProductSpace.det_gram_eq_prod_norm_gramSchmidt_sq), and ‖f*ᵢ‖ ≤ ‖fᵢ‖ (InnerProductSpace.norm_gramSchmidt_le). Every nonzero integer combination of the fᵢ is at least as long as some f*ᵢ (InnerProductSpace.exists_norm_gramSchmidt_le_of_mem_span_int), which is the first step of the proof of [LLL82], (1.11). None of these statements assumes linear independence.

Main definitions #

Main results #

References #

theorem InnerProductSpace.gramSchmidt_sub_mem_span_Iio (𝕜 : Type u_1) {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] (f : ι → E) (i : ι) :
gramSchmidt 𝕜 f i - f i ∈ Submodule.span 𝕜 (f '' Set.Iio i)

f*ᵢ - fᵢ lies in the span of the earlier vectors.

theorem InnerProductSpace.gramSchmidt_mem_orthogonal_span_Iio (𝕜 : Type u_1) {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] (f : ι → E) (i : ι) :

f*ᵢ is orthogonal to the span of the earlier vectors.

theorem InnerProductSpace.eq_gramSchmidt_of_sub_mem_of_mem_orthogonal {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] {f : ι → E} {i : ι} {v : E} (hsub : v - f i ∈ Submodule.span 𝕜 (f '' Set.Iio i)) (horth : v ∈ (Submodule.span 𝕜 (f '' Set.Iio i))ᗮ) :
v = gramSchmidt 𝕜 f i

gramSchmidt 𝕜 f i is the unique vector that differs from f i by an element of the span of the earlier vectors and is orthogonal to that span.

theorem InnerProductSpace.gramSchmidt_eq_of_sub_mem_span {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] {f g : ι → E} (h : ∀ (i : ι), g i - f i ∈ Submodule.span 𝕜 (f '' Set.Iio i)) :
gramSchmidt 𝕜 g = gramSchmidt 𝕜 f

Changing each vector by an element of the span of the earlier ones does not change the Gram–Schmidt orthogonalization.

noncomputable def InnerProductSpace.gramSchmidtCoeff (𝕜 : Type u_1) {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] (f : ι → E) (i j : ι) :
𝕜

The Gram–Schmidt coefficient μᵢⱼ = ⟪f*ⱼ, fᵢ⟫ / ‖f*ⱼ‖² of [LLL82], (1.2).

theorem InnerProductSpace.gramSchmidt_add_sum_coeff {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] (f : ι → E) (i : ι) :
f i = gramSchmidt 𝕜 f i + ∑ j < i, gramSchmidtCoeff 𝕜 f i j • gramSchmidt 𝕜 f j

fᵢ = f*ᵢ + ∑_{j<i} μᵢⱼ f*ⱼ, [LLL82], (1.3).

theorem InnerProductSpace.inner_gramSchmidt_self_right (𝕜 : Type u_1) {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] (f : ι → E) (i : ι) :
inner 𝕜 (gramSchmidt 𝕜 f i) (f i) = ↑‖gramSchmidt 𝕜 f i‖ ^ 2

⟪f*ᵢ, fᵢ⟫ = ‖f*ᵢ‖².

theorem InnerProductSpace.gramSchmidtCoeff_self (𝕜 : Type u_1) {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] {f : ι → E} {i : ι} (h : gramSchmidt 𝕜 f i ≠ 0) :
gramSchmidtCoeff 𝕜 f i i = 1

The diagonal coefficient μᵢᵢ is 1 when f*ᵢ ≠ 0.

theorem InnerProductSpace.gramSchmidtCoeff_eq_zero_of_lt (𝕜 : Type u_1) {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] (f : ι → E) {j l : ι} (hjl : j < l) :
gramSchmidtCoeff 𝕜 f j l = 0

The coefficients above the diagonal vanish: μⱼₗ = 0 for j < l.

theorem InnerProductSpace.norm_gramSchmidt_le (𝕜 : Type u_1) {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] (f : ι → E) (i : ι) :

Orthogonalization does not increase lengths: ‖f*ᵢ‖ ≤ ‖fᵢ‖.

theorem InnerProductSpace.inner_gramSchmidt_sum_zsmul {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] [Fintype ι] (f : ι → E) (c : ι → ℤ) {i : ι} (hc : ∀ (j : ι), i < j → c j = 0) :
inner 𝕜 (gramSchmidt 𝕜 f i) (∑ j : ι, c j • f j) = ↑(c i) * ↑‖gramSchmidt 𝕜 f i‖ ^ 2

⟪f*ᵢ, ∑ⱼ cⱼ fⱼ⟫ = cᵢ ‖f*ᵢ‖² for integer coefficients that vanish above i.

theorem InnerProductSpace.norm_gramSchmidt_le_norm_sum_zsmul {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] [Fintype ι] (f : ι → E) (c : ι → ℤ) {i : ι} (hci : c i ≠ 0) (hc : ∀ (j : ι), i < j → c j = 0) :
‖gramSchmidt 𝕜 f i‖ ≤ ‖∑ j : ι, c j • f j‖

If x = ∑ cⱼ fⱼ with integer coefficients whose last nonzero entry is at i, then ‖f*ᵢ‖ ≤ ‖x‖.

theorem InnerProductSpace.exists_norm_gramSchmidt_le_of_mem_span_int {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] [Finite ι] {f : ι → E} {x : E} (hx : x ∈ Submodule.span ℤ (Set.range f)) (hx0 : x ≠ 0) :
∃ (i : ι), ‖gramSchmidt 𝕜 f i‖ ≤ ‖x‖

Every nonzero vector of the integer span of a finite family f is at least as long as some Gram–Schmidt vector f*ᵢ.

theorem InnerProductSpace.gramSchmidt_congr_Iic {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] {f g : ι → E} {i : ι} (h : ∀ j ≤ i, f j = g j) :
gramSchmidt 𝕜 f i = gramSchmidt 𝕜 g i

Gram–Schmidt vectors depend only on the vectors up to their index.

theorem InnerProductSpace.gramSchmidt_comp {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] {ι' : Type u_4} [LinearOrder ι'] [LocallyFiniteOrderBot ι'] (f : ι → E) {e : ι' → ι} (he : StrictMono e) (hlow : IsLowerSet (Set.range e)) (i : ι') :
gramSchmidt 𝕜 (f ∘ e) i = gramSchmidt 𝕜 f (e i)

Gram–Schmidt commutes with restriction along an order embedding onto an initial segment.

theorem InnerProductSpace.det_gram_eq_prod_norm_gramSchmidt_sq {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] [Fintype ι] [DecidableEq ι] (f : ι → E) :
(Matrix.gram 𝕜 f).det = ∏ i : ι, ↑‖gramSchmidt 𝕜 f i‖ ^ 2

The Gram determinant is the product of the squared lengths of the Gram–Schmidt vectors.

theorem InnerProductSpace.gramSchmidt_update_add {𝕜 : Type u_1} {E : Type u_2} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] {ι : Type u_3} [LinearOrder ι] [LocallyFiniteOrderBot ι] [DecidableEq ι] (f : ι → E) {i : ι} {v : E} (hv : v ∈ Submodule.span 𝕜 (f '' Set.Iio i)) :
gramSchmidt 𝕜 (Function.update f i (f i + v)) = gramSchmidt 𝕜 f

Adding to f i a vector in the span of the earlier vectors leaves all Gram–Schmidt vectors unchanged.