File size: 9,699 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.Square
import OAI.LinearAlgebra.Moore.Outer
/-! Normal/spatial block algebra for the signed quaternionic determinant. -/
noncomputable section
namespace OAI.LinearAlgebra.Moore
open Matrix OAI.Analysis.PDE.Dirichlet
open scoped MatrixOrder ComplexOrder
def normalSplit (n : β) : Fin (n + 1) β Unit β Fin n where
toFun := Fin.cases (Sum.inl ()) Sum.inr
invFun := Sum.elim (fun _ β¦ 0) Fin.succ
left_inv := by intro i; refine Fin.cases rfl (fun _ β¦ rfl) i
right_inv := by rintro (a | i); cases a; rfl; rfl
def complexNormalSplit (n : β) :
Fin (n + 1) Γ Fin 2 β (Unit Γ Fin 2) β (Fin n Γ Fin 2) :=
(Equiv.prodCongr (normalSplit n) (Equiv.refl (Fin 2))).trans
(Equiv.sumProdDistrib Unit (Fin n) (Fin 2))
def normalBlock {n : β} (A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β))
(C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) :
Matrix (Fin (n + 1)) (Fin (n + 1)) (Quaternion β) :=
(Matrix.fromBlocks A B C D).submatrix (normalSplit n) (normalSplit n)
@[simp] theorem normalBlock_zero_zero {n : β} (A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β)) (C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) : normalBlock A B C D 0 0 = A () () := rfl
@[simp] theorem normalBlock_zero_succ {n : β} (A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β)) (C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) (j : Fin n) :
normalBlock A B C D 0 j.succ = B () j := rfl
@[simp] theorem normalBlock_succ_zero {n : β} (A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β)) (C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) (i : Fin n) :
normalBlock A B C D i.succ 0 = C i () := rfl
@[simp] theorem normalBlock_succ_succ {n : β} (A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β)) (C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) (i j : Fin n) :
normalBlock A B C D i.succ j.succ = D i j := rfl
theorem complexify_one_generic {I : Type*} [DecidableEq I] :
complexify (1 : Matrix I I (Quaternion β)) = 1 := by
ext β¨i,aβ© β¨j,bβ©
by_cases hij : i = j
Β· subst j
simp [complexify, Matrix.one_apply, quaternionMatrix_one]
Β· simp [complexify, hij, quaternionMatrix_zero]
theorem normalBlock_mul {n : β}
(A E : Matrix Unit Unit (Quaternion β))
(B F : Matrix Unit (Fin n) (Quaternion β))
(C G : Matrix (Fin n) Unit (Quaternion β))
(D H : Matrix (Fin n) (Fin n) (Quaternion β)) :
normalBlock A B C D * normalBlock E F G H =
normalBlock (A * E + B * G) (A * F + B * H)
(C * E + D * G) (C * F + D * H) := by
unfold normalBlock
rw [Matrix.submatrix_mul_equiv, Matrix.fromBlocks_multiply]
theorem normalBlock_star {n : β}
(A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β))
(C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) :
(normalBlock A B C D)α΄΄ = normalBlock Aα΄΄ Cα΄΄ Bα΄΄ Dα΄΄ := by
simp only [normalBlock, Matrix.conjTranspose_submatrix,
Matrix.fromBlocks_conjTranspose]
theorem normalBlock_one (n : β) :
normalBlock (1 : Matrix Unit Unit (Quaternion β)) 0 0
(1 : Matrix (Fin n) (Fin n) (Quaternion β)) = 1 := by
simp [normalBlock, Matrix.fromBlocks_one]
theorem complexify_normalBlock {n : β}
(A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β))
(C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) :
complexify (normalBlock A B C D) =
(Matrix.fromBlocks (complexify A) (complexify B) (complexify C) (complexify D)).submatrix
(complexNormalSplit n) (complexNormalSplit n) := by
ext β¨i,aβ© β¨j,bβ©
refine Fin.cases ?_ (fun i β¦ ?_) i <;>
refine Fin.cases ?_ (fun j β¦ ?_) j <;> rfl
theorem complexify_normalBlock_det {n : β}
(A : Matrix Unit Unit (Quaternion β))
(B : Matrix Unit (Fin n) (Quaternion β))
(C : Matrix (Fin n) Unit (Quaternion β))
(D : Matrix (Fin n) (Fin n) (Quaternion β)) :
(complexify (normalBlock A B C D)).det =
(Matrix.fromBlocks (complexify A) (complexify B) (complexify C) (complexify D)).det := by
rw [complexify_normalBlock, Matrix.det_submatrix_equiv_self]
theorem complexify_normalBlock_upper_det {n : β}
(B : Matrix Unit (Fin n) (Quaternion β)) :
(complexify (normalBlock (1 : Matrix Unit Unit (Quaternion β)) B 0
(1 : Matrix (Fin n) (Fin n) (Quaternion β)))).det = 1 := by
rw [complexify_normalBlock_det, complexify_one_generic, complexify_one_generic,
complexify_zero, Matrix.det_fromBlocks_zeroββ]
simp
def normalDiagonal {n : β} (s : β)
(D : Matrix (Fin n) (Fin n) (Quaternion β)) :=
normalBlock (s β’ (1 : Matrix Unit Unit (Quaternion β))) 0 0 D
theorem normalDiagonal_isHermitian {n : β} (s : β)
{D : Matrix (Fin n) (Fin n) (Quaternion β)} (hD : D.IsHermitian) :
(normalDiagonal s D).IsHermitian := by
rw [Matrix.IsHermitian, normalDiagonal, normalBlock_star]
simp only [quaternionMatrix_conjTranspose_real_smul, Matrix.conjTranspose_one,
Matrix.conjTranspose_zero]
rw [hD]
theorem normalDiagonal_quaternionForm {n : β} (s : β)
(D : Matrix (Fin n) (Fin n) (Quaternion β))
(z : Fin (n + 1) β Quaternion β) :
(OAI.Analysis.PDE.Dirichlet.quaternionForm (normalDiagonal s D) z).re =
s * Quaternion.normSq (z 0) + (OAI.Analysis.PDE.Dirichlet.quaternionForm D (fun i β¦ z i.succ)).re := by
have h : OAI.Analysis.PDE.Dirichlet.quaternionForm (normalDiagonal s D) z =
star (z 0) * (s β’ (1 : Quaternion β)) * z 0 +
OAI.Analysis.PDE.Dirichlet.quaternionForm D (fun i β¦ z i.succ) := by
simp [OAI.Analysis.PDE.Dirichlet.quaternionForm, Fin.sum_univ_succ, normalDiagonal]
rw [h]
change (star (z 0) * (s β’ (1 : Quaternion β)) * z 0).re + _ = _
congr 1
simp [Quaternion.star_mul_self]
theorem complexify_normalDiagonal_posDef {n : β} {s : β}
(hs : 0 < s) (D : Matrix (Fin n) (Fin n) (Quaternion β))
(hD : (complexify D).PosDef) : (complexify (normalDiagonal s D)).PosDef := by
have hDH := isHermitian_of_complexify hD.isHermitian
apply (complexify_posDef_iff (normalDiagonal_isHermitian s hDH)).mpr
intro z hz
rw [normalDiagonal_quaternionForm]
have hn : 0 β€ s * Quaternion.normSq (z 0) := mul_nonneg hs.le Quaternion.normSq_nonneg
have ht := (complexify_posSemidef_iff hDH).mp hD.posSemidef (fun i β¦ z i.succ)
by_cases htail : (fun i : Fin n β¦ z i.succ) = 0
Β· have hz0 : z 0 β 0 := by
intro he
apply hz
funext i
refine Fin.cases he (fun j β¦ ?_) i
exact congrFun htail j
have hp : 0 < Quaternion.normSq (z 0) :=
lt_of_le_of_ne Quaternion.normSq_nonneg (Ne.symm (Quaternion.normSq_ne_zero.mpr hz0))
exact add_pos_of_pos_of_nonneg (mul_pos hs hp) ht
Β· exact add_pos_of_nonneg_of_pos hn ((complexify_posDef_iff hDH).mp hD _ htail)
theorem complexify_normalDiagonal_one_det {n : β}
(D : Matrix (Fin n) (Fin n) (Quaternion β)) :
(complexify (normalDiagonal 1 D)).det = (complexify D).det := by
unfold normalDiagonal
rw [one_smul, complexify_normalBlock_det, complexify_one_generic,
complexify_zero, complexify_zero, Matrix.det_fromBlocks_zeroββ]
simp
theorem mooreDet_normalDiagonal_one {n : β}
(D : Matrix (Fin n) (Fin n) (Quaternion β)) (hD : (complexify D).PosDef) :
mooreDet (n + 1) (normalDiagonal 1 D) = mooreDet n D := by
have hp := complexify_normalDiagonal_posDef (by norm_num : (0 : β) < 1) D hD
have hsq := mooreDet_sq_eq_complexify_det_of_posDef (normalDiagonal 1 D) hp
rw [complexify_normalDiagonal_one_det] at hsq
have hsqD := mooreDet_sq_eq_complexify_det_of_posDef D hD
have ha := mooreDet_pos_of_complexify_posDef (normalDiagonal 1 D) hp
have hb := mooreDet_pos_of_complexify_posDef D hD
nlinarith
theorem normalDiagonal_add_coordinate {n : β} (s : β)
(D : Matrix (Fin n) (Fin n) (Quaternion β)) :
normalDiagonal s D = normalDiagonal 0 D + s β’ coordinateProjector (n + 1) 0 := by
apply Matrix.ext
intro i j
refine Fin.cases ?_ (fun i β¦ ?_) i <;>
refine Fin.cases ?_ (fun j β¦ ?_) j <;>
simp [normalDiagonal, coordinateProjector]
theorem mooreDet_normalDiagonal_zero {n : β}
(D : Matrix (Fin n) (Fin n) (Quaternion β)) (hD : D.IsHermitian) :
mooreDet (n + 1) (normalDiagonal 0 D) = 0 := by
apply mooreDet_zero_of_normalized_kernel (n + 1) (normalDiagonal 0 D)
(normalDiagonal_isHermitian 0 hD) (Pi.single 0 1) 0 (by simp)
funext i
refine Fin.cases ?_ (fun i β¦ ?_) i <;>
simp [Matrix.mulVec, dotProduct, Fin.sum_univ_succ, normalDiagonal]
/-- Signed block factorization: the normal scalar is not assumed positive. -/
theorem mooreDet_normalDiagonal {n : β} (s : β)
(D : Matrix (Fin n) (Fin n) (Quaternion β)) (hD : (complexify D).PosDef) :
mooreDet (n + 1) (normalDiagonal s D) = s * mooreDet n D := by
have h0 := mooreDet_normalDiagonal_zero D (isHermitian_of_complexify hD.isHermitian)
have h1 : normalDiagonal 0 D + coordinateProjector (n + 1) 0 = normalDiagonal 1 D := by
simpa using (normalDiagonal_add_coordinate 1 D).symm
rw [normalDiagonal_add_coordinate, mooreDet_add_coordinate, h0, h1,
mooreDet_normalDiagonal_one D hD]
ring
end OAI.LinearAlgebra.Moore
|