Verify that a random variable is a stopping time

Let $\lbrace X_{n}\rbrace$ be a stochastic process adapted to filtration $\lbrace \mathcal{F}_{n}\rbrace$. Let $B\subset \mathbb{R}$ be closed. Then $$\tau(\omega):=\mathtt{inf}\lbrace n\in\mathbb{N}:X_{n}(\omega)\in B\rbrace$$ is a stopping time.

My solution. Fix $k\in\mathbb{N}$. Then $$\lbrace\tau=k\rbrace=\lbrace\omega:X_{k}(\omega)\in B, X_{n}(\omega)\notin B,n<k\rbrace=\lbrace \omega:X_{k}(\omega)\in B\rbrace\cap\bigcap_{n=0}^{k}\lbrace\omega:X_{n}(\omega)\notin B\rbrace$$ Now, $X_{k}$ is $\mathcal{F}_{k}$-measurable, $B$ is a Borel set, so $X_{k}^{-1}(B)\in \mathcal{F}_{k}$. Since $B$ closed, the complement of $B$ is open, so also Borel, and for $n<k$ we have, by the same logic, $X_{n}^{-1}(B^{c})\in\mathcal{F}_{n}\subset \mathcal{F}_{k}$. The intersection of finitely many elements of $\mathcal{F}_{k}$ lies in $\mathcal{F}_{k}$, so for any natural $k$ it's true that $\lbrace\tau=k\rbrace\in\mathcal{F}_{k}$. Now, is this solution correct? Is it necessary to assume the closedeness of $B$? I have a feeling it's sufficient to assume that $B$ be Borel, isn't it?

-
Your solution is good, though your intersection should end at index $k-1$, not $k$. –  Byron Schmuland Feb 1 '13 at 22:13

As ByronSchmuland already mentioned your intersection should end at index $k-1$, i.e.
$$\{\tau=k\} = \ldots = \{\omega; X_k(\omega) \in B\} \cap \bigcap_{n=0}^{k-1} \{\omega; X_n(\omega) \notin B\}$$
The closedness of $B$ is not necessary for the given proof. Since $B$ is a Borel set we also have that $B^c$ is a Borel set (it's a sigma-algebra!), hence $X_n^{-1}(B^c) \in \mathcal{F}_n$ by the $\mathcal{F}_n$-measurability of $X_n$.
If you consider a stochastic process $(X_t)_{t \geq 0}$, it wouldn't be that easy to prove that $\tau$ is a stopping time - in this case one often assumes that $B$ is open (resp. closed) and left- or right-continuity of the paths $t \mapsto X_t(\omega)$. But in this case it work's fine, because it's a process in discrete time.