File size: 9,410 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | import OAI.LinearAlgebra.Moore.Derivative
import OAI.LinearAlgebra.Moore.Normalize
/-! Infinitesimal congruence and inverse linearization of the Moore determinant. -/
namespace OAI.LinearAlgebra.Moore
open Matrix
noncomputable def complexDetDifferential {I : Type*} [Fintype I] [DecidableEq I]
(M N : Matrix I I β) : β :=
β Ο : Equiv.Perm I, ((Equiv.Perm.sign Ο : β€) : β) *
β i : I, (β j β Finset.univ.erase i, M (Ο j) j) * N (Ο i) i
theorem hasDerivAt_complexDet_path {I : Type*} [Fintype I] [DecidableEq I]
(M : β β Matrix I I β) (N : Matrix I I β) (t : β)
(h : β i j, HasDerivAt (fun s => M s i j) (N i j) t) :
HasDerivAt (fun s => (M s).det) (complexDetDifferential (M t) N) t := by
simp only [Matrix.det_apply', complexDetDifferential]
apply HasDerivAt.fun_sum
intro Ο _
apply HasDerivAt.const_mul
simpa only [smul_eq_mul] using
(HasDerivAt.fun_finsetProd (u := Finset.univ) (fun i _ => h (Ο i) i))
theorem complexDetDifferential_one {I : Type*} [Fintype I] [DecidableEq I]
(N : Matrix I I β) : complexDetDifferential 1 N = N.trace := by
classical
have hex (Ο : Equiv.Perm I) (hΟ : Ο β 1) (i : I) :
β j, j β i β§ Ο j β j := by
by_contra h
push Not at h
apply hΟ
apply Equiv.ext
intro j
by_cases hj : j = i
Β· subst j
by_cases hi : Ο i = i
Β· exact hi
Β· exact Ο.injective (h (Ο i) hi)
Β· exact h j hj
unfold complexDetDifferential
rw [Finset.sum_eq_single (1 : Equiv.Perm I)]
Β· simp [Matrix.trace, Matrix.one_apply]
Β· intro Ο _ hΟ
apply mul_eq_zero.mpr
right
apply Finset.sum_eq_zero
intro i _
obtain β¨j, hji, hjβ© := hex Ο hΟ i
have hp : (β l β Finset.univ.erase i, (1 : Matrix I I β) (Ο l) l) = 0 := by
apply Finset.prod_eq_zero (Finset.mem_erase.mpr β¨hji, Finset.mem_univ _β©)
simp [hj]
rw [hp, zero_mul]
Β· simp
theorem hasDerivAt_complexDet_identity {I : Type*} [Fintype I] [DecidableEq I]
(M : β β Matrix I I β) (N : Matrix I I β) (t : β) (hM : M t = 1)
(h : β i j, HasDerivAt (fun s => M s i j) (N i j) t) :
HasDerivAt (fun s => (M s).det) N.trace t := by
have hd := hasDerivAt_complexDet_path M N t h
rw [hM, complexDetDifferential_one] at hd
exact hd
theorem hasDerivAt_quaternionMatrix_mul {I J K : Type*} [Fintype J]
(A : β β Matrix I J (Quaternion β)) (B : β β Matrix J K (Quaternion β))
(D : Matrix I J (Quaternion β)) (E : Matrix J K (Quaternion β)) (t : β)
(hA : β i j, HasDerivAt (fun s => A s i j) (D i j) t)
(hB : β j k, HasDerivAt (fun s => B s j k) (E j k) t) :
β i k, HasDerivAt (fun s => (A s * B s) i k)
((D * B t + A t * E) i k) t := by
intro i k
have h := HasDerivAt.fun_sum (u := Finset.univ) (fun j _ => (hA i j).mul (hB j k))
simpa only [Matrix.mul_apply, Matrix.add_apply, Finset.sum_add_distrib, Pi.mul_apply] using! h
def quaternionStarLinear : Quaternion β ββ[β] Quaternion β where
toFun := star
map_add' := star_add
map_smul' s q := by
ext <;> simp
noncomputable def quaternionStarCLM : Quaternion β βL[β] Quaternion β :=
quaternionStarLinear.toContinuousLinearMap
theorem hasDerivAt_quaternionMatrix_star {I J : Type*}
(A : β β Matrix I J (Quaternion β)) (D : Matrix I J (Quaternion β)) (t : β)
(hA : β i j, HasDerivAt (fun s => A s i j) (D i j) t) :
β j i, HasDerivAt (fun s => (A s)α΄΄ j i) (Dα΄΄ j i) t := by
intro j i
exact quaternionStarCLM.hasFDerivAt.comp_hasDerivAt t (hA i j)
theorem quaternionMatrix_real_smul (s : β) (q : Quaternion β) :
quaternionMatrix (s β’ q) = s β’ quaternionMatrix q := by
ext i j
fin_cases i <;> fin_cases j <;> apply Complex.ext <;> simp [quaternionMatrix]
theorem complexify_real_smul {I J : Type*} (s : β) (A : Matrix I J (Quaternion β)) :
complexify (s β’ A) = s β’ complexify A := by
ext β¨i, aβ© β¨j, bβ©
exact congrArg (fun M : Matrix (Fin 2) (Fin 2) β => M a b)
(quaternionMatrix_real_smul s (A i j))
theorem complexify_trace_real (n : β) (A : Matrix (Fin n) (Fin n) (Quaternion β)) :
(complexify A).trace.re = 2 * β i : Fin n, (A i i).re := by
simp [Matrix.trace, Fintype.sum_prod_type, Fin.sum_univ_two, complexify, quaternionMatrix,
Finset.mul_sum, two_mul]
/-- Differentiate the exact congruence law at the identity. This identity is
valid without positivity or invertibility assumptions. -/
theorem mooreDifferential_congruence (n : β)
(A E : Matrix (Fin n) (Fin n) (Quaternion β)) :
mooreDifferential n A (E * A + A * Eα΄΄) =
(complexify E).trace.re * mooreDet n A := by
let B : β β Matrix (Fin n) (Fin n) (Quaternion β) := fun s => 1 + s β’ E
have hB0 : B 0 = 1 := by simp [B]
have hB : β i j, HasDerivAt (fun s => B s i j) (E i j) 0 := by
intro i j
change HasDerivAt (fun s : β => (1 : Matrix (Fin n) (Fin n) (Quaternion β)) i j +
s β’ E i j) (E i j) 0
convert! ((hasDerivAt_id (0 : β)).smul_const (E i j)).const_add
((1 : Matrix (Fin n) (Fin n) (Quaternion β)) i j) using 1
simp
have hBA : β i j, HasDerivAt (fun s => (B s * A) i j) ((E * A) i j) 0 := by
have h := hasDerivAt_quaternionMatrix_mul B (fun _ => A) E 0 0 hB
(fun i j => hasDerivAt_const 0 (A i j))
simpa only [hB0, Matrix.mul_zero, add_zero] using h
have hF : β i j, HasDerivAt (fun s => (B s * A * (B s)α΄΄) i j)
((E * A + A * Eα΄΄) i j) 0 := by
have h := hasDerivAt_quaternionMatrix_mul (fun s => B s * A) (fun s => (B s)α΄΄)
(E * A) Eα΄΄ 0 hBA (hasDerivAt_quaternionMatrix_star B E 0 hB)
simpa only [hB0, Matrix.conjTranspose_one, Matrix.mul_one, Matrix.one_mul] using h
have hm := hasDerivAt_mooreDet_path n (fun s => B s * A * (B s)α΄΄) (E * A + A * Eα΄΄) 0 hF
simp only [hB0, Matrix.conjTranspose_one, Matrix.mul_one, Matrix.one_mul] at hm
have hCB (s : β) : complexify (B s) = 1 + s β’ complexify E := by
dsimp only [B]
rw [complexify_add, complexify_one, complexify_real_smul]
have hC : β i j : Fin n Γ Fin 2,
HasDerivAt (fun s => complexify (B s) i j) (complexify E i j) 0 := by
intro i j
simp only [hCB]
change HasDerivAt (fun s : β => (1 : Matrix (Fin n Γ Fin 2) (Fin n Γ Fin 2) β) i j +
s β’ complexify E i j) (complexify E i j) 0
convert! ((hasDerivAt_id (0 : β)).smul_const (complexify E i j)).const_add
((1 : Matrix (Fin n Γ Fin 2) (Fin n Γ Fin 2) β) i j) using 1
simp
have hd := hasDerivAt_complexDet_identity (fun s => complexify (B s)) (complexify E) 0
(by rw [hB0, complexify_one]) hC
have hr := (Complex.reCLM.hasFDerivAt.comp_hasDerivAt 0 hd).mul_const (mooreDet n A)
have hf : (fun s => mooreDet n (B s * A * (B s)α΄΄)) =
fun s => (complexify (B s)).det.re * mooreDet n A := by
funext s
exact mooreDet_congruence n A (B s)
rw [hf] at hm
exact hm.unique hr
theorem quaternionMatrix_conjTranspose_real_smul {I J : Type*}
(s : β) (A : Matrix I J (Quaternion β)) : (s β’ A)α΄΄ = s β’ Aα΄΄ := by
apply Matrix.ext
intro i j
exact quaternionStarLinear.map_smul s (A j i)
theorem quaternionRealTrace_mul_comm (n : β)
(A B : Matrix (Fin n) (Fin n) (Quaternion β)) :
(β i, ((A * B) i i).re) = β i, ((B * A) i i).re := by
have h := congrArg Complex.re (Matrix.trace_mul_comm (complexify A) (complexify B))
rw [β complexify_mul, β complexify_mul, complexify_trace_real, complexify_trace_real] at h
linarith
/-- The exact inverse-trace linearization on the Hermitian locus. `C` is an
explicit two-sided inverse of `A`, avoiding any commutative-matrix inverse
convention for quaternionic matrices. -/
theorem mooreDifferential_inverse (n : β)
(A D C : Matrix (Fin n) (Fin n) (Quaternion β))
(hA : A.IsHermitian) (hD : D.IsHermitian) (hAC : A * C = 1) (hCA : C * A = 1) :
mooreDifferential n A D = mooreDet n A * β i, ((C * D) i i).re := by
have hAe : Aα΄΄ = A := hA
have hDe : Dα΄΄ = D := hD
have hCe : Cα΄΄ = C := by
have hleft : Cα΄΄ * A = 1 := by
simpa only [Matrix.conjTranspose_mul, Matrix.conjTranspose_one, hAe] using
congrArg Matrix.conjTranspose hAC
calc
Cα΄΄ = Cα΄΄ * (A * C) := by rw [hAC, Matrix.mul_one]
_ = (Cα΄΄ * A) * C := (Matrix.mul_assoc _ _ _).symm
_ = C := by rw [hleft, Matrix.one_mul]
let E : Matrix (Fin n) (Fin n) (Quaternion β) := (1 / 2 : β) β’ (D * C)
have hEL : E * A = (1 / 2 : β) β’ D := by
dsimp only [E]
rw [Matrix.smul_mul, Matrix.mul_assoc, hCA, Matrix.mul_one]
have hER : A * Eα΄΄ = (1 / 2 : β) β’ D := by
dsimp only [E]
rw [quaternionMatrix_conjTranspose_real_smul, Matrix.conjTranspose_mul, hCe, hDe,
Matrix.mul_smul, β Matrix.mul_assoc, hAC, Matrix.one_mul]
have hE : E * A + A * Eα΄΄ = D := by
rw [hEL, hER, β add_smul]
norm_num
have htrace : (complexify E).trace.re = β i, ((C * D) i i).re := by
rw [complexify_trace_real]
calc
2 * β i : Fin n, (E i i).re = 2 * β i : Fin n, (1 / 2 : β) * ((D * C) i i).re := rfl
_ = β i : Fin n, ((D * C) i i).re := by rw [β Finset.mul_sum]; ring
_ = _ := quaternionRealTrace_mul_comm n D C
have h := mooreDifferential_congruence n A E
rw [hE, htrace] at h
exact h.trans (mul_comm _ _)
end OAI.LinearAlgebra.Moore
|