Let $X \subseteq \mathbb{R}^n$ be a closed $d$-dimensional regular set (i.e. for any $x \in X$ and $0<r< \text{diam(X)}>$, $\mathscr{H}^d(B(x,r)) \sim r^d$ ) which has the property that for any $y \in \mathbb{R}^n \setminus X$, the closest points from $y$ to $X$ are of the form $z\_{\pm}=(y\_1,...,y\_{n-1},y\_{n} \pm r)$ where $r=\text{dist}(y,X)$. That is to say, the closest point is always above or below $y$.


I am trying to deduce something about the geometry of $X$ given the above properties. For example if this set has to be a union of $d$-planes.


Would really appreciate if there are some papers that deal with something like this - maybe studying the distance function and geometry of the set in general.



Distance function and geometry of the set
Since Pietro Majer definitely was right about the structure of the set but hasn't supplied a proof let me jump in with an elementary one. I think the problem is to specific to find a reference, but it might have occurred to others in some context unbeknownst to me.


**Lemma:** If the closest point in $X$ is always directly above and below then all connected components of $\mathbb{R}^n \setminus X$ are of the form $\mathbb{R}^{n-1} \times (a,b)$.


Pick a point $(\bar x\_0,x\_n) \in \mathbb{R}^n \setminus X$. We can assume wlog. that the closest point in $X$ is above (and that it is close than the one below by some margin). Define $$f^+\_{x\_n}: \mathbb{R}^{n-1} \to \mathbb{R}, \bar{x} \mapsto \inf \{s \geq 0: (\bar{x},x\_n+s) \in X\}.$$


Set $r := f^+\_{x\_n}(\bar{x}\_0) = \operatorname{dist}( (\bar x\_0 , x\_n),X) >0$. Now there is no point in $X$ closer to $(\bar x\_0,x\_n)$ than distance $r$, we know that $B\_r(\bar x\_0,x\_n) \cap X = \emptyset$. But translated to $f^+\_{x\_n}$ this means that for any $\bar x$ with $|\bar x - \bar x\_0| < r$ we have to have
$$f^+\_{x\_n}(\bar x) \geq \sqrt{r^2 - |\bar x - \bar x\_0|^2 }.$$


Next consider any point close to $(\bar x\_0,x\_n)$ with distance $r$ to $(\bar x\_0,x\_n +r)$, i.e. of the form $(\bar x, x\_n + r-\sqrt{r^2 - |\bar x - \bar x\_0|^2 })=: (\bar x,y\_n)$. Then we have $\operatorname{dist}( (\bar x, z\_n),X) \leq r$ and the closest point again needs to be above (otherwise the closest for $(\bar x,x\_n)$ would be below). But then this tells us that
$$f^+\_{x\_n}(\bar{x}) \leq 2r-\sqrt{r^2 - |\bar x - \bar x\_0|^2}.$$
But now the function $f^+\_{x\_n}$ is wedged between two $C^\infty$ functions which meet each other with derivative 0 at $\bar x\_0$, so we have to have $\nabla f^+\_{x\_n}(\bar{x}\_0) = 0$ as well. But the same works for any point at which $f^+\_{x\_n}$ is nonzero, which includes all $\bar{x}$ with $|\bar x - \bar x\_0| < r$. So $f^+\_{x\_n}(\bar{x}) = f^+\_{x\_n}(\bar x\_0) = r$ for all those $\bar x$. The same argument for some $y\_n < x\_n$, for which $(\bar x\_0,y\_n -r)$ is the closest point to $(\bar x\_0,y\_n)$ in $X$, gives us that a similarly defined $f^-\_{x\_n}$ is constant on the same ball around $\bar x\_0$ and then iterating the argument allows us to arbitrarly extend the domain on which this is true, which proves the lemma.


**Corollary:** This also works if the condition is only true for $ r < r\_0$ fixed, one just has to pick points close enough.


This then lets us give an **answer to the question**: The set $X$ will always be of the form $\mathbb{R}^{n-1} \times F$ for some closed set $F$. Thus if you additionally enforce $d$-dimensionality of $X$, you'll get that $F$ is $d-(n-1)$-dimensional, so in particular $X = \emptyset$ for $d < n-1$ and a countable union of isolated planes for $d=n-1$.


