What can replace "dimension $0$" to measure discreteness of varieties over $ \mathbb{R} $? Consider the algebraic set $Z(x^2 + y^2) \subseteq \mathbb{R}[x, y]$. Set $A = \mathbb{R}[x, y]/(x^2 + y^2)$. In this ring, we have a chain of prime ideals $(0) \subseteq (x,y) $: the ring has dimension $1$. Hence the algebraic set has dimension $1$ when viewed as the (closed points of the) scheme $ \mathrm{Spec}\ A$. By Definition 2.8.1 on p.50 of Bochnak/Coste/Roy, this is also the dimension of the set as a real algebraic variety.
Question. As a scheme, the algebraic set has dimension 1. On the other hand, it is a real algebraic variety consisting of a single real closed point. Is there an algebraic way of defining a `dimension' so that this real algebraic variety has dimension $0$?
I fully expect the answer might be 'no', as the polynomial we look at here inherently has 'dimension 1-ness' built into it intrinsically (it is a conic) and I think we get dim = 1 here because we are in some sense detecting an infinitsimal tangent vector pointing in the imaginary direction(?).
Some context: I am studying a large family of complicated polynomials defined over $\mathbb{Q}$ and I am trying to detect whether given polynomials in the family have discrete zeros over $\mathbb{R}^n$; to do this, I was using Macaulay2 to compute the dimension of the hypersurface generated by each polynomial and looking for polynomials where this quantity was zero. Of course, this did not work as there were many polynomials with discrete zeros but generating an ideal with positive Krull dimension! I chose the example above as it is the simplest polynomial I could think of which has this "defect" in the hopes that the answers would be enlightening when dealing with the more complicated case.
Related: Two-variable polynomials over $\mathbb{Q}$ with finitely many roots in $\mathbb{R}^2$ (but I am interested in checking for discreteness of roots, not finiteness; I am also interested in studying the embedding of the real points of the varieties inside the complex points, so I'm more interested in algebraic results as opposed to the analytic ones in the answers to that question)
 A: Let $I:=(f_1,..,f_l)$ where $f_i\in A:=\mathbb{R}[x_1,..,x_n]$ let $ X:=\mathrm{Spec}(A/I)$. Let $F:=f_1^2+\cdots + f_l^2$ and let $Y:=\mathrm{Spec}(A/(F))$.
It follows $Y$ is a "hypersurface" in real affine space $\mathbb{A}^n_\mathbb{R}:=\mathrm{Spec}(A)$.
Lemma. Since $(F) \subseteq I$ there is a canonical map of affine schemes $\phi: X \rightarrow Y$ inducing a 1-1 correspondence at the level of $\mathbb{R}$-rational points:
$$ X(\mathbb{R}) \cong Y(\mathbb{R}).$$
Proof:Let $f^*: Spec(\mathbb{R}) \rightarrow X$ be an $\mathbb{R}$-rational point. It follows the corresponding map of $\mathbb{R}$-algebras $f$ satisfies $f(x_i):=a_i\in \mathbb{R}$ with $f_j(a_1,..,a_n)=0$ for all $j=1,..,l$. Hence it follows $F(a_1,..,a_n)=0$, and $f$ defines an $\mathbb{R}$-rational point of $Y$. Conversely if $f^*: Spec(\mathbb{R}) \rightarrow Y$ is an $\mathbb{R}$-rational point, it follows $f(x_i):=a_i$ and $F(a_1,..,a_n):= \sum_j f_j(a_1,..,a_n)^2=0$, hence $f_j(a_1,..,a_n)=0$ for all $j$. Hence $f$ defines an $\mathbb{R}$-rational point of $X$. This is a 1-1 correspondence and the Lemma is proved. QED.
Note 1. By the Lemma it follows the two schemes $X,Y$ have the same $\mathbb{R}$-rational points. A hypersurface in affine $n$-space should have dimension $n-1$, but the ideal $I$ is an arbitrary ideal in $A$. Hence if you are studying the $\mathbb{R}$-rational points $X(\mathbb{R})$, you may realize $X(\mathbb{R})$ as a hypersurface for any $X$.
Note 2. The map $\phi: X \rightarrow Y$ is a closed immersion, since $X$ may be defined using an ideal $\overline{I}\subseteq A/(F)$.
Note 3. This type of result holds for any subfield $\mathbb{Q} \subseteq K \subseteq \mathbb{R}$.
Example: If $I:=(x_1-a_1,..,x_n-a_n)$ is a maximal ideal, it follows $X:=\mathrm{Spec}(A/I)$ has one $\mathbb{R}$-rational point: The point $a:=(a_1,..,a_n)$. If $F:=(x_1-a_1)^2+\cdots + (x_n-a_n)^2$
it follows $Y:=\mathrm{Spec}(A/(F))$ is a hyper surface in affine $n$-space.
Lemma. $Y$ has $a$ as the only $\mathbb{R}$-rational point.
Proof. Let us repeat the proof: Assume $\phi:\mathrm{Spec}(\mathbb{R}) \rightarrow Y$ is a $\mathbb{R}$-rational point. we get a corresponding map of $\mathbb{R}$-algebras
$$ f: A/(F) \rightarrow \mathbb{R}$$
with $f(x_i)=u_i \in \mathbb{R}$. Since $f(F)=0$ we get
$$ f(F):=f(u_1,..,u_n):=(u_1-a_1)^2+\cdots + (u_n-a_n)^2=0$$
hence $u_i=a_i$ for all $i$, and it follows $(u_i)=a$ is the only $\mathbb{R}$-rational point. QED
Example 1. Let $D \subseteq \mathbb{R}$ be a sub-ring and let $I:=\{f_1,..,f_l\} \subseteq B:=D[x_0,..,x_n]$ be an ideal generated by a set of homogeneous polynomials of the same degree $deg(f_i)=d$. Let $A:=V(I)\subseteq \mathbb{P}^n_D$ be the projective scheme defined by $I$. Let $F:= \sum_j f_j^2 \in A$ and let $H:=V(I)$. It follows $A(D) \cong H(D)$.
In your case $a:=(0,0)$ has maximal ideal $I=(x,y)$ and corresponding hypersurface $F:=x^2+y^2$. The ring $B:=\mathbb{R}[x,y]/(x^2+y^2)$ has one maximal ideal with $\mathbb{R}$ as residue field. It has many maximal ideals with with $\mathbb{C}$ as residue field:
"Question. As a scheme, the algebraic set has dimension 1. On the other hand, it is a real algebraic variety consisting of a single real closed point. Is there an algebraic way of defining a `dimension' so that this real algebraic variety has dimension 0?"
For any non-zero complex number $w \in \mathbb{C}$ it follows the map $f: B\rightarrow \mathbb{C}$ defined by
$f(x)=iw, f(y)=w$ is a well defined surjection with $I(w):=\mathrm{ker}(f) \subseteq B$ a maximal ideal. Hence the ring $B$ has many maximal ideals with $\mathbb{C}$ as residue field.
What you are asking for is a formula detecting how many rational points a real algebraic variety $X$ has, and I believe this is an open problem in diophantine geometry in general.
