Linked-cluster theorem. Let $Z$ be the partition function and $W_c$ is the generating functional of connected diagrams. Let them be normalized such that for the free theory$^1$ $$ \left.Z\right|_{g=0,J=0}~=~1\qquad\text{and}\qquad\left.W_c\right|_{g=0,J=0}~=~0. \tag{1}$$ In other words, $1$ is the value of the empty diagram, which by definition is not connected. Then $$\ln Z~=~\frac{i}{\hbar} W_c. \tag{2}$$
Proof. We will use a replica trick, cf. Ref. 1.
Recall that if a theory consists of $n$ independent sub-theories with partition functions $Z_1, \ldots, Z_n$ (i.e. interactions are only allowed within each sub-theories), then the partition function for the full theory is the product $Z_1 \cdots Z_n$.
Introduce $n$ copies of the original theory under investigation, where $n\in\mathbb{N}$ is a positive integer. The replica partition function becomes just a power $$\sum\left\{\text{all replica diagrams}\right\} ~=~Z^n,\tag{3}$$ because different copies do not interact. Each field $\phi^{\alpha}_{(i)}(x)$ in the replica theory now carries a copy label $i\in\{1, \ldots, n\}$, and doesn't talk to other copies.
Given a Feynman diagram $D$ in the original theory, the contributions to the corresponding replica Feynman diagram should be multiplied with a factor $n^{\#(D)}$, where $\#(D)$ denotes the number of connected components of $D$. In other words, $$\begin{align} \sum & \left\{\text{all replica diagrams}\right\}\cr &~=~ 1 + n\sum\left\{\text{connected original diagrams}\right\} +{\cal O}(n^2).\end{align} \tag{4}$$ In eq. (4) we have used the normalization (1).
Possibly illuminating example. If an original diagram $D^2/2!$ consists of the same connected diagram $D$ twice, the corresponding replica contributions $$(\sum_{i=1}^n D_{(i)})^2/2!~=~ n^2 D^2/2!\tag{5}$$ scale as $n^2$. Here $2!$ is a symmetry factor. The fact that the corresponding diagonal replica contributions $$(\sum_{i=1}^n D_{(i)}^2)/2!~=~ n D^2/2!\tag{6}$$ only scale with a lower power $n$ is not relevant/important because it is (implicitly) assumed that the RHS of eq. (4) is organized according to original (rather than replica) diagrams. End of example.
Now let's continue the proof. Equivalent to eq. (4), by Taylor expansion$^2$, $$\begin{align} \ln\sum &\left\{\text{all replica diagrams}\right\}\cr ~\stackrel{(4)}{=}~& n\sum\left\{\text{connected original diagrams}\right\} +{\cal O}(n^2). \end{align} \tag{7}$$
Combining eqs. (3) & (7) yield $$\ln Z - \sum\left\{\text{connected original diagrams}\right\} ~\stackrel{(3)+(7)}{=}~{\cal O}(n^1) .\tag{8}$$ The LHS. of eq. (8) is independent of $n$, i.e. it is a constant wrt. $n$. But since the RHS. of eq. (8) has no ${\cal O}(n^0)$ terms, the constant must be zero. (Alternatively, we may formally treat the integer $n$ as a real number, and take the limit $n\to 0^{+}.$) This yields the linked-cluster theorem (2). $\Box$
See also this and this related Phys.SE posts.
References:
- X.G. Wen, QFT of many-body systems, (2004); p. 143.
$^1$NB: Conventionally in QFT, one allows for a multiplicative normalization factor in the partition function $Z$, which hence corresponds to an additive constant in $W_c$, cf. eq. (2).
If $\left.W_c\right|_{g=0,J=0}$ is non-zero, e.g. as a result of a functional determinant calculation, it is common to graphically identify it with (the sum of) self-loops $\bigcirc$ of propagators, since such graphs are the only connected ones with no ends that contain no vertices $g$ and no external sources $J$. We stress that $\bigcirc$ is not an ordinary perturbative Feynman diagram. (Periodic boundary conditions seem to play no role in that the curve $\bigcirc$ is closed rather than open.)
$^2$ The logarithm is here strictly speaking defined as a formal power series: $-\ln(1-x)=\sum_{j=1}^{\infty}\frac{x^j}{j}$.