cfahlgren1/math / lean /OAI /Analysis /MatrixSigning /Matrices /EliminationCompleteness.lean
cfahlgren1's picture
download
raw
2.08 kB
import Mathlib
import OAI.Analysis.MatrixSigning.Matrices.FinPivotPSD
import OAI.Analysis.MatrixSigning.Matrices.EliminationSoundness
namespace OAI
section
namespace KS.W17
open Matrix
theorem rationalNegativeWitness_none_psd (n : ℕ)
(M : Matrix (Fin n) (Fin n) ℚ) (hM : M.IsSymm)
(hout : rationalNegativeWitness n M = none) :
(M.map (fun q : ℚ => (q : ℝ))).PosSemidef := by
induction n with
| zero =>
have hz : M.map (fun q : ℚ => (q : ℝ)) = 0 := by
ext i j
exact Fin.elim0 i
rw [hz]
exact Matrix.PosSemidef.zero
| succ n ih =>
by_cases hnegative : M 0 0 < 0
· simp [rationalNegativeWitness, hnegative] at hout
· by_cases hzero : M 0 0 = 0
· cases hfind : firstNonzeroOffDiagonal M with
| some j =>
simp [rationalNegativeWitness, hzero, hfind] at hout
| none =>
have hrec : rationalNegativeWitness n (trailingMatrix M) = none := by
simpa [rationalNegativeWitness, hnegative, hzero, hfind] using hout
exact KS.W07.fin_psd_of_zero_pivot_tail M hM hzero
((firstNonzeroOffDiagonal_none_iff M).mp hfind)
(ih (trailingMatrix M) (trailingMatrix_isSymm M hM) hrec)
· have hrec : rationalNegativeWitness n (schurTail M) = none := by
simpa [rationalNegativeWitness, hnegative, hzero] using hout
have ha : 0 < M 0 0 :=
lt_of_le_of_ne (le_of_not_gt hnegative) (Ne.symm hzero)
exact KS.W07.fin_psd_of_schurTail M hM ha
(ih (schurTail M) (schurTail_isSymm M hM) hrec)
theorem rationalNegativeWitness_correct (n : ℕ)
(M : Matrix (Fin n) (Fin n) ℚ) (hM : M.IsSymm) :
match rationalNegativeWitness n M with
| none => (M.map (fun q : ℚ => (q : ℝ))).PosSemidef
| some q => q ⬝ᵥ (M *ᵥ q) < 0 := by
cases hout : rationalNegativeWitness n M with
| none => exact rationalNegativeWitness_none_psd n M hM hout
| some q => exact rationalNegativeWitness_sound n M hM q hout
end KS.W17
end
end OAI

Xet Storage Details

Size:
2.08 kB
·
Xet hash:
d51a89a61e5691620662345c4b232e4c9e9a51e8149af63b6b001ed44f12d854

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