The cumulative distribution function is defined as:
$$F(x)=P(X\le x)=\int_{-\infty}^x f(t)\,dt,$$
where $f(t)$ is the probability density function. By the fundamental theorem of calculus:
$$f(x)=F'(x)$$
I am having some difficulty with this topic. For example, suppose that I define:
$$F(x)=\begin{cases}
0,\quad x<0\\
x,\quad 0\le x<\frac12\\
\frac12x+\frac12,\quad \frac12\le x\le 1\\
1,\quad x>2
\end{cases}$$
Now, the graph appears to satisfy all of the requirements of a c.d.f.

$F$ is nondecreasing, right continuous, $\lim_{x\to-\infty}F(x)=0$, and $\lim_{x\to\infty}F(x)=1$. However, if I differentiate to try and obtain the p.d.f, I get: $$f(x)=F'(x)=\begin{cases} 0,\quad x<0\\ 1,\quad 0<x<\frac12\\ \frac12,\quad \frac12<x<1\\ 0,\quad x>1 \end{cases}$$
Note that the derivative does not exist at $x=0$, 1/2, and 1.

Now, the difficulty is this:
$$\int_{-\infty}^{\infty}f(x)\,dx=\frac34$$
It does not equal one as it should. So clearly I am making some sort of mistake and some sort of misunderstanding. Either I have not created a proper c.d.f, or I am not handling the "jump" in continuity of $F$. I'm stuck.
Any thoughts?