Solution (source code)

= Solution

All the <local fields> here carry normalized <discrete valuations>. Write $\mathcal O_F$ for the <valuation ring>, $\mathfrak m_F$ for its <maximal ideal>, and $k_F$ for its <residue field>. We use the basic degree identity $[B:A]=e(B/A)f(B/A)$ for finite extensions of non-Archimedean <local fields>, with $e$ the <ramification index> and $f$ the <residue degree>.

First construct the <maximal unramified subextension of a local field extension> inside an arbitrary finite extension $L/K$. Choose a <primitive element of a field extension> $\bar z$ for the finite <residue field> extension $k_L/k_K$. Let $\bar h$ be its monic irreducible <minimal polynomial of an algebraic element>, of degree $f$, and lift its coefficients to obtain a monic $h\in\mathcal O_K[T]$ of the same degree. Finite <finite fields> are <perfect fields>, so $\bar h'(\bar z)\ne0$. By <Hensel lemma> applied in $L$, there is $z\in\mathcal O_L$ reducing to $\bar z$ with $h(z)=0$. For $U=K(z)$ we have
$$
f=[k_L:k_K]\leq[k_U:k_K]\leq[U:K]\leq\deg h=f.
$$
Every inequality is therefore an equality. In particular $U/K$ is <unramified>, $k_U=k_L$, and $h$ is the <minimal polynomial of an algebraic element> $z$.

If $L/K$ is <unramified>, then $[L:K]=f$, so this construction gives $U=L$. Taking $x=z$ supplies the required generator, and $h'(x)$ is a <unit>. Conversely suppose $L=K(x)$ with $x$ integral and its monic <minimal polynomial of an algebraic element> $g$ satisfying $g'(x)\notin\mathfrak m_L$. Its coefficients lie in $\mathcal O_K$, since all conjugates of an integral element are integral and $K$ is complete. In the constructed <unramified extension> $U$ the element $\bar x\in k_U=k_L$ is a simple root of $\bar g$. <Hensel lemma> in $U$ produces a root $x'\in U$ with residue $\bar x$. In $L$ both $x$ and $x'$ lift this same simple residue root, so Hensel uniqueness gives $x=x'$. Thus $L\subseteq U\subseteq L$, proving
$$
\boxed{L/K\text{ is unramified}\iff L=K(x),\ x\in\mathcal O_L,\ g'(x)\in\mathcal O_L^\times.}
$$

For <lifting residue-field embeddings of unramified extensions>, use the generator $z$ and polynomial $h$ just constructed when $L/K$ is <unramified>. Given a $k_K$-<field homomorphism> $\iota:k_L\to k_M$, its value $\iota(\bar z)$ is a simple root of $\bar h$. <Hensel lemma> in $M$ produces the unique root $z'\in\mathcal O_M$ with that residue. The assignment $z\mapsto z'$ defines a $K$-<field homomorphism> $K[T]/(h)\to M$; it induces $\iota$ because $\bar z$ generates $k_L$. Conversely any such <field homomorphism> preserves the unique extended <valuation>, hence induces a residue <field homomorphism>, and its image of $z$ is uniquely forced by Hensel uniqueness. This proves the asserted bijection. The same proof only requires that $M$ be a non-Archimedean <local field> containing $K$ with its compatible valuation; its finiteness over $K$ is not essential.

Now set $M=L$. The finite <residue field> extension has exactly $f=[L:K]$ automorphisms, cyclically generated by $a\mapsto a^{|k_K|}$. Their unique lifts give $[L:K]$ automorphisms of $L$. Consequently $L/K$ is a <Galois extension>, and reduction identifies its <Galois group> with that cyclic residue <Galois group>. Its generator is the <arithmetic Frobenius>:
$$
\boxed{\operatorname{Gal}(L/K)\simeq\operatorname{Gal}(k_L/k_K)\simeq\mathbb Z/f\mathbb Z.}
$$

For the compositum, choose a <uniformizer> $\pi_M$ of the <totally ramified extension> $M/K$. The <Eisenstein generator of a totally ramified extension> characterization, proved in the next solution, says that $M=K(\pi_M)$ and its <minimal polynomial of an algebraic element> is Eisenstein over $\mathcal O_K$. A <uniformizer> of $K$ remains a <uniformizer> in the <unramified extension> $L$. All its Eisenstein coefficient conditions therefore remain true over $\mathcal O_L$. Thus the same <Eisenstein polynomial> is irreducible over $L$ and generates $LM=L(\pi_M)$ as a <totally ramified extension>. This proves \b[$LM/L$ is totally ramified, of degree $[M:K]$.]

Here is an explicit example showing that the converse decomposition of an arbitrary extension can fail. Take $K=\mathbb Q_3$ and $L=K(i)$ with $i^2=-1$. Since $T^2+1$ is irreducible and separable modulo three, the degree and residue-degree argument above shows that $L/K$ is <unramified> quadratic. Put
$$
\alpha^2=3(1+i),\qquad N=L(\alpha).
$$
The element $1+i$ is a <unit> in $\mathcal O_L$, so $T^2-3(1+i)$ is Eisenstein over $L$. Hence $[N:L]=2$, $e(N/K)=2$, and $f(N/K)=2$. Moreover $i=\alpha^2/3-1$ gives $N=K(\alpha)$, with
$$
\alpha^4-6\alpha^2+18=0.
$$
We verify its <Galois group>, since that is what rules out a totally ramified complement. By <Hensel lemma> there is $r\in K$ with $r^2=-2$: the residue root $1$ of $T^2+2$ is simple modulo three. Set $\beta=(1+i)/r$. Then
$$
\beta^2=-i,\qquad \beta\bar\beta=-1.
$$
The assignments $\sigma(i)=-i$ and $\sigma(\alpha)=\beta\alpha$ respect the defining relation, because $(\beta\alpha)^2=-3i(1+i)=3(1-i)$. They therefore define a $K$-automorphism of $N$. Its square satisfies $\sigma^2(i)=i$ and $\sigma^2(\alpha)=\bar\beta\beta\alpha=-\alpha$, so $\sigma$ has order four. There are thus four automorphisms of the degree-four extension, and
$$
\operatorname{Gal}(N/K)=\langle\sigma\rangle\simeq C_4.
$$
This is the <cyclic quartic local extension without a totally ramified complement>. Its unique quadratic subfield is $L$, fixed by $\sigma^2$, and is unramified. If $N=L'M'$ with $L'/K$ unramified and $M'/K$ totally ramified, then $[L':K]\leq f(N/K)=2$ and $[M':K]\leq e(N/K)=2$. To obtain the full degree four both would have degree two, forcing $M'$ to be a totally ramified quadratic subfield. There is no such subfield. Thus \b[$N/\mathbb Q_3$ is the required counterexample.]