Dimension inequality for homomorphisms between noetherian local rings

$A$ and $B$ are commutative noetherian local rings with maximal ideals $\mathfrak{m}$ and $\mathfrak{n}$ respectively.

If $f\colon A \to B$ is a local ring homomorphism, how do I prove the inequality $$\dim(B) \leq \dim(A) + \dim(B/f(\mathfrak{m})B),$$ where $\dim$ denotes the Krull dimension?

I know that dim equals the minimal number of generators of an $\mathfrak{m}$-primary ideal in the noetherian local case, but so far I cannot prove this statement.

Solutions Collecting From Web of "Dimension inequality for homomorphisms between noetherian local rings"

Prologue: As you probably know, a system of parameters of $A$ is a set of $\dim(A)$ elements of $\mathfrak m$ generating an $\mathfrak m$-primary ideal.

Sketch of proof: Take a system of parameters $a_1,…,a_d$ of $A$ and a system of parameters $\bar b_1,…\bar b_e$ of $B/(a_1,…,a_d)B$.
The sequence $a_1,…,a_d; b_1,… b_e$ of elements of $\mathfrak n$ generates an $\mathfrak n$-primary ideal of $B$ so that $\dim(B)\leq d+e$ according to the definition of dimension you mentioned.
(You might want to use that, since $(a_1,…,a_d)$ is $\mathfrak m$-primary, you have $(a_1,…,a_d)\supset \mathfrak m^r$ for $r$ big enough. )

Although there are some details to fill in, the proof is, as you see, pretty natural ( well, if you take into account that commutative algebra is as a rule more austere than detective fiction)