Function of bounded variation which is differentiable except on countable set Consider a function $g\in {\rm L}^1(0,1)$ such that $g\in {\rm BV}(0,1)$. I have two questions: 
Q1: If the classical derivative $g'$ exists almost everywhere on $(0,1)$, and if $g'=1$ almost everywhere on $(0,1)$, is it true that $g$ almost everywhere agrees with piece-wise affine function (with finitely many pieces) with slope $1$? 
Q2:  If the classical derivative $g'$ exists everywhere on $(0,1)$ except at countably many points in $(0,1)$, and if $g'=1$ except at countably many points in $(0,1)$, is it true that $g$ almost everywhere agrees with piece-wise affine function (with finitely many pieces) with slope $1$? 
I think the answer to Q1 is no. For instance, the counterexample in the case $g'=0$ almost everywhere is well-known Cantor's function or devil's staircase function, which is strictly increasing on $(0,1)$, and therefore belongs to ${\rm BV}(0,1)$, but such function is not piece-wise constant (with finitely many pieces). But I think that the answer to Q2 is yes. This would imply that such BV-functions allow at most finitely many jump-discontinuities. Is this really true? I do not know how to prove this. 
Remark. One of the issues is that we probably need to be specific when we introduce the space of BV-functions, and there are two approaches. One approach is to define that BV-function is a function with finite pointwise variation $V_0^1(g):={\rm sup}\{\sum|g(t_{j+1})-g(t_j)|\}$, where the supremum is taken over all finite sums with respect to finite partitions $0<t_1<...t_{j}<t_{j+1}<..<1$. Another approach is to require that points $(t_j)$ are points of approximate continuity of $g$, in which case we get the notion of essential variation ${\rm ess}V_0^1(g)$, so then BV-functions are defined as functions with finite essential variation. The latter definition is probably more convenient for $g\in {\rm L}^1(0,1)$, and the former for $g\in {\rm C}(0,1)$. But I do not know how to work with essential variation. In any case, I am interested in finding out if the answer to Q2 is yes, and why. Thanks in advance. 
 A: Here's a counterexample to both 1. and 2. Let $I_n = [1/(n+1),1/n),n = 1,2,\dots $ Define
$$g(x) = x+ \sum_{n=1}^{\infty}\frac{1}{2^n}\chi_{I_n}(x).$$
Then $g$ is increasing and bounded (by $3/2$) on $(0,1).$ Thus $g\in BV(0,1).$ Since $g(x) = x+1/2^n$ on $I_n,$ we have $g'(x)=1$ on each $(1/(n+1),1/n).$ Thus $g'(x)=1$ for all $x \in (0,1)\setminus \{1/2, 1/3, \dots\}.$ Clearly we have infinitely many pieces where $g$ is affine with slope $1.$
A: Here is Theorem 3.27 from Folland's textbook: 
c.) If $F\in BV$, then $F(x+):=\lim_{y↘x}F(y)$ and $F(x−):=\lim_{y↗x}F(y)$ exists for all $x∈\mathbf{R}$, 
d.) If $F\in BV$, the set of points at which $F$ is discontinuous is countable.
e.) If $F\in BV$ and $G(x):=F(x+)$, then $F′$ and $G′$ exist and are equal a.e.
Here BV-functions are defined in the sense of finite pointwise variation.
So, it appears that such BV-function in principle allows countable many jump-discontinuities. If we want to achieve that $g'=1$ except in countably many points, we could consider the following function $g$: consider a strictly decreasing sequence of real numbers $(a_k)$ in $(0,1)$ such that $\lim_{k\rightarrow+\infty}a_k=0$, and set $c_k:={1\over{2}}(a_k+a_{k+1})$. We set $g(c_k):=0$, $g'\vert_{(a_{k+1},a_k)}:=1$, so that $g$ is piece-wise affine function, with slope $1$ on each sub-interval $(a_{k+1},a_k)$. 
The question is then: Is $g$ BV-function on $(0,1)$. I guess it is, or maybe the answer depends on convergence of series $\sum_{k=1}^{\infty}a_k$? 
