math / data /lean /OAI /LinearAlgebra /Moore /Outer.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
6.91 kB
import OAI.LinearAlgebra.Moore.Corank
/-! Rank-one affine dependence in arbitrary quaternionic directions. -/
noncomputable section
namespace OAI.LinearAlgebra.Moore
open Matrix OAI.Analysis.Calculus.Quaternion
theorem exists_right_inverse_of_mulVec_injective {n : β„•}
(A : Matrix (Fin n) (Fin n) (Quaternion ℝ)) (hi : Function.Injective A.mulVec) :
βˆƒ C : Matrix (Fin n) (Fin n) (Quaternion ℝ), A * C = 1 := by
have hs : Function.Surjective (quaternionMulVecLinear A) :=
LinearMap.surjective_of_injective hi
choose v hv using hs
let C : Matrix (Fin n) (Fin n) (Quaternion ℝ) := fun i j ↦ v (Pi.single j 1) i
refine ⟨C, ?_⟩
apply Matrix.ext
intro i j
have h := congrFun (hv (Pi.single j 1)) i
change (A *α΅₯ v (Pi.single j 1)) i = (Pi.single j (1 : Quaternion ℝ) : Fin n β†’ Quaternion ℝ) i at h
change (A *α΅₯ v (Pi.single j 1)) i = (1 : Matrix _ _ _) i j
simpa only [Matrix.one_apply, Pi.single_apply, eq_comm] using h
def columnExtension {n : β„•} (v : Fin n β†’ Quaternion ℝ) (k : Fin n) :
Matrix (Fin n) (Fin n) (Quaternion ℝ) :=
1 + vecMulVec (v - Pi.single k 1) (Pi.single k 1)
theorem columnExtension_mulVec {n : β„•} (v x : Fin n β†’ Quaternion ℝ) (k : Fin n) :
columnExtension v k *α΅₯ x = fun i ↦ x i +
(v i - (Pi.single k (1 : Quaternion ℝ) : Fin n β†’ Quaternion ℝ) i) * x k := by
funext i
rw [columnExtension, Matrix.add_mulVec, Matrix.one_mulVec]
change x i + (βˆ‘ j, ((v i - (Pi.single k (1 : Quaternion ℝ) : Fin n β†’ Quaternion ℝ) i) *
(Pi.single k (1 : Quaternion ℝ) : Fin n β†’ Quaternion ℝ) j) * x j) = _
simp [Pi.single_apply, mul_ite, ite_mul]
theorem columnExtension_mulVec_injective {n : β„•} (v : Fin n β†’ Quaternion ℝ)
(k : Fin n) (hk : v k β‰  0) : Function.Injective (columnExtension v k).mulVec := by
change Function.Injective (quaternionMulVecLinear (columnExtension v k))
apply LinearMap.ker_eq_bot.mp
rw [LinearMap.ker_eq_bot']
intro x hx
have he : columnExtension v k *α΅₯ x = 0 := hx
have hh := congrFun he k
rw [columnExtension_mulVec] at hh
simp only [Pi.single_eq_same, Pi.zero_apply] at hh
have hvx : v k * x k = 0 := by
calc
v k * x k = x k + (v k - 1) * x k := by noncomm_ring
_ = 0 := hh
have hxk : x k = 0 := (mul_eq_zero.mp hvx).resolve_left hk
funext i
have hi := congrFun he i
rw [columnExtension_mulVec] at hi
simpa only [hxk, mul_zero, add_zero] using hi
theorem columnExtension_column {n : β„•} (v : Fin n β†’ Quaternion ℝ) (k : Fin n) :
columnExtension v k *α΅₯ Pi.single k 1 = v := by
rw [columnExtension_mulVec]
funext i
simp
theorem outer_congruence {n : β„•} (B : Matrix (Fin n) (Fin n) (Quaternion ℝ))
(v : Fin n β†’ Quaternion ℝ) : B * OAI.Analysis.Calculus.Quaternion.outer v * Bα΄΄ = OAI.Analysis.Calculus.Quaternion.outer (B *α΅₯ v) := by
change B * vecMulVec v (star v) * Bα΄΄ = vecMulVec (B *α΅₯ v) (star (B *α΅₯ v))
rw [Matrix.mul_vecMulVec, Matrix.vecMulVec_mul, ← Matrix.star_mulVec]
theorem coordinateProjector_eq_outer {n : β„•} (k : Fin n) :
coordinateProjector n k = OAI.Analysis.Calculus.Quaternion.outer (Pi.single k (1 : Quaternion ℝ)) := by
apply Matrix.ext
intro i j
by_cases hi : i = k <;> by_cases hj : j = k <;>
simp [coordinateProjector, OAI.Analysis.Calculus.Quaternion.outer, hi, hj]
theorem columnExtension_projector {n : β„•} (v : Fin n β†’ Quaternion ℝ) (k : Fin n) :
columnExtension v k * coordinateProjector n k * (columnExtension v k)α΄΄ = OAI.Analysis.Calculus.Quaternion.outer v := by
rw [coordinateProjector_eq_outer, outer_congruence, columnExtension_column]
/-- Affineness in a completely arbitrary quaternionic rank-one direction. -/
theorem mooreDet_add_outer {n : β„•}
(A : Matrix (Fin n) (Fin n) (Quaternion ℝ)) (v : Fin n β†’ Quaternion ℝ) (t : ℝ) :
mooreDet n (A + t β€’ OAI.Analysis.Calculus.Quaternion.outer v) = mooreDet n A +
t * (mooreDet n (A + OAI.Analysis.Calculus.Quaternion.outer v) - mooreDet n A) := by
by_cases hv : v = 0
Β· subst v
have hz : OAI.Analysis.Calculus.Quaternion.outer (0 : Fin n β†’ Quaternion ℝ) = 0 := by ext i j <;> simp [OAI.Analysis.Calculus.Quaternion.outer]
simp only [hz, smul_zero, add_zero, sub_self, mul_zero]
Β· obtain ⟨k, hk⟩ : βˆƒ k, v k β‰  0 := by
by_contra h
push Not at h
exact hv (funext h)
let B := columnExtension v k
obtain ⟨C, hBC⟩ := exists_right_inverse_of_mulVec_injective B
(columnExtension_mulVec_injective v k hk)
let D := C * A * Cα΄΄
have hstar : Cα΄΄ * Bα΄΄ = 1 := by
rw [← Matrix.conjTranspose_mul, hBC, Matrix.conjTranspose_one]
have hbase : B * D * Bα΄΄ = A := by
calc
B * D * Bα΄΄ = (B * C) * A * (Cα΄΄ * Bα΄΄) := by simp only [D, Matrix.mul_assoc]
_ = A := by rw [hBC, hstar, Matrix.one_mul, Matrix.mul_one]
have hproj : B * coordinateProjector n k * Bα΄΄ = OAI.Analysis.Calculus.Quaternion.outer v := columnExtension_projector v k
have hrep (s : ℝ) : B * (D + s β€’ coordinateProjector n k) * Bα΄΄ = A + s β€’ OAI.Analysis.Calculus.Quaternion.outer v := by
rw [Matrix.mul_add, Matrix.add_mul, Matrix.mul_smul, Matrix.smul_mul, hbase, hproj]
have hf (s : ℝ) : mooreDet n (A + s β€’ OAI.Analysis.Calculus.Quaternion.outer v) = (complexify B).det.re *
(mooreDet n D + s * (mooreDet n (D + coordinateProjector n k) - mooreDet n D)) := by
rw [← hrep s, mooreDet_congruence, mooreDet_add_coordinate]
have h0 := hf 0
have h1 := hf 1
simp only [zero_smul, add_zero, zero_mul] at h0
simp only [one_smul, one_mul] at h1
linear_combination hf t - (1 - t) * h0 - t * h1
theorem mooreDifferential_outer {n : β„•}
(A : Matrix (Fin n) (Fin n) (Quaternion ℝ)) (v : Fin n β†’ Quaternion ℝ) :
mooreDifferential n A (OAI.Analysis.Calculus.Quaternion.outer v) = mooreDet n (A + OAI.Analysis.Calculus.Quaternion.outer v) - mooreDet n A := by
have hc : HasDerivAt (fun s : ℝ ↦ mooreDet n (A + s β€’ OAI.Analysis.Calculus.Quaternion.outer v))
(mooreDet n (A + OAI.Analysis.Calculus.Quaternion.outer v) - mooreDet n A) 0 := by
simp_rw [mooreDet_add_outer]
convert! ((hasDerivAt_id (0 : ℝ)).mul_const
(mooreDet n (A + OAI.Analysis.Calculus.Quaternion.outer v) - mooreDet n A)).const_add (mooreDet n A) using 1
simp
have hd := hasDerivAt_mooreDet_affine A (OAI.Analysis.Calculus.Quaternion.outer v) 0
simpa only [zero_smul, add_zero] using hd.unique hc
theorem mooreDet_add_outer_differential {n : β„•}
(A : Matrix (Fin n) (Fin n) (Quaternion ℝ)) (v : Fin n β†’ Quaternion ℝ) (t : ℝ) :
mooreDet n (A + t β€’ OAI.Analysis.Calculus.Quaternion.outer v) = mooreDet n A + t * mooreDifferential n A (OAI.Analysis.Calculus.Quaternion.outer v) := by
rw [mooreDet_add_outer, mooreDifferential_outer]
end OAI.LinearAlgebra.Moore