Is volume of semialgebraic sets definable over the language of ordered fields? Let $ \mathcal{L}=\{0,1,+,\cdot,\le\} $ be the language of ordered fields and consider the theory of $\mathbb{R} $ in this language (i.e., the theory of real closed fields). Suppose $ \varphi(x_1,\ldots,x_n,y_1,\ldots,y_m) $ is a formula in $\mathcal{L} $, can we always write a formula $ \psi(y_1,\ldots,y_m,z) $ s.t. $ \mathbb{R}\models\psi(b_1,\ldots,b_m,v)$ iff the volume of $\{\overline{a} \in \mathbb{R} ^n \mid \mathbb{R} \models \varphi(a_1,\ldots,a_n,b_1,\ldots,b_m)\}$ is $v$ ?
If, as I suspect, the answer is negative, is there a way to study volume of semialgebraic sets from model theory point of view? I would ideally like to transfer questions about those volumes to questions about other real closed field.
Edit: It is actually enough for me to write a formula that checks if the volumes of two semialgebraic sets are equal.
 A: No, this is not possible, because the question of whether the volume exists as an element of the field is not invariant under elementary equivalence. This is because $\mathbb{R}$ is elementary equivalent to the real algebraic numbers $\mathbb{R}_{alg}$ but there are semialgebraic sets like $\{ x^2 + y^2 \le 1 \}$ definable over all real closed fields whose volume is not real algebraic. (This argument doesn't rule out the possibility that it might be possible to check whether two volumes are equal.)
A: Here is an argument that you can't even check if two volumes are equal in a definable way. I take that to mean that for every formula $\varphi(\overline{x};\overline{y})$, there is a formula $V^\varphi_=(\overline{y},\overline{y}')$ such that $\mathbb{R}\models V^\varphi_=(\overline{b},\overline{b}')$ if and only if the sets defined by $\varphi(\overline{x};\overline{b})$ and $\varphi(\overline{x};\overline{b}')$ have the same volume.
Consider the formula $\varphi(x_1,x_2;y,z)$: $$(0\leq x_1\leq y)\land (z = 0\rightarrow (0\leq x_2\leq 1))\land (z = 1\rightarrow 0\leq (1+(x_1)^2)x_2\leq 1)$$
For all $b\geq 0$:

*

*$\varphi(x_1,x_2;b,0)$ defines a rectangle of width $b$ and height $1$. It has volume $b$.

*$\varphi(x_1,x_2;b,1)$ defines the region between the $x_1$-axis and the curve $x_2 = \frac{1}{1+(x_1)^2}$, with $0\leq x_1\leq b$. It has volume $\int_0^b \frac{1}{1+(x_1)^2}\,dx_1 = \tan^{-1}(b)$.

Thus, for $b$ and $c$ non-negative, we have $V^\varphi_=(b,0,c,1)$ if and only if $b = \tan^{-1}(c)$. That is, if $V^\varphi_=$ is definable in the real field, then so is the inverse tangent function (restricted to the non-negative domain). But of course $\tan^{-1}$ is not semi-algebraic.

Interestingly, the example $V^\varphi_=$ used above actually is definable in an o-minimal expansion of $\mathbb{R}$. Indeed, in  $\mathbb{R}_{\text{an}}$, the expansion of the real field by restricted analytic functions, the functions $\sin|_{[-\frac{\pi}{2},\frac{\pi}{2}]}$ and $\cos|_{[-\frac{\pi}{2},\frac{\pi}{2}]}$ are definable, so $\tan|_{(-\frac{\pi}{2},\frac{\pi}{2})}$ is definable, and hence $\tan^{-1}$ is definable.
This raises the following question, to which I do not know the answer: Suppose we expand the real field by a new $2n$-ary relation symbol $V^\varphi_=$ for each formula $\varphi(\overline{x};\overline{y})$ in the language of ordered fields, where $\overline{y}$ is a tuple of length $n$, and we give $V^\varphi_=$ its interpretation of volume comparison, as defined above. Is the resulting structure o-minimal? Are all these relations $V^\varphi_=$ definable in $\mathbb{R}_{\text{an}}$?
