cfahlgren1's picture
download
raw
5.22 kB
import Mathlib
import OAI.Analysis.MatrixSigning.Matrices.TraceCLM
namespace OAI
open Matrix
namespace CurrentKS.Variational
noncomputable section
open CurrentKS.Hermitian Matrix Set
open scoped BigOperators ComplexOrder MatrixOrder Matrix.Norms.Frobenius
variable {d : ℕ}
abbrev Point (d : ℕ) := ℝ × H d × H d
def domain (d : ℕ) : Set (Point d) := {z | z.2.1 ∈ pd d ∧ z.2.2 ∈ pd d}
def objective (ε : ℝ) (z : Point d) : ℝ := z.1 + ε * realTrace (z.2.1 + z.2.2)
def residual (S : H d) (η : H d →L[ℝ] H d) (z : Point d) : H d × H d :=
(invH z.2.1 + S + η z.2.2 - z.1 • (Hermitian.one : H d),
invH z.2.2 - S + η z.2.1 - z.1 • (Hermitian.one : H d))
def feasible (S : H d) (η : H d →L[ℝ] H d) : Set (Point d) :=
{z | z ∈ domain d ∧ (residual S η z).1 ≤ 0 ∧ (residual S η z).2 ≤ 0}
lemma feasible_iff (S : H d) (η : H d →L[ℝ] H d) (z : Point d) :
z ∈ feasible S η ↔ z.2.1 ∈ pd d ∧ z.2.2 ∈ pd d ∧
invH z.2.1 + S + η z.2.2 ≤ z.1 • (Hermitian.one : H d) ∧
invH z.2.2 - S + η z.2.1 ≤ z.1 • (Hermitian.one : H d) := by
simp only [feasible, domain, residual, mem_ofPred_eq, sub_nonpos]
tauto
lemma continuous_objective (ε : ℝ) : Continuous (objective (d := d) ε) := by
exact continuous_fst.add (continuous_const.mul
(continuous_realTrace.comp ((continuous_fst.comp continuous_snd).add
(continuous_snd.comp continuous_snd))))
lemma trace_bounds_of_feasible [NeZero d] (S : H d) (η : H d →L[ℝ] H d)
(hη : ∀ A ∈ psdCone d, η A ∈ psdCone d)
{z : Point d} (hz : z ∈ feasible S η) :
0 ≤ z.1 ∧ 0 ≤ realTrace z.2.1 ∧ 0 ≤ realTrace z.2.2 := by
obtain ⟨hX, hY, h₁, h₂⟩ := (feasible_iff S η z).mp hz
have htr₁ := realTrace_mono h₁
have htr₂ := realTrace_mono h₂
have hiX := realTrace_nonneg (A := invH z.2.1) hX.inv.posSemidef
have hiY := realTrace_nonneg (A := invH z.2.2) hY.inv.posSemidef
have heX := realTrace_nonneg (hη _ hX.posSemidef)
have heY := realTrace_nonneg (hη _ hY.posSemidef)
simp only [realTrace_add, realTrace_sub, realTrace_smul, realTrace_one] at htr₁ htr₂
have hd : (0 : ℝ) < d := by exact_mod_cast NeZero.pos d
refine ⟨?_, realTrace_nonneg hX.posSemidef, realTrace_nonneg hY.posSemidef⟩
nlinarith
lemma objective_bounds [NeZero d] (S : H d) (η : H d →L[ℝ] H d)
(hη : ∀ A ∈ psdCone d, η A ∈ psdCone d)
{ε K : ℝ} (hε : 0 < ε) {z : Point d} (hz : z ∈ feasible S η)
(hf : objective ε z ≤ K) :
0 ≤ z.1 ∧ z.1 ≤ K ∧ realTrace z.2.1 ≤ K / ε ∧ realTrace z.2.2 ≤ K / ε := by
obtain ⟨ht, hX, hY⟩ := trace_bounds_of_feasible S η hη hz
simp only [objective, realTrace_add] at hf
refine ⟨ht, ?_, (le_div_iff₀ hε).mpr ?_, (le_div_iff₀ hε).mpr ?_⟩ <;>
nlinarith [mul_nonneg hε.le hX, mul_nonneg hε.le hY]
lemma inverse_bounds (S : H d) (η : H d →L[ℝ] H d)
(hη : ∀ A ∈ psdCone d, η A ∈ psdCone d)
{K : ℝ} (hS₁ : -K • (Hermitian.one : H d) ≤ S) (hS₂ : S ≤ K • (Hermitian.one : H d))
{z : Point d} (hz : z ∈ feasible S η) (ht : z.1 ≤ K) :
invH z.2.1 ≤ (2*K) • (Hermitian.one : H d) ∧ invH z.2.2 ≤ (2*K) • (Hermitian.one : H d) := by
obtain ⟨hX, hY, h₁, h₂⟩ := (feasible_iff S η z).mp hz
have heX : 0 ≤ η z.2.1 := psd_nonneg (hη _ hX.posSemidef)
have heY : 0 ≤ η z.2.2 := psd_nonneg (hη _ hY.posSemidef)
have htk : z.1 • (Hermitian.one : H d) ≤ K • (Hermitian.one : H d) := scalar_one_mono ht
constructor
· have hh : invH z.2.1 + S ≤ K • (Hermitian.one : H d) :=
(le_add_of_nonneg_right heY).trans (h₁.trans htk)
have hx := add_le_add hh (neg_le_neg hS₁)
convert hx using 1 <;> first | rfl | module
· have hh : invH z.2.2 - S ≤ K • (Hermitian.one : H d) :=
(le_add_of_nonneg_right heX).trans (h₂.trans htk)
have hx := add_le_add hh hS₂
convert hx using 1 <;> first | rfl | module
lemma sublevel_box [NeZero d] (S : H d) (η : H d →L[ℝ] H d)
(hη : ∀ A ∈ psdCone d, η A ∈ psdCone d)
{ε K : ℝ} (hε : 0 < ε) (hK : 0 < K)
(hS₁ : -K • (Hermitian.one : H d) ≤ S) (hS₂ : S ≤ K • (Hermitian.one : H d))
{z : Point d} (hz : z ∈ feasible S η) (hf : objective ε z ≤ K) :
z.1 ∈ Icc 0 K ∧
((2*K)⁻¹ • (Hermitian.one : H d) ≤ z.2.1 ∧ z.2.1 ≤ (K/ε) • (Hermitian.one : H d)) ∧
((2*K)⁻¹ • (Hermitian.one : H d) ≤ z.2.2 ∧ z.2.2 ≤ (K/ε) • (Hermitian.one : H d)) := by
obtain ⟨ht, htK, htrX, htrY⟩ := objective_bounds S η hη hε hz hf
obtain ⟨hXi, hYi⟩ := inverse_bounds S η hη hS₁ hS₂ hz htK
obtain ⟨hX,hY,-,-⟩ := (feasible_iff S η z).mp hz
have hmul : ∀ r s : ℝ, r ≤ s → r • (Hermitian.one : H d) ≤ s • (Hermitian.one : H d) :=
fun _ _ h => scalar_one_mono h
exact ⟨⟨ht,htK⟩,
⟨inverse_bound_below (by positivity) hX hXi,
(trace_bound_above hX.posSemidef).trans (hmul _ _ htrX)⟩,
⟨inverse_bound_below (by positivity) hY hYi,
(trace_bound_above hY.posSemidef).trans (hmul _ _ htrY)⟩⟩
end
end CurrentKS.Variational
end OAI

Xet Storage Details

Size:
5.22 kB
·
Xet hash:
18a924af8e658371af58241a68829415e75ad19af34360240b34ef3dc66597c2

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