\section{Ribet's method to first order}\label{sec:ribet} Ribet's method \cite{Ribet1976,Wiles1990} turns a congruence between a lift and a non-lift into an extension of Galois representations. In the form needed here the representations of a whole space of forms are treated at once, the auxiliary primes enter through \emph{tie parameters} $X_j$ that tie tame inertia to Frobenius, and only the coefficient of the product $\prod_jX_j$ of a Hecke element is controlled. This section proves the algebraic statement, which does not involve Galois groups (\cref{thm:ribet-lemma}); \cref{sec:denominators} applies it to the representations of \cref{sec:galois-lifts}. \subsection{Ribet's method over an algebra}\label{ss:ribet-algebra} Let $R\to L$ be rings, $\Lambda$ an $R$-algebra and $\rho\colon\Lambda\to M_\sigma(L)$ an $R$-algebra map such that the characteristic polynomials of a spanning set of $\Lambda$ have coefficients in the image of $R$. \lean{New.blockFlattenAlgEquiv, New.amitsur_charpoly_comp_coeff_mem_range, New.Selmer.exists_adjugate_polynomial, New.Selmer.mul_aeval_eq_zero_of_adjugate, New.Selmer.exists_ribet_polynomial, New.exists_family_algHom_charpoly_mem, New.Selmer.det_comp_map_eq_mul_prod, New.Selmer.det_mem_of_coeff_mem, New.Selmer.traceIdeal, New.Selmer.mem_traceIdeal, New.Selmer.trace_mul_mem_of_mem_span, New.Selmer.trace_mul_aeval_apply, New.Selmer.exists_mul_eq_algebraMap_det, New.Selmer.map_mem_span_range, New.Selmer.map_mul_eq_zero_of_blocks, New.Selmer.exists_ribet_element_of_tied_rows} Throughout, $R$ and $L$ are commutative, $L$ is an $R$-algebra, and an element of $L$ is said to lie \emph{in $R$} if it lies in the image of $R$. A square matrix $P=(P_{ij})$ over $\Lambda$ is read through $\rho$ as the block matrix $\Phi(P)$ with blocks $\rho(P_{ij})$; $\Phi$ is again an $R$-algebra map. In (b) of \cref{prop:ribet-algebra}, $\rho_0$, $\rho_1\in\Lambda$ are arbitrary and $P(\rho_0)$ is the value of $P\in R[X]$ at $\rho_0$. In (c), $O$ is a ring, $u_x\colon O[G]\to M_\sigma(O)$ are $O$-algebra maps, $L$ is an $O$-algebra, $S$ is a subalgebra of the functions $Y\to L$, $I$ is the left ideal spanned by the entries of a vector $y$ over $O[G]$, a \emph{matrix of tied rows} is a square matrix $B$ with the entries of $By$ in $\mathfrak a+I\rho_0$, and on $\mathcal X$ the elements $\rho_0$, $\rho_1$ satisfy: $\rho_1$ vanishes on the block and on the characters $\eta_e$, $e\ne0$, $\eta_0(\rho_1)=\mu_0$ and $\eta_0(\rho_0)=0$. \lean{New.amitsur_charpoly_mem_of_span, New.exists_adjugate_of_charpoly_mem} \begin{lemma}[Amitsur's theorem]\label{lem:amitsur} \begin{enumerate}[label=\textup{(\alph*)}] \item If $\Lambda$ is spanned over $R$ by elements $s$ for which the characteristic polynomial of $\rho(s)$ has its coefficients in $R$, then every $\rho(w)$ has this property. \item If moreover $\Lambda$ is replaced by $\Lambda[X]$, $R$ by $R[X]$ and $\rho$ by its extension $\rho_X$ to $\Lambda[X]\to M_\sigma(L[X])$ coefficientwise, the hypothesis of (a) holds, and for every square matrix $B$ over $\Lambda[X]$ there are $P\in R[X]$ and a square matrix $B'$ over $\Lambda[X]$ with $P(0)=\det\Phi(B|_{X=0})$ and $\Phi_X(B'B)=P\cdot1$. \end{enumerate} \end{lemma} \begin{proof} (a) For a matrix $A$ of size $n$ over a commutative ring, $\det(1-tA)=\sum_k(-1)^ke_k(A)t^k$, where $\pm e_k(A)$ are the coefficients of the characteristic polynomial; so the claim is that $\det(1-t\rho(w))$ has its coefficients in $R$. Fix $e\ge1$, put $L_e=L[t]/(t^e)$, let $R_e$ be the image of $R[t]$ in $L_e$, and extend $\rho$ to $\Lambda_e=\Lambda[t]/(t^e)\to M_\sigma(L_e)$ coefficientwise. $\Lambda_e$ is spanned over $R[t]$ by the given elements $s$. For $j\ge0$ let $\mathrm C(j)$ be the claim: for every $\beta\in\Lambda_e$ with $\det(1-t\rho(\beta))\in R_e$ and every $\gamma\in\Lambda_e$, $\det(1-t\rho(\beta+t^j\gamma))\in R_e$. For $j\ge e$ this holds because $t^j=0$. Assume $\mathrm C(j+1)$. Writing $\gamma=\sum_ic_is_i$ with $c_i\in R[t]$ and adding the terms one at a time, it suffices to show: if $\det(1-t\rho(\beta))\in R_e$, then $\det(1-t\rho(\beta+t^jcs))\in R_e$ for $c\in R[t]$ and a given $s$. Indeed \[ (1-t\beta)(1-t^{j+1}cs)=1-t\beta''\quad\text{with}\quad\beta''=\beta+t^jcs-t^{j+1}c\beta s, \] and $\det(1-t^{j+1}c\rho(s))=\sum_k(-1)^ke_k(\rho(s))(t^{j+1}c)^k\in R_e$, so $\det(1-t\rho(\beta''))\in R_e$. As $\beta+t^jcs=\beta''+t^{j+1}(c\beta s)$, $\mathrm C(j+1)$ gives the claim. Hence $\mathrm C(0)$ holds; with $\beta=0$ and $\gamma=w$ it says that the coefficients of $\det(1-t\rho(w))$ of degree below $e$ lie in $R$. As $e$ is arbitrary, all of them do. (b) $\Lambda[X]$ is spanned over $R[X]$ by $\Lambda$, and the characteristic polynomial of $\rho_X(w)=\rho(w)$, $w\in\Lambda$, has its coefficients in $R\subseteq R[X]$; so (a) applies to $\rho_X$. It applies also to $\Phi_X$ on the square matrices over $\Lambda[X]$: these are spanned by the matrices $E_q(Q)$ with a single nonzero row, the row $q$ of a matrix $Q$. Let $\mathrm{col}$ be the block column $q$ of the identity matrix and $\mathrm{row}$ the block row $q$ of $\Phi_X(Q)$. Then $\Phi_X(E_q(Q))=\mathrm{col}\cdot\mathrm{row}$ and $\mathrm{row}\cdot\mathrm{col}=\rho_X(Q_{qq})$, and for an $a\times b$ matrix $U$ and a $b\times a$ matrix $V$ one has $X^b\chi_{UV}=X^a\chi_{VU}$ (Sylvester), so the characteristic polynomial of $\Phi_X(E_q(Q))$ is a power of $X$ times that of $\rho_X(Q_{qq})$, whose coefficients lie in $R[X]$. By (a), the characteristic polynomial $\chi=\sum_ia_iT^i$ of $\Phi_X(B)$ has coefficients $a_i\in R[X]$, with $a_0=\pm\det\Phi_X(B)$. By Cayley--Hamilton, $\det\Phi_X(B)\cdot1=\mp\sum_{i\ge1}a_i\Phi_X(B)^i=\Phi_X(B'B)$ with $B'=\mp\sum_{i\ge1}a_iB^{i-1}$, a matrix over $\Lambda[X]$ since the $a_i$ are central. Take $P=\det\Phi_X(B)\in R[X]$; its value at $X=0$ is $\det\Phi(B|_{X=0})$. \end{proof} \begin{proposition}[Amitsur, Ribet]\label{prop:ribet-algebra} \begin{enumerate}[label=\textup{(\alph*)}] \item (Amitsur's formula.) If all characteristic polynomials of the $\rho(w)$ have coefficients in the image of $R$, so do those of every square matrix over $\Lambda$, read through $\rho$ as a block matrix. \item (Ribet's method.) Let $\mathfrak a$ be a two-sided ideal containing $\ker\rho$, $I$ the left ideal spanned by a vector $y$, and $B$ a square matrix over $\Lambda$ with $By\in\mathfrak a+I\rho_0$ entrywise. Then some polynomial $P$ over $R$ has constant term $\det B$, read through $\rho$, and $IP(\rho_0)\subseteq\mathfrak a$; the traces of $\rho(\rho_1P(\rho_0))$ lie in the image of $R$, and if $\delta\in R$ is $\rho(z)$ for some $z\in I$, then $\delta$ times such a trace is the trace of $\rho(a)$ for some $a\in\mathfrak a$. \item (Tied rows.) For representations $u_x$, $x\in Y$, of $O[G]$, an algebra $S$ of functions $Y\to L$ containing the constants and the coefficients of the characteristic polynomials, and an $S$-module $\mathcal J$, let $\mathfrak a$ be spanned by the elements whose traces against every group element lie in $\mathcal J$. If $B$ is a matrix of tied rows and, on a set $\mathcal X$, $u_x$ is a block $\psi_x$ plus characters $\eta_e$, then one $f\in S$ multiplies $\det(u_x(w))$ into $\mathcal J$ for every $w\in I$, with $f(x)=\mu_0\det(\psi_xB)\prod_e\det(\eta_eB)$ on $\mathcal X$. \end{enumerate} \end{proposition} \begin{proof} (a) is the second half of the proof of \cref{lem:amitsur}(b) without the variable $X$: the matrices with a single nonzero row span, and their characteristic polynomials are powers of $T$ times those of the $\rho(Q_{qq})$. (b) \emph{The rows.} Write $(By)_i=a_i+z_i\rho_0$ with $a_i\in\mathfrak a$ and $z_i\in I$, and $z_i=\sum_jB_{1,ij}y_j$; this defines a square matrix $B_1$ over $\Lambda$. Put $B_X=B-XB_1$, a matrix over $\Lambda[X]$, and let $P$, $B'$ be as in \cref{lem:amitsur}(b) for $B_X$; then $P(0)=\det\Phi(B)$. \emph{The module.} Let $Q=\Lambda/\mathfrak a$, a ring as $\mathfrak a$ is two-sided, and $\pi\colon\Lambda\to Q$ the quotient map. Let $\Lambda[X]$ act on $Q$ by letting $\Lambda$ act by left multiplication and $X$ by right multiplication with $\pi(\rho_0)$; the two commute, so this is a left module. Since $\ker\rho\subseteq\mathfrak a$, the action of $p\in\Lambda[X]$ depends only on the images $\rho(p_k)$ of its coefficients. \emph{Killing.} On the vector $\pi(y)\in Q^N$, $(B_X\pi(y))_i=\pi((By)_i)-\pi(z_i\rho_0)=\pi(a_i)=0$. Hence $0=B'B_X\pi(y)$, and as $\Phi_X(B'B_X)=P\cdot1$, the matrix $B'B_X$ acts on $\pi(y)$ as the scalar $P$, which acts by right multiplication with $\pi(P(\rho_0))$, the coefficients of $P$ being central. Hence $y_iP(\rho_0)\in\mathfrak a$ for every $i$, and for $z=\sum_jc_jy_j\in I$, $zP(\rho_0)=\sum_jc_j\,y_jP(\rho_0)\in\mathfrak a$. \emph{Traces.} The trace of $\rho(\rho_1P(\rho_0))$ is minus a coefficient of its characteristic polynomial, which lies in $R$ by \cref{lem:amitsur}(a). If $z_0\in I$ has $\rho(z_0)=\delta$, then $a=\rho_1z_0P(\rho_0)\in\mathfrak a$, $\mathfrak a$ being two-sided, and $\rho(a)=\delta\,\rho(\rho_1P(\rho_0))$ because $\delta$ is a scalar; take traces. (c) \emph{The lift.} Let $\kappa\colon O\to S$ send an element to the constant function, and define the $S$-algebra map $\rho\colon S[G]\to M_\sigma(\mathrm{Fun}(Y,L))$ by $\rho(\sum_gs_gg)=\sum_gs_g\,(x\mapsto u_x(g))$. It is $u_x$ at $x$ on the image of $O[G]$, and the characteristic polynomials of the group elements have their coefficients in $S$, so by \cref{lem:amitsur}(a) those of all $\rho(w)$ do. \emph{The ideal.} Let $\mathfrak a'$ be the set of $w\in S[G]$ with $\operatorname{tr}\rho(ws)\in\mathcal J$ for all $s\in S[G]$. It is a two-sided ideal: $\operatorname{tr}\rho(aws)=\operatorname{tr}\rho(w\,sa)$ by the cyclicity of the trace, and $\mathcal J$ is an $S$-module; it contains $\ker\rho$. If $r$ is a left combination $\sum_ic_iw_i$ of elements $w_i$ whose traces against all group elements lie in $\mathcal J$, then $\operatorname{tr}\rho(rs)=\sum_i\operatorname{tr}\rho(w_i\,sc_i)$ and $sc_i$ is an $S$-combination of group elements, so $r\in\mathfrak a'$. Hence the image of $B$ in $S[G]$ satisfies the hypothesis of (b) with $\mathfrak a'$, $\rho_0$ and the left ideal spanned by the image of $y$. Let $P\in S[X]$ be the polynomial of (b) and $f=\operatorname{tr}\rho(\rho_1P(\rho_0))\in S$. \emph{The multiplier.} Let $w\in I$ and $D=(x\mapsto\det u_x(w))$. By \cref{lem:amitsur}(a) the characteristic polynomial of $\rho(w)$ has coefficients in $S$, so by Cayley--Hamilton, as in \cref{lem:amitsur}(b), $\rho(vw)=D\cdot1$ for some $v\in S[G]$, and $vw$ lies in the left ideal spanned by $y$. By (b), $Df=\operatorname{tr}\rho(a)$ for some $a\in\mathfrak a'$, and $\operatorname{tr}\rho(a\cdot1)\in\mathcal J$. \emph{The value on $\mathcal X$.} For $x\in\mathcal X$, $u_x(\rho_1\rho_0)=0$: $\rho_1$ vanishes on $\psi_x$ and on $\eta_e$ for $e\ne0$, and $\rho_0$ on $\eta_0$. Writing $P(T)=P(0)+TP_1(T)$, the trace of $u_x(\rho_1P(\rho_0))$ is $P(0)(x)\operatorname{tr}u_x(\rho_1)=P(0)(x)\mu_0$, and $P(0)(x)$ is the determinant of $B$ read through $u_x$, which is block diagonal: $\det(\psi_xB)\prod_e\det(\eta_eB)$. \end{proof} \subsection{Tie ideals, Fitting ideals and the triangle cost}\label{ss:tie-ideals} Let $O$ be a discrete valuation ring, $R=O[X_j]_{j\in J}$, $G$ a group and $u_x$, $x\in Y$, matrix representations of $G$ over $O$ with $u_x(g)-1=\sum_iz_i(g)(u_x(\mathrm{gen}_i)-1)$ for given generators. For $p\in O$, elements $\tau_k$, $\varphi_k$ ($k=(j,b)$, $b\in\{\pm\}$) and polynomials $\varepsilon_j$, the \emph{tie ideal} is the left ideal of $R[G]$ spanned by the elements that every $u_x$ kills, by $p$ times the augmentation ideal $I_G$, by the \emph{ties} $\tau_k-1-X_j\varepsilon_j(\varphi_k)(\varphi_k-1)$, and by $I_G\rho_0$ for a normaliser $\rho_0$. A row $r$ is \emph{tied} if $\sum_ir_i(\mathrm{gen}_i-1)$ lies in it. An algebra $S$ of families of polynomials and an $S$-module $\mathcal J$ form a \emph{trace ideal} if $S$ holds the variables and the coefficients of the characteristic polynomials and $\mathcal J$ holds $p$ times the traces and the traces of the ties times group elements. The \emph{Fitting ideal} of $R^s/N$ is generated by the determinants of square matrices with rows in $N$. A module $Z$ of functions on $G$ has \emph{triangle cost $b$} along a set $I$ of indices, up to $C$, if there is $A\subseteq G$ such that, with $Z_0$ the members vanishing on $A$: for $j\in I$ and $c\in Z_0$ agreeing at the earlier pairs $\tau_i,\tau'_i$ and (for $i\in I$) $\varphi_i,\varphi'_i$, $C$ kills $c(\tau_j)-c(\tau'_j)$; and the length of $Z/Z_0$ plus that of any submodule of $Z_0$ vanishing at all $\tau_j,\tau'_j$ and agreeing at the $\varphi_j,\varphi'_j$, modulo $C$-torsion, is at most $b$. \lean{New.Selmer.HasTriangleCost, New.Selmer.exists_mem_fittingIdeal_addVal_constantCoeff_le, New.Selmer.smul_X_smul_mem_of_forall_form, New.Selmer.exists_mul_prod_X_mem_fittingIdeal, New.Selmer.IsTraceIdeal, New.Selmer.ribetCocyclesVanishingOn, New.Selmer.mem_ribetCocyclesVanishingOn, New.Selmer.rankOneRep, New.Selmer.IsCharacterCocycle, New.Selmer.IsDetectedBy, New.Selmer.IsCommonRibetElement, New.Selmer.exists_common_unit_row, New.Selmer.exists_rows_det_eq_pow_mul_det, New.Selmer.exists_relations_det_eq_pow_mul_det, New.Selmer.exists_forall_eq_one_and_forall_eq_zero, New.Selmer.exists_apply_eq_ite_of_prod_dvd, New.Selmer.exists_sum_mul_det_of_mem_fittingIdeal_map, New.Selmer.nonDivisorIdeal, New.Selmer.mem_nonDivisorIdeal, New.Selmer.X_mem_colon_nonDivisorIdeal, New.Selmer.coeff_mul_prod_of_mem_colon, New.Selmer.exists_mem_span_add_mul_eq_add_mul, New.Selmer.exists_block_rows, New.Selmer.isCharacterCocycle_of_mem_formsMod, New.Selmer.exists_unit_row, New.Selmer.exists_row_apply_eq_zero} \lean{New.Selmer.polyAction, New.Selmer.polyAction_single, New.Selmer.polyAction_aeval, New.Selmer.polyChar, New.Selmer.polyChar_single, New.Selmer.coordRows, New.Selmer.polyActionAtZero, New.Selmer.coordRows_apply, New.Selmer.polyChar_coordRows, New.Selmer.polyActionAtZero_single, New.Selmer.polyActionAtZero_X_smul, New.Selmer.polyActionAtZero_coordRows, New.Selmer.rowValue, New.Selmer.rowValue_apply, New.Selmer.evalRowAtChar, New.Selmer.evalRowAtChar_apply, New.Selmer.traceLeftIdeal, New.Selmer.mem_traceLeftIdeal_of_forall, New.Selmer.augmentationIdeal, New.Selmer.tieIdeal, New.Selmer.ker_le_tieIdeal, New.Selmer.map_augmentationIdeal_le_tieIdeal, New.Selmer.tie_mem_tieIdeal, New.Selmer.mul_mem_tieIdeal, New.Selmer.tiedRows, New.Selmer.mem_tiedRows, New.Selmer.normaliserRow, New.Selmer.tiedNormaliser, New.Selmer.C_algebraMap_trace, New.Selmer.ribetGenerators, New.Selmer.AreCoordinates, New.Selmer.polyAction_rowValue_coordRows, New.Selmer.polyAction_rowValue_coordRows_of_areCoordinates, New.Selmer.rowValue_mem_augmentationIdeal, New.Selmer.mem_tiedRows_of_forall_eq_zero, New.Selmer.coordRows_cocycle_mem_tiedRows, New.Selmer.coordRows_gen_sub_single_mem_tiedRows, New.Selmer.coordRows_linearCombination_mem_tiedRows, New.Selmer.smul_mem_tiedRows, New.Selmer.coordRows_tau_sub_mem_tiedRows, New.Selmer.polyAction_rowValue_normaliserRow, New.Selmer.sub_one_smul_normaliserRow_mem_tiedRows, New.Selmer.single_mem_tiedRows, New.Selmer.smul_one_mem_traceLeftIdeal, New.Selmer.tie_mem_traceLeftIdeal, New.Selmer.tieIdeal_le, New.Selmer.exists_mem_tiedRows_polyActionAtZero_eq, New.Selmer.coboundary_eq_zero_of_apply_eq_zero, New.Selmer.exists_tiedRows_addVal_det_le, New.Selmer.isCharacterCocycle_of_tiedRows, New.Selmer.mem_map_tiedRows_iff, New.Selmer.tie_mem_map_tiedRows, New.Selmer.exists_mem_fittingIdeal_character, New.Selmer.det_map_polyChar_tame_rows, New.Selmer.CharacterRows, New.Selmer.exists_unit_rows_mem_tiedRows, New.Selmer.exists_sum_mul_det_of_mem_fittingIdeal_evalRowAtChar, New.Selmer.nonempty_characterRows} We first record the facts on Fitting ideals and lengths over $O$ that are used. Write $v$ for the normalised valuation of $O$, $\varpi$ for a uniformiser, $K$ for the fraction field, and $\mathrm{len}(S,T)$ for the length of $S/(S\cap T)$. For $\Phi\colon O^n\to R^s$ an $O$-linear map, $z\colon G\to O^n$, a submodule $N\le R^s$ and $p\in O$, the module $\mathrm{forms}(\Phi,z,N,p)$ consists of the functions $\Psi\circ z$ on $G$, $\Psi\colon O^n\to O/p$ linear and vanishing on $\Phi^{-1}N$. \lean{New.Selmer.DivisibleQuot, New.Selmer.addVal_le_length_torsionBy, New.Selmer.divQuot, New.Selmer.divQuot_injective, New.Selmer.divQuot_mk, New.Selmer.exists_divQuot_eq, New.Selmer.exists_rows_addVal_det_le, New.Selmer.exists_rows_addVal_det_le_of_divisible, New.Selmer.exists_smul_eq_zero_divisibleQuot} \lean{New.DVR, New.DVR.isUnit_or_isUnit_of_add_one, New.DVR.not_a_field', New.DVR.toIsDiscreteValuationRing, New.DVR.toIsDomain, New.DVR.toIsPrincipalIdealRing, New.Lift.relLength_le_of_prime_smul_mem, New.Lift.relLength_le_of_relations, New.Lift.relLength_trans, New.OddPart.length_le_of_detecting_points, New.PadicIntegerRing, New.PadicIntegerRing.ctorIdx, New.PadicIntegerRing.toAlgebra, New.PadicIntegerRing.toCharZero, New.PadicIntegerRing.toDVR, New.PadicIntegerRing.toFinite, New.PadicIntegerRing.toFree, New.PadicIntegerRing.toHasFiniteQuotients, New.QuotSpan, New.Selmer.exists_pow_smul_notMem_and_succ_mem, New.Selmer.fittingIdeal, New.Selmer.fittingIdeal.exists_addVal_le_relLength, New.Selmer.fittingIdeal.exists_ge_mul_prod_mem, New.Selmer.fittingIdeal.mul_mem_of_smul_mem, New.Selmer.fittingIdeal.sup_smul_top_le, New.Selmer.formsMod, New.Selmer.formsMod_anti, New.Selmer.map_mkQ_formsMod_lt, New.Selmer.mem_formsMod, New.Selmer.mem_of_forall_form_eq_zero, New.Selmer.mul_det_mem_fittingIdeal, New.Selmer.nsmul_quot_eq_zero, New.addVal_prod, New.cocycleRelations, New.comp_mem_obeying_iff, New.exists_matrix_addVal_det_le_length, New.length_ker_le_addVal_det, New.length_le_of_le_map, New.length_mono, New.length_obeying_relationsOn_le, New.length_quot_span_eq_addVal, New.mapRel, New.mem_obeying, New.mem_obeying_cocycleRelations, New.mkQ_mem_obeying_relationsOn, New.obeying, New.relEval, New.relEval_apply, New.relLength, New.relLength_add_length_inf, New.relLength_bot, New.relLength_comap, New.relLength_eq_length_map_mkQ, New.relLength_eq_zero, New.relLength_iInf_le, New.relLength_ker, New.relLength_le_of_mapsTo, New.relLength_mono, New.relationsOn, New.smul_quot_eq_zero_of_dvd} \begin{lemma}[Fitting ideals and lengths]\label{lem:fitting} Let $N\le R^s$ and $p\ne0$ with $\Phi(pO^n)\subseteq N$; $\mathrm{Fitt}(N)$ denotes the Fitting ideal of $R^s/N$. \begin{enumerate}[label=\textup{(\alph*)}] \item For an ideal $\mathfrak q$ of $R$, $\mathrm{Fitt}(N+\mathfrak qR^s)\subseteq\mathrm{Fitt}(N)+\mathfrak q$. \item If $rv\in N$, then $r\,\mathrm{Fitt}(N+Rv)\subseteq\mathrm{Fitt}(N)$. If for each $j$ of a finite ordered set every $K'\ge N$ containing the $v_i$, $ib$. Hence $V$ is the $a$-torsion. \end{proof} \begin{theorem}[Ribet's lemma to first order]\label{thm:ribet-lemma} Let $u_x$, $x\in Y$, be a finite family of matrix representations of a group $G$ over a discrete valuation ring $O$, and $S$, $\mathcal J$ a trace ideal for $p\ne0$, elements $\tau_k$, $\varphi_k$ and polynomials $\varepsilon_j$ with $\varepsilon_j\equiv1$ modulo $p$ at the $\xi_e(\varphi_k)$. Assume: \begin{enumerate}[label=\textup{(\roman*)}] \item on a set $\mathcal X$, $u_x$ is a block $\rho_x$ plus characters $\xi_e$ with $\xi_0=1$, and $\rho_\pi$ spans all matrices for some $\pi\in\mathcal X$; \item an element $\gamma_x$ acts on the block by a scalar $y_x$ with $y_x-1$ a unit and as the identity on the characters; \item for an element $a$ the products $\prod_{k\ne e}(\xi_e(a)-\xi_k(a))$ divide $C$, and each $j$ has a type, monotone in $j$; \item the cocycles of $\rho_\pi$ in $K/O$ obeying the relations among the $(u_x(g)-1)_x$ and vanishing at the $\tau_k$ and at $\gamma_\pi$ have length at most $b_0$; \item elements $\delta_v$ are trivial on the characters and $o_v(X-1)$ kills every $u_x(\delta_v)$; \item for each $e$, every module of character cocycles for $\xi_e$ has triangle cost $b_e$ along the $j$ of type $e$, and is detected on a finite set $s$. \end{enumerate} Then the determinants of all combinations $\sum\omega_g(u_x(g)-1)$ lie in $S$ and vanish on $\mathcal X$; one $f\in S$ multiplies them into $\mathcal J$; on $\mathcal X$, $f$ has no monomial properly dividing $\prod_jX_j$; and the coefficient of $\prod_jX_j$ in $f(\pi)$ comes from some $c\in O$ with \[ v(c)\le b_0+\sum_eb_e+t\Bigl(\sum_vv(o_v(1))+2\#s\,v(C)\Bigr)+(\#J+1)v(C), \] $t$ being the number of characters. \end{theorem} \begin{proof} \emph{The determinants.} By \cref{lem:amitsur}(a) applied to the lift of the family to $S[G]$ (proof of \cref{prop:ribet-algebra}(c)), the determinant of every element of $O[G]$, as a function of $x$, lies in $S$. On $\mathcal X$ every combination $\sum_g\omega_g(u_x(g)-1)$ has the column of $\xi_0=1$ equal to zero, so its determinant vanishes there. \emph{Auxiliary elements.} The element $k=c\,(\gamma_x-1)$ with $c(y_x-1)=1$ is $1$ on every character and $0$ on the block $\rho_x$; multiplying over the finitely many $x\in\mathcal X$ such elements (each is $1$ on the characters) gives one $k$ that is $1$ on every character and $0$ on every block. By (iii), for each $e$ an element $q_e$ of $R[G]$, a multiple of $\prod_{k\ne e}(a-\xi_k(a))$, is $C$ on $\xi_e$ and $0$ on the other characters. \emph{Generators.} Take a finite $s_0$ and coordinates $z(g)$ in the generators $\delta_v$, $s_0$ and $s$ (\cref{ss:tie-ideals}), and $c_1$ with $c_1(y_\pi-1)=1$, so that $c_1(\gamma_\pi-1)$ is $1$ on $\rho_\pi$. \emph{The block.} By (iv) and \cref{prop:tied-rows}(b) there is a square matrix $B_0$ of tied rows whose determinant on $\rho_\pi$ at $X=0$ has valuation at most $b_0$. \emph{The characters.} By (iii), (vi) and \cref{prop:tied-rows}(c) there are matrices $B_{e,i}$ with weights $w_{e,i}$, polynomials $\Gamma_e$ and, for each choice $i=(i_e)$, a matrix $M_i$ of tied rows with $\det(M_i|_{\xi_e})=c_0\det B_{e,i_e}$, $c_0=\prod_vo_v(1)C^{\#s}$, such that $d_e=\sum_iw_{e,i}\det B_{e,i}$ satisfies $d_e+\zeta_e=\Gamma_e\prod_{\mathrm{ty}(j)=e}X_j$ with $\zeta_e\prod_{\mathrm{ty}(j)