Let $T$ be a stopping time for the filtration $(\mathcal{F_n})_{n \in \mathbb{N}}.$ For all $n \in \mathbb{N} \cup \left\{+\infty \right\},$ we set $\phi(n)=\inf\left\{k \in \mathbb{N};\left\{T=n \right\} \in \mathcal{F_k}\right\}$.
Show that $\phi(T)$ is a stopping time and that $\phi(T) \leq T.$
I wrote $\left\{w;\phi(T(w))=n \right\}=\left\{w;T^{-1} (\left\{T(w) \right\}) \in \mathcal{F_n} \ and \ T^{-1}(\left\{T(w) \right\}) \notin \bigcup_{k=0}^{n-1}{\mathcal{F}_k} \right\} $ by I don't see how this will help us to prove that $\left\{w;\phi(T(w))=n \right\} \in \mathcal{F}_n$.
For fixed $k \in \mathbb{N}$ we define $$X_{n}(\omega) := 1_{\{\phi(n) \leq k\}} \phi(n) 1_{\{T = n\}}(\omega).$$Then $X_n$ is $\mathcal{F}_k$-measurable for each $n \geq 1$. Indeed:
Case 1: $\phi(n)>k$. Then $X_n=0$ and therefore $X_n$ is trivially $\mathcal{F}_k$-measurable.
Case 2: $\phi(n) \leq k$. By the very definition of $\phi$,
$$\{T=n\} \in \mathcal{F}_{\phi(n)}.$$ As $\phi(n) \leq k$ this gives $$\{T=n\} \in \mathcal{F}_{\phi(n)} \subseteq \mathcal{F}_k$$ and therefore $X_n = \phi(n) 1_{\{T=n\}}$ is $\mathcal{F}_k$-measurable.
Hence,
$$\phi(T) 1_{\{\phi(T) \leq k\}} = \sum_{n=1}^{\infty} 1_{\{\phi(n) \leq k\}} \phi(n) 1_{\{T=n\}} = \sum_{n=1}^{\infty} X_{n}$$
is $\mathcal{F}_k$-measurable. As $k \geq 1$ is arbitrary, this proves that $\phi(T)$ is a stopping time.