Let $M$ be a metric space.
For any subset $A\subset M$ let $\dim(A)$ denote its Hausdorff dimension.
For $x\in M$, define the dimension of $M$ at $x$ by $\dim(x)=\lim\_{r\to0}\dim(B(x,r))$; this limit exists because dimension depends monotonously on the set.
What can this dimension function look like?
Are there any results about dimension at a point?
I haven't heard or found any.


For example, what is known about the regularity of the dimension function?
Is $\dim:M\to[0,\infty]$ always upper semicontinuous?
Lower semicontinuity can fail, as can be seen by attaching a stick to a ball.
Or is it at least Borel measurable?


I gave one answer below to give an idea of what I might be interested in.
If you need to assume something more (like $M$ being a compact subset of a Euclidean space) or can say something about some other kind of dimension, feel free to do so.



How can dimension depend on the point?
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](https://en.wikipedia.org/wiki/Thomae%27s_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?](https://math.stackexchange.com/questions/112067/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](https://math.stackexchange.com/questions/933194/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}$](http://journals.cambridge.org/action/displayIssue?jid=PEM&volumeId=48&seriesId=2&issueId=01), **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}$](http://journals.impan.gov.pl/cm/Cont/cm103-2.html), **Colloquium Mathematicum** 103 #2 (2005), pp. 231-239. MR 2006j:28020; Zbl 1105.28007


