Solution (source code)

= Solution

For a <polynomial> with $n$ distinct roots, the criterion is
$$
\boxed{G_f\subseteq A_n\iff\Delta_f\text{ is a nonzero square in }\mathbb Q.}
$$
Write $\delta=\prod_{i<j}(\alpha_i-\alpha_j)\ne0$. Part (a) gives $\sigma\delta=\operatorname{sgn}(\sigma)\delta$. If every Galois <permutation> is even, $\delta$ is fixed by the entire <Galois group> and therefore belongs to its <fixed field> $\mathbb Q$. Thus $\Delta_f=\delta^2$ is a rational square. Conversely, if $\Delta_f=q^2$ with $q\in\mathbb Q^\times$, then $\delta^2=q^2$ in a <field> implies $\delta=\pm q$. Every <automorphism> fixes this nonzero element, so its <permutation> sign must be one.

The distinct-root hypothesis is necessary in the statement's intended degree-$n$ <permutation> action. The source says “arbitrary degree” without stating that hypothesis. If repeated roots were allowed, zero <discriminant> would carry no sign information: $(X-1)^2(X^2-2)$ has <discriminant> zero, while its nontrivial <automorphism> swaps $\sqrt2,-\sqrt2$ and fixes the two rational-root positions, an odd <permutation>. The criterion above applies to the <squarefree polynomial>, or to the squarefree part with its degree and root action adjusted accordingly.