Bounded variation along given sequence of subdivisions 
Does there exist a continuous function $f:[0,1]\to\mathbb{R}$, along with a sequence $(\pi_n)_{n\geq 0}$ of subdivisions of $[0,1]$
  $$\pi_n\equiv\Big(0=t_0^n<t_1^n<\cdots <t_{p_n}^n=1\Big)$$
  with $\|\pi_n\|=\sup_{1\leq k\leq p_n}(t_{k}^n-t_{k-1}^n)\longrightarrow 0$ such that
  $$\sup_n V(\pi_n,f)<+\infty$$
  yet $f$ is not of bounded variation on $[0,1]$ ?

As usual,
$$V(\pi_n,f)=\sum_{k=1}^{p_n}|f(t^n_{k})-f(t^n_{k-1})|.$$

My guess is that such functions could exist, and I have an idea of how to construct one. The idea will be that $f$ will be expressed as a uniform limit of affine functions such that along well chosen subdivisions $\pi_n$, $f$ coïncides with well behaved functions of uniformly bounded total variation.
The following does not work, the sequence of functions does not converge uniformly, but maybe someone can find a modification that does, or provide a different solution (or a proof of the contrary).
Let me define
$$\forall n\geq 1,\quad f_n(x)=\frac{(-1)^{n-1}}{\lceil n/2\rceil}\cdot x(x-1)$$
These functions have uniformly bounded total variation :
$$\forall n\geq 1,\quad TV_{[0,1]}(f_n)\leq 1/2$$
me put $p_n=$ the $n$-th prime number : $p_1=2,p_2=3,\dots$ Let me define, for $n\geq 1$, and $k\in\lbrace 0,1,\dots,p_n\rbrace$
$$t^n_k:=\frac{k}{p_n}$$
and
$$\pi_n\equiv\Big(t^n_k\Big)_{k\in\lbrace 0,1,\,\dots\,,p_n\rbrace}$$
Then the idea would be to define affine functions $a_n$ by imposing


*

*$a_n$ is affine on every interval of the subdivision $\cup_{i=1}^n\pi_i=\Big(\frac{k}{p_1p_2\cdots p_n}\Big)_{k\in\lbrace 0,1,\,\dots\,,\,p_1p_2\cdots p_n\rbrace}$,

*for $n\geq 2$, $a_n$ coincides with $a_{n-1}$ on the vertices of the subdivision $\cup_{i=1}^{n-1}\pi_i$

*on the $t^n_k$, we have $a_n(t^n_k)=f_n(t^n_k)$.

*$f$ is the uniform limit of the $a_n$



As stated this does not work : the sequence $a_n$ does not converge uniformly. But I'm hopeful that there is a work around, although I can't quite find it yet. Maybe by asking that the $a_n$ only change outside of $[\epsilon_n,1-\epsilon_n]$ (for instance, in its current incarnation, one will have $\lim_{1/2^-}a=0\neq a(1/2)=1$, and this could be avoided if one didn't change the $a_n$ on $[\epsilon_n,1-\epsilon_n]$.
 A: Such a function and sequence of partitions don't exist. Suppose to the contrary that $f$ and $(\pi_n)$ had the desired properties, and
$$S = \sup_n V(\pi_n,f) < +\infty\,.$$
Since $f$ has unbounded variation, we can find a partition $\rho$, given by partition points
$$0 = r_0 < r_1 < \dotsc < r_{m-1} < r_m = 1$$
such that $V(\rho,f) > S + 1$. Let $\varepsilon \leqslant \lVert \rho\rVert/4$ so small that $\lvert x-y\rvert \leqslant \varepsilon$ implies $\lvert f(x) - f(y)\rvert < \frac{1}{4m}$. Then pick $n$ so large that $\lVert \pi_n\rVert < \varepsilon$. For $0 \leqslant \mu \leqslant m$, let $\ell_{\mu}$ be the largest point of $\pi_n$ not greater than $r_{\mu}$, and $u_{\mu}$ the smallest point of $\pi_n$ not smaller than $r_{\mu}$. Then
\begin{align}
\sum_{u_{\mu} \leqslant t^n_k < \ell_{\mu+1}} \lvert f(t^n_{k+1}) - f(t^n_k)\rvert &\geqslant \lvert f(\ell_{\mu+1}) - f(u_{\mu})\rvert \\
&\geqslant \lvert f(r_{\mu+1}) - f(r_{\mu})\rvert - \lvert f(r_{\mu+1}) - f(\ell_{\mu+1})\rvert - \lvert f(u_{\mu}) - f(r_{\mu})\rvert \\
&\geqslant \lvert f(r_{\mu+1}) - f(r_{\mu})\rvert - \frac{1}{2m}
\end{align}
for $0 \leqslant \mu < m$. Adding those, we find
$$V(\pi_n,f) \geqslant \sum_{\mu = 0}^{m-1}\sum_{u_{\mu} \leqslant t^n_k < \ell_{\mu+1}} \lvert f(t^n_{k+1}) - f(t^n_k)\rvert \geqslant \sum_{\mu = 0}^{m-1} \biggl(\lvert f(r_{\mu+1}) - f(r_{\mu})\rvert - \frac{1}{2m}\biggr) = V(\rho,f) - \frac{1}{2} > S\,,$$
contradicting the definition of $S$.
A: This is just me rewriting Daniel Fischer's answer and comment. The map $f$ is continuous.

Lemma. Let $\sigma$ be a subdivision of $[0,1]$
  and let $\epsilon>0$ be given.
  There exists $\delta>0$ such that for any subdivision $\pi$ of $[0,1]$,
  $$\|\pi\|\leq\delta\implies V(\sigma,f)\leq V(\pi,f)+\epsilon$$

Proof. Let $\sigma=(0=s_0<s_1<\cdots<s_{m-1}<s_m=1)$ be a subdivision of $[0,1]$. If $m=1$, there is nothing to prove, so assume $m\geq 2$.
By uniform continuity of $f$,
there exists $\delta>0$ such that
$$\forall~x,y\in[0,1],\Big(|x-y|\leq\delta\implies|f(x)-f(y)|\leq\frac{\epsilon}{2(m-1)}\Big)$$
Let $\pi=(0=t_0<t_1<\cdots<t_{n-1}<t_n=1)$
be a subdivision such that $\|\pi\|\leq\delta$.
Consider the subdivision $\sigma\cup\pi$.
Since it refines $\sigma$, one has
$$
V(\sigma,f)\leq V(\sigma\cup\pi,f)
$$
Let's set $\sigma\cup\pi=(0=u_0<u_1<\cdots<u_{N-1}<u_N=1)$,
and for all $0\leq k\leq n$, $t_k=u_{N_k}$. We will sum
$V(\sigma\cup\pi,f)$ in stages :
$$
V(\sigma\cup\pi,f)
=
\sum_{k=0}^{n-1}
\sum_{l=N_k}^{N_{k+1}-1}
|f(u_{l+1})-f(u_l)|
$$
and analyse the packets $\sum_{l=N_k}^{N_{k+1}-1}
|f(u_{l+1})-f(u_l)|$ separately :


*

*if $t_k$ and $t_{k+1}$ are consecutive in $\sigma\cup\pi$,
then
$$
\sum_{l=N_k}^{N_{k+1}-1}
|f(u_{l+1})-f(u_l)|
=
|f(t_{k+1})-f(t_k)|\,,
$$

*otherwise there are $0<a_k\leq b_k<m$ such that the
nodes of $\sigma\cup\pi$ between $t_k$ and $t_{k+1}$ are
precisely
$t_k<s_{a_k}<\cdots<s_{b_k}<t_{k+1}$.
Since $|t_{k+1}-t_k|\leq\|\pi\|\leq\delta$, we have
$$
\begin{array}{rcl}
\displaystyle
\sum_{l=N_k}^{N_{k+1}-1}
|f(u_{l+1})-f(u_l)|
& \leq &
\displaystyle
\frac{b_k-a_k+1+1}{2(m-1)}\epsilon \\
& = &
\displaystyle
\frac{\#\{a_k,\dots,b_k\}+1}{2(m-1)}\epsilon
\end{array}
$$


Since the $(\{a_k,\dots,b_k\})_k$ are pairwise
disjoint subsets of $\{1,\dots,m-1\}$, there
are at most $m-1$ non empty ones, and the sum
of their cardinalities is at most $m-1$. Hence
$$V(\sigma\cup\pi,f)\leq V(\pi,f)+\epsilon$$
This is an illustration of the idea :



Proposition
  Let $f$ be continuous on $[0,1]$. Then $f$ is
  of bounded variation iff there exists a sequence
  $(\pi_n)$ of subdivisions with $\|\pi_n\|\to0$ and
  $C=\sup_n V(\pi_n,f)<+\infty$. Furthermore, given such
  a sequence,
  $$
TV(f)
=
\lim_n
V(\pi_n,f).
$$

Proof. Let $\sigma$ be a subdivision of $[0,1]$.
By the preceding lemma, and since $\|\pi_n\|\to0$, there
exists $n_0\geq 0$ such that for all $n\geq n_0$,
$$
\begin{array}{rcl}
V(\sigma,f) & \leq & V(\pi_n,f)+1 \\
& \leq & C+1
\end{array}
$$
so that $f$ has bounded variation.
Let $\epsilon>0$. Again by the lemma, there exists $N$
such that 
for all $n\geq N$,
$
V(\sigma,f) \leq V(\pi_n,f)+\epsilon
$
and thus
$$
\begin{array}{rcl}
V(\sigma,f) & \leq & \displaystyle \inf_{n\geq N}V(\pi_n,f)+\epsilon \\
& \leq & \displaystyle \liminf_{n}V(\pi_n,f)+\epsilon
\end{array}
$$
Since $\sigma$ and $\epsilon >0$ are arbitrary, we get
$$TV(f) \leq \liminf_{n}V(\pi_n,f)$$
On the other hand,
$$\limsup_{n}V(\pi_n,f)\leq TV(f)$$
so that
$$
TV(f)
=
\liminf_{n}V(\pi_n,f)
=
\limsup_{n}V(\pi_n,f)
=
TV(f)
$$
and $V(\pi_n,f)$ converges to $TV(f)$.

To my surprise, the analoguous property for 
quadratic variation fails miserably. This is
discussed after Corollary 2.5 in
On a class of generalized Takagi functions
with linear pathwise quadratic variation.
The situation is much more complicated,
and I might ask a question about it later.
A: This is just tying up the loose ends from the comments in Daniel Fischer's answer.

Let $f:[0,1]\to\mathbb{R}$ be a function. Let us say that $x_0\in[0,1]$ is a good point if $f$ has both left and right limits at $x_0$ :
$$f(x_0^-)=\lim_{\substack{x\to x_0\\x<x_0}}f(x)
\quad\text{and}\quad
f(x_0^+)=\lim_{\substack{x\to x_0\\x>x_0}}f(x)$$
both exist and are finite (we set $f(0^-):=f(0)$ and $f(1^+):=f(1)$. Define the total jump of $f$ at $x_0$ as
$$J(x_0,f)=|f(x_0)-f(x_0^-)|+|f(x_0)-f(x_0^+)|.$$
Given a good subdivision $\sigma=(0=s_0<s_1<\cdots<s_{m-1}<s_m=1)$ of $[0,1]$, that is all the $s_k$ are good points, we define
$$J(\sigma,f)=\sum_{k=0}^mJ(s_k,f).$$

Lemma. Let $\sigma$ be a good subdivision of $[0,1]$. Then
  $$
\forall~\epsilon>0,~\exists~\delta>0,\forall~\pi\in\mathfrak{S}[0,1],~\Big(\|\pi\|<\delta\implies V(\sigma,f)\leq V(\pi,f)+J(\sigma,f)+\epsilon\Big)
$$

Here $\mathfrak{S}[0,1]$ is the set of all subdivisions of $[0,1]$, partially ordered by refinement.
Proof. Let $\epsilon>0$ be given. Since $\sigma=(0=s_0<s_1<\cdots<s_{m-1}<s_m=1)$ is a good subdivision of $[0,1]$, there exists $\delta_0>0$ such that for all $k\in\lbrace 1,\dots,m\}$ and for all $x\in[0,1]$
$$s_k-\delta_0<x<s_k\implies |f(x)-f(s_k^-)|<\frac\epsilon{2m}$$
and for all $k\in\lbrace 0,\dots,m-1\}$ and for all $x\in[0,1]$
$$s_k<x<s_k+\delta_0\implies |f(x)-f(s_k^+)|<\frac\epsilon{2m}$$
Set $\delta_1=\inf_{k=0,\dots,m}|s_{k+1}-s_k|$, and $\delta=\min\{\delta_0,\delta_1\}$.
Now let $\pi=(0=t_0<t_1<\cdots< t_{n-1}<t_n=1)\in \mathfrak{S}[0,1]$ be a subdivision such that $\|\pi\|<\delta$. Consider the subdivision $\sigma\cup\pi$ : since it is a refinement of $\sigma$, one has
$$
V(\sigma,f)\leq V(\sigma\cup\pi,f)
$$


*

*Since $\|\pi\|<\delta_1$, for every $0\leq k<m$ there exists
$0<l<n$ with $s_k<t_l<s_{k+1}$.

*For $0\leq k<m$, define $0<a_k\leq b_k<m$ such that $a_k\leq l\leq b_k \iff s_k<t_l<s_{k+1}$.


Then
$$
V(\sigma\cup\pi,f)
=
\sum_{k=0}^{m-1}
\left(
|f(s_k)-f(t_{a_k})|
+
\sum_{a_k\leq l<b_k}
|f(t_{l+1})-f(t_{l})|
+
|f(s_{k+1})-f(t_{b_k})|
\right)
$$
Now for all $0\leq k<m$, $|f(s_k)-f(t_{a_k})|\leq|f(s_k)-f(s_k^+)|+|f(s_k^+)-f(a_k)|$ and since $\|\sigma\cup\pi\|\leq \|\pi\|<\delta_0$, we get $|f(s_k^+)-f(a_k)|<\frac\epsilon{2m}$ (and similarly for $|f(s_{k+1})-f(t_{b_k})|$), thus
$$V(\sigma\cup\pi,f)\leq 
V(\pi,f)+J(\sigma,f)+\epsilon$$

It is known that any real valued function $[0,1]\to\mathbb{R}$ can only have countably many jump discontinuities. Thus, define, for any real valued function $f:I\to\mathbb{R}$ defined on some interval $I$
$$
J(f)=
\sum_{x}
J(x,f)
$$
where the sum is taken over the set of jump discontinuities of $f$.
Furthermore, it is known that a function has both a left and a right limit at all points iff it is regulated. Since monotone functions are regulated, and any function of bounded variation can be expressed as a sum of monotone functions, all functions of bounded variation are regulated. Also, one verifies that for a function of bounded variation $f$,
$$J(f)\leq TV(f)<+\infty$$
Hence all functions of bounded variation are regulated and have finite $J$. 

Proposition. Let $f:[0,1]\to\mathbb{R}$ be a regulated function such that $J(f)<+\infty$. Suppose there exists a sequence of subdivisions $(\pi_n)_{n\geq 0}$ with $\|\pi_n\|\to 0$ and $C=\sup_n V(\pi_n,f)<+\infty$, then $f$ is of bounded variation.

Proof. Let $\sigma$ be a subdivision of $[0,1]$. Since $f$ is regulated, it is a good subdivision. By the lemma, there exists $\delta>0$ such that
for any subdivision $\pi$ with $\|\pi\|<\delta$,
$$
V(\sigma,f)\leq V(\pi,f)+J(\sigma,f)+1
$$
Since $\|\pi_n\|\to 0$, there exists $N$ with $\|\pi_N\|<\delta$. Thus
$$
\begin{array}{rcl}
V(\sigma,f) & \leq & V(\pi_N,f)+J(\sigma,f)+1 \\
& \leq & C+J(f)+1.
\end{array}
$$
and $f$ has finite variation.
