introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.65 kB
import Mathlib
namespace OAI
/-! The Choi–Lam form, determinant polynomial, root-defined cone, and quadratic deformation. -/
noncomputable section
open scoped Matrix.Norms.L2Operator
universe u
namespace Paper256
abbrev Mat (n : β„•) (R : Type u) := Matrix (Fin n) (Fin n) R
abbrev Sym (n : β„•) := selfAdjoint (Mat n ℝ)
instance instFiniteDimensionalSym (n : β„•) : FiniteDimensional ℝ (Sym n) :=
FiniteDimensional.finiteDimensional_submodule (selfAdjoint.submodule ℝ (Mat n ℝ))
abbrev Ambient := (Sym 4 Γ— Sym 4) Γ— (Fin 3 β†’ ℝ)
abbrev SymIndex := {ij : Fin 4 Γ— Fin 4 // ij.1 ≀ ij.2}
abbrev Coord := (SymIndex βŠ• SymIndex) βŠ• Fin 3
def qMatrix {R : Type u} [CommRing R] (y : Fin 3 β†’ R) : Mat 3 R :=
fun i j => if i = j then y i ^ 2 + y (i + 1) ^ 2 else -(y i * y j)
def phi {R : Type u} [CommRing R] (y : Fin 3 β†’ R) (X : Mat 4 R) : Mat 4 R :=
fun i j => Fin.cases
(Fin.cases
(Matrix.trace (qMatrix y * X.submatrix Fin.succ Fin.succ))
(fun j => -(βˆ‘ k, X 0 k.succ * qMatrix y k j)) j)
(fun i => Fin.cases
(-(βˆ‘ k, qMatrix y i k * X k.succ 0))
(fun j => X 0 0 * qMatrix y i j) j) i
def matrixValue {R : Type u} [CommRing R]
(X Z : Mat 4 R) (y : Fin 3 β†’ R) : R :=
Matrix.det ((Matrix.det X) β€’ Z - phi y (Matrix.adjugate X))
def symmetricCoordinates {R : Type u} (v : SymIndex β†’ R) : Mat 4 R :=
fun i j => if h : i ≀ j then v ⟨(i, j), h⟩
else v ⟨(j, i), le_of_lt (lt_of_not_ge h)⟩
def polynomial : MvPolynomial Coord ℝ :=
matrixValue
(symmetricCoordinates fun ij => MvPolynomial.X (Sum.inl (Sum.inl ij)))
(symmetricCoordinates fun ij => MvPolynomial.X (Sum.inl (Sum.inr ij)))
(fun i => MvPolynomial.X (Sum.inr i))
def coordinates (x : Ambient) : Coord β†’ ℝ :=
Sum.elim (Sum.elim
(fun ij => (x.1.1 : Mat 4 ℝ) ij.val.1 ij.val.2)
(fun ij => (x.1.2 : Mat 4 ℝ) ij.val.1 ij.val.2)) x.2
def basePoint : Ambient := ((1, 1), 0)
def linePolynomial (x : Ambient) : Polynomial ℝ :=
MvPolynomial.evalβ‚‚ Polynomial.C
(fun i => Polynomial.C (coordinates basePoint i) * Polynomial.X -
Polynomial.C (coordinates x i)) polynomial
def cone : Set Ambient :=
{x | βˆ€ t : β„‚, (linePolynomial x).aeval t = 0 β†’ t.im = 0 ∧ 0 ≀ t.re}
def choiLam {R : Type u} [CommRing R] (z y : Fin 3 β†’ R) : R :=
(βˆ‘ i, z i ^ 2 * y i ^ 2) -
2 * (z 0 * y 0 * z 1 * y 1 + z 0 * y 0 * z 2 * y 2 +
z 1 * y 1 * z 2 * y 2) +
(βˆ‘ i, z i ^ 2 * y (i + 1) ^ 2)
def zMatrix {R : Type u} [CommRing R] (z : Fin 3 β†’ R) : Mat 3 R :=
fun i j => if i = j then z i ^ 2 + z (i + 2) ^ 2 else -(z i * z j)
def intervalPolynomial (a b : ℝ) : Polynomial ℝ :=
(1 - Polynomial.C a⁻¹ * Polynomial.X) * (1 + Polynomial.C b⁻¹ * Polynomial.X)
def timeScale (Ξ· t : ℝ) : ℝ := 1 + Ξ· * Real.sin (Real.pi * t) ^ 2
def deformedPolynomial (a b Ξ· t : ℝ) : Polynomial ℝ :=
(intervalPolynomial a b).comp (Polynomial.C (timeScale Ξ· t) * Polynomial.X)
def rigidlyConvexSet (p : Polynomial ℝ) : Set ℝ :=
closure (connectedComponentIn {x : ℝ | p.eval x β‰  0} 0)
open scoped BigOperators RealInnerProductSpace
open Set Filter Matrix
abbrev Vec (n : β„•) := EuclideanSpace ℝ (Fin n)
def outer {n : β„•} (v : Vec n) : Mat n ℝ := fun i j => v i * v j
def outerSym {n : β„•} (v : Vec n) : Sym n :=
⟨outer v, by
change (outer v)α΄΄ = outer v
ext i j
simp [outer, Matrix.conjTranspose_apply, mul_comm]⟩
def operatorNorm {m n : β„•} (A : Matrix (Fin m) (Fin n) ℝ) : ℝ :=
β€–A.toEuclideanLin.toContinuousLinearMapβ€–
def kernelProjection {n : β„•} (A : Mat n ℝ) : Mat n ℝ :=
Matrix.toEuclideanLin.symm (A.toEuclideanLin.ker.starProjection.toLinearMap)
def inverseSquareRoot {n : β„•} (A : Sym n) : Mat n ℝ :=
let hA : (A : Mat n ℝ).IsHermitian := A.property
let U : Mat n ℝ := hA.eigenvectorUnitary
U * Matrix.diagonal (fun i => (Real.sqrt (hA.eigenvalues i))⁻¹) * Uᴴ
/-- The vector vβ‚€uβ€²βˆ’uβ‚€vβ€² in the rank-one and operator-norm identities. -/
def wedgeCoordinates (v u : Vec 4) : Fin 3 β†’ ℝ :=
fun i => v 0 * u i.succ - u 0 * v i.succ
def tangentCurve (v h : Vec 4) (s : ℝ) : Vec 4 :=
(Real.sqrt (1 + s ^ 2 * β€–hβ€– ^ 2))⁻¹ β€’ (v + s β€’ h)
def tangentSpace (v : Vec 4) : Submodule ℝ (Vec 4) := (innerSL ℝ v).ker
/-- Positive unital diagonal blocks with an exact Schur-complement equivalence. -/
structure NormalizedPencil where
a : β„•
c : β„•
a_pos : 0 < a
c_pos : 0 < c
D : Sym 4 β†’β‚—[ℝ] Sym a
E : Sym 4 β†’β‚—[ℝ] Sym c
B : (Fin 3 β†’ ℝ) β†’β‚—[ℝ] Matrix (Fin a) (Fin c) ℝ
D_positive : βˆ€ X : Sym 4, (X : Mat 4 ℝ).PosSemidef β†’ (D X : Mat a ℝ).PosSemidef
E_positive : βˆ€ X : Sym 4, (X : Mat 4 ℝ).PosSemidef β†’ (E X : Mat c ℝ).PosSemidef
D_unital : D 1 = 1
E_unital : E 1 = 1
schur_equivalence : βˆ€ (X Z : Sym 4) (y : Fin 3 β†’ ℝ) (_hX : (X : Mat 4 ℝ).PosDef),
((Z : Mat 4 ℝ) - phi y (X : Mat 4 ℝ)⁻¹).PosSemidef ↔
((E Z : Mat c ℝ) - (B y)α΅€ * (D X : Mat a ℝ)⁻¹ * B y).PosSemidef
def NormalizedPencil.leftProjection (P : NormalizedPencil) (v : Vec 4) : Mat P.a ℝ :=
kernelProjection (P.D (1 - outerSym v) : Mat P.a ℝ)
def NormalizedPencil.rightProjection (P : NormalizedPencil) (v : Vec 4) : Mat P.c ℝ :=
kernelProjection (P.E (1 - outerSym v) : Mat P.c ℝ)
def deformedPencil (a b Ξ· t x : ℝ) : Mat 2 ℝ :=
Matrix.diagonal ![1 - timeScale Ξ· t * x / a, 1 + timeScale Ξ· t * x / b]
def deformedCoefficients (a b Ξ· t : ℝ) : Fin 3 β†’ ℝ :=
fun i => (deformedPolynomial a b Ξ· t).coeff i.val
end Paper256
end
end OAI