Dimension is an invariant in the Grothendieck ring of algebraic varieties $\DeclareMathOperator\Var{Var}$Let $k$ be any field and let $K_0(\Var_k)$ be the Grothendieck ring of $k$-algebraic varieties (i.e. algebraic varieties up to cut-and-paste relations). Given an algebraic variety $X$, the corresponding class $[X] \in K_0(\Var_k)$ will be called the virtual class of $X$.
Question: Does the virtual class of a variety $X$ on $K_0(\Var_k)$ determine the dimension of $X$? In other words, if $[X]=[Y]$ then is it true that $\dim X = \dim Y$?
Obviously, some hypotheses are needed in the field. For instance, if $k$ is a finite field, then $[X]$ is a bunch of points so any two varieties with the same number of points have (potentially) the same virtual classes.
If $k = \mathbb{C}$ (or a subfield of it) then this can be easily proven using the virtual Poincaré polynomial (or, with more machinery, the E-polynomial of the mixed Hodge structure).
However, I would like to get a similar proof for positive characteristic (say, for separably closed fields). When $k$ is separably closed, then étale cohomology says something, since $H_c^{2{\dim X}}(X, \mathbb{Q}_\ell(d))$ has positive dimension (see Corollary 7.5.21 of Poonen - Rational points on varieties). However, I don't know how to pack these cohomology groups into a “virtual Poincaré polynomial in positive characteristic” (is the naïve definition even additive?). I guess some additive function should do the job, but my knowledge of these guys in positive characteristic is quite limited (virtual motives, maybe?).
Edit: As pointed out in the comments, the dimension can also be read in the case of finite fields by looking at finite field extensions. For instance, the zeta function
$$
\zeta_X(s) = \sum_{m \geq 1} |X(\mathbb{F}_{q^m})|q^{-ms}
$$
encodes the dimension of $X$ (say, in its functional equation).
 A: Over finite fields, one can do either of the following to define the virtual Poincaré polynomial as an invariant in the Grothendieck ring of varieties.
(following naf) By the Weil conjectures, for $X/\mathbb F_q$, we have
$$ e^{ \sum_{n=1}^{\infty}  \frac{ \# X(\mathbb F_{q^n}) T^n} {n }  } = \prod_{i} (1 - \alpha_i T)^{e_i} $$ where $e_i \in \mathbb Z$ and $\alpha_i$ are complex numbers of norm $q^{w/2}$ for nonnegative integers $w$.
Let $$P (u) = \sum_{w=0}^{\infty} \sum_{i ,|\alpha_i|= q^{w/2}} e_i u^w.$$
Then since $X(\mathbb F_{q^n})$ is an additive invariant in the Grothendieck ring, the exponential of the sum is multiplicative, so $P(u)$ is additive.
(étale cohomology) Define $$P(u) = \sum_{w=0}^{\infty} \sum_{i=0}^{\infty} (-1)^i \dim H^i_c ( X_{\overline{\mathbb F_q}}, \mathbb Q_\ell)^{w} u^w$$
where $H^i_c( X_{\overline{\mathbb F_q}}, \mathbb Q_\ell)^{w}$ is the weight-$w$ part of $H^i_c ( X_{\overline{\mathbb F_q}}, \mathbb Q_\ell)$, i.e. the part where Frobenius acts by eigenvalues complex numbers of norm $q^{w/2}$.
This is additive by the excision long exact sequence.
By the Grothendieck–Lefschetz formula, these two definitions give the same value.
We can then pass to varieties over a general field as follows (also following naf):
Let $X$ be a variety over a field $k$. Let $R$ be the subring of $k$ generated by the coefficients of the finitely many polynomials defining $R$. (For non-quasiprojective varieties, we count the gluing maps in this.) Then $R$ is a finitely generated ring, so its maximal ideals all have finite residue fields and the associated closed points of $\operatorname{Spec} R$ are Zariski dense. We can spread out $X$ to a scheme $\mathcal X$ over $R$.
For each maximal ideal $\mathfrak m$, $ \mathcal X_{R/\mathfrak m}$ is a variety, and thus has a virtual Poincaré polynomial. This polynomial is a constructible function on $\operatorname{Spec} R$, hence constant on some dense open set. Define the virtual Poincaré polynomial of $X$ to be the virtual Poincaré polynomial of $ \mathcal X_{R/\mathfrak m}$  on a dense open set.
This is additive since, given a variety and an open set, we may pass to a ring where both are defined, and work over a dense open subset of that ring where the polynomials of the variety, open set, and closed complement are all well-defined, and then check the additive relation holds at each point.
Alternately, I believe you can pass to general fields directly in the second definition by defining weights, following Deligne, using the spectral sequence computing the cohomology of $X$ from the cohomology of a hypercovering, and using alterations to construct the hypercovering.
A: If $k$ has characteristic zero, one can use Looijenga–Bittner relations (Bittner - The universal Euler characteristic for varieties of characteristic zero) to show that for smooth proper varieties the generation function for Betti numbers is determined by the class of a variety. The degree of this polynomial when computed on the class of any (not necessarily smooth or proper) variety gives back its (doubled) dimension.
