Solution (source code)

= Solution

Replace coordinate inequalities by the <Loewner order> and coordinate sums by <matrix trace>. The maximizing <semidefinite program> is
$$
\boxed{F_k(X)=\max_{Y\in\mathbb S^n}\{\operatorname{tr}(XY):Y\succeq0,\ I-Y\succeq0,\ \operatorname{tr}Y=k\}.}
$$
Its feasible set is the <fantope>. In an <orthonormal eigenbasis> of $X$, its objective is $\sum_i\lambda_i(X)Y_{ii}$, and the diagonal entries of $Y$ belong to the <capped simplex>. Choosing $Y$ as the <orthogonal projection matrix> onto the largest $k$ <eigenvectors> attains the <sum of the largest eigenvalues>, as in the <Ky Fan maximum principle>.

The minimizing <semidefinite program> is
$$
\boxed{F_k(X)=\min_{t\in\mathbb R,\ S\in\mathbb S^n}\{kt+\operatorname{tr}S:S\succeq0,\ S+tI-X\succeq0\}.}
$$
For example, its <Lagrangian> arises by assigning $S\succeq0$ to $I-Y\succeq0$, keeping $Y\succeq0$ in the domain, and using free $t$ for $\operatorname{tr}Y=k$. Finiteness of the supremum over $Y$ requires $S+tI-X\succeq0$.

Equality follows directly by choosing $S$ to have <eigenvalues> $(\lambda_i(X)-t)_+$ in the same <orthonormal eigenbasis>, with $t$ between the $k$th and $(k+1)$st <eigenvalues>, or below the smallest one for $k=n$. This is the <threshold semidefinite program for the largest eigenvalues>, and it also verifies the endpoint case $k=n$.