Set of zeroes of the derivative of a pathological function
Solution 1:
I think the answer may not yet be known in general. In the case of a function $f$ that everywhere finitely differentiable (“finitely” can also be replaced with “finitely or infinitely”), the derivative of $f$ is a Baire $1$ function, and hence the zero set of $f’$ is a $\mathcal{G}_{\delta}$ set. (The inverse image of a closed set under a Baire $1$ function is a $\mathcal{G}_{\delta}$ set, and the zero set of a function is the inverse image of $\{0\}$.) However, not every $\mathcal{G}_{\delta}$ will be the zero set of some derivative. Zahorski [1] (see the italicized observation just after the Corollary on p. 43 of Zahorski [1]) gives a characterization of the zero sets of bounded derivatives. Zahorski’s characterization is that the complement of $E$ is the zero set for some bounded derivative if and only if ${\mathbb R} – E$ belongs to Zahorski’s $M_4$ class (see p. 25 of Bruckner/Leonard [2] for a definition).
Preiss [3] gave a characterization of the zero sets of derivatives for the following two larger collections of functions. (1) The derivatives of functions that are everywhere finitely differentiable $({\mathbb R} – E$ belongs to Preiss’ $M_{3}^{*}$ class). (2) The derivatives of functions that are everywhere finitely or infinitely differentiable $({\mathbb R} – E$ belongs to Preiss’ $M^{*}$ class). The definition of $M^{*}$ is given at the bottom of p. 178 of Preiss [3], and $M_{3}^{*} = M^{*} \cup M_{3}$ ($M_3$ is defined on p. 25 of Bruckner/Leonard [2]).
Possibly worth looking at, at least for your specific question of whether $X_{f}$ can be the set of irrational numbers, are Marcus [4] [5] and Bruckner [6].
In the general case where the derivative of $f$ may not exist everywhere, I think you can show $X_{f}$ is an $\mathcal{F}_{\sigma \delta}$ set by making use of the following results. If so, then $X_{f}$ sets could be characterized as a certain type of $\mathcal{F}_{\sigma \delta}$ set.
Given $f: {\mathbb R} \rightarrow {\mathbb R}$, let $Q(f)$ be the set of points at which $f$ does not have a finite derivative and let $Q^{*}(f)$ be the set of points at which $f$ does not have a finite or infinite derivative. Theorem 4 in Brudno [7] gives the following characterization of sets of the form $Q(f)$: Let $E \subseteq {\mathbb R}.$ Then there exists $f: {\mathbb R} \rightarrow {\mathbb R}$ such that $E = Q(f)$ if and only if $E$ can be written as $E = G \cup Z,$ where $G$ is a $\mathcal{G}_{\delta}$ set and $Z$ is a $\mathcal{G}_{\delta \sigma}$ Lebesgue measure zero set. Theorem 5 in Brudno [7] says that the previous result continues to hold if we replace $Q(f)$ with $Q^{*}(f).$ These results were also proved by Zahorski about this same time (see my answer at continuous functions are differentiable on a measurable set), who additionally (for the “if” direction) showed that $f$ can always be chosen to be continuous. See also p. 39 of Bruckner/Leonard [2].
[1] Zygmunt Zahorski, Sur la première dérivée [The first derivative], Transactions of the American Mathematical Society 69 (1950), 1-54. MR 12,247c; Zbl 38.20602
[2] Andrew Michael Bruckner and John Lander Leonard, Derivatives, American Mathematical Monthly 73 #4 (April 1966) [Part II: Papers in Analysis, Herbert Ellsworth Slaught Memorial Papers #11], 24-56. MR 33 #5797; Zbl 138.27805
[3] David Preiss, Level sets of derivatives, Transactions of the American Mathematical Society 272 (1982), 161-184. MR 83h:26009; Zbl 508.26001
[4] Solomon Marcus, Sur les propriétés différentielles des fonctions dont les points de continuité forment un ensemble frontière partout dense [On the differentiability properties of functions such that their points of continuity form a nowhere dense boundary set], Annales Scientifiques de l'École Normale Supérieure (3) 79 (1962), 1-21. MR 34 #2792; Zbl 105.04502
[5] Solomon Marcus, Sur les dérivées dont les zéros forment un ensemble frontière partout dense [On derivatives such that their zeros form a nowhere dense boundary set], Rendiconti del Circolo Matemàtico di Palermo (2) 12 (1963), 5-40. MR 29 #4844; Zbl 124.03202
[6] Andrew Michael Bruckner, On derivatives with a dense set of zeros, Revue Roumaine de Mathématiques Pures et Appliquées 10 #2 (1965), 149-153. MR 32 #1305; Zbl 138.27902
[7] Aleksandr L'vovich Brudno, Continuity and differentiability (Russian), Matematicheskii Sbornik (N.S.) 13(55) (1943), 119-134. MR 7,10a; Zbl 63.00636
English statements of the Brudno's 7 main theorems are given on p. 134. I note in passing that Theorem 1 on p. 124 was proved by William Henry Young in 1903. See the paper reviewed at JFM 34.0411.02, which can be found in google’s digitized copy of Volume 1 (1903-04) of Arkiv för matematik, astronomi och fysik.
Solution 2:
The answer to the first question is YES. In fact, one can show the following stronger statement :
THEOREM. There exists an increasing homeomorphism $f: [0,1] \to [0,1]$, such that $f'(q)=0$ for all $q\in {\mathbb Q}$ and any irrational $x\in [0,1]$ is contained in arbitrary small intervals $[u,v]$ with $\frac{f(v)-f(u)}{v-u} \geq 1$ (so that $f'(x)$, if defined, is $\geq 1$).
We use a familiar "inbreeding", piecewise and iterative construction, enumerating the rationals and imposing $f'(q)=0$ for each $q$ one by one, keeping at the same time a tight net of values $x,y$ such that $\frac{f(y)-f(x)}{y-x} \geq 1$. Formally :
DEFINITION. Let $f,g$ be two function $[a,b] \to {\mathbb R}$. We say that $(f,g)$ is a claw on $[a,b]$ when
(1) $f(a)=g(a),f(b)=g(b),f'(a)=g'(a)=f'(b)=g'(b)=0$ and
(2) $f(x)<g(x)$ when $a<x<b$.
If, in addition, one has
(3) For any $x\in ]a,b[$, there are $u<v$ in $]a,b[$ with $x\in [u,v]$, $\frac{f(v)-g(u)}{v-u} \geq 1$, then we say that $(f,g)$ is a tight claw.
FUNDAMENTAL LEMMA. If $(f,g)$ is any claw on $[a,b]$, then there is another claw $(F,G)$ with $f \leq F \leq G \leq g$ on $[a,b]$ and $(F,G)$ is tight. We may further impose that the supremum norm $||F-G||_{\infty}$ be $\lt \epsilon$ for $\epsilon$ as small as we want.
{\bf Proof of theorem using fundamental lemma}. We construct by induction two sequences $f_n,g_n$ of homeomorphisms $[0,1] \to [0,1]$ such that :
(i) $f_n \leq g_n$ on $[0,1]$
(ii) $(f_n,g_n)$ is a tight claw on each interval $I_{n,k}=[\frac{k}{n!},\frac{k+1}{n!}]$ for $0 \leq k\ \leq n!$.
(iii) $||f_n-g_n||_{\infty} \leq \frac{1}{n}$.
We start with $f_0(x)=4x^3-3x^4$ and $g_0(x)=3x^2-2x^3$. Suppose now that $(f_n,g_n)$ have already been constructed. The two maps $f_n$ and $g_n$ coincide on the finite set $X_n=\lbrace \frac{k}{n!} | 0 \leq k \leq n! \rbrace$. There is an increasing map $\phi : X_{n+1} \to [0,1]$, extending $f_{|X_n}=g_{|X_n}$, such that $f_n \lt \phi \lt g_n $ on $X_{n+1} \setminus X_n$.
On each interval $I_{n+1,k}$, there is a claw $(p_k,q_k)$ with $f_n \leq p_k \leq q_k \leq g_n$, and $p_k$ nad $q_k$ coincide with $\phi$ on the extremities of the interval. By fundamental lemma, there is a tight claw $(r_k,s_k)$ on $I_{n+1,k}$ with $p_k \leq r_k \leq s_k \leq q_k$, and $||r_k-s_k||_{\infty} \leq \frac{1}{n}$.
We may then take $f_{n+1}$ ($g_{n+1}$, respectively) to be the unique function that coincides with $r_k$ ($s_k$, respectively) on $I_{n+1,k}$. This completes the inductive construction.
Then by (i) and (iii) we have ${\sf sup}(f_n)={\sf inf}(g_n)$ ; let us call $f$ this function. Then $(f_n)$ nad $(g_n)$ converge uniformly towards $f$, and $f$ is a homeomorphism $[0,1] \to [0,1] $. We have for $x \in I_{n,k}$ and $q=\frac{k}{n!}$, and any $m\geq n$,
$$ f_m(q)=g_m(q)=f(q), \ \frac{f_n(x)-f(q)}{x-q} \leq \frac{f(x)-f(q)}{x-q} \leq \frac{g_n(x)-f(q)}{x-q} $$ whence $f'(q)=0$ on the right. Similarly, $f'(q)=0$ on the left.
The fundamental lemma can be shown from the following :
LEMMA 1. Let $(f,g)$ be a claw on $[a,b]$. Then there are three increasing sequences $(x_k)_{k\in \mathbb Z},(y_{1,k})_{k \in \mathbb Z}$ and $(y_{2,k})_{k \in \mathbb Z}$, with $$ {\sf lim}_{k \to -\infty} x_k=a, \ {\sf lim}_{k \to +\infty} x_k=b, \ $$
$$ {\sf lim}_{k \to -\infty} y_{1,k}={\sf lim}_{k \to -\infty} y_{2,k}=f(a)=g(a),\ {\sf lim}_{k \to +\infty} y_{1,k}={\sf lim}_{k \to +\infty} y_{2,k}=f(b)=g(b) $$
and $$ \frac{y_{1,k+2}-y_{2,k}}{x_{k+2}-x_k} \leq 1, f(x_k) \lt y_{1,k} \lt y_{2,k} <g(x_k), |y_{2,k}-y_{1,k}| \lt \epsilon $$
{\bf Proof of fundamental lemma from lemma 1.} Set $F(x_k)=y_{1,k}, G(x_k)=y_{2,k}$ for all $k\in \mathbb Z$ and interpolate in-between (take $F$ and $G$ affine on $[x_k,x_{k+1}]$, for instance).
Finally, lemma 1 follows from the iteration of
LEMMA 2. Let $(f,g)$ be a claw on $[a,b]$, and let $a',b'$ such that $a<a'<b'<b$. Then there are three increasing finite sequences $(x_k)_{|k| \leq M},(y_{1,k})_{|k| \leq M}$ and $(y_{2,k})_{|k| \leq M}$, with $$ x_{-M} \leq a', \ b' \leq x_{M} $$
$$ \frac{y_{1,k+2}-y_{2,k}}{x_{k+2}-x_k} \leq 1, f(x_k) \lt y_{1,k} \lt y_{2,k} <g(x_k), |y_{2,k}-y_{1,k}| \lt \epsilon $$