cfahlgren1's picture
download
raw
3.25 kB
import Mathlib
import OAI.Analysis.MatrixSigning.Matrices.Pivot
namespace OAI
section
namespace KS.W07
open Matrix
variable {n : Type*} [Fintype n]
theorem scalarPivot_posDef {a : ℝ} (ha : 0 < a) : (scalarPivot a).PosDef := by
have heq : scalarPivot a = Matrix.diagonal (fun _ : Unit => a) := by
ext i j
cases i; cases j
simp [scalarPivot]
rw [heq]
exact Matrix.PosDef.diagonal (fun _ => ha)
omit [Fintype n] in
theorem real_pivot_schur_formula {a : ℝ} (ha : a ≠ 0)
(b : n → ℝ) (D : Matrix n n ℝ) :
D - (pivotRow b)ᴴ * (scalarPivot a)⁻¹ *
(pivotRow b) = pivotSchur a b D :=
pivot_schur_formula ha b D
theorem pivotSchur_posSemidef {a : ℝ} (ha : 0 < a)
(b : n → ℝ) (D : Matrix n n ℝ) (hM : (pivotBlock a b D).PosSemidef) :
(pivotSchur a b D).PosSemidef := by
let _ := scalarPivotInvertible (ne_of_gt ha)
have hM' : (Matrix.fromBlocks (scalarPivot a)
(pivotRow b)
(pivotRow b)ᴴ D).PosSemidef := by
exact hM
have h := (Matrix.PosDef.fromBlocks₁₁
(pivotRow b) D (scalarPivot_posDef ha)).mp hM'
exact real_pivot_schur_formula (ne_of_gt ha) b D ▸ h
omit [Fintype n] in
theorem rat_pivotSchur_cast (a : ℚ) (b : n → ℚ) (D : Matrix n n ℚ) :
(pivotSchur a b D).map (fun q : ℚ => (q : ℝ)) =
pivotSchur (a : ℝ) (fun i => (b i : ℝ)) (D.map (fun q : ℚ => (q : ℝ))) := by
ext i j
simp [pivotSchur]
omit [Fintype n] in
theorem rat_pivotBlock_cast (a : ℚ) (b : n → ℚ) (D : Matrix n n ℚ) :
(pivotBlock a b D).map (fun q : ℚ => (q : ℝ)) =
pivotBlock (a : ℝ) (fun i => (b i : ℝ)) (D.map (fun q : ℚ => (q : ℝ))) := by
ext i j
cases i <;> cases j <;> rfl
theorem rat_pivotSchur_posSemidef {a : ℚ} (ha : 0 < a)
(b : n → ℚ) (D : Matrix n n ℚ)
(hM : ((pivotBlock a b D).map (fun q : ℚ => (q : ℝ))).PosSemidef) :
((pivotSchur a b D).map (fun q : ℚ => (q : ℝ))).PosSemidef := by
rw [rat_pivotSchur_cast]
apply pivotSchur_posSemidef (by exact_mod_cast ha)
rwa [rat_pivotBlock_cast] at hM
theorem pivotBlock_posSemidef_iff {a : ℝ} (ha : 0 < a)
(b : n → ℝ) (D : Matrix n n ℝ) :
(pivotBlock a b D).PosSemidef ↔ (pivotSchur a b D).PosSemidef := by
constructor
· exact pivotSchur_posSemidef ha b D
· intro hS
let _ := scalarPivotInvertible (ne_of_gt ha)
have hS' : (D - (pivotRow b)ᴴ * (scalarPivot a)⁻¹ *
(pivotRow b)).PosSemidef := by
rwa [real_pivot_schur_formula (ne_of_gt ha)]
have h := (Matrix.PosDef.fromBlocks₁₁
(pivotRow b) D (scalarPivot_posDef ha)).mpr hS'
exact h
theorem zero_pivotBlock_posSemidef (D : Matrix n n ℝ) (hD : D.PosSemidef) :
(pivotBlock 0 (fun _ => 0) D).PosSemidef := by
change (Matrix.fromBlocks (0 : Matrix Unit Unit ℝ) 0 0 D).PosSemidef
refine Matrix.PosSemidef.of_dotProduct_mulVec_nonneg ?_ ?_
· exact Matrix.IsHermitian.fromBlocks Matrix.isHermitian_zero (by simp) hD.isHermitian
· intro x
have hx : Sum.elim (x ∘ Sum.inl) (x ∘ Sum.inr) = x := Sum.elim_comp_inl_inr x
have h := hD.dotProduct_mulVec_nonneg (x ∘ Sum.inr)
rw [← hx]
simpa [Matrix.fromBlocks_mulVec, Function.comp_def] using h
end KS.W07
end
end OAI

Xet Storage Details

Size:
3.25 kB
·
Xet hash:
7379049731c0e963d15c84e85a769d7c83662b6c28fda0f969db6d10092b2e76

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.