Conventions. We use the order arithmetic of Elementary Arithmetic in an Ordered Field and Elementary Order Arithmetic in an Ordered Field, the fact that ≤ is a total order, hence reflexive, antisymmetric, transitive and comparing any two elements, and the elementary arithmetic of the underlying field. We use repeatedly that a≤b and c≤e imply a+c≤b+e, which follows from claims 2 and 3 of Elementary Arithmetic in an Ordered Field with the addition axioms of the field, and in particular that a≤b implies c+a≤c+b. Set 2=1+1.
Let dK×K be the restriction of dX×X to K×K, a metric by claim 1 of The Restriction of a Metric to a Subset Induces the Subspace Topology. Since dK×K and dX×X take the same values at points of K×K, a function on K×K is upper (or lower) semicontinuous on K×K with respect to one of them if and only if it is so with respect to the other; the same applies to continuity. By A Product of Compact Subsets is Compact in the Product Metric the topological space consisting of K×K with the subsets open in (K×K,dK×K) is compact, and K×K is compact in X×X. Since K is nonempty, so is K×K: if x∈K then (x,x)∈K×K.
Step 1: proof of claim 1. By claim 1 of Semicontinuity Under Negation and Characterization of Continuity, applied at each point of K, the function −v is upper semicontinuous on K, and then claim 1 of Sums and Nonnegative Multiples of Semicontinuous Functions shows that u+(−v), which is the function u−v, is upper semicontinuous on K. Claim 1 of Semicontinuous Functions Attain Their Extrema on a Compact Set, applied to the nonempty compact set K, provides xM∈K with (u−v)(x)≤(u−v)(xM) for every x∈K; put M=(u−v)(xM). If M′ has the two stated properties as well, then M≤M′ and M′≤M, so M=M′ by antisymmetry.
Fix α with 0<α. Let π1,π2:K×K→X be the maps π1(x,y)=x and π2(x,y)=y; by claim 1 of Continuity of the Projections and of the Distance Function on a Product Metric Space, applied with S=K×K, both are continuous on K×K relative to K×K, and both take values in K. By claim 1 of Semicontinuity and Continuity Under Composition with a Continuous Map, applied with A=K, B=K×K and g=π1, the function u∘π1 is upper semicontinuous on K×K. By claim 2 of the same lemma with g=π2, the function v∘π2 is lower semicontinuous on K×K, so −(v∘π2) is upper semicontinuous by claim 1 of Semicontinuity Under Negation and Characterization of Continuity. Since 0≤α, claim 3 of Sums and Nonnegative Multiples of Semicontinuous Functions shows that αψ is lower semicontinuous on K×K, and claim 1 of Semicontinuity Under Negation and Characterization of Continuity shows that −(αψ) is upper semicontinuous. Since
Φα=(u∘π1)+(−(v∘π2))+(−(αψ)),
two applications of claim 1 of Sums and Nonnegative Multiples of Semicontinuous Functions show that Φα is upper semicontinuous on K×K. Claim 1 of Semicontinuous Functions Attain Their Extrema on a Compact Set, applied in the metric space (X×X,dX×X) to the nonempty compact set K×K, provides a point at which Φα attains a greatest value Mα, unique by antisymmetry as above.
Step 2: proof of claim 2. Let x∈K. Then ψ(x,x)=0, so αψ(x,x)=0 and Φα(x,x)=u(x)−v(x)=(u−v)(x). Hence (u−v)(x)≤Mα for every x∈K, and taking x=xM gives M≤Mα.
Now let 0<α and α≤β, and let (x,y)∈K×K. Since 0≤ψ(x,y), claim 5 of Elementary Arithmetic in an Ordered Field gives αψ(x,y)≤βψ(x,y), and claim 4 of Elementary Order Arithmetic in an Ordered Field gives −βψ(x,y)≤−αψ(x,y). Adding u(x)−v(y) yields Φβ(x,y)≤Φα(x,y). In particular, choosing a point where Φβ attains Mβ,
Mβ=Φβ(xβ,yβ)≤Φα(xβ,yβ)≤Mα.
Step 3: proof of claim 3. Let w:K×K→R be the function w(x,y)=u(x)−v(y), that is w=(u∘π1)+(−(v∘π2)), which is upper semicontinuous on K×K by Step 1. By claim 1 of Semicontinuous Functions Attain Their Extrema on a Compact Set there is C∈R with w(p)≤C for every p∈K×K.
We first record two facts used below. First, for every p∈K×K we have 0≤αψ(p) by claim 5 of Elementary Arithmetic in an Ordered Field, hence −αψ(p)≤0 by claim 4 of Elementary Order Arithmetic in an Ordered Field, and therefore Φα(p)≤w(p). Second, if c∈R and c≤w(p) fails, then w(p)≤c by comparability.
Let ε satisfy 0<ε and put
Aε={p∈K×K:M+ε≤w(p)}.
By claim 3 of Semicontinuity via Sublevel and Superlevel Sets, applied in the metric space (X×X,dX×X) with the subset K×K and the value M+ε, the set Aε is closed in the topological space K×K whose open sets are the subsets open in (K×K,dK×K). That topological space is compact, so Closed Subset of a Compact Space is Compact shows that Aε is compact in the metric space (K×K,dK×K).
Case 1: Aε is empty. Then w(p)≤M+ε for every p∈K×K, so Φα(p)≤w(p)≤M+ε and hence Mα≤M+ε for every α with 0<α. Since 0<1 by claim 6 of Elementary Order Arithmetic in an Ordered Field, the choice α0=1 works.
Case 2: Aε is nonempty. By claim 4 of Semicontinuity and Continuity Under Composition with a Continuous Map the restriction of ψ to Aε is lower semicontinuous on Aε, so claim 2 of Semicontinuous Functions Attain Their Extrema on a Compact Set, applied in the metric space (K×K,dK×K) to the nonempty compact set Aε, provides p∗=(x∗,y∗)∈Aε with ψ(p∗)≤ψ(p) for every p∈Aε. Put c=ψ(p∗).
If x∗=y∗, then w(p∗)=u(x∗)−v(x∗)=(u−v)(x∗)≤M by claim 1, while M+ε≤w(p∗) because p∗∈Aε; adding −M to M+ε≤M gives ε≤0, contradicting 0<ε. Hence x∗=y∗, so ψ(p∗)=0 by the hypothesis on ψ, and with 0≤c this gives 0<c. By claim 7 of Elementary Order Arithmetic in an Ordered Field the inverse c−1 exists.
Put α0=max{1,(C−M−ε)c−1}, the maximum of the two displayed numbers. By claim 1 of Elementary Properties of the Maximum of Two Elements we have 1≤α0 and (C−M−ε)c−1≤α0, so 0<α0.
Let α satisfy α0≤α and let p=(x,y)∈K×K. If p∈/Aε, then w(p)≤M+ε and hence Φα(p)≤M+ε. If p∈Aε, then c≤ψ(p), so claim 5 of Elementary Arithmetic in an Ordered Field gives αc≤αψ(p) and claim 4 of Elementary Order Arithmetic in an Ordered Field gives −αψ(p)≤−αc; adding w(p)≤C yields Φα(p)≤C−αc. Moreover (C−M−ε)c−1≤α by transitivity, so multiplying by c, which satisfies 0≤c, gives C−M−ε≤αc by claim 5 of Elementary Arithmetic in an Ordered Field; claim 4 of Elementary Order Arithmetic in an Ordered Field and adding C then give
C−αc≤C−(C−M−ε)=M+ε.
Hence Φα(p)≤M+ε in this case as well. Taking p=(xα,yα) gives Mα≤M+ε.
Step 4: proof of claim 4. From Φα(xα,yα)=Mα we get
u(xα)−v(yα)=Mα+αψ(xα,yα).
Since 0≤αψ(xα,yα), adding Mα gives Mα≤u(xα)−v(yα), and M≤Mα by claim 2; transitivity gives the first assertion.
Now let 0<ε and put ε1=ε⋅2−1 and ε2=ε1⋅2−1. By claim 8 of Elementary Order Arithmetic in an Ordered Field we have 0<ε1, ε1+ε1=ε, ε1<ε, 0<ε2, ε2+ε2=ε1 and ε2<ε1. Let α0 be as in claim 3 for ε2 and put α1=2α0, which satisfies 0<α1 by claim 5 of Elementary Order Arithmetic in an Ordered Field.
Let α1≤α and put β=α⋅2−1, so that 0<β, β+β=α and β<α by claim 8. Multiplying 2α0≤α by 2−1, which is nonnegative, gives α0≤β by claim 5 of Elementary Arithmetic in an Ordered Field, so claim 3 gives Mβ≤M+ε2.
Since (xα,yα)∈K×K and αψ−βψ=βψ at that point, because α=β+β,
Mα+βψ(xα,yα)=u(xα)−v(yα)−βψ(xα,yα)=Φβ(xα,yα)≤Mβ≤M+ε2.
By claim 2 we have M≤Mα, hence −Mα≤−M by claim 4 of Elementary Order Arithmetic in an Ordered Field; adding −Mα to the displayed inequality therefore gives
βψ(xα,yα)≤M+ε2−Mα≤ε2.
Multiplying by 2, which is nonnegative, and using 2β=β+β=α and 2ε2=ε2+ε2=ε1, we obtain
αψ(xα,yα)≤ε1≤ε.
Finally, β≤α and claim 2 give Mα≤Mβ≤M+ε2, so adding the last two inequalities,
u(xα)−v(yα)=Mα+αψ(xα,yα)≤M+ε2+ε1≤M+ε1+ε1=M+ε.
Step 5: proof of claim 5. Let ρ:K×K→R be the function ρ(x,y)=d(x,y). By claim 2 of Continuity of the Projections and of the Distance Function on a Product Metric Space, applied with T=K×K, the function ρ is continuous on K×K relative to K×K, hence both upper and lower semicontinuous on K×K by claim 2 of Semicontinuity Under Negation and Characterization of Continuity.
Let 0<η and put Cη={p∈K×K:η≤ρ(p)}. By claim 3 of Semicontinuity via Sublevel and Superlevel Sets the set Cη is closed in the topological space K×K described in Step 3, hence compact in the metric space (K×K,dK×K) by Closed Subset of a Compact Space is Compact. Note that if p∈K×K and p∈/Cη, then η≤ρ(p) fails, so comparability gives ρ(p)≤η and ρ(p)=η, that is ρ(p)<η.
If Cη is empty, then d(xα,yα)<η for every α with 0<α, and α2=1 works. Otherwise, by claim 4 of Semicontinuity and Continuity Under Composition with a Continuous Map the restriction of ψ to Cη is lower semicontinuous on Cη, so claim 2 of Semicontinuous Functions Attain Their Extrema on a Compact Set provides p#=(x#,y#)∈Cη with ψ(p#)≤ψ(p) for every p∈Cη; put cη=ψ(p#). From η≤d(x#,y#) and 0<η we get d(x#,y#)=0, so x#=y# by condition 2 in the definition of a metric; hence cη=0 by the hypothesis on ψ, and 0<cη.
Let α1 be as in claim 4 for the value cη in place of ε, and put α2=max{α1,2}, so that 0<α2 by claim 1 of Elementary Properties of the Maximum of Two Elements. Let α2≤α and suppose that (xα,yα)∈Cη. Then cη≤ψ(xα,yα), so claim 5 of Elementary Arithmetic in an Ordered Field and claim 4 of the present theorem give
αcη≤αψ(xα,yα)≤cη,
while 2≤α2≤α and 0≤cη give cη+cη=2cη≤αcη. Hence cη+cη≤cη, and adding −cη gives cη≤0, contradicting 0<cη. Therefore (xα,yα)∈/Cη, that is d(xα,yα)<η.
Step 6: proof of claim 6. Write r=u(x^)−v(x^). Since x^∈K, claim 1 gives r≤M.
Let 0<ε. Since u is upper semicontinuous at x^ relative to K, there is δ1 with 0<δ1 such that every x∈K with d(x^,x)<δ1 satisfies u(x)<u(x^)+ε. Since v is lower semicontinuous at x^ relative to K, there is δ2 with 0<δ2 such that every y∈K with d(x^,y)<δ2 satisfies v(x^)−ε<v(y). By claim 9 of Elementary Order Arithmetic in an Ordered Field there is δ with δ≤δ1, δ≤δ2 and δ equal to δ1 or to δ2; in either case 0<δ. Put δ′=δ⋅2−1, so 0<δ′, δ′+δ′=δ and δ′<δ by claim 8.
By claim 5 there is α2 with 0<α2 such that d(xα,yα)<δ′ whenever α2≤α. By the hypothesis on x^, applied with δ′ and with β=α2, there is α with α2≤α and d(x^,xα)<δ′. Fix such an α. Then d(x^,xα)<δ′<δ≤δ1, so u(xα)<u(x^)+ε; and condition 4 in the definition of a metric gives
d(x^,yα)≤d(x^,xα)+d(xα,yα)<δ′+δ′=δ≤δ2,
so v(x^)−ε<v(yα) and hence −v(yα)<ε−v(x^) by claim 4 of Elementary Order Arithmetic in an Ordered Field. Adding the two strict inequalities by claim 3 of that lemma,
u(xα)−v(yα)<(u(x^)+ε)+(ε−v(x^))=r+ε+ε.
By claim 4 we have M≤u(xα)−v(yα), so claim 2 of Elementary Order Arithmetic in an Ordered Field gives M<r+ε+ε, and in particular M≤r+ε+ε.
Suppose r=M. Since r≤M, this gives r<M and hence 0<M−r. Applying the previous paragraph with ε=(M−r)⋅2−1⋅2−1, which is positive by claim 8 of Elementary Order Arithmetic in an Ordered Field, and using ε+ε=(M−r)⋅2−1<M−r from the same claim, we obtain
M≤r+ε+ε<r+(M−r)=M,
so M<M, which is impossible. Hence r=M, that is u(x^)−v(x^)=M.