Conditioning events on a conditional expectation Let $X_0=a$ for some $0<a<1$ and for $n \geq 0$, let
$\mathbb{P}(X_{n+1}=X_n/2|\mathcal{F}_n)=1-X_n$ and $\mathbb{P}(X_{n+1}=(1+X_n)/2| \mathcal{F}_n)=X_n$. 
Show that X is a martingale.
This is "easy" to show by conditioning on events $A=\{ X_{n+1}=X_n/2 \} $ and $B=\{ X_{n+1}=(1+X_n)/2 \} $ which partition a set which is almost the sample space. However, I am getting slightly confused writting out the argument formally from the definition of $\mathbb{E}[X_{n+1}| \mathcal{F}_n]$. 
For example, consider starting with $\mathbb{E}[X_{n+1}| \mathcal{F}_n]=\mathbb{E}[X_{n+1}\mathbb{I}_A| \mathcal{F}_n]+\mathbb{E}[X_{n+1}\mathbb{I}_B| \mathcal{F}_n]$, and then consider $\mathbb{E}[X_{n+1}\mathbb{I}_A| \mathcal{F}_n]$. How can I represent $\mathbb{E}[X_{n+1}\mathbb{I}_A| \mathcal{F}_n]$/$\mathbb{E}[\mathbb{I}_A| \mathcal{F}_n]$ (which we need to show equals $X_n/2$)?
 A: You can show $X$ is a martingale as follows :
$$\mathbb E(X_{n+1}|\mathcal F_n) = (1-X_n)(X_n/2)+X_n(1+X_n)/2 = X_n\;.$$

To argue this more carefully, you condition on the event $\mathbf X=\mathbf x$, where $\mathbf X$ is shorthand for $(X_0,\ldots,X_n)$ and $\mathbf x$ is short for $(x_0,\ldots,x_n)$:
$$
\begin{align}
\mathbb E(X_{n+1}|\mathbf X=\mathbf x)&=\sum_yy\mathbb P(X_{n+1}=y|\mathbf X=\mathbf x)\\
&= \mathbb P(X_{n+1}=x_n/2|\mathbf X=\mathbf x) (x_n/2) +
\mathbb P(X_{n+1}=(1+x_n)/2|\mathbf X=\mathbf x) (1+x_n)/2 \\
&= (1-x_n) (x_n/2) + (x_n) (1+x_n)/2
\end{align}
$$

To go all the way back to basics and argue this from the definition of conditional expectation, the first statement $\mathbb P(X_{n+1}=X_n/2|\mathcal F_n)=1-X_n$ implies $\mathbb E\left[I(X_{n+1}=X_n/2)I(A)\right]=\mathbb E\left[(1-X_n)I(A)\right]$
for every $A$ in $\mathcal F_n$.
Put $A=\{\mathbf X=\mathbf x\}$ to get
$$
\begin{align}
\mathbb P(X_{n+1}=x_n/2,\mathbf X=\mathbf x)
&=
\mathbb E\left[I(X_{n+1}=x_n/2)I(\mathbf X=\mathbf x)\right]\\
&=\mathbb E\left[I(X_{n+1}=X_n/2)I(\mathbf X=\mathbf x)\right]\\
&=\mathbb E\left[(1-X_n)I(\mathbf X=\mathbf x)\right]\\
&=\mathbb E\left[(1-x_n)I(\mathbf X=\mathbf x)\right]\\
&= (1-x_n)\mathbb P(\mathbf X=\mathbf x)\;.
\tag{*}
\end{align}
$$
A similar identity follows from the second statement.
To now show that $\mathbb E[X_{n+1}I(A)]=\mathbb E[X_nI(A)]$ for every $A$ in $\mathcal F_n$, put $A=\{\mathbf X=\mathbf x\}$ again and use identities of the form $(*)$:
$$
\begin{align}
\mathbb EX_{n+1}I(\mathbf X=\mathbf x)&=
\mathbb E[X_{n+1}I( X_{n+1}=x_n/2 , \mathbf X=\mathbf x)]
+\mathbb E[X_{n+1}I( X_{n+1}=(1+x_n)/2 , \mathbf X=\mathbf x)] \\
&=(x_n/2) \mathbb P( X_{n+1}=x_n/2 , \mathbf X=\mathbf x)
+((1+x_n)/2)\mathbb P(X_{n+1}=(1+x_n)/2 , \mathbf X=\mathbf x)\\
&=(x_n/2) (1-x_n)\mathbb P( \mathbf X=\mathbf x)
+((1+x_n)/2)(x_n)\mathbb P(\mathbf X=\mathbf x)\\
&=x_n\mathbb P( \mathbf X=\mathbf x)\\
&=\mathbb EX_nI( \mathbf X=\mathbf x)\\
\end{align}
$$
