Steps 1 and 2 below follow the published proof of Extreme Value Theorem on a Compact Subset of a Metric Space on TheoremBase, adapted: the continuity hypothesis used there is replaced by upper semicontinuity, which is all that the covering argument consumes, and the conclusion about minima is obtained from the maximum case by negation rather than proved separately.
Write Tdβ for the collection of subsets of X that are open in (X,d), a topology by Metric Open Sets Form a Topology, and TKβ={Kβ©W:WβTdβ} for the subspace topology on K. By the definition of a compact subset, the hypothesis on K says that the topological space (K,TKβ) is compact. For a natural number n, write [n] for the initial segment determined by n. We use the elementary order arithmetic of the ordered field R, and the fact that β€ is a total order, hence reflexive, antisymmetric, transitive and comparing any two elements.
Step 1: for every cβR the set Vcβ={yβK:u(y)<c} belongs to TKβ.
Let xβVcβ, so that u(x)<c. Claim 1 of Elementary Order Arithmetic in an Ordered Field, adding βu(x), gives 0<cβu(x). Since u is upper semicontinuous at x relative to K, applying the defining condition with Ξ΅=cβu(x) provides Ξ΄xββR with 0<Ξ΄xβ such that every yβK with d(x,y)<Ξ΄xβ satisfies
u(y)<u(x)+(cβu(x))=c,
that is yβVcβ. Let
Wcβ=xβVcβββBdβ(x,Ξ΄xβ)
be the union of the family of open balls Bdβ(x,Ξ΄xβ) indexed by xβVcβ.
The set Wcβ is open in (X,d). Indeed, let zβWcβ, say zβBdβ(x,Ξ΄xβ) with xβVcβ, and put r=Ξ΄xββd(x,z), which satisfies 0<r by claim 1 of Elementary Order Arithmetic in an Ordered Field because d(x,z)<Ξ΄xβ. If wβBdβ(z,r), then the triangle inequality in the definition of a metric gives
d(x,w)β€d(x,z)+d(z,w)<d(x,z)+r=Ξ΄xβ,
using claims 1 and 2 of Elementary Order Arithmetic in an Ordered Field, so Bdβ(z,r)βBdβ(x,Ξ΄xβ)βWcβ.
Moreover Kβ©Wcβ=Vcβ. If yβKβ©Wcβ, then yβBdβ(x,Ξ΄xβ) for some xβVcβ, so d(x,y)<Ξ΄xβ and hence yβVcβ by the choice of Ξ΄xβ. Conversely, if xβVcβ, then xβK and d(x,x)=0<Ξ΄xβ, so xβBdβ(x,Ξ΄xβ)βWcβ. Hence Vcβ=Kβ©WcββTKβ.
Step 2: proof of claim 1.
Suppose, for contradiction, that there is no xmaxββK with u(x)β€u(xmaxβ) for every xβK. Then for every xβK there is yβK for which u(y)β€u(x) fails. For such x and y, comparability gives u(x)β€u(y), and u(x)ξ =u(y), since u(x)=u(y) would give u(y)β€u(x) by reflexivity. So for every xβK there is yβK with u(x)<u(y).
Consider the family (Vu(y)β)yβKβ of subsets of K indexed by the set K. Each member belongs to TKβ by Step 1, and the family covers K: given xβK, choose yβK with u(x)<u(y); then xβVu(y)β. Since (K,TKβ) is compact, there are a natural number n and elements y1β,β¦,ynββK with
KβVu(y1β)ββͺβ―βͺVu(ynβ)β.
Since K is nonempty, fix x0ββK; then x0ββVu(yk0ββ)β for some k0ββ[n], so [n] is nonempty.
Apply Greatest Element of a Finite Family in a Totally Ordered Set to the set R with its total order and to the n-tuple in R whose k-th component is u(ykβ): there is jβ[n] with u(ykβ)β€u(yjβ) for every kβ[n]. Since yjββK, there is kβ[n] with yjββVu(ykβ)β, that is u(yjβ)<u(ykβ), so u(yjβ)β€u(ykβ) and u(yjβ)ξ =u(ykβ). Together with u(ykβ)β€u(yjβ), antisymmetry gives u(yjβ)=u(ykβ), a contradiction.
Hence the supposition was false, and there exists xmaxββK such that u(x)β€u(xmaxβ) for every xβK.
Step 3: proof of claim 2.
Let w:KβR be lower semicontinuous on K, and let βw:KβR be the function whose value at yβK is the additive inverse of w(y). By claim 1 of Semicontinuity Under Negation and Characterization of Continuity, applied at each point of K, the function βw is upper semicontinuous on K. By claim 1 of the present theorem, proved in Step 2 and applied to βw, there is xminββK such that
βw(x)β€βw(xminβ)
for every xβK. Claim 4 of Elementary Order Arithmetic in an Ordered Field converts this into w(xminβ)β€w(x) for every xβK.