hcju/stacksqa huggingface dataset:
We will only prove the first formula as the second is proved in exactly the same manner. Let $M' = M[x^\infty]$ be the $x$-power torsion submodule of $M$. Consider the short exact sequence $0 \to M' \to M \to M'' \to 0$. Then $M''$ is $x$-power torsion free (More on Algebra, Lemma \ref{more-algebra-lemma-divide-by-torsion}). Since $\varphi$, $\psi$ map $M'$ into $M'$ we obtain a short exact sequence $$ 0 \to (M', \varphi', \psi') \to (M, \varphi, \psi) \to (M'', \varphi'', \psi'') \to 0 $$ of $(2, 1)$-periodic complexes. Also, we get a short exact sequence $0 \to M' \cap \Im(\varphi) \to \Im(\varphi) \to \Im(\varphi'') \to 0$. We have $e_R(M', \varphi, \psi) = e_R(M', x\varphi, \psi) = e_R(M' \cap \Im(\varphi), 0, x) = 0$ by Lemma \ref{lemma-compare-periodic-lengths}. By additivity (Lemma \ref{lemma-additivity-periodic-length}) we see that it suffices to prove the lemma for $(M'', \varphi'', \psi'')$. This reduces us to the case discussed in the next paragraph. \medskip\noindent Assume $x : M \to M$ is injective. In this case $\Ker(x\varphi) = \Ker(\varphi)$. On the other hand we have a short exact sequence $$ 0 \to \Im(\varphi)/x\Im(\varphi) \to \Ker(\psi)/\Im(x\varphi) \to \Ker(\psi)/\Im(\varphi) \to 0 $$ This together with (\ref{equation-multiplicity-coker-ker}) proves the formula.
Set $I = \mathfrak m_1 \cap \ldots \cap \mathfrak m_r$. Set $A_i = A_{\mathfrak m_i}$ and $A' = \prod A_i$. Then $IA' = \prod \mathfrak m_i A_i$ and $A \to A'$ is a flat ring map such that $A/I \cong A'/IA'$. Thus we may use More on Algebra, Lemma \ref{more-algebra-lemma-application-formal-glueing} to see that there exists an $A$-module map $\varphi : A \to B$ with $\varphi_i$ isomorphic to the localization of $\varphi$ at $\mathfrak m_i$. Then we can use the discussion in More on Algebra, Remark \ref{more-algebra-remark-formal-glueing-algebras} to endow $B$ with an $A$-algebra structure matching the given $A$-algebra structure on $B_i$. The final statement of the lemma follows easily from the fact that $\Ker(\varphi)_{\mathfrak m_i} \cong \Ker(\varphi_i)$ and $\Coker(\varphi)_{\mathfrak m_i} \cong \Coker(\varphi_i)$.
If $a$ or $b$ is a unit, then the lemma is true with $R = R'$. Thus we may assume $a, b \in \mathfrak m$. Set $I = (a, b)$. The idea is to blow up $R$ in $I$. Instead of doing the algebraic argument we work geometrically. Let $X = \text{Proj}(\bigoplus_{d \geq 0} I^d)$. By Divisors, Lemma \ref{divisors-lemma-blowing-up-gives-effective-Cartier-divisor} the morphism $X \to \Spec(R)$ is an isomorphism over the punctured spectrum $U = \Spec(R) \setminus \{\mathfrak m\}$. Thus we may and do view $U$ as an open subscheme of $X$. The morphism $X \to \Spec(R)$ is projective by Divisors, Lemma \ref{divisors-lemma-blowing-up-projective}. Also, every generic point of $X$ lies in $U$, for example by Divisors, Lemma \ref{divisors-lemma-blow-up-and-irreducible-components}. It follows from Varieties, Lemma \ref{varieties-lemma-finite-in-codim-1} that $X \to \Spec(R)$ is finite. Thus $X = \Spec(R')$ is affine and $R \to R'$ is finite. We have $R_a \cong R'_a$ as $U = D(a)$. Hence a power of $a$ annihilates the finite $R$-module $R'/R$. As $\mathfrak m = \sqrt{(a)}$ we see that $R'/R$ is annihilated by a power of $\mathfrak m$. By Divisors, Lemma \ref{divisors-lemma-blowing-up-gives-effective-Cartier-divisor} we see that $IR'$ is a locally principal ideal. Since $R'$ is semi-local we see that $IR'$ is principal, see Algebra, Lemma \ref{algebra-lemma-locally-free-semi-local-free}, say $IR' = (t)$. Then we have $a = a't$ and $b = b't$ and everything is clear.
Choose a minimal prime $\mathfrak q \subset R$. Observe that $\dim(R/\mathfrak q) = 1$, in particular $R/\mathfrak q$ is not a field. We can choose a discrete valuation ring $A$ dominating $R/\mathfrak q$ with the same fraction field, see Algebra, Lemma \ref{algebra-lemma-dominate-by-dimension-1}. Observe that $a$ and $b$ map to nonzero elements of $A$ as nonzerodivisors in $R$ are not contained in $\mathfrak q$. Let $v$ be the discrete valuation on $A$. Then $v(a) > 0$ as $a \in \mathfrak m$. We claim $n = v(b)/v(a)$ works. \medskip\noindent Let $R \subset R'$ be given. Set $A' = A \otimes_R R'$. Since $\Spec(R') \to \Spec(R)$ is surjective (Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}) also $\Spec(A') \to \Spec(A)$ is surjective (Algebra, Lemma \ref{algebra-lemma-surjective-spec-radical-ideal}). Pick a prime $\mathfrak q' \subset A'$ lying over $(0) \subset A$. Then $A \subset A'' = A'/\mathfrak q'$ is a finite extension of rings (again inducing a surjection on spectra). Pick a maximal ideal $\mathfrak m'' \subset A''$ lying over the maximal ideal of $A$ and a discrete valuation ring $A'''$ dominating $A''_{\mathfrak m''}$ (see lemma cited above). Then $A \to A'''$ is an extension of discrete valuation rings and we have $b = a^m c$ in $A'''$. Thus $v'''(b) \geq mv'''(a)$. Since $v''' = ev$ where $e$ is the ramification index of $A'''/A$, we find that $m \leq n$ as desired.
Independence of choice of factorizations. Suppose we have a Noetherian $1$-dimensional local ring $B$, elements $a_1, a_2 \in B$, and nonzerodivisors $\pi, \theta$ such that we can write $$ a_1 = u_1 \pi^{e_1} = v_1 \theta^{f_1},\quad a_2 = u_2 \pi^{e_2} = v_2 \theta^{f_2} $$ with $e_i, f_i \geq 0$ integers and $u_i, v_i$ units in $B$. Observe that this implies $$ a_1^{e_2} = u_1^{e_2}u_2^{-e_1}a_2^{e_1},\quad a_1^{f_2} = v_1^{f_2}v_2^{-f_1}a_2^{f_1} $$ On the other hand, setting $m = \text{length}_B(B/\pi B)$ and $k = \text{length}_B(B/\theta B)$ we find $e_2 m = \text{length}_B(B/a_2 B) = f_2 k$. Expanding $a_1^{e_2m} = a_1^{f_2 k}$ using the above we find $$ (u_1^{e_2}u_2^{-e_1})^m =  (v_1^{f_2}v_2^{-f_1})^k $$ This proves the desired equality up to signs. To see the signs work out we have to show $me_1e_2$ is even if and only if $kf_1f_2$ is even. This follows as both $me_2 = kf_2$ and $me_1 = kf_1$ (same argument as above). \medskip\noindent Independence of choice of $B$. Suppose given two extensions $A \subset B$ and $A \subset B'$ as in Lemma \ref{lemma-prepare-tame-symbol}. Then $$ C = (B \otimes_A B')/(\mathfrak m\text{-power torsion}) $$ will be a third one. Thus we may assume we have $A \subset B \subset C$ and factorizations over the local rings of $B$ and we have to show that using the same factorizations over the local rings of $C$ gives the same element of $\kappa(\mathfrak m)$. By transitivity of norms (Fields, Lemma \ref{fields-lemma-trace-and-norm-tower}) this comes down to the following problem: if $B$ is a Noetherian local ring of dimension $1$ and $\pi \in B$ is a nonzerodivisor, then $$ \lambda^m = \prod \text{Norm}_{\kappa_k/\kappa}(\lambda)^{m_k} $$ Here we have used the following notation: (1) $\kappa$ is the residue field of $B$, (2) $\lambda$ is an element of $\kappa$, (3) $\mathfrak m_k \subset C$ are the maximal ideals of $C$, (4) $\kappa_k = \kappa(\mathfrak m_k)$ is the residue field of $C_k = C_{\mathfrak m_k}$, (5) $m = \text{length}_B(B/\pi B)$, and (6) $m_k = \text{length}_{C_k}(C_k/\pi C_k)$. The displayed equality holds because $\text{Norm}_{\kappa_k/\kappa}(\lambda) = \lambda^{[\kappa_k : \kappa]}$ as $\lambda \in \kappa$ and because $m = \sum m_k[\kappa_k:\kappa]$. First, we have $m = \text{length}_B(B/xB) = \text{length}_B(C/\pi C)$ by Lemma \ref{lemma-compare-periodic-lengths}  and (\ref{equation-multiplicity-coker-ker}). Finally, we have $\text{length}_B(C/\pi C) = \sum m_k[\kappa_k:\kappa]$ by Algebra, Lemma \ref{algebra-lemma-pushdown-module}.
Let us prove (\ref{item-bilinear-better}). Let $a_1, a_2, a_3 \in A$ be nonzerodivisors. Choose $A \subset B$ as in Lemma \ref{lemma-prepare-tame-symbol} for $a_1, a_2, a_3$. Then the equality $$ \partial_A(a_1a_2, a_3) = \partial_A(a_1, a_3) \partial_A(a_2, a_3) $$ follows from the equality $$ (-1)^{(e_{1, j} + e_{2, j})e_{3, j}} (u_{1, j}u_{2, j})^{e_{3, j}}u_{3, j}^{-e_{1, j} - e_{2, j}} = (-1)^{e_{1, j}e_{3, j}} u_{1, j}^{e_{3, j}}u_{3, j}^{-e_{1, j}} (-1)^{e_{2, j}e_{3, j}} u_{2, j}^{e_{3, j}}u_{3, j}^{-e_{2, j}} $$ in $B_j$. Properties (\ref{item-skew-better}) and (\ref{item-normalization}) are equally immediate. \medskip\noindent Let us prove (\ref{item-1-x-better}). Let $a_1, a_2, a_1 - a_2 \in A$ be nonzerodivisors and set $a_3 = a_1 - a_2$. Choose $A \subset B$ as in Lemma \ref{lemma-prepare-tame-symbol} for $a_1, a_2, a_3$. Then it suffices to show $$ (-1)^{e_{1, j}e_{2, j} + e_{1, j}e_{3, j} + e_{2, j}e_{3, j} + e_{2, j}} u_{1, j}^{e_{2, j} - e_{3, j}} u_{2, j}^{e_{3, j} - e_{1, j}} u_{3, j}^{e_{1, j} - e_{2, j}} \bmod \mathfrak m_j = 1 $$ This is clear if $e_{1, j} = e_{2, j} = e_{3, j}$. Say $e_{1, j} > e_{2, j}$. Then we see that $e_{3, j} = e_{2, j}$ because $a_3 = a_1 - a_2$ and we see that $u_{3, j}$ has the same residue class as $-u_{2, j}$. Hence the formula is true -- the signs work out as well and this verification is the reason for the choice of signs in (\ref{equation-tame-symbol}). The other cases are handled in exactly the same manner.
Choose $B_j \subset C_j$ as in Lemma \ref{lemma-prepare-tame-symbol} for $a, b$. By Lemma \ref{lemma-glue-at-max} we can choose a finite ring extension $B \subset C$ with $C_j \cong C_{\mathfrak m_j}$ for all $j$. Let $\mathfrak m_{j, k} \subset C$ be the maximal ideals of $C$ lying over $\mathfrak m_j$. Let $$ a = u_{j, k}\pi_{j, k}^{f_{j, k}},\quad b = v_{j, k}\pi_{j, k}^{g_{j, k}} $$ be the local factorizations which exist by our choice of $C_j \cong C_{\mathfrak m_j}$. By definition we have $$ \partial_A(a, b) =  \prod\nolimits_{j, k} \text{Norm}_{\kappa(\mathfrak m_{j, k})/\kappa(\mathfrak m)} ((-1)^{f_{j, k}g_{j, k}}u_{j, k}^{g_{j, k}}v_{j, k}^{-f_{j, k}} \bmod \mathfrak m_{j, k})^{m_{j, k}} $$ and $$ \partial_{B_j}(a, b) =  \prod\nolimits_k \text{Norm}_{\kappa(\mathfrak m_{j, k})/\kappa(\mathfrak m_j)} ((-1)^{f_{j, k}g_{j, k}}u_{j, k}^{g_{j, k}}v_{j, k}^{-f_{j, k}} \bmod \mathfrak m_{j, k})^{m_{j, k}} $$ The result follows by transitivity of norms for $\kappa(\mathfrak m_{j, k})/\kappa(\mathfrak m_j)/\kappa(\mathfrak m)$, see Fields, Lemma \ref{fields-lemma-trace-and-norm-tower}.
If $a_1, a_2$ are both units, then $\partial_A(a_1, a_2) = 1$ and $\partial_{A'}(a_1, a_2) = 1$ and the result is true. If not, then we can choose a ring extension $A \subset B$ and local factorizations as in Lemma \ref{lemma-prepare-tame-symbol}. Set $B' = A' \otimes_A B$. Since $A'$ is flat over $A$ we see that $A' \subset B'$ is a ring extension with $B'/A'$ annihilated by a power of $\mathfrak m'$. Let $\mathfrak m_1, \ldots, \mathfrak m_m$ be the maximal ideals of $B$. For each $j \in \{1, \ldots, m\}$ denote $\kappa_j = \kappa(\mathfrak m_j)$ the residue field. Then $$ \kappa_j \otimes_\kappa \kappa' = \prod\nolimits_{l = 1, \ldots, n_j} \kappa'_{j, l} $$ is a product of fields each finite over $\kappa'$ because $\kappa'/\kappa$ is a separable field extension (Algebra, Lemma \ref{algebra-lemma-separable-extension-preserves-reducedness}). It follows that $B'$ has corresponding maximal ideals $\mathfrak m'_{j, l}$ lying over $\mathfrak m_j$. As factorizations in $B'_{j, l} = B'_{\mathfrak m'_{j, l}}$ we use the image of the factorizations $a_i = u_{i, j} \pi_j^{e_{i, j}}$ given to us in $B_j$. Thus we obtain $$ \partial_A(a_1, a_2) = \prod\nolimits_j \text{Norm}_{\kappa_j/\kappa} ((-1)^{e_{1, j}e_{2, j}}u_{1, j}^{e_{2, j}}u_{2, j}^{-e_{1, j}} \bmod \mathfrak m_j)^{m_j} $$ by definition and similarly $$ \partial_{A'}(a_1, a_2) = \prod\nolimits_{j, l} \text{Norm}_{\kappa'_{j, l}/\kappa'} ((-1)^{e_{1, j}e_{2, j}}u_{1, j}^{e_{2, j}}u_{2, j}^{-e_{1, j}} \bmod \mathfrak m'_{j, l})^{m_j} $$ To finish the proof we observe that if $u \in \kappa_j$ has image $u_l \in \kappa'_{j, l}$, then $\text{Norm}_{\kappa_j/\kappa}(u)$ in $\kappa$ maps to $\prod_l \text{Norm}_{\kappa'_{j, l}/\kappa'}(u_l)$ in $\kappa'$. This follows from the fact that taking determinants of linear maps commutes with ground field extension.
Let $X \to S$, $\xi \in Z \subset X$ be as in the lemma. Since $X$ is locally of finite type over $S$ we see that $X$ is Jacobson, see Morphisms, Lemma \ref{morphisms-lemma-Jacobson-universally-Jacobson}. Hence closed points of $X$ are dense in every closed subset of $Z$ and map to closed points of $S$. Hence given any chain of irreducible closed subsets of $Z$ we can end it with a closed point of $Z$. It follows that $\dim(Z) = \sup_z(\dim(\mathcal{O}_{Z, z})$ (see Properties, Lemma \ref{properties-lemma-codimension-local-ring}) where $z \in Z$ runs over the closed points of $Z$. Note that $\dim(\mathcal{O}_{Z, z}) = \delta(\xi) - \delta(z)$ by the properties of a dimension function. For each closed $z \in Z$ the field extension $\kappa(z) \supset \kappa(f(z))$ is finite, see Morphisms, Lemma \ref{morphisms-lemma-jacobson-finite-type-points}. Hence $\delta_{X/S}(z) = \delta(f(z)) = 0$ for $z \in Z$ closed. It follows that all three integers are equal.
Let $Z' \subset Z$, $\xi \in Z'$ be as in (1). Then $\dim(\mathcal{O}_{Z, \xi}) = 0$ (for example by Properties, Lemma \ref{properties-lemma-codimension-local-ring}). Hence $\mathcal{O}_{Z, \xi}$ is Noetherian local ring of dimension zero, and hence has finite length over itself (see Algebra, Proposition \ref{algebra-proposition-dimension-zero-ring}). Hence, it also has finite length over $\mathcal{O}_{X, \xi}$, see Algebra, Lemma \ref{algebra-lemma-pushdown-module}. \medskip\noindent Assume $\xi \in Z$ and $\delta(\xi) = k$. Consider the closure $Z' = \overline{\{\xi\}}$. It is an irreducible closed subscheme with $\dim_\delta(Z') = k$ by definition. Since $\dim_\delta(Z) = k$ it must be an irreducible component of $Z$. Hence we see (2) holds.
By Cohomology of Schemes, Lemma \ref{coherent-lemma-coherent-support-closed} the support $Z$ of $\mathcal{F}$ is a closed subset of $X$. We may think of $Z$ as a reduced closed subscheme of $X$ (Schemes, Lemma \ref{schemes-lemma-reduced-closed-subscheme}). Hence (1) follows from Divisors, Lemma \ref{divisors-lemma-components-locally-finite} applied to $Z$ and (3) follows from Lemma \ref{lemma-multiplicity-finite} applied to $Z$. \medskip\noindent Let $\xi \in Z'$ be as in (2). In this case for any specialization $\xi' \leadsto \xi$ in $X$ we have $\mathcal{F}_{\xi'} = 0$. Recall that the non-maximal primes of $\mathcal{O}_{X, \xi}$ correspond to the points of $X$ specializing to $\xi$ (Schemes, Lemma \ref{schemes-lemma-specialize-points}). Hence $\mathcal{F}_\xi$ is a finite $\mathcal{O}_{X, \xi}$-module whose support is $\{\mathfrak m_\xi\}$. Hence it has finite length by Algebra, Lemma \ref{algebra-lemma-support-point}.
The closure $\overline{f(X)} \subset Y$ is irreducible as $X$ is irreducible (Topology, Lemmas \ref{topology-lemma-image-irreducible-space} and \ref{topology-lemma-irreducible}). If $\overline{f(X)} \not = Y$, then we are done. If $\overline{f(X)} = Y$, then $f$ is dominant and by Morphisms, Lemma \ref{morphisms-lemma-dominant-finite-number-irreducible-components} we see that the generic point $\eta_Y$ of $Y$ is in the image of $f$. Of course this implies that $f(\eta_X) = \eta_Y$, where $\eta_X \in X$ is the generic point of $X$. Since $\delta(\eta_X) = \delta(\eta_Y)$ we see that $R(Y) = \kappa(\eta_Y) \subset \kappa(\eta_X) = R(X)$ is an extension of transcendence degree $0$. Hence $R(Y) \subset R(X)$ is a finite extension by Morphisms, Lemma \ref{morphisms-lemma-finite-degree} (which applies by Morphisms, Lemma \ref{morphisms-lemma-permanence-finite-type}).
Let $W \subset X$ be an integral closed subscheme of dimension $k$. Consider $W' = f(W) \subset Y$ and $W'' = g(f(W)) \subset Z$. Since $f$, $g$ are proper we see that $W'$ (resp.\ $W''$) is an integral closed subscheme of $Y$ (resp.\ $Z$). We have to show that $g_*(f_*[W]) = (g \circ f)_*[W]$. If $\dim_\delta(W'') < k$, then both sides are zero. If $\dim_\delta(W'') = k$, then we see the induced morphisms $$ W \longrightarrow W' \longrightarrow W'' $$ both satisfy the hypotheses of Lemma \ref{lemma-equal-dimension}. Hence $$ g_*(f_*[W]) = \deg(W/W')\deg(W'/W'')[W''], \quad (g \circ f)_*[W] = \deg(W/W'')[W'']. $$ Then we can apply Morphisms, Lemma \ref{morphisms-lemma-degree-composition} to conclude.
It suffices to prove the final statement. We may replace $Y$ by the integral closed subscheme $Z$ and $X$ by the scheme theoretic inverse image $f^{-1}(Z) = Z \times_Y X$. Hence we may assume $Z = Y$ is integral and $f$ is a flat morphism of relative dimension $r$. Since $Y$ is locally Noetherian the morphism $f$ which is locally of finite type, is actually locally of finite presentation. Hence Morphisms, Lemma \ref{morphisms-lemma-fppf-open} applies and we see that $f$ is open. Let $\xi \in X$ be a generic point of an irreducible component of $X$. By the openness of $f$ we see that $f(\xi)$ is the generic point $\eta$ of $Z = Y$. Note that $\dim_\xi(X_\eta) = r$ by assumption that $f$ has relative dimension $r$. On the other hand, since $\xi$ is a generic point of $X$ we see that $\mathcal{O}_{X, \xi} = \mathcal{O}_{X_\eta, \xi}$ has only one prime ideal and hence has dimension $0$. Thus by Morphisms, Lemma \ref{morphisms-lemma-dimension-fibre-at-a-point} we conclude that the transcendence degree of $\kappa(\xi)$ over $\kappa(\eta)$ is $r$. In other words, $\delta(\xi) = \delta(\eta) + r$ as desired.
The composition is flat of relative dimension $r + s$ by Morphisms, Lemma \ref{morphisms-lemma-composition-relative-dimension-d}. Suppose that \begin{enumerate} \item $W \subset Z$ is a closed integral subscheme of $\delta$-dimension $k$, \item $W' \subset Y$ is a closed integral subscheme of $\delta$-dimension $k + s$ with $W' \subset g^{-1}(W)$, and \item $W'' \subset Y$ is a closed integral subscheme of $\delta$-dimension $k + s + r$ with $W'' \subset f^{-1}(W')$. \end{enumerate} We have to show that the coefficient $n$ of $[W'']$ in $(g \circ f)^*[W]$ agrees with the coefficient $m$ of $[W'']$ in $f^*(g^*[W])$. That it suffices to check the lemma in these cases follows from Lemma \ref{lemma-flat-inverse-image-dimension}. Let $\xi'' \in W''$, $\xi' \in W'$ and $\xi \in W$ be the generic points. Consider the local rings $A = \mathcal{O}_{Z, \xi}$, $B = \mathcal{O}_{Y, \xi'}$ and $C = \mathcal{O}_{X, \xi''}$. Then we have local flat ring maps $A \to B$, $B \to C$ and moreover $$ n = \text{length}_C(C/\mathfrak m_AC), \quad \text{and} \quad m = \text{length}_C(C/\mathfrak m_BC) \text{length}_B(B/\mathfrak m_AB) $$ Hence the equality follows from Algebra, Lemma \ref{algebra-lemma-pullback-transitive}.
The statements on dimensions follow immediately from Lemma \ref{lemma-flat-inverse-image-dimension}. Part (1) follows from part (2) by Lemma \ref{lemma-cycle-closed-coherent} and the fact that $f^*\mathcal{O}_Z = \mathcal{O}_{f^{-1}(Z)}$. \medskip\noindent Proof of (2). As $X$, $Y$ are locally Noetherian we may apply Cohomology of Schemes, Lemma \ref{coherent-lemma-coherent-Noetherian} to see that $\mathcal{F}$ is of finite type, hence $f^*\mathcal{F}$ is of finite type (Modules, Lemma \ref{modules-lemma-pullback-finite-type}), hence $f^*\mathcal{F}$ is coherent (Cohomology of Schemes, Lemma \ref{coherent-lemma-coherent-Noetherian} again). Thus the lemma makes sense. Let $W \subset Y$ be an integral closed subscheme of $\delta$-dimension $k$, and let $W' \subset X$ be an integral closed subscheme of dimension $k + r$ mapping into $W$ under $f$. We have to show that the coefficient $n$ of $[W']$ in $f^*[{\mathcal F}]_k$ agrees with the coefficient $m$ of $[W']$ in $[f^*{\mathcal F}]_{k+r}$. Let $\xi \in W$ and $\xi' \in W'$ be the generic points. Let $A = \mathcal{O}_{Y, \xi}$, $B = \mathcal{O}_{X, \xi'}$ and set $M = \mathcal{F}_\xi$ as an $A$-module. (Note that $M$ has finite length by our dimension assumptions, but we actually do not need to verify this. See Lemma \ref{lemma-length-finite}.) We have $f^*\mathcal{F}_{\xi'} = B \otimes_A M$. Thus we see that $$ n = \text{length}_B(B \otimes_A M) \quad \text{and} \quad m = \text{length}_A(M) \text{length}_B(B/\mathfrak m_AB) $$ Thus the equality follows from Algebra, Lemma \ref{algebra-lemma-pullback-module}.
The assertion that $f'$ is proper follows from Morphisms, Lemma \ref{morphisms-lemma-base-change-proper}. The assertion that $g'$ is flat of relative dimension $r$ follows from Morphisms, Lemmas \ref{morphisms-lemma-base-change-relative-dimension-d} and \ref{morphisms-lemma-base-change-flat}. It suffices to prove the equality of cycles when $\alpha = [W]$ for some integral closed subscheme $W \subset X$ of $\delta$-dimension $k$. Note that in this case we have $\alpha = [\mathcal{O}_W]_k$, see Lemma \ref{lemma-cycle-closed-coherent}. By Lemmas \ref{lemma-cycle-push-sheaf} and \ref{lemma-pullback-coherent} it therefore suffices to show that $f'_*(g')^*\mathcal{O}_W$ is isomorphic to $g^*f_*\mathcal{O}_W$. This follows from cohomology and base change, see Cohomology of Schemes, Lemma \ref{coherent-lemma-flat-base-change-cohomology}.
A finite locally free morphism is flat and finite by Morphisms, Lemma \ref{morphisms-lemma-finite-flat}, and a finite morphism is proper by Morphisms, Lemma \ref{morphisms-lemma-finite-proper}. We omit showing that a finite morphism has relative dimension $0$. Thus the formula makes sense. To prove it, let $Z \subset Y$ be an integral closed subscheme of $\delta$-dimension $k$. It suffices to prove the formula for $\alpha = [Z]$. Since the base change of a finite locally free morphism is finite locally free (Morphisms, Lemma \ref{morphisms-lemma-base-change-finite-locally-free}) we see that $f_*f^*\mathcal{O}_Z$ is a finite locally free sheaf of rank $d$ on $Z$. Hence $$ f_*f^*[Z] = f_*f^*[\mathcal{O}_Z]_k = [f_*f^*\mathcal{O}_Z]_k = d[Z] $$ where we have used Lemmas \ref{lemma-pullback-coherent} and \ref{lemma-cycle-push-sheaf}.
Part (1) follows from the definition of a prime divisor (Divisors, Definition \ref{divisors-definition-Weil-divisor}) and the definition of a dimension function (Topology, Definition \ref{topology-definition-dimension-function}). Let $\xi \in Z$ be the generic point of an irreducible component $Z$ of an effective Cartier divisor $D \subset X$. Then $\dim(\mathcal{O}_{D, \xi}) = 0$ and $\mathcal{O}_{D, \xi} = \mathcal{O}_{X, \xi}/(f)$ for some nonzerodivisor $f \in \mathcal{O}_{X, \xi}$ (Divisors, Lemma \ref{divisors-lemma-effective-Cartier-in-points}). Then $\dim(\mathcal{O}_{X, \xi}) = 1$ by Algebra, Lemma \ref{algebra-lemma-one-equation}. Hence $Z$ is as in (1) by Properties, Lemma \ref{properties-lemma-codimension-local-ring} and the proof is complete.
This lemma is a special case of Varieties, Lemma \ref{varieties-lemma-finite-in-codim-1}. Here is a direct argument in this case. By Cohomology of Schemes, Lemma \ref{coherent-lemma-proper-finite-fibre-finite-in-neighbourhood} it suffices to prove that $f^{-1}(\{\xi\})$ is finite. We replace $Y$ by an affine open, say $Y = \Spec(R)$. Note that $R$ is Noetherian, as $Y$ is assumed locally Noetherian. Since $f$ is proper it is quasi-compact. Hence we can find a finite affine open covering $X = U_1 \cup \ldots \cup U_n$ with each $U_i = \Spec(A_i)$. Note that $R \to A_i$ is a finite type injective homomorphism of domains such that the induced extension of fraction fields is finite. Thus the lemma follows from Algebra, Lemma \ref{algebra-lemma-finite-in-codim-1}.
Note that since $f$ is flat it is dominant so that $f$ induces an embedding $R(Y) \subset R(X)$, and hence we may think of $g$ as an element of $R(X)^*$. Let $Z \subset X$ be an integral closed subscheme of $\delta$-dimension $n + r - 1$. Let $\xi \in Z$ be its generic point. If $\dim_\delta(f(Z)) > n - 1$, then we see that the coefficient of $[Z]$ in the left and right hand side of the equation is zero. Hence we may assume that $Z' = \overline{f(Z)}$ is an integral closed subscheme of $Y$ of $\delta$-dimension $n - 1$. Let $\xi' = f(\xi)$. It is the generic point of $Z'$. Set $A = \mathcal{O}_{Y, \xi'}$, $B = \mathcal{O}_{X, \xi}$. The ring map $A \to B$ is a flat local homomorphism of Noetherian local domains of dimension $1$. We have $g$ in the fraction field of $A$. What we have to show is that $$ \text{ord}_A(g) \text{length}_B(B/\mathfrak m_AB) = \text{ord}_B(g). $$ This follows from Algebra, Lemma \ref{algebra-lemma-pullback-module} (details omitted).