[proofplan]
Recall the definition of the weak topology $\sigma(X, \mathcal{F})$: it is the coarsest topology on $X$ making every $f \in \mathcal{F}$ continuous, generated by the sub-basis $\mathcal{S} = \{f^{-1}(V) : f \in \mathcal{F}, V \subseteq Y_f \text{ open}\}$. The forward direction of the equivalence uses that compositions of continuous maps are continuous. The converse uses the criterion that continuity of a map into a space generated by a sub-basis is equivalent to continuity tested against the sub-basis: if $g^{-1}(S)$ is open in $Z$ for every $S \in \mathcal{S}$, then $g$ is continuous, and $g^{-1}(f^{-1}(V)) = (f \circ g)^{-1}(V)$ is open in $Z$ exactly because $f \circ g$ is continuous.
[/proofplan]
[step:Recall the sub-basis defining $\sigma(X, \mathcal{F})$]
By definition, $\sigma(X, \mathcal{F})$ is the topology on $X$ generated by the family
\begin{align*}
\mathcal{S} := \{f^{-1}(V) : f \in \mathcal{F},\ V \subseteq Y_f \text{ open}\}
\end{align*}
as a sub-basis. Concretely:
- A basis $\mathcal{B}$ for $\sigma(X, \mathcal{F})$ consists of finite intersections of sub-basis elements: $B = f_1^{-1}(V_1) \cap \cdots \cap f_n^{-1}(V_n)$ for $f_i \in \mathcal{F}$ and $V_i \subseteq Y_{f_i}$ open.
- Open sets in $\sigma(X, \mathcal{F})$ are unions of basis elements.
In particular, each $f \in \mathcal{F}$ is continuous as a map $f: (X, \sigma(X, \mathcal{F})) \to Y_f$: for any open $V \subseteq Y_f$, the preimage $f^{-1}(V)$ is in $\mathcal{S}$, hence open in $\sigma(X, \mathcal{F})$.
[/step]
[step:Prove the forward direction: continuity of $g$ implies continuity of each $f \circ g$]
Assume $g: Z \to (X, \sigma(X, \mathcal{F}))$ is continuous. Fix $f \in \mathcal{F}$. By Step 1, $f: (X, \sigma(X, \mathcal{F})) \to Y_f$ is continuous. The composition of continuous maps is continuous, so
\begin{align*}
f \circ g: Z \xrightarrow{g} (X, \sigma(X, \mathcal{F})) \xrightarrow{f} Y_f
\end{align*}
is continuous.
[/step]
[step:Prove the converse: continuity of each $f \circ g$ implies continuity of $g$]
Assume $f \circ g : Z \to Y_f$ is continuous for every $f \in \mathcal{F}$. We show $g: Z \to (X, \sigma(X, \mathcal{F}))$ is continuous.
We use the standard criterion: a map $g: Z \to X$ into a topological space $X$ whose topology is generated by a sub-basis $\mathcal{S}$ is continuous if and only if $g^{-1}(S)$ is open in $Z$ for every $S \in \mathcal{S}$.
We verify the criterion. Fix $S \in \mathcal{S}$, so $S = f^{-1}(V)$ for some $f \in \mathcal{F}$ and $V \subseteq Y_f$ open. Then
\begin{align*}
g^{-1}(S) = g^{-1}(f^{-1}(V)) = (f \circ g)^{-1}(V),
\end{align*}
which is open in $Z$ by continuity of $f \circ g: Z \to Y_f$. So $g^{-1}(S)$ is open for every $S \in \mathcal{S}$.
Now we verify the criterion implies $g$ is continuous. Let $W$ be open in $\sigma(X, \mathcal{F})$. By Step 1, $W = \bigcup_\alpha B_\alpha$ where each $B_\alpha = S_{\alpha,1} \cap \cdots \cap S_{\alpha, n_\alpha}$ is a finite intersection of sub-basis elements. Preimages commute with unions and intersections:
\begin{align*}
g^{-1}(W) = g^{-1}\left(\bigcup_\alpha B_\alpha\right) = \bigcup_\alpha g^{-1}(B_\alpha) = \bigcup_\alpha \bigcap_{i=1}^{n_\alpha} g^{-1}(S_{\alpha, i}).
\end{align*}
Each $g^{-1}(S_{\alpha,i})$ is open in $Z$ from the verification just done; finite intersections of open sets are open, and arbitrary unions of open sets are open. Hence $g^{-1}(W)$ is open in $Z$. Since $W$ was an arbitrary open set in $\sigma(X, \mathcal{F})$, $g$ is continuous.
[/step]