statement
stringlengths
1
615
proof
stringlengths
0
8.26k
type
stringclasses
11 values
symbolic_name
stringlengths
1
64
library
stringclasses
29 values
filename
stringclasses
121 values
imports
listlengths
0
15
deps
listlengths
0
20
docstring
stringlengths
0
1.5k
source_url
stringclasses
1 value
commit
stringclasses
1 value
Vec.soCone (t : m → ℝ) (X : Matrix m n ℝ) : Prop
∀ i, Real.soCone (t i) (X i)
def
Real.Vec.soCone
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[ "Real.soCone" ]
`m` copies of the `n`-dimensional second-order cone `(𝒬ⁿ)ᵐ`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Vec.rotatedSoCone (v w : m → ℝ) (X : Matrix m n ℝ) : Prop
∀ i, Real.rotatedSoCone (v i) (w i) (X i)
def
Real.Vec.rotatedSoCone
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[ "Real.rotatedSoCone" ]
`m` copies of the `n`-dimensional rotated second-order cone `(𝒬ᵣⁿ)ᵐ`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
rotateSoCone {n : ℕ} (t : ℝ) (x : Fin n.succ → ℝ) : ℝ × ℝ × (Fin n → ℝ)
((t + x 0) / sqrt 2, (t - x 0) / sqrt 2, fun i => x i.succ)
def
Real.rotateSoCone
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
If `(t, x) ∈ 𝒬ⁿ⁺¹` then `r(t, x) ∈ 𝒬ᵣⁿ⁺²`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
rotateSoCone_rotatedSoCone {n : ℕ} {t : ℝ} {x : Fin n.succ → ℝ} (h : soCone t x) : let (v, w, x)
rotateSoCone t x; rotatedSoCone v w x := by simp [rotatedSoCone, rotateSoCone] have habsx0t : |x 0| ≤ t := by rw [soCone, Fin.sum_univ_succ] at h have hS : 0 ≤ ∑ i : Fin n, x (Fin.succ i) ^ 2 := Finset.sum_nonneg (fun i _ => (rpow_two (x i.succ)).symm ▸ sq_nonneg (x i.succ)) exact abs_le_of_sqrt_s...
lemma
Real.rotateSoCone_rotatedSoCone
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
unrotateSoCone {n : ℕ} (v w : Real) (x : Fin n → ℝ) : ℝ × (Fin n.succ → ℝ)
((v + w) / sqrt 2, Matrix.vecCons ((v - w) / sqrt 2) x)
def
Real.unrotateSoCone
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
If `(v, w, x) ∈ 𝒬ⁿ⁺²` then `u(v, w, x) ∈ 𝒬ᵣⁿ⁺¹`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
unrotateSoCone_soCone {n : ℕ} {v w : ℝ} {x : Fin n → ℝ} (h : rotatedSoCone v w x) : let (t, x)
unrotateSoCone v w x; soCone t x := by simp [soCone, unrotateSoCone] replace ⟨h, hv, hw⟩ := h rw [sqrt_le_iff] split_ands { simp [le_div_iff]; linarith } { rw [Fin.sum_univ_succ] simp [Matrix.vecCons] rw [add_comm, ← le_sub_iff_add_le] field_simp have hrw : ((v + w) ^ 2 - (v - w) ^ 2) / 2 = ...
lemma
Real.unrotateSoCone_soCone
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
soCone_add_sub_two_mul_of_nonneg {x y : ℝ} (z : ℝ) (hx : 0 ≤ x) (hy : 0 ≤ y) : soCone (x + y) ![x - y, 2 * z] ↔ z ^ (2 : ℝ) ≤ x * y
by have hxy := add_nonneg hx hy conv => lhs; unfold soCone; simp [sqrt_le_left hxy, ← le_sub_iff_add_le'] ring_nf; simp
lemma
Real.soCone_add_sub_two_mul_of_nonneg
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
To handle powers, a common trick is to use the fact that for `x, y ≥ 0` and `z ∈ ℝ`, `((x + y), (x - y, 2z)ᵀ) ∈ 𝒬ⁿ⁺¹ ↔ z ^ 2 ≤ xy`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
soCone_add_sub_two_of_nonneg {x y : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) : soCone (x + y) ![x - y, 2] ↔ 1 ≤ x * y
by have h := soCone_add_sub_two_mul_of_nonneg 1 hx hy rw [mul_one, one_rpow] at h exact h
lemma
Real.soCone_add_sub_two_of_nonneg
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
Same as `soCone_add_sub_two_mul_of_nonneg` with `z = 1`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
soCone_sub_add_two_mul_of_nonneg {x y : ℝ} (z : ℝ) : soCone (x - y) ![x + y, 2 * z] ↔ y ≤ x ∧ z ^ (2 : ℝ) ≤ -(x * y)
by conv => lhs; unfold soCone; simp [sqrt_le_iff, ← le_sub_iff_add_le'] apply Iff.and · rfl · ring_nf!; rw [← neg_mul, ← div_le_iff (by norm_num)]; simp
lemma
Real.soCone_sub_add_two_mul_of_nonneg
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
Same as `soCone_add_sub_two_mul_of_nonneg` replacing `y` by `-y`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
vec_soCone_apply_to_soCone_add_sub_two_mul {n : ℕ} (x y z : Fin n → ℝ) (i : Fin n) : (soCone ((x + y) i) ((![x - y, 2 • z]ᵀ) i)) ↔ (soCone (x i + y i) ![x i - y i, 2 * z i])
by dsimp; convert Iff.rfl; funext j; fin_cases j <;> simp
lemma
Real.vec_soCone_apply_to_soCone_add_sub_two_mul
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
vec_soCone_apply_to_soCone_add_sub_two {n : ℕ} (x y : Fin n → ℝ) (i : Fin n) : (soCone ((x + y) i) ((![x - y, 2]ᵀ) i)) ↔ (soCone (x i + y i) ![x i - y i, 2])
by dsimp; convert Iff.rfl; funext j; fin_cases j <;> simp
lemma
Real.vec_soCone_apply_to_soCone_add_sub_two
Lib.Cones
CvxLean/Lib/Cones/SOCone.lean
[ "Mathlib.Data.Real.Sqrt", "Mathlib.Data.Matrix.Basic", "Mathlib.Analysis.SpecialFunctions.Pow.Real", "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
zeroCone (x : ℝ) : Prop
x = 0
def
Real.zeroCone
Lib.Cones
CvxLean/Lib/Cones/ZeroCone.lean
[ "Mathlib.Data.Real.Basic", "CvxLean.Lib.Math.Data.Matrix" ]
[]
The zero cone `{0}`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Vec.zeroCone {n} [Fintype n] (x : n → ℝ) : Prop
∀ i, Real.zeroCone (x i)
def
Real.Vec.zeroCone
Lib.Cones
CvxLean/Lib/Cones/ZeroCone.lean
[ "Mathlib.Data.Real.Basic", "CvxLean.Lib.Math.Data.Matrix" ]
[ "Real.zeroCone" ]
The `n`-dimensional zero cone `{0}ⁿ`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Matrix.zeroCone {n m} [Fintype n] [Fintype m] (M : Matrix n m ℝ) : Prop
∀ i j, Real.zeroCone (M i j)
def
Real.Matrix.zeroCone
Lib.Cones
CvxLean/Lib/Cones/ZeroCone.lean
[ "Mathlib.Data.Real.Basic", "CvxLean.Lib.Math.Data.Matrix" ]
[ "Real.zeroCone" ]
The `n×m`-dimensional zero cone `{0}ⁿˣᵐ`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Matrix.quadForm {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (x : Fin n → ℝ) : ℝ
x ⬝ᵥ R.mulVec x
def
Matrix.quadForm
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
gaussianPdf {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (x : Fin n → ℝ) : ℝ
(1 / sqrt (((2 * π) ^ n) * R.det)) * exp (- R⁻¹.quadForm x / 2)
def
gaussianPdf
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
covarianceMatrix {N n : ℕ} (y : Fin N → Fin n → ℝ) : Matrix (Fin n) (Fin n) ℝ
fun i j : Fin n => (∑ k : Fin N, y k i * y k j) / N
def
covarianceMatrix
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
gaussianPdf_pos {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (y : Fin n → ℝ) (h : R.PosDef) : 0 < gaussianPdf R y
by refine' mul_pos (div_pos zero_lt_one (sqrt_pos.2 (mul_pos _ h.det_pos))) (exp_pos _) exact (pow_pos (mul_pos (by positivity) pi_pos) n)
lemma
gaussianPdf_pos
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[ "gaussianPdf" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
prod_gaussianPdf_pos {N n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (y : Fin N → Fin n → ℝ) (h : R.PosDef) : 0 < ∏ i : Fin N, gaussianPdf R (y i)
Finset.prod_pos (fun _ _ => gaussianPdf_pos _ _ h)
lemma
prod_gaussianPdf_pos
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[ "gaussianPdf", "gaussianPdf_pos" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
log_prod_gaussianPdf {N n : ℕ} (y : Fin N → Fin n → ℝ) (R : Matrix (Fin n) (Fin n) ℝ) (hR : R.PosDef) : log (∏ i : Fin N, gaussianPdf R (y i)) = ∑ i : Fin N, (- (log (sqrt ((2 * π) ^ n)) + log (sqrt R.det)) + - R⁻¹.quadForm (y i) / 2)
by have : ∀ i, i ∈ Finset.univ → gaussianPdf R (y i) ≠ 0 := fun i _ => ne_of_gt (gaussianPdf_pos _ _ hR) have sqrt_2_pi_n_R_det_ne_zero: sqrt ((2 * π) ^ n * R.det) ≠ 0 := by refine' ne_of_gt (sqrt_pos.2 (mul_pos _ hR.det_pos)) exact (pow_pos (mul_pos (by positivity) pi_pos) _) rw [log_prod Finset.univ...
lemma
log_prod_gaussianPdf
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[ "gaussianPdf", "gaussianPdf_pos" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
sum_quadForm {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) {m : ℕ} (y : Fin m → Fin n → ℝ) : ∑ i, R.quadForm (y i) = m * (covarianceMatrix y * Rᵀ).trace
by by_cases h : m = 0 { subst h; simp } simp only [Matrix.quadForm, Matrix.trace, covarianceMatrix, diag, mul_apply, Finset.sum_mul, Finset.sum_div] erw [Finset.sum_comm (γ := Fin m)] simp_rw [Finset.mul_sum] congr; ext i have hmnz : (m : ℝ) ≠ 0 := by simp [h] simp_rw [← mul_assoc, mul_div_cancel₀ _...
lemma
sum_quadForm
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[ "Matrix.quadForm", "covarianceMatrix" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Real.inverse_eq_inv (a : ℝ) : Ring.inverse a = a⁻¹
by simp
lemma
Real.inverse_eq_inv
Lib.Math
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LDL.invertible_diag : Invertible (LDL.diag hA)
by rw [LDL.diag_eq_lowerInv_conj] refine @invertibleMul _ _ _ _ (@invertibleMul _ _ _ _ _ hA.Invertible) _
instance
Matrix.LDL.invertible_diag
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef_zero : PosSemidef (0 : Matrix n n 𝕜)
by simp [PosSemidef]
lemma
Matrix.PosSemidef_zero
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.feasibility_PosDef {D Z : Matrix n n ℝ} (hD : D = LDL.diag hA) (hZ : Z = LDL.diag hA * (LDL.lower hA)ᵀ) : (fromBlocks D Z Zᵀ A).PosSemidef
by have h_D_eq : D = Z * A⁻¹ * Zᴴ := calc D = D * D⁻¹ * D := by rw [hD, Matrix.mul_inv_of_invertible, Matrix.one_mul] _ = D * (LDL.lowerInv hA * A * (LDL.lowerInv hA)ᵀ)⁻¹ * Dᵀ := by erw [hD, LDL.diag, diagonal_transpose, ← LDL.diag, LDL.diag_eq_lowerInv_conj] rfl _ = D ...
lemma
Matrix.LogDetAtom.feasibility_PosDef
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.feasibility_PosDef' {D Z Y : Matrix n n ℝ} (hY : Y = LDL.diag hA * (LDL.lower hA)ᵀ) (hD : D = diagonal Y.diag) (hZ : Z = Y.toUpperTri) : (fromBlocks D Z Zᵀ A).PosSemidef
by have hY_tri : upperTriangular Y := by { rw [hY] apply upperTriangular.mul apply BlockTriangular_diagonal apply lowerTriangular.transpose apply LDL.lowerTriangular_lower } haveI := hA.Invertible rw [hZ, hY_tri.toUpperTri_eq] apply LogDetAtom.feasibility_PosDef _ _ hY simp [hD, hY, LDL.diag...
lemma
Matrix.LogDetAtom.feasibility_PosDef'
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[ "LDL.lowerTriangular_lower" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LDL.diagEntries_pos {A : Matrix n n ℝ} (hA: A.PosDef) (i : n) : 0 < LDL.diagEntries hA i
by have : (LDL.lowerInv hA).det ≠ 0 := by simp [LDL.det_lowerInv hA] have : LDL.lowerInv hA i ≠ 0 := fun h => this (Matrix.det_eq_zero_of_row_eq_zero i (λ j => congr_fun h j)) exact hA.2 (LDL.lowerInv hA i) this
lemma
Matrix.LDL.diagEntries_pos
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[ "LDL.det_lowerInv" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.solution_eq_atom {A : Matrix n n ℝ} (hA: A.PosDef) : ∑ i, Real.log (LDL.diagEntries hA i) = Real.log (A.det)
by conv => rhs; rw [(LDL.lower_conj_diag hA).symm] have heqsum := Real.log_prod Finset.univ (LDL.diagEntries hA) (fun i _ => ne_of_gt (LDL.diagEntries_pos hA i)) simp [LDL.diag, heqsum.symm]
lemma
Matrix.LogDetAtom.solution_eq_atom
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.feasibility_exp {A : Matrix n n ℝ} (hA: A.PosDef) (i : n) : LDL.diagEntries hA i ≤ ((LDL.diag hA) * ((LDL.lower hA)ᵀ)).diag i
by simp [LDL.diag]
lemma
Matrix.LogDetAtom.feasibility_exp
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
IsHermitian₁₁_of_IsHermitian_toBlock {A B C D : Matrix n n ℝ} (h : (fromBlocks A B C D).IsHermitian) : IsHermitian A
by ext i j; simpa using congr_fun (congr_fun h (Sum.inl i)) (Sum.inl j)
lemma
Matrix.IsHermitian₁₁_of_IsHermitian_toBlock
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
IsHermitian₂₂_of_IsHermitian_toBlock {A B C D : Matrix n n ℝ} (h : (fromBlocks A B C D).IsHermitian) : IsHermitian D
by ext i j; simpa using congr_fun (congr_fun h (Sum.inr i)) (Sum.inr j)
lemma
Matrix.IsHermitian₂₂_of_IsHermitian_toBlock
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef₁₁_of_PosSemidef_toBlock {A B C D : Matrix n n ℝ} (h : (fromBlocks A B C D).PosSemidef) : PosSemidef A
⟨IsHermitian₁₁_of_IsHermitian_toBlock h.1, fun x => by simpa [Matrix.fromBlocks_mulVec, star] using h.2 (Sum.elim x 0)⟩
lemma
Matrix.PosSemidef₁₁_of_PosSemidef_toBlock
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef₂₂_of_PosSemidef_toBlock {A B C D : Matrix n n ℝ} (h : (fromBlocks A B C D).PosSemidef) : PosSemidef D
⟨IsHermitian₂₂_of_IsHermitian_toBlock h.1, fun x => by simpa [Matrix.fromBlocks_mulVec, star] using h.2 (Sum.elim 0 x)⟩
lemma
Matrix.PosSemidef₂₂_of_PosSemidef_toBlock
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.optimality_D_posdef {t : n → ℝ} {Y Z D : Matrix n n ℝ} (ht : ∀ i, (t i).exp ≤ Y.diag i) (hD : D = Matrix.diagonal (Y.diag)) (_hZ : Z = Y.toUpperTri) (hPSD : (fromBlocks D Z Zᵀ A).PosSemidef) : D.PosDef
by have h_D_psd : D.PosSemidef := PosSemidef₁₁_of_PosSemidef_toBlock hPSD show D.PosDef { rw [h_D_psd.PosDef_iff_det_ne_zero, hD, det_diagonal, Finset.prod_ne_zero_iff] exact λ i _ => ne_of_gt (lt_of_lt_of_le ((t i).exp_pos) (ht i)) }
lemma
Matrix.LogDetAtom.optimality_D_posdef
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.optimality_Ddet_le_Adet {t : n → ℝ} {Y Z D : Matrix n n ℝ} (ht : ∀ i, (t i).exp ≤ Y.diag i) (hD : D = Matrix.diagonal (Y.diag)) (hZ : Z = Y.toUpperTri) (hPSD : (fromBlocks D Z Zᵀ A).PosSemidef) : D.det ≤ A.det
by by_cases h_nonempty : Nonempty n { have h_D_pd : D.PosDef := LogDetAtom.optimality_D_posdef ht hD hZ hPSD haveI h_D_invertible : Invertible D := h_D_pd.Invertible have h_Zdet : Z.det = D.det := by { rw [hZ, det_of_upperTriangular (upperTriangular_toUpperTri Y), hD, det_diagonal] simp [toUpperTr...
lemma
Matrix.LogDetAtom.optimality_Ddet_le_Adet
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.cond_elim {t : n → ℝ} {Y Z D : Matrix n n ℝ} (ht : ∀ i, (t i).exp ≤ Y.diag i) (hD : D = Matrix.diagonal (Y.diag)) (hZ : Z = Y.toUpperTri) (hPSD : (fromBlocks D Z Zᵀ A).PosSemidef) : A.PosDef
by have h_D_pd : D.PosDef := LogDetAtom.optimality_D_posdef ht hD hZ hPSD have h_A_psd : A.PosSemidef := PosSemidef₂₂_of_PosSemidef_toBlock hPSD have h_Ddet_le_Adet : D.det ≤ A.det := LogDetAtom.optimality_Ddet_le_Adet ht hD hZ hPSD have h_Adet_pos : 0 < A.det := lt_of_lt_of_le h_D_pd.det_pos h_Ddet_le_Adet r...
lemma
Matrix.LogDetAtom.cond_elim
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
LogDetAtom.optimality {t : n → ℝ} {Y Z D : Matrix n n ℝ} (ht : ∀ i, (t i).exp ≤ Y.diag i) (hD : D = Matrix.diagonal (Y.diag)) (hZ : Z = Y.toUpperTri) (hPSD : (fromBlocks D Z Zᵀ A).PosSemidef) : ∑ i, t i ≤ Real.log A.det
by have h_A_pd : A.PosDef := LogDetAtom.cond_elim ht hD hZ hPSD have h_Ddet_le_Adet : D.det ≤ A.det := LogDetAtom.optimality_Ddet_le_Adet ht hD hZ hPSD have h_Adet_pos: 0 < A.det := h_A_pd.det_pos rw [← Real.exp_le_exp, Real.exp_sum, Real.exp_log h_Adet_pos] apply le_trans (Finset.prod_le_prod (fun i _ => le_...
lemma
Matrix.LogDetAtom.optimality
Lib.Math
CvxLean/Lib/Math/LogDet.lean
[ "Mathlib.LinearAlgebra.Matrix.LDL", "CvxLean.Lib.Math.SchurComplement", "CvxLean.Lib.Math.Subadditivity", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
sum_exp_eq_sum_div {n} (x : Fin n → ℝ) (t : ℝ) : Vec.sum (Vec.exp (x - Vec.const n t)) = (Vec.sum (Vec.exp x)) / (Real.exp t)
by unfold Vec.sum rw [Finset.sum_div] congr; ext i simp [Vec.exp, Vec.const, Real.exp_sub]
lemma
Vec.sum_exp_eq_sum_div
Lib.Math
CvxLean/Lib/Math/LogSumExp.lean
[ "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[ "Vec.const", "Vec.exp", "Vec.sum" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
sum_exp_pos {n} (hn : 0 < n) (x : Fin n → ℝ) : 0 < Vec.sum (Vec.exp x)
by apply Finset.sum_pos { intros i _; simp [Vec.exp, Real.exp_pos] } { existsi ⟨0, hn⟩; simp }
lemma
Vec.sum_exp_pos
Lib.Math
CvxLean/Lib/Math/LogSumExp.lean
[ "CvxLean.Lib.Math.Data.Real", "CvxLean.Lib.Math.Data.Vec" ]
[ "Vec.exp", "Vec.sum" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
schur_complement_eq₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m 𝕜} (B : Matrix m n 𝕜) (D : Matrix n n 𝕜) (x : m → 𝕜) (y : n → 𝕜) [Invertible A] (hA : A.IsHermitian) : vecMul (star (x ⊕ᵥ y)) (fromBlocks A B Bᴴ D) ⬝ᵥ (x ⊕ᵥ y) = vecMul (star (x + (A⁻¹ * B).mulVec y)) A ⬝ᵥ (x + (A⁻¹ * B...
by simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hA.eq, conjTranspose_nonsing_inv, star_mulVec] abel
lemma
Matrix.schur_complement_eq₁₁
Lib.Math
CvxLean/Lib/Math/SchurComplement.lean
[ "Mathlib.LinearAlgebra.Matrix.Symmetric", "Mathlib.LinearAlgebra.Matrix.NonsingularInverse", "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.Algebra.Star.Pi" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
schur_complement_eq₂₂ [Fintype m] [Fintype n] [DecidableEq n] (A : Matrix m m 𝕜) (B : Matrix m n 𝕜) {D : Matrix n n 𝕜} (x : m → 𝕜) (y : n → 𝕜) [Invertible D] (hD : D.IsHermitian) : vecMul (star (x ⊕ᵥ y)) (fromBlocks A B Bᴴ D) ⬝ᵥ (x ⊕ᵥ y) = vecMul (star ((D⁻¹ * Bᴴ).mulVec x + y)) D ⬝ᵥ ((D⁻¹ * Bᴴ)....
by simp [Function.star_sum_elim, fromBlocks_mulVec, vecMul_fromBlocks, add_vecMul, dotProduct_mulVec, vecMul_sub, Matrix.mul_assoc, vecMul_mulVec, hD.eq, conjTranspose_nonsing_inv, star_mulVec] abel
lemma
Matrix.schur_complement_eq₂₂
Lib.Math
CvxLean/Lib/Math/SchurComplement.lean
[ "Mathlib.LinearAlgebra.Matrix.Symmetric", "Mathlib.LinearAlgebra.Matrix.NonsingularInverse", "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.Algebra.Star.Pi" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
IsHermitian.fromBlocks₁₁ [Fintype m] [DecidableEq m] {A : Matrix m m 𝕜} (B : Matrix m n 𝕜) (D : Matrix n n 𝕜) (hA : A.IsHermitian) : (Matrix.fromBlocks A B Bᴴ D).IsHermitian ↔ (D - Bᴴ * A⁻¹ * B).IsHermitian
by have hBAB : (Bᴴ * A⁻¹ * B).IsHermitian := by apply isHermitian_conjTranspose_mul_mul apply hA.inv rw [isHermitian_fromBlocks_iff] constructor · intro h apply IsHermitian.sub h.2.2.2 hBAB · intro h refine' ⟨hA, rfl, conjTranspose_conjTranspose B, _⟩ rw [← sub_add_cancel D] apply IsHe...
lemma
Matrix.IsHermitian.fromBlocks₁₁
Lib.Math
CvxLean/Lib/Math/SchurComplement.lean
[ "Mathlib.LinearAlgebra.Matrix.Symmetric", "Mathlib.LinearAlgebra.Matrix.NonsingularInverse", "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.Algebra.Star.Pi" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
IsHermitian.fromBlocks₂₂ [Fintype n] [DecidableEq n] (A : Matrix m m 𝕜) (B : Matrix m n 𝕜) {D : Matrix n n 𝕜} (hD : D.IsHermitian) : (Matrix.fromBlocks A B Bᴴ D).IsHermitian ↔ (A - B * D⁻¹ * Bᴴ).IsHermitian
by rw [← isHermitian_submatrix_equiv (Equiv.sumComm n m), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] convert IsHermitian.fromBlocks₁₁ _ _ hD <;> rw [conjTranspose_conjTranspose]
lemma
Matrix.IsHermitian.fromBlocks₂₂
Lib.Math
CvxLean/Lib/Math/SchurComplement.lean
[ "Mathlib.LinearAlgebra.Matrix.Symmetric", "Mathlib.LinearAlgebra.Matrix.NonsingularInverse", "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.Algebra.Star.Pi" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef.fromBlocks₁₁ [Fintype m] [DecidableEq m] [Fintype n] {A : Matrix m m 𝕜} (B : Matrix m n 𝕜) (D : Matrix n n 𝕜) (hA : A.PosDef) [Invertible A] : (fromBlocks A B Bᴴ D).PosSemidef ↔ (D - Bᴴ * A⁻¹ * B).PosSemidef
by rw [PosSemidef, IsHermitian.fromBlocks₁₁ _ _ hA.1] constructor { intro h; refine' ⟨h.1, _⟩; intro x have := h.2 (- ((A⁻¹ * B).mulVec x) ⊕ᵥ x) rw [dotProduct_mulVec, schur_complement_eq₁₁ B D _ _ hA.1, neg_add_self, dotProduct_zero, zero_add] at this rw [dotProduct_mulVec]; exact this } { in...
lemma
Matrix.PosSemidef.fromBlocks₁₁
Lib.Math
CvxLean/Lib/Math/SchurComplement.lean
[ "Mathlib.LinearAlgebra.Matrix.Symmetric", "Mathlib.LinearAlgebra.Matrix.NonsingularInverse", "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.Algebra.Star.Pi" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef.fromBlocks₂₂ [Fintype m] [Fintype n] [DecidableEq n] (A : Matrix m m 𝕜) (B : Matrix m n 𝕜) {D : Matrix n n 𝕜} (hD : D.PosDef) [Invertible D] : (fromBlocks A B Bᴴ D).PosSemidef ↔ (A - B * D⁻¹ * Bᴴ).PosSemidef
by rw [← posSemidef_submatrix_equiv (Equiv.sumComm n m), Equiv.sumComm_apply, fromBlocks_submatrix_sum_swap_sum_swap] convert @PosSemidef.fromBlocks₁₁ m n 𝕜 _ _ _ _ _ _ _ hD _ <;> rw [conjTranspose_conjTranspose]
lemma
Matrix.PosSemidef.fromBlocks₂₂
Lib.Math
CvxLean/Lib/Math/SchurComplement.lean
[ "Mathlib.LinearAlgebra.Matrix.Symmetric", "Mathlib.LinearAlgebra.Matrix.NonsingularInverse", "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.Algebra.Star.Pi" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
one_add_prod_le_prod_one_add {n : Type _} [Fintype n] [Nonempty n] (f : n → ℝ) (hf : ∀ i, 0 ≤ f i) : 1 + (∏ i, f i) ≤ ∏ i, (1 + f i)
by classical calc 1 + (∏ i, f i) = (∏ _a : n, 1 : ℝ) * ∏ a : n in univ \ univ, f a + (∏ a : n in ∅, 1) * ∏ a : n in univ \ ∅, f a := by { simp } _ = ∑ x in {univ, ∅}, (∏ _a : n in x, 1 : ℝ) * ∏ a : n in univ \ x, f a := by { rw [Finset.sum_pair]; simp; exact Finset.univ_nonempty.ne_empty } _ ≤...
lemma
Finset.one_add_prod_le_prod_one_add
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
eigenvectorMatrix_inv_mul : hA.eigenvectorMatrixInv * hA.eigenvectorMatrix = 1
by apply Basis.toMatrix_mul_toMatrix_flip
lemma
Matrix.IsHermitian.eigenvectorMatrix_inv_mul
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
spectral_theorem'' : hA.eigenvectorMatrix * diagonal (RCLike.ofReal ∘ hA.eigenvalues) * hA.eigenvectorMatrixᴴ = A
by rw [conjTranspose_eigenvectorMatrix, Matrix.mul_assoc, ← spectral_theorem, ← Matrix.mul_assoc, eigenvectorMatrix_mul_inv, Matrix.one_mul]
theorem
Matrix.IsHermitian.spectral_theorem''
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
IsHermitian.sqrt {A : Matrix n n ℝ} (hA : A.IsHermitian) : Matrix n n ℝ
hA.eigenvectorMatrix * Matrix.diagonal (fun i => (hA.eigenvalues i).sqrt) * hA.eigenvectorMatrixᵀ
def
Matrix.IsHermitian.sqrt
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
conjTranspose_eq_transpose {m n : Type _} {A : Matrix m n ℝ} : Aᴴ = Aᵀ
rfl
lemma
Matrix.conjTranspose_eq_transpose
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef.sqrt_mul_sqrt {A : Matrix n n ℝ} (hA : A.PosSemidef) : hA.1.sqrt * hA.1.sqrt = A
calc hA.1.sqrt * hA.1.sqrt = hA.1.eigenvectorMatrix * (Matrix.diagonal (fun i => (hA.1.eigenvalues i).sqrt) * (hA.1.eigenvectorMatrixᵀ * hA.1.eigenvectorMatrix) * Matrix.diagonal (fun i => (hA.1.eigenvalues i).sqrt)) * hA.1.eigenvectorMatrixᵀ := by simp [IsHermitian.sqrt, Matrix.mul_assoc] ...
lemma
Matrix.PosSemidef.sqrt_mul_sqrt
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef.PosSemidef_sqrt {A : Matrix n n ℝ} (hA : A.PosSemidef) : hA.1.sqrt.PosSemidef
PosSemidef.conjTranspose_mul_mul _ _ (PosSemidef_diagonal (fun i => Real.sqrt_nonneg (hA.1.eigenvalues i)))
lemma
Matrix.PosSemidef.PosSemidef_sqrt
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
IsHermitian.one_add {A : Matrix n n ℝ} (hA : A.IsHermitian) : (1 + A).IsHermitian
by dsimp [IsHermitian]; rw [IsHermitian.add _ hA]; simp
lemma
Matrix.IsHermitian.one_add
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
IsHermitian.has_eigenvector_one_add {A : Matrix n n ℝ} (hA : A.IsHermitian) (i : n) : Module.End.HasEigenvector (1 + Matrix.toLin' A) (1 + (hA.eigenvalues i)) ((hA.eigenvectorBasis) i)
Module.End.has_eigenvector_add (Module.End.has_eigenvector_one (hA.hasEigenvector_eigenvectorBasis i).2) (hA.hasEigenvector_eigenvectorBasis i)
lemma
Matrix.IsHermitian.has_eigenvector_one_add
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[ "Module.End.has_eigenvector_add", "Module.End.has_eigenvector_one" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosDef.PosDef_sqrt {A : Matrix n n ℝ} (hA : A.PosDef) : hA.1.sqrt.PosDef
by unfold IsHermitian.sqrt refine' PosDef.conjTranspose_mul_mul _ (hA.1.eigenvectorMatrixᵀ) (PosDef_diagonal (fun i => Real.sqrt_pos.2 (hA.eigenvalues_pos i))) _ show det hA.1.eigenvectorMatrixᵀ ≠ 0 rw [det_transpose] apply det_ne_zero_of_right_inverse hA.1.eigenvectorMatrix_mul_inv
lemma
Matrix.PosDef.PosDef_sqrt
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
PosSemidef.PosDef_iff_det_ne_zero [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosSemidef) : M.PosDef ↔ M.det ≠ 0
by refine' ⟨PosDef.det_ne_zero, _⟩; intro hdet; refine' ⟨hM.1, _⟩ intros x hx apply lt_of_le_of_ne' (hM.2 x) rw [← hM.sqrt_mul_sqrt, ← mulVec_mulVec, dotProduct_mulVec, ← transpose_transpose hM.1.sqrt, vecMul_transpose, transpose_transpose, ← conjTranspose_eq_transpose, hM.PosSemidef_sqrt.1.eq] simp o...
lemma
Matrix.PosSemidef.PosDef_iff_det_ne_zero
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
det_add_det_le_det_add' [Nonempty n] (A B : Matrix n n ℝ) (hA : A.PosDef) (hB : B.PosSemidef) : A.det + B.det ≤ (A + B).det
by let sqrtA := hA.1.sqrt have isUnit_det_sqrtA := isUnit_iff_ne_zero.2 hA.PosDef_sqrt.det_ne_zero have : IsUnit sqrtA := (isUnit_iff_isUnit_det _).2 isUnit_det_sqrtA have IsHermitian_sqrtA : sqrtA⁻¹.IsHermitian := by { apply IsHermitian.nonsingular_inv (hA.posSemidef.PosSemidef_sqrt.1) exact isUn...
lemma
Matrix.det_add_det_le_det_add'
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[ "Finset.one_add_prod_le_prod_one_add" ]
Subadditivity lemma for positive semidefinite matrices. This version assumes that one of the matrices is positive definite. See `det_add_det_le_det_add` for the more general statement. The argument is taken from Andreas Thom's comment on mathoverflow: https://mathoverflow.net/questions/65424/determinant-of-sum-of-posi...
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
det_add_det_le_det_add [Nonempty n] (A B : Matrix n n ℝ) (hA : A.PosSemidef) (hB : B.PosSemidef) : A.det + B.det ≤ (A + B).det
by by_cases hA' : A.det = 0 { by_cases hB' : B.det = 0 { simp [hA', hB'] apply (hA.add hB).det_nonneg } { rw [add_comm A B, add_comm A.det B.det] apply det_add_det_le_det_add' _ _ (hB.PosDef_iff_det_ne_zero.2 hB') hA } } { apply det_add_det_le_det_add' _ _ (hA.PosDef_iff_det_ne_zero.2 hA') hB ...
lemma
Matrix.det_add_det_le_det_add
Lib.Math
CvxLean/Lib/Math/Subadditivity.lean
[ "Mathlib.LinearAlgebra.Matrix.PosDef", "Mathlib.LinearAlgebra.Matrix.Spectrum", "Mathlib.LinearAlgebra.Eigenspace.Basic", "Mathlib.LinearAlgebra.Matrix.LDL", "Mathlib.LinearAlgebra.Matrix.DotProduct", "CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "Cv...
[]
Subadditivity lemma for positive semidefinite matrices.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
repr_gramSchmidt_diagonal {i : ι} (b : Basis ι 𝕜 E) : b.repr (gramSchmidt 𝕜 b i) i = 1
by rw [gramSchmidt_def, map_sub, Finsupp.sub_apply, Basis.repr_self, Finsupp.single_eq_same, sub_eq_self, map_sum, Finsupp.coe_finset_sum, Finset.sum_apply, Finset.sum_eq_zero] intros j hj rw [Finset.mem_Iio] at hj simp [orthogonalProjection_singleton, gramSchmidt_triangular hj]
lemma
repr_gramSchmidt_diagonal
Lib.Math.Analysis.InnerProductSpace
CvxLean/Lib/Math/Analysis/InnerProductSpace/GramSchmidtOrtho.lean
[ "Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
spectral_theorem' (v : E) (i : Fin n) (xs : OrthonormalBasis (Fin n) 𝕜 E) (as : Fin n → ℝ) (hxs : ∀ j, Module.End.HasEigenvector T (as j) (xs j)) : xs.repr (T v) i = as i * xs.repr v i
by suffices hsuff : ∀ (w : EuclideanSpace 𝕜 (Fin n)), T (xs.repr.symm w) = xs.repr.symm (fun i => as i * w i) by simpa only [LinearIsometryEquiv.symm_apply_apply, LinearIsometryEquiv.apply_symm_apply] using congr_arg (fun (v : E) => (xs.repr) v i) (hsuff ((xs.repr) v)) intros w simp_rw ...
lemma
LinearMap.spectral_theorem'
Lib.Math.Analysis.InnerProductSpace
CvxLean/Lib/Math/Analysis/InnerProductSpace/Spectrum.lean
[ "Mathlib.LinearAlgebra.Matrix.Spectrum" ]
[]
*Diagonalization theorem*, *spectral theorem*; version 3: A self-adjoint operator `T` on a finite-dimensional inner product space `E` acts diagonally on the identification of `E` with Euclidean space induced by an orthonormal basis of eigenvectors of `T`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Array.zeros [Zero α] (n : Nat) : Array α
Array.mk (List.replicate n 0)
def
Array.zeros
Lib.Math.Data
CvxLean/Lib/Math/Data/Array.lean
[ "Mathlib.Data.List.Basic", "Mathlib.Algebra.Group.Defs" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
DArray.zeros [Zero α] (a b : Nat) : Array (Array α)
Array.mk (List.replicate b (Array.zeros a))
def
DArray.zeros
Lib.Math.Data
CvxLean/Lib/Math/Data/Array.lean
[ "Mathlib.Data.List.Basic", "Mathlib.Algebra.Group.Defs" ]
[ "Array.zeros" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Array.filterIdx (as : Array α) (f : Nat → Bool)
Id.run do let mut bs := #[] for h : i in [:as.size] do if f i then bs := bs.push (as.get ⟨i, h.2⟩) return bs
def
Array.filterIdx
Lib.Math.Data
CvxLean/Lib/Math/Data/Array.lean
[ "Mathlib.Data.List.Basic", "Mathlib.Algebra.Group.Defs" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Array.zipWithMAux (f : α → β → MetaM γ) (as : Array α) (bs : Array β) (i : Nat) (cs : Array γ) : MetaM (Array γ)
do if h : i < as.size then let a := as.get ⟨i, h⟩; if h : i < bs.size then let b := bs.get ⟨i, h⟩; return ← zipWithMAux f as bs (i+1) <| cs.push <| ← f a b else pure cs else pure cs termination_by as.size - i
def
Array.zipWithMAux
Lib.Math.Data
CvxLean/Lib/Math/Data/Array.lean
[ "Mathlib.Data.List.Basic", "Mathlib.Algebra.Group.Defs" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Array.zipWithM (f : α → β → MetaM γ) (as : Array α) (bs : Array β) : MetaM (Array γ)
zipWithMAux f as bs 0 #[]
def
Array.zipWithM
Lib.Math.Data
CvxLean/Lib/Math/Data/Array.lean
[ "Mathlib.Data.List.Basic", "Mathlib.Algebra.Group.Defs" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Array.drop (n : ℕ) (as : Array α) : Array α
Array.mk (as.data.drop n)
def
Array.drop
Lib.Math.Data
CvxLean/Lib/Math/Data/Array.lean
[ "Mathlib.Data.List.Basic", "Mathlib.Algebra.Group.Defs" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
Array.take (n : ℕ) (as : Array α) : Array α
Array.mk (as.data.take n)
def
Array.take
Lib.Math.Data
CvxLean/Lib/Math/Data/Array.lean
[ "Mathlib.Data.List.Basic", "Mathlib.Algebra.Group.Defs" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
findIdx' (p : α → Prop) [DecidablePred p] : List α → Option ℕ
| [] => none | (a::l) => if p a then some 0 else (findIdx' p l).map Nat.succ
def
List.findIdx'
Lib.Math.Data
CvxLean/Lib/Math/Data/List.lean
[ "Mathlib.Algebra.Ring.Basic" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
toVec (x : List α) : Fin x.length → α
fun i => List.get x ⟨i, i.2⟩
def
List.toVec
Lib.Math.Data
CvxLean/Lib/Math/Data/List.lean
[ "Mathlib.Algebra.Ring.Basic" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
finRange' (d n : Nat) : List (Fin n)
if hn : 0 < n then (List.range d).map (Fin.ofNat' · hn) else []
def
List.finRange'
Lib.Math.Data
CvxLean/Lib/Math/Data/List.lean
[ "Mathlib.Algebra.Ring.Basic" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
sum' [Zero α] [Add α] (L : List α) : α
L.foldl (· + ·) 0
def
List.sum'
Lib.Math.Data
CvxLean/Lib/Math/Data/List.lean
[ "Mathlib.Algebra.Ring.Basic" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
const (k : α) : Matrix m n α
fun _ _ => k
def
Matrix.const
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
abs (A : Matrix m n ℝ) : Matrix m n ℝ
fun i j => |A i j|
def
Matrix.abs
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
vecCons_zero_zero {n} [Zero α] : vecCons (0 : α) (0 : Fin n → α) = 0
by ext i; refine' Fin.cases _ _ i <;> simp [vecCons]
theorem
Matrix.vecCons_zero_zero
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
smul_vecCons {n} [Zero α] [SMulZeroClass ℝ α] (x : ℝ) (y : α) (v : Fin n → α) : x • vecCons y v = vecCons (x • y) (x • v)
by ext i; refine' Fin.cases _ _ i <;> simp [vecCons]
theorem
Matrix.smul_vecCons
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
add_vecCons {n} [Zero α] [SMulZeroClass ℝ α] [Add α] (x : α) (v : Fin n → α) (y : α) (w : Fin n → α) : vecCons x v + vecCons y w = vecCons (x + y) (v + w)
by ext i; refine' Fin.cases _ _ i <;> simp [vecCons]
theorem
Matrix.add_vecCons
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
sum [Fintype m] [AddCommMonoid α] (X : Matrix m m α) : α
∑ i, (∑ j, X i j)
def
Matrix.sum
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
toArray (A : Matrix (Fin n) (Fin n) Float) : Array (Array Float)
(Array.range n).map <| fun i => if h : i < n then Vec.Computable.toArray (A ⟨i, h⟩) else Array.mk <| List.replicate n 0
def
Matrix.Computable.toArray
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[ "Vec.Computable.toArray" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
dotProduct (v w : Fin n → Float) : Float
(Array.zipWith (Vec.Computable.toArray v) (Vec.Computable.toArray w) Float.mul).foldl Float.add 0
def
Matrix.Computable.dotProduct
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[ "Vec.Computable.toArray" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
mulVec (M : Matrix (Fin n) (Fin m) Float) (v : (Fin m) → Float) : Fin n → Float
fun i => (fun j => M i j) ⬝ᵥᶜ v
def
Matrix.Computable.mulVec
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
vecMul (x : Fin n → Float) (M : Matrix (Fin n) (Fin m) Float) : Fin m → Float
fun j => x ⬝ᵥᶜ fun i => M i j
def
Matrix.Computable.vecMul
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
transpose {m n} {α} (M : Matrix m n α) : Matrix n m α
fun i j => M j i
def
Matrix.Computable.transpose
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
diag {n} {α} (M : Matrix n n α) : n → α
fun i => M i i
def
Matrix.Computable.diag
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
mul (M : Matrix (Fin l) (Fin m) Float) (N : Matrix (Fin m) (Fin n) Float) : Matrix (Fin l) (Fin n) Float
fun i k => (fun j => M i j) ⬝ᵥᶜ (fun j => N j k)
def
Matrix.Computable.mul
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
sum (A : Matrix (Fin n) (Fin n) Float) : Float
Vec.Computable.sum (fun i => Vec.Computable.sum (A i))
def
Matrix.Computable.sum
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[ "Vec.Computable.sum" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
trace (A : Matrix (Fin n) (Fin n) Float) : Float
(Vec.Computable.toArray (fun i => A i i)).foldl (· + ·) 0
def
Matrix.Computable.trace
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[ "Vec.Computable.toArray" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
covarianceMatrix {N n : ℕ} (Y : Matrix (Fin N) (Fin n) Float) (i j : Fin n) : Float
Vec.Computable.sum (fun k => (Y k i) * (Y k j)) / (OfNat.ofNat N)
def
Matrix.Computable.covarianceMatrix
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[ "Vec.Computable.sum", "covarianceMatrix" ]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
diagonal (x : Fin n → Float) : Matrix (Fin n) (Fin n) Float
fun i j => (if i = j then x i else 0)
def
Matrix.Computable.diagonal
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
fromBlocks {l : Type} {m : Type} {n : Type} {o : Type} {α : Type} : Matrix n l α → Matrix n m α → Matrix o l α → Matrix o m α → Matrix (n ⊕ o) (l ⊕ m) α
fun A B C D i j => match i with | Sum.inl i => match j with | Sum.inl j => A i j | Sum.inr j => B i j | Sum.inr i => match j with | Sum.inl j => C i j | Sum.inr j => D i j
def
Matrix.Computable.fromBlocks
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
toUpperTri (A : Matrix (Fin n) (Fin n) Float) : Matrix (Fin n) (Fin n) Float
fun i j => if i ≤ j then A i j else 0
def
Matrix.Computable.toUpperTri
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
minorAux (A : Matrix (Fin n.succ) (Fin n.succ) Float) (a b : Fin n.succ) : Matrix (Fin n) (Fin n) Float
fun i j => let i' : Fin n.succ := if i.val < a.val then i else i.succ; let j' : Fin n.succ := if j.val < b.val then j else j.succ; A i' j'
def
Matrix.Computable.minorAux
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
minor (A : Matrix (Fin n) (Fin n) Float) (a b : Fin n) : Matrix (Fin n.pred) (Fin n.pred) Float
match n with | 0 => fun _ => Fin.elim0 | _ + 1 => minorAux A a b
def
Matrix.Computable.minor
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
det {n : ℕ} (A : Matrix (Fin n) (Fin n) Float) : Float
if h : 0 < n then if n == 1 then A ⟨0, h⟩ ⟨0, h⟩ else (List.finRange n).foldl (fun s i => s + (-1) ^ (Float.ofNat i.val) * A i ⟨0, h⟩ * det (minor A i ⟨0, h⟩)) 0 else 0
def
Matrix.Computable.det
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
cofactor (A : Matrix (Fin n) (Fin n) Float) : Matrix (Fin n) (Fin n) Float
fun i j => (-1) ^ (Float.ofNat (i.val + j.val)) * (A i j)
def
Matrix.Computable.cofactor
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
adjugate (A : Matrix (Fin n) (Fin n) Float) : Matrix (Fin n) (Fin n) Float
transpose (cofactor A)
def
Matrix.Computable.adjugate
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
inv (A : Matrix (Fin n) (Fin n) Float) : Matrix (Fin n) (Fin n) Float
(1 / det A) • adjugate A
def
Matrix.Computable.inv
Lib.Math.Data
CvxLean/Lib/Math/Data/Matrix.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Matrix.Basic", "Mathlib.LinearAlgebra.Matrix.Trace", "Mathlib.LinearAlgebra.Matrix.Block", "Mathlib.Data.Array.Defs", "CvxLean.Lib.Math.Data.List", "CvxLean.Lib.Math.Data.Vec" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
entr (x : Real)
-(x * log x)
def
Real.entr
Lib.Math.Data
CvxLean/Lib/Math/Data/Real.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Complex.Exponential", "Mathlib.Analysis.SpecialFunctions.Pow.Real" ]
[]
See `CvxLean.Tactic.DCP.AtomLibrary.Fns.Entr`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
huber (x : Real)
if abs x ≤ 1 then x ^ 2 else 2 * abs x - 1
def
Real.huber
Lib.Math.Data
CvxLean/Lib/Math/Data/Real.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Complex.Exponential", "Mathlib.Analysis.SpecialFunctions.Pow.Real" ]
[]
See `CvxLean.Tactic.DCP.AtomLibrary.Fns.Huber`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
klDiv (x y : Real)
x * log (x / y) - x + y
def
Real.klDiv
Lib.Math.Data
CvxLean/Lib/Math/Data/Real.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Complex.Exponential", "Mathlib.Analysis.SpecialFunctions.Pow.Real" ]
[]
See `CvxLean.Tactic.DCP.AtomLibrary.Fns.KLDiv`.
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840
instDivReal : Div ℝ
by infer_instance
instance
Real.instDivReal
Lib.Math.Data
CvxLean/Lib/Math/Data/Real.lean
[ "Mathlib.Data.Real.Basic", "Mathlib.Data.Complex.Exponential", "Mathlib.Analysis.SpecialFunctions.Pow.Real" ]
[]
https://github.com/verified-optimization/CvxLean
c62c2f292c6420f31a12e738ebebdfed50f6f840