and one computes $\operatorname{{\mathrm{socle}}}A=ka^{2}$. Hence the sequence
$\varpi,b-c,b-\beta,X-\gamma$ is regular and it follows from Proposition (CI)
that $R_{v}^{\operatorname{\varphi-uni}}$ is Gorenstein. ∎

We consider the ‘same’ augmentation as in case $({\mathrm{st}})$, namely the
${\mathcal{O}}$-algebra map $R_{v}^{\operatorname{\varphi-
uni}}\to{\mathcal{O}}$ that is the projection $R^{\operatorname{\varphi-
uni}}_{v}\to R^{\operatorname{\varphi-uni}}_{1}/I_{2}=R_{v}^{\mathrm{st}}$
from Lemma (CI).2. composed with the augmentation
$R^{\mathrm{st}}_{v}\to{\mathcal{O}}$ from case $({\mathrm{st}})$. Concretely
$\lambda$ is given by

$a\mapsto 0,X\mapsto 0,c\mapsto 0,\alpha\mapsto 0,\gamma\mapsto 0,b\mapsto
s,\beta\mapsto t$

for some $s,t\in{\mathfrak{m}}_{\mathcal{O}}$ with $t$ non-zero.

#### Case $({\mathrm{uni}})$

One has natural surjections $R^{\square}_{v}\to R_{v}^{\mathrm{st}}$ and
$R^{\square}_{v}\to R_{v}^{\mathrm{unr}}$. Denote by $I^{\mathrm{st}}$ and
$I^{\mathrm{unr}}$ the corresponding ideals of $R^{\square}_{v}$. Then in the
case $({\mathrm{uni}})$, we define $R$ as the quotient

$R_{v}^{\mathrm{uni}}=R_{v}^{\square}/(I^{\mathrm{st}}\cap I^{\mathrm{unr}}),$

cf. [Sho16, Rem. 5.7] for a comparable definition. In other words,
$R_{v}^{\mathrm{uni}}$ is the reduced quotient of $R_{v}^{\square}$ such that
$\operatorname{Spec}R^{\mathrm{uni}}=\operatorname{Spec}R_{v}^{\mathrm{st}}\cup\operatorname{Spec}R_{v}^{\mathrm{unr}}\subset\operatorname{Spec}R_{v}^{\square}$;
see Lemma (CI).

The ring $R_{v}\square$ is can be realized as the quotient
${\mathcal{R}}^{\prime}/{\mathcal{I}}^{\prime}$ for
${\mathcal{R}}^{\prime}={\mathcal{O}}[[\alpha,\beta,\gamma,\delta,a,b,c,X]]$
and ${\mathcal{I}}^{\prime}\subset{\mathcal{R}}^{\prime}$ as the ideal
generated by the entries of the ($2\times 2$\- and $1\times 1$-) matrices

$AB-B^{q}A,\det A-q,\det B=1$

with $A:=\scalebox{0.8}{$\begin{pmatrix}q+a&b\\\ c&1-a-X\end{pmatrix}$}$ and
$B:=\scalebox{0.8}{$\begin{pmatrix}1+\alpha&\beta\\\
\gamma&1+\delta\end{pmatrix}$}$. The ideals $I^{\mathrm{unr}}$ and
$I^{\mathrm{st}}$ both contain $\alpha+\delta$ since these quotient describe
situations where either $N=B-I$ is zero, or $N$ is of trace and determinant
zero. Therefore $R_{v}^{\mathrm{uni}}$ can be written as a quotient of
${\mathcal{R}}={\mathcal{O}}[[\alpha,\beta,\gamma,a,b,c,X]]$ by an ideal
${\mathcal{I}}^{\mathrm{uni}}\subset{\mathcal{R}}$; with $\delta=-\alpha$.

We computed in Macaulay2 generators of $I^{\mathrm{unr}}$ and
$I^{\mathrm{st}}$ by working inside the polynomial ring
${\mathcal{R}}_{\mathbf{Z}}=\mathbf{Z}[{\underline{q}},a,b,c,X,\alpha,\beta,\gamma]$,
where we represent the prime $q$ in $\mathbf{Z}$ by the indeterminate
${\underline{q}}+1$ in the polynomial ring. Let
$I_{\mathbf{Z}}^{\mathrm{unr}}$ and $I^{\mathrm{st}}_{\mathbf{Z}}$ denote the
corresponding ideals of ${\mathcal{R}}_{\mathbf{Z}}$. Then we let Macaulay
also compute the intersection
$I_{\mathbf{Z}}^{\mathrm{uni}}=I_{\mathbf{Z}}^{\mathrm{unr}}\cap
I_{\mathbf{Z}}^{\mathrm{st}}$. The ideal $I_{\mathbf{Z}}^{\mathrm{uni}}$ is
generated by the elements

$r^{\mathrm{uni}}_{1}=X\gamma,\ r^{\mathrm{uni}}_{2}=X\beta,\
r^{\mathrm{uni}}_{3}=X\alpha,\ r^{\mathrm{uni}}_{4}=\alpha^{2}+\beta\gamma,\
r^{\mathrm{uni}}_{5}=b\alpha-a\beta,\ r^{\mathrm{uni}}_{6}=a\alpha+b\gamma,$
$r^{\mathrm{uni}}_{7}=c\beta-b\gamma+{\underline{q}}\alpha,\
r^{\mathrm{uni}}_{8}=c\alpha-a\gamma-{\underline{q}}\gamma,\
r^{\mathrm{uni}}_{9}=a^{2}+bc+aX+{\underline{q}}a+({\underline{q}}+1)X.$

We also have $I^{\mathrm{unr}}_{\mathbf{Z}}=(\alpha,\beta,\gamma)$ and
$I^{\mathrm{st}}_{\mathbf{Z}}=(X,r_{4}^{\mathrm{uni}},\ldots,r_{9}^{\mathrm{uni}})$.
We shall use the same names $r^{\mathrm{uni}}_{i}$ for the corresponding
elements in ${\mathcal{R}}$, with the silent assumption that in
${\mathcal{R}}$ we replace ${\underline{q}}$ by $q$.

######  Lemma (CI).

The ring $R^{\mathrm{uni}}_{v}={\mathcal{R}}/{\mathcal{I}}^{\mathrm{uni}}$
with ${\mathcal{R}}={\mathcal{O}}[[\alpha,\beta,\gamma,X,a,b,c]]$ and
${\mathcal{I}}^{\mathrm{uni}}=(r^{\mathrm{uni}}_{1},\ldots,r^{\mathrm{uni}}_{9})$
has the following properties:

  1. 1.

We have
${\mathcal{I}}^{\mathrm{uni}}={\mathcal{I}}^{\mathrm{unr}}\cap{\mathcal{I}}^{\mathrm{st}}$
for ${\mathcal{I}}^{\mathrm{unr}}={\mathcal{I}}+(\alpha,\beta,\gamma)$ and
${\mathcal{I}}^{\mathrm{st}}={\mathcal{I}}+(X)$ so that
${\mathcal{R}}/{\mathcal{I}}^{\mathrm{unr}}$ and
${\mathcal{R}}/{\mathcal{I}}^{\mathrm{st}}$ are identified with the unramified
and the Steinberg quotient of $R_{v}^{\mathrm{uni}}$, respectively.

  2. 2.

The ring $R_{v}^{\mathrm{uni}}$ is Cohen–Macaulay, flat over ${\mathcal{O}}$
and of relative dimension $3$ and reduced.

  3. 3.

The elements $\varpi,b-c,b-\beta,X-\gamma$ for a regular system of parameters
and $R_{v}^{\mathrm{uni}}$ is Gorenstein.

###### Proof.

Part 1 is clear, except for the containment
${\mathcal{I}}^{\mathrm{uni}}\supset{\mathcal{I}}^{\mathrm{unr}}\cap{\mathcal{I}}^{\mathrm{st}}$.
Similar to Lemma (CI), the quotient
${\mathcal{R}}/{\mathcal{I}}^{\mathrm{unr}}\cong{\mathcal{O}}[[X,a,b,c]]/(r_{9}^{\mathrm{uni}})$
is a Cohen–Macaulay domain of dimension $4$. The inclusion
${\mathcal{I}}^{\mathrm{uni}}\supset{\mathcal{I}}^{\mathrm{unr}}\cap{\mathcal{I}}^{\mathrm{st}}$
now follows as in the proof of Lemma (CI), and this completes part 1. Because
of part 1, the central factors in the short exact sequence of
${\mathcal{R}}$-modules
$0\to{\mathcal{R}}/{\mathcal{I}}^{\mathrm{uni}}\to{\mathcal{R}}/{\mathcal{I}}^{\mathrm{unr}}\times{\mathcal{R}}/{\mathcal{I}}^{\mathrm{st}}\to{\mathcal{R}}/({\mathcal{I}}^{\mathrm{unr}}+{\mathcal{I}}^{\mathrm{st}})\to
0$ are domains, and so $R_{v}^{\mathrm{uni}}$ is reduced. Both and also
${\mathcal{R}}/({\mathcal{I}}^{\mathrm{unr}}+{\mathcal{I}}^{\mathrm{st}})\cong{\mathcal{O}}[[a,b,c]]/(r_{3}^{\mathrm{st}})$
are Cohen–Macaulay of dimensions $4$, $4$ and $3$, respectively. As before we
find that $R_{v}^{\mathrm{uni}}$ is Cohen–Macaulay of dimension $4$ by [Eis95,
Exerc. 18.13].

Finally one verifies, by hand or via Macaulay, that
${\mathcal{R}}_{\mathbf{Z}}/({\mathcal{I}}_{\mathbf{Z}}^{\mathrm{uni}}+({\underline{q}},b-c,b-\beta,X-\gamma))$
is a free $\mathbf{Z}$-module of rank $6$ with basis
$1,a,aX,\alpha,\beta,\gamma$ and socle $aX$. By reduction module any prime
number $p$, one deduces that
$R_{v}^{\mathrm{uni}}/(\varpi,b-c,b-\beta,X-\gamma)$ is a zero-dimensional
Gorenstein ring, using Proposition (CI); when passing to the reduction, one
has to explicitly consider the bilinear paring that results from the
multiplication of two arbitrary linear forms in $a,\alpha,\beta,\gamma$, and
show that it remains non-degenerate under any reduction. The same proposition
then also implies that $\varpi,b-c,b-\beta,X-\gamma$ is a regular sequence in
$R_{v}^{\mathrm{uni}}$ and that $R_{v}^{\mathrm{uni}}$ is Gorenstein. In
particular $\varpi$ is a non-zero divisor and this shows that
$R_{v}^{\mathrm{uni}}$ is flat over ${\mathcal{O}}$. ∎

######  Remark (CI).

One can also work out the above argument by first working out properties for
${\mathcal{R}}_{\mathbf{Z}}$, ${\mathcal{I}}^{\mathrm{st}}$,
${\mathcal{I}}^{\mathrm{unr}}$ and ${\mathcal{I}}^{\mathrm{uni}}$, and then
completing at
${\mathfrak{m}}_{Z}=(p,{\underline{q}},\alpha,\beta,\gamma,X,a,b,c)$, and then
passing to the quotient modulo ${\underline{q}}-(q-1)$. The above direct
argument is shorter.

###  5.2 Steinberg deformations at trivial primes

######  Lemma (CI).

  1. 1.

The elements
$r^{\mathrm{st}}_{1},r^{\mathrm{st}}_{2},r^{\mathrm{st}}_{3},\gamma-\beta,c+b,\beta+b,\varpi$
of ${\mathcal{R}}={\mathcal{O}}[[a,b,c,\alpha,\beta,\gamma]]$ form a regular
sequence.

  2. 2.

The complete intersection
$\widetilde{R}:={\mathcal{R}}/(r^{\mathrm{st}}_{1},r^{\mathrm{st}}_{2},r^{\mathrm{st}}_{3})$
is flat over ${\mathcal{O}}$ and of relative dimension $3$.

  3. 3.

The point in $\operatorname{Spec}\widetilde{R}[\frac{1}{\varpi}]$
corresponding to the augmentation
$\widetilde{\lambda}\colon\widetilde{R}\to{\mathcal{O}}$ given by the same
prescription as $\lambda$ is formally smooth.

###### Proof.

1\. It suffices to show that ${\mathcal{R}}$ modulo the ideal generated by the
given sequence is finite. Modding out $\gamma-\beta,c+b,\beta+b,\varpi$ from
${\mathcal{R}}$, we need to show that $k[[a,b,\alpha]]$ modulo the $2\times
2$-minors $t_{1,2},t_{2,3},t_{3,4}$ of the matrix

$\left(\begin{array}[]{cccc}\alpha&-b&a&b\\\
-b&-\alpha&-b&-a\end{array}\right).$

is finite. Using the relation $\alpha a+b^{2}$ as an relation for $b$, it
follows that the quotient ring is a degree $2$ extension of
$k[[a,\alpha]]/(\alpha^{2}-a\alpha,a^{2}+a\alpha)$, and the latter ring is
finite, as $p>2$; a $k$-basis is $1,a,\alpha,a\alpha$.

2\. The regular sequence in 1. remains a regular sequence under any reordering
and after any truncation. This shows that $\widetilde{R}$ is flat over
${\mathcal{O}}$ and of relative dimension $3$ over ${\mathcal{O}}$.

3\. To see the formal smoothness, we form the Jacobian matrix of
$r^{\mathrm{st}}_{1},r^{\mathrm{st}}_{2},r^{\mathrm{st}}_{3}$ relative to the
variables of ${\mathcal{R}}[\frac{1}{\varpi}]$ and evaluate at the
augmentation. This gives

$\left(\begin{array}[]{cccccc}0&0&0&2\alpha&\gamma&\beta\\\
\alpha&\gamma&0&q-1+a&0&b\\\
2a+q-1&c&b&0&0&0\end{array}\right)\stackrel{{\scriptstyle\mathrm{eval.\,at\,}\widetilde{\lambda}}}{{\longrightarrow}}\left(\begin{array}[]{cccccc}0&0&0&0&0&t\\\
0&0&0&q-1&0&s\\\ q-1&0&s&0&0&0\end{array}\right)$

Columns $1,4,6$ witness the formal smoothness asserted for
$\widetilde{\lambda}$. ∎

######  Remark (CI).

From the proof of Lemma (CI).1, one deduces that as an ${\mathcal{O}}$-algebra
map $S={\mathcal{O}}[[y_{1},y_{1},y_{3}]]\to\widetilde{R}$ one can take

$y\mapsto\gamma-\beta,\quad y_{2}\mapsto c+b,\quad y_{3}\mapsto\beta+b.$

Similar to the proof of Lemma (CI).1, one can show that
$R_{v}^{\mathrm{st}}/(\varpi,y_{1},y_{2},y_{3})\cong
k[a,\alpha,\gamma]/(a,\alpha,\gamma)^{2}$. Its socle is obviously spanned by
$\\{a,\alpha,\gamma\\}$ and has thus $k$-dimension $3$. Using that
$R^{\mathrm{st}}_{v}$ is local Cohen–Macaulay of dimension $4$, by combining
parts 3, 2 and 1 of Proposition (CI) one deduces that $R_{v}^{\mathrm{st}}$ is
not Gorenstein.

In the following let
$\widetilde{R}={\mathcal{R}}/(r^{\mathrm{st}}_{1},r^{\mathrm{st}}_{2},r^{\mathrm{st}}_{3})$
and $I=\ker(\widetilde{R}\to R_{v}^{\mathrm{st}})$. We need some preparations
to give a presentation of $I$ as an $\widetilde{R}$-module. Recall that
$J_{\mathrm{st}}$ was defined before formula (5.1).

######  Lemma (CI).

The sequence of ${\mathcal{R}}$-modules
${\mathcal{R}}^{8}\stackrel{{\scriptstyle
A}}{{\to}}{\mathcal{R}}^{6}\stackrel{{\scriptstyle
B}}{{\to}}J_{\mathrm{st}}\to 0$ is exact, where $B$ is the $1\times 6$-matrix
$(r^{\mathrm{st}}_{1},r^{\mathrm{st}}_{2},\ldots,r^{\mathrm{st}}_{6})$ and $A$
is the $8\times 6$-matrix

$\left(\begin{array}[]{cccccccc}b&q-1+a&0&0&-a&c&0&0\\\
0&-\alpha&-b&0&0&-\gamma&a&0\\\ 0&0&\beta&\alpha&0&0&-\alpha&\gamma\\\
0&\beta&0&-b&0&-\alpha&0&a\\\ \beta&0&0&q-1+a&-\alpha&0&0&c\\\
-\alpha&0&q-1+a&0&-\gamma&0&c&0\\\ \end{array}\right).$

###### Proof.

The displayed presentation is part of the Eagon-Northcott complex attached to
the $4\times 2$-matrix from (5.1), considered as an ${\mathcal{R}}$-linear map
$\nu\colon{\mathcal{R}}^{4}\to{\mathcal{R}}^{2}$, and in the present case,
this complex is exact: The Eagon-Northcott complex is described in detail in
[Eis05, § 11H], which we now recall in parts. We follow the notation of
[Eis05] and set $G={\mathcal{R}}^{2}$ and $F={\mathcal{R}}^{4}$. Then in the
case at hand, the Eagon-Northcott complex is the complex

$0\longrightarrow(\operatorname{Sym}^{2}G)^{*}\otimes\bigwedge^{4}F\stackrel{{\scriptstyle
d_{2}}}{{\longrightarrow}}(\operatorname{Sym}^{1}G)^{*}\otimes\bigwedge^{3}F\stackrel{{\scriptstyle
d_{1}}}{{\longrightarrow}}(\operatorname{Sym}^{0}G)^{*}\otimes\bigwedge^{2}F\longrightarrow\bigwedge^{2}G;$

choosing bases $f_{1},\ldots,f_{4}$ of $F$ and $g_{1},g_{2}$ of $G$, the
complex is seen to be of the form
$0\to{\mathcal{R}}^{3}\to{\mathcal{R}}^{8}\to{\mathcal{R}}^{6}\to{\mathcal{R}}$;
the right most map of the complex sends the basis element $f_{i}\wedge f_{j}$,
$i<j$, to the minor $t_{i,j}$ of (5.1) formed by column $i$ and column $j$,
and thus its image is the ideal $J_{\mathrm{st}}$.

To describe the maps $d_{i}$, let
$\Gamma_{j}\colon(\operatorname{Sym}^{j}G)^{*}\to
G^{*}\otimes(\operatorname{Sym}^{j-1}G)^{*}$ be the map dual to the
multiplication map
$G\otimes\operatorname{Sym}^{j-1}G\to\operatorname{Sym}^{j}G$, and let
$\Phi_{k}\colon\bigwedge F^{k}\to F\otimes\bigwedge^{k-1}F$ be the
${\mathcal{R}}$-linear map given on basis elements by
$f_{i_{1}}\wedge\ldots\wedge
f_{i_{l}}\mapsto\sum_{j=1}^{k}(-1)^{j-1}f_{i_{j}}\otimes
f_{i_{1}}\wedge\ldots\wedge\widehat{f_{i_{j}}}\wedge\ldots\wedge f_{i_{l}}$.
Then for a pure tensor $u\otimes v$ in
$(\operatorname{Sym}^{j}G)^{*}\otimes\bigwedge F^{j+2}$ one has

$d_{j}(u\otimes
v)=\sum_{l,m}\big{(}\nu^{*}(u^{\prime}_{l})(v^{\prime}_{m})\big{)}u^{\prime\prime}_{l}\otimes
v^{\prime\prime}_{l},$

if we write $\Gamma_{j}(u)=\sum_{l}u^{\prime}_{l}\otimes u^{\prime\prime}_{l}$
and $\Phi_{j+2}(v)=\sum_{m}v^{\prime}_{m}\otimes v^{\prime\prime}_{m}$. This
procedure can be applied to the basis $g_{l}\otimes f_{i_{1}}\wedge
f_{i_{2}}\wedge f_{i_{3}}$, $1\leq i_{1}<i_{2}<i_{3}\leq 4$, of
$(\operatorname{Sym}^{1}G)^{*}\otimes\bigwedge^{3}F$ to obtain the matrix $A$.

To complete the proof, it remains to show exactness of the Eagon-Northcott
complex in the case at hand. By [Eis05, Thm. 11.35] this holds if and only if
the grade of the ideal $J_{\mathrm{st}}$ attains the maximal value possible,
namely the height of $J_{\mathrm{st}}$; see [Mat80, p. 103]. Because
${\mathcal{R}}/J_{\mathrm{st}}=R_{v}^{{\mathrm{st}}}$ has Krull dimension $4$,
the height of $J_{\mathrm{st}}$ is $3$. The grade of $J_{\mathrm{st}}$ is the
maximal length of a regular sequence of ${\mathcal{R}}$ contained in
$J_{\mathrm{st}}$, see [Mat80, p. 103], and because of Lemma (CI) this number
is at least $3$. ∎

######  Lemma (CI).

Let ${\mathcal{R}}^{m}\stackrel{{\scriptstyle
A}}{{\to}}{\mathcal{R}}^{n}\stackrel{{\scriptstyle B}}{{\to}}J\to 0$ be a
right exact sequence of ${\mathcal{R}}$-modules for $J$ an ideal of
${\mathcal{R}}$. We consider $A$ as an $n\times m$-matrix and $B$ as a
$1\times n$-matrix over ${\mathcal{R}}$. Decompose
$n=n^{\prime}+n^{\prime\prime}$ with $n^{\prime},n^{\prime\prime}>0$, and
decompose correspondingly the matrix $A$ into $A^{\prime}$ and
$A^{\prime\prime}$ of size $n^{\prime}\times m$ and $n^{\prime\prime}\times
m$, and the matrix $B$ into matrices $B^{\prime}$ of size $1\times n^{\prime}$
and $B^{\prime\prime}$ of size $1\times n^{\prime\prime}$, respectively. Let
$J^{\prime}\subset J$ be the image of ${\mathcal{R}}^{n^{\prime}}$ under
$B^{\prime}$. Then the induced sequence of ${\mathcal{R}}/J^{\prime}$-modules

$({\mathcal{R}}/J^{\prime})^{m}\stackrel{{\scriptstyle
A^{\prime\prime}\\!\\!\\!\\!\\!\\!\pmod{J^{\prime}}}}{{\longrightarrow}}({\mathcal{R}}/J^{\prime})^{n^{\prime\prime}}\stackrel{{\scriptstyle
B^{\prime\prime}\\!\\!\\!\\!\\!\\!\pmod{J^{\prime}}}}{{\longrightarrow}}J/J^{\prime}\to
0$

is right exact.

###### Proof.

By the definition of $J^{\prime}$, the map defined by
$B^{\prime\prime}\\!\\!\pmod{J^{\prime}}$ is clearly surjective. Also, $BA=0$
implies $B^{\prime}A^{\prime}=-B^{\prime\prime}A^{\prime\prime}$ as maps on
${\mathcal{R}}^{m}$. But $B^{\prime}\\!\\!\pmod{J^{\prime}}$ is the zero map,
and hence
$(B^{\prime\prime}\\!\\!\pmod{J^{\prime}})(A^{\prime\prime}\\!\\!\pmod{J^{\prime}})=0$.
It remains to show that
$\ker(B^{\prime\prime}\\!\\!\pmod{J^{\prime}})\subset\operatorname{im}(A^{\prime\prime}\\!\\!\pmod{J^{\prime}})$.
For this let $x^{\prime\prime}\in{\mathcal{R}}^{n^{\prime\prime}}$ represent
an element $x^{\prime\prime}\\!\\!\pmod{J^{\prime}}$ in
$\ker(B^{\prime\prime}\\!\\!\pmod{J^{\prime}})$. Then
$B^{\prime\prime}x^{\prime\prime}$ lies in $J^{\prime}$ and hence we can find
$x^{\prime}\in{\mathcal{R}}^{n^{\prime}}$ such that
$B^{\prime\prime}x^{\prime\prime}=B^{\prime}x^{\prime}$. We let
$x=(-x^{\prime},x^{\prime\prime})\in{\mathcal{R}}^{n}$, so that $Bx=0$. By the
exactness of the given complex, we can find $y\in{\mathcal{R}}^{m}$ such that
$Ay=x$. But then $A^{\prime\prime}y=x^{\prime\prime}$ and this implies
$x^{\prime\prime}\\!\\!\pmod{J^{\prime}}\in\operatorname{im}(A^{\prime\prime}\\!\\!\pmod{J^{\prime}})$.
∎

By combining the previous two lemmas, we find.

######  Corollary (CI).

As a module over $\widetilde{R}$ the ideal $I$ has a presentation

$(\widetilde{R})^{8}\stackrel{{\scriptstyle
A^{\prime}}}{{\longrightarrow}}(\widetilde{R})^{3}\longrightarrow I\to 0,$

where $A^{\prime}$ is the matrix

$\left(\begin{array}[]{cccccccc}0&\beta&0&-b&0&-\alpha&0&a\\\
\beta&0&0&q-1+a&-\alpha&0&0&c\\\ -\alpha&0&q-1+a&0&-\gamma&0&c&0\\\
\end{array}\right).$

######  Corollary (CI).

We have
$\widetilde{\lambda}(\operatorname{Fitt}_{0}^{\widetilde{R}}(I))=(q-1)t(s,t,q-1)\subset{\mathcal{O}}$.

###### Proof.

The ideal $\operatorname{Fitt}_{0}^{\widetilde{R}}(I)$ is the ideal generated
by the $3\times 3$-minors of the matrix $A^{\prime}$ from Corollary (CI).
Hence its image under $\widetilde{\lambda}$ is the ideal of ${\mathcal{O}}$
generated by the $3\times 3$-minors of

$\widetilde{\lambda}(A^{\prime})=\left(\begin{array}[]{cccccccc}0&t&0&-s&0&0&0&0\\\
t&0&0&q-1&0&0&0&0\\\ 0&0&q-1&0&0&0&0&0\\\ \end{array}\right).$ (5.2)

This is the ideal $(t^{2}(q-1),t(q-1)^{2},ts(q-1))=t(q-1)(s,t,q-1)$. ∎

######  Remark (CI).

One can also show that $\operatorname{Fitt}^{\widetilde{R}}_{0}(I)$ equals

$((q-1+a)^{2}\beta,\\!(q-1+a)b\beta,\\!(q-1+a)c\beta,\\!(q-1+a)\beta^{2},\\!(q-1+a)\beta\gamma,ac\alpha,ac\beta,bc\alpha,bc\beta,c^{2}\alpha,c^{2}\beta,c\alpha\beta,c\alpha\gamma,c\beta\gamma,c\beta^{2}).$

######  Corollary (CI).

We have
$\operatorname{Hom}_{R^{\mathrm{st}}_{v}}(I/I^{2},E/{\mathcal{O}})\cong{\mathcal{O}}/(s,t,q-1)\times{\mathcal{O}}/(t,q-1)\times(t,q-1))/(t(q-1))$.

###### Proof.

Note first that

$\operatorname{Hom}_{R_{v}^{\mathrm{st}}}(I/I^{2},E/{\mathcal{O}})\cong\operatorname{Hom}_{R_{v}^{\mathrm{st}}}(I\otimes_{\widetilde{R}}R_{v}^{\mathrm{st}},E/{\mathcal{O}})\cong\operatorname{Hom}_{{\mathcal{O}}}(I\otimes^{\widetilde{\lambda}}_{\widetilde{R}}{\mathcal{O}},E/{\mathcal{O}}),$

where in the second isomorphism, we use that $E$ is regarded as a
$R^{\mathrm{st}}_{v}$-module via the augmentation $\lambda$. Tensoring now the
presentation of $I$ in (CI) with ${\mathcal{O}}$ over $\widetilde{R}$ (via
$\widetilde{\lambda}$) gives the right exact sequence of
${\mathcal{O}}$-modules

${\mathcal{O}}^{8}\stackrel{{\scriptstyle\widetilde{\lambda}(A^{\prime})}}{{\longrightarrow}}{\mathcal{O}}^{3}\longrightarrow
I\otimes^{\widetilde{\lambda}}_{\widetilde{R}}{\mathcal{O}}\to 0$ (5.3)

Using the theory of invariant factors and elementary divisors of matrices over
PID’s, e.g. [Jac85, Thm. 3.9], the cokernel of this sequence is seen to be
isomorphic to $\prod_{i=1}^{3}{\mathcal{O}}/d_{i}{\mathcal{O}}$ where $d_{1}$,
$d_{1}d_{2}$ and $d_{1}d_{2}d_{3}$ are the gcd’s of the $i\times i$-minors of
$\widetilde{\lambda}(A^{\prime})$displayed in (5.2) for $i=1,2,3$. One readily
computes

$d_{1}=\gcd(s,t,q-1),$
$d_{2}=\gcd(t^{2},t(q-1),t(q-1),ts,(q-1)s,(q-1)^{2})=\gcd(s,t,q-1)\gcd(t,q-1),$
$d_{3}=\gcd(t^{2}(q-1),t(q-1)s,t(q-1)^{2})=t(q-1)\gcd(s,t,q-1),$

and this implies the assertion of the corollary. ∎

######  Lemma (CI).

For the ideals $P=(\alpha,\beta)$, $Q=(q-1+a,c)$ and
$I^{\prime}=((q-1+a)\alpha,(q-1+a)\beta,c\alpha,c\beta)$ of $\widetilde{R}$
the following hold.

  1. 1.

$P$ is a prime ideal and $P=\\{x\in\widetilde{R}\mid
xr^{\mathrm{st}}_{4}=0\\}$.

  2. 2.

$Q$ is a prime ideal and $Q=\\{x\in\widetilde{R}\mid
xr^{\mathrm{st}}_{6}=0\\}$.

  3. 3.

One has (a) $P\cap Q=\widetilde{R}[I]$ and (b) $P\cap Q=I^{\prime}$.

###### Proof.

1\. Note first that $\widetilde{R}/P$ is isomorphic to the quotient of
${\mathcal{O}}[[a,b,c,\beta]]/((q-1+a)a+bc)$. Since this is a domain, $P$ is a
prime ideal. Next observe that $\alpha$ and $\beta$ annihilate
$r^{\mathrm{st}}_{4}$ as follows by considering columns $2$ and $6$ in the
relation matrix $A^{\prime}$ in Corollary (CI). It remains to show that
$P=(\alpha,\beta)$ contains $\\{x\in\widetilde{R}\mid
xr^{\mathrm{st}}_{4}=0\\}$. So suppose that $xr^{\mathrm{st}}_{4}=0$ in
$\widetilde{R}$. The main observation is that
$r^{\mathrm{st}}_{4}\operatorname{mod}P=(q-1+a)\gamma$ is a non-zero element
in the domain $\widetilde{R}/P$. Therefore $x\operatorname{mod}P$ is zero, and
thus $x\in P$, as had to be shown. The proof of 2. is completely parallel to
that of 1. and left to the reader.

From the definition of $P$, $Q$ and $I^{\prime}$ it is clear that
$I^{\prime}\subset P\cap Q$. It is also straight forward to see from the
columns of $A^{\prime}$ that $I^{\prime}$ annihilates $r^{\mathrm{st}}_{5}$
(multiply the first column and the fifth column by $c$ or by $(q-1+a)$, and
use 1.; or alternatively, multiply the forth and the eighth column by $\alpha$
and $\beta$, and use 2.). We shall now prove (b), and from this and what we
already proved, (a) will follow.

To see (b), let $x$ be in $P\cap Q$. Write $x=f_{1}\alpha+f_{2}\beta$. To show
that $x$ lies in $I^{\prime}\subset P\cap Q$, we may subtract from $x$
arbitrary elements in $I^{\prime}$. Writing elements in ${\mathcal{R}}$ as
power series over ${\mathcal{O}}$ in $q-1+a,b,c,\alpha,\beta,\gamma$, we may
thus assume $f_{1},f_{2}\in(\alpha,\beta,\gamma,b)$. Shifting multiples of
$\alpha$ in $f_{2}$ to $\alpha f_{1}$, we may further assume
$f_{2}\in(\beta,\gamma,b)$, and using $r^{\mathrm{st}}_{1}$ we can replace
$\beta\gamma$ by $\alpha^{2}$, and this finally allows us to assume that
$f_{2}$ lies in $(b,\beta)$. We now reduce $x\in P\cap Q$ modulo $Q$. This
yields $f_{1}\alpha+f_{2}\beta=0$ in
${\mathcal{O}}[[\alpha,\beta,\gamma,b]]/(\alpha^{2}+\beta\gamma)$. In other
words, we can find
$f_{3}\in{\mathcal{R}}^{\prime}:={\mathcal{O}}[[\alpha,\beta,\gamma,b]]$ such
that

$f_{1}\alpha+f_{2}\beta+f_{3}(\alpha^{2}+\beta\gamma)=0\hbox{ in
}{\mathcal{R}}^{\prime}.$

Reducing modulo $\alpha$ and using $f_{2}\in(b,\beta)$ it follows that
$\gamma$ had to divide $f_{2}$ and hence that $f_{2}=0$. Since
${\mathcal{R}}^{\prime}$ is a UFD it follows that
$r^{\mathrm{st}}_{1}=\alpha^{2}+\beta\gamma$ divides $f_{1}$ and hence that
$f_{1}=0$ in $\widetilde{R}$. Hence we proved that $x$ lies in $I^{\prime}$. ∎

######  Corollary (CI).

Let $e$ be the ramification index of $E$ over $\mathbf{Q}_{l}$. Then
$\widetilde{\lambda}(\widetilde{R}[I])=(q-1)t\subset{\mathcal{O}}$ and
$c_{1,\lambda}(R^{\mathrm{st}}_{v})=\frac{1}{e}\log_{p}({\mathcal{O}}/(s,t,q-1))=\frac{n_{v}}{e}$.

###### Proof.

In Lemma (CI) we identified $\widetilde{R}[I]$ with $I^{\prime}$. The image of
$I^{\prime}$ under $\lambda$ is simply $((q-1)t)$. Invoking also Corollary
(CI), we deduce

$c_{1,\lambda}(R^{\mathrm{st}}_{v})=\frac{1}{e}\cdot\log_{p}\big{(}\\#((q-1)t)/((q-1)t(s,t,(q-1)))\big{)}=\frac{1}{e}\cdot\log_{p}\big{(}\\#{\mathcal{O}}/(s,t,q-1)\big{)}.$

∎

To complete the computation of $D_{1,\lambda}(R_{v}^{\mathrm{st}})$, we still
have to compute the size of the cokernel of
$\operatorname{Hom}_{R_{v}^{\mathrm{st}}}({\widehat{\Omega}}_{R_{v}^{\mathrm{st}}},E/{\mathcal{O}})\to\operatorname{Hom}_{\widetilde{R}}({\widehat{\Omega}}_{\widetilde{R}},E/{\mathcal{O}})$.
Using the methods of [BKM21, § 7.2] and its terminology, we need to compute
the lattice $\widetilde{\Lambda}\subset{\mathcal{O}}^{8}$ that is the kernel
of that natural surjection
${\mathcal{O}}^{8}\cong{\widehat{\Omega}}_{{\mathcal{R}}/{\mathcal{O}}}\otimes_{{\mathcal{R}}}^{\widetilde{\lambda}}{\mathcal{O}}\to{\widehat{\Omega}}_{\widetilde{R}/{\mathcal{O}}}\otimes_{\widetilde{R}}^{\widetilde{\lambda}}{\mathcal{O}}$.
The lattice $\widetilde{\Lambda}$ is contained in $\Lambda^{\mathrm{st}}$, and
the cardinality wanted is $\\#(\Lambda^{\mathrm{st}}/\widetilde{\Lambda})$.

######  Lemma (CI).

The lattice $\widetilde{\Lambda}\subset{\mathcal{O}}^{8}$ is spanned by the
rows of the matrix

$\left(\begin{array}[]{cccccccc}1&0&0&-1&0&0&0&0\\\ 0&0&0&0&1&0&0&1\\\
0&0&0&0&0&0&t&0\\\ 0&0&s&q-1&0&0&0&0\\\ 0&0&t&0&q-1&0&0&0\\\
\end{array}\right).$

and the quotient $\Lambda^{\mathrm{st}}/\widetilde{\Lambda}$ as an
${\mathcal{O}}$-module is isomorphic to $(s,t,q-1)/(t)\times(s,t,q-1)/(q-1)$.

###### Proof.

In the notation of [BKM21, § 7.3], the ring $\widetilde{R}$ is given as
${\mathcal{O}}[[a,b,c,e,\alpha,\beta,\gamma,\delta]]$ modulo the relations
$a-e,\alpha+\delta,\alpha\delta-\beta\gamma,(q-1+a)e+bc,(q-1+a)\delta-c\beta$.
The spanning vectors of $\widetilde{\Lambda}$ are then the image of the
Jacobian matrix

$\left(\begin{array}[]{cccccccc}1&0&0&-1&0&0&0&0\\\ 0&0&0&0&1&0&0&1\\\
0&0&0&0&\delta&-\gamma&-\beta&\alpha\\\ e&c&b&q-1+a&0&0&0&0\\\
\delta&0&-\beta&0&0&-c&0&q-1+a\\\ \end{array}\right)$

under the augmentation $\widetilde{\lambda}$. The matrix displayed in the
assertion of the lemma is obtained from this image after some simple row
operations. By [BKM21, § 7.2], the lattice $\Lambda^{\mathrm{st}}$ is spanned
by the rows of

$\left(\begin{array}[]{cccccccc}1&0&0&-1&0&0&0&0\\\ 0&0&0&0&1&0&0&1\\\
0&0&0&0&0&0&(s,t,q-1)&0\\\ 0&0&t&0&q-1&0&0&0\\\
0&0&0&(t,q-1)&{\textstyle\frac{s}{t}}(t,q-1)&0&0&0\\\ \end{array}\right)$

if ${\rm ord}_{\varpi}(s)\geq{\rm ord}_{\varpi}(t)$; and in the other case,
the last two rows have to be replaced by

$\left(\begin{array}[]{cccccccc}0&0&-s&q-1&0&0&0&0\\\
0&0&0&{\textstyle\frac{t}{s}}(s,q-1)&(s,q-1)&0&0&0\\\ \end{array}\right),$

In both cases, it is easy to express the basis spanning $\widetilde{\Lambda}$
in terms of the basis spanning $\Lambda^{\mathrm{st}}$, by an upper triangular
transition matrix over ${\mathcal{O}}$ diagonal entries
$1,1,1,\frac{t}{(s,t,q-1)},\frac{(q-1)}{(s,t,q-1)}$. The assertions of the
lemma are now clear. ∎

######  Corollary (CI).

We have
$D_{1,\lambda}(R_{v}^{\mathrm{st}})=\frac{1}{e}\cdot\log_{p}\\#({\mathcal{O}}/(s,t,q-1))^{3}=3\frac{n_{v}}{e}$.

###### Proof.

From Lemma (CI), the observations preceding it, and from Theorem (CI), we have

$\\#\operatorname{ker}(\operatorname{Hom}_{R_{v}^{\mathrm{st}}}(I/I^{2},E/{\mathcal{O}})\to\widehat{\operatorname{Der}}^{1}_{\mathcal{O}}(R_{v}^{\mathrm{st}},E/{\mathcal{O}}))=\\#\Lambda^{\mathrm{st}}/\widetilde{\Lambda}=\\#(s,t,q-1)^{2}/(t(q-1))$

In Corollary (CI) we computed
$\\#\operatorname{Hom}_{R_{v}^{\mathrm{st}}}(I/I^{2},E/{\mathcal{O}})=\\#{\mathcal{O}}/(t(q-1)(s,t,q-1))$.
Forming the quotient, the result follows from Theorem (CI). ∎

From
$\delta_{\lambda}(R_{v}^{\mathrm{st}})=D_{1,\lambda}(R_{v}^{\mathrm{st}})-c_{1,\lambda}(R_{v}^{\mathrm{st}})$
and Corollaries (CI) and (CI) we deduce.

######  Theorem (CI).

We have $\delta_{\lambda}(R_{v}^{{\mathrm{st}}})=2\frac{n_{v}}{e}$.

###  5.3 Unipotent deformations with a choice of Frobenius at trivial primes

In the following, ${\underline{s}}$ and ${\underline{t}}$ will denote
indeterminates that we shall specialize to $s$ and $t$, respectively, whenever
we pass to ${\mathcal{O}}$-algebras. Set $s_{1}^{\operatorname{\varphi-
uni}}=r_{9}^{\operatorname{\varphi-uni}}+r_{6}^{\operatorname{\varphi-uni}}$,
$s_{2}^{\operatorname{\varphi-uni}}=r_{8}^{\operatorname{\varphi-
uni}}-r_{7}^{\operatorname{\varphi-uni}}+r_{2}^{\operatorname{\varphi-uni}}$,
$s_{3}^{\operatorname{\varphi-uni}}=r_{5}^{\operatorname{\varphi-uni}}$,
$s_{4}^{\operatorname{\varphi-uni}}=r_{2}^{\operatorname{\varphi-
uni}}+ar_{3}^{\operatorname{\varphi-uni}}+r_{4}^{\operatorname{\varphi-
uni}}+ar_{6}^{\operatorname{\varphi-uni}}-br_{7}^{\operatorname{\varphi-
uni}}-r_{3}^{\operatorname{\varphi-uni}}$, and
$s_{4}^{\prime\,{\operatorname{\varphi-uni}}}=ar_{3}^{\operatorname{\varphi-
uni}}+r_{4}^{\operatorname{\varphi-uni}}+ar_{6}^{\operatorname{\varphi-
uni}}-br_{7}^{\operatorname{\varphi-uni}}-r_{3}^{\operatorname{\varphi-uni}}$.
Set also $\widetilde{\mathcal{I}}=(s_{1}^{\operatorname{\varphi-
uni}},s_{2}^{\operatorname{\varphi-uni}},s_{3}^{\operatorname{\varphi-
uni}},s_{4}^{\operatorname{\varphi-uni}})$ and
$\widetilde{\mathcal{I}}^{\prime}=(s_{1}^{\operatorname{\varphi-
uni}},s_{2}^{\operatorname{\varphi-uni}},s_{3}^{\operatorname{\varphi-
uni}},s_{4}^{\prime\,{\operatorname{\varphi-uni}}})$.

The next result summarizes some explicit computations done via Macaulay2.

######  Lemma (CI).

  1. 1.

The ring
$\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]/({\underline{q}},{\underline{s}},{\underline{t}},b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X,s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)$ is free over $\mathbf{Z}$ of rank $16$. The same holds if
we replace $s_{4}^{\operatorname{\varphi-uni}}$ by
$s_{4}^{\prime,{\operatorname{\varphi-uni}}}$. A basis is
$1,a,aX,aX\alpha,a\alpha,b,b\alpha,$
$X,X^{2},X^{2}\alpha,X\alpha,X\alpha^{2},X\alpha^{3},\alpha,\alpha^{2},\alpha^{3}$.
A basis of the socle of the ring modulo any prime is $X\alpha^{3}$.

  2. 2.

The ring
$\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]/(({\underline{q}},{\underline{s}},{\underline{t}},b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X)+{\mathcal{I}}^{\operatorname{\varphi-
uni}}_{\mathbf{Z}})$ is free over $\mathbf{Z}$ of rank $6$. A basis is
$1,a,b,bX,X,\alpha$. A basis of the socle of the ring modulo any prime is
$X\alpha$.

  3. 3.

Write $x_{1},\ldots,x_{7}$ for $a,b,c,X,\alpha,\beta,\gamma$. Then the ideal
in $\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}}]$ generated by
the $4\times 4$-minors of the Jacobian $(\partial
s_{i}^{\operatorname{\varphi-uni}}/\partial
x_{j})_{i=1,\ldots,4;j=1,\ldots,7}$ evaluated at
$(x_{1},\ldots,x_{7})=(0,{\underline{s}},0,0,0,{\underline{t}},0)$ is
$({\underline{s}}+{\underline{t}}){\underline{t}}^{2}({\underline{q}},{\underline{s}},{\underline{t}})$.
If one replaces $s_{4}^{\operatorname{\varphi-uni}}$ by
$s_{4}^{\prime,{\operatorname{\varphi-uni}}}$, the resulting ideal is
${\underline{s}}{\underline{t}}^{2}({\underline{q}},{\underline{s}},{\underline{t}})$.

######  Remark (CI).

We note that the number 16 in part 1 is optimal. After reducing the number of
variables by those relations that are linear, the
$s_{i}^{\operatorname{\varphi-uni}}$ are quadratic relations of a polynomial
ring over $\mathbf{Z}$ in $4$ variables. Now the intersection of 4 quadrics in
general position consists of $16$ points. Therefore dimension $16$ for the
coordinate ring of the corresponding scheme is optimal.

Let $s,t\in{\mathfrak{m}}$ with $t\neq 0$.

######  Corollary (CI).

  1. 1.

The ring
$\widetilde{R}={\mathcal{O}}[[a,b,c,X,\alpha,\beta,\gamma]]/(s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)$ is a complete intersection, flat over ${\mathcal{O}}$ and
of relative dimension $3$, and this also holds with
$s_{4}^{\operatorname{\varphi-uni}}$ replaced by
$s_{4}^{\prime,{\operatorname{\varphi-uni}}}$. One has a natural surjection
$\widetilde{R}\to R^{\operatorname{\varphi-uni}}_{v}$ induced from
$(s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)\subset(r_{j}^{\operatorname{\varphi-uni}},j=1,\ldots,9)$.

  2. 2.

Via the ring map $S={\mathcal{O}}[[y_{1},y_{2},y_{3}]]\to\widetilde{R}$ given
by $y_{1}\mapsto b-s-c,y_{2}\mapsto\beta-t-c,y_{3}\mapsto\gamma-X$, the rings
$\widetilde{R}$ and $R^{\operatorname{\varphi-uni}}_{v}$ are free $S$-modules
of rank $16$ and $6$, respectively (for either choice of $\widetilde{R}$).

  3. 3.

The augmentation $\widetilde{\lambda}\colon\widetilde{R}\to{\mathcal{O}}$
given by $a,c,X,\alpha,\gamma\mapsto 0$, $b\mapsto s$ and $\beta\mapsto t$
defines a formally smooth point of
$\operatorname{Spec}\widetilde{R}[\frac{1}{\varpi}]$, for at least one of the
two choices of $\widetilde{R}$ from 1, provided that
$t\in{\mathcal{O}}\setminus\\{0\\}$.

###### Proof.

The quotient $\widetilde{R}/(\varpi,b-s-c,\beta-t-c,\gamma-X)$ is isomorphic
to the ring from Lemma (CI).1 tensored with $k$ over $\mathbf{Z}$ – since the
latter is isomorphic to $k^{16}$ no completion is necessary. This implies that
$(\varpi,b-s-c,\beta-t-c,\gamma-X,s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)$ is a regular sequence in ${\mathcal{R}}$ with quotient
$k^{16}$. We deduce part 1 and the first half of part 2. The second half of
part 2 uses Lemma (CI).2 in an analogous way.

To prove part 3, observe that not both, $s$ and $s+t$ can be zero, since
otherwise $t=0$ which is ruled out. So we choose
$s_{4}^{\operatorname{\varphi-uni}}$ or $s_{4}^{\prime,{\operatorname{\varphi-
uni}}}$ accordingly. Then we evaluate the ideal in Lemma (CI).3 at the made
choice. This gives either the non-zero value $(s+t)t^{2}\gcd(t,st,q-1)$ or
$st^{2}\gcd(t,st,q-1)$ for a generator of the corresponding ideal over
${\mathcal{O}}$. This implies the stated formal smoothness. ∎

Our aim is to compute $D_{1,\lambda}(R_{v}^{\operatorname{\varphi-uni}})$ and
$c_{1,\lambda}(R_{v}^{\operatorname{\varphi-uni}})$. Instead, we shall compute
these invariants for the ring $R_{v}^{\operatorname{\varphi-
uni}}\otimes_{S}{\mathcal{O}}$, where $S$ is the ring from Corollary (CI) and
where the map $S\to{\mathcal{O}}$ is the augmentation $\widetilde{\lambda}$
composed with $S\to\widetilde{R}$. This is allowed due to Theorems (CI) and
(CI).777Our choices $S\to\widetilde{R}\to R_{v}^{\operatorname{\varphi-uni}}$
are almost certainly unrelated to any choices that arise from the Taylor-
Wiles-Kisin patching. It is probably not strictly necessary to perform this
base change. However it seems easier to work with Gorenstein and complete
intersection rings that are finite flat over ${\mathcal{O}}$. In particular,
this will allow us to (have Macaulay) compute structural constants of these
rings, namely their multiplication tables in a given ${\mathcal{O}}$-bases. In
the remainder of this subsection, we consider the rings

${\mathcal{O}}\longrightarrow\overline{R}=\widetilde{R}/(y_{1},y_{2},y_{3})\stackrel{{\scriptstyle\overline{\pi}}}{{\longrightarrow}}\overline{R}^{\operatorname{\varphi-
uni}}_{v}=R^{\operatorname{\varphi-uni}}_{v}/(y_{1},y_{2}.y_{3}),$

and we let $\overline{I}$ be the kernel of
$\overline{\pi}:\overline{R}\to\overline{R}^{\operatorname{\varphi-uni}}_{v}$.

We first explain the part that for us was the most difficult one, namely the
computation of $\overline{R}[\overline{I}]$. Let $(b_{i})_{i=1,\ldots,16}$ be
an ${\mathcal{O}}$-basis of $\overline{R}$ such that $(b_{i})_{i=7,\ldots,16}$
is a basis of the kernel of
$\overline{R}\to\overline{R}_{v}^{\operatorname{\varphi-uni}}$. Suppose
further that $b_{6}$ and $b_{16}$ are chosen, so that they reduce to a
generators of the socle of the finite Gorenstein rings
$\overline{R}_{v}^{\operatorname{\varphi-uni}}/(\varpi)$ and
$\overline{R}/(\varpi)$, respectively; this is always possible. Denote by
$(b_{i}^{*})_{i=1,\ldots,16}$ the dual basis. It follows from Proposition
(CI), that $b_{6}^{*}$ is a generator of
$\operatorname{Hom}_{\mathcal{O}}(\overline{R}_{v}^{\operatorname{\varphi-
uni}},{\mathcal{O}})$ as a free $\overline{R}_{v}^{\operatorname{\varphi-
uni}}$-module, and $b_{16}^{*}$ of
$\operatorname{Hom}_{\mathcal{O}}(\overline{R},{\mathcal{O}})$ as a free
$\overline{R}$-module. Denote by $\Theta$ the isomorphism
$\overline{R}\to\operatorname{Hom}_{\mathcal{O}}(\overline{R},{\mathcal{O}}),f\mapsto(b_{16}^{*}(f\cdot),g\mapsto
b_{16}^{*}(fg))$ and consider the chain of isomorphisms

$\displaystyle\overline{R}[\overline{I}]$
$\displaystyle\cong\operatorname{Hom}_{\overline{R}}(\overline{R}_{v}^{\operatorname{\varphi-
uni}},\overline{R})\cong\operatorname{Hom}_{\overline{R}}(\overline{R}_{v}^{\operatorname{\varphi-
uni}},\operatorname{Hom}_{\mathcal{O}}(\overline{R},{\mathcal{O}}))\cong\operatorname{Hom}_{\mathcal{O}}(\overline{R}_{v}^{\operatorname{\varphi-
uni}}\otimes_{\overline{R}}\overline{R},{\mathcal{O}})\cong\operatorname{Hom}_{\mathcal{O}}(\overline{R}_{v}^{\operatorname{\varphi-
uni}},{\mathcal{O}})$

from Lemma (CI). The generator $b_{6}^{*}$ on the right is successively mapped
to, first $h_{1}\otimes h_{2}\mapsto
b_{6}^{*}(h_{1}\cdot\overline{\pi}(h_{2}))$, second
$(h_{1}\mapsto(h_{2}\mapsto b_{6}^{*}(h_{1}\cdot\overline{\pi}(h_{2})))$,
third $(h_{1}\mapsto\Theta^{-1}(h_{2}\mapsto
b_{6}^{*}(h_{1}\cdot\overline{\pi}(h_{2})))$, lastly to

$\Theta^{-1}(h_{2}\mapsto
b_{6}^{*}(\overline{\pi}(h_{2})))=\Theta^{-1}(h_{2}\mapsto
b_{6}^{*}(h_{2}))=\Theta^{-1}\circ b_{6}^{*}.$

Now write $\Theta^{-1}\circ b_{6}^{*}=\sum_{i}\mu_{i}b_{i}$ with
$\mu_{i}\in{\mathcal{O}}$. By the definition of $\Theta$, this is equivalent
to $b_{6}^{*}(f)=b_{16}^{*}(\sum_{i}\mu_{i}b_{i}f)$ for all
$f\in\overline{R}$. Let $c_{ijk}\in{\mathcal{O}}$ be the structural constants
for multiplication in $\overline{R}$ over ${\mathcal{O}}$ with respect to the
basis $(b_{j})$, so that $b_{i}b_{j}=\sum_{k}c_{ijk}b_{k}$. Then substituting
for $f$ all basis elements of $\overline{R}$ over ${\mathcal{O}}$ gives

$b_{6}^{*}(b_{j})=b_{16}^{*}(\sum_{i}\mu_{i}b_{i}b_{j})=b_{16}^{*}(\sum_{i,k}\mu_{i}c_{ijk}b_{k})=\sum_{i}\mu_{i}c_{ij16}.$

Let $C$ be the matrix $(c_{ij16})_{i,j=1,\ldots,16}$. Then the row vector
$(\mu_{i})$ is given as the product $e_{6}C^{-1}$ for $e_{6}$ the $6$-th
standard basis vector of the column vector space ${\mathcal{O}}^{16}$. To
obtain $C$, consider the following commutative diagram

$\xymatrix@C+3pc{\frac{\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]}{(b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X,s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)}\ar[r]&\overline{R}[\frac{1}{\varpi}]\\\
\ar[u]\ar[d]\frac{\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]}{(b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X,s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)}\ar[r]^{{\underline{s}}\mapsto s,{\underline{t}}\mapsto
t,{\underline{q}}\mapsto
q-1}\ar[u]\ar[d]\overline{R}=\frac{{\mathcal{O}}[[a,b,c,X,\alpha,\beta,\gamma]]}{(b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X,s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)}\\\
\frac{\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]}{(p,{\underline{q}},{\underline{s}},{\underline{t}},b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X,s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)}\ar[r]\overline{R}/(\varpi)\\\ }$

Applying Nakayama’s Lemma to the right column, we see that the basis in Lemma
(CI) is an ${\mathcal{O}}$-basis of $\overline{R}$, and thus an $E$-basis of
$\overline{R}[\frac{1}{\varpi}]$. The analogous diagram holds for
$\overline{R}^{\operatorname{\varphi-uni}}_{v}$ in place of $\overline{R}$.
Macaulay computations give us the following lemma:

######  Lemma (CI).

  1. 1.

The ring
$R_{1}=\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]/(b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X,s_{i}^{\operatorname{\varphi-
uni}},i=1,\ldots,4)$ is free over
$\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$ of rank $16$
with the same basis as that given in Lemma (CI).1. The same holds if we
replace $s_{4}^{\operatorname{\varphi-uni}}$ by
$s_{4}^{\prime,{\operatorname{\varphi-uni}}}$.

  2. 2.

The ring
$R_{2}=\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}},,a,b,c,X,\alpha,\beta,\gamma]/((b-{\underline{s}}-c,\beta-{\underline{t}}-c,\gamma-X)+{\mathcal{I}}^{\operatorname{\varphi-
uni}}_{\mathbf{Z}})$ is free over
$\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$ of rank $6$ with
the same basis as that given in Lemma (CI).2.

  3. 3.

The kernel of the surjective ring homomorphism $R_{1}\to R_{2}$ is free over
$\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$ of rank $10$.

Thus we can compute $C$ as a matrix with entries in
$\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$, i.e., before
specialization. For this we computed new basis elements $b_{7},\ldots,b_{16}$
that span $\operatorname{ker}(R_{1}\to R_{2})$. To our surprise, we found
$\det C=1$, and inverting $C$ posed no problem. This allowed us to compute the
tuples of $\mu_{i}$ and then the $\overline{R}$-generator
$\Theta^{-1}(b_{6}^{*})$ of $\overline{R}[\overline{I}]$. Under our
augmentation, Macaulay evaluated it to
$({\underline{s}}+{\underline{t}}){\underline{t}}$ in
$\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$. This shows:

######  Corollary (CI).

$\overline{\lambda}(\overline{R}[\overline{I}])=(s+t)t\subset{\mathcal{O}}$,
or $\overline{\lambda}(\overline{R}[\overline{I}])=st\subset{\mathcal{O}}$ if
$s_{4}^{\operatorname{\varphi-uni}}$ is replaced by
$s_{4}^{\prime,{\operatorname{\varphi-uni}}}$.

The next steps are the computation of
$\widetilde{\lambda}(\operatorname{Fitt}_{0}^{\widetilde{R}}(I))$ and of
$\operatorname{Hom}_{R_{v}^{\operatorname{\varphi-
uni}}}(I/I^{2},E/{\mathcal{O}})$. For this we proceed essentially as in the
Steinberg case, cf. Corollaries (CI) and (CI), except that we rely on
Macaulay. Namely, we compute the first two steps of a resolution of
${\mathcal{I}}_{\mathbf{Z}}^{\operatorname{\varphi-uni}}$, considered as an
ideal of
${\mathcal{R}}_{\mathbf{Z}}[{\underline{s}},{\underline{t}}]=\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]$.
This results in a right exact sequence

${\mathcal{R}}_{\mathbf{Z}}[{\underline{s}},{\underline{t}}]^{26}\stackrel{{\scriptstyle
A}}{{\longrightarrow}}{\mathcal{R}}_{\mathbf{Z}}[{\underline{s}},{\underline{t}}]^{9}\stackrel{{\scriptstyle}}{{\longrightarrow}}{\mathcal{I}}_{\mathbf{Z}}^{\operatorname{\varphi-
uni}}\longrightarrow 0,$

for some matrix $A$ in $M_{9\times
26}({\mathcal{R}}_{\mathbf{Z}}[{\underline{s}},{\underline{t}}])$ (with rather
simple entries). We tensor the sequence over
${\mathcal{R}}_{\mathbf{Z}}[{\underline{q}},{\underline{s}}]$ with
$R_{3}={\mathcal{R}}_{\mathbf{Z}}[{\underline{q}},{\underline{s}}]/\widetilde{\mathcal{I}}$.
Now observe that over $R_{3}$, the ideal
$I_{3}={\mathcal{I}}_{\mathbf{Z}}^{\operatorname{\varphi-
uni}}\otimes_{{\mathcal{R}}_{\mathbf{Z}}[{\underline{q}},{\underline{s}}]}R_{3}$
is generated by the elements $r_{1}^{\operatorname{\varphi-
uni}},r_{2}^{\operatorname{\varphi-uni}},r_{3}^{\operatorname{\varphi-
uni}},r_{6}^{\operatorname{\varphi-uni}},r_{7}^{\operatorname{\varphi-uni}}$;
because these $5$ elements together with our generators of
$\widetilde{\mathcal{I}}$ generate
${\mathcal{I}}_{\mathbf{Z}}^{\operatorname{\varphi-uni}}$. So we extract a
matrix $A^{\prime}\in M_{5\times 26}(R_{3})$, from the specialization of $A$
under ${\mathcal{R}}_{\mathbf{Z}}[{\underline{s}},{\underline{t}}]\to R_{3}$,
that gives a short exact sequence

$R_{3}^{26}\stackrel{{\scriptstyle
A^{\prime}}}{{\longrightarrow}}R_{3}^{5}\stackrel{{\scriptstyle}}{{\longrightarrow}}I_{3}\longrightarrow
0,$

Specializing under
$R_{3}\to\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}}]$ via
$a,c,\alpha,\gamma,X\mapsto 0$, $b\mapsto{\underline{s}}$,
$\beta\mapsto{\underline{t}}$, and computing the ideal of the resulting
$5\times 5$-minors gives the ideal
$({\underline{s}},{\underline{t}},{\underline{q}})^{3}\cdot({\underline{s}}+{\underline{t}}){\underline{t}}$.
If we work with $\widetilde{\mathcal{I}}^{\prime}$ in place of
$\widetilde{\mathcal{I}}$, the answer is
$({\underline{s}},{\underline{t}},{\underline{q}})^{3}\cdot{\underline{s}}{\underline{t}}$.
Continuing with the natural map
$\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}}]\to{\mathcal{O}}$,
and observing the computations in Corollaries (CI) and (CI), we find:

######  Corollary (CI).

We have
$\\#{\mathcal{O}}/\widetilde{\lambda}(\operatorname{Fitt}_{0}^{\widetilde{R}}(I))=\\#\operatorname{Hom}_{R_{v}^{\operatorname{\varphi-
uni}}}(I/I^{2},E/{\mathcal{O}})$ and the number is equal to

$\\#{\mathcal{O}}/((s+t)t(s,t,q-1)^{3}),$

or to $\\#{\mathcal{O}}/(st(s,t,q-1)^{3})$, if we work with
$\widetilde{\mathcal{I}}^{\prime}$ in place of $\widetilde{\mathcal{I}}$.

Finally, we had Macaulay work out the analog of Lemma (CI) to determine the
lattice $\Lambda^{\operatorname{\varphi-uni}}$, which, as to be expected, is
rather easy. Following the proof of Corollary (CI), one finds.

######  Corollary (CI).

We have

$\\#\operatorname{ker}(\operatorname{Hom}_{R_{v}^{\operatorname{\varphi-
uni}}}(I/I^{2},E/{\mathcal{O}})\to\widehat{\operatorname{Der}}^{1}_{\mathcal{O}}(R_{v}^{\operatorname{\varphi-
uni}},E/{\mathcal{O}}))=\\#\Lambda^{{\operatorname{\varphi-
uni}}}/\widetilde{\Lambda}=\\#(s,t,q-1)^{3}/((s+t)t)$

and, if we work with $\widetilde{\mathcal{I}}^{\prime}$ in place of
$\widetilde{\mathcal{I}}$, the cardinality is $\\#(s,t,q-1)^{3}/(st)$.

As in the Steinberg case, the following result is now an immediate
consequence. It is independent of whether we use $\widetilde{\mathcal{I}}$ or
$\widetilde{\mathcal{I}}^{\prime}$.

######  Theorem (CI).

Let $e$ be the ramification index of $E$ over $\mathbf{Q}_{l}$. Then we have

  1. 1.

$D_{1,\lambda}(R_{v}^{{\operatorname{\varphi-uni}}})=6\frac{n_{v}}{e}$.

  2. 2.

$c_{1,\lambda}(R_{v}^{{\operatorname{\varphi-uni}}})=3\frac{n_{v}}{e}$.

  3. 3.

$\delta_{\lambda}(R_{v}^{{\operatorname{\varphi-uni}}})=3\frac{n_{v}}{e}$.

###  5.4 Unipotent deformations

This case we handled in basically the same way as the previous one. Again we
made use of Macaulay to compute various intermediate steps. This was more
challenging, since we did not find a good complete intersection that would
surject onto the Gorenstein ring that we were interested in over $\mathbf{Z}$,
but only over $\mathbf{Z}[\frac{1}{2}]$, and we could not apply certain
Macaulay functionalities directly. We only indicate outcomes of some
intermediate steps, but give no further details:

Set
$s_{1}^{\mathrm{uni}}=-r_{1}^{\mathrm{uni}}+2r_{2}^{\mathrm{uni}}+r_{4}^{\mathrm{uni}}-2r_{5}^{\mathrm{uni}}$,
$s_{2}^{\mathrm{uni}}=r_{7}^{\mathrm{uni}}-r_{1}^{\mathrm{uni}}$,
$s_{3}^{\mathrm{uni}}=r_{8}^{\mathrm{uni}}-r_{1}^{\mathrm{uni}}$,
$s_{4}^{\mathrm{uni}}=r_{9}^{\mathrm{uni}}-r_{1}^{\mathrm{uni}}$ and
$\widetilde{\mathcal{I}}=(s_{1}^{\mathrm{uni}},s_{2}^{\mathrm{uni}},s_{3}^{\mathrm{uni}},s_{4}^{\mathrm{uni}})$.

######  Lemma (CI).

  1. 1.

The ring
$\mathbf{Z}[\frac{1}{2}][{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]/({\underline{q}},{\underline{s}},{\underline{t}},b-{\underline{s}}-\beta+{\underline{t}},a+X-\gamma,b-{\underline{s}}-c,s_{i}^{\mathrm{uni}},i=1,\ldots,4)$
is free over $\mathbf{Z}[\frac{1}{2}]$ of rank $14$. A basis is
$1,a,a\alpha,b,bX,b\alpha,X,X^{2},X\alpha,\alpha,\alpha^{2},\alpha^{3}$. A
basis of the socle of the ring modulo any prime is
$4\alpha^{3}+16a^{2}+54ab-30X\alpha+133b\alpha-19\alpha^{2}+111X$.

  2. 2.

The ring
$\mathbf{Z}[\frac{1}{2}][{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]/(({\underline{q}},{\underline{s}},{\underline{t}},b-{\underline{s}}-\beta+{\underline{t}},a+X-\gamma,b-{\underline{s}}-c)+{\mathcal{I}}^{\mathrm{uni}}_{\mathbf{Z}})$
is free over $\mathbf{Z}[\frac{1}{2}]$ of rank $5$. A basis is
$1,a,b,X,\alpha$. A basis of the socle of the ring modulo any prime is $X$.

  3. 3.

Write $x_{1},\ldots,x_{7}$ for $a,b,c,X,\alpha,\beta,\gamma$. Then the ideal
in $\mathbf{Z}[{\underline{q}},{\underline{s}},{\underline{t}}]$ generated by
the $4\times 4$-minors of the Jacobian $(\partial
s_{i}^{\mathrm{uni}}/\partial x_{j})_{i=1,\ldots,4;j=1,\ldots,7}$ evaluated at
$(x_{1},\ldots,x_{7})=(0,{\underline{s}},0,0,0,{\underline{t}},0)$ is
$2{\underline{q}}{\underline{t}}({\underline{q}},{\underline{s}},{\underline{t}})$.

######  Remark (CI).

The optimal rank over $\mathbf{Z}[\frac{1}{2}]$ of a complete intersection
cover of the Gorenstein ring we are interested in would be $8$; cf. Remark
(CI). We could not find such a ring that would make our computations work,
uniformly for all maximal ideals in
$\operatorname{Spec}\mathbf{Z}[\frac{1}{2}]$.

Let $s,t\in{\mathfrak{m}}$ with $t\neq 0$.

######  Corollary (CI).

  1. 1.

The ring
$\widetilde{R}={\mathcal{O}}[[a,b,c,X,\alpha,\beta,\gamma]]/(s_{i}^{\mathrm{uni}},i=1,\ldots,4)$
is a complete intersection, flat over ${\mathcal{O}}$ and of relative
dimension $3$. One has a natural surjection $\widetilde{R}\to
R^{\mathrm{uni}}_{v}$ induced from
$(s_{i}^{\mathrm{uni}},i=1,\ldots,4)\subset(r_{j}^{\mathrm{uni}},j=1,\ldots,9)$.

  2. 2.

Via the ring map $S={\mathcal{O}}[[y_{1},y_{2},y_{3}]]\to\widetilde{R}$ given
by $y_{1}\mapsto b-{\underline{s}}-\beta+{\underline{t}}$, $y_{2}\mapsto
a+X-\gamma$, $y_{3}\mapsto b-{\underline{s}}-c$, the rings $\widetilde{R}$ and
$R^{\mathrm{uni}}_{v}$ are free $S$-modules of rank $12$ and $5$,
respectively.

  3. 3.

The augmentation $\widetilde{\lambda}\colon\widetilde{R}\to{\mathcal{O}}$
given by $a,c,X,\alpha,\gamma\mapsto 0$, $b\mapsto s$ and $\beta\mapsto t$
defines a formally smooth point of
$\operatorname{Spec}\widetilde{R}[\frac{1}{\varpi}]$.

######  Lemma (CI).

  1. 1.

The ring
$R_{1}=\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}},a,b,c,X,\alpha,\beta,\gamma]/(b-{\underline{s}}-\beta+{\underline{t}},a+X-\gamma,b-{\underline{s}}-c,s_{i}^{\mathrm{uni}},i=1,\ldots,4)$
is free over $\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$ of
rank $12$ with the same basis as that given in Lemma (CI).1.

  2. 2.

The ring
$R_{2}=\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}},,a,b,c,X,\alpha,\beta,\gamma]/((b-{\underline{s}}-\beta+{\underline{t}},a+X-\gamma,b-{\underline{s}}-c)+{\mathcal{I}}^{\mathrm{uni}}_{\mathbf{Z}})$
is free over $\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$ of
rank $5$ with the same basis as that given in Lemma (CI).2.

  3. 3.

The kernel of the surjective ring homomorphism $R_{1}\to R_{2}$ is free over
$\mathbf{Q}[{\underline{q}},{\underline{s}},{\underline{t}}]$ of rank $7$.

######  Proposition (CI).

We have

  1. 1.

$\widetilde{\lambda}(\widetilde{R}[\widetilde{I}])=(q-1)$.

  2. 2.

$\\#{\mathcal{O}}/\widetilde{\lambda}(\operatorname{Fitt}_{0}^{\widetilde{R}}(I))=\\#\operatorname{Hom}_{R_{v}^{\mathrm{uni}}}(I/I^{2},E/{\mathcal{O}})=\\#{\mathcal{O}}/((q-1)\gcd(s,t,q-1))$.

  3. 3.

$\\#\operatorname{ker}(\operatorname{Hom}_{R_{v}^{\mathrm{uni}}}(I/I^{2},E/{\mathcal{O}})\to\widehat{\operatorname{Der}}^{1}_{\mathcal{O}}(R_{v}^{\mathrm{uni}},E/{\mathcal{O}}))=\\#\Lambda^{{\mathrm{uni}}}/\widetilde{\Lambda}=\\#(\gcd(s,t,q-1)/(q-1))$.

######  Theorem (CI).

Let $e$ be the ramification index of $E$ over $\mathbf{Q}_{l}$. We have

  1. 1.

$D_{1,\lambda}(R_{v}^{{}^{\mathrm{uni}}})=2\frac{n_{v}}{e}$.

  2. 2.

$c_{1,\lambda}(R_{v}^{{}^{\mathrm{uni}}})=\frac{n_{v}}{e}$.

  3. 3.

$\delta_{\lambda}(R_{v}^{{}^{\mathrm{uni}}})=\frac{n_{v}}{e}$.

###  5.5 Recollections about Cohen–Macaulay and Gorenstein rings

Let $R$ be a Noetherian local ring with maximal ideal ${\mathfrak{m}}$ and
residue field $k$. In this subsection we want to briefly recall some results
on Cohen–Macaulay and Gorenstein rings that occur repeatedly in our arguments
or, more importantly, in our computations. We also present a result on
generating sets of dual modules that was useful in our computations. For basic
notions such as $\operatorname{depth}$, $R$-sequence, Cohen–Macaulay and
Gorenstein rings, we refer to [BH93, §§ 1.2, 2.1, 3.1],

######  Definition (CI).

The socle of $R$ is defined as
$\operatorname{{\mathrm{socle}}}R=R[{\mathfrak{m}}]=\\{x\in
R\mid{\mathfrak{m}}x=0\\}$.

######  Proposition (CI) ([Mat80, Thm. 17.4 and p. 136], [BH93, 2.1.3, 2.1.8,
3.1.19]).

  1. 1.

Any local Artin ring $R$ is Cohen–Macaulay. It is Gorenstein if in addition it
satisfies $\operatorname{{\mathrm{socle}}}R\cong k$.

  2. 2.

If $R$ is Noetherian local, and if $(x_{1}\ldots,x_{n})$ is an $R$-sequence in
${\mathfrak{m}}$, then $R$ is Cohen–Macaulay or Gorenstein, respectively, if
and only if $R/(x_{1},\ldots,x_{n})$ has this property. In particular, if
$R/(x_{1}\ldots,x_{n})$ is Artinian, then $R$ is Cohen–Macaulay, and if
moreover $\operatorname{{\mathrm{socle}}}R/(x_{1}\ldots,x_{n})\cong k$, then
$R$ is Gorenstein.

  3. 3.

If $R$ is a local Cohen–Macaulay ring, then any system of parameters is a
regular $R$-sequence.

Let now $(A,{\mathfrak{m}})$ be a local Artin ring. In this case
$I\cap\operatorname{{\mathrm{socle}}}A\supsetneq 0$ for any non-zero ideal $I$
of $A$: To see this consider $n\in\mathbf{Z}_{\geq 0}$ such that
${\mathfrak{m}}^{n-1}I\neq 0$ and ${\mathfrak{m}}^{n}I=0$. Then
${\mathfrak{m}}^{n-1}I\subset I\cap\operatorname{{\mathrm{socle}}}A$.

######  Proposition (CI).

Let $(\bar{\psi}_{i})_{i\in B}$ be a finite tuple in
$\operatorname{Hom}_{k}(A,k)$, such that $(\bar{\psi}_{i})_{i\in
B}\colon\operatorname{{\mathrm{socle}}}(A)\to k^{B}$ is injective. Then
$(\bar{\psi}_{i})_{i\in B}$ is a set of generators of
$\operatorname{Hom}_{k}(A,k)$ as an $A$-module. In particular, if $A$ is
Gorenstein and if $B=\\{0\\}$ is a singleton, then $\bar{\psi}_{0}$ is an
$A$-basis of $\operatorname{Hom}_{k}(A,k)$.

The proof relies on the following result from linear algebra.

######  Lemma (CI).

Let $V$ be a finite-dimensional $k$-vector space. Let $(V_{j})_{j\in J}$ be a
finite tuple of sub vector spaces such that $\bigcap_{j\in J}V_{j}=0$. Then
for any $\bar{\psi}\in\operatorname{Hom}_{k}(V,k)$, there exist
$\bar{\psi}_{j}\in\operatorname{Hom}_{k}(V,k)$ with
$V_{j}\subset\operatorname{ker}\bar{\psi}_{j}$ for $j\in J$, such that
$\bar{\psi}=\sum_{j\in J}\bar{\psi}_{j}$.

###### Proof.

We may assume $J=\\{1,\ldots,t\\}$ for some $t\in\mathbf{Z}_{\geq 1}$. We
induct over $t$, noting that the case $t=1$ is trivial, since then $V_{1}=0$.
For the induction step suppose $t\geq 2$, and let $W=\bigcap_{j=2}^{t}V_{j}$.
Then $V_{1}\cap W=0$, and so we can choose a basis for $W$ and one for $V_{1}$
and then extend the one for $V_{1}$ to a complementary basis to that of $W$.
Then one can find $\bar{\psi}_{1}$ and $\bar{\phi}$ in
$\operatorname{Hom}_{k}(V,k)$ such that
$\operatorname{ker}\bar{\psi}_{1}\supseteq V_{1}$ and
$\operatorname{ker}\bar{\phi}\supseteq W$, and
$\bar{\psi}=\bar{\psi}_{1}+\bar{\phi}$. Now apply the induction hypothesis to
$V/V_{1}$ and $(V_{j}/V_{1})_{j=2,\ldots,t}$ and $\bar{\psi}_{1}$ considered
as a map in $\operatorname{Hom}_{k}(V/V_{1},k)$. ∎

###### Proof of Lemma (CI).

Let $N=\sum_{i\in B}A\bar{\psi}_{i}$. We shall show that
$\operatorname{Hom}_{k}(A,k)\subseteq
N+{\mathfrak{m}}\operatorname{Hom}_{k}(A,k)$. Then the lemma will follow from
Nakayama’s Lemma.

Let $\bar{\psi}$ be in $\operatorname{Hom}_{k}(A,k)$. By our hypothesis, there
is a $k$-linear map $\alpha\colon k^{B}\to k$ such that the restriction
$\bar{\psi}|_{\operatorname{{\mathrm{socle}}}A}$ agree with
$\alpha\circ(\bar{\psi}_{i})_{i\in B}$. In other words, the map

$\bar{\phi}:=\bar{\psi}-\sum_{i\in B}\alpha(\bar{e}_{i}))\bar{\psi}_{i}$

vanishes on $\operatorname{{\mathrm{socle}}}A$.

Next let $x_{1},\ldots,x_{t}$ be a set of $A$-module generators of
${\mathfrak{m}}$, and let $V_{i}=\\{r\in A\mid x_{i}r=0\\}$. Then

$\operatorname{{\mathrm{socle}}}A=\bigcap_{i=1,\ldots,t}V_{i}$

By Lemma (CI) applied to $A/\operatorname{{\mathrm{socle}}}A$, there exist
$\bar{\phi}_{i}\in\operatorname{Hom}_{k}(A,k)$ with
$\operatorname{ker}\bar{\phi}_{i}\supset V_{i}$, and $\bar{\phi}=\sum_{i\in
B}\bar{\phi}_{i}$.

Now consider the short exact sequence $0\to V_{i}\to A\stackrel{{\scriptstyle
x_{i}\cdot}}{{\to}}x_{i}A\to 0$. Then the $\bar{\psi}_{i}$ induce $k$-linear
maps $x_{i}A\to k$. The latter can be extended to $k$-linear maps
$\bar{\xi}_{i}\colon A\to k$ under $x_{i}A\subset A$. In other words
$\bar{\phi}_{i}=x_{i}\bar{\xi}_{i}$, and this gives

$\bar{\psi}-\sum_{i\in
B}\bar{\psi}(e_{i})\bar{\psi}_{i}=\sum_{j=1,\ldots,t}x_{j}\bar{\xi}_{j},$

proving the claim from the first line, and hence the lemma. ∎

Let now $(R,{\mathfrak{m}})$ be a local complete Noetherian Cohen–Macaulay
ring that is an ${\mathcal{O}}$-algebra, and suppose that
$\mathbf{r}=(\varpi,r_{1},\ldots,r_{n})$ is a system of parameters. Let
$(\bar{e}_{i})_{i\in B}$ be a $k$-basis of $A=R/\mathbf{r}R$, let
$(e_{i})_{i\in B}$ be a tuple of preimages in $R$, and consider the
${\mathcal{O}}$-algebra homomorphism $S={\mathcal{O}}[[x_{1},\ldots,x_{n}]]\to
R,x_{i}\mapsto e_{i}$.

######  Lemma (CI).

As an $S$-module, $R$ is free with basis $(e_{i})_{i=1,\ldots,n}$.

###### Proof.

The ring $S$ is regular local and thus of finite global dimension. Hence $R$
has finite projective dimension over $S$. By Nakayama’s Lemma $R$ is also
finitely generated as an $S$-module, because $\dim_{k}R/\mathbf{r}R$ is finite
for the system of parameters $\mathbf{r}$. The sequence $\mathbf{r}$ is in
fact regular as $R$ is Cohen–Macaulay. It follows that
$\operatorname{depth}_{S}R=1+n=\dim S$, so that by the Auslander-Buchsbaum
theorem $R$ is a finite free $S$-module. One finds that $\psi\colon S^{B}\to
R,(s_{i})_{i\in B}\mapsto\sum_{i}s_{i}e_{i}$ is an isomorphism, because $S$ is
local and $\psi\operatorname{mod}{\mathbf{r}}$ is bijective. ∎

The following result gives a generating set (or a basis) over $R$ of the free
$S$-module $\operatorname{Hom}_{S}(R,S)$.

######  Proposition (CI).

Let $\psi_{i}\in\operatorname{Hom}_{S}(R,S)$, $i\in B$, be a tuple of elements
such that the elements $\bar{\psi}_{i}:=\psi_{i}\otimes_{R}A\colon A\to k$
satisfy the condition of Lemma (CI). Then $(\psi_{i})_{i\in B}$ is a set of
$R$-module generators of $\operatorname{Hom}_{S}(R,S)$. If moreover $R$ is
Gorenstein and $B=\\{0\\}$ is a singleton, then $\psi_{0}$ is an $R$-basis of
$\operatorname{Hom}_{S}(R,S)$.

###### Proof.

This is immediate from Nakayama’s lemma and Lemma (CI). ∎

##  6 Wiles defect of Hecke algebras and global deformation rings

In this section, we’ll describe how the commutative algebra results from
Sections 4 and 5 can be applied to Galois deformation rings, in the setup of
Taylor–Wiles–Kisin patching. For ease of exposition we’ll restrict our
attention to the case of two dimensional Galois representations over a totally
real number field, and moreover ones that are modular of parallel weight $2$,
as all of the computations and applications we give in this paper will be
concerned with this case. This is not a fundamental limitation on our methods,
and indeed everything we describe in this section will generalize
automatically to any “$\ell_{0}=0$” patching setup (such as the definite
unitary groups considered by [CHT08] and others).

Let $F$ be a totally real number field. Fix a finite set $\Sigma$ of finite
places of $F$. For each $v\in\Sigma$, fix a
$\tau_{v}\in\\{\operatorname{min},{\mathrm{st}},{\mathrm{uni}},{\operatorname{\varphi-
uni}},\square\\}$, let $\tau=(\tau_{v})_{v\in\Sigma}$, and for
$\sigma\in\\{\operatorname{min},{\mathrm{st}},{\mathrm{uni}},{\operatorname{\varphi-
uni}},\square\\}$ write $\Sigma^{\sigma}=\\{v\in\Sigma|\tau_{v}=\sigma\\}$.

Pick a prime $p>2$ which is not ramified in $F$ and is not divisible by any
prime in $\Sigma$. Let $E/\mathbf{Q}_{p}$ be a finite extension with ring of
integers ${\mathcal{O}}$, uniformizer $\varpi$ and residue field $k$. Let
$\varepsilon_{p}:G_{F}\to{\mathcal{O}}^{\times}$ be the cyclotomic character.
Let $\rho:G_{F}\to\mathrm{GL}_{2}({\mathcal{O}})$ be a Galois representation
for which:

  * •

$\rho$ corresponds to a Hilbert modular form of parallel weight 2;

  * •

$\det\rho=\varepsilon_{p}$;

  * •

For every $v\not\in\Sigma$ and $v\nmid p$, $\rho$ is unramified at $v$;

  * •

For every $v|p$, $\overline{\rho}|_{G_{v}}$ is finite flat;

  * •

If $v\in\Sigma^{\operatorname{min}}$, then either
$|{\mathcal{O}}/v|\not\equiv-1\pmod{\ell}$, $\overline{\rho}|_{I_{v}}$ is
irreducible or $\overline{\rho}|_{G_{v}}$ is absolutely reducible;

  * •

If
$v\in\Sigma^{{\mathrm{st}}}\cup\Sigma^{{\mathrm{uni}}}\cup\Sigma^{{\operatorname{\varphi-
uni}}}$, then $\rho|_{G_{v}}$ is Steinberg (i.e.
$\rho|_{G_{v}}\sim\begin{pmatrix}\chi\,\varepsilon_{p}&*\\\
0&\chi\end{pmatrix}$ for some unramified quadratic character);

  * •

The residual representation $\overline{\rho}:G_{F}\to\mathrm{GL}_{2}(k)$ is
absolutely irreducible, and moreover that it satisfies the _Taylor–Wiles
conditions:_ $\overline{\rho}|_{G_{F(\zeta_{p})}}$ is still absolutely
irreducible; and in the case when $p=5$, $\sqrt{5}\in F$ and the projective
image
$\operatorname{proj}\overline{\rho}:G_{F}\to\mathrm{PGL}_{2}({\overline{\mathbf{F}}}_{5})$
is isomorphic to $\mathrm{PGL}_{2}({\mathbb{F}}_{5})$, that
$\ker\operatorname{proj}\overline{\rho}\not\subseteq G_{F(\zeta_{5})}$.

Let $Q=\Sigma^{{\mathrm{st}}}$, and let $D$ be a quaternion algebra over $F$
ramified at the primes in $Q$ (and no other finite primes) and at either all,
or all but one infinite place of $F$ (depending on whether
$|Q|+[F:\mathbf{Q}]$ is even or odd). Define a compact open subgroup
$K^{\tau}=\prod_{v}K_{v}^{\tau}\subset(D\otimes\mathbf{A}_{F,f})^{\times}$ by:

  * •

$K_{v}^{\tau}=\mathrm{GL}_{2}({\mathcal{O}}_{F,v})$ if $v\not\in\Sigma$;

  * •

$K_{v}^{\tau}$ is a maximal compact subgroup of $(D\otimes F_{v})^{\times}$ if
$v\in\Sigma^{{\mathrm{st}}}=Q$;

  * •

$K_{v}^{\tau}=U_{0}(v)$ if
$v\in\Sigma^{{\mathrm{uni}}}\cup\Sigma^{{\operatorname{\varphi-uni}}}$;

  * •

$K_{v}^{\tau}=U_{0}(v^{a_{v}})$ if $v\in\Sigma^{\operatorname{min}}$, where
$a_{v}$ is the Artin conductor of $\overline{\rho}|_{G_{v}}$;

  * •

$K_{v}^{\tau}=U_{0}(v^{a_{v}+2})$ if $v\in\Sigma^{\square}$.

For convenience, we will simply write $K=K^{\tau}$ and $K_{v}=K_{v}^{\tau}$.

When $D$ is ramified at all but one infinite places (resp. all infinite
places) let $X_{K}$ be the Shimura curve (resp. Shimura set) associated to
$K$. Let $\mathbf{T}^{D}(K)$ be the Hecke algebra acting on
$H^{1}(X_{K},{\mathcal{O}})$ in the Shimura curve case and on
$H^{0}(X_{K},{\mathcal{O}})$ in the Shimura set case, generated (as an
${\mathcal{O}}$-algebra) by the Hecke operators $T_{v}$ and $S_{v}$ for all
finite primes $v\not\in\Sigma$, and let
${\overline{\mathbf{T}}}^{D}(K)=\mathbf{T}^{D}(K)[U_{v}|v\in\Sigma^{{\operatorname{\varphi-
uni}}}]$. Note that $\mathbf{T}^{D}(K)$ and ${\overline{\mathbf{T}}}^{D}(K)$
are finite ${\mathcal{O}}$-algebras.

Let
$\mathbf{T}^{D}(K)^{\varepsilon}=\mathbf{T}^{D}(K)/\left(S_{v}-\varepsilon_{p}(\operatorname{Frob}_{v})\middle|v\not\in\Sigma\right)$
and
${\overline{\mathbf{T}}}^{D}(K)^{\varepsilon}={\overline{\mathbf{T}}}^{D}(K)/\left(S_{v}-\varepsilon_{p}(\operatorname{Frob}_{v})\middle|v\not\in\Sigma\right)$
be the fixed determinant Hecke algebras.

The assumption that $\rho$ corresponds to a Hilbert modular form of parallel
weight $2$ gives the following:

######  Proposition (CI).

There is an augmentation
$\lambda:{\overline{\mathbf{T}}}^{D}(K)^{\varepsilon}\twoheadrightarrow{\mathcal{O}}$
with the property that for any $v\not\in\Sigma\cup\Sigma_{p}$,
$\rho(\operatorname{Frob}_{v})$ has characteristic polynomial
$x^{2}-\lambda(T_{v})x+\lambda(S_{v})$. Moreover,
$\Phi_{\lambda}({\overline{\mathbf{T}}}^{D}(K)^{\varepsilon})$ is finite.

Let
${\mathfrak{m}}=\lambda^{-1}(\varpi{\mathcal{O}})\subseteq{\overline{\mathbf{T}}}^{D}(K)^{\varepsilon}$
be the maximal ideal of ${\overline{\mathbf{T}}}^{D}(K)^{\varepsilon}$
corresponding to $\overline{\rho}$. By slight abuse of notation, also write
${\mathfrak{m}}={\mathfrak{m}}\cap\mathbf{T}^{D}(K)$ for the maximal ideal of
$\mathbf{T}^{D}(K)$ corresponding to $\overline{\rho}$.

Write $\mathbf{T}^{\tau}=\mathbf{T}^{D}(K)^{\varepsilon}_{{\mathfrak{m}}}$ and
${\overline{\mathbf{T}}}^{\tau}={\overline{\mathbf{T}}}^{D}(K)^{\varepsilon}_{{\mathfrak{m}}}$
for the localizations at ${\mathfrak{m}}$ (and note that we are suppressing
$\varepsilon$ from our notation).

Note that any $x:{\overline{\mathbf{T}}}^{\tau}\to{\overline{\mathbf{Q}}_{p}}$
corresponds to a Galois representation
$\rho_{x}:G_{F}\to\mathrm{GL}_{2}({\overline{\mathbf{Q}}_{p}})$ lifting
$\overline{\rho}$ with $\det\rho_{x}=\varepsilon_{p}=\det\rho$ and
$\operatorname{tr}\rho_{x}(\operatorname{Frob}_{v})=x(T_{v})$ for all
$v\not\in\Sigma$ (so that $\rho=\rho_{\lambda}$).

Define $H^{\tau}=H^{1}(X_{K},{\mathcal{O}})^{*}$ if $D$ is indefinite and
$H^{\tau}=H^{0}(X_{K},{\mathcal{O}})^{*}$ if $D$ is definite (where for any
${\mathcal{O}}$-module $M$,
$M^{*}=\operatorname{Hom}_{{\mathcal{O}}}(M,{\mathcal{O}})$), viewed as a
${\overline{\mathbf{T}}}^{D}(K)$-module, and hence as a
$\mathbf{T}^{D}(K)$-module. Define

$M^{\tau}={\overline{\mathbf{T}}}^{\tau}\otimes_{{\overline{\mathbf{T}}}^{D}(K)}H^{\tau}=\mathbf{T}^{\tau}\otimes_{\mathbf{T}^{D}(K)}H^{\tau}=H^{\tau}/\left((S_{v}-\varepsilon_{p}(\operatorname{Frob}_{v}))x\middle|v\not\in\Sigma,x\in
H^{\tau}\right)$

For the convenience of the reader, we recall some notation and results from
Sections 4 and 5. For each prime $v$ of $F$, the universal (fixed determinant)
ring, parameterizing framed deformations of $\overline{\rho}|_{G_{F_{v}}}$
with determinant $\varepsilon_{p}$ is $R_{v}^{\square}$. For $v\nmid p$ and
$\tau_{v}\in\\{\operatorname{min},{\mathrm{st}},{\mathrm{uni}},{\operatorname{\varphi-
uni}},\square\\}$, let $R_{v}^{\tau_{v}}$ be the deformation ring defined in
Section 5, provided it exists (which is does for $v\in\Sigma$ and
$\tau=\tau_{v}$, by assumption). The ring $R_{v}^{\tau_{v}}$ is naturally an
$R_{v}^{\square}$-algebra, and unless $\tau_{v}={\operatorname{\varphi-uni}}$
it is a quotient of $R_{v}^{\square}$. Summarizing the results of Proposition
(CI) we have:

######  Proposition (CI).

For each $v\in\Sigma$, the ring $R_{v}^{\tau_{v}}$ is a complete, Noetherian
${\mathcal{O}}$-algebra which is flat and equidimensional over ${\mathcal{O}}$
of relative dimension $3$. Moreover, $R_{v}^{\tau_{v}}$ is Cohen–Macaulay, and
is a complete intersection whenever $\tau_{v}=\operatorname{min}$ or
$\square$, or whenever $\overline{\rho}|_{G_{v}}$ is not a scalar.

For $v|p$ the ring $R_{v}^{\operatorname{fl}}$ is the quotient of
$R_{v}^{\square}$ parameterizing _flat_ framed deformations of
$\overline{\rho}|_{G_{v}}$ with determinant $\varepsilon_{p}$. Then as
$\overline{\rho}|_{G_{v}}$ is flat and $F_{v}/\mathbf{Q}_{p}$ is unramified,
Fontaine–Laffaille theory implies that
$R_{v}^{\operatorname{fl}}\cong{\mathcal{O}}[[x_{1},\ldots,x_{3+[F_{v}:\mathbf{Q}_{p}]}]]$.

Now write

$\displaystyle R_{\operatorname{loc}}$
$\displaystyle=\left({\widehat{\bigotimes_{v\in\Sigma}}}\,R_{v}^{\square}\right){\widehat{\otimes}}\left({\widehat{\bigotimes_{v|p}}}\,R_{v}^{\operatorname{fl}}\right),$
and $\displaystyle R_{\operatorname{loc}}^{\tau}$
$\displaystyle=\left({\widehat{\bigotimes_{v\in\Sigma}}}\,R_{v}^{\tau_{v}}\right){\widehat{\otimes}}\left({\widehat{\bigotimes_{v|p}}}\,R_{v}^{\operatorname{fl}}\right)$

so that $R^{\tau}_{\operatorname{loc}}$ is naturally a
$R_{\operatorname{loc}}$-algebra. By Propositions (CI) and (CI),
$R_{\operatorname{loc}}$ is flat over ${\mathcal{O}}$ and Cohen–Macaulay.

By $R$ (resp. $R^{\square}$) we denote the (global) unframed (resp. framed)
deformation ring parameterizing lifts of $\overline{\rho}$ with determinant
$\varepsilon_{p}$ which are flat at every prime $v|p$. One may noncanonically
fix an isomorphism $R^{\square}=R[[X_{1},\ldots,X_{4j-1}]]$ for some $j$, and
thereby treat $R$ as a quotient of $R^{\square}$. Using the natural map
$R_{\operatorname{loc}}\to R^{\square}$ (and $R_{\operatorname{loc}}\to R$),
one defines
$R^{\square,\tau}=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}}R^{\square}$
and $R^{\tau}=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}}R$.

######  Lemma (CI).

There is a surjective map
$R^{\tau}\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}$ inducing a
representation
$\rho^{\tau}:G_{F}\to\mathrm{GL}_{2}(R^{\tau})\twoheadrightarrow\mathrm{GL}_{2}(\mathbf{T}^{\tau})$,
such that for all $v\not\in\Sigma\cup\Sigma_{p}$,
$\rho^{\tau}(\operatorname{Frob}_{v})$ has characteristic polynomial
$t^{2}-T_{v}t+S_{v}$, and for all
$v\in\Sigma^{{\mathrm{uni}}}\cup\Sigma^{{\operatorname{\varphi-uni}}}$,
$\rho^{\tau}|_{G_{F_{v}}}$ is unipotent and if $\operatorname{Frob}_{v}\in
G_{F_{v}}$ is any lift of Frobenius then
$\rho^{\tau}(\operatorname{Frob}_{v})$ again has characteristic polynomial
$t^{2}-T_{v}t+S_{v}$.

###### Proof.

If $\Sigma^{{\operatorname{\varphi-uni}}}=\varnothing$, this is just [Man21,
Lemma 2.4].

In general, for each for each $v\in\Sigma$, set $\sigma_{v}=\tau_{v}$ if
$\tau_{v}\in\\{\operatorname{min},{\mathrm{st}},\mathrm{uni},\square\\}$ and
$\sigma_{v}=\mathrm{uni}$ if $\tau_{v}={\operatorname{\varphi-uni}}$. Note
that under this definition, $K^{\sigma}=K^{\tau}=K$ and
${\overline{\mathbf{T}}}^{\sigma}=\mathbf{T}^{\sigma}=\mathbf{T}^{\tau}$.

It follows that there is a surjection
$R^{\sigma}\twoheadrightarrow{\overline{\mathbf{T}}}^{\sigma}=\mathbf{T}^{\sigma}=\mathbf{T}^{\tau}$
satisfying the desired conditions on $\rho^{\sigma}$. By definition,
${\overline{\mathbf{T}}}^{\tau}=\mathbf{T}^{\tau}[U_{v}|v\in\Sigma^{{\operatorname{\varphi-
uni}}}]$. From the identity $U_{v}^{2}-T_{v}U_{v}+S_{v}=0$ in
${\overline{\mathbf{T}}}^{D}(K)$ and the definition of modified global
deformation rings given in Section 4, it follows that
$R^{\sigma}\twoheadrightarrow\mathbf{T}^{\tau}\to{\overline{\mathbf{T}}}^{\tau}$
induces a map $R^{\tau}\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}$
sending $\alpha_{v}$ to $U_{v}$ for $v\in\Sigma^{{\operatorname{\varphi-
uni}}}$, which is therefore surjective, and hence is the desired map. ∎

Now similarly to [BKM21, Theorem 6.3], the Taylor–Wiles patching method gives
the following:

######  Theorem (CI).

There exist integers $g,d\geq 0$ and rings

$\displaystyle R_{\infty}^{\tau}$
$\displaystyle=R_{\operatorname{loc}}^{\tau}[[x_{1},\ldots,x_{g}]]$
$\displaystyle S_{\infty}$ $\displaystyle={\mathcal{O}}[[y_{1},\ldots,y_{d}]]$

satisfying the following:

  1. 1.

$\dim S_{\infty}=\dim R_{\infty}^{\tau}$.

  2. 2.

There exists a continuous ${\mathcal{O}}$-algebra morphism $i:S_{\infty}\to
R_{\infty}^{\tau}$ making $R_{\infty}^{\tau}$ into a finite free
$S_{\infty}$-module.

  3. 3.

There is an isomorphism
$R_{\infty}^{\tau}\otimes_{S_{\infty}}{\mathcal{O}}\cong R^{\tau}$ and
$R^{\tau}$ is finite free over ${\mathcal{O}}$.

  4. 4.

The map $R^{\tau}\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}$ from Lemma
(CI) is an isomorphism. These rings are reduced if
$\Sigma^{{\operatorname{\varphi-uni}}}=\varnothing$.

  5. 5.

If $\lambda$ is the induced map $R_{\infty}^{\tau}\twoheadrightarrow
R^{\tau}\xrightarrow{\sim}{\overline{\mathbf{T}}}^{\tau}\xrightarrow{\lambda}{\mathcal{O}}$,
then $\operatorname{Spec}R_{\infty}^{\tau}[1/\varpi]$ is formally smooth at
the point corresponding to $\lambda$.

###### Proof.

This is proved similarly to Theorem 6.3 in [BKM21].

First, we will consider the case when $\Sigma^{{\operatorname{\varphi-
uni}}}=\varnothing$, and so
${\overline{\mathbf{T}}}^{D}(K)=\mathbf{T}^{D}(K)$. More precisely, as in the
proof of Lemma (CI), for each $v\in\Sigma$, define $\sigma_{v}=\tau_{v}$ if
$\tau_{v}\in\\{\operatorname{min},{\mathrm{st}},\mathrm{uni},\square\\}$ and
define $\sigma_{v}=\mathrm{uni}$ if $\tau_{v}={\operatorname{\varphi-uni}}$.
Note that under this definition, $K^{\sigma}=K^{\tau}=K$,
$M^{\sigma}=M^{\tau}$ and
${\overline{\mathbf{T}}}^{\sigma}=\mathbf{T}^{\sigma}=\mathbf{T}^{\tau}$.

By assumption, $\overline{\rho}$ satisfies the Taylor–Wiles conditions, and so
we may apply the Taylor–Wiles–Kisin patching method (as summarized in [Man21,
Section 4]) to the rings $R^{\sigma}$ and $\mathbf{T}^{\sigma}$ and the module
$M^{\sigma}$.

First, as in [Man21, Section 4.2], we may add auxiliary level structure at a
carefully chosen prime not in $\Sigma$ to remove any isotropy issues, without
affecting any of the objects considered considered in this theorem.

Now, exactly as in the proof of [BKM21, Theorem 6.3] (and the method outlined
in [Man21, Section 4.3]), there exist integers $g,d\geq 0$, satisfying
$d+1=\dim R_{\operatorname{loc}}+g=\dim R_{\operatorname{loc}}^{\sigma}+g$
(see [Man21, Lemma 2.5] and [Kis09, Proposition (3.2.5)]) such that for each
$n\geq 1$, there is a unframed global deformation ring $R_{n}^{\sigma}$ and a
framed global deformation ring $R_{n}^{\sigma,\square}$ (with fixed
determinant, the same deformation conditions as $R^{\sigma}$ at each
$v\in\Sigma$, and relaxed deformation conditions at a carefully selected set
$Q_{n}$ of “Taylor–Wiles” primes), such that $R_{n}^{\sigma,\square}$ has the
structure of a $S_{\infty}$-algebra and there is a surjective map
$R_{\infty}\twoheadrightarrow R_{n}^{\sigma,\square}$ and an isomorphism
$R_{n}^{\sigma,\square}\otimes_{S_{\infty}}{\mathcal{O}}\cong R^{\sigma}$,
where $S_{\infty}$ and $R_{\infty}$ are as in the theorem statement.

Moreover, for each $n\geq 1$ the construction in [Man21, Section 4.2] also
constructs a compact open subgroup
$K_{n}=\prod_{v}K_{n,v}\subseteq(D\otimes\mathbf{A}_{F,f})^{\times}$ (with
$K_{n,v}=K_{v}$ for all $v\not\in Q_{n}$), and a Hecke algebra
$\mathbf{T}^{\sigma}_{n}$ and Hecke module $M^{\sigma}_{n}$ at level $K_{n}$
(defined analogously to $\mathbf{T}^{\sigma}$ and $M^{\sigma}$ above, by
localizing at a particular maximal ideal, and fixing determinants by taking a
quotient). One then has a surjection
$R^{\sigma}_{n}\twoheadrightarrow\mathbf{T}^{\sigma}_{n}$, making
$M^{\sigma}_{n}$ into a $R^{\sigma}_{n}$-module. Using this surjection, we may
define framed versions of these objects:
$\mathbf{T}^{\sigma,\square}_{n}=\mathbf{T}^{\sigma}_{n}\otimes_{R^{\sigma}_{n}}R^{\sigma,\square}_{n}$
and
$M^{\sigma,\square}_{n}=M^{\sigma}_{n}\otimes_{R^{\sigma}_{n}}R^{\sigma,\square}_{n}$.

Applying the ‘ultrapatching’ construction described in [Man21, Section 4.1]
(as well as in the proof of Lemma 4.8) then produces an $S_{\infty}$-algebra
${\mathcal{R}}_{\infty}^{\sigma}$ as well as an
${\mathcal{R}}_{\infty}$-module $M_{\infty}^{\sigma}$ (which would be called
$\mathscr{P}(\\{R^{\sigma,\square}_{n}\\})$ and
$\mathscr{P}(\\{M^{\sigma,\square}_{n}\\})$ in the notation of that paper),
for which:

  * •

$M_{\infty}^{\sigma}$ is finite free over $S_{\infty}$;

  * •

${\mathcal{R}}_{\infty}^{\sigma}\otimes_{S_{\infty}}{\mathcal{O}}\cong
R^{\sigma}$ and $M_{\infty}^{\sigma}\otimes_{S_{\infty}}{\mathcal{O}}\cong
M^{\sigma}$;

  * •

There is a surjection
$R_{\infty}^{\sigma}\twoheadrightarrow{\mathcal{R}}_{\infty}^{\sigma}$ such
that the composition

$R_{\operatorname{loc}}^{\sigma}\hookrightarrow
R_{\infty}^{\sigma}\twoheadrightarrow{\mathcal{R}}_{\infty}^{\sigma}\twoheadrightarrow
R^{\sigma}$

is the map $R_{\operatorname{loc}}^{\sigma}\to R^{\sigma}$ from above.

Just as in the proof of [BKM21, Theorem 6.3], we may lift the structure map
$S_{\infty}\to{\mathcal{R}}_{\infty}^{\sigma}$ to a map $i:S_{\infty}\to
R_{\infty}^{\sigma}$ making
$\pi_{\infty}:R_{\infty}^{\sigma}\to{\mathcal{R}}^{\sigma}_{\infty}$ into an
$S_{\infty}$-module surjection, and so it follows that $M_{\infty}^{\sigma}$
is a maximal Cohen–Maculay $R_{\infty}^{\sigma}$-module.

But now by standard properties of maximal Cohen–Macaulay modules, the support
of $M_{\infty}^{\sigma}$ is a union of irreducible components of
$\operatorname{Spec}R_{\infty}^{\sigma}$. As
$R_{\infty}^{\sigma}=R_{\operatorname{loc}}^{\sigma}[[x_{1},\ldots,x_{g}]]$,
the irreducible components of $\operatorname{Spec}R_{\infty}^{\sigma}$ are in
bijection with those of $\operatorname{Spec}R_{\operatorname{loc}}^{\sigma}$.

By an analogous result to Lemma 6.2 from [BKM21] (using Corollary 3.1.7 of
[Gee11] instead of the results of [DT94] that are used there), it follows that
each irreducible component of $\operatorname{Spec}R_{\infty}^{\sigma}$
contains a point in the support of
$M_{\infty}^{\sigma}/(i(y_{1}),\ldots,i(y_{d}))\otimes_{\mathcal{O}}E=M^{\sigma}\otimes_{\mathcal{O}}E$,
which is not contained in any other component. Then as in the proof of [BKM21,
Theorem 6.3], as $R_{\infty}^{\sigma}$ is reduced, it follows that
$R_{\infty}$ acts faithfully on $M_{\infty}$ and so
${\mathcal{R}}^{\sigma}_{\infty}=R^{\sigma}_{\infty}$, and so we indeed have
an isomorphism $R_{\infty}^{\sigma}\otimes_{S_{\infty}}{\mathcal{O}}\cong
R^{\sigma}$, proving the first part of (3).

By Proposition (CI), $R_{\infty}^{\tau}$ is Cohen–Macaulay. As in the proof of
[BKM21, Theorem 6.3] this, combined with the fact that $M_{\infty}^{\sigma}$
is free over $S_{\infty}$, implies that $R_{\infty}^{\tau}$ is free over
$S_{\infty}$, proving (2). As in [BKM21, Theorem 6.3] this also implies that
$R^{\sigma}=R_{\infty}^{\sigma}\otimes_{S_{\infty}}{\mathcal{O}}$ is finite
free over ${\mathcal{O}}$, proving the second part of (3). In particular (as
$\mathbf{T}^{\sigma}$ is finite free over ${\mathcal{O}}$ by definition) to
show that $R^{\sigma}\twoheadrightarrow\mathbf{T}^{\sigma}$ is an isomorphism,
it will suffice to show that the induced map
$R^{\sigma}[1/\varpi]\twoheadrightarrow\mathbf{T}^{\sigma}[1/\varpi]$ is.

Now as in the proof of [BKM21, Theorem 6.3],
$\operatorname{Spec}R_{\infty}^{\sigma}[1/\varpi]$ is formally smooth at every
point in the support of $\operatorname{Spec}M^{\sigma}\otimes_{\mathcal{O}}E$,
and so in particular at the point corresponding to
$\lambda:R_{\infty}^{\sigma}\twoheadrightarrow{\mathcal{O}}$, proving (5).
This is proved as in [BKM21, Lemma 6.1] by using the fact that Galois
representations arising from cohomological Hilbert modular forms are known to
be generic in the sense of [All16, Lemma 1.1.5], which follows from the
genericity of the corresponding automorphic representation of
$\mathrm{GL}_{2}(\mathbf{A}_{F})$ at all finite places and local-global
compatibility as recorded in [All16, Theorem 2.1.2].

The argument of [BKM21, Theorem 6.3] now proves that
$R^{\sigma}[1/\varpi]\twoheadrightarrow\mathbf{T}^{\sigma}[1/\varpi]$ is an
isomorphism, and hence $R^{\sigma}\twoheadrightarrow\mathbf{T}^{\sigma}$ is an
isomorphism. This proves (4) in the case when $\Sigma^{{\operatorname{\varphi-
uni}}}=\varnothing$ (the last claim in (4), that the rings are reduced, is a
consequence of the standard fact that the Hecke operators $T_{v}$ and $S_{v}$
for $v\not\in\Sigma$ are all simultaneously diagonalizable as operators on
$H^{\sigma}$).

In the case when $\Sigma^{{\operatorname{\varphi-uni}}}=\varnothing$, and
hence $\sigma=\tau$, this completes the proof. In the case when
$\Sigma^{{\operatorname{\varphi-uni}}}\neq\varnothing$, and so
$\sigma\neq\tau$, it remains to deduce the statement of the theorem for $\tau$
from the one for $\sigma$.

First, by the definition of modified global deformation rings given in Section
4, we have that

$R^{\tau}=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}}R=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}R^{\sigma}$

and similarly
$R^{\tau}_{n}=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}R_{n}^{\sigma}$
and
$R^{\tau,\square}_{n}=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}R_{n}^{\sigma,\square}$
for all $n\geq 1$. The $S_{\infty}$-algebra structure on
$R_{n}^{\sigma,\square}$ then induces an $S_{\infty}$-algebra structure on
$R_{n}^{\sigma,\square}$ and we have

$R_{n}^{\tau,\square}\otimes_{S_{\infty}}{\mathcal{O}}=(R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}R_{n}^{\sigma,\square})\otimes_{S_{\infty}}{\mathcal{O}}=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}(R_{n}^{\sigma,\square}\otimes_{S_{\infty}}{\mathcal{O}})=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}R^{\sigma}=R^{\tau}.$

Also, as $R_{n}^{\sigma,\square}$ is a quotient of $R_{\infty}^{\sigma}$ (as a
$R_{\operatorname{loc}}^{\sigma}$-algebra), if we let

$R_{\infty}^{\tau}=R_{\operatorname{loc}}^{\tau}[[x_{1},\ldots,x_{g}]]=R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}R_{\infty}^{\sigma}$

then $R_{n}^{\tau,\square}$ is a quotient of
$R_{\operatorname{loc}}^{\tau}\otimes_{R_{\operatorname{loc}}^{\sigma}}R_{\infty}^{\sigma}=R_{\infty}^{\tau}$
(as a $R_{\operatorname{loc}}^{\tau}$-algebra).

Now just as in the proof of Lemma (CI), the map
$R_{n}^{\sigma}\twoheadrightarrow\mathbf{T}^{\sigma}_{n}$ induces a map
$R_{n}^{\tau}\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}_{n}$ making the
diagram

$R^{\tau}_{n}$${\overline{\mathbf{T}}}^{\tau}_{n}$$R^{\sigma}_{n}$$\mathbf{T}^{\sigma}_{n}$

commute. As the $\mathbf{T}^{\sigma}_{n}$-action on $M^{\sigma}_{n}$ extends
to a ${\overline{\mathbf{T}}}^{\tau}_{n}$-action (since the $U_{v}$ operators
naturally act on $M^{\sigma}$), the $R^{\sigma}_{n}$-action on
$M^{\sigma}_{n}$ also extends to a $R^{\tau}_{n}$-action on $M^{\sigma}_{n}$.
Passing to the framed versions (by applying
$-\otimes_{R^{\sigma}_{n}}R^{\sigma,\square}_{n}$), it follows that the action
of $R^{\sigma,\square}_{n}$ on $M^{\sigma,\square}_{n}$ extends to an action
of $R^{\tau,\square}_{n}$. Moreover, it’s easy to check that the isomorphism
$M^{\sigma,\square}_{n}\otimes_{S_{\infty}}{\mathcal{O}}\cong M^{\sigma}$ is
compatible with the action of the $U_{v}$-operators, and so it is an
isomorphism of ${\overline{\mathbf{T}}}^{\tau}$-modules, and hence of
$R^{\tau}$-modules.

Combining all of this, we can again use the ‘ultrapatching’ construction of
[Man21, Section 4.1], with $\\{R^{\tau,\square}_{n}\\}$ in place of
$\\{R^{\sigma,\square}_{n}\\}$ and $R_{\infty}^{\tau}$ in place of
$R_{\infty}^{\sigma}$. This produces a $S_{\infty}$-algebra
${\mathcal{R}}^{\tau}_{\infty}$ together with a surjection
$R_{\infty}^{\tau}\twoheadrightarrow{\mathcal{R}}^{\tau}_{\infty}$ and an
isomorphism
${\mathcal{R}}_{\infty}^{\tau}\otimes_{S_{\infty}}{\mathcal{O}}\cong R^{\tau}$
such that the composition

$R_{\operatorname{loc}}^{\tau}\hookrightarrow
R_{\infty}^{\tau}\twoheadrightarrow{\mathcal{R}}_{\infty}^{\tau}\twoheadrightarrow
R^{\tau}$

is the map $R_{\operatorname{loc}}^{\tau}\to R^{\tau}$.

By the functorality of the ultrapatching construction, the maps
$R_{n}^{\sigma,\square}\to R_{n}^{\tau,\square}$ induce an
$S_{\infty}$-algebra homomorphism
$R_{\infty}^{\sigma}={\mathcal{R}}_{\infty}^{\sigma}\to{\mathcal{R}}_{\infty}^{\tau}$.
Moreover, the action of $R_{n}^{\tau,\square}$ on $M^{\sigma,\square}_{n}$
induces an action of ${\mathcal{R}}_{\infty}^{\tau}$ on $M_{\infty}^{\sigma}$,
extending the action of ${\mathcal{R}}_{\infty}^{\sigma}$. In particular, we
may treat $M_{\infty}^{\sigma}$ as a $R_{\infty}^{\tau}$-module.

We can now finish the proof. First we have $R_{v}^{\sigma}=R_{v}^{\tau}$ for
$v\not\in\Sigma^{\operatorname{\varphi-uni}}$ and $\dim R_{v}^{\sigma}=\dim
R_{v}^{\tau}=3+1$ for $v\in\Sigma^{\operatorname{\varphi-uni}}$, so $\dim
R_{\infty}^{\tau}=\dim R_{\infty}^{\sigma}=\dim S_{\infty}$, proving (1).

We shall now show (5). First, for
$v\in\Sigma\smallsetminus\Sigma^{\operatorname{\varphi-uni}}$, we have
$R_{v}^{\tau_{v}}=R_{v}^{\sigma_{v}}$ and
$\operatorname{Spec}R_{v}^{\sigma_{v}}[1/\varpi]$ is formally smooth at the
point corresponding to $\lambda:R_{v}^{\sigma_{v}}\hookrightarrow
R_{\infty}^{\sigma}\xrightarrow{\lambda}{\mathcal{O}}$ by the above. Thus to
show (5), it suffices to show that for each
$v\in\Sigma^{\operatorname{\varphi-uni}}$,
$\operatorname{Spec}R_{v}^{\operatorname{\varphi-uni}}[1/\varpi]$ is also
formally smooth at the point corresponding to
$\lambda:R_{v}^{\operatorname{\varphi-uni}}\hookrightarrow
R_{\infty}^{\tau}\xrightarrow{\lambda}{\mathcal{O}}$.

Take any such $v\in\Sigma^{\operatorname{\varphi-uni}}$. Recall that by
assumption the representation $\rho|_{G_{v}}$ is Steinberg. Thus the point of
$\operatorname{Spec}R_{v}^{\mathrm{uni}}[1/\varpi]$ corresponding to
$\lambda:R_{v}^{\mathrm{uni}}\hookrightarrow
R_{\infty}^{\sigma}\xrightarrow{\lambda}{\mathcal{O}}$ is in the Steinberg
component and not in the unramified component (it can’t lie on both
components, as it corresponds to a formally smooth point of
$\operatorname{Spec}R_{\infty}^{\sigma}[1/\varpi]$, by the above argument).
But now by the explicit descriptions of the rings $R_{v}^{\mathrm{uni}}$ and
$R_{v}^{\operatorname{\varphi-uni}}$ given in Section 5, it follows that the
point of $\operatorname{Spec}R_{v}^{\operatorname{\varphi-uni}}[1/\varpi]$
corresponding to $\lambda:R_{v}^{\operatorname{\varphi-uni}}\hookrightarrow
R_{\infty}^{\tau}\xrightarrow{\lambda}{\mathcal{O}}$ is also contained in the
Steinberg components, but not the unramified component. But the description of
$R_{v}^{\operatorname{\varphi-uni}}$ from Section 5 shows that
$\operatorname{Spec}R_{v}^{\operatorname{\varphi-uni}}[1/\varpi]$ is formally
smooth at any such point. This proves (5).

As $M_{\infty}^{\sigma}$ is maximal Cohen–Macaulay over $R_{\infty}^{\sigma}$,
it follows that it is also maximal Cohen–Macaulay over $R_{\infty}^{\tau}$,
and so the support of $M_{\infty}^{\sigma}$ as an $R_{\infty}^{\tau}$-module
is again a union of irreducible components of
$\operatorname{Spec}R_{\infty}^{\tau}$. But now for each $v\in\Sigma$, the
irreducible components of $R_{v}^{\sigma}$ are in bijection with those of
$R_{v}^{\tau}$ (this is trivial for $v\not\in\Sigma^{\operatorname{\varphi-
uni}}$ and for $v\in\Sigma^{{\operatorname{\varphi-uni}}}$ follows from the
description of $R^{\mathrm{uni}}_{v}$ and $R^{\operatorname{\varphi-uni}}_{v}$
given in Section 5). By Proposition (CI), it follows that the irreducible
components of $\operatorname{Spec}R_{\infty}^{\sigma}$ are in bijection with
those of $\operatorname{Spec}R_{\infty}^{\tau}$. Since $M_{\infty}^{\sigma}$
is supported on all of $\operatorname{Spec}R_{\infty}^{\sigma}$, it follows
that $M_{\infty}^{\sigma}$ is supported on all of
$\operatorname{Spec}R_{\infty}^{\tau}$ as well. Since $R_{\infty}^{\tau}$ is
reduced, it follows that $R_{\infty}^{\tau}$ acts faithfully on
$M_{\infty}^{\sigma}$. Since the action of $R_{\infty}^{\tau}$ on
$M_{\infty}^{\sigma}$ factors through
$R_{\infty}^{\tau}\twoheadrightarrow{\mathcal{R}}_{\infty}^{\tau}$, it follows
that $R_{\infty}^{\tau}\cong{\mathcal{R}}_{\infty}^{\tau}$.

Just as before, (2) and (3) follow from this, and again, the second part of
(3) implies that to show that
$R^{\tau}\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}$ is an isomorphism,
it will suffice to show that the induced map
$R^{\tau}[1/\varpi]\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}[1/\varpi]$
is.

To prove (4), consider the commutative diagram

$R^{\tau}[1/\varpi]$${\overline{\mathbf{T}}}^{\tau}[1/\varpi]$$R^{\sigma}[1/\varpi]$$\mathbf{T}^{\sigma}[1/\varpi]$

As the bottom map is an isomorphism of finite free reduced $E$-algebras, to
show that the top map is an isomorphism, it will suffice to show that for any
${\overline{\mathbf{Q}}}_{p}$ point
$\eta:\mathbf{T}^{\sigma}[1/\varpi]\to{\overline{\mathbf{Q}}}_{p}$ of
$\operatorname{Spec}\mathbf{T}^{\sigma}\cong\operatorname{Spec}R^{\sigma}$ the
induced map
$R^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}$
is an isomorphism.

Fix any such
$\eta:\mathbf{T}^{\sigma}[1/\varpi]\to{\overline{\mathbf{Q}}}_{p}$. Then
$\eta$ corresponds to a modular Galois representation
$\rho_{\eta}:G_{F}\to\mathrm{GL}_{2}({\overline{\mathbf{Q}}}_{p})$ lifting
$\overline{\rho}$. For each $v\in\Sigma^{\operatorname{\varphi-uni}}$,
$\overline{\rho}|_{G_{F_{v}}}$ must be either Steinberg or unramified. Let
$S_{\eta}\subseteq\Sigma^{\operatorname{\varphi-uni}}$ be the set of
$v\in\Sigma^{\operatorname{\varphi-uni}}$ for which $\rho_{\eta}|_{G_{F_{v}}}$
is unramified.

By the definition given in Section 6,
$R^{\tau}=R^{\sigma}\left[a_{v}\middle|v\in\Sigma^{\operatorname{\varphi-
uni}}\right]$, where for each $v\in\Sigma$, $a_{v}$ is the chosen root of the
characteristic polynomial of $\rho_{\eta}(\operatorname{Frob}_{v})$. Hence

$R^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}=(R^{\sigma}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p})\left[a_{v}\middle|v\in\Sigma^{\operatorname{\varphi-
uni}}\right]={\overline{\mathbf{Q}}}_{p}\left[a_{v}\middle|v\in\Sigma^{\operatorname{\varphi-
uni}}\right]$

For $v\in\Sigma^{\operatorname{\varphi-uni}}\smallsetminus S_{\eta}$ (so that
$\rho_{\eta}|_{G_{F_{v}}}$ is Steinberg) the definition of
$R_{v}^{\operatorname{\varphi-uni}}$ implies that $a_{v}=\pm
1\in{\overline{\mathbf{Q}}}_{p}$, so in fact,
$R^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}={\overline{\mathbf{Q}}}_{p}\left[a_{v}\middle|v\in
S_{\eta}\right]$, and so $R^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}$
is a quotient of

${\overline{\mathbf{Q}}}_{p}\left[x_{v}\middle|v\in
S_{\eta}\right]/(x_{v}^{2}-x_{v}\operatorname{tr}\rho_{v}^{\square}(\operatorname{Frob}_{v})+\det\rho_{v}^{\square}(\operatorname{Frob}_{v})).$

In particular, we have
$\dim_{{\overline{\mathbf{Q}}}_{p}}R^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}\leq
2^{|S_{\eta}|}$.

On the other hand,
${\overline{\mathbf{T}}}^{\tau}=\mathbf{T}^{\sigma}\left[U_{v}\middle|v\in\Sigma^{\operatorname{\varphi-
uni}}\right]$ is a subalgebra of
$\operatorname{End}_{{\mathcal{O}}}(M^{\tau})$, and so

${\overline{\mathbf{T}}}^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}=(\mathbf{T}^{\sigma}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p})\left[U_{v}\middle|v\in\Sigma^{\operatorname{\varphi-
uni}}\right]={\overline{\mathbf{Q}}}_{p}\left[U_{v}\middle|v\in\Sigma^{\operatorname{\varphi-
uni}}\right]={\overline{\mathbf{Q}}}_{p}\left[U_{v}\middle|v\in
S_{\eta}\right]$

is a subalgebra of
$\operatorname{End}_{{\overline{\mathbf{Q}}}_{p}}(M^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p})$
(where the last inequality comes from the fact that $U_{v}$ acts as a scalar
on $M^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}$ if
$\rho_{\eta}|_{G_{F_{v}}}$ is Steinberg). But now as $\rho_{\eta}$ is
unramified at each $v\in S_{\eta}$, it corresponds to a Hilbert modular form
$f_{\eta}$ of level not divisible by any $v\in S_{\eta}$. Standard properties
of Hilbert modular forms now imply that
$\dim_{{\overline{\mathbf{Q}}}_{p}}{\overline{\mathbf{T}}}^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}=\dim_{{\overline{\mathbf{Q}}}_{p}}{\overline{\mathbf{Q}}}_{p}\left[U_{v}\middle|v\in
S_{\eta}\right]=2^{|S_{\eta}|}$; we are using here that the $U_{v}$ for $v\in
S_{\eta}$ act as independent non-scalar endomorphisms on the $2^{|S_{\eta}|}$
dimensional (${\overline{\mathbf{Q}}}_{p}$-) vector space generated by the
image of $f_{\eta}$ under the standard degeneracy maps arising from the places
$v\in S_{\eta}$. Thus
$\dim_{{\overline{\mathbf{Q}}}_{p}}{\overline{\mathbf{T}}}^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}=2^{|S_{\eta}|}\geq\dim_{{\overline{\mathbf{Q}}}_{p}}R^{\tau}\otimes_{\eta}$,
and so as the map
$R^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}\twoheadrightarrow{\overline{\mathbf{T}}}^{\tau}\otimes_{\eta}{\overline{\mathbf{Q}}}_{p}$
is surjective, it must be an isomorphism. This completes the proof of (4), and
thus of the theorem. ∎

Combining this with Proposition (CI) and the computations in Section 5 gives
the following generalization of [BKM21, Theorem 10.1]:

######  Theorem (CI).

In setting described in this section we have:

$\delta(R^{\tau})=\delta(\mathbf{T}^{\tau})=\sum_{v\in\Sigma^{{\mathrm{st}}}}\frac{2n_{v}}{e}+\sum_{v\in\Sigma^{{\operatorname{\varphi-
uni}}}}\frac{3n_{v}}{e}+\sum_{v\in\Sigma^{{\mathrm{uni}}}}\frac{n_{v}}{e}$

where $n_{v}$ is as above, and $e$ is the ramification index of
$E/\mathbf{Q}_{p}$.

###### Proof.

Theorem (CI) implies that the map $\theta:S_{\infty}\to R_{\infty}^{\tau}$
satisfies property (P), and so Theorem (CI) implies that implies that

$\delta_{\lambda}(\mathbf{T}^{\tau})=\delta_{\lambda}(R^{\tau})=\delta_{\lambda}(R_{\infty}^{\tau}\otimes_{S_{\infty}}{\mathcal{O}})=\delta_{\lambda}(R_{\infty}^{\tau}).$

Now by Proposition (CI) and Proposition (CI) we get:

$\displaystyle\delta_{\lambda}(R_{\infty}^{\tau})$
$\displaystyle=\delta_{\lambda}(R_{\operatorname{loc}}^{\tau}[[x_{1},\ldots,x_{g}]])=\delta_{\lambda}(R_{\operatorname{loc}}^{\tau})+\delta_{\lambda}({\mathcal{O}}[[x_{1},\ldots,x_{g}]])=\delta_{\lambda}(R_{\operatorname{loc}}^{\tau})$
$\displaystyle=\delta_{\lambda}\left(\left({\widehat{\bigotimes_{v\in\Sigma}}}R_{v}^{\tau_{v}}\right){\widehat{\otimes}}\left({\widehat{\bigotimes_{v|p}}}R_{v}^{\operatorname{fl}}\right)\right)=\sum_{v\in\Sigma}\delta_{\lambda}(R_{v}^{\tau_{v}})+\sum_{v|p}\delta_{\lambda}(R_{v}^{\operatorname{fl}})$
$\displaystyle=\sum_{v\in\Sigma}\delta_{\lambda}(R_{v}^{\tau_{v}})+\sum_{v|p}\delta_{\lambda}({\mathcal{O}}[[x_{1},\ldots,x_{3+[F_{v}:\mathbf{Q}_{p}]}]])=\sum_{v\in\Sigma}\delta_{\lambda}(R_{v}^{\tau_{v}})$
$\displaystyle=\sum_{v\in\Sigma^{\operatorname{min}}}\delta_{\lambda}(R_{v}^{\operatorname{min}})+\sum_{v\in\Sigma^{{\mathrm{st}}}}\delta_{\lambda}(R_{v}^{{\mathrm{st}}})+\sum_{v\in\Sigma^{{\operatorname{\varphi-
uni}}}}\delta_{\lambda}(R_{v}^{{\operatorname{\varphi-
uni}}})+\sum_{v\in\Sigma^{{\mathrm{uni}}}}\delta_{\lambda}(R_{v}^{{\mathrm{uni}}})+\sum_{v\in\Sigma^{\square}}\delta_{\lambda}(R_{v}^{\square}).$

Now Proposition (CI) implies that $R_{v}^{\operatorname{min}}$ and
$R_{v}^{\square}$ are complete intersections, so Proposition (CI) gives
$\delta_{\lambda}(R_{v}^{\operatorname{min}})=0$ and
$\delta_{\lambda}(R_{v}^{\square})=0$. Thus the claim follows by the
computations in Theorems (CI), (CI) and (CI). ∎

As a side note, while this theorem only computes the “non-cohomological” Wiles
defect, and [BKM21, Theorem 10.1] computes both the cohomological and non-
cohomological defects, we still have these defects are equal in the minimal
level case (i.e. $\Sigma^{{\mathrm{uni}}}=\Sigma^{{\operatorname{\varphi-
uni}}}=\Sigma^{\square}=\varnothing$) by [Man21, Theorem 1.2] and [BKM21,
Theorem 3.12].

In the next section we show that in fact our work here, which determines the
defect of Hecke algebras and deformation rings, can be used to show an
equality of cohomological and non-cohomological defects in many situations.

##  7 Cohomological Wiles defects and degrees of parametrizations by Shimura
curves

The main theorem of this paper, Theorem (CI), that we have proven above
computes Wiles defects of Hecke algebras acting on the cohomology of modular
curves and Shimura curves. We use this to compute in the present section the
Wiles defect of the modules of the Hecke algebras of Theorem (CI) that are
given by the cohomology of the Shimura curve on which the respective Hecke
algebras acts faithfully ; Theorem (CI) and Proposition (CI) below.

Our methods here also allow us to improve on the results of [RT97] about
degrees of optimal parametrizations of elliptic curves over $\mathbf{Q}$ by
Shimura curves: see Corollaries (CI) and (CI) below. Our approach diverges
considerably from the one of [RT97]. Our proofs are rather indirect but seem
to fill in a lacuna caused by the basic problem that one does not know in
generality surjectivity of maps on $p$-parts of component groups at primes $q$
(of multiplicative reduction), induced by optimal parametrization of an
elliptic curve $E$ over $\mathbf{Q}$ by a Shimura curve, when the prime $q$
divides the discriminant of the corresponding quaternion algebra (see the
remarks in §7.1). We only consider non-Eisenstein primes, namely primes $p$
such that $E[p]$ is irreducible. The arguments in [RT97, page 11113] which
prove this in special cases rely on auxiliary hypotheses: for instance that
there is a prime $q$ such that the image of an inertia group $I_{q}$ at $q$
acting on $E[p]$ has image of order $p$. The difficulty of proving the
surjectivity alluded to above is specially vexing when considering component
groups at a prime $q$ that is trivial for $E[p]$. Both corollaries are deduced
from Theorem (CI) and Proposition (CI).

We work with the setup in [BKM21, Section 5] and thus operate (mainly for
simplicity) at less generality than the work in the previous sections (for
instance we will asume $F=\mathbf{Q}$.) There are slight differences between
the setup here and that of [BKM21, Section 5] that we begin by highlighting.

Fix $Q$ a finite set of primes and let $D_{Q}$ be the quaternion algebra over
$\mathbf{Q}$ considered in [BKM21, §5]: it is definite if $Q$ has odd
cardinality and indefinite if $Q$ is of even cardinality. (By abuse of
notation, we will also frequently use $Q$ to denote the product of all the
primes in the set $Q$. The context will make clear which meaning is intended.)
We assume here that $Q$ has even cardinality and thus $D_{Q}$ is an indefinite
quaternion algebra. For a positive integer $N$ with $(N,Q)=1$ let
$\Gamma_{0}^{Q}(N)$ be the congruence subgroup for $D_{Q}^{\times}$, which is
maximal compact at primes in $Q$, and upper triangular mod $\ell$ for all
$\ell|N$. We consider also the usual congruence subgroups $\Gamma_{0}(NQ)$ and
$\Gamma_{0}(N^{2}Q^{2})$ of $\mathrm{SL}_{2}(\mathbf{Z})$. Let
$K_{0}(N^{2}Q^{2})\subseteq\mathrm{GL}_{2}(\mathbf{A}_{\mathbf{Q},f})$, and
$K_{0}^{Q}(NQ)\subseteq D_{Q}^{\times}(\mathbf{A}_{\mathbf{Q},f})$ be the
corresponding compact open subgroups.

We consider $X^{Q}_{0}(N)$ the (compact) Riemann surface

$D_{Q}^{\times}(\mathbf{Q})\backslash\left(D_{Q}^{\times}(\mathbf{A}_{\mathbf{Q},f})\times\mathcal{H}\right)/K_{0}^{Q}(N)$

(where $\mathcal{H}$ is the complex upper half plane). Give $X^{Q}_{0}(N)$ its
canonical structure as an algebraic curve over $\mathbf{Q}$. Let as before $p$
be a prime not dividing $2NQ$, and we fix a finite extension
$E/\mathbf{Q}_{p}$, with ${\mathcal{O}}$ the ring of integers in $E$, $\varpi$
a uniformizer, $k={\mathcal{O}}/\varpi$ the residue field, and $e$ the
ramification index of $E/\mathbf{Q}_{p}$. We will assume below that $E$ is
sufficiently large so that ${\mathcal{O}}$ contains the Fourier coefficients
of all newforms in $S_{2}(\Gamma_{0}(N^{2}Q^{2}))$. Consider
$S^{Q}(\Gamma_{0}^{Q}(N))=H^{1}(X^{Q}_{0}(N),{\mathcal{O}})$, with its natural
$\mathbf{T}^{Q}(N)[G_{\mathbf{Q}}]$-module structure. We also denote
$S(N^{2}Q^{2})=H^{1}(X_{0}(N^{2}Q^{2}),{\mathcal{O}})$ and
$S(NQ)=H^{1}(X_{0}(NQ),{\mathcal{O}})$.

Let $\mathbf{T}(N^{2}Q^{2})$, $\mathbf{T}(NQ)$ and $\mathbf{T}^{Q}(N)$ be the
${\mathcal{O}}$-algebras at level $\Gamma_{0}(NQ^{2})$, $\Gamma_{0}(NQ)$ and
$\Gamma_{0}^{Q}(N)$, respectively, generated by the Hecke operators $T_{r}$
for primes $r$ coprime to $pNQ$ acting on $S(N^{2}Q^{2})$, $S(NQ)$ and
$S^{Q}(\Gamma_{0}^{Q}(N))$. Note that by the Jacquet–Langlands correspondence,
$\mathbf{T}^{Q}(N)$ is a quotient of $\mathbf{T}(N^{2}Q^{2})$, and this
quotient factors through $\mathbf{T}(NQ)$.

Let $f\in S_{2}(\Gamma_{0}(NQ))$ be a newform of level $NQ$ such that all its
Fourier coefficients lie in $E$, and consider the corresponding
${\mathcal{O}}$-algebra homomorphisms
$\lambda_{f}:\mathbf{T}(N^{2}Q^{2})\to{\mathcal{O}}$ and (abusing notation
slightly) $\lambda_{f}:\mathbf{T}(NQ)\to{\mathcal{O}}$. We will fix this
newform and our main results will be in relation to $f$. By the
Jacquet–Langlands correspondence, this also gives a related homomorphism
$\mathbf{T}^{Q}(N)\to{\mathcal{O}}$ that we again denote by the same symbol
$\lambda_{f}$. We denote the corresponding maximal ideals which contain the
prime ideal $\ker(\lambda_{f})$ by the same symbol ${\mathfrak{m}}$. Let
$\rho_{f}:G_{\mathbf{Q}}\to\mathrm{GL}_{2}({\mathcal{O}})$ be the Galois
representation associated by Eichler and Shimura to $f$ and assume that the
corresponding residual Galois representation
$\overline{\rho}_{f}=\overline{\rho}:G_{\mathbf{Q}}\to\mathrm{GL}_{2}(k)$ is
absolutely irreducible. By enlarging ${\mathcal{O}}$ if necessary, we may
assume that $k$ contains all eigenvalues of $\overline{\rho}(\sigma)$ for all
$\sigma\in G_{\mathbf{Q}}$. The Galois representation
$\rho_{f}:G_{\mathbf{Q}}\to\mathrm{GL}_{2}(E)$, with irreducible residual
representation $\overline{\rho}$, is locally at $q$ of the form

$\left(\begin{array}[]{cc}\epsilon&\ast\\\ 0&1\end{array}\right),$

up to twist by an unramified character $\chi$ of order dividing 2. The
$\beta_{q}\in\\{\pm 1\\}$ of Section 4 will be chosen so that
$\rho_{f}|_{G_{q}}$ gives rise to a point of
$\operatorname{Spec}R_{q}^{{\mathrm{st}}}$ in what follows (and thus depends
on whether $\chi$ is trivial or not).

There is an oldform $f^{NQ}$ in $S_{2}(\Gamma_{0}(N^{2}Q^{2}))$ with
corresponding newform $f$ which is characterised by the property that it is an
eigenform for the Hecke operators $T_{\ell}$ for $\ell$ prime with
$(\ell,NQ)=1$ and $U_{\ell}$ for $\ell|NQ$ and such that $a_{\ell}(f^{NQ})=0$,
i.e., $f^{Q}|U_{\ell}=0$, for $\ell|NQ$. Let $\lambda_{f^{NQ}}:\mathbf{T}^{\rm
full}(N^{2}Q^{2})\to{\mathcal{O}}$ be the induced homomorphism of the full
Hecke algebra $\mathbf{T}^{\rm full}(N^{2}Q^{2})$ acting on
$H^{1}(X_{0}(N^{2}Q^{2}),{\mathcal{O}})$ which is generated as an
${\mathcal{O}}$-algebra by the action of the Hecke operators $T_{\ell}$ for
$(\ell,NQ^{2})=1$ and $U_{\ell}$ for $\ell|NQ$ on
$S(N^{2}Q^{2})=H^{1}(X_{0}(N^{2}Q^{2}),{\mathcal{O}})$. We denote by
${\mathfrak{m}}_{Q}$ the maximal ideal of $\mathbf{T}^{\rm full}(N^{2}Q^{2})$
that contains the kernel of $\lambda_{f^{NQ}}$.

The homomorphism $\lambda_{f}:\mathbf{T}^{Q}(N)\to{\mathcal{O}}$ extends to
the full Hecke algebra acting on $S^{Q}(\Gamma_{0}^{Q}(N))$, and we denote by
${\mathfrak{m}}_{Q}$ again the maximal ideal of $\mathbf{T}^{Q}(N)$ which
contains the kernel of the extended homomorphism. We define $\mathbf{T}$,
$\mathbf{T}^{\mathrm{uni}}$ and $\mathbf{T}^{\mathrm{st},{Q}}$ to be the image
of $\mathbf{T}(NQ^{2})$ and $\mathbf{T}^{Q}(N)$ in the endomorphisms of the
finitely generated ${\mathcal{O}}$-modules
$S(N^{2}Q^{2})=H^{1}(X_{0}(N^{2}Q^{2}),{\mathcal{O}})_{{\mathfrak{m}}_{Q}}$,
$S(NQ)=H^{1}(X_{0}(NQ),{\mathcal{O}})_{{\mathfrak{m}}}$ and
$S^{Q}(\Gamma_{0}^{Q}(N))_{{\mathfrak{m}}_{Q}}$ respectively. We denote by
$R,R^{\mathrm{uni}},R^{{\mathrm{st}},Q}$ the corresponding universal
deformation rings and thus we have surjective maps
$R\twoheadrightarrow\mathbf{T}$,
$R^{\mathrm{uni}}\twoheadrightarrow\mathbf{T}^{\mathrm{uni}}$ and
$R^{{\mathrm{st}},Q}\twoheadrightarrow\mathbf{T}^{{\mathrm{st}},Q}$ of
${\mathcal{O}}$-algebras. (Thus in each of these cases the type
$\tau=(\tau_{v})$ for $v|NQ$ is such that $\tau_{v}$ is unrestricted, or
unipotent, or unipotent at $v|N$ and Steinberg at $v|Q$.) We have the
corresponding universal modular deformation
$\rho^{\operatorname{mod}}:G_{\mathbf{Q}}\to\mathrm{GL}_{2}(\mathbf{T}))$ by
results of Carayol which is a specialization of a universal representation
$G_{\mathbf{Q}}\to\mathrm{GL}_{2}(R)$.

Define

$M(N^{2}Q^{2})=\operatorname{Hom}_{\mathbf{T}[G_{\mathbf{Q}}]}(\rho^{\operatorname{mod}},S(N^{2}Q^{2})_{{\mathfrak{m}}_{Q}}^{*}),$
$M(NQ)=\operatorname{Hom}_{\mathbf{T}[G_{\mathbf{Q}}]}(\rho^{\operatorname{mod}},S(NQ)_{{\mathfrak{m}}}^{*}),$
$M^{{\mathrm{st}},{Q}}(N)=\operatorname{Hom}_{\mathbf{T}[G_{\mathbf{Q}}]}(\rho^{\operatorname{mod}},S^{Q}(\Gamma_{0}^{Q}(N))_{{\mathfrak{m}}_{Q}}^{*}).$

As in Lemma 5.1 of [BKM21], we have using [Car94] that the evaluation map
$M(N^{2}Q^{2})\otimes_{\mathbf{T}}\rho^{\operatorname{mod}}\to
S(N^{2}Q^{2})_{{\mathfrak{m}}_{Q}}^{*}$ is an isomorphism, as is
$M^{\mathrm{st},{Q}}(N)\otimes_{\mathbf{T}}\rho^{\operatorname{mod}}\to
S^{Q}(\Gamma_{0}^{Q}(N))_{{\mathfrak{m}}_{Q}}^{*}$. In particular, as
$\mathbf{T}$-modules we have
$S(N^{2}Q^{2})_{{\mathfrak{m}}_{Q}}^{*}=M(N^{2}Q^{2})^{\oplus 2}$ and
$S^{Q}(\Gamma_{0}^{Q}(N))_{{\mathfrak{m}}_{Q}}^{*}=M^{{\mathrm{st}},{Q}}(N)^{\oplus
2}$.

We have the following lemma proved using Proposition 4.7 of [DDT97] (see proof
of Theorem 5.2 of [BKM21]).

######  Lemma (CI).

(i)

The Hecke module $M(N^{2}Q^{2})[{1\over p}]$ is free of rank one over
$\mathbf{T}[{1\over p}]$.

(ii)

The $\mathbf{T}$-modules

$M(N^{2}Q^{2}),M(NQ),M^{\mathrm{st},{Q}}(N)$

are self-dual.

(iii)

The ${\mathcal{O}}$-modules

$M(N^{2}Q^{2})[\ker(\lambda_{f^{NQ}})],M(NQ)[\ker(\lambda_{f})],M^{\mathrm{st},{Q}}(N)[\ker(\lambda_{f})]$

are each free of rank 1 over ${\mathcal{O}}$.

###### Proof.

The first part follows from the arguments in Proposition 4.7 of [DDT97] (see
proof of Theorem 5.2 of [BKM21]). For the second part we use that $f$ is a
newform of level $NQ$, and the explicit description of $f^{NQ}$ and the
corresponding maximal ideal ${\mathfrak{m}}_{Q}$ that is used to define
$M(N^{2}Q^{2})$. ∎

######  Remark (CI).

In general the modules $M(NQ),M^{\mathrm{st},{Q}}(N)$, because of the presence
of oldforms, are not generically free over the anemic Hecke algebras acting on
them that do not have the operators $U_{v}$ for $v|NQ$ in them. This generic
freeness holds for $M^{\mathrm{st},{Q}}(N)$ if $N|N(\overline{\rho})$ which
was the assumption in [BKM21]. They are generically free over the full Hecke
algebras acting on them that have the operators $U_{v}$ for $v|NQ$ in them.

######  Remark (CI).

The definition of the modules $M(N^{2}Q^{2})$, $M(NQ)$ and
$M^{{\mathrm{st}},{Q}}(N)$ differs slightly from the definition of the modules
$M^{\tau}$ from Section 6. In particular, we do not quotient by the elements
$S_{v}-\varepsilon_{p}(\operatorname{Frob}_{v})$ (or even explicitly use the
Hecke operators $S_{v}$). The definition of $M^{\tau}$ from Section 6 is
needed when $F\neq\mathbf{Q}$ in order to make the patching argument work (for
subtle reasons involving the unit group ${\mathcal{O}}_{F}^{\times}$). In this
section, we are only considering the case $F=\mathbf{Q}$ for convenience, and
so we are still able to use patching arguments with the simpler definitions of
the modules given in this section.

Also here we ‘factor out’ the Galois representation
$\rho^{\operatorname{mod}}$ as above, while we do not do so in Section 6. This
also does not significantly affect the patching argument. See [BKM21, Theorem
6.3] or [Man21, Section 4] for more details on patching arguments in which the
Galois representation is factored out.

In particular, one can prove completely analogous versions of Theorems (CI)
and (CI) for the modules defined in this section, with only minimal
modifications to the proofs. We will leave the details of this to the
interested reader, and for the remainder of the section we will simply cite
the results of Section 6 as if they literally applied to the modules
considered in this section.

We denote by $\langle\ ,\ \rangle$ certain ${\mathcal{O}}$-valued, perfect
$\mathbf{T}$-equivariant pairings on the $\mathbf{T}$-modules

$M(N^{2}Q^{2}),M(NQ),M^{\mathrm{st},{Q}}(N)$

that are induced by Poincare duality (see [BKM21, §9]). We then recall from
[BKM21, §3, Lemma 3.5], that if $X,Y,Z$ are generators of the rank one
${\mathcal{O}}$-modules

$M(N^{2}Q^{2})[\ker(\lambda_{f^{NQ}})],M(NQ)[\ker(\lambda_{f})],M^{\mathrm{st},{Q}}(N)[\ker(\lambda_{f})],$

we have the following relationship:

$\Psi_{\lambda}(M(N^{2}Q^{2}))={\mathcal{O}}/(\langle
X,X\rangle),\Psi_{\lambda}(M(NQ))={\mathcal{O}}/(\langle
Y,Y\rangle),\Psi_{\lambda}(M^{\mathrm{st},{Q}}(N))={\mathcal{O}}/(\langle
Z,Z\rangle).$

Here we are abbreviating all the augmentations arising from the newform $f$ to
$\lambda$.

Let ${\mathcal{A}}_{f}$ stand for the isogeny class of the abelian variety
$A_{f}$ (which is an optimal quotient of $J_{0}(NQ)$). The residual
representations arising from the class ${\mathcal{A}}_{f}$ with respect to the
fixed embedding $K_{f}\hookrightarrow\overline{\mathbf{Q}}_{p}$ are all
isomorphic to our fixed absolutely irreducible $\overline{\rho}$.

######  Theorem (CI).

We have the equality of lengths of ${\mathcal{O}}$-modules:

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(N^{2}Q^{2})))=\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{\ell|N}\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1)+\sum_{q\in
Q}(m_{q}+\operatorname{ord}_{\mathcal{O}}(q^{2}-1)),$

and

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ)))=\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{q\in
Q}m_{q}.$

We have equality of defects
$\delta_{\lambda,\mathbf{T}^{{\mathrm{st}},Q}}(M^{{\mathrm{st}},Q}(N))=\delta_{\lambda,\mathbf{T}^{{\mathrm{st}},Q}}(\mathbf{T}^{{\mathrm{st}},Q})=\sum_{\ell|N}\frac{n_{\ell}}{e}+\sum_{q\in
Q}\frac{2n_{q}}{e}$.

###### Proof.

The proof follows from the following facts:

  1. 1.

We use the exact computation of the length of a relative cotangent space,
namely

$\ell_{\mathcal{O}}(\Phi_{R/R^{{\mathrm{st}},Q}})=\ell_{\mathcal{O}}(\Phi_{\mathbf{T}/\mathbf{T}^{{\mathrm{st}},Q}})=\sum_{\ell|N}(\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1)-n_{\ell})+\sum_{q\in
Q}(m_{q}+\operatorname{ord}_{\mathcal{O}}(q^{2}-1)-2n_{q})$

by a slight variant of the arguments in the proof of [BKM21, Corollary 7.15]
using as key input Theorem (CI) (there the level considered when we relax
ramification conditions is $NQ^{2}$ rather than $N^{2}Q^{2}$, and it is
assumed that $N|N(\overline{\rho})$, but the arguments carry over to our
slightly different situation mutatis mutandis);

  2. 2.

$\delta_{\lambda,\mathbf{T}}(\mathbf{T})=\delta_{\lambda,\mathbf{T}}(M(N^{2}Q^{2}))=0$.
This follows from the arguments in [BKM21, Theorem 5.2] (see also [BKM21,
Remark 5.3, 5.4]) which is proved using the arguments of [Dia97, Theorem 3.4].

  3. 3.

The inequality

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(N^{2}Q^{2})))\leq\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{\ell|N}(\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1))+\sum_{q\in
Q}(m_{q}+\operatorname{ord}_{\mathcal{O}}(q^{2}-1))$

that follows from the following two inequalities:

     * •

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ)))\leq\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{q\in
Q}m_{q}$

which follows from [RT97, Theorem 2]. To justify this, as noted above as a
consequence of [BKM21, §3, Lemma 3.5], we have
$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ)))=\operatorname{ord}_{\mathcal{O}}(\langle
Y,Y\rangle)$ and
$\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))=\operatorname{ord}_{\mathcal{O}}(\langle
Z,Z\rangle)$. Further the ideals generated by the inner products $(\langle
Y,Y\rangle)$ and $(\langle Z,Z\rangle)$ can be read off from the optimal
quotients $\xi$ and $\xi’$ of the isogeny class of abelian varieties ${\cal
A}_{f}$ by the Jacobians of $X_{0}(NQ)$ and $X^{Q}_{0}(N)$ as follows. The
composition $\xi_{*}\xi^{*}$ of the pull-back $\xi^{*}$ and push-forward of
the maps induced by $\xi$ on the ${\rm
Ta}_{\wp}(A)_{{\mathfrak{m}}}={\mathcal{O}}^{2}$ is identified with
multiplication by a scalar in ${\mathcal{O}}$. We denote the ideal of
${\mathcal{O}}$ generated by this scalar by $(\xi_{*}\xi^{*})$. Then $(\langle
Y,Y\rangle)=(\xi_{*}\xi^{*})$. Similarly $(\langle
Z,Z\rangle)=(\xi’_{*}{\xi’}^{*})$. Then (using [RT97, Theorem 2] (in the case
when ${\cal A}_{f}$ is an isogeny class of elliptic curves, and its
generalization to optimal abelian variety quotients in [Kha03]) we see that
the ideal $(\xi_{*}\xi^{*})(\xi’_{*}{\xi’}^{*})^{-1}$ divides the ideal
$(\Pi_{q\in Q}\omega^{m_{q}})$ of ${\mathcal{O}}$ which justifies our claim.

     * •

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(N^{2}Q^{2})))\leq\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ)))+\sum_{\ell|NQ}\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1)$

This statement, in the stronger form of an equality follows easily from the
arguments in Step 2 of proof of [BKM21, Proposition 9.1].

  4. 4.

The inequality

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}))\leq\ell_{\mathcal{O}}(\Psi_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q})),$

which is equivalent to the inequality

$\delta_{\lambda}(M^{{\mathrm{st}},Q}(N))\geq\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}).$

This follows from [BKM21, Theorem 3.12].

  5. 5.

The equality
$\delta_{\lambda,\mathbf{T}^{\mathrm{st},Q}}=\sum_{\ell|N}\frac{n_{\ell}}{e}+\sum_{q|Q}\frac{2n_{q}}{e}$
which is a consequence of our main theorem Theorem (CI). (To deduce this from
our main theorem, we use for $\ell|N$ the local deformation condition
described by $R_{\ell}^{\mathrm{uni}}$ and for $q\in Q$ that described by
$R_{q}^{\mathrm{st}}$.)

Using the first three points (1), (2) and (3) we conclude that
$\delta_{\lambda}(M^{\mathrm{st},Q}(N))\leq\sum_{\ell|N}\frac{n_{\ell}}{e}+\sum_{q|Q}\frac{2n_{q}}{e}$.
Using (4) and (5) we deduce the series of (in)equalities

$\sum_{\ell|N}\frac{n_{\ell}}{e}+\sum_{q\in
Q}\frac{2n_{q}}{e}=\delta_{\lambda,\mathbf{T}^{{\mathrm{st}},Q}}(\mathbf{T}^{{\mathrm{st}},Q})\leq\delta_{\lambda}(M^{\mathrm{st},Q}(N))\leq\sum_{\ell|N}\frac{n_{\ell}}{e}+\sum_{q\in
Q}\frac{2n_{q}}{e}$

and hence

$\delta_{\lambda,\mathbf{T}^{{\mathrm{st}},Q}}(M^{{\mathrm{st}},Q}(N))=\delta_{\lambda,\mathbf{T}^{{\mathrm{st}},Q}}(\mathbf{T}^{{\mathrm{st}},Q})=\sum_{\ell|N}\frac{n_{\ell}}{e}+\sum_{q\in
Q}\frac{2n_{q}}{e}.$

From this using (1) and (2) we conclude that

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(N^{2}Q^{2})))=\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{\ell|N}\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1))+\sum_{q\in
Q}(m_{q}+\operatorname{ord}_{\mathcal{O}}(q^{2}-1)).$

Finally using the two inequalities that occurred in proof of (3) above we
deduce that

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ)))=\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{q\in
Q}m_{q},$

finishing the proof of all parts of the theorem.

∎

We note a variant of the result above which computes defects for the module
$M(NQ)$ when considered as a module for an anemic Hecke algebra and a full
Hecke algebra. The module $M(NQ)$ is a module for the (anemic) Hecke algebra
$\mathbf{T}^{\mathrm{uni}}$, and it is also a module for the (full) Hecke
algebra $\overline{\mathbf{T}^{\mathrm{uni}}}$ (and thus
$U_{v}\in\overline{\mathbf{T}}^{\mathrm{uni}}$ for all primes $v$ dividing
$NQ$) that acts faithfully on $M(NQ)$. The augmentation
$\lambda:\mathbf{T}^{\mathrm{uni}}\to{\mathcal{O}}$ extends uniquely to
$\lambda’:\overline{\mathbf{T}}^{\mathrm{uni}}\to{\mathcal{O}}$, and
$\lambda’(U_{v})=\pm 1$ for $v|NQ$. We determine next the defects
$\delta_{\lambda’,\overline{\mathbf{T}}^{\mathrm{uni}}}(M(NQ))$ and
$\delta_{\lambda,\mathbf{T}^{\mathrm{uni}}}(M(NQ))$.

######  Proposition (CI).

(i)

$\delta_{\lambda,\overline{\mathbf{T}}^{\mathrm{uni}}}(M(NQ))=\delta_{\lambda}(\overline{\mathbf{T}}^{\mathrm{uni}})=\sum_{v|NQ}\frac{3n_{v}}{e}$.

(ii)

$\delta_{\lambda,\mathbf{T}^{\mathrm{uni}}}(M(NQ))=\delta_{\lambda,\mathbf{T}^{\mathrm{uni}}}(\mathbf{T}^{\mathrm{uni}})=\sum_{v|NQ}\frac{n_{v}}{e}$.

###### Proof.

(i) By Theorem (CI),
$\delta_{\lambda}(\overline{\mathbf{T}}^{\mathrm{uni}})=\sum_{v|NQ}\frac{3n_{v}}{e}$.
Using arguments pioneered by Mazur to prove mod $p$ multiplicity one
statements (see for instance [Wil95, Theorem 2.1] for an example of this type
of argument, note that under our hypothesis $(p,NQ)=1$), one sees that $M(NQ)$
is a free $\overline{\mathbf{T}}^{\mathrm{uni}}$-module, and thus
$\delta_{\lambda,\overline{\mathbf{T}}^{\mathrm{uni}}}(M(NQ))=\delta_{\lambda}(\overline{\mathbf{T}}^{\mathrm{uni}})$.

(ii) In this case we argue as in the proof of Theorem (CI) except that the
proof is easier. Namely we first observe that

$\ell_{\mathcal{O}}(\Phi_{R/R^{\mathrm{uni}}})=\sum_{\ell|NQ}(\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1)-n_{\ell}))$

by a slight variant of the arguments in the proof of [BKM21, Corollary 7.15].
Further

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(N^{2}Q^{2})))=\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ)))+\sum_{\ell|NQ}\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1).$

This together with $\delta_{\lambda,\mathbf{T}}(M(N^{2}Q^{2}))=0$, proves that
$\delta_{\lambda,\mathbf{T}^{\mathrm{uni}}}(M(NQ))=\sum_{v|NQ}\frac{n_{v}}{e}$.
Theorem (CI) gives that
$\delta_{\lambda}(\mathbf{T})=\sum_{v|NQ}\frac{n_{v}}{e}$, and thus altogether
we get that
$\delta_{\lambda,\mathbf{T}^{\mathrm{uni}}}(M(NQ))=\delta_{\lambda,\mathbf{T}^{\mathrm{uni}}}(\mathbf{T}^{\mathrm{uni}})=\sum_{v|NQ}\frac{n_{v}}{e}$.
∎

######  Remark (CI).

We could prove Proposition (CI)(i) by a different method that exploits the
equality of congruence modules
$\Psi_{\lambda,\overline{\mathbf{T}}^{\mathrm{uni}}}(M(NQ))=\Psi_{\lambda,\mathbf{T}^{\mathrm{uni}}}(M(NQ))$.
This should follow from [BKM21, Lemm 3.4] (see also [BIK21, Lemma 3.7]) on
using the fact that
$M(NQ)[\ker(\lambda)]=M(NQ)[\ker(\lambda’)]={\mathcal{O}}$. Then we have to
compute the change of the local cotangent space at $v$ when we consider the
induced augmentations of the map of local deformation rings
$R_{v}^{\mathrm{uni}}\to\overline{R}_{v}^{\mathrm{uni}}$. We have not done
this computation but one can make the educated guess that the difference of
the lengths of the respective cotangent spaces is $2n_{v}$. This would also
compute the defects when we consider $M(NQ)$ as a module for Hecke algebras
that have $U_{v}$ in them for only a subset $\Sigma$ of places that divide
$NQ$, our educated guess for this defect is

$\sum_{v\in\Sigma}\frac{3n_{v}}{e}+\sum_{v|NQ,v\notin\Sigma}\frac{n_{v}}{e}.$

From Theorem (CI) it is easy to deduce the formula for the change of degrees
of optimal parametrizations of elliptic curves by Shimura curves which may be
summarized in the following formula (compare to [RT97, Theorem 1]).

######  Corollary (CI).

Let $\cal E$ be an isogeny class of semistable elliptic curves over
$\mathbf{Q}$ of conductor $N$, and $p$ be a prime such that the mod $p$
representation arising from $\cal E$ is irreducible. We also assume that $p$
is prime to $N$. Conisder a factorisation $N=D\cdot(N/D)$ with $D$ having an
even number of prime factors an optimal parametrization $X_{0}^{D}(N/D)\to E$
with $E\in\cal E$, and let $\delta_{D}$ be its degree. Then for primes $q,r$
such that $qr|D$, the $p$-part of

$\displaystyle{\delta_{D/qr}\over\delta_{D}}$

and the $p$-part of $c_{q}c_{r}$ are equal where $c_{q},c_{r}$ are the orders
of the component groups of any $E\in\cal E$ at the primes $q$ and $r$.

###### Proof.

The result follows from the first part of Theorem (CI) and the well known
relation between congruence modules and degrees. We leave the details to the
interested reader. ∎

We get results about the surjectivity of maps on component groups at primes
$q$ of multiplicative reduction of elliptic curves $E$ that are induced by
parametrizations of $E$ by Shimura curves whose Jacobians have purely toric
reduction at $q$ (compare to the the arguments on [RT97, page 11113]).

######  Corollary (CI).

With the notation of the previous corollary, for a prime $q|D$, the map
induced by an optimal parametrization $X_{0}^{D}(N/D)\to E$ on the $p$-parts
of the component groups $\phi_{q}(J_{0}^{D}(N/D))\to\phi_{q}(E)$ is
surjective.

###### Proof.

This follows from the corollary above and [RT97, Proposition 2]. ∎

###  7.1 Some remarks about Theorem (CI)

  * •

The first part of Theorem (CI) was proved in [BKM21, Proposition 9.1], using
the methods of [RT97], in particular [RT97, Theorem 1]. We have reverse
engineered the arguments of [BKM21, Proposition 9.1], and are able to deduce
[RT97, Theorem 1] below by a different method which is more robust. We still
use [RT97, Theorem 2] to prove upper bounds on change of congruence modules
(or equivalently degrees of parametrizations)

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ)))\leq\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{q\in
Q}m_{q}$

but not the less robust and delicate methods of the proof of the second part
of [RT97, Theorem 1, see also page 11113], which show that these upper bounds
in fact give exactly the change of lengths of the congruence modules. We view
the correct upper bounds on change of congruence modules, when we relax
deformation conditions at primes in $Q$ (from Steinberg to unrestricted with
fixed determinant) as “easier” than the corresponding correct lower bounds
(correctness lying in the fact that the bounds are expected to turn into
equalities). In the analogous case of lengths of relative cotangent spaces,
the inequality

$\ell_{\mathcal{O}}(\Phi_{R/R^{\mathrm{st}}})\leq\sum_{\ell|N}(\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1)-n_{\ell})+\sum_{q\in
Q}(m_{q}+\operatorname{ord}_{\mathcal{O}}(q^{2}-1)-2n_{q})$

follows purely from local arguments: see [BKM21, Proposition 7.9] for the
local computation, and also note that the surjectivity of the map
$\Phi_{\lambda,R_{\infty}/R_{\infty}^{\mathrm{st}}}\rightarrow\Phi_{\lambda,R/R^{\mathrm{st}}}$
of [BKM21, Theorem 7.14] is elementary. The injectivity of this map which is
proved in [BKM21, Theorem 7.14] lies deeper and uses patching arguments. Thus
the heuristic that we justify by our work here is that (correct) upper bounds
on change of congruence modules, or change of cotangent spaces, are “easy” and
our methods allow one to convert these upper bounds to equalities using the
methods of this paper.

  * •

The proof of [RT97, Theorem 1, part 2] on page 11113 depends on the hypothesis
that $N/D$ is not prime (that is used to “permute” primes around there) which
we can dispense with in Corollary (CI).

  * •

Using (a straightforward modification of) of [BKM21, Theorem 5.2] and [BKM21,
Theorem 8.1, Cor. 8.3] (which considered $M(NQ^{2})$ rather than
$M(N^{2}Q^{2})$), and under the assumption that $N|N(\overline{\rho})$ of
[BKM21] we know from [BKM21] that

$\Psi_{\lambda}(M(N^{2}Q^{2}))=\Psi_{\lambda}(\mathbf{T}),\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N))=\Psi_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}).$

On the other hand using Theorem (CI), together with [BKM21, Proposition 7.9,
Corollary 7.15] we know that

$\ell_{\mathcal{O}}(\Psi_{\lambda}(\mathbf{T}))=\ell_{\mathcal{O}}(\Psi_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}))+\sum_{\ell|N}\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1)+\sum_{q\in
Q}(m_{q}+\operatorname{ord}_{\mathcal{O}}(q^{2}-1)).$

Combining this we can deduce the first part

$\ell_{\mathcal{O}}(\Psi_{\lambda}(M(NQ^{2})))=\ell_{\mathcal{O}}(\Psi_{\lambda}(M^{{\mathrm{st}},Q}(N)))+\sum_{\ell|N}\operatorname{ord}_{\mathcal{O}}(\ell^{2}-1)+\sum_{q\in
Q}(m_{q}+\operatorname{ord}_{\mathcal{O}}(q^{2}-1))$

of the theorem above. The arguments given in Theorem (CI) use Theorem (CI) to
deduce numerically the equality of cohomological and ring theoretic defects,
or equivalently of lengths as ${\mathcal{O}}$-modules of ring theoretic and
cohomological congruence modules, seem more versatile and apply in cases where
the arguments of [BKM21, Corollary 8.3 ] do not apply, and do not use the
assumption that $N|N(\overline{\rho})$.

  * •

Corollary (CI) does not seem accessible via the methods of [RT97] in the case
of $D$ divisible by some trivial primes for the mod $p$ representation arising
from $E$ and $D$ is prime to $N(\overline{\rho})$. Both the above corollaries
should easily generalize to elliptic curves over $\mathbf{Q}$ that are not
semistable. In [RT97] ingenious arguments are used to get round the fact that
one does not have general proofs of surjectivity of maps
$\phi_{q}(J_{0}^{D}(N/D))\to\phi_{q}(E)$ on the $p$-part of component groups.
It is not hard to prove this surjectivity by geometric means when $q$ is not 1
mod $p$, but as far the authors know in the case when $q$ is a trivial prime
for the Galois representation arising from $E[p]$ there is no geometric proof
available.

  * •

The argument here should generalize easily to the case of totally real fields
$F$ using analogs of Ribet sequences relating character groups of reductions
of modular curves and Shimura curves as in [Jar99]. It should also generalize
without too much difficulty to the case of newforms of weight $k>2$. There are
some related results in [KO19], they only consider situations where the Hecke
algebras are complete intersections and hence of defect 0. The assumption that
$N$ is squarefree is also not eseential to our methods, the results given here
are more illustrative than exhaustive.

  * •

We assumed in this section that $f$ was a newform of level $NQ$, and so in
particular $\rho_{f}$ ramifies at each prime dividing $N$. It it possible to
prove the equality of cohomological and ring theoretic defects somewhat more
generally by using the arguments of [Dia97].

Specifically, assume that $f$ is a newform of level $N_{\varnothing}Q$ for
some integer $N_{\varnothing}$. Then Theorem (CI) gives an equality
$\delta_{\lambda}(M^{{\mathrm{st}},Q}(N_{\varnothing}))=\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}(N_{\varnothing}))$.

Now let $\Sigma$ be a finite set of primes not containing any primes dividing
$N_{\varnothing}Q$, and let $N_{\Sigma}$ be the level considered in [Dia97,
Section 3.2]. The inequalities given in the proof of [Dia97, Theorem 3.4]
(which in our case rely on Ihara’s Lemma for the Shimura curves
$X^{Q}_{0}(N)$) then show that
$\delta_{\lambda}(M^{{\mathrm{st}},Q}(N_{\Sigma}))\leq\delta_{\lambda}(M^{{\mathrm{st}},Q}(N_{\varnothing}))$.

But now for each prime $q\in\Sigma$, one has that $R_{q}^{\operatorname{min}}$
and $R_{q}^{\square}$ are both complete intersections. The work of Section 6
then implies that
$\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}(N_{\varnothing}))=\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}(N_{\Sigma}))$.
One then deduces that

$\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}(N_{\Sigma}))\leq\delta_{\lambda}(M^{{\mathrm{st}},Q}(N_{\Sigma}))\leq\delta_{\lambda}(M^{{\mathrm{st}},Q}(N_{\varnothing}))=\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}(N_{\varnothing}))=\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}(N_{\Sigma}))$

and so
$\delta_{\lambda}(\mathbf{T}^{{\mathrm{st}},Q}(N_{\Sigma}))=\delta_{\lambda}(M^{{\mathrm{st}},Q}(N_{\Sigma}))$
for all $\Sigma$, generalizing Theorem (CI). By a similar argument, one can
also generalize Proposition (CI).

##  Appendix A A formula of Venkatesh by N. Fakhruddin and C. Khare

The results of this section are inspired by unpublished notes of A. Venkatesh
[Ven16]. Venkatesh’s formula was stated (as a conjecture, but it was checked
in many cases) for certain derived commutative rings, but we prove a version
in the context of ordinary commutative algebra; we briefly explain the
connection in Section A.1. The invariants $c_{0}$ and $c_{1}$ are essentially
the same as those defined in [Ven16], but our method of proof is different
from the approach taken there. The formula is used in the main text to compute
the Wiles defect for certain Hecke algebras that are not complete
intersections.

Let $\mathcal{O}$ be a complete dvr and consider $B$, a complete local
Noetherian $\mathcal{O}$-algebra with $\dim(B)=1$ and with an augmentation
$\pi_{B}:B\to{\mathcal{O}}$. Let $E$ be the quotient field of $\mathcal{O}$
which we view as a module over any augmented ring using the augmentation. We
assume that the augmentation has a finite cotangent space, by which we mean
that $\ker(\pi_{B})/\ker(\pi_{B})^{2}$ is a finite length $\mathcal{O}$-module
. Let $C$ be the largest Cohen–Macaulay quotient of $B$ — if $B$ is finite
over $\mathcal{O}$ then this is simply the quotient of $B$ by its
$\mathcal{O}$-torsion (which is an ideal)—and let $\pi_{C}:C\to{\mathcal{O}}$
be the augmentation of $C$ induced by $\pi_{B}$.

######  Definition (CI).

$c_{0}(B):=\ell({\mathcal{O}}/\pi_{C}(\operatorname{Ann}(\ker(\pi_{C}))))$.

Since $B$ is complete, we may write it as a quotient of
$S={\mathcal{O}}[[x_{1},x_{2},\dots,x_{n}]]$ for some $n\geq 0$. Then by the
prime avoidance lemma ([BH93, Lemma 1.2.2]), we may find a quotient $A$ of $S$
through which the map to $B$ factors and such that $A$ is a complete
intersection ring with $\dim(A)=1$. Denote this map $A\to B$ by $\phi_{B}$ and
the induced map $A\to{\mathcal{O}}$ by $\pi_{A}$. We may (and do) choose $A$
such that $\ker(\pi_{A})/\ker(\pi_{A})^{2}$ is a finite length
$\mathcal{O}$-module. Furthermore, if $B$ is finite over $\mathcal{O}$ the
lemma also allows us to choose $A$ finite over $\mathcal{O}$.

Let $\mathbf{x}$ be a sequence of generators of $\ker(\phi_{B})$ of length