This definition is taken from the Wikipedia page for truncated distribution:
Let $X$ be a random variable with a continuous distribution, $f(x)$ be its probability density function and $F(x)$ be its cumulative distribution function.
Now the truncated distribution where the top of the distribution has been removed is as follows: $$f(x|X\le y)=\frac{g(x)}{F(y)}$$ where $g(x)=f(x)$ for all $x\le y$ and $g(x)=0$ everywhere else.
I have a hard time understanding the formula $f(x|X\le y)$ since I could not find a proof for it. My intuition tells me that it is derived from either the formula of conditional probability $$P(A|B)=\frac{P(A\cap B)}{P(B)}$$ or the formula of conditional probability density function $$f_{Y|X}(y|x)=\frac{f_{X,Y}(x.y)}{f_X (x)}$$ but I just don't know how. I can see how where the denomitator comes from since it is the condition and $P(X\le y)=F_X(y)$ but I don't know where the numerator comes from.
If $x > y$, $$Pr(X \le x|X \le y)=\frac{P(X \le x, X \le y)}{P(X\le y)}=\frac{P(X \le \min(x,y))}{P(X\le y)}=\frac{P(X \le y)}{P(X\le y)}=1$$
If $x \le y$, $$Pr(X \le x|X \le y)=\frac{P(X \le x, X \le y)}{P(X\le y)}=\frac{P(X \le \min(x,y))}{P(X\le y)}=\frac{P(X \le x)}{P(X\le y)}$$
Now, if you differentiate with respect to $x$,
$$f(x|X \le y) = \begin{cases} 0 &, x > y \\ \frac{f(x)}{F(y)} &, x \le y\end{cases}$$