# Existence of an antiderivative for a continuous function on an arbitrary subset of $\mathbb{R}$ [duplicate]

Let $f$ be a continuous function on a set $I\subset \mathbb{R}$. Does there always exist a function $F$ differentiable on an open set $J$ containing $I$ such that $F'=f$ on $I$ ?

The case where J is an interval has been studied in this thread Existence of antiderivative on a part $I$ of $\mathbb{R}$

• Almost a direct repost of this question last hour. – user296602 Jul 16 '18 at 16:33
• but now J is an open set – cerise Jul 16 '18 at 16:34

Hint: There exists a strictly increasing function $f:\mathbb R \to \mathbb R$ that is continuous at each irrational, and discontinuous at each rational. Let $I$ be the irrationals. So we have $f$ continuous on $I.$ Show that if there were such an $F$ on an open $J$ containing $I,$ then $F'$ would violate the Darboux property on each connected component of $J.$
Added later: Here is such a function: Set $g(x) = 0$ for $x<0,$ $g(x) = 1$ for $x\ge 0.$ Let $r_1,r_2,\dots$ be the rationals. For $x\in \mathbb R ,$ define
$$f(x) = \sum_{n=1}^{\infty}\frac{g(x-r_n)}{2^n}.$$
• No, not all. Thomae function is $0$ on the irrationals. – zhw. Jul 16 '18 at 20:13