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.
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.)