Let $L$ be the set of all integrable real-valued functions defined over $[0,1)$. The set $L$ is a topological vector space (TVS) with addition of functions $f+g$ and multiplication of a function with a real number defined in the usual way.
Consider a nonnegative increasing function $f\in L$ and the subset $$S=\left\{g\in L: g \textrm{ is nonnegative and increasing,}\\ \int_{z}^1 g(x)\leq \int_z^1 f(x), \forall z\in[0,1), \\ \int_{0}^1 g(x)= \int_0^1 f(x)\right\}.$$ My question is: is $S$ a compact set? why?
My idea: define a metric $M$ by defining the distance between two functions $g,h$ as $\int_0^1 |g(x)-h(x)|dx$, and then showing that $L$ is compact "with respect to" this metric.
A relevant question: The TVS $L$ is metrizable. Suppose we prove that $L$ is compact "with respect to" a metric $M$. This TVS might not be compact "with respect" to some metric $N$ though. Then compactness is not a property of the TVS; it is rather a property of a pair (TVS, Metric). If this is right, then, how should one interpret theorems that simply mention compactness, but no metric. For example Bauer's maximum principle requires a convex and compact set, but would compactness with respect to any metric be sufficient for this principle to hold?
This angle might work on sequential compactness. Take an arbitrary sequence $\{g_i\}$ in your space. Now, we know $0\leq g_i(0)\leq f(0)$, so $a_0=\sup_{i\in \mathbb{N}} \{f(0)-g(i)\}$ exists and we can take a subsequence of $g$ such that $g_i(0)$ monotonically increases with $\lim_{i\to \infty}g_i(0)=a_0$. Do that, then relabel the sequence accordingly (Otherwise we'd get into sub sub subscripts with this argument!). So now we have a subsequence with monotonic $g_i(0)$. Do the exact same with $g_i(1)$.
Now we have a subsequence that approaches the same start point and the same end point, but it might not be increasing all the way. So we bifurcate. Do the same for $g(\frac 1 2)$. Then $g(\frac 1 4)$ and $g(\frac 3 4)$. Repeat for all $g(\frac n {2^k})$. At each step we refine our sequence to one that increases to the limit values at finer and finer divisions. I'm about 99% certain you can then show this must converge to an increasing function $g$ in your space.