Step 0 (finite maxima). The order of the ordered field R is a total order, so the maximum of two elements is defined on R. For a natural number r and a map s:[r]→R with values sk, define maxk∈[r]sk by recursion on r: put maxk∈[1]sk=s1, and, whenever m+1≤r,
k∈[m+1]maxsk=max{k∈[m]maxsk, sm+1},
the inner maximum being formed from the restriction of s to [m]. An induction on r, using that max{a,b} is a or b and is an upper bound for both, gives:
(a) sk≤maxk′∈[r]sk′ for every k∈[r];
(b) there is j∈[r] with maxk∈[r]sk=sj.
Step 1 (auxiliary functions). For a nonempty subset A⊆X and z∈X write distd(z,A) for the distance from z to A in (X,d). For i∈[n] define φi:X→R as follows. If Ui=X, put φi(x)=1 for every x∈X. If Ui=X, then X∖Ui is nonempty, and we put
φi(x)=min{1, distd(x,X∖Ui)},
using the minimum of two elements. We record four properties, valid for every i∈[n].
(i) 0≤φi(x)≤1 for every x∈X. In the first case this is immediate. In the second case 0≤distd(x,X∖Ui) by claim 1 of The Distance to a Set is Nonexpansive, and the minimum of 1 and a nonnegative real number is nonnegative and at most 1.
(ii) φi is continuous on X as a map from (X,d) to (R,dR). By claim 1 of Continuity of Sums and Products of Real-Valued Functions on a Metric Space, applied at each point of X with A=X, every constant real-valued map on X is continuous on X; we use this repeatedly below. In the first case φi is such a constant map. In the second case the map z↦distd(z,X∖Ui) is continuous on X by claim 5 of The Distance to a Set is Nonexpansive, the constant map with value 1 is continuous on X, and the minimum of two real-valued maps continuous on X is continuous on X by claim 4 of Continuity of the Absolute Value, Maximum and Minimum of Real-Valued Functions on a Metric Space.
(iii) If φi(x)=0 then x∈Ui. In the first case Ui=X and there is nothing to prove. In the second case suppose x∈/Ui, so x∈X∖Ui; then distd(x,X∖Ui)≤d(x,x) by claim 2 of The Distance to a Set is Nonexpansive, and d(x,x)=0 by condition 2 of the definition of a metric, so φi(x)≤0, which together with (i) gives φi(x)=0.
(iv) If x∈Ui then 0<φi(x). In the first case φi(x)=1. In the second case Ui∈Td, so by the definition of an open subset of a metric space there is a real number r>0 with Bd(x,r)⊆Ui, where Bd(x,r) is the open ball with center x and radius r. Every y∈X∖Ui then satisfies y∈/Bd(x,r), that is r≤d(x,y). Hence r is a lower bound for the set of real numbers of the form d(x,y) with y∈X∖Ui, whose greatest lower bound is distd(x,X∖Ui) by the definition of the distance to a set, so r≤distd(x,X∖Ui) and therefore 0<min{1,r}≤φi(x).
Step 2 (the degenerate case C=∅). Suppose C is empty. For every i∈[n] put hi(x)=0 for all x∈X and Di=∅. Then hi is a constant map, hence continuous on X as noted in Step 1(ii), and its only value 0 satisfies 0≤0≤1, so property 1 holds. The set ∅ is closed in (X,Td) because its complement X lies in Td, and ∅⊆Ui, and hi vanishes identically; so property 2 holds. Every term of the family (hi(x))i∈[n] equals 0, so claim 7 of Properties of Finite Sums, applied with the index 1, gives ∑i=1nhi(x)=h1(x)=0≤1, and property 3 holds. Property 4 holds vacuously. From now on assume that C is nonempty.
Step 3 (a uniform positive lower bound on C). Define Φ:X→R by Φ(x)=maxi∈[n]φi(x), formed as in Step 0. By (ii), claim 4 of Continuity of the Absolute Value, Maximum and Minimum of Real-Valued Functions on a Metric Space and induction along the recursion of Step 0, Φ is continuous on X.
Let x∈C. Since C⊆⋃i∈[n]Ui there is i∈[n] with x∈Ui, so 0<φi(x)≤Φ(x) by (iv) and Step 0(a).
The restriction of Φ to C satisfies the continuity hypothesis of Extreme Value Theorem on a Compact Subset of a Metric Space: given x∈C and a real number ε>0, continuity of Φ at x relative to X furnishes a real number δ>0 such that every y∈X with d(x,y)<δ satisfies ∣Φ(y)−Φ(x)∣<ε, and in particular every such y lying in C does. Since C is nonempty and compact in (X,Td), that theorem provides xmin∈C with Φ(xmin)≤Φ(x) for every x∈C. Put c=Φ(xmin). Then 0<c, because xmin∈C, and c≤Φ(x) for every x∈C.
Write 2=1+1. By claim 8 of Elementary Order Arithmetic in an Ordered Field the inverse 2−1 exists and, since 0<c, the number γ=c⋅2−1 satisfies 0<γ, γ<c and γ+γ=c.
Step 4 (the cutoffs and their supports). For i∈[n] define ψi:X→R and Di⊆X by
ψi(x)=max{0, φi(x)−γ},Di={x∈X:γ≤φi(x)}.
The map x↦φi(x)−γ is the sum of φi and the constant map with value −γ, hence continuous on X by (ii), by the continuity of constant maps recorded in Step 1(ii) and by claim 5 of Continuity of Sums and Products of Real-Valued Functions on a Metric Space; so ψi is continuous on X by claim 4 of Continuity of the Absolute Value, Maximum and Minimum of Real-Valued Functions on a Metric Space. By (i) and 0<γ we have φi(x)−γ<1, so 0≤ψi(x)≤1.
By (ii) and claim 2 of Semicontinuity Under Negation and Characterization of Continuity, φi is upper semicontinuous on X; hence, by claim 3 of Semicontinuity via Sublevel and Superlevel Sets applied with the subset X of X itself, the set Di is closed in the topological space X carrying the topology Td.
If x∈Di then 0<γ≤φi(x), so φi(x)=0 and x∈Ui by (iii); thus Di⊆Ui. If x∈/Di then φi(x)<γ, so φi(x)−γ<0 and ψi(x)=0.
Step 5 (normalization). Define Ψ:X→R and Θ:X→R by
Ψ(x)=i=1∑nψi(x),Θ(x)=max{Ψ(x),γ}.
By claim 1 of Properties of Finite Sums, Ψ is obtained from the maps ψi by iterated addition, so Ψ is continuous on X by claim 5 of Continuity of Sums and Products of Real-Valued Functions on a Metric Space and induction on n; and Θ is then continuous on X by the continuity of constant maps recorded in Step 1(ii) and claim 4 of Continuity of the Absolute Value, Maximum and Minimum of Real-Valued Functions on a Metric Space.
Since 0<γ≤Θ(x) for every x∈X, we have Θ(x)=0, so the map Θ−1:X→R with Θ−1(x)=(Θ(x))−1 is defined and is continuous on X by claim 2 of Continuity of the Reciprocal of a Nonvanishing Real-Valued Function on a Metric Space; moreover 0<Θ−1(x) by claim 7 of Elementary Order Arithmetic in an Ordered Field. We shall also use that multiplying a non-strict inequality between real numbers by a positive real number preserves it, which follows from claim 10 of Elementary Order Arithmetic in an Ordered Field when the inequality is strict and is trivial when it is an equality. Define
hi(x)=ψi(x)Θ−1(x)(i∈[n], x∈X),
which is continuous on X by claim 5 of Continuity of Sums and Products of Real-Valued Functions on a Metric Space.
Property 1. hi(x) is a product of two nonnegative numbers, so 0≤hi(x). By claims 5 and 6 of Properties of Finite Sums applied to the nonnegative family (ψi(x))i∈[n] we get 0≤Ψ(x) and ψi(x)≤Ψ(x); and Ψ(x)≤Θ(x) by Step 0(a). Multiplying ψi(x)≤Θ(x) by Θ−1(x)>0 gives hi(x)≤Θ(x)Θ−1(x)=1.
Property 2. This was proved in Step 4, together with hi(x)=ψi(x)Θ−1(x)=0 whenever x∈/Di.
Property 3. By claim 3 of Properties of Finite Sums with λ=Θ−1(x),
i=1∑nhi(x)=Θ−1(x)i=1∑nψi(x)=Θ−1(x)Ψ(x),
and multiplying Ψ(x)≤Θ(x) by Θ−1(x)>0 gives Θ−1(x)Ψ(x)≤1.
Property 4. Let x∈C. By Step 0(b) there is j∈[n] with Φ(x)=φj(x), and c≤Φ(x) by Step 3, so φj(x)−γ≥c−γ=γ>0 and therefore ψj(x)=φj(x)−γ≥γ. By claim 6 of Properties of Finite Sums, γ≤ψj(x)≤Ψ(x), so Θ(x)=max{Ψ(x),γ}=Ψ(x) and, by the display in Property 3,
i=1∑nhi(x)=Ψ(x)−1Ψ(x)=1.
This completes the proof.