SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\begin{array}{l} h _ {i _ {0} - 1} \left(t \left(s _ {i _ {0} - 1}, s _ {i _ {0}}\right) + (1 - t) \left(s _ {i _ {0} - 1} ^ {\prime}, s _ {i _ {0}} ^ {\prime}\right)\right) \leq t h _ {i _ {0} - 1} \left(s _ {i _ {0} - 1}, s _ {i _ {0}}\right) + (1 - t) h _ {i _ {0} - 1} \left(s _ {i _ {0} - 1} ^ {\prime}, s _ {i _ {0}} ^ {\prime}\right) (32) \\ = h _ {i _ {0} - 1} \left(s _ {i _ {0} - 1}, s _ {i _ {0}}\right). (33) \\ \end{array}
$$
The whole segment joining  $(s_{i_0 - 1}, s_{i_0})$  and  $(s_{i_0 - 1}', s_{i_0}')$  is then a minimiser. Without loss of generality, we can thus assume that both  $s_{i_0}$  and  $s_{i_0 - 1}'$  are on the same side of  $\delta_{i_0 - 1}$  (e.g. smaller than  $\delta_{i_0 - 1}$ ) and both  $s_{i_0}$  and  $s_{i_0}'$  are on the same side of  $\delta_{i_0}$ .
Moreover, Equation (33) implies an equality on  $g_{i_0}$  that leads to the colinearity of the vectors  $(s_{i_0 - 1} - \delta_{i_0 - 1}, s_{i_0} - \delta_{i_0 - 1})$  and  $(s_{i_0 - 1}' - \delta_{i_0 - 1}, s_{i_0}' - \delta_{i_0 - 1})$ . In particular, both  $s_{i_0} \neq s_{i_0}'$  and
$s_{i_0 - 1} \neq s_{i_0 - 1}'$ . Moreover, we have equality cases on both  $c_{i_0 - 1}$  and  $c_{i_0}$  implying, thanks to the first point of Lemma 7
$$
\left| c _ {i _ {0} - 1} \left(s _ {i _ {0} - 1}\right) - c _ {i _ {0} - 1} \left(s _ {i _ {0} - 1} ^ {\prime}\right) \right| = \sqrt {1 + x _ {i _ {0} - 1} ^ {2}} \left| s _ {i _ {0} - 1} - s _ {i _ {0} - 1} \right| \tag {34}
$$
$$
| c _ {i _ {0}} (s _ {i _ {0}}) - c _ {i _ {0}} (s _ {i _ {0}} ^ {\prime}) | = \sqrt {1 + x _ {i _ {0}} ^ {2}} | s _ {i _ {0}} - s _ {i _ {0}} |.
$$
For  $u = (x_{i_0 - 1}, 1)$  and  $v = (x_{i_0}, 1)$ , we have by (positive) colinearity of  $(s_{i_0 - 1} - \delta_{i_0 - 1}, s_{i_0} - \delta_{i_0 - 1})$  and  $(s_{i_0 - 1}' - \delta_{i_0 - 1}, s_{i_0}' - \delta_{i_0 - 1})$ :
$$
\begin{array}{l} | g _ {i _ {0}} (s _ {i _ {0}}, s _ {i _ {0} - 1}) - g _ {i _ {0}} (s _ {i _ {0}} ^ {\prime}, s _ {i _ {0} - 1} ^ {\prime}) | = \left| \| (s _ {i _ {0}} - \delta_ {i _ {0} - 1}) v - (s _ {i _ {0} - 1} - \delta_ {i _ {0} - 1}) u \| - \| (s _ {i _ {0}} ^ {\prime} - \delta_ {i _ {0} - 1}) v - (s _ {i _ {0} - 1} ^ {\prime} - \delta_ {i _ {0} - 1}) u \| \right| \\ = \left\| \left(s _ {i _ {0}} - s _ {i _ {0}} ^ {\prime}\right) v - \left(s _ {i _ {0} - 1} - s _ {i _ {0} - 1} ^ {\prime}\right) u \right\|. \\ \end{array}
$$
Since  $s_{i_0} \neq s_{i_0}'$  and  $s_{i_0 - 1} \neq s_{i_0 - 1}'$ , the triangle inequality gives both strict inequalities
$$
\left| \sqrt {1 + x _ {i _ {0}} ^ {2}} | s _ {i _ {0}} - s _ {i _ {0}} ^ {\prime} | - \sqrt {1 + x _ {i _ {0} - 1} ^ {2}} | s _ {i _ {0} - 1} - s _ {i _ {0} - 1} ^ {\prime} | \right| <   | g _ {i _ {0}} (s _ {i _ {0}}, s _ {i _ {0} - 1}) - g _ {i _ {0}} (s _ {i _ {0}} ^ {\prime}, s _ {i _ {0} - 1} ^ {\prime}) |,
$$
$$
\sqrt {1 + x _ {i _ {0}} ^ {2}} | s _ {i _ {0}} - s _ {i _ {0}} ^ {\prime} | + \sqrt {1 + x _ {i _ {0} - 1} ^ {2}} | s _ {i _ {0} - 1} - s _ {i _ {0} - 1} ^ {\prime} | > | g _ {i _ {0}} (s _ {i _ {0}}, s _ {i _ {0} - 1}) - g _ {i _ {0}} (s _ {i _ {0}} ^ {\prime}, s _ {i _ {0} - 1} ^ {\prime}) |.
$$
Using this with Equation (34), this yields
$$
g _ {i _ {0}} (s _ {i _ {0}}, s _ {i _ {0} - 1}) - g _ {i _ {0}} (s _ {i _ {0}} ^ {\prime}, s _ {i _ {0} - 1} ^ {\prime}) \neq c _ {i _ {0}} (s _ {i _ {0}}) - c _ {i _ {0}} (s _ {i _ {0}} ^ {\prime}) + c _ {i _ {0} - 1} (s _ {i _ {0} - 1}) - c _ {i _ {0} - 1} (s _ {i _ {0} - 1} ^ {\prime}).
$$
This contradicts the fact that  $(s_{i_0 - 1}, s_{i_0})$  and  $(s_{i_0 - 1}', s_{i_0}')$  both minimise Equation (31). Hence, Equation (31) admits a unique minimiser.
Also the minimisation problem
$$
\min  _ {s _ {i + 1} \in S _ {i} (\tilde {s} _ {i})} g _ {i + 1} (s _ {i + 1}, \tilde {s} _ {i}) + c _ {i + 1} (s _ {i + 1})
$$
admits a unique minimiser for any  $i \in \{i_0, \dots, n - 1\}$ . Indeed, either  $\tilde{s}_i = \delta_i$  in which case the constraint set is a singleton, or the function  $s_{i + 1} \mapsto g_{i + 1}(s_{i + 1}, \tilde{s}_i)$  is strictly convex for  $\tilde{s}_i \neq \delta_i$ . A symmetric argument exists for the minimisation problem of Equation (28). It thus concludes the proof of Theorem 2.
Let  $i \in \{i_0, \dots, n - 1\}$ . Recall that
$$
s _ {i + 1} ^ {*} = \operatorname * {a r g m i n} _ {s _ {i + 1} \in S _ {i} (s _ {i} ^ {*})} g _ {i + 1} (s _ {i + 1}, s _ {i} ^ {*}) + c _ {i + 1} (s _ {i + 1}).
$$
If  $i = n - 1$ , the objective is obviously minimised for  $s_i^* = \delta_{n-1}$  as both  $x_{n-1}$  and  $x_n$  are positive. Otherwise, assume for example that  $s_i^* > \delta_i$ . Thanks to Lemma 7, the objective is decreasing on  $(- \infty, \min(\delta_i, \delta_{i+1})]$  and  $S_i(s_i^*) = [\delta_i, +\infty)$  which yields that  $s_{i+1}^* \in [\min(\delta_i, \delta_{i+1}), \delta_i] \subset [\min(\delta_i, \delta_{i+1}), \max(\delta_i, \delta_{i+1})]$ . The case  $s_i^* = \delta_i$  is trivial and similar arguments hold for  $s_i^* < \delta_i$ .
Now consider  $i = i_0 - 1$ . Assume first that  $s_{i_0 - 1}^* > \delta_{i_0 - 1}$ , then
$$
s _ {i _ {0}} ^ {*} = \operatorname * {a r g m i n} _ {s _ {i _ {0}} <   \delta_ {i _ {0} - 1}} g _ {i _ {0}} (s _ {i _ {0}}, s _ {i _ {0} - 1} ^ {*}) + c _ {i _ {0}} (s _ {i _ {0}}).
$$
Thanks to the last point of Lemma 7
$$
c _ {i _ {0}} \left(s _ {i _ {0}}\right) - c _ {i _ {0}} \left(s _ {i _ {0}} ^ {\prime}\right) \geq \frac {1 + x _ {i _ {0}} x _ {i _ {0} + 1}}{\sqrt {1 + x _ {i _ {0} + 1} ^ {2}}} \left(s _ {i _ {0}} - s _ {i _ {0}} ^ {\prime}\right) \quad \text {f o r a n y} s _ {i _ {0}} <   s _ {i _ {0}} ^ {\prime} \leq \delta_ {i _ {0}}. \tag {35}
$$
Note that the function
$$
h: \qquad \begin{array}{c} (- \infty , \delta_ {i _ {0} - 1} ] \to \mathbb {R} _ {+} \\ s \mapsto g _ {i _ {0}} (s, s _ {i _ {0} - 1} ^ {*}) \end{array}
$$
is convex and verifies  $h'(\delta_{i_0 - 1}) = -\frac{1 + x_{i_0 - 1}x_{i_0}}{\sqrt{1 + x_{i_0 - 1}^2}}$ . Since  $x_{i_0 - 1} < 0 \leq x_{i_0 + 1}$ , it comes
$$
- \frac {1 + x _ {i _ {0} - 1} x _ {i _ {0}}}{\sqrt {1 + x _ {i _ {0} - 1} ^ {2}}} \leq x _ {i _ {0}} \leq \frac {1 + x _ {i _ {0}} x _ {i _ {0} + 1}}{\sqrt {1 + x _ {i _ {0} + 1} ^ {2}}}.
$$
Thanks to Equation (35), the function  $s_{i_0} \mapsto g_{i_0}(s_{i_0}, s_{i_0 - 1}^*) + c_{i_0}(s_{i_0})$  is thus decreasing on  $(-\infty, \min(\delta_{i_0 - 1}, \delta_{i_0})]$ . As above, this implies that  $s_{i_0}^* \in [\min(\delta_{i_0 - 1}, \delta_{i_0}), \max(\delta_{i_0 - 1}, \delta_{i_0})]$ . The case  $s_{i_0 - 1}^* = \delta_{i_0 - 1}$  is trivial and similar arguments hold if  $s_{i_0 - 1}^* < \delta_{i_0 - 1}$ .
We showed  $s_{i+1}^* \in [\min(\delta_i, \delta_{i+1}), \max(\delta_i, \delta_{i+1})]$  for any  $i \in \{i_0, \dots, n\}$ . Symmetric arguments hold for  $i \in [i_0 - 1]$ . This concludes the proof of Lemma 3.
E.3 Proof of Lemma 4
Let us first prove that any sparsest interpolator  $f$  has at least a number of kinks given by the right sum. For that, we actually show that for  $k \geq 1$ , on any interval  $(x_{n_k - 1}, x_{n_{k + 1}})$  with  $\delta_{n_k - 1} \neq \delta_{n_k}$ ,  $f$  has at least  $\left\lceil \frac{n_{k + 1} - n_k}{2} \right\rceil$  kinks, whose signs are given by  $\mathrm{sign}(\delta_{n_k} - \delta_{n_{k - 1}})$ . Consider any  $k \geq 1$  such that  $\delta_{n_k - 1} \neq \delta_{n_k}$ . Assume w.l.o.g. that  $\delta_{n_k - 1} < \delta_{n_k}$ . By the definition of Equation (10):
$$
\delta_ {j} > \delta_ {j - 1} \quad \text {f o r a n y} j \in \{n _ {k}, \dots , n _ {k + 1} - 1 \}.
$$
Obviously,  $f$  must count at least one positive kink on each interval of the form $^{14}$  ( $x_{j-1}, x_{j+1}$ ) for any  $n_k \leq j \leq n_{k+1} - 1$ . Note that we can build  $\left\lceil \frac{n_{k+1} - n_k}{2} \right\rceil$  disjoint such intervals. Thus,  $f$  has at least  $\left\lceil \frac{n_{k+1} - n_k}{2} \right\rceil$  positive kinks on  $(x_{n_k-1}, x_{n_{k+1}})$ .
The intervals of the form  $(x_{n_k - 1}, x_{n_{k + 1}})$  with  $\delta_{n_k - 1} < \delta_{n_k}$  are disjoint by definition. As a consequence,  $f$  has a total number of positive kinks at least
$$
\sum_ {k \geq 1} \left\lceil \frac {n _ {k + 1} - n _ {k}}{2} \right\rceil \mathbb {1} _ {\delta_ {n _ {k} - 1} <   \delta_ {n _ {k}}}.
$$
Similarly,  $f$  has a total number of negative kinks at least
$$
\sum_ {k \geq 1} \left\lceil \frac {n _ {k + 1} - n _ {k}}{2} \right\rceil \mathbb {1} _ {\delta_ {n _ {k} - 1} > \delta_ {n _ {k}}},
$$
which leads to the first part of Lemma 4
$$
\min_{\substack{f\\\forall i,f(x_{i}) = y_{i}}}\| f^{\prime \prime}\|_{0}\geq \sum_{k\geq 1}\left\lceil \frac{n_{k + 1} - n_{k}}{2}\right\rceil \mathbb{1}_{\delta_{n_{k} - 1}\neq \delta_{n_{k}}}.
$$
We now construct an interpolating function that has exactly the desired number of kinks. Note that the problem considered in Lemma 4 is shift invariant (which is not the case of Equation (4)). As a consequence, we can assume without loss of generality that  $x_{1} \geq 0$ . This simplifies the definition of the following sequence of slopes  $\mathbf{s} \in S$ :
$$
s _ {1} = \delta_ {1}
$$
and for any  $i \in \{2, \ldots, n\}$ ,  $s_i = \begin{cases} \delta_{i-1} & \text{if } (s_{i-1} = \delta_{i-1} \text{ or } i = n_k \text{ for some } k \geq 1) \\ s_i = \delta_i & \text{otherwise.} \end{cases}$
It is easy to check that  $\mathbf{s} \in S$ . We now consider the function  $f$  associated to the sequence of slopes by the mapping of Lemma 6 and an interval  $[x_{n_k - 1}, x_{n_k + 1})$  with  $\delta_{n_k - 1} \neq \delta_{n_k}$ . By definition,  $s_{n_k + 1 + 2p} = \delta_{n_k + 1 + 2p}$  for any  $p$  such that  $n_k + 1 \leq n_k + 1 + 2p < n_{k + 1}$ . This implies that  $f$  has no kink in the interval  $[x_{n_k + 1 + 2p}, x_{n_k + 2 + 2p})$ . From there, a simple calculation shows that  $f$  has at most  $\left\lceil \frac{n_{k + 1} - n_k}{2} \right\rceil$  kinks on  $[x_{n_k}, x_{n_{k + 1}})$ . Moreover, as  $s_i = \delta_{i - 1}$  if  $i = n_k$ ,  $f$  has no kink on intervals  $[x_{n_k}, x_{n_{k + 1}})$  when  $\delta_{n_k - 1} = \delta_{n_k}$ .  $f$  is thus an interpolating function with at most
$$
\sum_ {k \geq 1} \left\lceil \frac {n _ {k + 1} - n _ {k}}{2} \right\rceil \mathbb {1} _ {\delta_ {n _ {k} - 1} \neq \delta_ {n _ {k}}},
$$
kinks, which concludes the proof of Lemma 4.
Let  $f$  be the minimiser of Equation (4). The proof of Theorem 3 separately shows that  $f$  has exactly  $\left\lceil \frac{n_{k+1} - n_k}{2} \right\rceil \mathbb{1}_{\delta_{n_k-1} \neq \delta_{n_k}}$  kinks on each  $(x_{n_k-1}, x_{n_{k+1}})$ . Fix in the following  $k \geq 0$ .
14 Otherwise, the derivative would be weakly decreasing on the interval, contradicting interpolation.
Assume first that  $\delta_{n_k - 1} = \delta_{n_k}$ . Then Lemma 3 along with the definitions of  $n_k$  and  $n_{k + 1}$  directly imply that  $s_i^* = \delta_{n_k - 1}$  for any  $i = n_k,\ldots ,n_{k + 1} - 1$ . This then implies that the associated interpolator, i.e.  $f$  has no kink on  $(x_{n_k - 1},x_{n_{k + 1}})$ .
Now assume that  $\delta_{n_k - 1} \neq \delta_{n_k}$ . Without loss of generality, assume  $\delta_{n_k - 1} < \delta_{n_k}$ . By the definition of Equation (10):
Moreover, by definition of  $n_k$ , we have
$$
\left\{ \begin{array}{l} \text {e i t h e r} n _ {k} = 1 \\ \text {o r} \delta_ {n _ {k} - 1} \leq \delta_ {n _ {k} - 2} \end{array} \right. \quad \text {a n d} \quad \left\{ \begin{array}{l} \text {e i t h e r} n _ {k + 1} = n \\ \text {o r} \delta_ {n _ {k + 1}} \leq \delta_ {n _ {k + 1} - 1} \end{array} \right.
$$
Since  $n_{k+1} \leq n_k + 3$  by Assumption 1, Lemma 8 below states that for all the cases,  $f$  has exactly  $\left\lceil \frac{n_{k+1} - n_k}{2} \right\rceil$  kinks on  $(x_{n_k-1}, x_{n_{k+1}})$ .
Symmetric arguments hold if  $\delta_{n_k - 1} > \delta_{n_k}$ . In conclusion,  $f$  has exactly  $\left\lceil \frac{n_{k + 1} - n_k}{2} \right\rceil \mathbb{1}_{\delta_{n_k - 1} \neq \delta_{n_k}}$  kinks on each  $(x_{n_k - 1}, x_{n_{k + 1}})$ . This implies that  $f$  has at most
$$
\sum_ {k \geq 1} \left\lceil \frac {n _ {k + 1} - n _ {k}}{2} \right\rceil \mathbb {1} _ {\delta_ {n _ {k} - 1} \neq \delta_ {n _ {k}}}
$$
kinks in total. This concludes the proof of Theorem 3, thanks to Lemma 4.
Lemma 8. For any  $k \geq 0$ , if  $\delta_{n_k - 1} < \delta_{n_k}$ , then the minimiser of Equation (4) has
1. 1 kink on  $(x_{n_k - 1}, x_{n_{k + 1}})$  if  $n_{k + 1} = n_k + 1$ ;
2. 1 kink on  $(x_{n_k - 1}, x_{n_{k + 1}})$  if  $n_{k + 1} = n_k + 2$ ;
3. 2 kinks on  $(x_{n_k - 1}, x_{n_{k + 1}})$  if  $n_{k + 1} = n_k + 3$ .
Lemma 8 is written in this non-compact way since its proof shows separately (with similar arguments) the three cases.
Proof. 1) Consider  $n_{k+1} = n_k + 1$ . First assume that  $x_{n_k} \geq 0$ . Lemma 3 implies that  $s_{n_k+1}^* \in [\delta_{n_k+1}, \delta_{n_k}]$  and  $s_{n_k}^* \in [\delta_{n_k-1}, \delta_{n_k}]$ . In particular,  $s_{n_k}^* \leq \delta_{n_k}$ , which implies that  $s_{n_k+1}^* = \delta_{n_k}$ . Similarly,  $s_{n_k-1}^* \geq \delta_{n_k-1}$ , which implies that  $s_{n_k}^* = \delta_{n_k-1}$ . Using the mapping from Lemma 6, both values  $s_{n_k}^*$  and  $s_{n_k+1}^*$  yield that the associated function  $f$  has exactly one kink on  $(x_{n_k-1}, x_{n_k+1})$ , which is located at  $x_{n_k}$ . Similar arguments hold if  $x_{n_k} < 0$ .
2) Consider now  $n_{k + 1} = n_k + 2$
First assume that  $x_{n_k + 2} < 0$ . Thanks to Lemma 3, we can show similarly to the case 1) that  $s_{n_k + 1}^* = \delta_{n_k + 1}$ .
Now assume that  $x_{n_k + 2} \geq 0$ . Similarly to the case 1),  $s_{n_k + 2}^* = \delta_{n_k + 1}$ . The minimisation problem of the slopes becomes on  $s_{i + 1}^*$  for  $i = n_k$ :
$$
s_{i + 1}^{*} = \operatorname *{argmin}_{s\in \tilde{S}}g_{i + 1}(s,s_{i}^{*}) + g_{i + 2}(\delta_{i + 1},s),
$$
where  $\tilde{S} = S_{i}(s_{i}^{*})$  if  $x_{i + 1}\geq 0$ , and  $\tilde{S} = \{\delta_{i + 1}\}$  otherwise. Note that  $g_{i + 1}(s,s_i^*)$  is  $\sqrt{1 + x_{i + 1}^2}$ . Lipschitz in its first argument, while  $g_{i + 2}(\delta_{i + 1},s) = \sqrt{1 + x_{i + 1}^2}|s - \delta_{i + 1}|$ . Moreover,  $s_{n_k}^* \in [\delta_{n_k - 1},\delta_{n_k}]$ . As a consequence, either  $x_{n_k + 1}\geq 0$  and  $s_{n_k}^* = \delta_{n_k} = s_{n_k + 1}^*$ ; or  $s_{n_k + 1}^* = \delta_{n_k + 1}$ .
Symmetrically, when reasoning on the points  $x_{n_k - 1}, x_{n_k}$ :
- either  $s_{n_k}^* = \delta_{n_k - 1}$
- or  $(x_{n_k} < 0$  and  $s_{n_k}^* = \delta_{n_k} = s_{n_k + 1}^*$ .
There are thus two possible cases in the end:
- either  $(s_{n_k}^* = \delta_{n_k - 1}$  and  $s_{n_k + 1}^* = \delta_{n_k + 1})$ ;
- or  $(s_{n_k}^* = \delta_{n_k} = s_{n_k + 1}^*$  and  $x_{n_k} < 0 \leq x_{n_k + 1}$ .
In the case where  $x_{n_k} < 0 \leq x_{n_k + 1}$ , we also have  $s_{n_k - 1}^* = \delta_{n_k - 1}$  and  $s_{n_k + 2}^* = \delta_{n_k + 1}$ . A straightforward computation then yields a smaller cost on the functions  $g_i$  for the choice of slopes  $s_{n_k}^* = \delta_{n_k - 1}$  and  $s_{n_k + 1}^* = \delta_{n_k + 1}$ .
As a consequence,  $s_{n_k}^* = \delta_{n_k - 1}$  and  $s_{n_k + 1}^* = \delta_{n_k + 1}$  in any case. The mapping of Lemma 6 then yields that  $f$  has exactly one kink on  $(x_{n_k - 1}, x_{n_k + 2})$ , which is located in  $(x_{n_k}, x_{n_k + 1})$ . Indeed, we either have  $a_{n_k - 1} = 0$  or  $\tau_{n_k - 1} = x_{n_k - 1}$ ; similarly either  $a_{n_k + 1} = 0$  or  $\tau_{n_k + 1} = x_{n_k + 2}$ .
3) Consider now  $n_{k + 1} = n_k + 3$ . Similarly to the case 2), we have both
$$
\left\{ \begin{array}{l} \text {e i t h e r} s _ {n _ {k} + 2} ^ {*} = \delta_ {n _ {k} + 2} \\ \text {o r} (s _ {n _ {k} + 1} ^ {*} = \delta_ {n _ {k} + 1} = s _ {n _ {k} + 2} ^ {*} \text {a n d} x _ {n _ {k} + 2} ^ {*} \geq 0) \end{array} \right.
$$
$$
\text {a n d} \quad \left\{ \begin{array}{l} \text {e i t h e r} s _ {n _ {k}} ^ {*} = \delta_ {n _ {k} - 1} \\ \text {o r} (s _ {n _ {k}} ^ {*} = \delta_ {n _ {k}} = s _ {n _ {k} + 1} ^ {*} \text {a n d} x _ {n _ {k}} <   0). \end{array} \right.
$$
When considering all the possible cases, the mapping of Lemma 6 implies that  $f$  has exactly two kinks on  $(x_{n_k - 1}, x_{n_k + 3})$ , which are located in  $[x_{n_k}, x_{n_k + 2}]$ .
E.5 Adapted analysis for the case  $x_{1} \geq 0$
This section explains how to adapt the analysis of this section to the easier case where all  $x$  are positive. Lemma 7 holds under the exact same terms (but its second part is useless) in that case. From there, the proof of Theorem 2 consists in just showing the uniqueness of the minimisation problems for any  $\tilde{\mathbf{s}} \in S$ :
$$
\min  _ {s _ {i _ {0}} \in \mathbb {R}} c _ {i _ {0}} \left(s _ {i _ {0}}\right)
$$
$$
\min  _ {s _ {i + 1} \in S _ {i} (\tilde {s} _ {i})} g _ {i + 1} (s _ {i + 1}, \tilde {s} _ {i}) + c _ {i + 1} (s _ {i + 1}) \quad \text {f o r a n y} i \in \{i _ {0}, \ldots , n - 1 \}.
$$
The unique solution of the first problem is  $\delta_{i_0}$  thanks to Lemma 7, while same arguments as in Appendix E.1 hold for the second problem.
For the proof of Lemma 3, the exact same arguments as in Appendix E.2 hold for any  $i \geq i_0 + 1$ . For  $i = i_0 = 1$ , it is obvious in that case that  $s_1^* = \delta_1$ , leading to Lemma 3.
Finally, the proof of Theorem 3 follows the same lines when  $x_{1} \geq 0$ .
E.6 Proof of Corollary 1
Proof of Corollary 1. For classification, the natural partition to define is the following:
$$
n _ {1} = 1 \text {a n d f o r a n y} k \geq 0 \text {s u c h t h a t} n _ {k} <   n + 1,
$$
$$
n _ {k + 1} = \min  \left\{j \in \left\{n _ {k} + 1, \dots , n \right\} \mid y _ {n _ {k}} \neq y _ {j} \right\} \cup \{n + 1 \}. \tag {36}
$$
This partition splits the data so that for any  $k$ ,  $y_{i}$  has the same value for  $i \in \{n_k, n_{k+1} - 1\}$ . Denote  $K$  the number of  $n_k$  defined in Equation (36), i.e.,  $n_K = n + 1$ . From there, by simply noting that any margin classifier has at least a kink in  $[x_{n_k}, x_{n_{k+1}})$  for  $k \in [K-2]$ :
$$
\min_{\substack{f\\ \forall i\in [n],y_{i}f(x_{i})\geq 1}}\| f^{\prime \prime}\|_{0} = K - 2.
$$
Similarly to the proof of Lemma 1, we can first show the existence of a minimum.15 Let us now consider  $f$  a minimiser of
$$
\min  _ {\substack {f \\ \forall i \in [ n ], y _ {i} f (x _ {i}) \geq 1}} \left\| \sqrt {1 + x ^ {2}} f ^ {\prime \prime} \right\| _ {\mathrm {T V}}. \tag{37}
$$
Define the set
$$
S = \left\{n _ {k} \mid k \in \{2, \dots , K - 1 \} \right\} \cup \left\{n _ {k} - 1 \mid k \in \{2, \dots , K - 1 \} \right\}.
$$
By continuity of  $f$ , we can choose an alternative training set  $(\tilde{x}_i, \tilde{y}_i)$  satisfying:
$$
\tilde {x} _ {i} \in \left[ x _ {n _ {k} - 1}, x _ {n _ {k}} \right] \quad \text {f o r a n y} i \in \left\{n _ {k} - 1, n _ {k} \right\},
$$
$$
y _ {i} = f \left(\tilde {x} _ {i}\right) \quad \text {f o r a n y} i \in S.
$$
Then, a direct application of Theorem 2 yields that the minimisation problem
$$
\min  _ {\tilde {f}} \left\| \sqrt {1 + x ^ {2}} \tilde {f} ^ {\prime \prime} \right\| _ {\mathrm {T V}}, \tag {38}
$$
admits a unique minimiser, that we denote  $f_{\mathrm{reg}}$ . But also note that this unique minimiser is also in the constraint set of Equation (37) thanks to Lemma 3, so that
$$
\left\| \sqrt {1 + x ^ {2}} f _ {\text {r e g}} ^ {\prime \prime} \right\| _ {\text {T V}} \geq \left\| \sqrt {1 + x ^ {2}} f ^ {\prime \prime} \right\| _ {\text {T V}}.
$$
However, since  $f$  is in the constraint set of Equation (38), we actually have an equality, and by unicity of the minimiser of Equation (38),
$$
f _ {\text {r e g}} = f.
$$
Moreover, it is easy to check that Assumption 1 holds for the data  $(\tilde{x}_i,y_i)_{i\in S}$ , with  $n_{k + 1} = n_k + 2$ . As a consequence, Theorem 3 implies that the minimiser of Equation (38) is among the sparsest interpolators for the set  $(\tilde{x}_i,y_i)_{i\in S}$ , i.e. it exactly counts  $K - 2$  kinks. This then implies that  $\| f^{\prime \prime}\| _0 = K - 2$ , so that
$$
\underset { \begin{array}{c} f \\ \forall i \in [ n ], y _ {i} f (x _ {i}) \geq 1 \end{array} } {\operatorname {a r g m i n}} \bar {R} _ {1} (f) \subset \underset { \begin{array}{c} f \\ \forall i \in [ n ], y _ {i} f (x _ {i}) \geq 1 \end{array} } {\operatorname {a r g m i n}} \| f ^ {\prime \prime} \| _ {0}. \tag {39}
$$
15 Proving that the sequence  $(a_{j},b_{j})$  is bounded is here a bit more tricky. Either the data is linearly separable, in which case the minimum is 0, or the data is not linearly separable. When the data is not linearly separable, then  $(a_{j},b_{j})$  is necessarily bounded, since  $(\mu_j,a_j,b_j)$  would behave as a linear classifier for arbitrarily large  $(a_{j},b_{j})$ .