My teacher gave me a demonstration of the idea behind the bus waiting paradox, but I'm having some issues understanding one of the initial assumptions.
Convention here is that X is the time between two arrivals, while Y is the waiting time.
The demonstration starts by saying that
$$ E[Y]=\int_{0}^\infty E[Y|A_t]*P(A_t)\label{a}\tag{1} $$
where $A_t$ is the event defined as
$$ A_t= \text{"arrival happening during a realization } x \text{ of } X : t \le x \le t+dt" $$
He also adds that
$$ E[Y|A_t]=\int_{u=0}^t u*f_{Y|A_t}(u)*du=\frac1t*\int_{u=0}^t u*du = \frac t2\label{b}\tag{2} $$
What I don't understand is how both $(1)$ and $(2)$ work, from a formal point of view, even if I have a rough idea.
So, what I'd like to know is if someone can provide all the steps to prove the two equalities.
EDIT - adding the full demonstration just for clarity
Thesis:
$$ E[Y]=\frac{E[X^2]}{2*E[X]}=\frac12*E[x]+\frac{VAR(X)}{2*E[X]} $$
Demonstration:
$$ P(A_t)=c*t*f_X(t)*dt; c=\frac{1}{E[X]} $$
$$ E[Y]=\int_{0}^\infty E[Y|A_t]*P(A_t) $$
$$ E[Y|A_t]=\frac t2 $$
$$ E[Y]=\int_{0}^\infty E[Y|A_t]*P(A_t)=\int_{0}^\infty \frac t2 * \frac{t*f_X(t)}{E[X]}*dt=\frac{E[X^2]}{2E[X]} $$