Can a proper Morse function $\mathbb{R}\to\mathbb{R}$ have infinitely many critical points? Depending on interpretation, there may be an assumption missing from Exercise 6.1.4(a) in Liviu I. Nicolaescu's Invitation to Morse Theory:

Suppose $f : \mathbb{R} → \mathbb{R}$ is a proper Morse function, i.e., $f^{−1}(\text{compact}) = \text{compact}$. Prove that the number of critical points of $f$ is even if $\lim_{x\to \infty} f(x)f(−x) = −\infty$, and it is odd if $\lim_{x \to \infty}f(x)f(−x) = \infty$.

This motivates my question: Can a proper Morse function $\mathbb{R}\to\mathbb{R}$ have infinitely many critical points? I believe I have such an example below, but I would like confirmation.
Example. The function $f(x)=x/2 + \sin(x)$ has (infinitely many) critical points $x=\pm \frac{2\pi}{3}+2n\pi$. This clearly satisfies
$\lim_{x \to \infty} f(x)f(-x)=-\infty$, and we also see that $f$ is Morse: $$f''(\pm\frac{2\pi}{3} + 2n\pi)=-\sin(\pm\frac{2\pi}{3}+2n\pi)=\mp\frac{\sqrt{3}}{2}\neq 0.$$
As for $f$ being proper, continuity and Heine-Borel leave us needing to show that $$f^{-1}(\text{bounded})=\text{bounded}.$$ To this end, observe that $f^{-1}([-a,a])\subset [-2a-2,2a+2]$: It suffices to show that $|x| \leq 2|f(x)| +2$, which is trivial if $|x|\leq 2$. When $|x|\geq 2$, we have $|x| \leq 2|f(x)|+2$ because  $$|f(x)|=\left|\frac{x}{2} + \sin(x)\right|\geq\left|\frac{|x|}{2}-|\sin(x)|\right| = \frac{|x|}{2}-|\sin(x)|\geq \frac{|x|}{2}-1.$$
Remark. In the case of finitely many critical points, I think the idea is to recognize that a Morse function $f$ has $f''(x) \neq 0$ whenever $f'(x)=0$, so the critical points occur at strict local minima and maxima. Then there has to be a certain "cancellation" of these extrema depending on whether $\lim_{x\to \infty}f(x)f(-x)$ is positive or negative infinity.
 A: A brief answer provided at the request of our OP squirrel (see comments):
As applied to numbers of various sorts, the concepts even and odd are really only meaningful in the overall context of finiteness.  So I think it is safe to assume that  Nicolaescu, who incidentally I have found to be a very fine expositor, made a minor omission here and neglected to include that the critical points of $f(x)$ must be finite in number.  This assumption is of course buttressed by squirrel's example which appears without error to this author, and apparently also to Professor Budney.
As for Nicolaescu's question, which is the overall primum mobile for the present discussion, I don't have a complete answer in all rigor worked up at this point, but I would like to offer the following intuitive view of things:
The "critical" thing to realize, if you will, is that the critical points of a Morse function $f:\Bbb R \to \Bbb R$ must alternate in index as we allow $x \in \Bbb R$ to increase or decrease.  For if $x_1 \in \Bbb R$ is critical, so that $f'(x_1) = 0$, then we must have $f''(x_1) \ne 0$ since $f(x)$ is Morse, i.e., the critical points are non-degenerate.  So suppose $f''(x_1) > 0$;  then, since $f'(x_1) = 0$, $x_1$ is, locally, at the "bottom of the bowl", so to speak; we must have $f(x) > f(x_1)$ for $x \in (x_1 - \delta, x_1 + \delta)$ for some (perhaps small) $\delta$.  Moving slightly to the right from $x_1$, we may infer that $f'(x) > 0$, since $f''(x_1) > 0$.  (We may, if a more detailed analysis is desired, invoke the Morse lemma here to establish this assertion.)  In any event, we will have $f'(x) > 0$ as $x$ increases until we hit the next critical point $x_2$ (assuming there is one).  So, since $f'(x) > 0$, $f(x)$ increases 'twixt $x_1$ and $x_2$. Then $f'(x_2) = 0$ and $x_2$ is also non-degenerate, so that $f''(x_2) \ne 0$, we see that we must indeed have $f''(x_2)< 0$, for if $f''(x_2) > 0$, then again using a similar argument to the previous or Morse's lemma, we would have $f(x) > f(x_2)$ for $x$ slightly to the left of $x_2$; but this contradicts the established fact that $f(x)$ must increase for $x \in (x_1, x_2)$.  It is easy to see how the extend the argument to the other germane cases, i.e., $f''(x_1)< 0$, $x$ decreases from $x_1$, und so weiter.  Once it is seen that the indices of the critical points must alternate in sign, it is easy to deduce that $f(x)f(-x) \to \infty$ implies that the number of critical points must be odd, provided that both $f(x), f(-x) \to \pm \infty$, for $f(x)$ "turns around" an odd number of times.  It is possible that $f(x) \to \infty$ but $f(-x) \not \to \infty$, and situations like this will require a more refined argument.  Of course, similar remarks apply to the other possible alternatives, $f(x)f(-x) \to -\infty$ etc.  These things being written, I close this discussion with a (though not completely rigorously earned) QED.
Hope this helps.  Cheers,
and as always,
Fiat Lux!!!
