Consider a sequence of measurable functions $(f_n)_{n=1}^{\infty}$ with values $0$ or $1$. Define
$$ g_n = f_1 + (1-f_1)f_2 + (1-f_1)(1-f_2)f_3 + (1-f_1)(1-f_2)(1-f_3)f_4 + \dots $$
Prove that the sequence $g_n$ converges a.e.e to a function $g$ Is it true that $\lim_{n\rightarrow \infty} \int g_n dm = \int g dm$ Prove or give counterexample.
Clearly $g_n \rightarrow 1$ since as $n \rightarrow \infty$ then for the first time it happens at index $k \in (1,n)$ we have $f_k = 1$ and $f_s = 0$ $\forall s<k$ all the sums inside $g_n$ for all index after $k$ are 0. That's about all I can say about the problem.
Suppose $g_n = f_1 + (1-f_1)f_2 + (1-f_1)(1-f_2)f_3 + (1-f_1)(1-f_2)(1-f_3)f_4 + \dots$
Note that $g_n$ is monotone non-decreasing. I guess you want each $f_n$ measurable. Then so are the $g_n.$
Let $x\in A\subseteq \mathbb R$ for some Lebesgue measurable set $A$.
Suppose $f_j(x)=0$ for all integers $j\le n$. Then, $g_n(x)=0$ and so $g_n(x)\to 0.$
Otherwise, let $1\le j\le n$ be the first integer such that $f_j(x)=1.$ Then, because each term in $g_n$ after the $j^{th}$ is zero, once $f_j(x)=1,\ g_{k}(x)=1$ for all $k\ge n.$ So, $g_n(x)=f_j(x)=1$ and $g_n(x)=\max\{f_j(x):1\le j\le n\}$. We have then $g_n(x)\to 1.$
In paticular, $g$ is $not$ necessarily constant.
The final claim is true by the montone convergence theorem.