Theorem: gramSchmidt_of_orthogonal
File: Mathlib/Analysis/InnerProductSpace/GramSchmidtOrtho.lean

tactic: ext i
state_before: 𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
⊢ gramSchmidt 𝕜 f = f

tactic: rw [gramSchmidt_def]
state_before: case h
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i : ι
⊢ gramSchmidt 𝕜 f i = f i

tactic: trans f i - 0
state_before: case h
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i : ι
⊢ f i - ∑ i_1 in Finset.Iio i, ↑(↑(orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f i_1})) (f i)) = f i

tactic: congr
state_before: 𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i : ι
⊢ f i - ∑ i_1 in Finset.Iio i, ↑(↑(orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f i_1})) (f i)) = f i - 0

tactic: apply Finset.sum_eq_zero
state_before: case e_a
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i : ι
⊢ ∑ i_1 in Finset.Iio i, ↑(↑(orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f i_1})) (f i)) = 0

tactic: intro j hj
state_before: case e_a.h
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i : ι
⊢ ∀ (x : ι), x ∈ Finset.Iio i → ↑(↑(orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f x})) (f i)) = 0

tactic: rw [coe_eq_zero]
state_before: case e_a.h
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
⊢ ↑(↑(orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f j})) (f i)) = 0

tactic: suffices span 𝕜 (f '' Set.Iic j) ⟂ 𝕜 ∙ f i by
  apply orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero
  rw [mem_orthogonal_singleton_iff_inner_left]
  rw [← mem_orthogonal_singleton_iff_inner_right]
  exact this (gramSchmidt_mem_span 𝕜 f (le_refl j))
state_before: case e_a.h
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
⊢ ↑(orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f j})) (f i) = 0

tactic: rw [isOrtho_span]
state_before: case e_a.h
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
⊢ span 𝕜 (f '' Set.Iic j) ⟂ span 𝕜 {f i}

tactic: rintro u ⟨k, hk, rfl⟩ v (rfl : v = f i)
state_before: case e_a.h
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
⊢ ∀ ⦃u : E⦄, u ∈ f '' Set.Iic j → ∀ ⦃v : E⦄, v ∈ {f i} → inner u v = 0

tactic: apply hf
state_before: case e_a.h.intro.intro
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
k : ι
hk : k ∈ Set.Iic j
⊢ inner (f k) (f i) = 0

tactic: exact (lt_of_le_of_lt hk (Finset.mem_Iio.mp hj)).ne
state_before: case e_a.h.intro.intro.a
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
k : ι
hk : k ∈ Set.Iic j
⊢ k ≠ i

tactic: apply orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero
state_before: 𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
this : span 𝕜 (f '' Set.Iic j) ⟂ span 𝕜 {f i}
⊢ ↑(orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f j})) (f i) = 0

tactic: rw [mem_orthogonal_singleton_iff_inner_left]
state_before: case hv
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
this : span 𝕜 (f '' Set.Iic j) ⟂ span 𝕜 {f i}
⊢ f i ∈ (span 𝕜 {gramSchmidt 𝕜 f j})ᗮ

tactic: rw [← mem_orthogonal_singleton_iff_inner_right]
state_before: case hv
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
this : span 𝕜 (f '' Set.Iic j) ⟂ span 𝕜 {f i}
⊢ inner (f i) (gramSchmidt 𝕜 f j) = 0

tactic: exact this (gramSchmidt_mem_span 𝕜 f (le_refl j))
state_before: case hv
𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i j : ι
hj : j ∈ Finset.Iio i
this : span 𝕜 (f '' Set.Iic j) ⟂ span 𝕜 {f i}
⊢ gramSchmidt 𝕜 f j ∈ (span 𝕜 {f i})ᗮ

tactic: simp
state_before: 𝕜 : Type u_2
E : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
ι : Type u_1
inst✝² : LinearOrder ι
inst✝¹ : LocallyFiniteOrderBot ι
inst✝ : IsWellOrder ι fun x x_1 => x < x_1
f : ι → E
hf : Pairwise fun i j => inner (f i) (f j) = 0
i : ι
⊢ f i - 0 = f i