I want to prove that the systematic scan Gibbs sampler yields an aperiodic chain $X$ on a general state space. Let $\pi$ be the stationary distribution for the resulting chain.

Suppose to get a contradiction that the sampler is periodic with period $d$ and associated partition $A_0,..,A_{d-1}$, meaning that when starting from $X_0\in A_0$, we have $X_1\in A_1$, $\ldots$, $X_{d-1}\in A_{d-1}$ and $X_d\in A_0$. Hence, by ergodicity, we have $\pi(A_k) = 1/d$ for all $k$.

We fix the scan order as $1,...,k$ without loss of generality. Write $Y_0 = X_n$ and let $Y_1$ be the state of the Markov chain after the fist update in iteration $n$ of the Gibbs Sampler, $Y_2$ the second and so on. Then conditional on $Y_1,..,Y_{k-1}$ the two random elements $X_n = Y_0$ and $X_{n+1} = Y_k$ are conditionally independent. Hence $$\mathbb{P}(X_{n+1} \in A_k | X_n \in A_k,Y_1,...,Y_{k-1}) = \mathbb{P}(X_{n+1} \in A_k | Y_1,...,Y_{k-1})$$holds. And here is the step I do not get:

In order for the sampler to be periodic, we must have: $$\mathbb{P}(X_{n+1} \in A_k | X_n \in A_k) = \mathbb{E}[\mathbb{P}(X_{n+1} \in A_k | X_n \in A_k,Y_1,...,Y_{k-1}) | X_n \in A_k]$$

equal to zero. Why can we write the conditional probability as this expectation value? And why does this imply that $\mathbb{P}(X_{n+1} \in A_k | Y_1,...,Y_{k-1})$ is zero a.s. wrt to $\pi$? Is this something like the total probability law?