Let $\M$ be an o-minimal expansion of a dense linear order $(M,\lt)$ with language $\la$.

**Definition**

Let $A \subseteq M$ and $\phi(x_1, \dots, x_n)$ be an $\la(A)$-formula, and set $S:= \phi(M^n)$. We define $$\dim_A S := \sup\set{\dim(s/A):\ \N \models \phi(s), \ \N \succ \M},$$ where $\dim(s/A)$ is defined in $\N$ as in this post. Note that $\dim_A S \in \{-\infty, 0, \dots, n\}$ and that $\dim_A S = -\infty$ if and only if $S = \emptyset$.

We shall see below that $\dim_A S$ is independent of $A$, as long as $A$ contains all the parameters of the formula $\phi$.

**Exercise**

Let $A \subseteq M$, let $S \subseteq M^n$ be $A$-definable, and set $\kappa:= \max\{|\la|, |A|\}$. If $\M$ is $\kappa^+$-saturated, show that $\dim_A S = \max\set{\dim(a/A):\ a \in S}$.

**Lemma**

*Let $A \subseteq M$, and let $S,T \subseteq M^n$ be $A$-definable.*

- If $S \subseteq T$, then $\dim_A S \le \dim_A T$.
- $\dim_A (S \cup T) = \max\{\dim_A S, \dim_A T\}$.
- If $\iota:\{1, \dots, m\} \into \{1, \dots, n\}$ is strictly increasing, then $\dim_A \Pi_\iota(S) \le \dim_A S$.
- If $S$ is an open cell, then $\dim_A S = n$.
- Let $f:S \into M$ be $A$-definable. Then $\dim_A \gr(f) = \dim_A S$, and that $\dim_A f(S) \le \dim_A S$.

**Proof.** Say $S = \phi(M^n)$ and $T = \psi(M^n)$, for $\la(A)$-formulas $\phi$ and $\psi$. Then $S \subseteq T$ implies $\phi(N^n) \subseteq \psi(N^n)$ for all $\N \succ \M$, so part 1 follows.

For part 2, let $\N \succ \M$ and $s \in N^n$ be such that $\N \models (\phi \vee \psi)(s)$ and $\dim(s/A) = \dim_A(S \cup T)$. Then $\N \models \phi(s)$ or $\N \models \psi(s)$, so by definition $\dim_A(S \cup T) \le \max\{\dim_A S, \dim_A T\}$. The reverse inequality follows from part 1.

Part 3 follows from the fact that $\dim\left(\Pi_\iota(s)/A\right) \le \dim(s/A)$.

For part 4, assume that $S$ is an open cell. If $n=1$, then $S$ is infinite, so $\dim_A(S) = 1$ by the first Exercise of this post. So we assume $n>1$ and $\dim_A T = n-1$ for every open cell $T \subseteq M^{n-1}$. In particular, there exist $\N \succ \M$ and $a \in \Pi_{n-1}(S^*)$ such that $\dim(a/A) = n-1$, where $S^* \subseteq N^n$ is the set defined in $\N$ by the same formula that defines $S$ in $\M$. Then $S^*_a$ is infinite, so again by the first Exercise in this post, $\dim_A S = n$.

The equality of part 5 follows from the Lemma in this post, while the inequality then follows from part 3 and the observation that $f(S)$ is the projection of $\gr(f)$ on the last coordinate. $\qed$

**Proposition 1**

*Let $S \subseteq M^n$ and $f:S \into M^m$ be $A$-definable.*

*If $f$ is injective, then $\dim_A f(S) = \dim_A S$.**If $S$ is a $\sigma$-cell, then $\dim_A S = \sum\sigma$.**$\dim_A S$ is equal to the maximal $m \le n$ for which there exists a strictly increasing $\iota:\{1, \dots, m\} \into \{1, \dots, n\}$ such that $\Pi_\iota(S)$ is not sparse.**The number $\dim_A S$ is independent of $A$ (as long as $S$ is $A$-definable).*

**Proof.** Part 1 follows from Lemma 5 above applied to $f$ and $f^{-1}$.

For part 2, assume $S$ is a $\sigma$-cell. By Exercise 4 of this post $S$ is, after permuting the coordinates if necessary (which by part 1 does not change the dimension), the graph of a definable map $f:S^\sigma \into M^{n-\sum\sigma}$. Since $S^\sigma$ is an open cell, it has dimension $\sum\sigma$ by Lemma 4 above, so $S$ has dimension $\sum\sigma$ by Lemma 5 above.

Part 3 is true if $S$ is a cell, by part 2. It follows for general $S$ from the Cell Decomposition Theorem and Lemma 2 above (and because sparse definable sets are nowhere dense).

Since part 3 only depends on the set $S$, not on the formula defining it, part 4 follows. $\qed$

In view of Proposition 1, we now define, for any $A$-definable $S \subseteq M^n$, $$\dim S:= \dim_A S.$$ All the above statements then hold with “$\dim$” in place of “$\dim_A$”.

**Proposition 2**

*Let $S \subseteq M^{n+m}$ be definable and nonempty. For $d \in \{-\infty,0, \dots, m\}$, set $S_d:= \set{x \in M^n:\ \dim S_x = d}$. Then each $S_d$ is definable and $$\dim \big(S \cap (S_d \times M^m)\big) = \dim S_d + d.$$ *

**Proof.** Note first that if $S$ is a cell, then the proposition holds by Proposition 1. For general $S$, let $\C$ be a cell decomposition of $M^{m+n}$ compatible with $S$, and set $\D:= \Pi_m(\C)$. Then by the definition of cell decomposition and Proposition 1 above, for each $D \in \D$, the fibers $S_x$ have constant dimension as $x$ ranges over $D$. So for each $d$, the set $S_d$ is a finite union of cells in $\D$, hence is definable. The proposition now follows from Proposition 1 and case when $S$ is a cell. $\qed$