Chain-rule and change of variables in BV/Sobolev A lot of results are available for the following chain-rule problem: 
(CRP1) Let $f\colon \mathbb R \to \mathbb R$ be a $C^1$/Lipschitz function and let $g \colon \mathbb R^d \to \mathbb R$ be a weakly differentiable function (e.g. $W_{\rm loc}^{1,p}$ or $BV_{\rm loc}$). Then the function $f \circ g$ is weakly differentiable as well and explicit chain rule formulas hold, like for instance in the Sobolev setting 
$$
(f \circ g)'(x) = f'(g(x)) g'(x)
$$
a.e. with respect to Lebesgue measure (with some standards caveat when $f$ is Lipschitz). 
I am wondering for the other way round, i.e. 
(CRP2) Let $f\colon \mathbb R \to \mathbb R^d$ be a $C^1$/Lipschitz function and let $g \colon \mathbb R^d \to \mathbb R$ be a weakly differentiable function (e.g. $W_{\rm loc}^{1,p}$ or $BV_{\rm loc}$). What can we say about the function $g \circ f \colon \mathbb R \to \mathbb R$? For instance in the Sobolev setting it seems to me that the formula 
$$
(g \circ f)'(x) = \nabla g(f(x)) \cdot f'(x)
$$
(a.e. with respect to Lebesgue measure) makes sense, doesn't it? Are there any references about this topic? 
Thanks. 
 A: Your formula can be wrong even if $f$ and $g$ are both Lipschitz. For criteria when such a result holds (and related results) see e.g. Leoni, Giovanni, Morini, Massimiliano: Necessary and sufficient conditions for the chain rule in $W^{1,1}_{loc}(ℝ^N;ℝ^d)$ and $BV_{loc}(ℝ^N;ℝ^d)$. J. Eur. Math. Soc. (JEMS) 9 (2007). https://mathscinet.ams.org/mathscinet-getitem?mr=2293955
They give the counterexample $g(y_1,y_2)=\max(y_1,y_2)$, $f(x)=(x,x)$, where the right hand side is nowhere defined as $f'(x)=(1,1)$ everywhere but $g$ is not differentiable at $y_1=y_2$. 
A: Here is a related example from:
P. Hajlasz, Sobolev mappings: Lipschitz density is not a bi-Lipschitz invariant of the target. Geom. Funct. Anal. 17 (2007), 435-467.
Theorem. There is a Lipschitz function 
$\varphi\in {\rm Lip}\, (\mathbb{R}^2)$
with compact support such that the bounded operator
$\Phi:W^{1,p}([0,1],\mathbb{R}^2)\to W^{1,p}([0,1])$ defined as
composition $\Phi(u)=\varphi\circ u$ is not continuous for any $1\leq
p<\infty$.
The operator is bounded in the sense that the Sobolev norm of $\varphi\circ u$ is bounded by constant times that of $u$. However, the operator is not continuous as a mapping between Banach spaces $W^{1,p}([0,1],\mathbb{R}^2)$ and $W^{1,p}([0,1])$.
However as was proved in
M. Marcus,V. J. Mizel, Every superposition operator mapping one Sobolev space
into another is continuous. J. Funct. Anal. 33 (1979), 217-229,
the composition operator in the case in which $\varphi$ is a Lipschitz function on $\mathbb{R}$ is continuous.
Another reference for understanding the chain rule for Sobolev and BV functions is:
Ambrosio, L.; Dal Maso, G. A general chain rule for distributional derivatives. Proc. Amer. Math. Soc. 108 (1990), no. 3, 691-702.
