Assume $\mathcal M$ and $S$ satisfy all of the assumptions in the exercise, including 1-4. For each $m\in\mathbb N$, define $A_m = \{x\in\Pi_n(S) : |S_x| \geq m\}$. We will show that each $A_m$ is either empty or equal to $S$, and hence that $S_x$ is equal to the minimal value of $m$ such that $A_m\neq\emptyset$.

Suppose $x\in M^n$ with $|S_x|=m$ for some $m$, and write $\Pi_n^{-1}(x) = \{(x,y_1),\ldots,(x,y_m)\}$. Since $\Pi_n|_S$ is a local homeomorphism, there exist boxes $B_x^1,\ldots,B_x^m\subseteq M^{n+1}$ with $(x,y_i)\in B_x^i$ such that each $S\cap B_x^i$ is the graph of a function $f: \Pi_n(S\cap B_x^i)\to M$. In particular, for each $z\in M^n$ there is a unique $y_z^i\in M$ such that $(z,y_z^i) \in S\cap B_x^i$. By shrinking the boxes if necessary, we may assume the following:

- $B_x^i\cap B_x^j = \emptyset$ for all $i\neq j$,
- $P_x := \bigcap_{i=1}^m \Pi_n(S\cap B_x^i) = \Pi_n(S\cap B_x^i)$ for all $i\leq m$, since the fact that each $\Pi_n(S\cap B_x^i)$ is an open neighbourhood of $x$ implies that their intersection $P_x$ is also an open neighbourhood of $x$, and
- $S\cap (P_x\times M)$ is bounded.

Fix any $k\in\mathbb N$ such that $A_k\neq\emptyset$. If $x\in A_k$ then for each $z\in P_x$, we must have $|S_z| \geq k$, since there exist distinct $y_z^1,\ldots,y_z^k\in M$ with $(z,y_z^i) \in S\cap B_x^i$. Thus, $A_k$ is open.

Suppose $x\in cl(A_k)\setminus A_k$, say $|S_x|=m<k$. Then, as above, for each $i\leq m$ and $z\in A_k\cap P_x$ there is a unique point $y_z^i\in S_z\cap B_x^i$. Let $U = (S\cap (P_x\times M))\setminus (B_x^1\cup \ldots \cup B_x^m)$. For each $z\in A_k\cap P_x$,

\[ |S_z \cap (S\cap (B_x\times M))| = |S_z| \geq k \]
and hence $|S_z\cap U| = |S_z|-m \geq k-m > 0$.

For any definable set $D\subseteq M^n$, write $\sup_{n+1}(D)$ for the supremum of values $d_{n+1}$ such that there exists $d\in D$ with $(d,d_{n+1})\in S$. The paragraph above shows that for any definable $D\subseteq A_k$, the set $(D\times M)\cap U$ is non-empty, and hence $\sup_{n+1}(\Pi_n(U)\cap D)$ is well defined for any such set by definable completeness.

Write $E$ for the set of boxes $B$ such that $x\in B\subseteq P_x$. Then the set

\[ V = \{y\in M : y = \sup{}_{n+1}(B\cap\Pi_n(U)\cap A_k)\text{ for some }B\in E\} \]
is definable and non-empty, and hence has an infemum $l$ by definable completeness.

**Claim:** $(x,l)$ is a limit point of $A_k\times M$.

Suppose $Z\subseteq M^n$ is a box and $Y\subseteq M$ is an interval such that $(x,l)\in Z\times Y$. Since $x$ is a limit point of $A_k$, $Z’ = Z\cap \Pi_n(U)\cap A_k\neq\emptyset$, and so $\sup_{n+1}(Z’)$ is well-defined, and (since $Z$ is a box) contained in $V$. By shrinking $Z$ (and $Z’$) if necessary, we may assume that $l \leq \sup_{n+1}(Z’) \leq \sup(Y)$. By definition of supremum, there must exist $(z,y)\in Z’\times Y$ with $y\in (l,\sup_{n+1}(Z’))$. Thus $(Z\times Y)\cap A_k\times M$ is non-empty, which means $(x,l)$ is a limit point of $A_k\times M$. (end of claim)

But then $y_x^1,\ldots,y_x^m,l \in S_x$, so $|S_x| \geq m+1$, contradicting our choice of $x$. Thus, $A_k$ is closed, which means it is a definable non-empty clopen subset of $S$. Since $S$ is definably connected, we must have $A_k = S$. Thus, since $k$ was chosen arbitrarily, there exists $m$ such that $A_m = \emptyset$ and $A_{m+1} = S$, which means $|S_x| = m$ for all $x\in\Pi_n(S)$.

For the counter-examples, consider the structure $\mathcal R$, the real numbers as an ordered field. Since $\mathbb R$ is complete, $\mathcal R$ is definably complete. Write $\Pi: \mathbb R^2\to\mathbb R$ for projection onto the first coordinate, and consider the following definable subsets or $\mathcal R^2$:

- $A = \{(x,0) : x\neq 0\}\cup\{(x,1) : x < 0\}$
- $B = \{(x,0) : x\in\mathbb R\}\cup\{(x,-\frac1x) : x\neq 0\}$
- $C = \{(x,0) : x\in\mathbb R\}\cup\{(x,1) : x < 0\}$
- $D = \{(x,0) : x\in\mathbb R\}\cup\{(x,x) : x\in\mathbb R\}$

Since $\mathbb R = \Pi(B) = \Pi(C) = \Pi(D)$ is connected, it is definably connected. Since $A$ and $C$ are bounded, they are locally bounded at every $x\in\mathbb R$; the set $D$ is also locally bounded, since for each $x\in\mathbb R$, the set $\{(z,y)\in D: z\in (x-1,x+1)\}$ is contained in $(x-1,x+1)\times(x-1,x+1)$. The sets $B$ and $D$ are the unions of two graphs of continuous functions, and hence are closed in $\mathbb R^2$; $A$ is the intersection of the closed set $\{(x,0) : x\in\mathbb R\}$ with $\Pi(A)\times\mathbb R$, and hence is closed in $\Pi(A)\times\mathbb R$. The restrictions $\Pi|_A,\Pi|_B,\Pi|_C$ are all clearly local homeomorphisms. Thus, each of the sets $A,B,C,D$ satisfies three of the four conditions.

However, $A$ is clearly not definably connected, $B$ is not bounded on any $I\times\mathbb R$ where $I$ is an interval containing $0$, $C$ is not closed in $\Pi(C)\times\mathbb R=\mathbb R^2$, and $\Pi|_D$ is not a homeomorphism on any neighbourhood of $(0,0)$. Moreover, in all cases, the fibres at $x<0$ have size 2, while the fibres at $x=0$ have size 1.