File size: 1,621 Bytes
9b6e014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Mathlib

namespace OAI

noncomputable section
open scoped BigOperators Classical ComplexOrder MatrixOrder
open Matrix

namespace BinaryCoordinateSweeps.Density
variable {I J : Type*} [Fintype I] [DecidableEq I] [DecidableEq J]

lemma block_diagonal_commute (f : I → J) (Q : Matrix I I ℂ)
    (hQ : ∀ i j, f i ≠ f j → Q i j = 0) (a : J) :
    Commute Q (Matrix.diagonal (fun i => if f i = a then (1 : ℂ) else 0)) := by
  ext i j
  simp only [Matrix.mul_diagonal, Matrix.diagonal_mul]
  by_cases h : f i = f j
  · rw [h]; ring
  · rw [hQ i j h]; ring

lemma sqrt_block_diagonal (f : I → J) (Q : Matrix I I ℂ)
    (hQ : ∀ i j, f i ≠ f j → Q i j = 0) :
    ∀ i j, f i ≠ f j → CFC.sqrt Q i j = 0 := by
  intro i j hij
  have h := (block_diagonal_commute f Q hQ (f i)).cfc_nnreal NNReal.sqrt
  rw [← CFC.sqrt_eq_cfc] at h
  have hh := congrFun (congrFun h.eq i) j
  simp only [Matrix.mul_diagonal, Matrix.diagonal_mul, ite_true,
    ite_eq_right (Ne.symm hij), mul_zero, one_mul] at hh
  exact hh.symm

lemma sqrt_submatrix_invariant (Q : Matrix I I ℂ) (hQ : Q.PosSemidef)
    (e : Equiv.Perm I) (he : Q.submatrix e e = Q) :
    (CFC.sqrt Q).submatrix e e = CFC.sqrt Q := by
  apply Eq.symm
  apply CFC.sqrt_unique _ ((CFC.sqrt_nonneg Q).posSemidef.submatrix e).nonneg
  rw [Matrix.submatrix_mul_equiv, CFC.sqrt_mul_sqrt_self Q hQ.nonneg, he]

lemma sqrt_gram (Q : Matrix I I ℂ) (hQ : Q.PosSemidef) :
    CFC.sqrt Q * (CFC.sqrt Q).conjTranspose = Q := by
  rw [(CFC.sqrt_nonneg Q).posSemidef.1.eq, CFC.sqrt_mul_sqrt_self Q hQ.nonneg]

end BinaryCoordinateSweeps.Density

end

end OAI