TITLE: dimension of a real affine variety
QUESTION [5 upvotes]: Let $V$ be a real affine variety in $\mathbb R^n$, i.e. the zero set of a real polynomial $p(x_1,\dots,x_n)$. Consider the following three definitions of the dimension of $V$, $dim(V)$.

Definition 1: if $I$ is the ideal of
  polynomials vanishing on $V$, then
  $dim(V)$ is the maximum dimension of a
  coordinate subspace in $V(\langle
> LT(I)\rangle)$ with a given graded
  order $>$ on the monomials
  ($\sum\alpha_i>\sum\beta_i$ implies
  $x^\alpha>x^\beta$) (see the book
  "Ideals, Varieties, and Algorithms"
  chapter 9)

Definition 2: $dim(V)$ is the largest $d$ such that there exists an injective semi-algebraic map from $(0, 1)^d$ to $V$ (see "Algorithms in Real Algebraic Geometry" chapter 5)

Definition 3: $dim(V)$ is the largest $d$ such that there exists a
  subset of $V$ homeomorphic to $(0,
> 1)^d$

Are these three definitions, for the case of real affine varieties, pairwise equivalent, or pairwise different, or something else?

REPLY [4 votes]: They are all equivalent, including definition 1, to the Krull dimension of $S/I$, where $S=\mathbb{R}[x_1,\ldots,x_n]$ is the polynomial ring $I$ lives in.  This is very good news for people like me who want to apply algebraic geometry to statistics, where numbers are mostly real.
Here's how it goes: 
Definition 1 is a way of computing the Krull dimension of $S/I$ via Groebner bases.  See, e.g., p. 250 of Computing in algebraic geometry: a quick start using SINGULAR by Wolfram Decker and Christoph Lossen
Definition 2 is shown equivalent to Krull dimension in Corollary 2.8.9 of Real Algebraic Geometry by Bochnak, Coste and Roy.  Note that they define the "dimension" of a real variety to be Krull dimension of its coordinate ring.  I recommend reading the whole chapter.
Definition 3 is equivalent to Defintion 2 because any semialgebraic set admits a decomposition into finitely many pieces homeomorphic to $(0,1)^d$ (see Theorem 2.3.6 in RAG), and a finite union of semialgebraic sets of dimension less than $d$ cannot contain a set of dimension $d$.  I.e., the only way a real variety can contain an open set homeomorphic to $(0,1)^d$ is by containing a semialgebraic set homeomorphic to $(0,1)^d$ in its semialgebraic cell decomposition.