# If $M$ is a smooth manifold with boundary, $f \in C^\infty(M)$, $b$ a regular value of $f$, then is $f^{-1}((-\infty,b])$ a regular domain in $M$?

The above is taken from John Lee's Introduction to Smooth Manifolds (p. 121). In Proposition 5.47, one supposes that $$M$$ is a smooth manifold. Does Proposition 5.47 also hold if $$M$$ is changed to a smooth manifold with boundary?

Proposition 5.47. Suppose $$M$$ is a smooth manifold and $$f \in C^\infty(M)$$.

1. For each regular value $$b$$ of $$f$$, the sublevel set $$f^{-1}((-\infty,b])$$ is a regular domain in $$M$$.

2. If $$a$$ and $$b$$ are regular values of $$f$$ with $$a < b$$, then $$f^{-1}([a,b])$$ is a regular domain in $$M$$.

First recall the definition of a regular domain: it's a properly embedded (hence closed) codimension-$$0$$ smooth submanifold with boundary in $$M$$.
The basic problem is that wherever the boundary of a sublevel set intersects the boundary of $$M$$, you're likely to get a corner or worse. A simple counterexample is to take $$M$$ to be the closed upper half-plane $$\mathbb R \times [0,\infty)$$, and take $$f(x,y) = x$$. Then $$f^{-1}((-\infty,0])$$ is the quadrant $$\{(x,y): x \le 0,\ y\ge 0\}$$, which is a smooth manifold with corners but not a regular domain.
But it can be much worse than that -- for example, the "corner points" can have an accumulation point, which prevents the sublevel set from even being a smooth manifold with corners. For example, with $$M$$ as above, define $$f\colon M\to\mathbb R$$ by $$f(x,y) = u(x)-y$$, where $$u\colon\mathbb R\to \mathbb R$$ is given by $$\begin{equation*} u(x) = \begin{cases} e^{-1/x^2} \sin \frac{1}{x}, & x\ne 0,\\ 0, & x=0. \end{cases} \end{equation*}$$ Then there are infinitely many points on the $$x$$-axis where the boundary of the sublevel set $$f^{-1}((-\infty,0])$$ is not smooth, and they accumulate at the origin.