"Counterexample" for a weaker version of Riemann–Lebesgue lemma My teacher gave us this version of Riemann–Lebesgue lemma in class:

Let $g(t)$ be an absolutely integrable function on $[a,b]$, then $$\lim_{p\to\infty} \int_a^b g(t)\sin(pt)dt=0$$ Similarly for $\cos(px)$

Then, he told us to look for an example of a function $g(t)$ such that it is integrable (in the improper sense) such that $$\lim_{p\to\infty} \int_a^b g(t)\sin(pt)dt\neq0$$ i.e., dropping the hypotesis of $g$ being absolutely integrable. 
I don't understand why he says that it has to be integrable in the improper sense, I think that doesn't even apply in this case because the limit is not taken over the limits of the integral, but over the integrand.
Also, could you give me some intuition background to be able to come up with such a function? I understand that this means that when the period is really small the integral goes to zero, but I can't find the example!
 A: The easiest intuition for me is that such a function has to oscillate faster and faster, so it has places where it looks like $\sin{pt}$ for arbitrarily large $t$, and hence the oscillations in that region are picked up by the integral, so it doesn't decay. You can probably construct a function that does this by pasting together sines in a clever way, but I've got an example that's easier to think about, although the integral requires some sophistication to do. I shall not use anything beyond basic trigonometric identities, but it's all in the application...
Consider $\sin{(t^2)}$. I shall consider
$$ I(p) = \int_{-\infty}^{\infty} \sin{(t^2)}\cos{2pt} \, dt, $$
purely because it is easier to do/not do the integrals (and obviously $p \mapsto 2p$ has no effect on the behaviour). Notice that the integral exists for $p=0$ because
$$ \int_{-\infty}^{\infty} \sin{(t^2)} \, dt = 2\int_{0}^{\infty} \sin{(t^2)} \, dt = \int_{0}^{\infty} \frac{\sin{u}}{u^{1/2}} \, du, $$
and you can split this into an alternating series where the terms decrease in absolute value. Now, look at the integrand, and use the prosthaphaeresis formulae:
$$ \sin{(t^2)}\cos{pt} = \frac{1}{2} \left( \sin{(t^2+pt)} + \sin{(t^2-pt)}  \right) $$
(think about expanding the right-hand side with the addition formula for sine if stuck) Now, complete the square, and re-expand:
$$ \sin{(t^2 \pm pt)} = \sin{((t \pm p)^2-p^2)} = \sin{((t\pm p)^2)}\cos{(p^2)} - \cos{((t \pm p)^2)}\sin{(p^2)} $$
So therefore the integral becomes
$$ I(p) = \cos{(p^2)} \int_{-\infty}^{\infty} \frac{1}{2} \left( \sin{((t+ p)^2)} + \sin{((t-p)^2)}  \right) \, dt - \sin{(p^2)} \int_{-\infty}^{\infty} \frac{1}{2} \left( \cos{((t+ p)^2)} + \cos{((t-p)^2)}  \right) \, dt $$
But the integrals are over the whole real line, so I can just do a translation to change variables to $u=t+p$ or $u=t-p$, which doesn't affect the values at all! So
$$ I(p) = \cos{(p^2)} \int_{-\infty}^{\infty} \sin{(t^2)} \, dt - \sin{(p^2)} \int_{-\infty}^{\infty} \cos{(t^2)} \, dt $$
The first is just $I(0)$, the second is just another constant (which happens to have the same value as $I(0)$, but I haven't got an elementary proof of that, yet), so we find
$$ I(p) = I(0)\cos{(p^2)} - A \sin{(p^2)}, $$
which certainly does not tend to zero as $p \to \infty$.
