I'd like to prove that if $T$ is a stopping time, $X_T$ is $\mathcal F_T$ measurable.
I know the set theory argument, but I thought that writting (as recommanded here : How to show that a stopped process $X_T$ is $\mathcal{F}$ measurable? ) :
$$ X_T=\sum_n\mathbf 1_{T=n}\cdot X_n $$ would make the proof simplier.
However I don't know how to conclude. My problem is that I don't know what to do with the $X_n$, which are $\mathcal F_n$ measurable, but possibly not $\mathcal F_T$ measurable. How can I do that ?
Let $B$ be any Borel set, then $$\{X_T \in B\} \cap \{T \leq k\} = \bigcup_{n=0}^k \{X_T \in B\} \cap \{T=n\} = \bigcup_{n=0}^k \{X_n \in B\} \cap \{T=n\} \in \mathcal{F}_k,$$ and so $X_T$ is $\mathcal{F}_T$-measurable.
Alternatively you can use the following small lemma which follows directly from the definition of $\mathcal{F}_T$.
Since (according to the identity from the body of your question) $$X_T 1_{\{T\leq k\}} = \sum_{n=0}^k X_n 1_{\{T=n\}},$$ it follows that $X_T 1_{\{T \leq k\}}$ is $\mathcal{F}_k$-measurable and so $X_T$ is $\mathcal{F}_T$-measurable.