Doob-Dynkin Lemma for Stopped Sigma Field Suppose that $X_{0},X_{1},\ldots$ is a sequence of real-valued random variables.  Let $\mathcal{F}_{n}=\sigma(X_{0},\ldots,X_{n})$.  The Doob-Dynkin lemma says that any $Y$ that is $\mathcal{F}_{n}$-measurable can be written as $Y=g(X_{0},\ldots, X_{n})$ for $g:\mathbb{R}^{n+1}\rightarrow \mathbb{R}$ measurable (with respect to the Borel sigma fields).  This lemma is sometimes used to interpret $\mathbb{E}(Y| \mathcal{F}_{n})$ as either a random variable or a measurable function $\mathbb{R}^{n+1}\rightarrow \mathbb{R}$ (as in the second paragraph of https://en.wikipedia.org/wiki/Conditional_expectation).
If $N$ is a stopping time, we sometimes condition on $\mathcal{F}_{N}$, as in the strong markov property.  Is there a version of the Doob-Dynkin lemma for $\mathcal{F}_{N}$?  My intuition is that an $\mathcal{F}_{N}$-measurable random variable should be some kind of measurable function of the information $(N=n,X_{0}=x_{0},\ldots,X_{n}=x_{n})$.
 A: Introduction
I'll be working in the discrete time setting, which seems to be the case in OP's question. Define $1_{S}$ as the indicator function of a set $S$.
Let's recall what the definition of $\mathcal F_N$ is : A set $A \in \mathcal F$ (which is the sigma-algebra for the probability space on which the $X_i$ are defined) belongs in $\mathcal F_N$ if and only if , for all $n \in \mathbb N$, we have that $A \cap \{N = n\} \in \mathcal F_n$.
We also recall a simple fact : a set $B$ is contained in a sigma-algebra $\mathcal G$ if and only if $1_B$ is measurable with respect to $\mathcal G$.
In other words, we should have , for all $n \in \mathbb N$ that $1_{A \cap \{N = n\}}$ is $\mathcal F_n$ measurable.
Using the Doob-Dynkin lemma for the case that we do know, this occurs if and only if $1_{A \cap \{N = n\}} = g(X_0,X_1,...,X_n)$ (almost surely) for some function $g : \mathbb R^{n+1} \to \mathbb R$.
Note that $1_{A \cap \{N = n\}} = 1_{A} 1_{\{N=n\}}$ and ,if we assume that $N$ is a.s. finite, then it is true that $1_{A} = \sum_{n=0}^\infty 1_{A}1_{\{N = n\}}$ (since the exceptional set is contained in $\{N = \infty\}$ , which has measure zero).
But then, using the property of indicators,
$$
1_A1_{\{N = n\}} = 1_{\{N = n\}}(1_{A} 1_{\{N =n\}}) = 1_{\{N = n\}} g(X_0,X_1,...,X_n)
$$
and using countable additivity and monotonicity of the underlying probability measure , the union  of the null sets on which the above don't hold for a particular $n$, has probability zero.
In particular, we arrive at the following statement.

For $A \in \mathcal F$, $1_A$ is $\mathcal F_N$ measurable for an a.s. finite stopping time $N$ if and only if there exist $g_n : \mathbb R^{n+1} \to \mathbb R$ such that
$$
1_A = \sum_{n=0}^\infty 1_{\{N=n\}}g_n(X_0,...,X_n)
$$
almost surely.


Statement of our Doob-Dynkin Lemma
At this point, we are ready to mock the Doob-Dynkin lemma proof and prove the following :

Let $X_i$ be a sequence of random variables, $N$ be an a.s. finite stopping time for the filtration generated by the $X_i$, and $\mathcal F_N$ the associated stopped filtration. A random variable $Y$ is $\mathcal F_N$ measurable if and only if there exist Borel measurable functions $g_n : \mathbb R^{n+1} \to \mathbb R$ such that $$
Y = \sum_{n=0}^{\infty} 1_{\{N=n\}}g_n(X_0,...,X_n)
$$
almost surely.

Proof : We'll mock the Wikipedia proof, pretty much line-for-line. You can try this yourself, but I'm going to edit this in because it's essential to my answer and I'd like it to be present in the post. (Note : I'd have absolutely loved to use the monotone class theorem for functions, but I'm not going to. Instead, for this I'll redirect you here to see the result that you will need to use, and it's one that will benefit you for future usage).
Simple random variables
So for random variables of the form $Y= 1_A$ for $A \in \mathcal F_N$, we are already done. Let's now consider a simple random variable i.e. one that is of the form $Y = \sum_{i=1}^m c_i1_{A_i}$ where $c_i$ are real constants and $A_i,i=1,...,m \in \mathcal F_N$ is a partition of the sample space. How does the lemma work here?
Well, for each $i$, we know that $1_{A_i} = \sum_{n=0}^\infty 1_{\{N = n\}}g^i_n(X_0,...,X_n)$ for Borel measurable $g^i_n$. By exchanging the finite and infinite summation, we obtain :
$$
Y= \sum_{i=1}^m c_i \sum_{n=0}^\infty 1_{\{N=n\}}g^i_n(X_0,...,X_n) = \sum_{n=0}^\infty 1_{\{N=n\}}\color{blue}{\sum_{i=1}^m c_i g^i_n(X_0,...,X_n)}
$$
where the $\color{blue}{\text{blue}}$ part is a finite sum of Borel functions, hence Borel itself. Thus, we are done for simple functions.
Positive random variables
Next, we use the following result : any non-negative (not necessarily bounded) measurable random variable $Y$ is the pointwise a.s. limit of an a.s. non-decreasing sequence of simple random variables $Y_k$.
Suppose that $Y_k = \sum_{n=0}^\infty 1_{\{N=n\}} g^k_n(X_0,...,X_n)$ for some $g^k_n$ Borel. What we know, is that $Y = \lim_{k \to \infty} Y_k$ a.s.
Now, suppose we could prove that all the equalities in :
$$
Y =^{(1)} \lim_{k \to \infty}\sum_{n=0}^\infty 1_{\{N=n\}} g^k_n(X_0,...,X_n) =^{(2)}  \sum_{n=0}^\infty [\lim_{k \to \infty} 1_{\{N=n\}} g^k_n(X_0,...,X_n)] \\ =^{(3)} \sum_{n=0}^\infty  1_{\{N=n\}}\left[\color{green}{\lim_{k \to \infty} g^k_n(X_0,...,X_n)}\right]
$$
held true a.s. and concerned well-defined quantities , we are done. Equality $1$ follows by substituting for $Y_k$ in the formula $Y = \lim_{k \to \infty} Y_k$.
Equality $2$ will follow from the monotone convergence theorem , so let's prove it. If we fix an $\omega$ in the sample space for which the $Y_k$ are non-decreasing and $N(\omega) = n <\infty$ then  $Y_k(\omega)$ increasing implies that the sequence $g^k_n(X_0(\omega),...,X_n(\omega))$ is non-negative and increasing in $k$, and obviously that $1_{N(\omega)=n}g^k_n(X_0(\omega),...,X_n(\omega))$ is increasing in $k$. Thus, $1_{N=n}g^k_n(X_0,...,X_n)$ is non-negative a.s. increasing in $k$ for all $n$ : which means the monotone convergence theorem applies and $2$ is proved.
Equality $3$ is obvious, but we already discussed above that $g_n^k(X_0,...,X_n)$ are non-negative increasing in $k$, and any non-negative increasing sequence has a limit in $\overline{\mathbb R}$. It is well known that the limit is a well defined Borel measurable function. Thus, the result holds for all positive random variables $Y$.
General case
Write , for a  general random variable $Y$, the decomposition $Y = Y^+ - Y^-$ where $Y^+ = \max\{Y,0\}$ and $Y^- = \max\{-Y,0\}$. Each of the random variables $Y^+$ and $Y^-$ is a non-negative random variable, hence by the above demonstration can be written in the desired form. As $Y$ is just a difference of these, using an argument analogous to the exchange of the finite-infinite summation performed earlier, we conclude that $Y$ can be written in the form desired. $\blacksquare$
