Chapter 01 — Vector Spaces

Proofs omitted. Hover over highlighted terms to see their Lean types.

Definition 1.1

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

The additive data of a real vector space is the canonical typeclass AddCommGroup E.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] #check AddCommGroup E

Lemma 1.1

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Lemma 1.1 [generalized Cauchy--Schwarz inequality]: on a real normed space, the canonical pairing between y : E* = Module.Dual ℝ E and x : E satisfies |y x| ≤ ‖y‖ * ‖x‖.

universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] theorem abs_apply_le_dual_norm_mul_norm (y : Module.Dual ℝ E) (x : E) :

Proposition 1.1

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.1 (source-facing; core/canonical owner: ContinuousLinearMap.le_opNorm; bridge/view: Matrix.toLpLin): for every real vector x, the induced (a,b)-norm of a real matrix A bounds the b-norm of A x by ‖A x‖_b ≤ ‖A‖_{a,b} ‖x‖_a. In the project notation from Definition 1.34, this is the source-facing WithLp coordinate form of the canonical operator-norm estimate defining ‖A‖[a,b].

open Matrix WithLp open scoped Matrix variable {m n : ℕ} theorem norm_mulVec_le_opNorm_toLpLin_mul_norm (a b : ENNReal) [Fact (1 ≤ a)] [Fact (1 ≤ b)] (A : Matrix (Fin m) (Fin n) ℝ) (x : Fin n → ℝ) : ‖toLp b (A *ᵥ x)‖ ≤ ‖A‖[a,b] * ‖toLp a x‖

Definition 1.2

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.2: a finite family of vectors in a real vector space is linearly independent exactly when it is the canonical mathlib predicate LinearIndependent ℝ v.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] variable {n : ℕ} (v : Fin n → E) #check (LinearIndependent ℝ v)

Proposition 1.2

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.2 (source-facing; core/canonical owner: LinearMap.singularValues; bridge/view: Matrix.Norms.L2Operator): for a real matrix equipped with the Euclidean induced operator norm, the norm equals its largest singular value.

open scoped Matrix.Norms.L2Operator variable {m n : ℕ} theorem l2_induced_matrix_norm_eq_max_singular_value (A : Matrix (Fin m) (Fin n) ℝ) : ‖A‖ = A.toEuclideanLin.singularValues 0

Definition 1.3

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.3: a finite family of vectors spans E when the submodule generated by that family is the whole space.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] variable {n : ℕ} (v : Fin n → E) #check (Submodule.span ℝ (Set.range v) = ⊤)

Proposition 1.3

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.3 (source-facing; core/canonical owner: Matrix.toLpLin; bridge/view: induced_l1_opNNNorm_eq_max_column_sum): the induced ℓ¹ matrix norm ‖A‖[1,1] of a real matrix is the maximum absolute column sum.

namespace Matrix open scoped Matrix variable {m n : ℕ} theorem induced_l1_norm_eq_max_column_sum (A : Matrix (Fin m) (Fin n) ℝ) : ‖A‖[1,1] = maxAbsColumnSum A

Definition 1.4

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.4 is recall-only: a basis of a real vector space E is the canonical mathlib owner object Module.Basis ι ℝ E.

universe u v variable (ι : Type v) (E : Type u) [AddCommGroup E] [Module ℝ E] #check Module.Basis ι ℝ E

Proposition 1.4

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.4 is recall-only: the owner theorem Matrix.linfty_opNorm_def already states that the ℓ∞ operator norm of a matrix is the maximum absolute row sum.

recall Matrix.linfty_opNorm_def

Definition 1.5

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.5 (dimension): the owner notion is the cardinal-valued dimension Module.rank ℝ E. For any basis of E, the canonical theorem Module.Basis.mk_eq_rank identifies the cardinality of its index type with this rank.

universe u v variable (ι : Type v) (E : Type u) [AddCommGroup E] [Module ℝ E] #check Module.rank ℝ E

Proposition 1.5

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.5 is recall-only. For the coordinate spaces used in this chapter, (Fin n → ℝ) →ₗ[ℝ] (Fin m → ℝ), the owner abstraction for matrix representation of linear maps is the canonical equivalence LinearMap.toMatrix'.

recall LinearMap.toMatrix'

Definition 1.6

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.6 (source-facing): a real normed vector space on E is formalized by the owner pair [NormedAddCommGroup E] [NormedSpace ℝ E]. The first class carries the additive, metric, and norm structure, while the second is the canonical scalar-compatibility typeclass.

universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] #check NormedAddCommGroup E

Proposition 1.6

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.6: every linear map from ℝ^{m × n} to ℝ^k is given coordinatewise by Frobenius pairings with a family of matrices.

open scoped Matrix variable {m n k : ℕ} -- Proof sketch: use the canonical owner abstraction `LinearMap.toMatrix` with respect to the -- standard bases `Matrix.stdBasis` on the domain and `Pi.basisFun` on the codomain. The `r`th row -- of that matrix gives the coefficients of the representing matrix `A r`; expanding `X` in the -- standard matrix basis yields the entrywise sum, which is then identified with the trace formula. theorem exists_matrix_trace_representation (𝒜 : Matrix (Fin m) (Fin n) ℝ →ₗ[ℝ] (Fin k → ℝ)) : ∃ A : Fin k → Matrix (Fin m) (Fin n) ℝ, ∀ X, 𝒜 X = fun r ↦ Matrix.trace ((A r)ᵀ * X)

Definition 1.7

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.7 (1) (core/canonical): the textbook open ball B(c, r) is the owner declaration Metric.ball c r. Mathlib defines it in any pseudometric space for all real radii, while the textbook uses the normed additive commutative group special case and states the definition for r > 0.

recall Metric.ball

Proposition 1.7

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.7: the dual norm of y ∈ E* can be computed by maximizing the canonical pairing over the unit sphere, not just over the closed unit ball. Equivalently, ‖y‖_* is the greatest value of y x for x on Metric.sphere (0 : E) 1.

universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] variable [FiniteDimensional ℝ E] [Nontrivial E] -- Proof sketch: use the chapter owner declaration `dualNorm` and the earlier attainment theorem on -- the closed unit ball. If `dualNorm y = 0`, every value on the unit sphere is `0`. Otherwise, a -- maximizer on the closed unit ball must already lie on the unit sphere, since the dual-pairing -- inequality would force strict inequality whenever `‖x‖ < 1`. theorem dualNorm_isGreatest_on_unit_sphere (y : Module.Dual ℝ E) : IsGreatest (y '' Metric.sphere (0 : E) 1) (dualNorm y)

Definition 1.8

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.8: an inner product on a real vector space is the canonical source-facing mathlib data InnerProductSpace.Core; specialized to ℝ, this encodes the textbook symmetry, linearity, and positive-definiteness axioms for the pairing.

recall InnerProductSpace.Core

Proposition 1.8

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.8 is recall-only: the textbook statement that the Euclidean norm is self-dual is exactly the specialization of the owner theorem LinearIsometryEquiv.norm_map to the canonical Fréchet-Riesz equivalence InnerProductSpace.toDual ℝ E : E ≃ₗᵢ⋆[ℝ] StrongDual ℝ E, whose canonical hypothesis is completeness of the inner-product space.

universe u variable {E : Type u} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] #check (InnerProductSpace.toDual ℝ E).norm_map

Definition 1.9

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.9 (1): an affine subset of a real vector space is represented in mathlib by an AffineSubspace ℝ E.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] variable (s : Set E) (Q : AffineSubspace ℝ E) #check AffineSubspace ℝ E

Proposition 1.9

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Source-facing bridge for Proposition 1.9: the dual norm of the coordinate-pairing functional on WithLp p (ι → ℝ) is the l_q norm of the coefficient vector whenever p and q are Hölder-conjugate.

open Matrix open WithLp (linearEquiv ofLp toLp) variable {ι : Type*} [Fintype ι] {p q : ENNReal} abbrev dualNorm_lpPairingDual_eq_conjugate_lp_norm (hpq : ENNReal.HolderConjugate p q) (y : ι → ℝ)

Definition 1.10

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.10: for a nonzero normal vector a, the hyperplane with normal vector a and offset b is the affine subspace of points whose inner product with a is b. The defining formula is canonical and extends to arbitrary a.

universe u open WithLp open scoped RealInnerProductSpace variable {E : Type u} [NormedAddCommGroup E] [InnerProductSpace ℝ E] noncomputable def hyperplane (a : E) (b : ℝ) : AffineSubspace ℝ E := (affineSpan ℝ ({b} : Set ℝ)).comap (((innerSL ℝ a).toLinearMap).toAffineMap) -- Proof sketch: unfold `hyperplane`; membership in the defining set is exactly the displayed -- inner-product equation.

Proposition 1.10

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.10: if ℝ^n is endowed with the Q-norm associated to a positive definite matrix Q, then the dual norm of the Euclidean pairing functional y ↦ xᵀ y is √(xᵀ Q⁻¹ x) = ‖x‖_{Q⁻¹}.

open Matrix open scoped BigOperators variable {n : ℕ} theorem dual_qNorm_eq_sqrt_dotProduct_inv_mulVec (Q : Matrix (Fin n) (Fin n) ℝ) (hQ : Q.PosDef) (x : Fin n → ℝ) : Q.qDualNorm hQ x = Real.sqrt (dotProduct x (Q⁻¹.mulVec x))

Definition 1.11

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.11: a subset of a real vector space is convex in the textbook sense precisely when it satisfies the canonical mathlib predicate Convex ℝ C.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] variable (C : Set E) #check Convex ℝ C -- Proof sketch: rewrite the claim using `convex_iff_add_mem`; specialize the two coefficients to -- `t` and `1 - t`, and use the interval hypothesis `t ∈ [0,1]` to obtain the required -- nonnegativity assumptions.

Proposition 1.11

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.11: the supremum of the coordinatewise pairing over the weighted l_2 unit ball is the square root of the inverse-weighted sum of the squared factor dual norms.

open scoped BigOperators universe u variable {ι : Type u} [Fintype ι] variable {E : ι → Type u} variable [∀ i, NormedAddCommGroup (E i)] variable [∀ i, NormedSpace ℝ (E i)] theorem unit_piDualPairing_sSup_eq_sqrt_sum_invWeight_mul_sq [∀ i, FiniteDimensional ℝ (E i)] (ω : ι → Set.Ioi (0 : ℝ)) (v : ∀ i, Module.Dual ℝ (E i)) : sSup ((fun u : ∀ i, E i ↦ |piDualPairing v u|) '' {u | compositeWeightedL2Norm ω u ≤ 1}) = √(∑ i, (positiveWeight ω i)⁻¹ * dualNorm (v i) ^ (2 : ℕ))

Definition 1.12

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.12: the closed line segment between two points in a real vector space is the canonical mathlib set segment ℝ x y; the companion declarations below record the textbook one-parameter formulas for the closed and open line segments.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] #check (segment ℝ) -- Proof sketch: use `segment_eq_image`; then unpack membership in the image of `Icc (0 : ℝ) 1` -- and rewrite the affine combination to match the textbook coefficient convention.

Proposition 1.12

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.12 is recall-only at the chapter's source-facing bidual layer. By Definition 1.43, the bidual is E** = Module.Dual ℝ (Module.Dual ℝ E), and in finite dimension the owner equivalence identifying E with that bidual is Module.evalEquiv ℝ E.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] [FiniteDimensional ℝ E] #check (Module.evalEquiv ℝ E)

Definition 1.13

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.13: the half-space with normal vector a and offset b.

universe u open WithLp open scoped RealInnerProductSpace variable {E : Type u} [NormedAddCommGroup E] [InnerProductSpace ℝ E] variable (a : E) (b : ℝ) noncomputable def halfSpace : Set E := (innerSL ℝ a) ⁻¹' Set.Iic b

Proposition 1.13

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.13: if a linear map from ℝ^{m × n} to ℝ^k is given coordinatewise by the trace pairings X ↦ Tr(A_iᵀ X), then the matrix ∑ i, y_i • A_i satisfies the defining adjoint identity against the canonical Euclidean inner product on ℝ^k and the Frobenius pairing on ℝ^{m × n}.

open scoped BigOperators Matrix Matrix.Norms.Frobenius RealInnerProductSpace variable {m n k : ℕ} theorem matrix_trace_representation_adjoint {𝒜 : Matrix (Fin m) (Fin n) ℝ →ₗ[ℝ] EuclideanSpace ℝ (Fin k)} {A : Fin k → Matrix (Fin m) (Fin n) ℝ} (h𝒜 : ∀ X i, 𝒜 X i = Matrix.trace ((A i)ᵀ * X)) (X : Matrix (Fin m) (Fin n) ℝ) (y : EuclideanSpace ℝ (Fin k)) : ⟪𝒜 X, y⟫ = Matrix.trace (((∑ i, y i • A i)ᵀ) * X)

Definition 1.14

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.14 (1): a Euclidean space carries the canonical real inner product structure InnerProductSpace ℝ E.

universe u open scoped RealInnerProductSpace variable {E : Type u} [NormedAddCommGroup E] [InnerProductSpace ℝ E] #check InnerProductSpace ℝ E

Proposition 1.14

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.14: the transpose operation on matrices is involutive, so transposing twice returns the original matrix.

recall Matrix.transpose_transpose

Definition 1.15

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.15 is source-facing: the textbook coordinate space ℝ^n is represented by the coordinate model Fin n → ℝ, while the canonical mathlib owner for this Euclidean coordinate space is EuclideanSpace ℝ (Fin n), identified with the coordinate model by EuclideanSpace.equiv.

variable (n : ℕ) #check (Fin n → ℝ)

Proposition 1.15

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.15: whenever a square matrix A is invertible, the transpose of ⅟A is the inverse of Aᵀ, which is the canonical mathlib formulation of (A^T)^{-1} = (A^{-1})^T.

recall Matrix.transpose_invOf

Definition 1.16

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.16: EuclideanSpace ℝ (Fin n) is the canonical Lean model of ℝ^n, and its inner product is the canonical Euclidean-space dot product from EuclideanSpace.inner_eq_star_dotProduct. Over ℝ, conjugation is trivial, so this is exactly the textbook formula ∑ i, x_i y_i.

open Matrix open scoped BigOperators RealInnerProductSpace variable {n : ℕ} #check (EuclideanSpace.inner_eq_star_dotProduct : ∀ x y : EuclideanSpace ℝ (Fin n), ⟪x, y⟫ = dotProduct y x) -- Proof sketch: rewrite the canonical Euclidean-space inner product as a dot product and unfold -- `dotProduct` over `ℝ`.

Proposition 1.16

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Proposition 1.16 is recall-only: in the chapter owner setup from Definition 1.34, the induced (a,b)-norm of a real matrix is exactly the canonical operator norm ‖A‖[a,b].

open scoped Matrix variable {m n : ℕ} variable (a b : ENNReal) [Fact (1 ≤ a)] [Fact (1 ≤ b)] variable (A : Matrix (Fin m) (Fin n) ℝ) #check (‖A‖[a,b] : ℝ)

Definition 1.17

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.17: for a positive definite matrix Q, the Q-inner product on ℝ^n is canonically given by the inner-product-space structure induced by Matrix.toInnerProductSpace; its value on x and y is the matrix expression xᵀ Q y.

open Matrix #check Matrix.toInnerProductSpace

Definition 1.18

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.18: when ℝ^n is endowed with the dot product, the associated Euclidean norm is the canonical l_2-norm on EuclideanSpace ℝ (Fin n), provided by EuclideanSpace.norm_eq.

open Matrix open scoped BigOperators variable {n : ℕ} #check (EuclideanSpace.norm_eq : ∀ x : EuclideanSpace ℝ (Fin n), ‖x‖ = Real.sqrt (∑ i, ‖x i‖ ^ (2 : ℕ))) -- Proof sketch: start from `EuclideanSpace.norm_eq` and simplify the real coordinate terms using -- `Real.norm_eq_abs`, so that `|x i|^2 = x i^2`.

Definition 1.19

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.19 is organized around the canonical owner PiLp: for p ≥ 1, the textbook l_p norm on ℝ^n is the PiLp norm on the WithLp copy of Fin n → ℝ, and the source-facing coordinate formula below is the real-valued specialization of PiLp.norm_eq_sum.

open scoped BigOperators variable {n : ℕ} {p : ℝ} recall PiLp.norm_eq_sum -- Proof sketch: apply `PiLp.norm_eq_sum` to `WithLp.toLp (ENNReal.ofReal p) x`, then simplify the -- coordinates using `PiLp.toLp_apply`, `Real.norm_eq_abs`, and `ENNReal.toReal_ofReal` under the -- hypothesis `1 ≤ p`.

Definition 1.20

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

variable {n : ℕ} #check (Pi.norm_def : ∀ x : Fin n → ℝ, ‖x‖ = ↑(Finset.univ.sup fun i ↦ ‖x i‖₊))

Definition 1.21

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.21 (core/canonical): the nonnegative orthant ℝ^n_+ is the principal upper set Set.Ici 0 in the pointwise order on Fin n → ℝ.

variable (n : ℕ) #check (Set.Ici (0 : Fin n → ℝ))

Definition 1.22

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.22: The positive orthant ℝ^n_{++} is the subset of ℝ^n consisting of the vectors whose coordinates are all strictly positive.

variable (n : ℕ) def positiveOrthant : Set (Fin n → ℝ) := Set.pi Set.univ (fun _ : Fin n ↦ Set.Ioi (0 : ℝ)) -- Proof sketch: unfold `positiveOrthant` and simplify membership in the product set.

Definition 1.23

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.23: The unit simplex Δ_n in ℝ^n, modeled as Fin n → ℝ, is the standard simplex stdSimplex ℝ (Fin n) consisting of the nonnegative vectors whose coordinates sum to 1.

open scoped BigOperators variable (n : ℕ) #check (stdSimplex ℝ (Fin n) : Set (Fin n → ℝ)) -- Proof sketch: unfold `stdSimplex`; its defining predicate is exactly the conjunction of -- coordinatewise nonnegativity and the condition that the finite sum of the coordinates is `1`.

Definition 1.24

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

The coordinate box in ι → ℝ with extended-real lower and upper bounds.

variable {ι : Type*} def box (ℓ u : ι → EReal) : Set (ι → ℝ) := {x | ∀ i, ℓ i ≤ (x i : EReal) ∧ (x i : EReal) ≤ u i}

Definition 1.25

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.25: for a vector x in ℝ^n, modeled as Fin n → ℝ, the nonnegative part [x]_+ is the canonical positive-part operation x⁺.

variable (n : ℕ) #check ((·⁺) : (Fin n → ℝ) → Fin n → ℝ)

Definition 1.26

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.26: for a vector x in ℝ^n, modeled as Fin n → ℝ, the vector |x| is the coordinatewise absolute-value vector, given canonically by Pi.abs_def.

variable {n : ℕ} #check (Pi.abs_def : ∀ x : Fin n → ℝ, |x| = fun i ↦ |x i|)

Definition 1.27

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.27: For a vector x in ℝ^n, modeled as Fin n → ℝ, sgn x is the coordinatewise sign vector whose i-th entry is 1 when x i ≥ 0 and -1 when x i < 0.

variable {n : ℕ} noncomputable def sgn (x : Fin n → ℝ) : Fin n → ℝ := fun i ↦ if 0 ≤ x i then 1 else -1

Definition 1.28

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.28: for vectors in ℝ^n, modeled as Fin n → ℝ, the Hadamard product is the canonical pointwise multiplication on the function space Fin n → ℝ.

variable {n : ℕ} #check ((· * ·) : (Fin n → ℝ) → (Fin n → ℝ) → Fin n → ℝ)

Definition 1.29

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.29: the space ℝ^{m × n} is formalized as Matrix (Fin m) (Fin n) ℝ. The textbook Frobenius pairing on this matrix space is canonically expressed by Matrix.trace (Aᵀ * B), and the bridge theorem below identifies that trace with the usual entrywise double sum.

open scoped BigOperators Matrix Matrix.Norms.Frobenius variable (m n : ℕ) #check (Matrix (Fin m) (Fin n) ℝ)

Definition 1.30

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.30: the textbook notation 𝕊^n is the canonical self-adjoint submodule of real n × n matrices. This abbreviation is the stable owner vocabulary reused throughout the chapter for the symmetric-matrix space.

open scoped BigOperators Matrix open Matrix variable {n : ℕ} abbrev symmetricMatrices (n : ℕ) : Submodule ℝ (Matrix (Fin n) (Fin n) ℝ) := selfAdjoint.submodule ℝ (Matrix (Fin n) (Fin n) ℝ)

Definition 1.31

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.31 (1): positiveSemidefiniteMatrices n is the set 𝕊_+^n of real n × n positive semidefinite matrices.

def positiveSemidefiniteMatrices (n : ℕ) : Set (Matrix (Fin n) (Fin n) ℝ) := Matrix.PosSemidef

Definition 1.32

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.32: The set of all n × n orthogonal real matrices is represented in mathlib by Matrix.orthogonalGroup; for matrices indexed by Fin n, this is Matrix.orthogonalGroup (Fin n) ℝ.

universe u v recall Matrix.orthogonalGroup

Definition 1.33

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.33: the Frobenius norm of a real matrix is √(Matrix.trace (Aᵀ * A)).

open Matrix open scoped BigOperators Matrix Matrix.Norms.Frobenius variable {m n : ℕ} theorem frobenius_norm_eq_sqrt_trace_transpose_mul (A : Matrix (Fin m) (Fin n) ℝ) : ‖A‖ = √(Matrix.trace (Aᵀ * A))

Definition 1.34

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.34 is recall-only: the induced (a,b)-norm of a real matrix is the canonical operator norm ‖A‖[a,b] of the continuous linear map associated to the owner object Matrix.toLpLin a b.

open WithLp namespace Matrix open scoped Matrix variable {m n : ℕ} variable (a b : ENNReal) [Fact (1 ≤ a)] [Fact (1 ≤ b)] variable (A : Matrix (Fin m) (Fin n) ℝ) #check (‖A‖[a,b] : ℝ) -- Proof sketch: apply `ContinuousLinearMap.unit_le_opNorm` to the continuous linear map induced by -- `A`, then rewrite its value on a coordinate vector using `Matrix.toLpLin_toLp`.

Definition 1.35

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.35 is recall-only: the Cartesian product of finitely many real inner product spaces is canonically modeled in Lean by the L² product PiLp (2 : ENNReal) E. The ambient vector-space structure is pointwise, and the inner product is the sum of the component inner products.

open scoped BigOperators universe u variable {m : ℕ} (E : Fin m → Type u) [∀ i, NormedAddCommGroup (E i)] [∀ i, InnerProductSpace ℝ (E i)] #check (PiLp (2 : ENNReal) E)

Definition 1.36

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.36: the composite l_p norm on a finite Cartesian product of normed vector spaces is the canonical PiLp construction, i.e. the L^p norm on the WithLp copy of the finite product.

universe u open scoped BigOperators variable {m : ℕ} {p : ℝ} variable {E : Fin m → Type u} variable [∀ i, NormedAddCommGroup (E i)] recall PiLp.norm_eq_sum -- Proof sketch: apply `PiLp.norm_eq_sum` to the element `WithLp.toLp (ENNReal.ofReal p) u`, then -- simplify the exponent `((ENNReal.ofReal p).toReal)` to `p` using `ENNReal.toReal_ofReal` under -- the hypothesis `1 ≤ p`.

Definition 1.37

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.37: the composite weighted l_2 formula on the finite product ∏ i, E i, modeling a finite block product, is the canonical PiLp L² norm of the componentwise rescaled family. Written out in coordinates, this is the textbook weighted l_2 norm with strictly positive weights.

open scoped BigOperators open WithLp (toLp) universe u v variable {ι : Type u} [Fintype ι] {E : ι → Type v} variable [∀ i, NormedAddCommGroup (E i)] variable [∀ i, NormedSpace ℝ (E i)] def compositeWeightedL2Norm (ω : ι → Set.Ioi (0 : ℝ)) (u : ∀ i, E i) : ℝ := ‖WithLp.toLp (2 : ENNReal) (fun i ↦ Real.sqrt (ω i : ℝ) • u i)‖

Definition 1.38

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.38 is recall-only: once Definition 1.35 identifies the Cartesian product of the Euclidean spaces E i with PiLp (2 : ENNReal) E, the remaining Euclidean-space structure is owned by mathlib through the canonical finite-dimensionality instance below and the canonical L² norm formula PiLp.norm_eq_of_L2.

universe u variable {m : ℕ} (E : Fin m → Type u) [∀ i, NormedAddCommGroup (E i)] [∀ i, InnerProductSpace ℝ (E i)] [∀ i, FiniteDimensional ℝ (E i)] #check (inferInstance : FiniteDimensional ℝ (PiLp (2 : ENNReal) E))

Definition 1.39

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.39: a linear transformation between real vector spaces is represented in mathlib by the canonical type of real linear maps E →ₗ[ℝ] V.

universe u v variable {E : Type u} {V : Type v} variable [AddCommGroup E] [Module ℝ E] [AddCommGroup V] [Module ℝ V] variable (f : E → V) #check (E →ₗ[ℝ] V)

Definition 1.40

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.40: the identity transformation on a real vector space E is the canonical real linear endomorphism LinearMap.id : E →ₗ[ℝ] E.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] recall LinearMap.id

Definition 1.41

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.41 is recall-only: the primitive notion is the canonical type of real linear maps E →ₗ[ℝ] ℝ, and the dual space is organized by the owner abstraction Module.Dual.

universe u variable {E : Type u} [AddCommGroup E] [Module ℝ E] #check (E →ₗ[ℝ] ℝ)

Definition 1.42

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.42: the dual norm on E* is the canonical chapter owner declaration dualNorm, defined as the operator norm of the associated continuous linear functional.

universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] recall dualNorm

Definition 1.43

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.43 is recall-only: the bidual space E** is not a new owner abstraction. It is the iterated canonical dual type Module.Dual ℝ (Module.Dual ℝ E).

universe u variable {E : Type u} [AddCommMonoid E] [Module ℝ E] #check (Module.Dual ℝ (Module.Dual ℝ E))

Definition 1.44

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.44: the textbook adjoint transformation of a linear map between finite-dimensional real inner product spaces is the canonical mathlib construction LinearMap.adjoint.

universe u v recall LinearMap.adjoint

Definition 1.45

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source

Definition 1.45 is recall-only: for a linear transformation on a finite-dimensional real normed space, the textbook norm ‖A‖ is the canonical operator norm of the associated continuous linear map A.toContinuousLinearMap.

universe u v namespace LinearMap variable {E : Type u} {V : Type v} variable [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] variable [NormedAddCommGroup V] [NormedSpace ℝ V] variable (A : E →ₗ[ℝ] V) #check (‖A‖ : ℝ) -- Proof sketch: apply `ContinuousLinearMap.unit_le_opNorm` to the continuous linear map -- `A.toContinuousLinearMap`; this canonical operator norm is exactly the textbook norm of `A`.

Supporting modules

These source modules support the indexed items and are listed separately so the chapter inventory remains complete.

Lean contributors (project-level attribution): Shu Miao, Zhiyan Wang, Suwan Wu, Changyu Zou, Xinyi Guo, Yunxi Duan, Wanli Ma, Zichen Wang.

Source header · Attribution source