This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a
1 module 2 public import Mathlib.LinearAlgebra.Span.Basic 3 4 @[expose] public section 5 6 /-! 7 An elementary span identity used when a raw velocity differs from a corrected 8 velocity by a linear combination of transverse columns and a nonzero scalar. 9 This file is intentionally independent of the projective and tangent-cone 10 constructions. 11 -/ 12 13 namespace Stafford38.Geometry.CorrectedVelocitySpan 14 15 universe u v w 16 17 variable {K : Type u} {V : Type v} {W : Type w} 18 variable [Field K] [AddCommGroup V] [Module K V] 19 20 /-- Replacing one vector by a nonzero scalar multiple of itself plus a linear 21 combination of a fixed finite family does not change the span with that family. 22 The convention in `h` is `raw - Σ λᵢ zᵢ = c • corrected`. -/ 23 theorem span_range_union_singleton_eq_of_corrected_velocity 24 {ι : Type*} [Fintype ι] 25 (z : ι → V) (coeff : ι → K) (corrected raw : V) (c : K) 26 (hc : c ≠ 0) 27 (h : raw - (∑ i, coeff i • z i) = c • corrected) : 28 Submodule.span K (Set.range z ∪ {corrected}) = 29 Submodule.span K (Set.range z ∪ {raw}) := by 30 let S₀ : Submodule K V := Submodule.span K (Set.range z ∪ {corrected}) 31 let S₁ : Submodule K V := Submodule.span K (Set.range z ∪ {raw}) 32 have hcorrected_mem₀ : corrected ∈ S₀ := 33 Submodule.subset_span (Set.mem_union_right _ (Set.mem_singleton _)) 34 have hsum : (∑ i, coeff i • z i) ∈ S₀ := by 35 apply S₀.sum_smul_mem coeff 36 intro i hi 37 exact Submodule.subset_span (Set.mem_union_left _ ⟨i, rfl⟩) 38 have hraw_mem : raw ∈ S₁ := 39 Submodule.subset_span (Set.mem_union_right _ (Set.mem_singleton _)) 40 have hsum₁ : (∑ i, coeff i • z i) ∈ S₁ := by 41 apply S₁.sum_smul_mem coeff 42 intro i hi 43 exact Submodule.subset_span (Set.mem_union_left _ ⟨i, rfl⟩) 44 have hcorrected_mem : corrected ∈ S₁ := by 45 have hsub : raw - (∑ i, coeff i • z i) ∈ S₁ := 46 S₁.sub_mem hraw_mem hsum₁ 47 have hscaled : c • corrected ∈ S₁ := by rwa [← h] 48 have hinv : c⁻¹ • (c • corrected) ∈ S₁ := S₁.smul_mem c⁻¹ hscaled 49 have hc' : c⁻¹ * c = 1 := inv_mul_cancel₀ hc 50 simpa [smul_smul, hc'] using hinv 51 have hraw_from_corrected : raw ∈ S₀ := by 52 have hscaled : c • corrected ∈ S₀ := S₀.smul_mem c hcorrected_mem₀ 53 have hrepr : raw = (∑ i, coeff i • z i) + c • corrected := by 54 calc 55 raw = (raw - (∑ i, coeff i • z i)) + (∑ i, coeff i • z i) := 56 (sub_add_cancel _ _).symm 57 _ = c • corrected + (∑ i, coeff i • z i) := by rw [h] 58 _ = (∑ i, coeff i • z i) + c • corrected := add_comm _ _ 59 rw [hrepr] 60 exact S₀.add_mem hsum hscaled 61 have h01 : S₀ ≤ S₁ := by 62 apply Submodule.span_le.mpr 63 intro x hx 64 rcases hx with hx | hx 65 · rcases hx with ⟨i, rfl⟩ 66 exact Submodule.subset_span (Set.mem_union_left _ ⟨i, rfl⟩) 67 · rcases Set.mem_singleton_iff.mp hx with rfl 68 exact hcorrected_mem 69 have h10 : S₁ ≤ S₀ := by 70 apply Submodule.span_le.mpr 71 intro x hx 72 rcases hx with hx | hx 73 · rcases hx with ⟨i, rfl⟩ 74 exact Submodule.subset_span (Set.mem_union_left _ ⟨i, rfl⟩) 75 · rcases Set.mem_singleton_iff.mp hx with rfl 76 exact hraw_from_corrected 77 exact le_antisymm h01 h10 78 79 /-- The same replacement identity after applying a linear observation map. 80 This form is convenient for tangent coordinates, where the vectors are first 81 dehomogenized by a fixed linear map. -/ 82 theorem span_map_range_union_singleton_eq_of_corrected_velocity 83 [AddCommGroup W] [Module K W] 84 (φ : V →ₗ[K] W) {ι : Type*} [Fintype ι] 85 (z : ι → V) (coeff : ι → K) (corrected raw : V) (c : K) 86 (hc : c ≠ 0) 87 (h : raw - (∑ i, coeff i • z i) = c • corrected) : 88 Submodule.span K (Set.range (fun i => φ (z i)) ∪ {φ corrected}) = 89 Submodule.span K (Set.range (fun i => φ (z i)) ∪ {φ raw}) := by 90 have hφ : φ raw - (∑ i, coeff i • φ (z i)) = c • φ corrected := by 91 calc 92 φ raw - (∑ i, coeff i • φ (z i)) = 93 φ (raw - (∑ i, coeff i • z i)) := by 94 simp only [map_sub, map_sum, map_smul] 95 _ = c • φ corrected := by rw [h, map_smul] 96 exact span_range_union_singleton_eq_of_corrected_velocity 97 (fun i => φ (z i)) coeff (φ corrected) (φ raw) c hc hφ 98 99 end Stafford38.Geometry.CorrectedVelocitySpan 100