Given the filtered probability space $(\Omega, \mathbb{F}, \mathbb{P})$, for any $s<t$ and any event $A \in \mathcal{F}_s$, define the random variable $\tau: \Omega \to (0,\infty)$ by $\tau(\omega) = s\mathbb{1}_A(\omega) + t \mathbb{1}_{A^c}(\omega)$.
Show that $\tau$ is an $\mathbb{F}$-stopping time, and that if $X$ is an $\mathbb{F}$-adapted random variable, then $X$ is maringale iff $\mathbb{E}[X_{\tau}]=\mathbb{E}[X_0]$ for any stopping time $\tau$ of the form defined above.
Showing it's a stopping time: I want to show that for all $r$, $\{\omega \in \Omega:\tau(\omega) \leq r \} \in \mathcal{F}_r$. I have that: $$\{\omega \in \Omega:\tau(\omega) \leq r \} = \{\omega: s\mathbb{1}_A(\omega) + t \mathbb{1}_{A^c}(\omega) \leq r\} =\{\omega \in A: s \leq r\} \cup \{w \in A^c: t \leq r\}$$ I interpret $\{\omega \in A: s \leq r\}$ is to be the set $A$ if $r\geq s$, and I guess the empty set otherwise? But I don't really understand. However, using this interpretation:
Since $A \in \mathcal{F}_S$, if $s \leq r$, then $A \in \mathcal{F}_s \subset \mathcal{F}_r$ so $\{\omega \in A: s \leq r\} \in \mathcal{F}_r$. Also, since $s <t, A^c \in \mathcal{F}_s \subset \mathcal{F}_t$, so $\{\omega \in A^c:t \leq r\}\in \mathcal{F}_r$. $\mathcal{F}_r$ is closed under countable unions, so $$\{\omega \in \Omega:\tau(\omega) \leq r \} = \{\omega \in A: s \leq r\} \cup \{w \in A^c: t \leq r\} \in \mathcal{F}_r$$
For proving the second part, I'm confused about what $X_\tau$ means. How do we make sense of a random variable indexed by a stopping time?
Any help or hints would be appreciated!
Your argument for the first part is perfect. You have proved that $\tau$ is a stopping time. $X_\tau$ is defined by $X_\tau (\omega)=X_{\tau (\omega)} (\omega)$. Noting that $\tau (\omega) =s$ if $\omega \in A$ and $\tau (\omega) =t$ if $\omega \in A^{c}$ the equation $EX_\tau =EX_0$ can be written as $EX_s I_A+EX_t I_{A^{c}}=EX_0$. If this holds for all choices of $s,t,A$ we can take $A=\Omega$ to get $EX_s=EX_0$. We can now write $EX_s I_A+EX_t I_{A^{c}}=EX_s$. By transferring the first term to the right we can write $EX_t I_{A^{c}}=EX_s-EX_sI_A=EX_sI_{A^{c}}$. This holds for all $A \in \mathcal F_s$ and we can replace $A$ by $A^{c}$. What you get is exactly the definition of a martingale. For the converse part simply go backwards in this argument.