How to extend a theorem about Hausdorff dimension of the non-differentiability set from the whole $\mathbb R^d$ to its open subsets? Let $X \subset \mathbb R^d$ be open, $f : X \to \mathbb R$ and
$$
E := \{x \in X : f \text{ is not Fréchet differentiable at }x\}.
$$
Then we have the following result which is

Theorem: If $X= \mathbb R^d$ and $f$ is convex, then the Hausdorff dimension of $E$ is at most $d-1$.

Differentiability is a local property, so I guess above theorem is true even though $X \neq \mathbb R^d$. Can we extend above theorem to obtain below one?

If $X$ is convex and $f$ is convex, then the Hausdorff dimension of $E$ is at most $d-1$.

 A: Let $V$ be the affine subspace generated by $X$. Let $d$ be the dimension of $V$.  Now, we have the inclusions
$$\mathring X\subset X \subset \bar X$$
where $\mathring X$ is the relative interior of $X$ ( that is, the interior of $X$ inside $V$). The boundary of $X$ has Hausdorff dimension at most $d-1$ ( got an answer about it on this site). So we can restrict to the problem $f \colon \mathring X\to \mathbb{R}$, that is, a function defined on an open convex set. From here we can reduce to the case $X=\mathbb{R}^d$.
$\bf{Added:}$ Let's see how the reduction to $\mathbb{R}^d$ works: consider $f\colon X \to \mathbb{R}$ convex, where $X\subset \mathbb{R}^d$ convex and open. Recall that for every $x \in X$ the graph of $f$ has a linear support at $x$, that is, there exists an affine map $L_x\colon \mathbb{R}^d\to \mathbb{R}$ such that $L_x(x) = x$ and $L_x(x') \le f(x')$ for all $x'\in X$. We can see that $f$ is the supremum of the family $(L_x)_{x\in X}$. Note that each $L_x$ is defined on the whole $\mathbb{R}^d$. Therefore, we can define $L\colon \mathbb{R}^d$ as
$$F= \sup_{x\in X} L_x$$
From the above, $F_{\mid X}= f$. Moreover, $F$ is convex, as a supremum of a family of convex functions ( in fact affine functions). Therefore, $F$ is an extension of $f$ to the whole $\mathbb{R}^d$.
Obs: It may be that $F$ has value $+ \infty$ at some points. Then we can extend in this way the restriction of $f$ to a smaller open set.
In this way, we can use the previous result about convex functions on the whole $\mathbb{R}^d$.
A: I formalize @orangeskid below. This is to enforce my understanding of convex functions.


*

*Lemma 1: Let $X  \subset \mathbb R^d$ be non-empty open convex. There is a sequence $(X_n)$ of bounded open convex sets such that $\overline{X_n} \subset X_{n+1}$ and $\bigcup_n X_n = X$.


*Lemma 2: Let $f : \mathbb R^d \to \mathbb R$ be convex and
$$
E := \{x \in \mathbb R^d \mid f \text{ is not Fréchet differentiable at }x\},
$$
then the Hausdorff dimension of $E$ is at most $d-1$.
Let $(X_n)$ be the sequence in the Lemma 1. It follows from $f$ is convex that $f$ is locally Lipschitz on $\overline{X_n}$.  Because $\overline{X_n}$ is compact, $f$ is Lipschitz on $\overline{X_n}$. So $f$ is Lipschitz on $X_n$. Thus $\partial f (X_n)$ is bounded. For each $x \in X_n$, we pick $x^* \in \partial f (x)$.
$$
h_n := \sup_{x \in X_n} x^* \quad \forall n \in \mathbb N.
$$
Clearly, $h_n:\mathbb R^d \to \mathbb R \cup \{+\infty\}$ is convex and $h_n (x) = f(x)$ for all $x \in X_n$. Let's prove that $h_n$ is real-valued. For $y \in \mathbb R^d$, we have
$$
h_n (y) = \sup_{x \in X_n} \langle x^*, y \rangle \le \sup_{x \in X_n} \|x^*\| \cdot |y| = |y|\sup_{x \in X_n} \|x^*\| < +\infty
$$
because $\partial f (X_n)$ is bounded. Hence $h_n:\mathbb R^d \to \mathbb R$. Let
$$
\begin{align}
E &:= \{x \in X \mid f \text{ is not Fréchet differentiable at }x\} \\
E_n &:= \{x \in X_n \mid f \text{ is not Fréchet differentiable at }x\} \\
E'_n &:= \{x \in \mathbb R^d \mid h_n \text{ is not Fréchet differentiable at }x\}.
\end{align}
$$
By Lemma 2, the Hausdorff dimension of $E'_n$ is at most $d-1$. Notice that $X_n$ is open and $f \restriction X_n = h_n {\restriction X_n}$, so $E_n \subset E'_n$. This implies the Hausdorff dimension of $E_n$ is at most $d-1$. Clearly, $E_n \nearrow E$, i.e., $E_{n} \subset E_{n+1}$ and $\bigcup_n E_n = E$. It follows that the Hausdorff dimension of $E$ is at most $d-1$.
