How statement and proof provenance work
The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.
- Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
- AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
- AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.
These labels describe origin, not correctness: citations and verification chips remain separate evidence.
Nearest neighbors and learned metrics
1 · Prerequisites
- Algebraic Closure, Embeddings, and Separability
- Algebraic Extensions, Extension Degree, and Finite Fields
- Binary Operations, Monoids, Groups and Subgroups
- Bounded Linear Operators and Quotient Spaces
- Compactness in Metric Spaces
- Completeness, Completion, and Uniform Continuity
- Complex Norms and Realification
- Complexification, Realification and Real Structures
- Composition Series, the Jordan–Hölder Theorem and Solvable Groups
- Congruences, the Integers Modulo n and the Chinese Remainder Theorem
- Construction of the Natural Numbers
- Construction of the Real Numbers via Cauchy Sequences
- Construction of the Real Numbers via Dedekind Cuts
- Continuity, IVT, EVT, and Uniform Continuity
- Convex and Semicontinuous Functions on Rⁿ
- Cosets, Index and Lagrange's Theorem
- Countability and Uncountability
- Cyclic Groups and Direct Products
- Determinants of Matrices over a Commutative Ring
- Diagonalisation and the Minimal Polynomial
- Divisibility, Euclidean Domains, Principal Ideal Domains and Unique Factorisation
- Divisibility, Greatest Common Divisors and Bézout's Identity
- Dual Spaces, Bilinear and Quadratic Forms, and Sylvester's Law of Inertia
- Eigenvalues, Eigenvectors and the Characteristic Polynomial
- Finite Counting, Factorials and Binomial Coefficients
- Foundations of the Real Numbers for Analysis
- Group Actions, Orbits, Stabilisers and Cayley's Theorem
- Group Homomorphisms and the Isomorphism Theorems
- Hilbert Space Geometry and Riesz Representation
- Ideals, Quotient Rings and the Isomorphism Theorems for Rings
- Inner Product Spaces, Gram-Schmidt, Projections and Adjoints
- Limits of Real Functions
- Linear Independence, Bases and Dimension
- Linear Transformations, Rank-Nullity and Quotient Spaces
- Matrices, the Matrix of a Linear Map, and Change of Basis
- Matrix Norms, Condition Numbers and Numerical Stability
- Metric Spaces
- Monotone Sequences, Bolzano-Weierstrass, and Cauchy Completeness
- Normal Subgroups and Quotient Groups
- Normed and Banach Spaces
- Norming and Separation under Hahn–Banach
- Order, Zorn's Lemma, and the Axiom of Choice
- Polynomial Rings, the Division Algorithm and Roots
- Primes, Euclid's Lemma and the Fundamental Theorem of Arithmetic
- Relations, Functions, and Quotients
- Rings, Subrings, Integral Domains and Fields
- Rⁿ as a Normed Space; Vector-Valued Functions
- Roots, Rational Powers, and Classical Inequalities
- Sequences and Limits
- Simple Field Extensions and the Construction of the Complex Numbers
- Splitting Fields
- Subgradient bundle and derivative free optimization
- Suprema and Infima
- Sylow's Theorems, p-Groups and Nilpotent Groups
- Symmetric Groups, Cycle Decomposition and the Sign Homomorphism
- The Analytic Hahn Banach Theorem
- The Determinant of a Linear Operator, Cofactors and Cramer's Rule
- The Fundamental Theorem of Algebra
- The Fundamental Theorem of Finite Abelian Groups
- The Galois Correspondence
- The Spectral Theorem, Positive Operators and Singular Value Decomposition
- The Total Derivative in ℝᵐ → ℝⁿ
- The ZFC Axioms and the Basic Set Constructions
- Topology of ℝ
- Triangularisation, Generalised Eigenspaces and Jordan Canonical Form
- Vector Spaces, Linear Subspaces, Span and Direct Sums
2 · Logical flowchart
3 · Definitions, theorems and proofs
Mahalanobis pseudometric induced by a positive-semidefinite matrix
Definition
Fix an integer . A real matrix is positive semidefinite, written , when it is symmetric and for every . For , define the squared Mahalanobis distance and its nonnegative square root by
The square root is defined because . A pseudometric is a nonnegative symmetric function that vanishes on the diagonal and satisfies the triangle inequality, but may assign distance zero to distinct points. The function is called the Mahalanobis pseudometric associated with ; is its squared-distance form. The theorem on this page proves the pseudometric properties and the equivalent linear-feature representation.
Symmetric matrices are Euclidean under the Frobenius norm
Statement
Let , let be the real vector space of symmetric matrices, and set . Use one-based entry labels for , and likewise for every matrix below. Equip with the Frobenius inner product and its induced norm. Define by listing first, followed by for in lexicographic order. Then is a linear bijection and preserves inner products and norms; in particular, for all .
Statement references
Facts & Assumptions
Given: An integer , symmetric real matrices , and .
For a real matrix, the squared Frobenius norm is the sum of the squares of all entries (The Frobenius norm on real or complex matrices). Under the stated entry labels, substituting , gives ; in particular, when , .
The Euclidean inner product on is the coordinate dot product, with norm the square root of the sum of coordinate squares (The Euclidean inner product on ).
Every nonnegative real number has a unique nonnegative square root, so and division by is defined (Square roots exist: a unique with ; the positives are ).
Proof
The coordinate list has entries. Its first entries recover each diagonal entry of , and each later entry recovers the corresponding symmetric pair by division by from [F3]. Thus it has a unique inverse on ; its coordinate formulas are linear, so is a linear bijection.
For , the Euclidean dot product of their coordinate lists is , because each off-diagonal coordinate contributes . Symmetry gives , which is the same expression. Hence .
Linearity gives . Applying step 1.2 to with itself and taking the unique nonnegative square roots from [F1]–[F3] yields . This proves norm preservation.
Frobenius projection onto the positive-semidefinite cone is spectral clipping
Statement
Let and let be symmetric. There exists an orthogonal eigendecomposition . For any such decomposition define and . Let be the set of real symmetric matrices with for every , and let . Then is the unique minimizer of over , so its value is independent of the chosen orthogonal eigendecomposition.
Statement references
Facts & Assumptions
Given: A real symmetric matrix , , and its orthogonal eigendecomposition from the Statement.
Every self-adjoint endomorphism of a finite-dimensional real inner-product space has an orthonormal eigenbasis (Real spectral theorem: a self-adjoint endomorphism of a finite-dimensional real inner product space has an orthonormal eigenbasis).
A self-adjoint operator is nonnegative exactly when its eigenvalues are nonnegative (A non-negative operator is equivalently self-adjoint with nonnegative eigenvalues, a positive semidefinite matrix in an orthonormal basis, or an operator of the form S^*S).
For a finite-dimensional real inner-product space, a self-adjoint operator is nonnegative exactly when its associated symmetric form is positive semidefinite (Over the reals, non-negative and positive operators correspond exactly to positive semidefinite and positive definite symmetric forms).
Orthogonal multiplication on either side preserves the Frobenius norm (Spectral and Frobenius norms are unitarily invariant, are given by singular values, and satisfy the sharp rank comparison).
The squared Frobenius norm is the sum of the squares of all matrix entries (The Frobenius norm on real or complex matrices).
Proof
By [F1], choose an orthogonal eigendecomposition of and define as in the Statement. It is symmetric and has eigenvalues . By [F2] its associated operator is nonnegative, and by [F3] its quadratic form is positive semidefinite; hence .
Let and set . For each coordinate vector , ; also is symmetric. Orthogonal invariance [F4] gives .
Expanding the entry sum [F5], the last square is . For every , : if the right side is zero and equality is attained only at , while if then and equality is attained only at . Thus every feasible has squared distance at least .
For the conjugated matrix is , so all off-diagonal terms vanish and every diagonal term attains its lower bound from step 2.1. Hence is a minimizer.
Equality in the lower bound requires every off-diagonal square in step 2.1 to vanish and every diagonal term to attain its unique scalar minimum. Therefore and . The minimizer is unique; since the argument applies to any orthogonal eigendecomposition, every allowed decomposition gives this same nearest matrix.
Remarks
The proof above is choice-free: it constructs the unique minimizer from a finite orthogonal eigendecomposition and checks the objective directly. The separate abstract Hilbert-projection route used in the LMNN procedure is recorded under its own Countable Choice assumption.
The real positive-semidefinite cone is closed in the Frobenius metric
Statement
For an integer , let be the real symmetric matrices and let . With the Frobenius norm , the set is closed in .
Statement references
Facts & Assumptions
Given: An integer and the real vector space with the Frobenius metric.
The Frobenius norm is the Euclidean norm of the matrix-entry list (The Frobenius norm on real or complex matrices).
The entry inner product is the Euclidean coordinate inner product, so it satisfies Cauchy–Schwarz; expanding entries gives (The Euclidean inner product on , Cauchy-Schwarz with its equality case, the triangle inequality for , the parallelogram law and polarisation).
A set is closed when its complement is open, and an open set contains a positive-radius ball around each of its points (The metric topology: a set is open when every one of its points has a ball around it inside the set; closed means open complement, Open ball, closed ball and sphere in a metric space).
The Frobenius norm is an inner-product norm, so its restriction to is a norm; the induced metric is (The Frobenius norm on real or complex matrices, The inner-product norm is definite, homogeneous, and satisfies the triangle inequality, A norm on a real vector space, the induced metric, and the dictionary with the metric axioms).
Proof
Let . By the definition of , there is with ; necessarily . Set .
For any with , the entry norm [F1], entry inner product, and Cauchy–Schwarz [F2] give . Hence , so .
Step 2.1 shows that the open ball in the metric is contained in the complement of . Since was arbitrary in that complement, every point of it has an open ball contained in it; the complement is open by [F3], and therefore is closed.
Finite-sample k-nearest-neighbor classifier with fixed tie-breaking
Definition
Let be positive integers, let be a finite labeled sample with and , let be symmetric with for every , let , and let be a query. For each sample index set . Order indices by increasing pairs in lexicographic order, and let be the first indices in this order. For each class compute and return the smallest class label attaining . Thus equal distances are resolved by the fixed sample-index order, and equal class votes by the smallest class label.
Fixed-target large-margin nearest-neighbor objective
Definition
Fix positive integers , a finite labeled sample with and , and a weight . For each , fix in advance an integer with and a fixed target-neighbor set with . These target sets do not change with the matrix being optimized. Let denote the real symmetric matrices satisfying for all , and put . For a real number , let . For , define
and . This is the fixed-target LMNN training surrogate; it is not a test-error or calibrated/generalization-risk quantity. The quantity is a squared distance, while its square root is the Mahalanobis pseudometric.
The Mahalanobis distance is a pseudometric and comes from a linear feature map
Statement
Let and let be real symmetric and positive semidefinite, meaning for every . Define and . Then there is a real matrix with and, for all , . Consequently is nonnegative, symmetric, zero on the diagonal, and satisfies the triangle inequality, without asserting separation of distinct points.
Statement references
Positive semidefinite forms and nonnegative operators over the reals
Factorization of nonnegative operators
Euclidean inner product and norm
Triangle inequality for the Euclidean norm
Nonnegative square-root uniqueness
Weinberger and Saul, §2.1, printed pp. 209–210
Bellet, Habrard, and Sebban, Mahalanobis distance and interpretation, printed pp. 9–10
Facts & Assumptions
Given: An integer , a real symmetric positive-semidefinite matrix , and .
For a finite-dimensional real inner-product space, a symmetric bilinear form is positive semidefinite exactly when its associated self-adjoint operator is nonnegative (Over the reals, non-negative and positive operators correspond exactly to positive semidefinite and positive definite symmetric forms).
Every nonnegative endomorphism of a finite-dimensional real inner-product space has the form for a linear endomorphism (A non-negative operator is equivalently self-adjoint with nonnegative eigenvalues, a positive semidefinite matrix in an orthonormal basis, or an operator of the form S^*S).
The Euclidean inner product is and its induced norm satisfies (The Euclidean inner product on ).
The Euclidean norm is nonnegative, symmetric under sign change, vanishes only at zero, and satisfies the triangle inequality (Cauchy-Schwarz with its equality case, the triangle inequality for , the parallelogram law and polarisation).
Every nonnegative real has a unique nonnegative square root (Square roots exist: a unique with ; the positives are ).
Proof
Regard as the matrix of an endomorphism , . The associated symmetric bilinear form is , so its positive-semidefinite hypothesis and [F1] imply that is nonnegative.
By [F2], there is an endomorphism with . Let be its real matrix in the standard basis; the Euclidean adjoint has matrix , hence .
For , steps 2.1 and [F3] give . Both and are nonnegative and their squares agree, so [F5] gives .
Nonnegativity, symmetry, and zero diagonal follow from the corresponding properties of the Euclidean norm in [F4]. For any , by the triangle inequality in [F4]. The pseudometric axioms follow.
Symmetric vectorization transports closed convex domains and subgradients
Statement
Let be a closed convex set of real symmetric matrices in the Frobenius metric, let be convex, let be the symmetric vectorization isometry, and define and by . Then is closed and convex and is convex. If is a Frobenius subgradient of at , meaning for every , then is a Euclidean subgradient of at .
Statement references
Facts & Assumptions
Given: A closed convex set , a convex function , a point , and a Frobenius subgradient at .
The map is a linear bijection and preserves inner products and distances (Symmetric matrices are Euclidean under the Frobenius norm).
A function is convex when it satisfies the convex-combination inequality, and a set is convex when it contains every convex combination of its points (Convex and strictly convex functions on Euclidean convex sets, A convex subset of contains every line segment between two of its points).
A set is closed when its complement is open, and an open set contains a positive-radius ball around each of its points (The metric topology: a set is open when every one of its points has a ball around it inside the set; closed means open complement, Open ball, closed ball and sphere in a metric space).
A subgradient supplies a global supporting affine lower bound on the convex function (Subgradients and the subdifferential of a convex function).
Proof
If , choose with . For , linearity gives , and the matrix on the right is in by [F2]. Thus is convex.
Let and set . Since is closed, [F3] gives such that , where . For any , isometry [F1] gives , hence . Therefore , so the complement of is open and is closed.
For with preimages , linearity yields . Applying convexity of from [given] proves , so is convex.
Let and take any , with preimage . The assumed subgradient inequality gives . By inner-product preservation [F1], this equals ; hence is a Euclidean subgradient by [F4].
The fixed-target LMNN objective is convex
Statement
Let be positive integers, let be a finite sample with and , let each fixed target set satisfy , and let . For symmetric write and define
where . Then is convex on the real vector space of symmetric matrices. The feasible set is convex, so minimizing over is a convex optimization problem.
Statement references
Facts & Assumptions
Given: The finite sample, fixed target sets, and parameter in the Statement.
For fixed , , so it is affine-linear in the entries of (Fixed-target large-margin nearest-neighbor objective, The trace as the sum of the diagonal entries).
A real-valued function on a convex set is convex when its value at every convex combination is at most the same convex combination of its values (Convex and strictly convex functions on Euclidean convex sets).
A subset of a real vector space is convex when it contains every convex combination of any two of its points (A convex subset of contains every line segment between two of its points).
Proof
For each fixed pair , let . By [F1], is linear in , so every pull term is affine-linear. Each margin expression is also affine-linear.
For any affine-linear and , . The number is at least and at least , hence it is at least their maximum . Thus each hinge term is convex by [F2].
Finite sums of affine-linear functions and convex hinge functions are convex, and the coefficients and are nonnegative because . Applying the convexity inequality term by term proves is convex on all symmetric matrices, including the endpoint cases and .
If and , then is symmetric and for every , . Hence is convex by [F3]. Restricting the already convex function to this convex feasible set yields a convex optimization problem.
LMNN hinge subgradient formula and a uniform data-dependent bound
Statement
Fix the finite labeled sample, fixed target sets, and of the LMNN objective. For each and each impostor index with , set , , and , where . Define if and if . Put
For the convex objective on , a Frobenius subgradient at means a symmetric matrix such that for every . Then is a subgradient at every . Moreover, uniformly in ,
At an exact hinge kink , the selected subgradient coefficient is .
Statement references
Facts & Assumptions
Given: The finite sample, fixed target sets and weight in the Statement, and .
The objective is the finite weighted sum of linear pull terms and positive-part hinge terms with affine arguments (Fixed-target large-margin nearest-neighbor objective).
The objective is convex on (The fixed-target LMNN objective is convex).
A subgradient is a vector whose inner product gives a global supporting affine lower bound on the convex function (Subgradients and the subdifferential of a convex function).
The Frobenius norm is the Euclidean entry norm and its triangle inequality follows from the inner-product norm theorem (The Frobenius norm on real or complex matrices, The inner-product norm is definite, homogeneous, and satisfies the triangle inequality).
The Euclidean norm on satisfies (The Euclidean inner product on ).
Proof
For , the entrywise inner product satisfies . Thus each hinge has the form , with affine argument .
For any , , so by [F5]. By [F4], .
If , then and for every . If , then and for every . Hence is a subgradient of this hinge, including the selected zero coefficient at equality.
Each and is symmetric, so their weighted sum is symmetric. Each pull term is linear with Frobenius subgradient . Adding its supporting equality to the hinge supporting inequalities in step 2.1, weighted by the nonnegative coefficients and , proves for every . Thus is a subgradient by [F3].
Since each , the triangle inequality and step 1.2 give . The bound is finite because the sample and all index sets are finite, and it is independent of .
Finite-budget projected-subgradient training for fixed-target LMNN
Definition
Use the finite sample, fixed target sets, weight , and objective defined by the LMNN objective item. The inputs are an integer budget , an initial matrix , and positive step sizes . Let and use , the linear isometry that lists the diagonal entries followed by the -scaled upper-triangle entries in lexicographic order. Set and ; this is a nonempty closed convex domain and is convex.
Initialize . At each , put and compute the Frobenius subgradient
where , , when , and when . Supply the successful oracle response to the finite-budget projected-subgradient method on with step size . It updates , where is the unique nearest point in the Euclidean norm. Equivalently, form , choose an orthogonal eigendecomposition , and set
All oracle calls succeed; the generic method reports budget-exhausted after updates. The requested final iterate is ; its status, completed update count, weighted average, and least-index best observed iterate are also defined by the generic method. The explicit spectral-clipping implementation is choice-free. The equivalent abstract Hilbert-projection interface assumes Countable Choice, as in the general closest-point theorem; that axiom branch is retained separately for the conditional analysis. This finite procedure makes no unconditional convergence, optimality, empirical-error, or generalization claim.
Definition references
Sample, fixed targets, and objective
Convexity of the objective and feasible cone
Explicit subgradient, kink convention, and uniform bound
Closedness of the feasible cone
Transport of domain properties and subgradients
Exact Frobenius projection formula
Published finite-budget projected-subgradient procedure
Abstract Hilbert projection interface
Countable Choice for that abstract interface
Weinberger and Saul, Appendix A.1–A.3, printed pp. 238–241
Conditional best-iterate and weighted-average bound for LMNN training
Statement
Assume Countable Choice . Let be positive integers, let be a finite sample with and , let fixed target sets satisfy , and let . For symmetric put and
where , and minimize over . Let be an integer, choose and step sizes , and suppose a global minimizer of exists. For each , put , , and if and if . Form
where is orthogonal, and define
Set
let be the least-index minimizer of over , and define
where and is the entry-sum Frobenius norm.
Then , , and
This conditional bound applies to the best observed iterate and weighted average; it does not assert the same bound for the final iterate or any test-error improvement.
Statement references
Finite projected-subgradient procedure and kink convention
Convexity of the fixed-target objective
Subgradient formula and uniform data bound
Euclidean coordinate reduction
Completeness of finite-dimensional Euclidean space
Abstract Hilbert projection theorem
Published projected-subgradient best/average bound
Choice-free spectral-clipping projection formula
Bubeck, §3.1, printed pp. 262–266
Bertsekas, MIT 6.253 Lecture 15, printed pp. 200–205
Weinberger and Saul, §3.4 and Appendix A, printed pp. 220–221 and 238–241
Facts & Assumptions
Given: The data and objective in the Statement, , an attained minimizer , the finite projected-subgradient procedure, and its positive step sizes.
Countable Choice selects one element from each member of a countable family of nonempty sets (The Axiom of Countable Choice ()).
The finite target objective is convex on , and this cone is convex (The fixed-target LMNN objective is convex).
The real positive-semidefinite cone is closed in the Frobenius metric (The real positive-semidefinite cone is closed in the Frobenius metric).
Symmetric vectorization is a linear inner-product isometry to and transports closed convex domains and subgradients (Symmetric matrices are Euclidean under the Frobenius norm, Symmetric vectorization transports closed convex domains and subgradients).
Euclidean space is complete and hence a real Hilbert space under its Euclidean inner product ( and for with the Euclidean metric are complete, componentwise from the Cauchy criterion in , Hilbert space, The Euclidean inner product on ).
Under Countable Choice, every point of a real Hilbert space has a unique nearest point in each nonempty closed convex set (Projection onto a nonempty closed convex set).
The local subgradient formula returns valid subgradients and satisfies for every iterate (LMNN hinge subgradient formula and a uniform data-dependent bound).
The finite-budget projected-subgradient method updates and records its finite status, final iterate, weighted average, and least-index best observed point (Projected subgradient method with finite budget).
For a convex objective on a nonempty closed convex Euclidean domain, a finite projected-subgradient run with valid bounded subgradients, an attained minimizer, and an initial-distance bound satisfies the stated best-observed and weighted-average gap estimate (Projected subgradient best-iterate and weighted-average bound).
The explicit eigenvalue-clipping update is the unique Frobenius projection onto (Frobenius projection onto the positive-semidefinite cone is spectral clipping).
Proof
Put and . The cone contains ; [F1] makes it convex, [F2] makes it closed in Frobenius distance, and [F3] transfers both properties to . By [F4], is a real Hilbert space; under [A1], [F5] gives a unique Euclidean projection onto , which is the projection used in [F7]. The explicit matrix update is that projection because [F9] identifies the unique Frobenius-nearest PSD matrix.
For every , the displayed data formula in [F6] computes and its bound. The coordinate transport [F3] makes a Euclidean subgradient of with norm . Thus all oracle calls in [F7] are valid.
The point maps to a global minimizer of on , the initial point satisfies , and the positive step sizes give . Apply [F8] to the generic run with , subgradient bound , and distance bound . It yields the asserted upper bound for the least-index best observed objective gap and the weighted-average objective gap in Euclidean coordinates.
By linearity of , the Euclidean weighted average maps to as defined in the Statement. Each iterate lies in , so convexity [F1] puts there; bijectivity also preserves the finite-list minimum, so the Euclidean bound from step 1.3 is exactly the displayed matrix bound.
Remarks
The explicit eigenvalue-clipping implementation and its finite local projection formula are choice-free. The proof above separately records the stronger abstract Hilbert-projection route required by the current interface; that branch uses only , not the full Axiom of Choice. The hypothesis that exists is essential to this stated application and is not derived from convexity alone.
4 · Examples, counterexamples and false statements
None yet.
Sources
- Kilian Q. Weinberger and Lawrence K. Saul, Distance Metric Learning for Large Margin Nearest Neighbor Classification, JMLR 10 (2009), 207–244
- Aurélien Bellet, Amaury Habrard, and Marc Sebban, A Survey on Metric Learning for Feature Vectors and Structured Data, arXiv:1306.6709v4 (2014)
- Nicholas J. Higham, Computing a Nearest Symmetric Positive Semidefinite Matrix, Linear Algebra and its Applications 103 (1988), 103–118
- David Bindel, Matrix Computations, CS 6210, Matrix Nearness Problems, Fall 2022
- Sébastien Bubeck, Convex Optimization: Algorithms and Complexity, Foundations and Trends in Machine Learning 8(3–4) (2015)
- Dimitri P. Bertsekas, Convex Analysis and Optimization, MIT 6.253 Complete Lecture Notes