Lars Olsen **[1]**, **[2]** (2005, 2005) has proved some results about this notion. Let $E \subseteq {\mathbb R}^{n}$ and $x \in {\mathbb R}^{n},$ where $n$ is a fixed positive integer. Let $\dim_{H}(E,x)$ and $\dim_{P}(E,x)$ denote the local Hausdorff and local packing dimensions of $E$ at $x,$ defined as in your question.

# Discussion of Results in Olsen **[1]**

In **[1]** Olsen proved that, given any continuous function $f:{\mathbb R}^n \rightarrow [0,n],$ there exists $E \subseteq {\mathbb R}^{n}$ such that for all $x \in {\mathbb R}^{n}$ we have $f(x) = \dim_{H}(E,x) = \dim_{P}(E,x).$

Olsen observed (p. 214) that it is easy to see that some local dimension functions can be discontinuous, giving the example $f:{\mathbb R} \rightarrow [0,1]$ defined by $f(x) = \frac{\ln 2}{\ln 3}$ for $x \in C$ and $f(x) = 0$ if $x \notin C,$ where $C$ is the Cantor middle thirds set. In fact, the characteristic function of a compact interval gives a simpler example, but I suppose Olsen gave the example he did because then the discontinuities occur at every point of the Cantor set.

Olsen also observed (p. 214) that it is easy to see that some very simple discontinuous functions $f:{\mathbb R} \rightarrow [0,1]$ cannot be a local dimension function, giving the example $f(x) = 0$ if $x \neq 0$ and $f(0) = 1.$

Olsen posed the problem (p. 214) of characterizing those functions $f:{\mathbb R}^n \rightarrow [0,n]$ that can be the local dimension function (Hausdorff and/or packing) of some subset of ${\mathbb R}^{n}.$

The result Olsen actually proved was a bit sharper than I stated above. Let $M(f,x,r)$ denote the supremum of $|f(x_{1}) – f(x_{2})|$ as $x_1$ and $x_2$ vary over the open ball $B(x,r)$ of radius $r$ centered at $x.$ Olsen's *Theorem 1.1* in **[1]** states that, given any function $f:{\mathbb R}^n \rightarrow [0,n]$ (continuous or not), there exists $E \subseteq {\mathbb R}^{n}$ such that for all $x \in {\mathbb R}^{n}$ and for all $r > 0$ we have

$$| f(x) \; - \; \dim_{H}\left(E \cap B(x,r) \right)| \;\; \leq \;\; M(f,x,r)$$
$$| f(x) \; - \; \dim_{P}\left(E \cap B(x,r) \right)| \;\; \leq \;\; M(f,x,r)$$

Olsen observed that if $f$ is continuous, then we obtain the result I gave earlier.

# Discussion of Results in Olsen **[2]**

In **[2]** Olsen provided an answer to the problem he posed in the earlier paper by characterizing those functions $f:{\mathbb R}^n \rightarrow [0,n]$ that can be the local dimension function (in both the Hausdorff and the packing sense) of some subset of ${\mathbb R}^{n}.$

For Hausdorff dimension, the characterization Olsen gave is that $f:{\mathbb R}^n \rightarrow [0,n]$ satisfies:

(1) For each $x \in {\mathbb R}^{n},$ we have $\limsup_{x' \rightarrow x} f(x') = f(x).$

(2) For each $y$ with $0 \leq y < \sup f$ and for each $x \in \{f > y\} \; = \; \{x' \in {\mathbb R}^{n}: \; f(x') > y \},$ we have $\dim_{H}\left( \{f > y\}, \;x\right) \; > \; y.$ Here, "$\sup f$" denotes the supremum of $f$ over ${\mathbb R}^{n}.$

The characterization for packing dimension is identical except that $\dim_{P}$ replaces $\dim_{H}$ in (2).

Before proving this result, Olsen gave an example (2nd example on p. 233) to show that there exist functions $f:{\mathbb R} \rightarrow [0,1]$ satisfying (1) but not satisfying (2). The example Olsen gave is the function $f$ equal to $s$ (a constant) at each point of the Cantor middle thirds set $C$ and equal to $0$ elsewhere, where $\frac{\ln 2}{\ln 3} < s \leq 1.$ To see that (2) does not hold, note that if $y$ is chosen so that $\frac{\ln 2}{\ln 3} \leq y < s,$ then $\{f > y\} = C.$ Incidentally, Olsen uses Hausdorff dimension throughout in this example, but since the packing and Hausdorff dimensions of the Cantor middle thirds set are both equal to $\frac{\ln 2}{\ln 3},$ the same example shows that (1) can hold and (2) can fail for packing dimension as well.

As was the case with Olsen's earlier paper, Olsen actually proved a bit more than I've stated thus far.

Rather than limiting himself to the Hausdorff or packing dimensions, he proved the characterization for the local dimension function of any "regular dimension index", which is an assignment $\dim$ of a non-negative real number to each subset of ${\mathbb R}^{n}$ such that $\dim$ is monotone with respect to set inclusion, $\dim$ is countably stable, $\dim$ assigns the value of $0$ to every finite subset, and $\dim$ is regular in the sense that given any Borel set $E$ and any real number $t$ with $0 \leq t < \dim E,$ then there exists a compact set $K$ such that $K \subseteq E$ and $\dim K = t.$

Also, Olsen proved that the set for which the function is to be a local dimension function of can always be chosen to be an $F_{\sigma}$ set. In a Remark on p. 235 (that Olsen attributes to a referee -- see *Acknowledgements* at the end of the paper), he shows that $F_{\sigma}$ cannot be strengthened to "closed".

# Olsen's *punctured upper limit* and *punctured upper semicontinuous* notions

Olsen uses a non-deleted notion of $\limsup$ in which the value of the function is taken into account, and he uses the phrase *punctured upper limit* for the usual $\limsup$ notion in which the value of the function is not taken into account. For a simple example, if $f(x) = 0$ for $x \neq 0$ and $f(0) = 1,$ then the non-deleted $\limsup$ of $f$ at $x=0$ is $1$ and the delted $\limsup$ of $f$ at $x=0$ is $0.$ For a less simple example, if $T$ is the Thomae function, then at each nonzero rational $x$ the non-deleted $\limsup$ of $T$ is equal to $T(x) \neq 0$ and the deleted $\limsup$ of $T$ is equal to $0.$

In the case of upper semicontinuous, Olsen uses the standard definition in which at each point the value of the function is greater than or equal to the deleted $\limsup$ at that point. However, for his characterization of the local dimension function, Olsen requires a refinement of this, which he calls *punctured upper semicontinuous*. This is the property in which at each point the value of the function is equal to the deleted $\limsup$ at that point. In my summary above I have avoided this terminology and stated (1) directly in terms of the $\limsup$ operation (deleted version being understood, as that is the standard notion). Incidentally, one sometimes sees the phrase *upper boundary function* used for functions that satisfy (1).

Finally, if anyone is interested in continuity issues, I believe that any $F_{\sigma}$ first category (in the Baire sense) subset of ${\mathbb R}^{n}$ can be the discontinuity set for a dimension function, but I have not looked at this carefully. I do know that any such set can be the discontinuity set for a function satisfying (1) above. For some possible properties of sets that are $F_{\sigma}$ and first category, see my answer to How discontinuous can a derivative be?.

The less precise result that any such set can be the discontinuity set for an upper semicontinuous function is proved in *Proof Sketch* at Oscillation of a Function, but I believe the proof there needs to be modified to actually show the result for (1). However, the result for (1) is a consequence of the more precise results proved by Zbigniew Grande in *Quelques remarques sur la semi-continuité supérieure* [**Fundamenta Mathematicae** 126 (1985), pp. 1-13] and by Tomasz Natkaniec in *On semicontinuity points* [**Real Analysis Exchange** 9 (1983-844), pp. 215-232]. The issue I have not investigated is whether any such set can be the discontinuity set for a function satisfying both (1) and (2) above.

**[1]** Lars Olsen, *Applications of divergence points to local dimension functions of subsets of* ${\mathbb R}^{d}$, **Proceedings of the Edinburgh Mathematical Society** (2) 48 #1 (February 2005), 213-218. MR 2005m:28023; Zbl 1061.28004

**[2]** Lars Olsen, *Characterization of local dimension functions of subsets of* ${\mathbb R}^{d}$, **Colloquium Mathematicum** 103 #2 (2005), pp. 231-239. MR 2006j:28020; Zbl 1105.28007

Characterization of local dimension functions of subsets of${\mathbb R}^{d}$, Colloquium Mathematicum 103 #2, pp. 231-239. (This comment is late because I didn't see your question until just now.) $\endgroup$1more comment