Given a topological space X, we establish formulas to compute the distance from a function f∈RX to the spaces of upper semicontinuous functions and lower semicontinuous functions. For this, we introduce an index of upper semioscillation and lower semioscillation. We also establish new formulas about distances to some subspaces of continuous functions that generalize some classical results.

Ministerio de Economía y CompetitividadMTM2017-83262-C2-2-PFundación Séneca20906/PI/181. Introduction

Several classical and modern results deal with distances, optimization, equalities, and inequalities. For this, several authors have studied how to compute distances to some spaces of functions, for example, spaces of continuous functions ([1]), spaces of Baire-one functions ([2, 3]), and spaces of measurable functions and integrable functions ([4]). This kind of results has been used in a big number of papers (for instance, [5–15]).

Our aim here is to establish analogous formulas to study distances to spaces of upper semicontinuous functions and lower semicontinuous functions and to study distances to some subspaces of continuous functions that generalize the mentioned result in [1].

Recall that if X is a topological space, a function f∈RX is upper (resp., lower) semicontinuous if for all x∈X and ε>0 there is U, a neighborhood of x, such that f(z)<f(x)+ε (resp., f(z)>f(x)-ε) for all z∈U. Observe that f is upper (resp., lower) semicontinuous if and only if f-1([t,+∞)) (resp., f-1((-∞,t])) is a closed set for all t∈R.

Throughout the paper X is a topological space, C(X) denotes the subspace of RX made up of all continuous functions, usC(X) denotes the subspace of upper semicontinuous functions, and lsC(X) denotes the subspace of lower semicontinuous functions. For f∈RX and C⊂RX we denote (1)df,C=infg∈Cdf,gwhere (2)df,g=supx∈Xfx-gxis the supremum metric (that can take the value +∞).

In Section 2 we introduce the indexes of upper and lower semioscillation and use them to study the distances of a function to the spaces of upper semicontinuous functions and lower semicontinuous functions; see Theorem 5.

In Section 3 we establish some relations between distances to spaces of semicontinuous functions and spaces of continuous functions.

It is known that if X is a normal space and f∈RX, then(3)df,CX=12oscf;see Theorem 8. In Section 4 we study the distances to some subspaces of continuous functions. Theorem 12 shows that if f∈RX and A⊂X is a closed subset of the set of points of continuity of f, then we can extend f|A to a continuous function that is also a best approximation of f in C(X). Theorem 15 studies the distance from f to the continuous functions that have fixed values in some points. Both theorems generalize (3).

2. Upper and Lower Semioscillation

The oscillation of a function f∈RX at x∈X is defined as (4)oscf,x=infU∈UxsupdiamfUwhere Ux denotes the set of neighborhoods of x. The oscillation of a function is used in [1] to study distances to spaces of continuous functions (see Theorem 8). Inspired by this idea, we define the indexes of upper semioscillation and lower semioscillation.

Definition 1.

Let f∈RX and x∈X. We define the index of upper semioscillation of f in x as (5)uoscf,x=infU∈Uxsupz∈Ufz-fxwhere Ux denotes the set of neighborhoods of x, and the index of upper semioscillation of f as (6)uoscf=supx∈Xuoscf,x.Analogously we define the index of lower semioscillation of f in x as (7)loscf,x=infU∈Uxsupz∈Ufx-fzand the index of lower semioscillation of f as (8)loscf=supx∈Xloscf,x.

Observe that uosc(f,x)<ε (resp., losc(f,x)<ε) if and only if there exist 0<ε′<ε and a neighborhood U of x such that f(z)<f(x)+ε′ (resp., f(z)>f(x)-ε′) for all z∈U. In particular f is upper (resp., lower) semicontinuous if and only if uosc(f)=0 (resp., losc(f)=0).

It is very clear that the index of oscillation and the indexes of upper semioscillation and lower semioscillation are related.

Proposition 2.

If X is a topological space and f∈RX is a function, then for all x∈X we have that (9)oscf,x=uoscf,x+loscf,x,so (10)oscf≤uoscf+loscf.

We introduce the following known functions.

Definition 3.

For f∈RX we denote (11)f¯x=infU∈Uxsupz∈Ufz,f_x=supU∈Uxinfz∈Ufz.

Proposition 4.

Let f∈RX. Then f¯ is an upper semicontinuous function, f_ is a lower semicontinuous function, and we have that (12)f¯x=fx+uoscf,x,f_x=fx-loscf,x.

Proof.

It is known and very easy to check that f¯ is upper semicontinuous and f_ is lower semicontinuous. We also have that (13)f¯x=infU∈Uxsupz∈Ufz=fx+infU∈Uxsupz∈Ufz-fx=fx+uoscf,xand analogously f_(x)=f(x)+losc(f,x).

The following theorem is the main result of this section.

Theorem 5.

Let X be a topological space and f∈RX a function. Then (14)df,usCX=12uoscf,df,lsCX=12loscf.In fact there are g∈usC(X) and h∈lsC(X) such that d(f,g)=d(f,usC(X)) and d(f,h)=d(f,lsC(X)).

Proof.

We prove the theorem in the usC(X) case, and the other one can be done analogously or we can deduce it from the usC(X) case applied to -f.

Suppose that d(f,usC(X))<d. Choose g∈usC(X) such that d(f,g)<d. Fix x∈X and ε>0. Since g∈usC(X), there is a neighborhood U of x such that g(z)<g(x)+ε for all z∈U and then (15)fz-fx<gz+d-gx-d<ε+2d.Therefore, uosc(f,x)≤2d for all x∈X and all d>d(f,usC(X)) and then uosc(f)≤2d(f,usC(X)).

We have to prove that if uosc(f)=δ<+∞, there is g∈usC(X) such that d(f,g)≤δ/2. For this we use the upper semicontinuous function (16)f¯x=infU∈Uxsupz∈Ufz.By Proposition 4 we have that (17)fx≤f¯x=fx+uoscf,x≤fx+δ,so the upper semicontinuous function g=f¯-δ/2 satisfies that (18)fx-δ2≤gx≤fx+δ2and the proof is over.

If a sequence of upper (resp., lower) semicontinuous functions is locally uniformly convergent to a function f, then f is also upper (resp., lower) semicontinuous. Theorem 5 can be used to get a quantitative version of this result.

Proposition 6.

Let X be a topological space and (fn)n a sequence in RX locally uniformly convergent to a function f. Then (19)df,usCX≤liminfndfn,usCX,df,lsCX≤liminfndfn,lsCX.

Proof.

Fix x∈X and ε>0 and choose n∈N and U, a neighborhood of x, such that |fm(z)-f(z)|<ε for all z∈U and m>n. Fix m>n and choose V⊂U, a neighborhood of x, such that (20)fmz-fmx<uoscfm,x+εfor all z∈V. Then (21)fz-fx=fz-fmz+fmz-fmx+fmx-fx<uoscfm,x+3εfor all z∈V, so uosc(f,x)≤uosc(fm,x)+3ε≤uosc(fm)+3ε and then uosc(f,x)≤liminfuosc(fm)+3ε. Since x∈X and ε>0 are arbitrary, we get by Theorem 5 that d(f,usC(X))≤liminfnd(fn,usC(X)). Analogously d(f,lsC(X))≤liminfnd(fn,lsC(X)).

Example 7.

The inequalities of Proposition 6 are sharp because they become an equality when we consider constant sequences of non-semicontinuous functions (for example, fn=f=χQ∈RR where χA is the characteristic function of A). However, in general, the equalities do not hold. Consider fn=χ{n}∈RR. The sequence (fn)n is locally uniformly convergent to the null function f=0 and d(fn,lsC(R))=1/2, so (22)df,lsCR=0<12=liminfndfn,lsCR.

3. Relations between Distances to Spaces of Semicontinuous and Continuous Functions

Since C(X)⊂usC(X)∩lsC(X), we have that (23)df,usCX≤df,CX,df,lsCX≤df,CXfor all f∈RX. From Theorem 8 we can obtain that in some cases the distance d(f,C(X)) can be bounded using the distances d(f,usC(X)) and d(f,lsC(X)). For this we also need the following result.

Theorem 8 (see [<xref ref-type="bibr" rid="B6">1</xref>, <xref ref-type="bibr" rid="B1">16</xref>]).

Let X be a topological space. Then the following statements are equivalent:

X is normal,

for each f∈RX there is g∈C(X) such that d(f,g)=1/2osc(f),

d(f,C(X))=1/2osc(f) for each f∈RX.

The version of Theorem 8 that appears in [1] is less general. They prove that if X is a paracompact space, then the formula d(f,C(X))=1/2osc(f) holds for all bounded functions f∈RX and also says that this result holds for normal spaces.

Corollary 9.

Let X be a normal topological space and f∈RX a function. Then(24)df,CX≤df,usCX+df,lsCX.If f is an upper semicontinuous function, then(25)df,CX=df,lsCX.If f is a lower semicontinuous function, then(26)df,CX=df,usCX.

Proof.

By Proposition 2osc(f)≤uosc(f)+losc(f) and then by Theorems 8 and 5, we have that (27)df,CX=12oscf,x≤12uoscf+loscf=df,usCX+df,lsCX.Observe now that if f is upper (resp., lower) semicontinuous, then osc(f)=losc(f) (resp., osc(f)=uosc(f)), so equalities (25) and (26) also follow from Theorems 8 and 5.

Remark 10.

Considering equality (26), one can think that if f is lower (resp., upper) semicontinuous, then the best approximation of f by upper (resp., lower) semicontinuous functions that appear in the proof of Theorem 5 is continuous. However, it is easy to check that it is not true. If we consider X=R and f=χ(0,+∞), i.e., f is the function defined by (28)fx=0if x≤0,1if x>0,then f is lower semicontinuous but (29)f¯x=infU∈Uxsupz∈Ufz=χ0,+∞=0if x<0,1if x≥0is not continuous.

4. Distances to Subspaces of Continuous Functions

In this section we study generalizations of Theorem 8. We prove that we can obtain a best approximation g of f in C(X) that preserves the value of f in some sets of continuity points and we also can force g to have fixed values at some points. First of all, we need the following known lemma that can be found in [17, Theorem 12.16].

Lemma 11.

Let X be a topological normal space. Then if g1∈RX is an upper semicontinuous function and g2∈RX is a lower semicontinuous function such that g1≤g2, there exists a continuous function g∈C(X) such that g1≤g≤g2.

Theorem 12.

Let X be a normal space, f∈RX, and A be a closed subset of X such that f is continuous at x for all x∈A. Then there is g∈C(X) a continuous function such that f|A=g|A and (30)df,g=12oscf=df,CX.

Proof.

Suppose that osc(f)=δ<∞ and define h1(x)=f¯(x)-δ/2 and h2(x)=f_(x)+δ/2. By Proposition 4, h1 is upper semicontinuous and h2 is lower semicontinuous and f¯(x)-f_(x)=uosc(f,x)+losc(f,x)=osc(f,x)≤osc(f)=δ, so h1≤h2. Define (31)gix=fxif x∈A,hixif x∉A,for i=0,1. Clearly g1(x)≤g2(x). Observe that if f is continuous in x, then f¯(x)=f_(x)=f(x), so (32)h1x<g1x=fx=g2x<h2xfor x∈A.Let us prove that g1 is upper semicontinuous. If x∉A, there is a neighborhood U of x such that g1|U=h1|U and then uosc(g1,x)=uosc(h1,x)=0. If x∈A, there is a neighborhood U of x such that diam(f(U))<ε (f is continuous at x) and h1(z)<h1(x)+ε for all z∈U. If z∈U∩A, then g1(z)=f(z)<f(x)+ε=g1(x)+ε, and if z∈U∩Ac, then g1(z)=h1(z)<h1(x)+ε<g1(x)+ε, so uosc(g1)=0. Then we have that g1 is upper semicontinuous. Analogously g2 is lower semicontinuous, and since g1≤g2, by Lemma 11 we have that there exists a continuous function g∈C(X) such that (33)g1≤g≤g2.Observe that if x∈A, since g1(x)=f(x)=g2(x), then g(x)=f(x), so (34)f∣A=g∣A.If x∉A, then g1(x)=h1(x)=f¯(x)-δ/2=f(x)+uosc(f,x)-1/2osc(f), so (35)g1x-fx=uoscf,x-12oscf≤12oscf.Analogously |g2(x)-f(x)|≤1/2osc(f), so (36)fx-12oscf≤g1x≤gx≤g2x≤fx+12oscfand then (37)df,g≤12oscf.To finish, we have to prove that d(f,h)≥1/2osc(f) for all h∈C(X). This is true by Theorem 8, but we include the proof here to get a self-contained proof. Suppose that h is a continuous function and define d=d(f,h). For x∈X, choose U, a neighborhood of x, such that diam(h(U))<ε. Then (38)fz-fx≤fz-hz+hz-hx+hx-fx<2d+εfor all z∈U so osc(f)≤2d and then (39)df,h≥12oscffor all h∈C(X).

Remark 13.

Observe that the final part of the proof of Theorem 12 does not need the normal hypothesis, so if X is a topological space and f∈RX, then (40)df,CX≥12oscf.

Example 14.

The set A in Theorem 12 needs to be closed. Indeed consider the function f=χA∈RR where A=(0,+∞). If g∈C(R) is a continuous function such that f|A=g|A, then g(0)=1, so (41)df,g≥f0-g0=1>12oscf=12.If we change the hypothesis A⊂{x∈X:fiscontinuousatx} by f|A continuous, the theorem also fails. Consider now f=χ{0}∈RR and A={0}. If g∈C(R) is a continuous function such that g(0)=f(0)=1, then clearly d(f,g)≥1 and osc(f)=1, so d(f,g)>1/2osc(f).

Keeping the last example in mind, we can ask how far is f∈RX from the set of continuous functions that takes a fixed value z∈R in a point x∈X. The following theorem says that the distance that we obtain depends on M=max{|z-f¯(x)|,|z-f_(x)|}. Since f¯(x)=f(x)+uosc(f,x), f_(x)=f(x)-losc(f,x), and f_≤f¯, we get that we can write M as (42)M=maxz-fx+loscf,x,fx+uoscf,x-z.

Theorem 15.

Let X be a normal space, f∈RX, and A⊂X be a discrete closed subset. For each x∈A, fix zx∈RX. Then there is g∈C(X) such that g(x)=zx for all x∈A and (43)df,g=max12oscf,Mwhere (44)M=supx∈Amaxzx-fx+loscf,x,fx+uoscf,x-zx=supx∈Amaxzx-f¯x,zx-f_x.

Proof.

Take δ=max{1/2osc(f),M} and define h1(x)=f¯(x)-δ and h2(x)=f_(x)+δ. By Proposition 4h1 is upper semicontinuous, h2 is lower semicontinuous, and f¯(x)-f_(x)=uosc(f,x)+losc(f,x)=osc(f,x)≤osc(f)≤2δ, so h1≤h2. We have that (45)h1x≤zx≤h2xfor x∈A.Indeed, if zx∈A, then f¯(x)-zx=f(x)+uosc(f,x)-zx≤δ, so h1(x)=f¯(x)-δ≤zx and analogously zx≤h2(x). Define (46)gix=zxif x∈A,hixif x∉A,for i=1,2. Let us see that g1 is upper semicontinuous. If x∉A, then there is U, a neighborhood of x, such that g1|U=h1|U, so uosc(g1,x)=uosc(h1,x)=0. If x∈A, fix ε>0 and pick U, a neighborhood of x, such that A∩U={x} and h1(z)<h1(x)+ε for all z∈U. Then (47)g1z=h1z<h1x+ε≤zx+ε=g1x+εfor all z∈U∖{x}, so g1 is upper semicontinuous. Analogously g2 is lower semicontinuous, and since g1≤g2, by Lemma 11 there is a continuous function g∈C(X) such that (48)g1≤g≤g2.Observe that if x∈A, then zx=g1(x)≤g(x)≤g2(x)=zx, so g(x)=zx for all x∈A. Let us see that |f(x)-g1(x)|≤δ.

Suppose that x∈A. Then (49)fx-g1x=fx-zx≤maxzx-fx+loscf,x,fx+uoscf,x-zx≤δ.

Suppose that x∉A and f(x)≤g1(x). Then (50)g1x-fx=f¯x-δ-fx=fx+uoscf,x-δ-fx=uoscf,x-δ≤uoscf,x-12oscf≤12oscf≤δ.

Suppose that x∉A and f(x)≥g1(x). Then (51)fx-g1x≤f¯x-g1x=f¯x-f¯x-δ=δ.

Thus, |f(x)-g1(x)|≤δ and analogously |f(x)-g2(x)|≤δ. We have that (52)fx-δ≤g1x≤gx≤g2x≤fx+δand then (53)df,g≤δ.We have to prove that d(f,g)≥δ. Since d(f,C(X))=1/2osc(f), then d(f,g)≥1/2osc(f). Accordingly, the following claim finish the proof.

Claim. If h is a continuous function such that h(x)=zx for some fixed x∈A, then (54)df,h≥L≔maxzx-fx+loscf,x,fx+uoscf,x-zx.Suppose without loss of generality that L=zx-f(x)+losc(f,x). Fix ε>0; then there is U, a neighborhood of x, such that |zx-h(y)|<ε for all y∈U. Choose y∈U∖A such that f(y)<f(x)-losc(f,x)+ε. Then (55)hy-fy≥zx-ε-fx-loscf,x+ε=zx-fx+loscf,x-2ε=L-2ε.Since ε>0 is arbitrary, we get that d(f,h)≥L and the proof of the claim is over.

Corollary 16.

Let X be a normal space, f∈RX, and A⊂X be a discrete closed subset. For each x∈A fix zx∈RX and consider the affine subspace (56)Z=h∈CX:hx=zx for all x∈A.Then (57)df,Z=max12oscf,Mwhere (58)M=supx∈Amaxzx-fx+loscf,x,fx+uoscf,x-zx=supx∈Amaxzx-f¯x,zx-f_x.

Proof.

By Theorem 15 we have that d(f,Z)≤max{1/2osc(f),M}. The other inequality is true by the claim of the proof of Theorem 15.

Corollary 17.

Let X be a normal space, f∈RX, and A⊂X be a discrete closed subset. For each x∈A fix (59)zx∈f¯x-12oscf,f_x+12oscf.Then there is g∈C(X) such that g(x)=zx for all x∈A and (60)df,g=12oscf.

Proof.

If x∈A and zx∈[f¯(x)-1/2osc(f),f_(x)+1/2osc(f)], we have that (61)maxzx-f¯x,zx-f_x≤12oscfso by Theorem 15 there is a function g∈C(X) such that g(x)=zx and (62)df,g=max12oscf,M=12oscf.

The proofs of Theorems 12 and 15 are very similar. In fact we can combine both theorems.

Theorem 18.

Let X be a normal space, f∈RX, A⊂X be a discrete closed subset, and B be a closed subset of X such that f is continuous at x for all x∈B. For each x∈A fix zx∈RX. Then there is g∈C(X) such that g(x)=zx for all x∈A, g(x)=f(x) for all x∈B∖A, and (63)df,g=max12oscf,Mwhere (64)M=supx∈Amaxzx-fx+loscf,x,fx+uoscf,x-zx=supx∈Amaxzx-f¯x,zx-f_x.

We omit the proof because it is very similar to the proofs of Theorems 12 and 15. If we read the proof of Theorem 15, we have to change the definition of gi by (65)gix=zxif x∈A,fxif x∈B∖Ahixif x∉A∪B,and then we get by Lemma 11g∈C(X) that g1≤g≤g2, and then we have to check that g is the desired function.

Data Availability

All our findings are theoretical ones and are included within the article.

Conflicts of Interest

The author declares no conflicts of interest.

Acknowledgments

The author is supported by the Spanish grants MTM2017-83262-C2-2-P of the Spanish Ministry of Economy and 20906/PI/18 of Fundación Séneca.

BenyaminiY.LindenstraussJ.Geometric nonlinear functional analysis. Vol. 1AngostoC.CascalesB.NamiokaI.Distances to spaces of Baire one functionsGraneroA. S.SánchezM.Convexity, compactness and distancesAngostoC.CascalesB.RodríguezJ.Distances to spaces of measurable and integrable functionsAngostoC.CascalesB.Measures of weak noncompactness in Banach spacesAngostoC.KakolJ.KubzdelaA.Measures of weak noncompactness in non-Archimedean Banach spacesCascalesB.KalendaO. F. K.SpurnýJ.A quantitative version of James's compactness theoremCascalesB.MarciszewskiW.RajaM.Distance to spaces of continuous functionsFabianM.HájekP.MontesinosV.ZizlerV.A quantitative version of Kreins theoremGraneroA. S.An extension of the Krein-Šmulian theoremGraneroA. S.HájekP.MontesinosV.Convexity and w^{⁎}-compactness in Banach spacesGraneroA. S.SánchezM.The class of universally Krein-Šmulian Banach spacesKačenaM.KalendaO. F. K.SpurnýJ.Quantitative Dunford–Pettis propertyKalendaO. F.PfitznerH.SpurnýJ.On quantification of weak sequential completenessKryczkaA.PrusS.SzczepanikM.Measure of weak noncompactness and real interpolation of operatorsAngostoC.CascalesB.A new look at compactness via distances to function spacesJamesonG. J. O.