If $g:\mathbb R\to\mathbb R$ is differentiable, how can we show that $$h(z):=\min\left(1,e^{g(z)}\right)\;\;\;\text{for }z\in\mathbb R$$ is also differentiable, except at a countable number of points, with derivative given Lebesgue almost everywhere by the function $$z\ni\mathbb R\mapsto\begin{cases}g'(z)e^{g(z)}&\text{, if }g(z)<0\\0&\text{, if }g(z)\ge0\end{cases}?\tag1$$


It's clear to me that $\min:\mathbb R^2\to\mathbb R$ is partially differentiable in both arguments, except on the diagonal $\Delta:=\left\{(x,x):x\in\mathbb R\right\}$ (which clearly has Lebesgue measure $0$). However, it's not clear to me why $h$ is differentiable except on a countable set.


*Remark 1*: I'm aware of [Rademacher's theorem](https://en.wikipedia.org/wiki/Rademacher%27s_theorem), which yields that $\mathbb R\ni x\mapsto\min(1,e^x)$ is differentiable Lebesgue almost everywhere (noting that this function is Lipschitz continuous). But this doesn't immediately yield that the derivative of $h$ is as claimed and it doesn't yield that the null set is countable.


*Remark 2*: We may note that the Lipschitz continuity implies absolutely continuity. So, maybe this is related to this Wikipedia entry: <https://en.wikipedia.org/wiki/Absolute_continuity#Equivalent_definitions>. But again, this result seems only to yield Lebesgue almost everywhere differentiability, but not the concrete shape of the derivative.


**EDIT**: We know that $$\frac{\rm d}{{\rm d}x}\min(1,e^x)=\left.\begin{cases}e^x&\text{, if }x<0\\0&\text{, if }x>0\end{cases}\right\}\;\;\;\text{for all }x\in\mathbb R.\tag2$$ So, the problematic set seems to be $\left\{x\in\mathbb R:g(x)=0\right\}$, which doesn't need to be countable ... The claim can be found [here on page 12](https://pdf.sciencedirectassets.com/271499/1-s2.0-S0304414900X00725/1-s2.0-S0304414900000417/main.pdf?x-amz-security-token=AgoJb3JpZ2luX2VjEIf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJIMEYCIQC9SpxY2MLyWQey6Dhgdjd93GyzroZPHJUaR1MCwECA7QIhAPgsWwwZEA58coPlqav92fXLtqEv3Odw%2Fef8WCNfwFSHKtoDCG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013ac2b2430a89b270f6af2c76d8dfd086a07176afe7c76c2c61&pii=S0304414900000417&tid=spdf-677a2814-945f-432c-b8db-fad0944c8bed&sid=e8689e94643dd6487d9ba8f6e98ea1a27122gxrqb&type=client).



If $g$ is differentiable, how can we show that $z\mapsto1\wedge e^{g(z)}$ is differentiable except on a countable set
Yes, it is true. Since $2\min(a,b)=a+b-|b-a|$ for positive numbers $a,b$, and $F(z)=e^{g(z)}-1$ is differentiable, it suffices to prove that $|F|$ is differentiable except at a countable set of points. Namely, this exceptional set is a set of isolated zeroes of $F$ (or, better to say, a subset of the set of isolated zeroes). Indeed, if $F(x)\ne 0$, of course $|F|$ is differentiable at $x$. If $F(x)=0$ and $F'(x)=0$, then $(|F|)'(x)=0$, since $|F(x+t)|-|F(x)|=|0+o(t)|-|0|=o(t)$ for small $t$. All points which remain are isolated zeroes of $h$, there are at most countably many of them. 


