@@ -367,24 +367,15 @@ lemma bezoutMatrix.det_factor_nonneg_of_quadratic_posSemidef {a b c d : ℝ}
367367lemma _root_.Matrix.posDef_fin_two_of_entries {a b c : ℝ}
368368 (ha : 0 < a) (hdet : 0 < a * c - b * b) :
369369 (!![a, b; b, c] : Matrix (Fin 2 ) (Fin 2 ) ℝ).PosDef := by
370- refine Matrix.PosDef.of_dotProduct_mulVec_pos ?_ ?_
371- · exact Matrix.IsHermitian.ext (by simp)
372- · intro x hx
373- have hmain :
374- 0 < a * (x 0 + b / a * x 1 ) ^ 2 + (a * c - b * b) / a * (x 1 ) ^ 2 := by
375- by_cases hx1 : x 1 = 0
376- · have hx0 : x 0 ≠ 0 := fun h0 ↦ hx <| funext fun i ↦ by fin_cases i <;> assumption
377- have hfirst : 0 < a * (x 0 + b / a * x 1 ) ^ 2 := by
378- simp [hx1, mul_pos ha (sq_pos_of_ne_zero hx0)]
379- simp_all
380- · have hfirst : 0 ≤ a * (x 0 + b / a * x 1 ) ^ 2 :=
381- mul_nonneg ha.le (sq_nonneg _)
382- have : 0 < (a * c - b * b) / a * (x 1 ) ^ 2 :=
383- mul_pos (div_pos hdet ha) (sq_pos_of_ne_zero hx1)
384- linarith
385- norm_num [dotProduct, Matrix.mulVec]
386- field_simp [ne_of_gt ha] at hmain
387- nlinarith
370+ refine .of_dotProduct_mulVec_pos (.ext (by simp)) fun x hx ↦ ?_
371+ have h : x 0 = 0 → x 1 ≠ 0 := by simpa [funext_iff, Fin.forall_fin_two] using hx
372+ simp only [star_trivial, cons_mulVec, cons_dotProduct, dotProduct_of_isEmpty,
373+ add_zero, empty_mulVec, dotProduct_cons, gt_iff_lt]
374+ change 0 < x 0 * (a * x 0 + b * x 1 ) + x 1 * (b * x 0 + c * x 1 )
375+ rcases eq_or_ne (x 1 ) 0 with h1 | h1
376+ · rw [h1]
377+ nlinarith [mul_self_pos.mpr (fun h0 ↦ h h0 h1 : x 0 ≠ 0 )]
378+ · nlinarith [sq_nonneg (a * x 0 + b * x 1 ), mul_pos hdet (mul_self_pos.mpr h1)]
388379
389380/-- An explicit `LDLᵀ` certificate for positive definiteness of a symmetric
390381`3 × 3` real matrix. -/
0 commit comments