Is the singular homology of a real algebraic set always finitely generated?

Here is a precise statement of my question:

Let $p\in \mathbb{R}[x_1, \ldots, x_n]$ be a polynomial, and let $Z(p)\subset \mathbb{R}^n$ be the set of zeros of $p$. Must the singular homology $H_i (Z(p); \mathbb{Z})$ ($i\geq 0$) be finitely generated as an abelian group?

Here I really just mean the singular homology groups of this set as a topological space with the Euclidean topology.

It's an old theorem of Whitney that $Z(p)$ has finitely many connected components, so $H_0 (Z(p); \mathbb{Z})$ is finitely generated. Note that it is possible to triangulate $\mathbb{R}^n$ with $Z(p)$ as a subcomplex, so $H_i (Z(p)) = 0$ for $i>n$.

I'm guessing the answer is well-known (either a theorem or a counterexample), but I couldn't find an answer on Google or MathSciNet...

-

Proposition 1.13 of these notes by Coste implies (if I've read it correctly) that any semialgebraic set $S$ is homeomorphic to a union $U$ of open simplices in some finite simplicial complex $K$.

Thus $S$ is an open subset of an ENR, hence is an ENR. Its singular cohomology therefore coincides with its Čech cohomology, which is finitely generated. Therefore its singular homology must be finitely generated.

Edit: The argument given above is incomplete, since a union of "open" simplices in a simplicial complex is not necessarily open (an easy mistake to make!). However it is easy to see that $S\subseteq\mathbb{R}^n$ is an ENR by other means (in particular, it is locally compact and locally contractible).

-
Ah, the trick I was missing is that any semialgebraic set is equivalent to a bounded one, by the trick explained just prior to Proposition 1.13. Thanks! – Dan Ramras May 28 '12 at 14:34
@Dan Ramras If you were only concerned with possible noncompactness of $M=Z(p)$ that is easy to deal with directly. For any $v\in \mathbb R^n$ look at $f_v(x)=|x-v|^2$. If $M$ is smooth then $f_v$ is a Morse function on $M$ for most $v\in \mathbb R^n$ (so long as $v$ is not a focal point of $M$). For any such $v$ the set of critical points of $f_v$ on $M$ is real algebraic and discrete and hence finite (e.g. by the Theorem of Whitney you mention). Therefore $M$ deformation retracts onto its intersection with the closed ball $\bar B(v,R)$ for some finite $R$. – Vitali Kapovitch May 28 '12 at 18:28
Vitali, that's a nice observation. I am specifically interested in the case of singular algebraic sets, however. – Dan Ramras May 29 '12 at 22:07
@Dan Ramras the singular case follows from above because any algebraic set has finitely many smooth strata and you can choose $f_v$ that works for all of them. this easily yields a smooth gradient like vector field for $f_v$ tangent to $M$ on $M$ and without critical points outside a large ball. – Vitali Kapovitch May 30 '12 at 0:54

This appears to be proved in Chapter 9 of Bochnak/Coste/Roy "Real Algebraic Geometry". In Chapter 11 they prove bounds on the Betti numbers (if you care about $\mathbb{Q}$ coefficients).

-