The absolute value function $|\cdot|$ is elementary, but not differentiable? As usual, define the absolute value function $|\cdot|:\mathbb R \rightarrow \mathbb R$ by
$$|x| = \left\{
\begin{array}{ll}
      x & \text{for } x \geq 0,\\
      -x & \text{for } x < 0.\\
\end{array} \right.$$
Observe that the absolute value function can also defined by:
$$|x| = \sqrt {x^2}.$$
And so by ProofWiki's definition of elementary functions, the absolute value function is the composition of two elementary functions and is itself elementary.
According to Wikipedia, the set of elementary functions "is also closed under differentiation". I believe this implies the claim that every elementary function is differentiable. But I know that the absolute value function isn't.
What is the flaw/error in the above argument?

Addendum: I also found in Edwards and Larson (Calculus, 2018) the claim that "you can differentiate any elementary function".

 A: The Wikipedia article does not state that every elementary function is differentiable. I suppose that you read that is closed under differentiation and you thought that it meant that every elementary function is differentiable. But what it means is that if $f$ is elementary and differentiable, then $f'$ is elementary too.
A: Wikipedia doesn't say that elementary functions are differentiable everywhere. You don't even have to look at composites of elementary functions, just take the square root: it's not differentiable at zero.
However elementary functions are differentiable almost everywhere. Wikipedia is saying that if you take an elementary function and differentiate it where you can, you get back another elementary function. For the absolute value, you get $-1$ on $(-\infty,0)$ and $1$ on $(0,+\infty)$. Both are indeed elementary functions.
A: The problem arises at $x=0$ where the $\sqrt x$ is not differentiable.  
As the result the composite function$$|x| = \sqrt {x^2}$$ is not differentiable.
Otherwise there is no problem at $x\ne 0$ where both functions are differentiable.
A: Note that by the chain rule, the derivative of $x\mapsto \sqrt{x^2}$ is $x\mapsto 2x\cdot\frac{1}{2\sqrt{x^2}}$ and hence elementary. This indeed evaluates to $+1$ for $x>0$ and to $-1$ for $x<0$. However it is not defined at $x=0$, but neither is the certainly elementary function $x\mapsto \frac1x$.
Also note that at face value, the quoted definitions of elementary function include quotients of constants. So that would make $x\mapsto \frac 10$ and even $x\mapsto \frac 00$ elementary functions, won't it? Lesson learned: One has to be careful with the domains of the functions involved.
