Solution (source code)

= Solution

The joint law is the <Edwards-Sokal coupling>. For a fixed spin configuration, the sum over each <edge> state contributes $(1-p)+p\delta_e(\sigma)$. Since $\delta_e$ is either zero or one, setting $\beta=-\log(1-p)$ gives
$$
(1-p)+p\delta_e(\sigma)=(1-p)e^{\beta\delta_e(\sigma)}.
$$
Consequently the spin <marginal distribution> is the <Potts measure>
$$
\boxed{\mu_1(\sigma)=\frac1{Z'}\exp\left(\beta\sum_{e\in E}\delta_e(\sigma)\right),
\qquad e^{-\beta}=1-p,\qquad Z'=\frac{Z}{(1-p)^{|E|}}}.
$$
This follows from a finite sum that factorizes over <edges>, without any <independence> assumption on the spin marginal.

For a fixed <edge> configuration, the joint weight vanishes unless the spins agree across every open <edge>, equivalently unless they are constant on each open <percolation cluster>. Each of the $k(\omega)$ clusters, including <isolated vertices>, may independently be assigned any of $q$ colors. Thus exactly $q^{k(\omega)}$ spin configurations have nonzero weight, and their common weight is the <edge>-product factor divided by $Z$. The <edge> <marginal distribution> is therefore the <random-cluster measure>
$$
\boxed{\mu_2(\omega)=\frac1Z\left[\prod_{e\in E}p^{\omega(e)}(1-p)^{1-\omega(e)}\right]q^{k(\omega)}}.
$$
In this convention $Z''=Z$. Dividing the joint mass by this positive marginal gives the <conditional distribution>
$$
\boxed{\mu(\sigma\mid\omega)=q^{-k(\omega)}
\mathbf1\{\sigma\text{ is constant on every open cluster}\}}.
$$
Equivalently the clusters receive independent uniformly chosen colors. Conversely, conditionally on the spins, <edges> are independent: an unequal-spin <edge> must be closed, while an equal-spin <edge> is open with <probability> $p$. These two conditional descriptions explain the <Edwards-Sokal coupling> directly.

If $x$ and $y$ lie in the same open cluster, their conditional spin-equality <probability> is one. If they lie in different clusters, their two independent uniform colors agree with <probability> $1/q$. Averaging over the <random-cluster measure> yields
$$
\mu_1(\sigma(x)=\sigma(y))
=\mu_2(x\leftrightarrow y)+\frac1q\bigl[1-\mu_2(x\leftrightarrow y)\bigr],
$$
and hence the <spin-connectivity identity for the Potts model>
$$
\boxed{\mu_1(\sigma(x)=\sigma(y))-\frac1q
=\left(1-\frac1q\right)\mu_2(x\leftrightarrow y)}.
$$
The identity also includes $x=y$, when connectivity and spin equality are both certain.