Is the composition of a Sobolev function and a smooth function Sobolev? Let $\Omega \subseteq \mathbb{R}^n$ be an open bounded domain, and let $1<p<n$.  Suppose that $f \in W^{1,p}(\Omega)$ is continuous*, and $g \in C^{\infty}(\mathbb{R})$.
Is it true that $g \circ f \in W^{1,p}_{loc}(\Omega)$?
My guess was that the answer is positive, and that $\partial_i (g \circ f)(x)=g'(f(x)) \partial_i f(x)$ but a naive calculation to prove it failed.
*Note that the continuity of $f$ does not follow from $f \in W^{1,p}(\Omega)$, since $p<n$; this is an additional assumption I am adding.
 A: The answer is positive. Indeed, we have the following version of the chain rule in Sobolev spaces:

Assume $F : \mathbb{R} \to \mathbb{R}$ is $C^1$, with $F'$ bounded. Suppose $U$ is bounded and $u \in W^{1,p}(U)$ for some $1 \le p < \infty$. Then $$v :=F \circ u \in W^{1,p}(U) \quad \text{and the weak derivatives satisfy} \quad v_{x_i}=F'(u)u_{x_i}.$$

As stated this theorem does not help us. However, inspecting its proof we see that it only uses the following fact: 
There exist approximating functions $u_k \in C^{\infty}$ (i.e. $u_k \to u$ in $W^{1,p}$) such that $F'$ is bounded in a ball containing $\text{Image}(u_k),\text{Image}(u)$ for all sufficiently large $k$.
In our case, $u$ is continuous hence bounded on compact subsets. Hence, there are approximations $u_k$ which are also uniformly bounded for sufficiently large $k$. (Think of the standard density proof, via convolution with mollifiers). Recall we are only looking for a local result.
From here essentially the same proof should work. 
