Consider a grid $\Delta : a := x_0<x_1<\ldots <x_n =: b$ on $[a,b]$. Denote the space of piecewise polynomials of at most degree $m$ on $[a,b]$ by $\mathcal P_\Delta^m = \mathcal P^m$. We know it is a vector subspace in the vector space of all bounded functions on $[a,b]$. Furthermore, it's also known that $\dim\mathcal P^m = n(m+1)$, since for each subinterval we construct a polynomial of at most degree $m$, therefore we need to select a total of at most $n(m+1)$ coefficients.
Impose restrictions on the mentioned space. Consider all $S:[a,b]\to\mathbb R$ with $$\forall j, 1\leq j\leq n\quad S\in \mathcal P^m[x_{j-1},x_j] \\S\in C^{(m-k)}[a,b],$$ i.e all splines on $[a,b]$ : $\mathcal S_\Delta ^{m,k}$. One can simply check that it's a subspace in $\mathcal P^m$, therefore finite dimensional, but how do we compute its dimension? It's clear our choice of coefficients is going to be limited by conditions. For instance if $[a,b]$ is divided into two subintervals $[a,z]\cup [z,b]$ and we consider $\mathcal S_\Delta ^{2,1}$, then we have some two polynomials $f:[a,z]\to\mathbb R$ and $g:[z,b]\to\mathbb R$ $$f(x) = a_0 + a_1x + a_2x^2\quad\mbox{and}\quad g(x) = b_0 +b_1x + b_2x^2 $$ with the necessary conditions $f(z) = g(z)$ and $f'(z) = g'(z)$.
Question: Are such conditions sufficient when we consider the dimension? E.g if we consider $\mathcal S_\Delta^{2,1}$ on $[a,b] = [a,z]\cup [z,b]$, would the dimension be $2(2+1) - (2-1)(2-1+1) = 4?$
In the general case, we have $n-1$ interior knots and $m-k+1$ (necessary) conditions for each interior knot i.e $$S_j^{(d)}(x_j) = S_{j+1}^{(d)}(x_j)\qquad j=1,\ldots ,n-1\quad d = 0,\ldots, m-k $$