What is the difference between $\mathbb E[Z|\mathcal G]=Y$ and $\mathbb E[Z|\mathcal G]\stackrel{\text{a.s.}}{=}Y$? I'm somewhat confused by the definition of martingale:

Let $(\Omega, \mathcal F, \mathcal F_n, \mathbb P)$ be a filtered probability space. We call $(X_n)_{n\in\mathbb N}$ martingale if for all $n\in\mathbb N$ holds:

*

*$X_n \in \mathcal L^1(\mathbb P)$


*$X_n$ is $\mathcal F_n$-measurable


*$\mathbb E[X_{n+1}|\mathcal F_n]\stackrel{\text{a.s.}}{=}X_n$

Why do we need "a.s." in the 3rd part? Isn't $\mathbb E[Z|\mathcal G]$ always unique only up to "a.s." anyway? How would we check the 3rd part without knowing that the 2nd part holds? (I.e. doesn't the 3rd imply the 2nd?) Why do we separate the points 2 and 3? Wouldn't it be enough to just ask for $\mathbb E[X_{n+1}|\mathcal F_n]=X_n$ instead?
 A: In general, 3 does not imply 2
Suppose $g$ is $\mathcal{F}$-measruable and $h=g$ almost surely, it does not imply $h$ is also  $\mathcal{F}$-measurable.
Take a set $A$ which is contained in $B \in \mathcal{F}$ with $P(B) = 1$, but $A$ is not itself in $\mathcal{F}$. By definition, $h = 1_{A}$ is alomst surely equal to the constant variable $g \equiv 0$. But $h$ is not $\mathcal{F}$-measurable, since $h^{-1}(\{1\}) = A \not\in \mathcal{F}$.
If $\mathcal{F}$ has been completed and the filtration is augmented by $\mathbb{P}$, then (2) is indeed unnecessary. That's one of the reason of completion and augmentation: to make sure modification on a null set doesn't cause measurability problem.
A: Let's generalise how 3 doesn't imply 2:

All versions of a conditional expectation are almost surely equal to each other, but any version is free to be equal to another random variable that is not a version of said conditional expectation.

Precisely:

Let $(\Omega,\mathcal F, \mathbb P)$ be a probability space with random variable $X \in \mathscr L^1$ and a sub-$\sigma$-algebra $\mathcal G$. Versions of $\mathbb E[X|\mathcal G]$ are almost surely equal to each other, but any version is free to be equal to another random variable, $Y$, that is not $\mathcal G$-measurable.

Consider $X=c$, $Y=c1_A$, $P(A)=1$ and $A \notin \mathcal G$. Then
$$\mathbb E[X|\mathcal G] := \mathbb E[c|\mathcal G] = c \stackrel{\text{a.s.}}{=}c1_A=:Y,$$ but $Y$ is not $\mathcal G$-measurable. You could say that $Y$ is a non-$\mathcal G$-measurable version of $\mathbb E[X|\mathcal G]$, i.e. it satisfies $E[Y1_G] = E[X1_G] \ \forall G \ \in \ \mathcal G$ but not $\sigma(Y) \subseteq \mathcal G$, if that's even a thing in probability.
