Definition: A subset $D\subseteq \mathbb{Q}$ is diophantine if it is the projection of the zero set of a polynomial, i.e. there exists a polynomial $f\in\mathbb{Q}[X,Y_1,\dots,Y_n]$ for some $n$ such that $$ D = \{ x\in \mathbb{Q} \;|\; \exists y_1,\dots,y_n\in \mathbb{Q}: f(x,y_1,\dots,y_n)=0 \}. $$
Example: The set $\mathbb{Q}_{\geq0}=\{x\in \mathbb{Q}:x\geq 0\}$ is diophantine since it equals the set of sums of four squares in $\mathbb{Q}$. So more precisely, it satisfies the above definition with $n=4$ (and $f=x-y_1^2-y_2^2-y_3^2-y_4^2$).
Question: What is the minimal $n$ for which $D=\mathbb{Q}_{\geq0}$ satisfies the definition?
Remarks:
(a) The answer is either 2 or 3: It is at most 3 since every $x\in\mathbb{Q}_{\geq0}$ is either the sum of three squares or twice the sum of three squares, hence one can take $f=(x-y_1^2-y_2^2-y_3^2)(2x-y_1^2-y_2^2-y_3^2)$, and it cannot be 1 by Hilbert's irreducibility theorem.
(b) For the logician, the question can be phrased as asking whether there exists an existential first-order formula in the language of rings with only two quantifiers that defines $\mathbb{Q}_{\geq0}$ in $\mathbb{Q}$. For the arithmetic geometer, it can be phrased as asking whether there exists a surface $V$ over $\mathbb{Q}$ and a morphism $f:V\rightarrow\mathbb{A}^1_\mathbb{Q}$ with $f(V(\mathbb{Q}))=\mathbb{Q}_{\geq0}$.
(c) Of course the question can be asked also about other diophantine subsets $D\subseteq\mathbb{Q}$. General considerations on this positive-existential rank of diophantine sets can be found in this paper by Pasten and this paper by Daans, Dittmann and myself, but these do not seem to help with this specific question. The latter paper also contains detailed explanations for the claims made in (b) and the lower bound in (a).