-1$. By (2), $r_x\operatorname{ord}_c\Phi$ is an integer, so the logarithmic order at $x\in D_C$ is at least $1$ if and only if $\operatorname{ord}_c\Phi>0$; and a section of $\rho^*\omega^{\otimes(k-2)}\otimes\Omega^1_C(\log D_C)$ of logarithmic order at least $1$ along $D_C$ is a section of $\rho^*\omega^{\otimes(k-2)}\otimes\Omega^1_C$. Every $\tau_0\in\mathbb H$ and every cusp of $\Gamma$ lies under some point of $C$, as $C\to X'\to X_\Gamma$ is surjective, and $\omega_\Phi\neq0$ if and only if $\Phi\neq0$. This proves (3).
\end{proof}
\begin{lemma}\label{lem:v5_hod_pos_the}
Assume that the datum is admissible. Let $H_{a,p}$ be the eigenlattice of the model and $\omega_\Phi$ the twisted differential on $C$.
\begin{enumerate}
\item $\omega_\Phi$ is a global section over $C$ of $\rho^*\omega^{\otimes(k-2)}\otimes\Omega^1_{C/\mathcal O_{L,(\mathfrak P)}}\subset\operatorname{Fil}^{k-2}M_k\otimes\Omega^1_C(\log D_C)$, and $g^*\omega_\Phi=\chi_\Phi(g)\,\omega_\Phi$ for every $g\in\tilde G$.
\item Let $\infty_C$ be a point of $C$ over the cusp $\infty'$ of (M5), defined over a finite unramified extension $W$ of $\mathbb Z_p$, and let $Q=s\,(t/q)^{-1/d}$ in the completed local ring of $C_W$ at $\infty_C$, so that $Q^d=q$. The restriction of $\omega_\Phi$ to the formal neighbourhood of $\infty_C$ is $f_\Phi(Q)\,\omega_{\mathrm{can}}^{\otimes(k-2)}\otimes\frac{dQ}Q$, and $f_\Phi\in Q^j\,\mathbb Z_{(p)}[[Q^d]]$.
\item The class $[\omega_\Phi]$ lies in $H_{a,p}$ and spans $\operatorname{Fil}^{k-1}(H_{a,p}\otimes\mathbb Q_p)=\operatorname{Fil}^1(H_{a,p}\otimes\mathbb Q_p)$.
\end{enumerate}
\end{lemma}
\begin{proof}
\emph{Rationality and the eigen-property.} By (M4) of Definition~\ref{def:v5_mod_mod_kum}, $f\omega^{\otimes(k-2)}$ is a rational section of $\omega^{\otimes(k-2)}$ over $X'_L$, and $R(t)\,s^{j-1}ds$ is a rational differential on $C_L$; so $\omega_\Phi$ is a rational section of the line bundle $\mathcal L=\rho^*\omega^{\otimes(k-2)}\otimes\Omega^1_{C/\mathcal O_{L,(\mathfrak P)}}$ on the smooth $\mathcal O_{L,(\mathfrak P)}$-scheme $C$ (Lemma~\ref{lem:v5_smo_kum_cov}). Let $g=(h,\zeta)\in\tilde G$. Since $\rho\circ h=h\circ\rho$, (M4) gives $h^*\rho^*(f\omega^{\otimes(k-2)})=\chi_G(h)\,\rho^*(f\omega^{\otimes(k-2)})$, and $h$ fixes $t$ and $s$; the automorphism $[\zeta]$ satisfies $\rho\circ[\zeta]=\rho$ and $[\zeta]^*(s^{j-1}ds)=\zeta^js^{j-1}ds$. Hence $g^*\omega_\Phi=\chi_\Phi(g)\,\omega_\Phi$.
\emph{Holomorphy on the generic fibre.} By (M4), the component $X'_0$ of $X'_{\mathbb C}$ is $\Gamma'\backslash\mathbb H^*$ with $\Gamma'$ as in Lemma~\ref{lem:v5_ord_the_twi}, $E$ restricts to the universal curve, and $f\omega^{\otimes(k-2)}$ restricts to $f(\tau)(2\pi i\,dz)^{\otimes(k-2)}$; so on the part of $C_{\mathbb C}$ over $X'_0$, $\omega_\Phi$ is the section of Lemma~\ref{lem:v5_ord_the_twi}. As the datum satisfies (F), Lemma~\ref{lem:v5_ord_the_twi}(3) shows that $\omega_\Phi$ is a holomorphic section of $\mathcal L$ there. The group $\tilde G$ permutes the components of $C_{\mathbb C}$ transitively ($G$ those of $X'_{\mathbb C}$, as $X'_L/G\cong\mathbb P^1_L$ is geometrically connected, and $\mu_d$ those over a given one) and acts on $\mathcal L$ by bundle automorphisms, and $\omega_\Phi$ is an eigensection; so $\omega_\Phi$ is holomorphic on all of $C_{\mathbb C}$, and the horizontal part of its divisor on $C$ is effective.
\emph{Proof of (2).} Over $\operatorname{Spf}W[[q']]$, (M5) gives $E=\mathrm{Tate}(q)$, $t$ equal to the $q$-expansion of the Hauptmodul, and $f\omega^{\otimes(k-2)}=F(t)\,\omega_{\mathrm{can}}^{\otimes(k-2)}=f(q)\,\omega_{\mathrm{can}}^{\otimes(k-2)}$. By Definition~\ref{def:v5_kum_twi_dat}, $t/q\in1+q\,\mathbb Z_{(p)}[[q]]$, so $(t/q)^{-1/d}$ is given by the binomial series, which has coefficients in $\mathbb Z[\frac1d]\subset\mathbb Z_{(p)}$ as $p\nmid d$; thus $Q=s\,(t/q)^{-1/d}$ lies in the completed local ring of $C_W$ at $\infty_C$ and $Q^d=s^d\,q/t=q$. Using $s^{j-1}ds=\frac1d\,s^j\frac{dt}t$, $s^j=Q^j(t/q)^a$, $\frac{dt}t=\frac qt\frac{dt}{dq}\frac{dq}q$ and $\frac{dq}q=d\,\frac{dQ}Q$,
\[
\omega_\Phi=f\,R(t)\,Q^j\,(t/q)^a\,\frac qt\frac{dt}{dq}\;\omega_{\mathrm{can}}^{\otimes(k-2)}\otimes\frac{dQ}Q=f_\Phi(Q)\,\omega_{\mathrm{can}}^{\otimes(k-2)}\otimes\frac{dQ}Q,
\]
the last equality being the definition of the coefficients $c(N)$ in Definition~\ref{def:v5_kum_twi_dat}. The same definition gives $f_\Phi=Q^j\cdot(\text{a series in }Q^d=q)$ with coefficients in $\mathbb Z[\frac1{dM}]\subset\mathbb Z_{(p)}$, as $p\nmid dM$. This proves (2).
For (1) it remains to show that the vertical part of the divisor of $\omega_\Phi$ is effective; it has one multiplicity for each connected component of $C\otimes W(\bar{\mathbb F}_p)$. On the component containing $\infty_C$ the multiplicity is $\geq0$: by (2), on the formal neighbourhood of $\infty_C$ the section is $f_\Phi(Q)\,\omega_{\mathrm{can}}^{\otimes(k-2)}\otimes\frac{dQ}Q$ with integral coefficients, where $\frac{dQ}Q=w'\frac{du}u$ for a formal parameter $u$, and $f_\Phi$ is divisible by $Q^j$, hence by $u$, so the section is integral there. The group $\tilde G$ acts on $C\otimes\mathbb Z_p$ and on $\mathcal L$ over $\mathbb Z_p$, permutes these components transitively (they correspond to the components of the generic fibre, $C$ being smooth and proper), and $\omega_\Phi$ is an eigensection with eigenvalues $\chi_\Phi(g)\in\mathbb Z_p^\times$; so all vertical multiplicities agree and are $\geq0$. Hence $\omega_\Phi\in H^0(C,\mathcal L)$. Since $\Omega^1_C\subset\Omega^1_C(\log D_C)$ and $\rho^*\omega^{\otimes(k-2)}=\operatorname{Fil}^{k-2}M_k$, this proves (1).
\emph{Proof of (3).} The section $\omega_\Phi$ of $\operatorname{Fil}^{k-2}M_k\otimes\Omega^1_C(\log D_C)$ defines a class in $\operatorname{Fil}^{k-1}H_{\mathbb Z}$, represented on any affine cover by the cocycle $(\omega_\Phi|_{U_i},0)$. It is a $\chi_\Phi$-eigenvector by (1), and its residue at every point of $D_C$ vanishes because $\omega_\Phi$ is a section of $\rho^*\omega^{\otimes(k-2)}\otimes\Omega^1_C$; by the proof of Lemma~\ref{lem:v5_par_eig_the}(3), $\operatorname{Res}_z$ is the constant term of the $e_0$-coefficient of the residue. So $[\omega_\Phi]\in H_{a,p}$. We show $[\omega_\Phi]\neq0$ in $H_{\mathbb Z}\otimes\mathbb Q_p$. If it were zero, the cocycle $(\omega_\Phi|_{U_i},0)$ would be the coboundary of sections $m_i$ with $m_j-m_i=0$, that is, $\omega_\Phi=\nabla m$ for a global section $m$ of $M_k$ over $C_{\mathbb Q_p}$. As in the proof of Lemma~\ref{lem:v5_par_eig_the}(1): the image of $m$ in $\operatorname{gr}^0M_k=\rho^*\omega^{\otimes(2-k)}$ vanishes, $\rho^*\omega$ having positive degree on every component; and if $m\in\operatorname{Fil}^i$ with $1\leq i\leq k-2$, the component of $\nabla m=\omega_\Phi$ in $\operatorname{gr}^{i-1}M_k\otimes\Omega^1_C(\log D_C)$ is $i\,\kappa(\bar m_i)$, while that of $\omega_\Phi\in\operatorname{Fil}^{k-2}M_k\otimes\Omega^1_C(\log D_C)$ is zero since $i-1 2$ this holds because $\mathbb P^1$ is a curve \cite{locbib:Deligne1974}, (1.10). Let $\bar\eta$ be a geometric generic point of $U_{\bar{\mathbb F}_p}$ and $x_0$ a geometric point of $\mathbb P^1_{\mathbb F_p}$ over $t=0$, with inertia group $I_{x_0}$; by Lemma~\ref{lem:v5_eta_eig_twi}(5), $I_{x_0}$ has neither nonzero invariants nor nonzero coinvariants on $\mathcal F_{\bar a,\bar\eta}$. By \cite[(1.4.1.1), (1.4.1.3)]{locbib:Deligne1980}, $H^0(\mathbb P^1_{\bar{\mathbb F}_p},o_*\mathcal F_{\bar a})$ is the space of invariants and $H^2(\mathbb P^1_{\bar{\mathbb F}_p},o_*\mathcal F_{\bar a})$ the Tate twist of the space of coinvariants of $\pi_1(U_{\bar{\mathbb F}_p},\bar\eta)$ on $\mathcal F_{\bar a,\bar\eta}$; both vanish, as the invariants and the coinvariants of $I_{x_0}$ do. Now Grothendieck's trace formula \cite[(1.4.5.1)]{locbib:Deligne1980}, in its trace form over $\mathbb F_p$, applied to the constructible $L_\lambda$-sheaf $o_*\mathcal F_{\bar a}$ on the proper curve $\mathbb P^1_{\mathbb F_p}$, gives
\[
A_{\mathfrak P}=\operatorname{Tr}\bigl(F\mid V_{\bar a}\bigr)=-\sum_{x\in\mathbb P^1(\mathbb F_p)}\operatorname{Tr}\bigl(\mathrm{Frob}_x\mid(o_*\mathcal F_{\bar a})_{\bar x}\bigr).
\]
As $0,\infty\in S$, $U(\mathbb F_p)=\mathbb F_p\setminus S(\mathbb F_p)$, and by Lemma~\ref{lem:v5_eta_eig_twi}(2) the stalk of $\mathcal F_{\bar a}=\mathbb V_{\chi_G^{-1}}\otimes\mathcal L_{-j}$ at $x\in U(\mathbb F_p)$ has trace $(x/\mathfrak P)_d^{-j}\operatorname{Tr}(\mathrm{Frob}_x\mid\mathbb V_{\chi_G^{-1},\bar x})$. Splitting the sum into $x\in U(\mathbb F_p)$ and $x\in S(\mathbb F_p)$ gives (3).
\textbf{Step 6.} $A_{\mathfrak P}$ is integral. By Step 5, $A_{\mathfrak P}=-\sum_{x\in\mathbb P^1(\mathbb F_p)}\operatorname{Tr}(\mathrm{Frob}_x\mid(o_*\mathcal F_{\bar a})_{\bar x})$, and $A_{\mathfrak P}\in L$ by Step 4; so it suffices that each eigenvalue of each $\mathrm{Frob}_x$ on $(o_*\mathcal F_{\bar a})_{\bar x}$ be an algebraic integer. This stalk is a $\mathrm{Frob}_x$-stable subspace of $(o_*\varpi_*M_\ell)_{\bar x}=(\bar\varpi_*o_*M_\ell)_{\bar x}=\bigoplus_{y\in\bar\varpi^{-1}(\bar x)}(o_*M_\ell)_{\bar y}$ (proper base change for the finite $\bar\varpi$), on which $\mathrm{Frob}_x$ permutes the summands. If $y$ lies in an orbit of length $r$, $\mathrm{Frob}_x^r$ acts on $(o_*M_\ell)_{\bar y}$ as the geometric Frobenius of the $\mathbb F_{p^r}$-rational point $y$: for $y\notin D_C$ as $\operatorname{Sym}^{k-2}$ of the Frobenius of the elliptic curve $E_{\rho(y)}$ over $\mathbb F_{p^r}$, whose eigenvalues are algebraic integers of absolute value $p^{r/2}$ \cite{locbib:Silverman2009}, Theorem V.1.1 and V.2.3.1; for $y\in D_C$ trivially, the Galois group acting trivially on the invariant line (proof of Lemma~\ref{lem:v5_loc_ter_agr}, at the cusps). So every eigenvalue of $\mathrm{Frob}_x$ on the direct sum is an $r$-th root of an algebraic integer, hence an algebraic integer.
\textbf{Step 7.} Purity gives the weights in (4). The same description shows that for every $r\geq1$ and $x\in U(\mathbb F_{p^r})$ every eigenvalue of $\mathrm{Frob}_x$ on $\mathcal F_{\bar a,\bar x}$ has absolute value $p^{r(k-2)/2}$ under every complex embedding: $\mathcal F_{\bar a}$ is pointwise pure of weight $k-2$. By \cite{locbib:Deligne1980}, Th\'eor\`eme (3.2.3), applied for every isomorphism $\bar{\mathbb Q}_\ell\cong\mathbb C$, the eigenvalues $\alpha',\beta'$ of $F$ on $V_{\bar a}=H^1(\mathbb P^1_{\bar{\mathbb F}_p},o_*\mathcal F_{\bar a})$ have absolute value $p^{(k-1)/2}$ under every complex embedding of $\mathbb Q(\alpha',\beta')$. Extending $\sigma$ to $L(\alpha',\beta')$, $|\sigma(A_{\mathfrak P})|=|\sigma\alpha'+\sigma\beta'|\leq2p^{(k-1)/2}$ and $|\sigma(\varepsilon_{\mathfrak P})|=|\sigma(\alpha'\beta')|/p^{k-1}=1$.
\textbf{Step 8.} The stalks at the points of $S$, (5). Let $D$ be the reduction of $\bar S$, a finite set of closed points of $\mathbb P^1_{\mathbb F_p}$ because $\bar S$ is finite and \'etale over $\mathcal O$ (Lemma~\ref{lem:v5_eta_eig_twi}(1)), so that $U_{\mathbb F_p}=\mathbb P^1_{\mathbb F_p}\setminus D$, and let $x\in S(\mathbb F_p)$, a point of $D$. The stalk of $o_*\mathcal F_{\bar a}$ at $\bar x$ is the space of invariants of a local monodromy group \cite{locbib:Deligne1974}, (2.11): the strict henselisation of $\mathbb P^1_{\bar{\mathbb F}_p}$ at $x$ is a henselian discrete valuation ring whose fraction field has absolute Galois group $I_x$, so $(o_*\mathcal F_{\bar a})_{\bar x}=\mathcal F_{\bar a,\bar\eta}^{I_x}$; as $x$ is $\mathbb F_p$-rational, $\mathrm{Frob}_x$ acts on it through a Frobenius element of a decomposition group at $x$, which normalises $I_x$. The isomorphism $\mathcal F_{\bar a}\cong\mathbb V_{\chi_G^{-1}}\otimes\mathcal L_{-j}$ of Lemma~\ref{lem:v5_eta_eig_twi}(2) on $U_{\mathbb F_p}$ identifies this space, compatibly with $\mathrm{Frob}_x$, with $(\mathbb V_{\chi_G^{-1}}\otimes\mathcal L_{-j})_{\bar\eta}^{I_x}$. This proves (5).
\textbf{Step 9.} Complex conjugation, (6). The field $L$ is generated over $\mathbb Q$ by roots of unity and square roots of integers (Definition~\ref{def:v5_exc_set_kum}), so it is abelian over $\mathbb Q$. Let $\sigma:L\to\mathbb C$ be an embedding. As $L\subset\mathbb C$ is Galois over $\mathbb Q$, $\sigma$ is the restriction of some $\tau\in\operatorname{Gal}(L/\mathbb Q)$, and complex conjugation restricts to an automorphism $\xi\mapsto\bar\xi$ of $L$; since $\operatorname{Gal}(L/\mathbb Q)$ is abelian,
\[
\overline{\sigma(\xi)}=\overline{\tau(\xi)}=\tau(\bar\xi)=\sigma(\bar\xi)\qquad(\xi\in L).
\]
Let $\alpha'$, $\beta'$ be the roots of $X^2-A_{\mathfrak P}X+\varepsilon_{\mathfrak P}p^{k-1}$, the eigenvalues of $F$ on $V_{\bar a}$, and extend $\sigma$ to an embedding $\tilde\sigma$ of $L(\alpha',\beta')$ in $\mathbb C$. By (4), $|\tilde\sigma\alpha'|^2=|\tilde\sigma\beta'|^2=p^{k-1}$, so $\overline{\tilde\sigma\alpha'}=p^{k-1}/\tilde\sigma\alpha'$ and $\overline{\tilde\sigma\beta'}=p^{k-1}/\tilde\sigma\beta'$. As $\tilde\sigma\alpha'+\tilde\sigma\beta'=\sigma(A_{\mathfrak P})$ and $\tilde\sigma\alpha'\,\tilde\sigma\beta'=\sigma(\varepsilon_{\mathfrak P})p^{k-1}$,
\[
\sigma\bigl(\overline{A_{\mathfrak P}}\bigr)=\frac{p^{k-1}}{\tilde\sigma\alpha'}+\frac{p^{k-1}}{\tilde\sigma\beta'}=\frac{\sigma(A_{\mathfrak P})}{\sigma(\varepsilon_{\mathfrak P})},\qquad\sigma\bigl(\overline{\varepsilon_{\mathfrak P}}\bigr)=\frac{\overline{\tilde\sigma\alpha'}\;\overline{\tilde\sigma\beta'}}{p^{k-1}}=\frac1{\sigma(\varepsilon_{\mathfrak P})}.
\]
As $\sigma$ is injective, $\overline{A_{\mathfrak P}}=A_{\mathfrak P}/\varepsilon_{\mathfrak P}$ and $\overline{\varepsilon_{\mathfrak P}}=\varepsilon_{\mathfrak P}^{-1}$. The last assertion of (6) is then the second sentence of (2).
\end{proof}
\begin{lemma}\label{lem:v5_twi_lef_for}
Let $H_{\mathrm{cris}}\subset H_{\mathbb Z}\otimes\mathbb Q_p$ be the subspace of classes all of whose residues $\operatorname{Res}_z$ vanish, with the action $x\mapsto g^*x$ of $\tilde G$ of Lemma~\ref{lem:v5_par_eig_the}(1). Let $\widehat C$ be the $p$-adic completion of $C\otimes\mathbb Z_p$, regard $M_k$ as an $F$-crystal with logarithmic singularities on $(\widehat C,\widehat D_C)$ in the sense of \cite{locbib:Scholl1985Trace}, 1.5, and let $\Omega^\bullet(M_k)$ be the complex of loc.\ cit., 2.5. Put $C_0=C\otimes\mathbb F_p$, $C_0^\circ=C_0\setminus D_C$ and $o:C_0^\circ\hookrightarrow C_0$. Let $\ell\neq p$ be a prime, $\lambda$ a prime of $L$ above $\ell$, $M_\ell=\rho^*\operatorname{Sym}^{k-2}R^1\pi_{E*}\mathbb Q_\ell\otimes_{\mathbb Q_\ell}L_\lambda$ on $C_0^\circ$, for the structure map $\pi_E:E\to X'$, with the action of $\tilde G$ by the maps $\zeta^\sharp g^\sharp$, where $g^\sharp=c_g\operatorname{Sym}^{k-2}(\pi_g^*)\circ g^*$ and $\zeta^\sharp=[\zeta]^*$, and $H_\ell=H^1(C_{0,\bar{\mathbb F}_p},o_*M_\ell)$, with the geometric Frobenius $F$ and the induced right action $g\mapsto g^*$. For $n\geq1$ put $q=p^n$, let $\mathrm{Fr}_q$ be the $q$-power Frobenius endomorphism of $C_{\bar{\mathbb F}_p}$, and for $g\in\tilde G$ put
\[
\operatorname{Fix}_q(g)=\{y\in C(\bar{\mathbb F}_p):\ \mathrm{Fr}_q(y)=g(y)\}.
\]
\begin{enumerate}
\item $H^i(\widehat C,\Omega^\bullet(M_k))\otimes\mathbb Q_p=0$ and $H^i(C_{0,\bar{\mathbb F}_p},o_*M_\ell)=0$ for $i\neq1$, and $H^1(\widehat C,\Omega^\bullet(M_k))\otimes\mathbb Q_p=H_{\mathrm{cris}}$.
\item Let $n\geq1$, $q=p^n$ and $g\in\tilde G$. There are a smooth projective curve $C^{(g)}$ over $W(\mathbb F_q)$ with a divisor $D^{(g)}$ finite \'etale over $W(\mathbb F_q)$, an $F$-crystal with logarithmic singularities $M^{(g)}$ on $(\widehat{C^{(g)}},\widehat{D^{(g)}})$ satisfying the conditions 1.7 of loc.\ cit., and a lisse $L_\lambda$-sheaf $M^{(g)}_\ell$ on $C^{(g)}_{\mathbb F_q}\setminus D^{(g)}$, which become $(C,D_C,M_k)$ and $(C_0^\circ,M_\ell)$ after base change to $W(\bar{\mathbb F}_p)$, respectively $\bar{\mathbb F}_p$, in such a way that the $q$-power Frobenius endomorphism of $C^{(g)}_{\mathbb F_q}$ becomes $g^{-1}\circ\mathrm{Fr}_q$, so that $C^{(g)}(\mathbb F_q)=\operatorname{Fix}_q(g)$, and the $q$-linear Frobenius on the cohomology of the twisted objects becomes $\varphi^n(g^{-1})^*$ on $H_{\mathrm{cris}}$ and $F^n(g^{-1})^*$ on $H_\ell$. For $y\in\operatorname{Fix}_q(g)$ let $\Psi^{\mathrm{cris}}_{g,y}$ be the $q$-linear Frobenius at $y$ of $M^{(g)}$ on $B^{\mathrm{cris}}_y=\operatorname{coker}(R_y)\otimes\mathbb Q$, where $R_y$ is the residue map of $M^{(g)}$ at $y$ ($R_y=0$ if $y\notin D_C$), and $\Psi^\ell_{g,y}$ the geometric Frobenius at $y$ on $B^\ell_y=(o_*M^{(g)}_\ell)_{\bar y}$. Then $\operatorname{Fix}_q(g)$ is finite and
\[
\begin{aligned}
\operatorname{Tr}\bigl(g^*\varphi^{-n}\mid H_{\mathrm{cris}}\bigr)
&=-q^{-1}\sum_{y\in\operatorname{Fix}_q(g)}
\operatorname{Tr}\bigl((\Psi^{\mathrm{cris}}_{g,y})^{-1}
\mid B^{\mathrm{cris}}_y\bigr),\\
\operatorname{Tr}\bigl(F^n(g^{-1})^*\mid H_\ell\bigr)
&=-\sum_{y\in\operatorname{Fix}_q(g)}
\operatorname{Tr}\bigl(\Psi^\ell_{g,y}\mid B^\ell_y\bigr).
\end{aligned}
\]
\item Let $y\in\operatorname{Fix}_q(g)\setminus D_C$, $g=(h,\zeta)$, and $x=\rho(y)$, so that $\mathrm{Fr}_q(x)=h(x)$. After extending scalars to $W(\kappa(x))$, $\Psi^{\mathrm{cris}}_{g,y}$ becomes $c_h\operatorname{Sym}^{k-2}(u_{g,y}^*)$ on $\operatorname{Sym}^{k-2}H^1_{\mathrm{cris}}(E_x/W(\kappa(x)))\otimes\mathbb Q$, and $\Psi^\ell_{g,y}$ is $c_h\operatorname{Sym}^{k-2}(u_{g,y}^*)$ on $\operatorname{Sym}^{k-2}H^1(E_{\bar x},\mathbb Q_\ell)\otimes L_\lambda$, where
\[
u_{g,y}=\hat\pi_{h,x}\circ F_{x,q}\in\operatorname{End}_{\kappa(x)}(E_x),
\]
$F_{x,q}:E_x\to E_x^{(q)}=E_{h(x)}$ is the relative $q$-power Frobenius, $\hat\pi_{h,x}:E_{h(x)}\to E_x$ is the dual of the fibre at $x$ of the isogeny $\pi_h:E\to h^*E$ of (M2), and $c_h$ is the constant of (M2).
\end{enumerate}
\end{lemma}
\begin{proof}
The formulas of (2) are Scholl's and Grothendieck's trace formulas, applied to the forms of $(C,D_C,M_k)$ and of $M_\ell$ twisted by $g$, on a curve whose $\mathbb F_q$-points are $\operatorname{Fix}_q(g)$; this twisting (Step 3, after Scholl) is the idea of the proof. Write $K$ for the log de Rham complex $M_k\to M_k\otimes\Omega^1_{C/\mathbb Z_p}(\log D_C)$ on $C_{\mathbb Z_p}$, so that $H_{\mathbb Z}=\mathbb H^1(C_{\mathbb Z_p},K)$ is the twisted crystal.
\textbf{Step 1: the crystalline side of (1).} The terms of $\Omega^\bullet(M_k)$ and of $K$ are coherent on the proper $\mathbb Z_p$-scheme $C_{\mathbb Z_p}$, so by \cite{locbib:EGAIII1}, (4.1.5), and the hypercohomology spectral sequences, $\mathbb H^i(\widehat C,\widehat K)=\mathbb H^i(C_{\mathbb Z_p},K)$, and likewise for $\Omega^\bullet(M_k)$. The residues of $\nabla$ along $D_C$ are nilpotent (Lemma~\ref{lem:v5_tat_cur_loc}, and (M1)), $M_k$ is locally free, and its Frobenius is an isogeny, so $M_k$ satisfies the conditions 1.7 of \cite{locbib:Scholl1985Trace}. The exact sequence $0\to\Omega^\bullet(M_k)\to \widehat K\to\operatorname{coker}(R_{D_C})[-1]\to0$ of loc.\ cit., 2.5 and (5.6.1), gives, after tensoring with $\mathbb Q$,
\[
\begin{aligned}
0&\to H^0(\Omega^\bullet)\to H^0(K)\to0,\\
0&\to H^1(\Omega^\bullet)\to H^1(K)\xrightarrow{\ r\ }\operatorname{coker}(R_{D_C})\to H^2(\Omega^\bullet)\to H^2(K)\to0 ,
\end{aligned}
\]
where $r$ is induced by $\mathrm{id}\otimes\operatorname{res}_{D_C}$. At $z\in D_C$ the cokernel of the residue is spanned by $e_0$ and $r$ is $\operatorname{Res}_z$ (proof of Lemma~\ref{lem:v5_par_eig_the}(3), Reduction); so $H^1(\Omega^\bullet)\otimes\mathbb Q=H_{\mathrm{cris}}$. Scholl's endomorphism $F$ of these groups (loc.\ cit., 2.3) is the crystalline Frobenius $\varphi$: both are computed on a \v{C}ech--de Rham complex of an affine open cover of $\widehat C$ with admissible (that is, logarithmic) local Frobenius lifts, glued by the homotopies $L(\phi',\phi)$ of loc.\ cit., 2.1, which is the description of the logarithmic crystalline Frobenius through a log-smooth lifting \cite{locbib:Kato1989}, \S6, used in Lemma~\ref{lem:v5_exp_cus_fro}(1),(3). Likewise $g^*$ is the action of loc.\ cit., 7.2, for the pairs $(g,g^\sharp)$.
For $H^0$, the proof of Lemma~\ref{lem:v5_par_eig_the}(1) shows that $M_k\otimes\mathbb F_p$ has no nonzero horizontal global sections, that is $H^0(C_{\mathbb F_p},K/p)=0$. As $H^0(K)$ is a finitely generated $\mathbb Z_p$-module and $H^0(K)/p\hookrightarrow H^0(K/p)$, Nakayama's lemma gives $H^0(K)=0$, hence $H^0(\Omega^\bullet)=0$.
For $H^2$ we pass to $\mathbb C$. Fix a field embedding $\iota:\mathbb Q_p\to\mathbb C$ that is the identity on $L$. Coherent cohomology commutes with flat base change, so it suffices to show that $\mathbb H^2(C_{\mathbb C},K)=0$ and that $r\otimes_\iota\mathbb C$ is surjective. By \cite{locbib:Deligne1970}, II, \S\S5--6, as in the proof of Lemma~\ref{lem:v5_par_eig_the}(3) (Topology), $\mathbb H^i(C_{\mathbb C},K)=H^i(C^{\mathrm{an}}\setminus D_C,\operatorname{Sym}^{k-2}\mathbb V)$ with $\mathbb V=R^1\pi_{E*}\mathbb C$, and $r\otimes\mathbb C$ is the restriction to the punctured discs $\Delta_z^*$ around the points of $D_C$. Every connected component of $C_{\mathbb C}$ meets $D_C$: $t\circ\rho$ is non-constant on it (M3) and its zeros lie in $\rho^{-1}(Z')$. So each component of $C^{\mathrm{an}}\setminus D_C$ is a non-compact Riemann surface, on which $H^2$ of a local system vanishes. The cokernel of the restriction $H^1(C^{\mathrm{an}}\setminus D_C,\operatorname{Sym}^{k-2}\mathbb V)\to\bigoplus_zH^1(\Delta_z^*,\operatorname{Sym}^{k-2}\mathbb V)$ injects into $H^2_c(C^{\mathrm{an}}\setminus D_C,\operatorname{Sym}^{k-2}\mathbb V)$, which is dual to $H^0(C^{\mathrm{an}}\setminus D_C,\operatorname{Sym}^{k-2}\mathbb V^\vee)$ by Poincar\'e duality. This vanishes: $\mathbb V^\vee\cong\mathbb V$ by the Weil pairing, and on each component the monodromy of $\operatorname{Sym}^{k-2}\mathbb V$ contains $\operatorname{Sym}^{k-2}$ of a subgroup of finite index of $\mathrm{SL}_2(\mathbb Z)$, Zariski dense in $\mathrm{SL}_2$, which has no nonzero invariants as $k\geq3$ (proof of Lemma~\ref{lem:v5_par_eig_the}(3), Descent). So $H^2(\Omega^\bullet)\otimes\mathbb Q=0$.
\textbf{Step 2: the $\ell$-adic side of (1).} We first show $H^0(C_{0,\bar{\mathbb F}_p},o_*M_\ell)=H^0(C^\circ_{0,\bar{\mathbb F}_p},M_\ell)=0$. Let $V$ be the strict henselisation of $\mathcal O_{L,(\mathfrak P)}$ and $\bar\eta$ a geometric generic point of $\operatorname{Spec}V$. The sheaf $M_\ell$ is the restriction to the special fibre of the sheaf $\rho^*\operatorname{Sym}^{k-2}R^1\pi_{E*}\mathbb Q_\ell\otimes L_\lambda$ on $C^\circ_V=(C\setminus D_C)_V$, which has the lattice $\rho^*\operatorname{Sym}^{k-2}R^1\pi_{E*}\mathbb Z_\ell\otimes\mathcal O_\lambda$; let $M_n$ be its reduction modulo $\lambda^n$, a locally constant constructible sheaf. The morphism $C^\circ_V\to\operatorname{Spec}V$ is smooth, hence locally acyclic relative to $M_n$ \cite{locbib:SGA4vol3}, Exp.~XV. The $M_n$ are tamely ramified along the relative normal crossings divisor $D_{C,V}$, finite \'etale over $V$: near $D_C$ they are trivialised by adjoining $\ell^n$-th roots of the Tate parameter of (M1), a Kummer covering of degree prime to $p$. So by \cite{locbib:SGA4half}, Th.~finitude, Appendice, 1.3.3, the formation of $Ro_*M_n$ commutes with base change, and by the proper base change theorem so does the formation of $R\Gamma(C^\circ,M_n)$; by loc.\ cit., 2.4, specialisation and cospecialisation are then inverse isomorphisms between the cohomology of the special and of the generic geometric fibre. Passing to the limit, $H^0(C^\circ_{0,\bar{\mathbb F}_p},M_\ell)\cong H^0(C^\circ_{\bar\eta},M_\ell)$. The latter vanishes: after an extension of algebraically closed fields of characteristic zero, which does not change \'etale cohomology, Artin's comparison theorem \cite{locbib:SGA4vol3}, Exp.~XVI, Th.~4.1, identifies it with the space of global monodromy invariants of $\operatorname{Sym}^{k-2}\mathbb V\otimes L_\lambda$ on $C^{\mathrm{an}}\setminus D_C$, which is zero as in Step 1. The dual of $M_\ell$ is $M_\ell(k-2)$ (the pairing of Lemma~\ref{lem:v5_kum_eig_pai}(1), pulled back by $\rho$), so by Poincar\'e duality $H^2(C_{0,\bar{\mathbb F}_p},o_*M_\ell)$ is dual to $H^0(C_{0,\bar{\mathbb F}_p},o_*(M_\ell^\vee)(1))=H^0(C_{0,\bar{\mathbb F}_p},o_*M_\ell)(k-1)=0$. Groups $H^i$ with $i>2$ vanish on a curve. This proves (1).
\textbf{Step 3: twisted forms.} We construct the objects of (2) as in \cite{locbib:Scholl1985}, proof of Proposition 4.4, (4.4.3)--(4.4.4). Let $m$ be the order of $g$ in $\tilde G$, $R_1=W(\mathbb F_q)$, $R_m=W(\mathbb F_{q^m})$, and $\tau\in\operatorname{Gal}(R_m/R_1)$ the $q$-power Frobenius. The group $\tilde G$ acts on $C\otimes\mathbb Z_p$ over $\mathbb Z_p$ ($G$ over $\mathcal O_{L,(\mathfrak P)}\subset\mathbb Z_p$, and $\mu_d(\mathbb Z_p)$ through $s\mapsto\zeta s$), preserving $D_C$. Let $\gamma$ be the $\tau$-semilinear automorphism $g\otimes\tau$ of $C_{R_m}=C\otimes R_m$; as $g$ commutes with the $\mathbb Z_p$-structure, $\gamma^m=1$, and $\langle\gamma\rangle$ acts on $\operatorname{Spec}R_m$ through $\operatorname{Gal}(R_m/R_1)$, freely. Since $C$ is projective, Galois descent \cite{locbib:BLR1990}, \S6.2, Example B, gives a smooth projective $R_1$-scheme $C^{(g)}$ with $C^{(g)}\otimes_{R_1}R_m=C_{R_m}$ on which the descent datum is $\gamma$, and likewise $D^{(g)}$, finite \'etale over $R_1$. The isomorphisms $\gamma^*M_k\cong M_k$ given by $g^\sharp$ and the base change along $\tau$ are compatible with $\nabla$, the Hodge filtration and the Frobenius structures (M2), and satisfy the cocycle condition because $g\mapsto g^\sharp$ is an action (proof of Lemma~\ref{lem:v5_eta_eig_twi}, Step 5). So, by faithfully flat descent of modules with connection, the morphisms $F_\phi$ descending as they commute with the descent datum \cite{locbib:Scholl1985Trace}, 7.2, $M_k$ descends to an $F$-crystal with logarithmic singularities $M^{(g)}$ on $(\widehat{C^{(g)}},\widehat{D^{(g)}})$, which satisfies the conditions 1.7 of loc.\ cit.\ because they can be checked after the faithfully flat base change to $R_m$. In the same way, \'etale descent along $C_{\mathbb F_{q^m}}\to C^{(g)}_{\mathbb F_q}$ gives $M^{(g)}_\ell$ from $M_\ell$ and the maps $g^\sharp$.
The arithmetic Frobenius of the twisted $\mathbb F_q$-structure is $\gamma$; as the absolute $q$-power Frobenius is the identity on closed points, the $q$-power Frobenius endomorphism of $C^{(g)}_{\mathbb F_q}$ acts on $C(\bar{\mathbb F}_p)$ as $\mathrm{Fr}_q\circ g^{-1}=g^{-1}\circ\mathrm{Fr}_q$. Hence $C^{(g)}(\mathbb F_q)=\operatorname{Fix}_q(g)$, a finite set. On cohomology, which commutes with the base changes $R_1\to R_m$ and $\mathbb F_q\to\bar{\mathbb F}_p$, the $q$-linear Frobenius of the twisted objects is the pull-back along $g^{-1}\circ\mathrm{Fr}_q$, that is $\varphi^n(g^{-1})^*$ on $H^\bullet(\widehat C,\Omega^\bullet(M_k))\otimes R_m$ (compare (4.4.4) of \cite{locbib:Scholl1985}) and $F^n(g^{-1})^*$ on $H^\bullet(C_{0,\bar{\mathbb F}_p},o_*M_\ell)$, the formation of $o_*$ commuting with the extension $\mathbb F_q\to\bar{\mathbb F}_p$. At $y\in\operatorname{Fix}_q(g)$ the fibre of the twisted objects is the fibre at $y$, and the Frobenius at $y$ is the composite of $(g^\sharp)^{-1}$, from the fibre at $y$ to the fibre at $g(y)=\mathrm{Fr}_q(y)$, with the $q$-power Frobenius of the crystal, respectively of the sheaf, from the fibre at $\mathrm{Fr}_q(y)$ to that at $y$.
\textbf{Step 4: the two trace formulas.} We apply \cite{locbib:Scholl1985Trace}, Theorem 5.2(ii), to $(C^{(g)},D^{(g)},M^{(g)})$ over $R=R_1$, whose absolute ramification index $1$ is less than $p-1$, with residue field $\mathbb F_q$, $q=p^n$ odd, and with the integer $s$ of loc.\ cit.\ equal to $1$:
\[
\sum_i(-1)^i\operatorname{Tr}\bigl(F'^{-n}\mid H^i(\widehat{C^{(g)}},\Omega^\bullet(M^{(g)}))_{\mathbb Q}\bigr)=q^{-1}\sum_{y\in C^{(g)}(\mathbb F_q)}\operatorname{Tr}\bigl((\Psi^{\mathrm{cris}}_{g,y})^{-1}\mid\operatorname{coker}(R_y)_{\mathbb Q}\bigr),
\]
where $F'$ is the $\sigma$-linear Frobenius of the twisted crystal, so that $F'^{n}$ is $R_1$-linear. By Step 3 and (1), after extending scalars to $R_m$ only $i=1$ contributes, and $F'^{-n}$ becomes $(\varphi^n(g^{-1})^*)^{-1}=g^*\varphi^{-n}$ on $H_{\mathrm{cris}}\otimes R_m$; traces are unchanged by extension of scalars. This is the first formula of (2). For the second, Grothendieck's trace formula \cite[(1.4.5.1)]{locbib:Deligne1980}, in its trace form over $\mathbb F_q$, applied to the constructible $L_\lambda$-sheaf $o_*M^{(g)}_\ell$ on the proper curve $C^{(g)}_{\mathbb F_q}$, gives $\sum_i(-1)^i\operatorname{Tr}(F^n(g^{-1})^*\mid H^i(C_{0,\bar{\mathbb F}_p},o_*M_\ell))=\sum_{y\in\operatorname{Fix}_q(g)}\operatorname{Tr}(\Psi^\ell_{g,y}\mid B^\ell_y)$, and (1) removes $i\neq1$.
\textbf{Step 5: the local operators off the cusps, (3).} For $g=(h,\zeta)$ the factor $\zeta$ acts on $C$ over $X'$ and trivially on the fibres of $M_k=\rho^*\operatorname{Sym}^{k-2}H$ and of $M_\ell$; so $\rho(g(y))=h(x)$, and as $\rho$ commutes with $\mathrm{Fr}_q$, $\mathrm{Fr}_q(x)=h(x)$. The fibre of $H$ at (a lift of) $x$ is $H^1_{\mathrm{cris}}(E_x/W(\kappa(x)))$, and the Frobenius structure of the crystal $H$ restricts on fibres to the map induced by the relative Frobenius of $E$ over $X'$ \cite{locbib:BerthelotOgus1978}, \S7; so the $q$-power Frobenius from the fibre at $h(x)=\mathrm{Fr}_q(x)$ to the fibre at $x$ is $\operatorname{Sym}^{k-2}(F_{x,q}^*)$, and likewise for $R^1\pi_{E*}\mathbb Q_\ell$. On fibres, $g^\sharp=c_h\operatorname{Sym}^{k-2}(\pi_{h,x}^*)$ from the fibre at $h(x)$ to that at $x$. As $\pi_{h,x}^*\hat\pi_{h,x}^*=(\hat\pi_{h,x}\pi_{h,x})^*=\deg\pi_h$ on $H^1$ and $c_h^2(\deg\pi_h)^{k-2}=1$, its inverse is
\[
(g^\sharp)^{-1}=c_h^{-1}(\deg\pi_h)^{-(k-2)}\operatorname{Sym}^{k-2}(\hat\pi_{h,x}^*)=c_h\operatorname{Sym}^{k-2}(\hat\pi_{h,x}^*).
\]
So $\Psi_{g,y}=\operatorname{Sym}^{k-2}(F_{x,q}^*)\circ c_h\operatorname{Sym}^{k-2}(\hat\pi_{h,x}^*)=c_h\operatorname{Sym}^{k-2}((\hat\pi_{h,x}\circ F_{x,q})^*)$ in both theories. Both $F_{x,q}$ and $\hat\pi_{h,x}$ are defined over $\kappa(x)$, which contains the residue field of $h(x)=\mathrm{Fr}_q(x)$.
\end{proof}
\begin{lemma}\label{lem:v5_loc_ter_agr}
Let $\ell\neq p$ be a prime, $\lambda$ a prime of $L$ above $\ell$, $n\geq1$, $q=p^n$ and $g=(h,\zeta)\in\tilde G$, and let $\operatorname{Fix}_q(g)$, the local Frobenius operators $\Psi^{\mathrm{cris}}_{g,y}$ on $B^{\mathrm{cris}}_y$ and $\Psi^\ell_{g,y}$ on $B^\ell_y$, and the endomorphisms $u_{g,y}$ be those of Lemma~\ref{lem:v5_twi_lef_for}(2),(3). Let $y\in\operatorname{Fix}_q(g)$. Then $\operatorname{Tr}(\Psi^\ell_{g,y}\mid B^\ell_y)$ lies in $L$, and
\[
q^{-1}\operatorname{Tr}\bigl((\Psi^{\mathrm{cris}}_{g,y})^{-1}\mid B^{\mathrm{cris}}_y\bigr)=q^{-(k-1)}\,\iota_{\mathfrak P}\operatorname{Tr}\bigl(\Psi^\ell_{g,y}\mid B^\ell_y\bigr).
\]
More precisely:
\begin{enumerate}
\item If $y\notin D_C$, let $x=\rho(y)$ and $u=u_{g,y}$, and let $\alpha,\beta$ be the roots of the characteristic polynomial $P_u(X)=X^2-\operatorname{tr}(u)X+\deg u\in\mathbb Z[X]$ of $u^*$ on $H^1(E_{\bar x},\mathbb Q_\ell)$. Then $P_u$ is also the characteristic polynomial of $u^*$ on $H^1_{\mathrm{cris}}(E_x/W(\kappa(x)))\otimes\mathbb Q$, and
\[
\operatorname{Tr}(\Psi^{\mathrm{cris}}_{g,y})=\iota_{\mathfrak P}\operatorname{Tr}(\Psi^\ell_{g,y})=c_h\sum_{i=0}^{k-2}\alpha^i\beta^{k-2-i},\qquad\operatorname{Tr}\bigl((\Psi^{\mathrm{cris}}_{g,y})^{-1}\bigr)=q^{-(k-2)}\operatorname{Tr}(\Psi^{\mathrm{cris}}_{g,y}).
\]
\item If $y\in D_C$, then $B^{\mathrm{cris}}_y$ and $B^\ell_y$ are lines, and there is a nonzero integer $r_y$ such that $\Psi^{\mathrm{cris}}_{g,y}$ acts by $c_h(qr_y)^{k-2}$ and $\Psi^\ell_{g,y}$ by $c_h(\deg\pi_h/r_y)^{k-2}$; $r_y$ is the degree on the tori of the Tate parametrisations of the restriction of $\hat\pi_h$ to the punctured formal neighbourhood of the cusp.
\end{enumerate}
\end{lemma}
\begin{proof}
\textbf{Off the cusps.} Let $y\notin D_C$. By Lemma~\ref{lem:v5_twi_lef_for}(3) both local operators are $c_h\operatorname{Sym}^{k-2}(u^*)$, with $u=u_{g,y}$ an endomorphism of the elliptic curve $E_x$ over the finite field $\kappa(x)$, of degree $\deg u=q\deg\pi_h$. The graph of $u$ is a cycle of dimension one with integer coefficients on $E_x\times E_x$, and $E_x$ is projective, smooth and absolutely irreducible; by \cite{locbib:KatzMessing1974}, Theorem 2(2), its characteristic polynomial on $H^1$ lies in $\mathbb Z[X]$ and is the same for $\ell$-adic cohomology and for crystalline cohomology tensored with the fraction field of $W(\bar{\mathbb F}_p)$, the latter being a Weil cohomology by \cite{locbib:GilletMessing1987}. On $\ell$-adic $H^1$ this polynomial is $X^2-\operatorname{tr}(u)X+\deg u$ \cite{locbib:Silverman2009}, Proposition III.8.6 (on the Tate module, whose dual is $H^1$). So in both theories $\operatorname{Sym}^{k-2}(u^*)$ has eigenvalues $\alpha^i\beta^{k-2-i}$, $0\leq i\leq k-2$, and its trace $\sum_i\alpha^i\beta^{k-2-i}$, a symmetric polynomial in $\alpha,\beta$ with integer coefficients, is an integer; as $c_h\in L$ (M2) acts on crystalline cohomology through $\iota_{\mathfrak P}$, $\operatorname{Tr}(\Psi^\ell_{g,y})\in L$ and $\operatorname{Tr}(\Psi^{\mathrm{cris}}_{g,y})=\iota_{\mathfrak P}\operatorname{Tr}(\Psi^\ell_{g,y})$. For the inverse, $\alpha\beta=q\deg\pi_h$ and $c_h^{-1}(\deg\pi_h)^{-(k-2)}=c_h$, which is the normalisation $c_h^2=(\deg\pi_h)^{-(k-2)}$ of (M2), give
\[
c_h^{-1}\alpha^{-i}\beta^{-(k-2-i)}=c_h^{-1}(\alpha\beta)^{-(k-2)}\alpha^{k-2-i}\beta^{i}=q^{-(k-2)}\,c_h\,\alpha^{k-2-i}\beta^{i},
\]
so the eigenvalues of $(\Psi^{\mathrm{cris}}_{g,y})^{-1}$ are those of $q^{-(k-2)}\Psi^{\mathrm{cris}}_{g,y}$. This proves (1).
\textbf{At the cusps.} Let $y\in D_C$, $z=\rho(y)\in Z'(\bar{\mathbb F}_p)$ and $W=W(\bar{\mathbb F}_p)$; then $h(z)=\mathrm{Fr}_q(z)$ (Step 5 of the proof of Lemma~\ref{lem:v5_twi_lef_for}). As $Z'$ and $D_C$ are \'etale over $\mathcal O_{L,(\mathfrak P)}$ , $y$, $g(y)$, $z$, $h(z)$ have unique lifts $\tilde y,\widetilde{g(y)}\in D_C(W)$, $\tilde z,\widetilde{h(z)}\in Z'(W)$, and $\widetilde{h(z)}=\sigma^n(\tilde z)$ for the Frobenius $\sigma$ of $W$, as $X'$ and $Z'$ are defined over $\mathcal O_{L,(\mathfrak P)}\subset\mathbb Z_p$. Fix data $(q_z,\delta_z,m_z)$ as in (M1) at $\tilde z$, take the $\sigma^n$-conjugate data at $\widetilde{h(z)}$, and transport both to the cusps of $C$ above them as in the proof of Lemma~\ref{lem:v5_par_eig_the}(2): with a formal parameter $v$ of $C_W$ along $\tilde y$, the pull-back of $E$ to $\operatorname{Spf}W[[v]]$ is $\mathrm{Tate}(Q)$, $Q=\delta v^m$, $\delta\in W^\times$, $m$ prime to $p$; likewise along $\widetilde{g(y)}$.
Both spaces are lines. In the basis $e_i=\omega^{k-2-i}\xi^i$ of Lemma~\ref{lem:v5_tat_cur_loc}, $\omega=\omega_{\mathrm{can}}$, the residue $R_y$ maps $e_i$ to $(k-2-i)m\,e_{i+1}$, so $B^{\mathrm{cris}}_y$ is the line spanned by the image of $e_0=\omega^{\otimes(k-2)}$. Let $K_y$ be the fraction field of the strict henselisation of $C_{0,\bar{\mathbb F}_p}$ at $y$, with inertia group $I$. Over $K_y$, $E$ is the Tate curve $\mathrm{Tate}(Q)$ with $Q$ of valuation $m\geq1$, and $\mathrm{Tate}(Q)[\ell^\nu]$ is an extension of $\mathbb Z/\ell^\nu$ by $\mu_{\ell^\nu}$, the quotient being generated by the class of an $\ell^\nu$-th root of $Q$ \cite{locbib:DeligneRapoport1973}, VII, \S1. So $I$ acts on $T_\ell(E)$ through a nontrivial unipotent group, trivially on $T_\ell(\mu)$ and on $T_\ell(E)/T_\ell(\mu)\cong\mathbb Z_\ell$, and $H^1(E,\mathbb Q_\ell)^I$ is the line dual to $T_\ell(E)/T_\ell(\mu)$, on which the whole Galois group of $K_y$ acts trivially. As $\operatorname{Sym}^{k-2}$ of a nontrivial unipotent automorphism of a plane has one-dimensional invariants, $B^\ell_y=(o_*M_\ell)_{\bar y}=\operatorname{Sym}^{k-2}(H^1(E,\mathbb Q_\ell)^I)\otimes L_\lambda$ is a line.
Over $B=\operatorname{Spec}W[[v]][\frac1v]$, which maps to $Y'$, the isogeny $\hat\pi_h:h^*E\to E$ restricts to an isogeny $\psi:\mathrm{Tate}(Q')\to\mathrm{Tate}(Q)$ of degree $\deg\pi_h$, where $\mathrm{Tate}(Q')$ is the pull-back along $g$ of the Tate curve along $\widetilde{g(y)}$. Let $R_0$ be the local ring of $C_W$ at the generic point of the divisor $\tilde y$, a discrete valuation ring with residue field $\kappa_0=\operatorname{Frac}W$ of characteristic zero and completion $\kappa_0[[v]]$, the ideal of $\tilde y$ in $W[[v]]$ being $(v)$; its fraction field is the function field of $C_W$, to which the generic point of $B$ maps. Over $\operatorname{Frac}R_0$ both curves have split multiplicative reduction, and the special fibre of the identity component of their N\'eron models is the torus $\mathbb G_{m,\kappa_0}$ of the Tate parametrisation, on which $\omega_{\mathrm{can}}$ restricts to $dx/x$ and whose $\ell^\nu$-torsion is the reduction of the subgroup scheme $\mu_{\ell^\nu}\subset\mathrm{Tate}(\cdot)[\ell^\nu]$ \cite{locbib:DeligneRapoport1973}, VII, \S1, \cite{locbib:Silverman2009}, Proposition VII.5.1. By the N\'eron mapping property \cite{locbib:BLR1990}, \S1.2, Definition 1, $\psi$ extends to the N\'eron models, and on the special fibres of the identity components it is a homomorphism of tori, $x\mapsto x^{r_y}$ with $r_y\in\mathbb Z\setminus\{0\}$, as $\psi$ is an isogeny. Hence the function $\psi^*\omega_{\mathrm{can}}/\omega_{\mathrm{can}}$, which lies in $W[[v]]$ because $c_h\operatorname{Sym}^{k-2}(\hat\pi_h^*)$ extends to the logarithmic crystal (M2), takes the value $r_y$ at $v=0$. Moreover $\psi$ maps $\mu_{\ell^\nu}$ by $x\mapsto x^{r_y}$ over $R_0$. Indeed, both are morphisms from $\mu_{\ell^\nu,R_0}$, a disjoint union of copies of the local scheme $\operatorname{Spec}R_0$ because $W$ contains $\mu_{\ell^\nu}$, to an \'etale separated $R_0$-scheme, and they agree on the closed point of each copy; the locus where two such morphisms agree is open and closed, the diagonal of an \'etale separated morphism being an open and closed immersion. The same argument over $B$, the components of $\mu_{\ell^\nu,B}$ being copies of the integral scheme $B$, whose generic point maps to $\operatorname{Spec}\operatorname{Frac}R_0$, shows that $\psi$ restricts to $x\mapsto x^{r_y}$ on $\mu_{\ell^\nu}$ over $B$, hence over $K_y$. So over $K_y$, $\psi$ acts by $r_y$ on $T_\ell(\mu)$ and by $r'_y=\deg\pi_h/r_y$ on $T_\ell(E)/T_\ell(\mu)$, the determinant of $\psi$ on $T_\ell$ being $\deg\psi$ \cite{locbib:Silverman2009}, Proposition III.8.6.
On the crystalline side $(g^\sharp)^{-1}=c_h\operatorname{Sym}^{k-2}(\hat\pi_h^*)$ (Step 5 of the proof of Lemma~\ref{lem:v5_twi_lef_for}), extended to the logarithmic crystal by (M2), maps the image of $e_0$ in the fibre at the cusp $\tilde y$ (where $v=0$) to $c_hr_y^{k-2}$ times the image of $e_0$ at $\widetilde{g(y)}$, as $\psi^*\omega_{\mathrm{can}}/\omega_{\mathrm{can}}$ takes the value $r_y$ at $v=0$, and the $q$-power Frobenius, induced on Tate curves with conjugate data by $x\mapsto x^q$ (iterate Lemma~\ref{lem:v5_tat_cur_loc}(2)), maps $\omega_{\mathrm{can}}$ at $\widetilde{g(y)}=\mathrm{Fr}_q(\tilde y)$ to $q\,\omega_{\mathrm{can}}$ at $\tilde y$; so $\Psi^{\mathrm{cris}}_{g,y}=c_h(qr_y)^{k-2}$. On the $\ell$-adic side, $(g^\sharp)^{-1}$ acts on the invariant lines by $c_h(r'_y)^{k-2}$, and the $q$-power Frobenius carries the generator dual to the class of the roots of the Tate parameter at $\mathrm{Fr}_q(y)$ to the corresponding generator at $y$, the data being conjugate and Galois acting trivially on $T_\ell(E)/T_\ell(\mu)$; so $\Psi^\ell_{g,y}=c_h(r'_y)^{k-2}$. This proves (2).
\textbf{The identity.} Off the cusps, (1) gives
\[
\begin{aligned}
q^{-1}\operatorname{Tr}((\Psi^{\mathrm{cris}})^{-1})
&=q^{-1}q^{-(k-2)}\operatorname{Tr}(\Psi^{\mathrm{cris}})\\
&=q^{-(k-1)}\iota_{\mathfrak P}\operatorname{Tr}(\Psi^\ell).
\end{aligned}
\] At a cusp, (2) and $c_h^{-1}=c_h(\deg\pi_h)^{k-2}=c_h(r_yr'_y)^{k-2}$, again by (M2), give $(\Psi^{\mathrm{cris}})^{-1}=c_h^{-1}(qr_y)^{-(k-2)}=q^{-(k-2)}c_h(r'_y)^{k-2}$, and $c_h(r'_y)^{k-2}\in L$.
\end{proof}
\subsection{Specialisation} \label{subsec:generic_fibre}
The computation above takes place over $\overline{\mathbb F}_p$. Tame specialisation identifies these cohomology groups, with their Frobenius action, with the restrictions of the generic-fibre representations to a decomposition group at $\mathfrak P$.
\begin{lemma}\label{lem:v5_tam_spe_the}
Assume that the datum is admissible. Let $\ell\neq p$ be a prime, $\lambda$ a prime of $L$ above $\ell$, $V_{a,\lambda}$, $V_{\bar a,\lambda}$ the $\lambda$-adic realisations of the model, and $V_a$, $V_{\bar a}$ the cohomology over $\bar{\mathbb F}_p$ of its Kummer eigensheaves, with the geometric Frobenius $F$. Fix a prime of $\bar L$ above $\mathfrak P$, and let $D\supset I$ be its decomposition and inertia groups. Then $I$ acts trivially on $V_{a,\lambda}$ and on $V_{\bar a,\lambda}$, and there are isomorphisms $V_{a,\lambda}\cong V_a$ and $V_{\bar a,\lambda}\cong V_{\bar a}$, compatible with the action of $D$, which acts on $V_a$ and $V_{\bar a}$ through $D/I=\operatorname{Gal}(\bar{\mathbb F}_p/\mathbb F_p)$, so that a geometric Frobenius element $\mathrm{Frob}_{\mathfrak P}\in D$ acts as $F$. In particular $V_{a,\lambda}$ and $V_{\bar a,\lambda}$ are two-dimensional and unramified at $\mathfrak P$, and
\[
\det\bigl(X-\mathrm{Frob}_{\mathfrak P}\mid V_{\bar a,\lambda}\bigr)=X^2-A_{\mathfrak P}X+\varepsilon_{\mathfrak P}\,p^{k-1}
\]
with $A_{\mathfrak P}$, $\varepsilon_{\mathfrak P}$ the numbers of Proposition~\ref{prop:v5_tra_ide_kum}(2).
\end{lemma}
\begin{proof}
We use the notation of Lemma~\ref{lem:v5_twi_lef_for} and of Lemma~\ref{lem:v5_eig_coh_cov}, with $\chi=\chi_\Phi$; the index $\ast$ stands for $a$ or $\bar a$, with $e_\chi$ for $\ast=a$ and $e_{\chi^{-1}}$ for $\ast=\bar a$. Let $\mathcal O=\mathcal O_{L,(\mathfrak P)}$, let $\mathcal O^{\mathrm{sh}}$ be the strict henselisation of $\mathcal O$ at $\mathfrak P$, with closed point $s$, and $\bar\eta$ a geometric generic point of $\operatorname{Spec}\mathcal O^{\mathrm{sh}}$ over the fixed prime of $\bar L$. Let $M$ be the lisse sheaf $\rho^*\operatorname{Sym}^{k-2}R^1\pi_{E*}\mathbb Q_\ell\otimes L_\lambda$ on $C^\circ_{\mathrm{sh}}=(C\setminus D_C)_{\mathcal O^{\mathrm{sh}}}$, with the lattice $M^0=\rho^*\operatorname{Sym}^{k-2}R^1\pi_{E*}\mathbb Z_\ell\otimes\mathcal O_\lambda$ and $M_n=M^0/\lambda^n$, and $o:C^\circ_{\mathrm{sh}}\hookrightarrow C_{\mathrm{sh}}$.
\textbf{Step 1: specialisation on $C^\circ$.} By Lemma~\ref{lem:v5_smo_kum_cov}(2), $C_{\mathrm{sh}}$ is smooth and proper over $\mathcal O^{\mathrm{sh}}$ and $D_{C,\mathrm{sh}}$ is finite \'etale over $\mathcal O^{\mathrm{sh}}$, hence a divisor with normal crossings relative to $\mathcal O^{\mathrm{sh}}$. Each $M_n$ is locally constant and tamely ramified along $D_{C,\mathrm{sh}}$: near a point of $D_C$ the curve $E$ is a Tate curve $\mathrm{Tate}(Q)$ (M1), $Q=\delta v^m$ with $p\nmid m$, whose $\ell^n$-torsion, and hence $M_n$, is trivialised by adjoining an $\ell^n$-th root of $v$, a Kummer covering of degree prime to $p$ \cite{locbib:DeligneRapoport1973}, VII, \S1. So by \cite{locbib:SGA4half}, Th.~finitude, Appendice, 1.3.3(i), the formation of $Ro_*M_n$ commutes with every base change, and by the proper base change theorem \cite{locbib:SGA4vol3}, Exp.~XII, Th.~5.1, for $C_{\mathrm{sh}}\to\operatorname{Spec}\mathcal O^{\mathrm{sh}}$, the formation of $R\Gamma(C^\circ,M_n)$ and of $R\Gamma_c(C^\circ,M_n)$ commutes with every base change. The specialisation maps on both are therefore defined \cite{locbib:SGA4half}, Th.~finitude, Appendice, 2.1, and compatible with the forget-supports maps and with the action of $\tilde G$. The smooth morphism $C^\circ_{\mathrm{sh}}\to\operatorname{Spec}\mathcal O^{\mathrm{sh}}$ is locally acyclic relative to the locally constant $M_n$ \cite{locbib:SGA4vol3}, Exp.~XV, so by \cite{locbib:SGA4half}, Th.~finitude, Appendice, 2.4, $\operatorname{sp}:H^1(C^\circ_{\bar s},M_n)\to H^1(C^\circ_{\bar\eta},M_n)$ is an isomorphism. Passing to the limit and tensoring with $\mathbb Q$, the same holds for $M$.
\textbf{Step 2: the parabolic parts.} On each geometric fibre, $H^1(C,o_*M)$ is the image of $H^1_c(C^\circ,M)\to H^1(C^\circ,M)$ and injects into $H^1(C^\circ,M)$, by Lemma~\ref{lem:v5_eig_coh_cov}(1). Hence $\operatorname{sp}$ maps $H^1(C_{\bar s},o_*M)=H_\ell$ injectively and $\tilde G$-equivariantly into $H^1(C_{\bar\eta},o_*M)$. By Lemma~\ref{lem:v5_eig_coh_cov}(2), applied to the geometric generic fibre, $e_{\chi^{\pm1}}H^1(C_{\bar\eta},o_*M)=H^1(\mathbb P^1_{\bar\eta},o_*\mathcal F_\ast)$, and this is $V_{\ast,\lambda}$, as $H^1$ of a proper scheme is unchanged by the extension $\bar L\subset\bar\eta$ of algebraically closed fields (proper base change). So $\operatorname{sp}$ maps $V_\ast=e_{\chi^{\pm1}}H_\ell$ injectively into $V_{\ast,\lambda}$. Both have dimension $2$: $V_\ast$ by Proposition~\ref{prop:v5_tra_ide_kum}(2); $V_{a,\lambda}$ by the duality of Lemma~\ref{lem:v5_eta_eig_twi}(3) once $V_{\bar a,\lambda}$ is known; and $V_{\bar a,\lambda}$ because it is an $L_\lambda$-form of $H_a$, of dimension $2$ by (R). To see the last point, fix an embedding $\bar L\subset\mathbb C$ extending $L\subset\mathbb C$. Over $\bar L$, which has characteristic zero, $S$ is a divisor of $\mathbb P^1_{\bar L}$ \'etale over $\bar L$, and the reductions of an integral lattice of $\mathcal F_{\bar a}$ are locally constant on $U_{\bar L}$ and tamely ramified along $S$. Hence the formation of their direct images under $o$ commutes with the base change to $\mathbb C$ \cite{locbib:SGA4half}, Th.~finitude, Appendice, 1.3.3(i), and the proper base change theorem \cite{locbib:SGA4vol3}, Exp.~XII, Th.~5.1, applied to $\mathbb P^1_{\bar L}\to\operatorname{Spec}\bar L$, gives $V_{\bar a,\lambda}\cong H^1(\mathbb P^1_{\mathbb C},o_*\mathcal F_{\bar a})$. By Lemma~\ref{lem:v5_eta_eig_twi}(4) the right side is $H^1(\mathbb P^1(\mathbb C),o_*\mathcal V)\otimes_LL_\lambda$ for a local system $\mathcal V$ of $L$-vector spaces with $H^1(\mathbb P^1(\mathbb C),o_*\mathcal V)\otimes_L\mathbb C\cong H_a$. So $\operatorname{sp}:V_\ast\to V_{\ast,\lambda}$ is an isomorphism.
\textbf{Step 3: Galois action.} The decomposition group $D$ is the Galois group of the henselisation of $L$ at $\mathfrak P$ (for the fixed prime), it acts on $\mathcal O^{\mathrm{sh}}$ over the henselisation of $\mathcal O$, and $\operatorname{sp}$ is $D$-equivariant, $D$ acting on the special fibre through $D/I=\operatorname{Gal}(\bar{\mathbb F}_p/\mathbb F_p)$. So $I$ acts trivially on $V_{\ast,\lambda}$. An element of $D$ inducing the arithmetic Frobenius of $\bar{\mathbb F}_p$ acts on $H^1(\mathbb P^1_{\bar{\mathbb F}_p},o_*\mathcal F_\ast)$ as the inverse of the geometric Frobenius $F$ \cite{locbib:Deligne1974}, (1.15); so $\mathrm{Frob}_{\mathfrak P}$ acts as $F$. The last assertion is then Proposition~\ref{prop:v5_tra_ide_kum}(2).
\end{proof}
\section{The global system and the general theorem} \label{sec:galois}
\subsection{Independence of the model} \label{subsec:global}
The modular model used in Section~\ref{sec:trace} was chosen at a single prime $\mathfrak P$. To show that the polynomials obtained at different primes come from one system over $L$, we compare the eigensheaves on their common generic base. Geometric irreducibility leaves a possible rank-one arithmetic twist. The invariant line at the Tate cusp determines that twist and shows that it is trivial.
\begin{prop}\label{prop:v5_glo_sys_kum}
Let $(\Gamma,t,f,a,R)$ be an admissible Kummer twist datum with field $L$, exceptional set $\Sigma$ and singular set $S$. Let $\ell$ be a prime and $\lambda$ a prime of $L$ above $\ell$.
\begin{enumerate}
\item There are lisse $L_\lambda$-sheaves $\mathcal F_{\bar a,\lambda}$ and $\mathcal F_{a,\lambda}$ on $U_L=\mathbb P^1_L\setminus S$, unique up to isomorphism, such that $\mathcal F_{\bar a,\lambda}\cong\mathcal F_{\bar a}|_{U_L}$ and $\mathcal F_{a,\lambda}\cong\mathcal F_a|_{U_L}$ for the Kummer eigensheaves of every modular model of the datum at every prime of $L$ of residue degree one over a prime not in $\Sigma$. In particular the $\lambda$-adic realisations $V_{\bar a,\lambda}$ and $V_{a,\lambda}$ do not depend, up to isomorphism, on the model or the prime; they are two-dimensional over $L_\lambda$. Moreover, for an embedding $\bar L\subset\mathbb C$ extending $L\subset\mathbb C$, there is a local system $\mathcal V$ of $L$-vector spaces on $U(\mathbb C)$ with
\[
V_{\bar a,\lambda}\cong H^1\bigl(\mathbb P^1(\mathbb C),o_*\mathcal V\bigr)\otimes_LL_\lambda,\qquad H^1\bigl(\mathbb P^1(\mathbb C),o_*\mathcal V\bigr)\otimes_L\mathbb C\cong H_a .
\]
\item Let $\mathfrak P$ be a prime of $L$ of residue degree one over a prime $p\notin\Sigma$, with $\mathfrak P\nmid\ell$. Then $V_{\bar a,\lambda}$ and $V_{a,\lambda}$ are unramified at $\mathfrak P$, and, for a geometric Frobenius $\mathrm{Frob}_{\mathfrak P}$,
\[
\det\bigl(X-\mathrm{Frob}_{\mathfrak P}\mid V_{\bar a,\lambda}\bigr)=X^2-A_{\mathfrak P}X+\varepsilon_{\mathfrak P}\,p^{k-1},
\]
where $A_{\mathfrak P}\in\mathcal O_L$ and $\varepsilon_{\mathfrak P}\in L^\times$ are the numbers of Proposition~\ref{prop:v5_tra_ide_kum}(2) for any modular model of the datum at $\mathfrak P$; in particular $A_{\mathfrak P}$ and $\varepsilon_{\mathfrak P}$ depend neither on the model nor on $\ell$ and $\lambda$.
\item If $L=\mathbb Q$, then $(V_{\bar a,\ell})_\ell$ is a weakly compatible system of two-dimensional $\ell$-adic representations of $\operatorname{Gal}(\bar{\mathbb Q}/\mathbb Q)$, unramified outside $\Sigma$: for every prime $p\notin\Sigma$ and every prime $\ell\neq p$, $V_{\bar a,\ell}$ is unramified at $p$, and a geometric Frobenius at $p$ has characteristic polynomial $X^2-A_pX+\varepsilon_p\,p^{k-1}$, independent of $\ell$, with $A_p\in\mathbb Z$, $\varepsilon_p\in\{\pm1\}$, and roots of absolute value $p^{(k-1)/2}$ under every complex embedding.
\end{enumerate}
\end{prop}
\begin{proof}
\emph{Proof of (1).} The set $\Sigma$ is finite, and $L$ is generated over $\mathbb Q$ by roots of unity and square roots of integers, so it is abelian over $\mathbb Q$ and infinitely many primes split completely in it; hence there is a prime $\mathfrak P_0$ of $L$ of residue degree one over some $p_0\notin\Sigma$, and the datum has a modular model at $\mathfrak P_0$ by Proposition~\ref{prop:v5_exi_mod_mod}. Let $\mathcal F_{\bar a,\lambda}$ and $\mathcal F_{a,\lambda}$ be the restrictions to $U_L$ of the Kummer eigensheaves of this model. By Proposition~\ref{prop:v5_mod_ind_kum}, the Kummer eigensheaves of any other modular model at any prime of residue degree one over a prime not in $\Sigma$ are isomorphic to them on $U_L$; uniqueness up to isomorphism is then clear. Applying Lemma~\ref{lem:v5_tam_spe_the} to a modular model at a prime $\mathfrak P$ of residue degree one over $p\notin\Sigma$ with $\mathfrak P\nmid\ell$ (such primes exist, as above), $V_{\bar a,\lambda}$ and $V_{a,\lambda}$ are two-dimensional. For the last assertion, compute $V_{\bar a,\lambda}$ with the Kummer eigensheaf $\mathcal F_{\bar a}$ of one model: as $o_*$ commutes with the base change from $\bar L$ to $\mathbb C$ for the tamely ramified sheaf $\mathcal F_{\bar a}$ \cite{locbib:SGA4half}, Th.~finitude, Appendice, 1.3.3(i), the proper base change theorem \cite{locbib:SGA4vol3}, Exp.~XII, Th.~5.1, gives $V_{\bar a,\lambda}\cong H^1(\mathbb P^1_{\mathbb C},o_*\mathcal F_{\bar a})$, and Lemma~\ref{lem:v5_eta_eig_twi}(4) gives the displayed isomorphisms.
\emph{Proof of (2).} By Proposition~\ref{prop:v5_exi_mod_mod} the datum has a modular model at $\mathfrak P$; by (1), $V_{\bar a,\lambda}$ and $V_{a,\lambda}$ are, as representations of $\operatorname{Gal}(\bar L/L)$, the $\lambda$-adic realisations of this model. As $\ell\neq p$, Lemma~\ref{lem:v5_tam_spe_the} shows that they are unramified at $\mathfrak P$ and that the characteristic polynomial of $\mathrm{Frob}_{\mathfrak P}$ on $V_{\bar a,\lambda}$ is $X^2-A_{\mathfrak P}X+\varepsilon_{\mathfrak P}p^{k-1}$, with $A_{\mathfrak P}$, $\varepsilon_{\mathfrak P}$ those of Proposition~\ref{prop:v5_tra_ide_kum}(2) for this model. The left-hand side does not depend on the model, by (1); since $A_{\mathfrak P}$ is the trace and $\varepsilon_{\mathfrak P}p^{k-1}$ the determinant, neither do $A_{\mathfrak P}$ and $\varepsilon_{\mathfrak P}$. They do not depend on $\ell$ and $\lambda$ either: by Proposition~\ref{prop:v5_tra_ide_kum}(2) the polynomial lies in $L[X]$ and its image under the injective map $\iota_{\mathfrak P}$ is the characteristic polynomial of $p^{k-1}\varphi^{-1}$ on $H_{a,p}$, in which $\ell$ and $\lambda$ do not occur.
\emph{Proof of (3).} If $L=\mathbb Q$, every prime $p$ is the unique prime of $L$ above itself, of residue degree one, and $\lambda=\ell$. For $p\notin\Sigma$ and $\ell\neq p$, (2) gives unramifiedness and the characteristic polynomial, independent of $\ell$; $A_p\in\mathcal O_{\mathbb Q}=\mathbb Z$; and by Proposition~\ref{prop:v5_tra_ide_kum}(4) the roots have absolute value $p^{(k-1)/2}$ and $|\varepsilon_p|=1$, so $\varepsilon_p=\pm1$ as $\varepsilon_p\in\mathbb Q^\times$.
\end{proof}
\begin{prop}\label{prop:v5_mod_ind_kum}
Let $(\Gamma,t,f,a,R)$ be a Kummer twist datum with field $L$, exceptional set $\Sigma$ and singular set $S$. For $i=1,2$ let $p_i\notin\Sigma$ be primes (possibly equal), $\mathfrak P_i$ a prime of $L$ of residue degree one over $p_i$, and $(X'_i,Z'_i,E_i,G_i,\chi_{G_i})$ a modular model of the datum at $\mathfrak P_i$. Let $\ell$ be a prime, $\lambda$ a prime of $L$ above $\ell$, and $\mathcal F_a^{(i)}$, $\mathcal F_{\bar a}^{(i)}$ the Kummer eigensheaves of the $i$-th model, restricted to $U_L=\mathbb P^1_L\setminus S$. Then
\[
\mathcal F_{\bar a}^{(1)}\cong\mathcal F_{\bar a}^{(2)}\qquad\text{and}\qquad\mathcal F_a^{(1)}\cong\mathcal F_a^{(2)}
\]
as lisse $L_\lambda$-sheaves on $U_L$. In particular $H^1(\mathbb P^1_{\bar L},o_*\mathcal F_{\bar a}^{(1)})\cong H^1(\mathbb P^1_{\bar L},o_*\mathcal F_{\bar a}^{(2)})$ and $H^1(\mathbb P^1_{\bar L},o_*\mathcal F_a^{(1)})\cong H^1(\mathbb P^1_{\bar L},o_*\mathcal F_a^{(2)})$ as representations of $\operatorname{Gal}(\bar L/L)$.
\end{prop}
\begin{proof}
The local system $\mathbb V_f\otimes\mathbb L_a$ is irreducible. Indeed, put $n=\operatorname{lcm}(n_\Gamma,n_f)$. By Lemma~\ref{lem:v5_pic_fuc_loc}(3),(5), its monodromy restricted to $\Gamma(n)$ is the $(k-2)$-th symmetric power of the standard representation of $\mathrm{SL}_2$, tensored with a rank-one character. The group $\Gamma(n)$ is Zariski-dense in $\mathrm{SL}_2$: its upper and lower unipotents with entries in $n\mathbb Z$ are Zariski-dense in the corresponding one-parameter subgroups, which generate $\mathrm{SL}_2$. In characteristic zero the symmetric power of the standard representation is irreducible. Tensoring with a rank-one character preserves irreducibility. Its endomorphisms are therefore scalars.
The space $\mathcal N=\operatorname{Hom}_{U_{\bar L}}(\mathcal F_{\bar a}^{(1)},\mathcal F_{\bar a}^{(2)})$ is a line over $L_\lambda$ spanned by an isomorphism. Fix an embedding $\bar L\subset\mathbb C$ extending $L\subset\mathbb C$. By Lemma~\ref{lem:v5_eta_eig_twi}(4), Artin's comparison theorem \cite{locbib:SGA4vol3}, Exp.~XVI, Th.~4.1, identifies $\mathcal F_{\bar a}^{(i)}|_{U(\mathbb C)}$ with $\mathcal V^{(i)}\otimes_LL_\lambda$, where $\mathcal V^{(i)}$ is a local system of $L$-vector spaces with $\mathcal V^{(i)}\otimes_L\mathbb C\cong\mathbb V_f\otimes\mathbb L_a$. By the first step, $\operatorname{Hom}(\mathcal V^{(1)},\mathcal V^{(2)})\otimes_L\mathbb C$ is a line and each $\mathcal V^{(i)}$ is absolutely irreducible; as invariants of a linear action commute with extension of scalars, $\operatorname{Hom}(\mathcal V^{(1)}\otimes_LL_\lambda,\mathcal V^{(2)}\otimes_LL_\lambda)$ is a line, and each $\mathcal V^{(i)}\otimes_LL_\lambda$ is irreducible, so a nonzero homomorphism between them is an isomorphism. Now $\mathcal N$ is the space of global sections over $U_{\bar L}$ of the lisse sheaf $\mathcal Hom(\mathcal F_{\bar a}^{(1)},\mathcal F_{\bar a}^{(2)})$; each of its reductions is trivialised by a connected finite \'etale Galois cover of $U_{\bar L}$, which stays connected, with the same group, over the algebraically closed field $\mathbb C$, so global sections do not change from $U_{\bar L}$ to $U_{\mathbb C}$, and by Artin's comparison they are the homomorphisms of the associated local systems on $U(\mathbb C)$. Hence $\mathcal N$ is a line, and a nonzero $\phi\in\mathcal N$ is an isomorphism, being one on a geometric stalk.
Consequently the two sheaves differ by a character of $\operatorname{Gal}(\bar L/L)$. The group $\pi_1(U_L)$ acts on $\mathcal N$ by conjugation, through its quotient $\pi_1(U_L)/\pi_1(U_{\bar L})=\operatorname{Gal}(\bar L/L)$, hence by a continuous character $\nu$. Evaluation $\mathcal F_{\bar a}^{(1)}\otimes_{L_\lambda}\mathcal N\to\mathcal F_{\bar a}^{(2)}$ is equivariant, so it is a morphism of lisse sheaves on $U_L$, with $\mathcal N$ the rank-one sheaf pulled back from $\operatorname{Spec}L$; it is an isomorphism by the previous step. Thus $\mathcal F_{\bar a}^{(2)}\cong\mathcal F_{\bar a}^{(1)}\otimes\nu$.
It remains to show that $\nu=1$. Let $K$, $\bar\xi$, $G_K$, $I$, $E_0$ and $S_0$ be as in Lemma~\ref{lem:v5_cus_res_kum}, and let $\psi$ be the character of $G_K$ on the stalk at $\bar\xi$ of the Kummer sheaf $\mathcal L_{-j}$, of rank one by Lemma~\ref{lem:v5_eta_eig_twi}(2), which is built from $[d]:s\mapsto s^d$ alone and so is the same for both models. By Lemma~\ref{lem:v5_eta_eig_twi}(2), $\mathcal F_{\bar a}^{(i)}\cong\mathbb V^{(i)}_{\chi_{G_i}^{-1}}\otimes\mathcal L_{-j}$, and by Lemma~\ref{lem:v5_cus_res_kum}(2) the stalk of $\mathbb V^{(i)}_{\chi_{G_i}^{-1}}$ at $\bar\xi$ is $S_0$ for both $i$. So, as representations of $G_K$,
\[
S_0\otimes\psi\cong S_0\otimes\psi\otimes\nu|_{G_K},\qquad\text{hence}\qquad S_0\cong S_0\otimes\nu|_{G_K},
\]
where $\nu|_{G_K}$ is $\nu$ composed with restriction $G_K\to\operatorname{Gal}(\bar L/L)$, which is trivial on $I$. Taking $I$-invariants gives $S_0^I\cong S_0^I\otimes\nu$ as representations of $G_K/I=\operatorname{Gal}(\bar L/L)$ (Lemma~\ref{lem:v5_cus_res_kum}(3)). As $S_0^I$ is a line, $\nu=1$. So $\mathcal F_{\bar a}^{(1)}\cong\mathcal F_{\bar a}^{(2)}$.
By Lemma~\ref{lem:v5_eta_eig_twi}(3), $\mathcal F_a^{(i)}\cong\mathcal Hom(\mathcal F_{\bar a}^{(i)},L_\lambda(-(k-2)))$, so $\mathcal F_a^{(1)}\cong\mathcal F_a^{(2)}$. The last assertion follows by functoriality of $o_*$ and of $H^1(\mathbb P^1_{\bar L},-)$.
\end{proof}
\begin{lemma}\label{lem:v5_cus_res_kum}
Let $(X',Z',E,G,\chi_G)$ be a modular model, at a prime $\mathfrak P$ of $L$ of residue degree one over $p\notin\Sigma$, of a Kummer twist datum $(\Gamma,t,f,a,R)$ with singular set $S$. Let $\ell$ be a prime, $\lambda$ a prime of $L$ above $\ell$, and $\mathbb V_{\chi_G}$, $\mathbb V_{\chi_G^{-1}}$ its Kummer eigensheaves, restricted to $U_L=\mathbb P^1_L\setminus S$. Let $T\in t+t^2\mathbb Z[\frac1M][[t]]$ be the compositional inverse of the $q$-expansion $t(q)$ of the Hauptmodul, so that $q=T(t)$. Let $K=L((t))$, fix an algebraic closure $\bar K$, let $\bar L$ be the algebraic closure of $L$ in $\bar K$, put $G_K=\operatorname{Gal}(\bar K/K)$ and $I=\operatorname{Gal}(\bar K/\bar LK)$, and let $\bar\xi:\operatorname{Spec}\bar K\to U_L$ be the geometric point defined by $L(t)\subset K\subset\bar K$. Let $E_0=\mathrm{Tate}(T(t))$ be the Tate curve over $K$ with parameter $T(t)$, and
\[
S_0=\operatorname{Sym}^{k-2}H^1(E_{0,\bar K},\mathbb Q_\ell)\otimes_{\mathbb Q_\ell}L_\lambda ,
\]
with the natural action of $G_K$. Then:
\begin{enumerate}
\item $\operatorname{End}_{\bar K}(E_{0,\bar K})=\mathbb Z$.
\item The stalks $(\mathbb V_{\chi_G})_{\bar\xi}$ and $(\mathbb V_{\chi_G^{-1}})_{\bar\xi}$, with their actions of $G_K$, are both isomorphic to $S_0$.
\item $S_0^{I}$ is a line, and restriction to $\bar L$ induces an isomorphism $G_K/I\cong\operatorname{Gal}(\bar L/L)$.
\end{enumerate}
\end{lemma}
\begin{proof}
Since $T(t)$ has $t$-adic valuation one, $E_0$ is the Tate curve with split multiplicative reduction, and for every $n$ the group $E_0[\ell^n](\bar K)$ is the extension of $\mathbb Z/\ell^n$ by $\mu_{\ell^n}$ formed by the classes of $\zeta\,T(t)^{b/\ell^n}$, $\zeta\in\mu_{\ell^n}$, $b\in\mathbb Z$ \cite{locbib:DeligneRapoport1973}, VII, \S1. The group $I$ fixes $\mu_{\ell^\infty}\subset\bar L$, and it acts transitively on the $\ell^n$-th roots of $T(t)$, because $T(t)$ is a uniformiser of the discretely valued field $\bar LK=\bigcup_{L'}L'((t))$ ($L'$ finite over $L$) and $X^{\ell^n}-T(t)$ is Eisenstein. Hence, in a suitable basis $e,e'$ of $V=H^1(E_{0,\bar K},\mathbb Q_\ell)$, every element of $I$ acts by a matrix $\bigl(\begin{smallmatrix}1&*\\0&1\end{smallmatrix}\bigr)$, the line $\mathbb Q_\ell e$ being the space of forms on $T_\ell E_0$ that vanish on $T_\ell\mu$, and the image of every open subgroup of $I$ contains a nontrivial unipotent.
\emph{Proof of (1).} Let $\alpha\in\operatorname{End}_{\bar K}(E_{0,\bar K})$. It is defined over a finite extension $K_1\subset\bar K$ of $K$, so $\alpha^*$ commutes on $V$ with $I\cap\operatorname{Gal}(\bar K/K_1)$, which is open in $I$ and so contains an element acting by a unipotent $u\neq1$. The commutant of $u$ in $\operatorname{End}(V)$ is $\mathbb Q_\ell\oplus\mathbb Q_\ell N$ with $N=u-1$, $N^2=0$; write $\alpha^*=a+bN$. The characteristic polynomial of $\alpha^*$ on $V$ is $(X-a)^2$, and it equals $X^2-\operatorname{tr}(\alpha)X+\deg\alpha$ with integer coefficients \cite{locbib:Silverman2009}, Proposition III.8.6 (stated for $T_\ell$; $V$ is its dual). So $2a\in\mathbb Z$ and $a^2\in\mathbb Z$, whence $a\in\mathbb Z$. Then $\beta=\alpha-[a]$ acts on $V$ by the nilpotent $bN$, so $\deg\beta=\det(\beta^*)=0$ and $\beta=0$.
\emph{Proof of (3).} In characteristic zero $\operatorname{Sym}^{k-2}(u)$ of a nontrivial unipotent $u\in\mathrm{GL}(V)$ is a single unipotent Jordan block of size $k-1$: its logarithm is the derivation of $\operatorname{Sym}^{\bullet}V$ induced by $N$, which maps $e^{i}e'^{\,k-2-i}$ to a nonzero multiple of $e^{i+1}e'^{\,k-3-i}$. So $S_0^I$ has dimension at most one, and it contains $e^{k-2}$. As $L$ is algebraically closed in $K$, restriction $G_K\to\operatorname{Gal}(\bar L/L)$ is surjective, and its kernel is $I$.
Let $B$ be the set of $K$-morphisms $y:\operatorname{Spec}\bar K\to X'_U$ with $\varpi'\circ y=\bar\xi$; put $E_y=y^*E$, an elliptic curve over $\bar K$, and $S_y=\operatorname{Sym}^{k-2}H^1(E_y,\mathbb Q_\ell)\otimes L_\lambda$. Then $(\varpi'_*\operatorname{Sym}^{k-2}\mathcal H\otimes L_\lambda)_{\bar\xi}=\bigoplus_{y\in B}S_y$. The group $G$ acts on $B$ by $y\mapsto g\circ y$, transitively, since $X'_L/G\cong\mathbb P^1_L$ (M3) \cite{locbib:BourbakiAC56}, Ch.~V, \S2, no.~2, Th.~2; and $g^\sharp$ maps $v=(v_y)$ to $(c_g\pi_{g,y}^*v_{g\circ y})_y$, where $\pi_{g,y}:E_y\to E_{g\circ y}$ is the fibre of $\pi_g$. The group $G_K$ acts on $B$ by $\sigma(y)=y\circ\operatorname{Spec}(\sigma)$, and on the stalk by transport of structure: the projection $f_{\sigma,y}:E_{\sigma(y)}=E_y\times_{\operatorname{Spec}\bar K,\operatorname{Spec}\sigma}\operatorname{Spec}\bar K\to E_y$ is an isomorphism of schemes over $\operatorname{Spec}\sigma$, and $\sigma$ maps $S_y$ to $S_{\sigma(y)}$ by $f_{\sigma,y}^*$. The two actions commute. In the same way $\sigma$ acts on $S_0$ by $(f^0_\sigma)^*$, where $f^0_\sigma=\mathrm{id}\times\operatorname{Spec}\sigma$ is the transport of $E_{0,\bar K}=E_0\times_K\operatorname{Spec}\bar K$. Finally, $f\omega^{\otimes(k-2)}$ is a rational section over $X'_L$ (M4), regular and nonzero at the generic points of $X'_L$ (on $X'_0$ it is $f(\tau)(2\pi i\,dz)^{\otimes(k-2)}$, and $G$ permutes the components); its fibres $\phi_y\in H^0(E_y,\Omega^1)^{\otimes(k-2)}$ satisfy $f_{\sigma,y}^*\phi_y=\phi_{\sigma(y)}$, and (M4) gives
\begin{equation}
c_g\,\pi_{g,y}^*\,\phi_{g\circ y}=\chi_G(g)\,\phi_y\qquad(g\in G,\ y\in B).
\end{equation}
We next produce a point $y_0\in B$ with a normalised isomorphism $\iota_0:E_{y_0}\to E_{0,\bar K}$. Let $W$, $\infty'\in Z'(W)$, $q'$ and $w$ be as in (M5), and let $x_0\in X'_L$ be the image of the generic point of $\infty'$, a closed point with $t(x_0)=0$. The completed local ring $A$ of $X'_L$ at $x_0$ is a discrete valuation ring finite over $L[[t]]$ ($t$ is finite, (M3)), so $F=\operatorname{Frac}A$ is finite over $K$. The generic point of $\infty'$ is a $\operatorname{Frac}(W)$-point of $X'_L\otimes_L\operatorname{Frac}(W)$ over $x_0$, at which $q'$ restricts to a uniformiser; so the completed local ring there is $\operatorname{Frac}(W)[[q']]$, the induced map $A\to\operatorname{Frac}(W)[[q']]$ is a local injection, and $F$ embeds over $K$ into $F^+=\operatorname{Frac}(W)((q'))$, with $t\mapsto t(q)$, $q=q'^{\,w}$. By (M5) and \cite{locbib:EGAIII1}, (5.4.1), $E\times_{X'}\operatorname{Spec}W[[q']]$ is $\mathrm{Tate}(q)\otimes W[[q']]$, and $f\omega^{\otimes(k-2)}=F(t)\,\omega_{\mathrm{can}}^{\otimes(k-2)}$ there; as $T(t)=q$ in $F^+$, we get an isomorphism $\iota^+:E_{F^+}\to E_{0,F^+}$ with $\iota^{+*}(F(t)\omega_{\mathrm{can}}^{\otimes(k-2)})=f\omega^{\otimes(k-2)}$. Since $j(E_0)=j(T(t))$ has a pole at $t=0$, it is neither $0$ nor $1728$, so $E_F$ and $E_{0,F}$, which have the same $j$-invariant, are quadratic twists of each other, and their isomorphisms over any extension of $F$ are $\pm$ one of them \cite{locbib:Silverman2009}, Theorem III.10.1 and Proposition X.5.4. Hence $\iota^+$ is the base change of an isomorphism $\iota'$ defined over $F'=F(\sqrt\delta)\subset F^+$ for some $\delta\in F^\times$, and $\iota'^*(F(t)\omega_{\mathrm{can}}^{\otimes(k-2)})=f\omega^{\otimes(k-2)}$, as this identity holds in $F^+$. Choose a $K$-embedding $F'\to\bar K$. It defines $y_0\in B$ (the image of $\operatorname{Spec}F\to X'_L$ is a generic point, so $y_0$ lies over $U$) and $\iota_0=\iota'\otimes\bar K$, with $\iota_0^*(F(t)\omega_{\mathrm{can}}^{\otimes(k-2)})=\phi_{y_0}$.
Let $\sigma\in G_K$ and $g\in G$ with $g\circ\sigma^{-1}(y_0)=y_0$; put $y=\sigma^{-1}(y_0)$ and $\Pi=\pi_{g,y}\circ f_{\sigma,y}:E_{y_0}\to E_y\to E_{y_0}$, an isogeny of group schemes over $\operatorname{Spec}\sigma$ of degree $\deg\pi_g$. Then $(f^0_\sigma)^{-1}\circ\iota_0\circ\Pi\circ\iota_0^{-1}$ is a $\bar K$-linear isogeny of $E_{0,\bar K}$ of degree $\deg\pi_g$, so by (1) it is $[m]$ with $m\in\mathbb Z$, $m^2=\deg\pi_g$:
\begin{equation}
\iota_0\circ\Pi\circ\iota_0^{-1}=[m]\circ f^0_\sigma .
\end{equation}
Apply both sides to differentials. Pull-back along $\Pi$ is $\sigma$-semilinear and, by the identity $c_g\pi_{g,y}^*\phi_{y_0}=\chi_G(g)\phi_y$ (the (M4) display with $g\circ y=y_0$) and $f_{\sigma,y}^*\phi_y=\phi_{y_0}$, maps $\phi_{y_0}$ to $c_g^{-1}\chi_G(g)\phi_{y_0}$ (as $c_g,\chi_G(g)\in L\subset K$). On the other side, $(f^0_\sigma)^*$ fixes the $K$-rational $\omega_{\mathrm{can}}$ and $F(t)\in K$, and $[m]^*\omega_{\mathrm{can}}=m\,\omega_{\mathrm{can}}$; with $\iota_0^*(F(t)\omega_{\mathrm{can}}^{\otimes(k-2)})=\phi_{y_0}$ this gives $\Pi^*\phi_{y_0}=m^{k-2}\phi_{y_0}$. Since $\phi_{y_0}\neq0$,
\begin{equation}
\chi_G(g)=c_g\,m^{k-2},\qquad\chi_G(g)^2=c_g^2m^{2(k-2)}=(\deg\pi_g)^{-(k-2)}(\deg\pi_g)^{k-2}=1 .
\end{equation}
\emph{Proof of (2).} Let $\chi\in\{\chi_G,\chi_G^{-1}\}$ and let $p_0$ be the projection of the stalk onto $S_{y_0}$. On the $\chi$-part $p_0$ is injective: if $g\circ y=y_0$, then $\chi(g)v_y=c_g\pi_{g,y}^*v_{y_0}$. It is surjective: for $w\in S_{y_0}$ put $v_y=\chi(g)^{-1}c_g\pi_{g,y}^*w$ for any $g$ with $g\circ y=y_0$; this does not depend on $g$, and $v=(v_y)$ lies in the $\chi$-part, by the composition rule $g^\sharp h^\sharp=(hg)^\sharp$ of Lemma~\ref{lem:v5_eta_eig_twi}(2) and because, for $h$ fixing $y_0$, the case $\sigma=1$ above gives $\pi_{h,y_0}=[m_h]$ (by (1), through $\iota_0$) and $c_h\operatorname{Sym}^{k-2}(\pi_{h,y_0}^*)=c_hm_h^{k-2}=\chi_G(h)=\chi(h)$. Transport the action of $G_K$ to $S_{y_0}$ through $p_0$. For $\sigma\in G_K$ and $v$ in the $\chi$-part, with $y$ and $g$ as above, $(\sigma v)_{y_0}=f_{\sigma,y}^*v_y=\chi(g)^{-1}c_g\,f_{\sigma,y}^*\pi_{g,y}^*v_{y_0}$, that is, $\sigma$ acts on $S_{y_0}$ by $\chi(g)^{-1}c_g\operatorname{Sym}^{k-2}(\Pi^*)$. By the displayed identity for $\Pi$, $\Pi^*=\iota_0^*\circ m\,(f^0_\sigma)^*\circ(\iota_0^*)^{-1}$ on $H^1$, so $\sigma$ acts by
\[
\chi(g)^{-1}c_gm^{k-2}\cdot\iota_0^*\circ\operatorname{Sym}^{k-2}\bigl((f^0_\sigma)^*\bigr)\circ(\iota_0^*)^{-1}=\chi(g)^{-1}\chi_G(g)\cdot\iota_0^*\circ\sigma_{S_0}\circ(\iota_0^*)^{-1},
\]
where $\sigma_{S_0}=\operatorname{Sym}^{k-2}((f^0_\sigma)^*)$ is the natural action of $\sigma$ on $S_0$, and $\chi(g)^{-1}\chi_G(g)=1$ because $\chi_G(g)=\pm1$. So $(\iota_0^*)^{-1}\circ p_0$ identifies $(\mathbb V_\chi)_{\bar\xi}$ with $S_0$, $G_K$-equivariantly.
\end{proof}
Crystalline comparison is needed at auxiliary split primes. Its range $p>k$ therefore imposes no extra exclusion on the prime in the final congruence, where $p\geq k$ suffices. The proof applies Faltings' logarithmic comparison \cite[Theorems~5.3 and 6.2]{locbib:Faltings1989} to the Kummer cover and checks its isogeny eigenspaces and residue kernels.
\begin{prop}\label{prop:v5_cry_com_for}
Let $(\Gamma,t,f,a,R)$ be an admissible Kummer twist datum with field $L$ and exceptional set $\Sigma$. Let $p\notin\Sigma$ with $p>k$, let $\mathfrak P$ be a prime of $L$ of residue degree one over $p$, fix an embedding $\bar L\subset\bar{\mathbb Q}_p$ inducing on $L$ the embedding $\iota_{\mathfrak P}:L\to\mathbb Q_p$ defined by $\mathfrak P$, and let $D_{\mathfrak P}\subset\operatorname{Gal}(\bar L/L)$ be the corresponding decomposition group, identified with $\operatorname{Gal}(\bar{\mathbb Q}_p/\mathbb Q_p)$. Let $V_{a,\lambda}$, $V_{\bar a,\lambda}$ be the $\lambda$-adic realisations.
\begin{enumerate}
\item For every prime $\lambda$ of $L$ above $p$, the restrictions of $V_{a,\lambda}$ and $V_{\bar a,\lambda}$ to $D_{\mathfrak P}$ are crystalline.
\item Let $\lambda=\mathfrak P$, so that $L_\lambda=\mathbb Q_p$. For every modular model of the datum at $\mathfrak P$, with eigenlattice $H_{a,p}$ and crystalline Frobenius $\varphi$,
\[
D_{\mathrm{cris}}(V_{a,\mathfrak P})=\bigl(V_{a,\mathfrak P}\otimes_{\mathbb Q_p}B_{\mathrm{cris}}\bigr)^{D_{\mathfrak P}}\cong H_{a,p}\otimes\mathbb Q_p
\]
as filtered $\varphi$-modules. Consequently $V_{a,\mathfrak P}$ and $V_{\bar a,\mathfrak P}$ are two-dimensional with Hodge--Tate weights $0$ and $k-1$, each of multiplicity one, in the normalisation in which $\mathbb Q_p(-1)$ has weight $1$.
\end{enumerate}
\end{prop}
\begin{proof}
Let $(X',Z',E,G,\chi_G)$ be a modular model at $\mathfrak P$: one exists by Proposition~\ref{prop:v5_exi_mod_mod}, and in (2) we take the given one; the argument uses only (M1)--(M5). By Proposition~\ref{prop:v5_glo_sys_kum}(1) we may compute $V_{a,\lambda}$ and $V_{\bar a,\lambda}$ with the sheaves of this model. Let $C^\circ=C\setminus D_C$ and $\mathbb T=\rho^*R^1\pi_*\mathbb Z_p$, a lisse sheaf on $C^\circ_{\mathbb Q_p}$.
Let $\lambda\mid p$, let $M_\lambda=\operatorname{Sym}^{k-2}\mathbb T\otimes_{\mathbb Z_p}L_\lambda$ on $C^\circ_{\bar{\mathbb Q}_p}$, with $\tilde G$ acting by the maps $g^\sharp$ (constants $c_g$ and values of $\chi$ taken in $L_\lambda$), and let $\mathcal W_\lambda=H^1(C_{\bar{\mathbb Q}_p},o_*M_\lambda)$, the image of $H^1_c(C^\circ_{\bar{\mathbb Q}_p},M_\lambda)\to H^1(C^\circ_{\bar{\mathbb Q}_p},M_\lambda)$ (Lemma~\ref{lem:v5_eig_coh_cov}(1)). The cohomology of the proper $\mathbb P^1$ does not change under the extension $\bar L\subset\bar{\mathbb Q}_p$ of algebraically closed fields, and Lemma~\ref{lem:v5_eig_coh_cov}(2), with $\Omega=\bar{\mathbb Q}_p$ and $\ell=p$, gives
\[
V_{a,\lambda}|_{D_{\mathfrak P}}=e_\chi\mathcal W_\lambda,\qquad V_{\bar a,\lambda}|_{D_{\mathfrak P}}=e_{\chi^{-1}}\mathcal W_\lambda ,
\]
with $e_{\chi^{\pm1}}$ the idempotents attached to $\chi^{\pm1}$. The automorphisms in $\tilde G$ and the isogenies $\pi_g$ are defined over $\mathcal O_{L,(\mathfrak P)}\subset\mathbb Z_p$, so the $g^\sharp$, and the $e_{\chi^{\pm1}}$, commute with $D_{\mathfrak P}=\operatorname{Gal}(\bar{\mathbb Q}_p/\mathbb Q_p)$. As a representation over $\mathbb Q_p$, $\mathcal W_\lambda=\mathcal W\otimes_{\mathbb Q_p}L_\lambda$ with $\mathcal W=H^1(C_{\bar{\mathbb Q}_p},o_*\operatorname{Sym}^{k-2}\mathbb T\otimes\mathbb Q_p)$.
Following Faltings, we show that $\mathcal W$ is crystalline and describe $D_{\mathrm{cris}}(\mathcal W)$. The hypotheses of the theory hold: $C_{\mathbb Z_p}$ is smooth and proper over $\mathbb Z_p$ and $D_C$ is finite \'etale, a divisor with normal crossings relative to $\mathbb Z_p$ (Lemma~\ref{lem:v5_smo_kum_cov}(2)). By (M1), $E\to X'$ is a proper generalised elliptic curve which near each point of $Z'$ is a Tate curve $\mathrm{Tate}(\delta q^m)$, with nodes of local equation $xy=\delta q^m$, so it is logarithmically smooth over $(X',Z')$ for the logarithmic structures defined by $Z'$ and its inverse image \cite{locbib:Kato1989}, Theorem 3.5, as for modular curves in \cite{bib:diamond2025a}, \S2.2. By \cite{locbib:Faltings1989}, Theorem 6.2, applied to $E\to X'$ as in \cite{locbib:FaltingsJordan1995}, \S1, p.~4, and \cite{bib:diamond2025a}, \S2.2, $H$ with its Hodge filtration, logarithmic Gauss--Manin connection and Frobenius is an object of $\mathcal{MF}^\nabla_{[0,1]}(X'_{\mathbb Z_p})$ associated to $R^1\pi_*\mathbb Z_p$. Pulling back along the morphism of logarithmic schemes $\rho:(C,D_C)\to(X',Z')$, $\rho^*H$ is an object of $\mathcal{MF}^\nabla_{[0,1]}(C_{\mathbb Z_p})$ associated to $\mathbb T$ (compatibility with pull-back, \cite{locbib:Faltings1989}, V a), as used in \cite{bib:diamond2025a}, \S3.3). Alternatively, Theorem 6.2 applies directly to $E\times_{X'}C\to C$, a proper generalised elliptic curve with nodes of local equation $xy=\delta'v^{em}$, $v$ a parameter at a point of $D_C$ and $e\mid d$ the ramification index of $\rho$, logarithmically smooth over $(C,D_C)$ by the same criterion. As the association respects tensor products (\cite{locbib:Faltings1989}, II h), \cite{bib:diamond2025a}, \S2.2) and $k-2\le p-2$, $M_k$ is an object of $\mathcal{MF}^\nabla_{[0,k-2]}(C_{\mathbb Z_p})$ associated to $\operatorname{Sym}^{k-2}\mathbb T$. Since $1+(k-2)\le p-2$, that is $p>k$, the comparison theorem \cite{locbib:Faltings1989}, Theorem 5.3 (in the form of \cite{bib:mokrane2000}, published version, Ast\'erisque 280 (2002), \S6.1, Theorem 7, with $i=1$ and $a=k-2$), identifies $H^1(C^\circ_{\bar{\mathbb Q}_p},\operatorname{Sym}^{k-2}\mathbb T)$, naturally and functorially, with the Galois module associated to the logarithmic crystalline cohomology $H^1_{\mathrm{crys}}$ of $(C,D_C)$ with coefficients $M_k$, an object of $\mathcal{MF}_{[0,k-1]}(\mathbb Z_p)$; and likewise $H^1_c$ with $H^1_{c,\mathrm{crys}}$, whose underlying filtered module is the hypercohomology of the logarithmic de Rham complex of $M_k(-D_C)$, compatibly with the forget-supports maps (\cite{locbib:FaltingsJordan1995}, \S1, p.~4; \cite{bib:diamond2025a}, \S\S2.2 and 2.5). By the theory of Fontaine and Laffaille \cite{locbib:FontaineLaffaille1982}, as recalled in \cite{bib:diamond2025a}, \S1.1, the Galois module associated to an object $A$ of $\mathcal{MF}_{[0,p-2]}(\mathbb Z_p)$ spans a crystalline representation with $D_{\mathrm{cris}}\cong A\otimes\mathbb Q_p$ as filtered $\varphi$-modules, functorially. As $D_{\mathrm{cris}}$ is exact on crystalline representations and $\mathcal W$ is the image of $H^1_c\otimes\mathbb Q_p\to H^1\otimes\mathbb Q_p$, $\mathcal W$ is crystalline and
\[
D_{\mathrm{cris}}(\mathcal W)=\operatorname{Im}\bigl(H^1_{c,\mathrm{crys}}\to H^1_{\mathrm{crys}}\bigr)\otimes\mathbb Q_p .
\]
The underlying filtered module of $H^1_{\mathrm{crys}}$ is the hypercohomology $H_{\mathbb Z}$ of the logarithmic de Rham complex of $M_k$, and its Frobenius is the crystalline Frobenius $\varphi$ of Lemma~\ref{lem:v5_par_eig_the}(1), both being the logarithmic crystalline cohomology of $(C_{\mathbb F_p},D_C)$ with coefficients $M_k$ \cite{locbib:Kato1989}, Theorem 6.4.
\emph{Proof of (1).} For $\lambda\mid p$, $V_{a,\lambda}|_{D_{\mathfrak P}}$ and $V_{\bar a,\lambda}|_{D_{\mathfrak P}}$ are direct summands of $\mathcal W\otimes_{\mathbb Q_p}L_\lambda$, a direct sum of copies of the crystalline $\mathcal W$. A direct summand of a crystalline representation is crystalline, since the comparison map $D_{\mathrm{cris}}(X)\otimes_{\mathbb Q_p}B_{\mathrm{cris}}\to X\otimes_{\mathbb Q_p}B_{\mathrm{cris}}$ is additive in $X$, and $X$ is crystalline exactly when it is an isomorphism \cite{locbib:Fontaine1994}, \S1.
The comparison commutes with $\tilde G$. On the \'etale side $(g,\zeta)\in\tilde G$ acts by the maps $g^\sharp=c_g\operatorname{Sym}^{k-2}(\pi_g^*)\circ g^*$ and $[\zeta]^*$; on the crystalline side by the action $x\mapsto g^*x$ of Lemma~\ref{lem:v5_par_eig_the}(1), given by the same formulas, where $c_g\operatorname{Sym}^{k-2}(\pi_g^*)$ extends over $Z'$ and respects all structures by (M2). The morphisms of $\mathcal{MF}^\nabla$ and of \'etale sheaves to be compared are determined by their restrictions to the open part, the functor of \cite{locbib:Faltings1989}, Theorem 2.6, being fully faithful (\cite{bib:diamond2025a}, \S2.2), and there they come from the isogeny $\pi_g$ of elliptic curves. Both are induced by the automorphism $(g,\zeta)$ of $(C,D_C)$ together with the isogeny $\pi_g$ of degree prime to $p$. The comparison isomorphisms are natural for such data: by \cite{locbib:Faltings1989}, 4 c), and the proof of its Theorem 6.2, an isogeny of the families induces a morphism of the associated objects of $\mathcal{MF}^\nabla$ which corresponds to the induced morphism of \'etale sheaves (loc. cit., V a)), exactly as for the isogenies defining Hecke operators in \cite{bib:diamond2025a}, \S3.3, and \cite{locbib:FaltingsJordan1995}, proof of Theorem 1.2(1); and the isomorphism of Theorem 5.3 is functorial (\cite{bib:mokrane2000}, published version, \S6.1, Theorem 7). So $D_{\mathrm{cris}}$ carries $e_\chi$ on $\mathcal W$ to $e_\chi$ on $D_{\mathrm{cris}}(\mathcal W)$, the constants acting through $\iota_{\mathfrak P}$ on both sides.
\emph{Proof of (2).} Let $\lambda=\mathfrak P$. By the comparison above and its equivariance, $D_{\mathrm{cris}}(V_{a,\mathfrak P})=e_\chi\operatorname{Im}(H^1_{c,\mathrm{crys}}\to H^1_{\mathrm{crys}})\otimes\mathbb Q_p\subset e_\chi H_{\mathbb Z}\otimes\mathbb Q_p$. Classes in the image of $H^1_{c,\mathrm{crys}}$ have vanishing residues: on an affine neighbourhood of $z\in D_C$ such a class is represented by a logarithmic $1$-form with coefficients in $M_k(-D_C)$, and $\operatorname{Res}_z$ is the constant term at $z$ of the $e_0$-coefficient of the component near $z$ (proof of Lemma~\ref{lem:v5_par_eig_the}(3)), which vanishes. Hence $D_{\mathrm{cris}}(V_{a,\mathfrak P})\subset H_{a,p}\otimes\mathbb Q_p$, the residue-free $\chi$-part (Lemma~\ref{lem:v5_par_eig_the}(2)). Both have dimension two: $V_{a,\mathfrak P}$ by Proposition~\ref{prop:v5_glo_sys_kum}(1), and it is crystalline by (1); $H_{a,p}$ by Lemma~\ref{lem:v5_par_eig_the}(3) and (R). So they are equal, as $\varphi$-modules, and as filtered modules, the filtration of $D_{\mathrm{cris}}(V_{a,\mathfrak P})$ being induced from $D_{\mathrm{cris}}(\mathcal W)$ ($D_{\mathrm{cris}}$ is strict) and that of $H_{a,p}\otimes\mathbb Q_p$ from $H_{\mathbb Z}\otimes\mathbb Q_p$.
It remains to compute the Hodge--Tate weights. Over $\mathbb Q_p$, $D_{\mathrm{dR}}=D_{\mathrm{cris}}$ with its filtration, and the Hodge--Tate weights are the jumps of the filtration, the jump of $\mathbb Q_p(-1)$ being at $1$. On $H_{a,p}\otimes\mathbb Q_p$, $F^0$ is everything, $F^1=F^{k-1}$ is a line by Lemma~\ref{lem:v5_par_eig_the}(3) and (P), and $F^k=0$, the filtration of $H^1$ with coefficients in $\mathcal{MF}_{[0,k-2]}$ lying in $[0,k-1]$. So the weights of $V_{a,\mathfrak P}$ are $0$ and $k-1$. By Lemma~\ref{lem:v5_eta_eig_twi}(3) and Poincar\'e duality on $\mathbb P^1_{\bar{\mathbb Q}_p}$ \cite{locbib:Deligne1974}, (2.12) ($p$ is invertible on $\bar{\mathbb Q}_p$), $V_{\bar a,\mathfrak P}\cong\operatorname{Hom}(V_{a,\mathfrak P},\mathbb Q_p(-(k-1)))$, $D_{\mathfrak P}$-equivariantly; it is crystalline by (1), with weights $(k-1)-0$ and $(k-1)-(k-1)$, that is $k-1$ and $0$.
\end{proof}
\subsection{The determinant as a Hecke character} \label{subsec:hecke}
We now identify the normalised determinants $\varepsilon_{\mathfrak P}$ as values of one algebraic Hecke character of $L$. At an auxiliary split prime the determinant of the global representation is Hodge--Tate, so Serre's theory gives an algebraic Hecke character. A second auxiliary prime allows us to remove the first from the modulus. We use the degree-one-prime formulations in Lemmas~\ref{lem:v5_hec_cha_ht} and~\ref{lem:v5_hec_cha_uni}.
\begin{definition}\label{def:v5_alg_hec_cha}
Let $K$ be a number field, Galois over $\mathbb Q$, and $\mathfrak m$ a nonzero integral ideal of $K$; let $I^{\mathfrak m}$ be the group of fractional ideals of $K$ prime to $\mathfrak m$. An \textbf{algebraic Hecke character of $K$ with values in $K$ and modulus $\mathfrak m$} is a homomorphism $\chi:I^{\mathfrak m}\to K^\times$ for which there are integers $(a_\sigma)_{\sigma\in\operatorname{Gal}(K/\mathbb Q)}$, its \textbf{infinity type}, such that
\[
\chi\bigl((\alpha)\bigr)=\prod_{\sigma\in\operatorname{Gal}(K/\mathbb Q)}\sigma(\alpha)^{a_\sigma}
\]
for every totally positive $\alpha\in K^\times$ with $\alpha\equiv1\bmod^\times\mathfrak m$.
\end{definition}
\begin{prop}\label{prop:v5_hec_cha_dat}
Let $(\Gamma,t,f,a,R)$ be an admissible Kummer twist datum with field $L$ and exceptional set $\Sigma$. There is an algebraic Hecke character $\varepsilon$ of $L$ with values in $L$, whose modulus is prime to every prime of $L$ of residue degree one over a prime not in $\Sigma$, such that
\[
\varepsilon(\mathfrak P)=\varepsilon_{\mathfrak P}
\]
for every prime $\mathfrak P$ of $L$ of residue degree one over a prime $p\notin\Sigma$, where $\varepsilon_{\mathfrak P}$ is the number of Proposition~\ref{prop:v5_glo_sys_kum}(2).
\end{prop}
\begin{proof}
Put
\[
\delta(\mathfrak P)=\varepsilon_{\mathfrak P}p^{k-1}
\]
for a degree-one prime $\mathfrak P$ above $p\notin\Sigma$, with the coefficients of Proposition~\ref{prop:v5_glo_sys_kum}(2). We construct a Hecke character with these values and then divide by the $(k-1)$st power of the norm character.
The field $L$ is abelian over $\mathbb Q$, since it is generated by roots of unity and square roots of integers. Choose distinct primes $\ell_1,\ell_2>k$, outside $\Sigma$, that split completely in $L$, by Chebotarev's theorem \cite[Ch.~I, \S2.2]{locbib:Serre1989}, and primes $\lambda_i\mid\ell_i$. Write $\mathcal P$ for the degree-one primes of $L$ above rational primes outside $\Sigma$.
Apply Lemma~\ref{lem:v5_hec_cha_ht} to
\[
\psi_i=\det V_{\bar a,\lambda_i}:G_L\longrightarrow
L_{\lambda_i}^{\times}=\mathbb Q_{\ell_i}^{\times}.
\]
Its Frobenius condition is Proposition~\ref{prop:v5_glo_sys_kum}(2). At every $w\mid\ell_i$, the representation $V_{\bar a,\lambda_i}$ is crystalline by Proposition~\ref{prop:v5_cry_com_for}(1), since $\ell_i$ splits completely and $\ell_i>k$. Its determinant is therefore crystalline, hence Hodge--Tate \cite[1.5.2, 3.8, 5.1.4 and 5.1.7]{locbib:Fontaine1994}. The lemma gives an algebraic Hecke character $\chi_i$, with values in $L$, such that
\[
\chi_i(\mathfrak P)=\delta(\mathfrak P)
\qquad(\mathfrak P\in\mathcal P,\ \mathfrak P\nmid\ell_i).
\]
Its modulus is supported on the primes above $\ell_i$ and on a finite set $T_i$ disjoint from $\mathcal P$.
Choose an ideal $\mathfrak n$, supported on $T_1\cup T_2$, and ideals $\mathfrak r_i$, supported on the primes above $\ell_i$, with exponents large enough that $\mathfrak n\mathfrak r_i$ is a modulus for $\chi_i$. These three supports are pairwise disjoint: every prime above either $\ell_i$ belongs to $\mathcal P$. The characters agree on the degree-one primes prime to both moduli, so Lemma~\ref{lem:v5_hec_cha_uni}(2) gives an algebraic Hecke character $\chi$ of modulus $\mathfrak n$ restricting to both. Every $\mathfrak P\in\mathcal P$ is prime to $\mathfrak n$ and to at least one $\ell_i$; using that $i$ shows $\chi(\mathfrak P)=\delta(\mathfrak P)$.
The absolute norm $\mathrm N$ is an algebraic Hecke character of modulus $(1)$ and infinity type $(1)_\sigma$: for totally positive $\alpha$,
\[
\mathrm N((\alpha))=|N_{L/\mathbb Q}(\alpha)|
=\prod_\sigma\sigma(\alpha).
\]
Here $L$ is totally real or totally imaginary, so the norm on such $\alpha$ is positive. Thus
\[
\varepsilon=\chi\,\mathrm N^{1-k}
\]
is an algebraic Hecke character with values in $L$, whose modulus is prime to $\mathcal P$. Since $\mathrm N\mathfrak P=p$ for $\mathfrak P\in\mathcal P$ above $p$, it has the required value $\varepsilon(\mathfrak P)=\varepsilon_{\mathfrak P}$.
\end{proof}
\subsection{The rational-field newform} \label{subsec:newform}
When $L=\mathbb Q$, the Kummer character is quadratic and the multiplier is real. In this case the two character summands coincide, and Poincar\'e duality gives a pairing on the global representation itself. This determines the determinant and gives oddness. Lemma~\ref{lem:v5_mod_odd_pur} then produces a weight-$k$ newform from the Frobenius polynomials at good primes and the crystalline comparison at an auxiliary prime.
\begin{lemma}\label{lem:v5_equ_poi_pai}
Let $(\Gamma,t,f,a,R)$ be an admissible Kummer twist datum with field $L=\mathbb Q$ and exceptional set $\Sigma$. For a prime $\ell$ let $V_{a,\ell}$ and $V_{\bar a,\ell}$ be its $\ell$-adic realisations, representations of $G_{\mathbb Q}=\operatorname{Gal}(\bar{\mathbb Q}/\mathbb Q)$. Then $V_{a,\ell}\cong V_{\bar a,\ell}$, and there is a perfect $\mathbb Q_\ell$-bilinear pairing
\[
B_\ell:V_{\bar a,\ell}\times V_{\bar a,\ell}\to\mathbb Q_\ell(1-k)
\]
such that $B_\ell(\sigma x,\sigma y)=\sigma B_\ell(x,y)$ for $\sigma\in G_{\mathbb Q}$ and
\[
B_\ell(y,x)=(-1)^{k-1}B_\ell(x,y)\qquad(x,y\in V_{\bar a,\ell}).
\]
Thus $B_\ell$ is alternating if $k$ is even and symmetric if $k$ is odd.
\end{lemma}
\begin{proof}
We first identify the two sheaves. Fix a prime $p\notin\Sigma$ with $p\neq\ell$, and a modular model of the datum at $p$ (Definition~\ref{def:v5_mod_mod_kum}), which exists by Proposition~\ref{prop:v5_exi_mod_mod}; then $\mathcal U=U$ is smooth over $\mathbb Z_{(p)}$ with generic fibre $U_{\mathbb Q}=\mathbb P^1_{\mathbb Q}\setminus S$. The character $\chi_\Phi(g,\zeta)=\chi_G(g)\zeta^j$ of $\tilde G$ has finite order and values in $L^\times=\mathbb Q^\times$ ((M4) and $\mu_2\subset\mathbb Q$), hence values $\pm1$, so $\chi_\Phi^{-1}=\chi_\Phi$ and the $\chi_\Phi$- and $\chi_\Phi^{-1}$-parts of $\mathcal M$ coincide: $\mathcal F_a=\mathcal F_{\bar a}$ by their definition (Definition~\ref{def:v5_kum_eig_she}(2)). Put $\mathcal F=\mathcal F_a|_{U_{\mathbb Q}}$. By Proposition~\ref{prop:v5_glo_sys_kum}(1), $V_{a,\ell}$ and $V_{\bar a,\ell}$ are both isomorphic, as representations of $G_{\mathbb Q}$, to $V=H^1(\mathbb P^1_{\bar{\mathbb Q}},o_*\mathcal F)$, where $o:U_{\bar{\mathbb Q}}\hookrightarrow\mathbb P^1_{\bar{\mathbb Q}}$. It suffices to construct $B$ on $V$.
We next show that $\mathcal F$ carries a perfect pairing $\beta:\mathcal F\otimes\mathcal F\to\mathbb Q_\ell(2-k)$ of lisse sheaves on $U_{\mathbb Q}$ with $\beta(y\otimes x)=(-1)^k\beta(x\otimes y)$. By Lemma~\ref{lem:v5_kum_eig_pai}(1), the perfect alternating cup-product pairing $\langle\,,\rangle:\mathcal H\otimes\mathcal H\to\mathbb Q_\ell(-1)$ induces the pairing
\[
\langle x_1\cdots x_{k-2},y_1\cdots y_{k-2}\rangle=\frac1{(k-2)!}\sum_{\sigma\in S_{k-2}}\prod_{i=1}^{k-2}\langle x_i,y_{\sigma(i)}\rangle
\]
on $\operatorname{Sym}^{k-2}\mathcal H$; composed with the trace of the finite \'etale map $\varpi$ it gives a pairing on $\mathcal M$ whose restriction to $\mathcal F_a\otimes\mathcal F_{\bar a}$ is perfect on $U$, by Lemma~\ref{lem:v5_kum_eig_pai}(2), whose hypotheses hold by Lemma~\ref{lem:v5_eta_eig_twi}(1), (2). Let $\beta$ be its restriction to $U_{\mathbb Q}$. Since $\langle y_i,x_{\sigma(i)}\rangle=-\langle x_{\sigma(i)},y_i\rangle$, substituting $\sigma^{-1}$ for $\sigma$ gives $\langle y,x\rangle=(-1)^{k-2}\langle x,y\rangle$ on $\operatorname{Sym}^{k-2}\mathcal H$; this sign survives the trace and the restriction, so $\beta(y\otimes x)=(-1)^k\beta(x\otimes y)$.
By $\beta$, $\mathcal F\cong\mathcal F^\vee(2-k)$, so $\mathcal F^\vee(1)\cong\mathcal F(k-1)$. By the duality theorem \cite{locbib:Deligne1974}, Th\'eor\`eme (2.12), applied to the projective smooth connected curve $X=\mathbb P^1_{\bar{\mathbb Q}}$ over the algebraically closed field $\bar{\mathbb Q}$, the dense open set $U_{\bar{\mathbb Q}}$ and the lisse sheaf $\mathcal F|_{U_{\bar{\mathbb Q}}}$, the pairing $\operatorname{Tr}(x\cup y)$ between $H^1(X,o_*\mathcal F)$ and $H^1(X,o_*\mathcal F^\vee(1))$ is perfect. Transported along $\mathcal F^\vee(1)\cong\mathcal F(k-1)$ it becomes
\[
B(x,y)=\operatorname{Tr}\bigl(\beta_*(x\cup y)\bigr)\in\mathbb Q_\ell(1-k)\qquad(x,y\in V),
\]
where $x\cup y\in H^2(X,o_*\mathcal F\otimes o_*\mathcal F)$, $\beta_*$ is induced by $o_*\mathcal F\otimes o_*\mathcal F\to o_*(\mathcal F\otimes\mathcal F)\xrightarrow{\beta}o_*\mathbb Q_\ell(2-k)=\mathbb Q_\ell(2-k)$, and $\operatorname{Tr}:H^2(X,\mathbb Q_\ell(2-k))\to\mathbb Q_\ell(1-k)$ is the trace map. So $B$ is perfect.
The pairing $B$ is $G_{\mathbb Q}$-equivariant. The sheaf $\mathcal F$ and the pairing $\beta$ are defined on $U_{\mathbb Q}$, and $G_{\mathbb Q}$ acts on the cohomology of $X=\mathbb P^1_{\mathbb Q}\otimes\bar{\mathbb Q}$ through the second factor. The cup product and $\beta_*$ commute with this action by functoriality, and so does the trace map: it is the stalk at $\operatorname{Spec}\bar{\mathbb Q}$ of the trace morphism $R^2h_*\mathbb Q_\ell(1)\to\mathbb Q_\ell$ of the smooth proper map $h:\mathbb P^1_{\mathbb Q}\to\operatorname{Spec}\mathbb Q$, a morphism of sheaves on $\operatorname{Spec}\mathbb Q$ \cite{locbib:SGA4vol3}, Exp.~XVIII, Th\'eor\`eme 2.9. Hence $B(\sigma x,\sigma y)=\sigma B(x,y)$, where $\sigma$ acts on $\mathbb Q_\ell(1-k)$ through $\chi_\ell^{1-k}$, $\chi_\ell$ the $\ell$-adic cyclotomic character.
Finally we compute the symmetry of $B$. For classes $x,y$ of degree one, $y\cup x=-s_*(x\cup y)$, where $s$ is the symmetry of $o_*\mathcal F\otimes o_*\mathcal F$: this is the Koszul sign rule for cup products \cite{locbib:SGA4half}, Cycle, 1.2--1.3, used in the same way in loc.\ cit., Sommes trig., 3.6 c). As $\beta\circ s=(-1)^k\beta$, we get $\beta_*\circ s_*=(-1)^k\beta_*$, and so
\[
B(y,x)=\operatorname{Tr}\bigl(\beta_*(y\cup x)\bigr)=-(-1)^k\operatorname{Tr}\bigl(\beta_*(x\cup y)\bigr)=(-1)^{k-1}B(x,y).
\]
\end{proof}
\begin{prop}\label{prop:v5_det_odd_rat}
Let $(\Gamma,t,f,a,R)$ be an admissible Kummer twist datum with field $L=\mathbb Q$ and exceptional set $\Sigma$. For a prime $\ell$ let $V_\ell=V_{\bar a,\ell}$ be its $\ell$-adic realisation, a representation of $G_{\mathbb Q}=\operatorname{Gal}(\bar{\mathbb Q}/\mathbb Q)$, and for $p\notin\Sigma$ let $A_p\in\mathbb Z$ and $\varepsilon_p\in\{\pm1\}$ be as in Proposition~\ref{prop:v5_glo_sys_kum}(3). Let $\chi_\ell$ be the $\ell$-adic cyclotomic character and $c\in G_{\mathbb Q}$ a complex conjugation.
\begin{enumerate}
\item There is a continuous character $\psi:G_{\mathbb Q}\to\{\pm1\}$, unramified outside $\Sigma$, such that $\det V_\ell=\psi\,\chi_\ell^{1-k}$ for every prime $\ell$, and $\psi(\mathrm{Frob}_p)=\varepsilon_p$ for every prime $p\notin\Sigma$.
\item If $k$ is even, then $\psi=1$.
\item If $k$ is odd, then $\psi\neq1$ and $\ker\psi=G_K$ for an imaginary quadratic field $K$ unramified outside $\Sigma$; moreover $A_p=0$ for every prime $p\notin\Sigma$ inert in $K$.
\item $\det V_\ell(c)=-1$ for every prime $\ell$.
\item There is a prime $p_0\notin\Sigma$ such that $X^2-A_{p_0}X+\varepsilon_{p_0}p_0^{k-1}$ is irreducible over $\mathbb Q$.
\end{enumerate}
\end{prop}
\begin{proof}
The crux is that $K$ in (3) is imaginary: otherwise the Hodge--Tate weights $0$ and $k-1$ at a prime split in $K$ would make a unit of infinite order a root of unity.
\emph{Proof of (1).} For a prime $\ell$ put $\psi_\ell=\det V_\ell\cdot\chi_\ell^{k-1}$, a continuous character $G_{\mathbb Q}\to\mathbb Q_\ell^\times$, unramified outside $\Sigma\cup\{\ell\}$. For $p\notin\Sigma\cup\{\ell\}$, $\psi_\ell(\mathrm{Frob}_p)=\varepsilon_pp^{k-1}\cdot p^{1-k}=\varepsilon_p\in\{\pm1\}$. So $\psi_\ell^2$ is trivial on a dense subset, hence trivial, and $\psi_\ell$ takes values in $\{\pm1\}$. For two primes $\ell,\ell'$, $\psi_\ell$ and $\psi_{\ell'}$ agree at $\mathrm{Frob}_p$ for all $p\notin\Sigma\cup\{\ell,\ell'\}$, hence everywhere. Their common value $\psi$ is unramified outside $\Sigma\cup\{\ell\}$ for every $\ell$, hence outside $\Sigma$, and $\psi(\mathrm{Frob}_p)=\varepsilon_p$ for $p\notin\Sigma$ (take $\ell\neq p$). This proves (1).
\emph{Proof of (2).} Let $\ell$ be a prime. By Lemma~\ref{lem:v5_equ_poi_pai}, $B_\ell$ is a perfect alternating pairing on the two-dimensional space $V_\ell$ with $B_\ell(\sigma x,\sigma y)=\chi_\ell(\sigma)^{1-k}B_\ell(x,y)$ for $\sigma\in G_{\mathbb Q}$. For a basis $e_1,e_2$ of $V_\ell$ we have $B_\ell(\sigma e_1,\sigma e_2)=\det(\sigma)\,B_\ell(e_1,e_2)$ and $B_\ell(e_1,e_2)\neq0$; so $\det V_\ell=\chi_\ell^{1-k}$, that is, $\psi_\ell=1$, and $\psi=1$. This proves (2).
\emph{Proof of (3).} Until the proof of (4), $k$ is odd. We first show that $\psi\neq1$. The family $(V_\ell)_\ell$ satisfies the hypotheses of Lemma~\ref{lem:v5_irr_cry_two}(2) with $T=\Sigma$: (a) is Proposition~\ref{prop:v5_glo_sys_kum}(3), and (b) is Proposition~\ref{prop:v5_cry_com_for}(2) with $\mathfrak P=\ell$, which applies to every decomposition group at $\ell$ because for $L=\mathbb Q$ every embedding $\bar{\mathbb Q}\subset\bar{\mathbb Q}_\ell$ induces $\iota_{\mathfrak P}$. Fix a prime $\ell_0\notin\Sigma$ with $\ell_0>k$; then $V=V_{\ell_0}$ is absolutely irreducible. Let $B$ be the pairing of Lemma~\ref{lem:v5_equ_poi_pai} on $V$; it is symmetric, as $k$ is odd. If $\psi=1$, then $\wedge^2V=\det V\cong\mathbb Q_{\ell_0}(1-k)$, and $D(x,y)=x\wedge y$ is a perfect alternating $G_{\mathbb Q}$-equivariant pairing $V\times V\to\mathbb Q_{\ell_0}(1-k)$. Both $B$ and $D$ define isomorphisms $V\to V^\vee(1-k)$ of absolutely irreducible representations, so by Schur's lemma $B=\gamma D$ with $\gamma\in\mathbb Q_{\ell_0}^\times$; but a nonzero bilinear form in characteristic zero is not both symmetric and alternating. Hence $\psi\neq1$, and $\ker\psi=G_K$ for a quadratic field $K$, unramified outside $\Sigma$ as $\psi$ is.
Let $\ell$ be any prime and $B=B_\ell$ the symmetric pairing of Lemma~\ref{lem:v5_equ_poi_pai}. As $B$ is nondegenerate and $\bar{\mathbb Q}_\ell$ is algebraically closed of characteristic zero, there is a basis $e_1,e_2$ of $V_\ell\otimes\bar{\mathbb Q}_\ell$ with $B(e_1,e_1)=B(e_2,e_2)=0$ and $B(e_1,e_2)=1$. Then $B(x_1e_1+x_2e_2,x_1e_1+x_2e_2)=2x_1x_2$, so the isotropic lines are exactly $\bar{\mathbb Q}_\ell e_1$ and $\bar{\mathbb Q}_\ell e_2$. Every $\sigma\in G_{\mathbb Q}$ satisfies $B(\sigma x,\sigma y)=\chi_\ell(\sigma)^{1-k}B(x,y)$, so it permutes these two lines.
\begin{itemize}
\item If $\sigma$ fixes both, $\sigma e_1=\alpha e_1$ and $\sigma e_2=\beta e_2$ with $\alpha\beta=B(\sigma e_1,\sigma e_2)=\chi_\ell(\sigma)^{1-k}$, so $\det\sigma=\chi_\ell(\sigma)^{1-k}$.
\item If $\sigma$ exchanges them, $\sigma e_1=\beta e_2$ and $\sigma e_2=\alpha e_1$ with $\alpha\beta=\chi_\ell(\sigma)^{1-k}$, so $\det\sigma=-\chi_\ell(\sigma)^{1-k}$ and $\operatorname{tr}\sigma=0$.
\end{itemize}
By (1), $\sigma$ fixes both lines if and only if $\psi(\sigma)=1$, that is, $\sigma\in G_K$. So $G_K$ acts on $\bar{\mathbb Q}_\ell e_i$ through a character $\xi_i:G_K\to\bar{\mathbb Q}_\ell^\times$, and for $\tau\in G_{\mathbb Q}\setminus G_K$ and $\delta\in G_K$,
\[
\xi_1(\tau\delta\tau^{-1})=\xi_2(\delta).
\]
If $p\notin\Sigma$ is inert in $K$, take $\ell\neq p$: then $\mathrm{Frob}_p\notin G_K$, so $A_p=\operatorname{tr}V_\ell(\mathrm{Frob}_p)=0$.
We next compute Hodge--Tate weights at a prime split in $K$. Let $\ell\notin\Sigma$ be a prime with $\ell>k$ that splits in $K$; there are infinitely many. Let $\iota_w:\bar{\mathbb Q}\to\bar{\mathbb Q}_\ell$ be an embedding, with decomposition group $D_w$, let $\tau\in G_{\mathbb Q}\setminus G_K$, and put $\iota_{w'}=\iota_w\circ\tau^{-1}$, with decomposition group $D_{w'}=\tau D_w\tau^{-1}$. Identify $D_w$ and $D_{w'}$ with $G_{\mathbb Q_\ell}=\operatorname{Gal}(\bar{\mathbb Q}_\ell/\mathbb Q_\ell)$ through $\iota_w$ and $\iota_{w'}$; then $\delta\mapsto\tau\delta\tau^{-1}$ becomes the identity of $G_{\mathbb Q_\ell}$. As $\ell$ splits in $K$, $D_w,D_{w'}\subset G_K$, and $\iota_1=\iota_w|_K$, $\iota_2=\iota_{w'}|_K$ are the two embeddings $K\to\mathbb Q_\ell$, with $\iota_2(x)=\iota_1(\bar x)$, where $x\mapsto\bar x$ is the nontrivial automorphism of $K$ (the restriction of $\tau^{-1}$). Let $E\subset\bar{\mathbb Q}_\ell$ be a finite extension of $\mathbb Q_\ell$ containing the coordinates of $e_1,e_2$ in a $\mathbb Q_\ell$-basis of $V_\ell$; then the $\xi_i$ take values in $E^\times$, and $(V_\ell\otimes_{\mathbb Q_\ell}E)|_{G_K}=E(\xi_1)\oplus E(\xi_2)$. By Proposition~\ref{prop:v5_cry_com_for}(2), $V_\ell|_{D_w}$ is crystalline with Hodge--Tate weights $0$ and $k-1$. As crystalline representations are stable under subquotients and $D_{\mathrm{HT}}$ is exact on Hodge--Tate representations \cite{locbib:Fontaine1994}, \S1, each $\xi_i|_{D_w}$ is crystalline with a single Hodge--Tate weight $h_i$, and $\{h_1,h_2\}=\{0,k-1\}$. By the display above and the identification of $\delta\mapsto\tau\delta\tau^{-1}$ with the identity, the character of $G_{\mathbb Q_\ell}$ given by $\xi_1|_{D_{w'}}$ is the one given by $\xi_2|_{D_w}$; so $\xi_1|_{D_{w'}}$ has Hodge--Tate weight $h_2$. As $0\leq h_i\leq k-1\leq\ell-2$, Lemma~\ref{lem:v5_irr_cry_two}(1) gives $\xi_1|_{D_w}=\mu_1\chi_\ell^{-h_1}$ and $\xi_1|_{D_{w'}}=\mu_2\chi_\ell^{-h_2}$ as characters of $G_{\mathbb Q_\ell}$, with $\mu_1,\mu_2$ unramified.
Suppose now that $K$ is real, and let $\eta=\xi_1\circ\mathrm{Art}_K$, where $\mathrm{Art}_K:\mathbb A_K^\times\to G_K^{\mathrm{ab}}$ is the reciprocity map; $\eta$ is a continuous character, trivial on $K^\times$, and its restriction $\eta_v$ to $K_v^\times$ is $\xi_1$ composed with the local reciprocity map of $K_v$ and the decomposition map \cite{locbib:Neukirch1999}, Ch.~VI, \S5. We evaluate $\eta_v$ on units.
\begin{itemize}
\item If $v$ is finite and lies over a prime not in $\Sigma\cup\{\ell\}$, then $\xi_1$ is unramified at $v$, since $V_\ell$ is unramified at the prime below $v$, and the local reciprocity map sends $\mathcal O_v^\times$ into the inertia group \cite{locbib:Neukirch1999}, Ch.~V, \S1; so $\eta_v(\mathcal O_v^\times)=1$.
\item If $v$ lies over $q\in\Sigma$, then $q\neq\ell$, and $\eta_v$ is trivial on an open subgroup $U_v$ of $\mathcal O_v^\times$: $\mathcal O_v^\times$ is a finite group times a pro-$q$ group, $\mathcal O_E^\times$ has an open pro-$\ell$ subgroup, and a pro-$q$ group has no nontrivial continuous pro-$\ell$ quotient.
\item If $v$ is real, $\eta_v$ is trivial on the connected group $\mathbb R_{>0}$, as $E^\times$ is totally disconnected.
\item If $v=v_i$ is the place of $\iota_i$, so that $K_{v_i}=\mathbb Q_\ell$, then for $x\in\mathbb Z_\ell^\times$, $\eta_{v_i}(x)=\chi_\ell(\mathrm{Art}_{\mathbb Q_\ell}(x))^{-h_i}=x^{h_i}$, since $\mu_i$ is unramified and $\chi_\ell(\mathrm{Art}_{\mathbb Q_\ell}(x))=x^{-1}$ in the normalisation in which uniformisers map to arithmetic Frobenius elements \cite{locbib:Neukirch1999}, Ch.~V, \S2; the other normalisation replaces $x^{h_i}$ by $x^{-h_i}$, which changes nothing below.
\end{itemize}
By Dirichlet's unit theorem \cite{locbib:Neukirch1999}, Ch.~I, (7.4), $\mathcal O_K^\times$ has rank one. Its subgroup of totally positive units lying in $U_v$ for every $v$ over $\Sigma$ has finite index, so it contains a unit $u$ of infinite order, and $u\bar u=N_{K/\mathbb Q}(u)=1$ because $u$ is totally positive. Then
\[
1=\eta(u)=\prod_v\eta_v(u)=\iota_1(u)^{h_1}\,\iota_2(u)^{h_2}=\iota_1(u)^{h_1}\,\iota_1(\bar u)^{h_2}=\iota_1(u)^{h_1-h_2}.
\]
As $h_1-h_2=\pm(k-1)\neq0$, $\iota_1(u)$ is a root of unity, hence so is $u$, a contradiction. So $K$ is imaginary, and (3) is proved.
\emph{Proof of (4).} If $k$ is even, $\psi=1$ by (2), and $\det V_\ell(c)=\chi_\ell(c)^{1-k}=(-1)^{k-1}=-1$. If $k$ is odd, $\chi_\ell(c)^{1-k}=1$, and $c$ acts nontrivially on the imaginary quadratic field $K$, so $\det V_\ell(c)=\psi(c)=-1$.
\emph{Proof of (5).} If $k$ is even, every $p\notin\Sigma$ will do: a rational root $r$ of $Q_p$ is real with $|r|=p^{(k-1)/2}$, so $r^2=p^{k-1}$ with $k-1$ odd, which is impossible. Let $k$ be odd, and fix $\ell$ and $w$ as in the computation of Hodge--Tate weights. As $\xi_1|_{D_w}$ and $\xi_2|_{D_w}$ have the distinct Hodge--Tate weights $h_1\neq h_2$, $\xi_1\neq\xi_2$, so $\{\delta\in G_K:\xi_1(\delta)\neq\xi_2(\delta)\}$ is open, nonempty and stable under conjugation. By Chebotarev it contains a Frobenius element $\mathrm{Frob}_v$ at a place $v$ of $K$ of degree one over a prime $p_0\notin\Sigma\cup\{\ell\}$. Then $p_0$ splits in $K$, so $\varepsilon_{p_0}=\psi(\mathrm{Frob}_{p_0})=1$, and $\mathrm{Frob}_v$ is a Frobenius element at $p_0$ in $G_{\mathbb Q}$. The roots of $Q_{p_0}$ are therefore $\xi_1(\mathrm{Frob}_v)\neq\xi_2(\mathrm{Frob}_v)$, with product $p_0^{k-1}$. If $Q_{p_0}$ were reducible over $\mathbb Q$, its roots would be real of absolute value $p_0^{(k-1)/2}$ and distinct, hence $\pm p_0^{(k-1)/2}$, with product $-p_0^{k-1}$, a contradiction.
\end{proof}
\begin{prop}\label{prop:v5_new_rat_cm}
Let $(\Gamma,t,f,a,R)$ be an admissible Kummer twist datum with field $L=\mathbb Q$ and exceptional set $\Sigma$, and for a prime $p\notin\Sigma$ let $A_p\in\mathbb Z$ and $\varepsilon_p\in\{\pm1\}$ be the numbers of Proposition~\ref{prop:v5_glo_sys_kum}(2), (3).
\begin{enumerate}
\item There is a newform $g$ of weight $k$ and nebentypus $\psi$, of level divisible only by primes in $\Sigma$, such that $A_p=a_p(g)$ and $\varepsilon_p=\psi(p)$ for every prime $p\notin\Sigma$.
\item If $k$ is odd, there is an imaginary quadratic field $K$, unramified outside $\Sigma$, with quadratic character $\chi_K$, such that $\psi(p)=\chi_K(p)$ and $a_p(g)=\chi_K(p)\,a_p(g)$ for every prime $p\notin\Sigma$; that is, $g$ has complex multiplication by $K$.
\end{enumerate}
\end{prop}
\begin{proof}
We check the hypotheses of Lemma~\ref{lem:v5_mod_odd_pur} for the family $(V_\ell)_\ell$, with $T=\Sigma$ and $Q_p(X)=X^2-A_pX+\varepsilon_pp^{k-1}$.
\begin{itemize}
\item (a): by Proposition~\ref{prop:v5_glo_sys_kum}(1), (3), each $V_\ell$ is two-dimensional, and for $p\notin\Sigma$ and $\ell\neq p$ it is unramified at $p$; $Q_p$ lies in $\mathbb Z[X]$ ($A_p\in\mathbb Z$, $\varepsilon_p=\pm1$), does not depend on $\ell$, and has roots of absolute value $p^{(k-1)/2}$ under every complex embedding.
\item (b): for $\ell\notin\Sigma$ with $\ell>k$, Proposition~\ref{prop:v5_cry_com_for}(2), with $\mathfrak P=\ell$ and $\lambda=\mathfrak P$, shows that $V_\ell$ restricted to a decomposition group at $\ell$ is crystalline with Hodge--Tate weights $0$ and $k-1$, in the normalisation in which $\mathbb Q_\ell(-1)$ has weight $1$.
\item (c): $\det V_\ell(c)=-1$ for every prime $\ell$, by Proposition~\ref{prop:v5_det_odd_rat}(4).
\item (d): by Proposition~\ref{prop:v5_det_odd_rat}(5) there is $p_0\notin\Sigma$ with $Q_{p_0}$ irreducible over $\mathbb Q$.
\end{itemize}
By Lemma~\ref{lem:v5_mod_odd_pur} there is a newform $g$ of weight $k$ and nebentypus $\psi$, of level divisible only by primes in $\Sigma$, with $X^2-A_pX+\varepsilon_pp^{k-1}=X^2-a_p(g)X+\psi(p)p^{k-1}$ for every prime $p\notin\Sigma$. Comparing coefficients, $A_p=a_p(g)$ and $\varepsilon_p=\psi(p)$ for every prime $p\notin\Sigma$. This proves (1).
For (2), let $k$ be odd, let $\psi'$ be the character of $G_{\mathbb Q}$ of Proposition~\ref{prop:v5_det_odd_rat}(1), and let $K$ be the imaginary quadratic field of Proposition~\ref{prop:v5_det_odd_rat}(3), with $\ker\psi'=G_K$, unramified outside $\Sigma$. A prime $p\notin\Sigma$ is unramified in $K$, and $\chi_K(p)=\psi'(\mathrm{Frob}_p)=\varepsilon_p=\psi(p)$, by Proposition~\ref{prop:v5_det_odd_rat}(1) and item (1) above. If $p$ is inert in $K$, then $a_p(g)=A_p=0$ by Proposition~\ref{prop:v5_det_odd_rat}(3); otherwise $\chi_K(p)=1$. In both cases $a_p(g)=\chi_K(p)a_p(g)$.
\end{proof}
\subsection{The general theorem} \label{subsec:main}
We combine the integral cusp relation with the common Frobenius polynomial to prove Theorem~\ref{thm:introB}. The full statement records the point-count formula, the bounds on the trace and the criterion for the cusp expansion to extend to a modular form.
\begin{thm}\label{thm:v5_asd_kum_twi}
Let $(\Gamma,t,f,a,R)$ be an admissible Kummer twist datum, with $a=j/d$, coefficients $c(N)$, field $L$ and exceptional set $\Sigma$. Let $\mathfrak P$ be a prime of $L$ of residue degree one over a prime $p\notin\Sigma$ (so $p\equiv1\pmod d$), and let $\iota_{\mathfrak P}:L\to\mathbb Q_p$ be the embedding defined by $\mathfrak P$, which maps $\mathcal O_L[\frac1{dM}]$ into $\mathbb Z_p$. Read congruences through $\iota_{\mathfrak P}$. There are $A_{\mathfrak P}\in\mathcal O_L$ and $\varepsilon_{\mathfrak P}\in L^\times$ with the following properties. Write $B_{\mathfrak P}=\varepsilon_{\mathfrak P}p^{k-1}$ for the constant term of the polynomial.
\begin{enumerate}
\item For all integers $m\geq1$ prime to $p$ and $r\geq1$,
\[
c(mp^r)-A_{\mathfrak P}\,c(mp^{r-1})+B_{\mathfrak P}\,c(mp^{r-2})\equiv0\pmod{p^{(k-1)r}},
\]
where $c(x)=0$ for $x\notin\mathbb Z$.
\item For every prime $\lambda$ of $L$ not above $p$, the global $\lambda$-adic realisation $V_{\bar a,\lambda}$ of $H_a$ is unramified at $\mathfrak P$, and $X^2-A_{\mathfrak P}X+B_{\mathfrak P}$ is the characteristic polynomial of geometric Frobenius there. The trace $A_{\mathfrak P}$ is given by the twisted point-count formula of Proposition~\ref{prop:v5_tra_ide_kum}(3). Moreover $|\sigma(A_{\mathfrak P})|\leq2p^{(k-1)/2}$ and $|\sigma(\varepsilon_{\mathfrak P})|=1$ for every embedding $\sigma:L\to\mathbb C$, and there is an algebraic Hecke character $\varepsilon$ of $L$ with values in $L$ such that $\varepsilon(\mathfrak P')=\varepsilon_{\mathfrak P'}$ for every prime $\mathfrak P'$ of $L$ of residue degree one over a prime not in $\Sigma$.
\item If $L=\mathbb Q$ (so that $d=2$ and $\chi_f$ takes the values $\pm1$), there is a normalised newform $g$ of weight $k$ and nebentypus $\psi$, of level supported on $\Sigma$, such that $A_{p'}=a_{p'}(g)$ and $\varepsilon_{p'}=\psi(p')$ for every prime $p'\notin\Sigma$, where $A_{p'}$ and $\varepsilon_{p'}$ are the numbers attached to $\mathfrak P=p'\mathbb Z$.
\item Let $P$ be the pole of $t$ on $X_\Gamma$ and, if $P$ is an interior point, let $e_P$ be its stabiliser order. If $P$ is not a cusp and $d\nmid e_P$, then $\tau\mapsto f_\Phi(e^{2\pi i\tau/d})$ is not the restriction to a half-plane $\operatorname{Im}\tau>y_0$, on which it converges, of a single-valued meromorphic function on $\mathbb H$; in particular it is not a meromorphic modular form, of any weight and multiplier system, for any subgroup of finite index in $\mathrm{SL}_2(\mathbb Z)$. If $P$ is a cusp or $d\mid e_P$, it is a cusp form of weight $k$ on a subgroup of finite index in $\Gamma$.
\end{enumerate}
\end{thm}
\begin{proof}
The main inputs are Theorem~\ref{thm:v5_con_cry_coe} and Proposition~\ref{prop:v5_tra_ide_kum}. Choose a modular model at $\mathfrak P$ by Proposition~\ref{prop:v5_exi_mod_mod}, with eigenlattice $H_{a,p}$ and Frobenius $\varphi$. Proposition~\ref{prop:v5_tra_ide_kum}(2) supplies $A_{\mathfrak P}\in\mathcal O_L$ and $\varepsilon_{\mathfrak P}\in L^\times$ such that
\[
X^2-\iota_{\mathfrak P}(A_{\mathfrak P})X+
\iota_{\mathfrak P}(\varepsilon_{\mathfrak P})p^{k-1}
\]
is the characteristic polynomial of $p^{k-1}\varphi^{-1}$. By Proposition~\ref{prop:v5_glo_sys_kum}(1),(2),the single global system $V_{\bar a,\lambda}$ is unramified at $\mathfrak P$ for every $\lambda$ not above $p$, and these are the coefficients of its geometric Frobenius polynomial there; they are independent of the modular model and of $\lambda$.
Apply Theorem~\ref{thm:v5_con_cry_coe}(2),(3) to this model. Its coefficients $A^\vee$ and $B^\vee$ are precisely $\iota_{\mathfrak P}(A_{\mathfrak P})$ and $\iota_{\mathfrak P}(B_{\mathfrak P})$, so it gives (1). The required integrality of the expansion is Lemma~\ref{lem:v5_hod_pos_the}(2).
The point-count expression and the bounds in (2) are Proposition~\ref{prop:v5_tra_ide_kum}(3),(4). The algebraic Hecke character with these normalised determinant values is supplied by Proposition~\ref{prop:v5_hec_cha_dat}; its values agree at every degree-one prime outside $\Sigma$ with those of the same global system. This proves (2).
If $L=\mathbb Q$, then $\mu_d\subset L$ and $0-1,\qquad 1-3(1-a)>-1.
\]
They give exactly $1/3n$, which proves the Clausen identity.
Now take the coefficient of $X^n$ on both sides. On the left it is $\sum_kL_{n,k}L_{n,n-k}$. On the right it is $\sum_kL_{n,k}\binom{2k}{k}\binom{k}{n-k}$, and
\[
\binom{2k}{k}\binom{k}{n-k}=\binom nk\binom{2k}{n},
\]
both sides vanishing when $2k 0$ and $p\nmid\det A$.
\end{lemma}
\begin{proof}
The first step is the classical description of groups commensurable with $\mathrm{PSL}_2(\mathbb Z)$: their elements are rational matrices up to scalars. What is added here is that the determinants can be taken prime to $p$, which comes from a fixed point of the closure of $\Gamma$ on the Bruhat--Tits tree of $\mathrm{PGL}_2(\mathbb Q_p)$.
\emph{Elements of $\Gamma$ are rational up to scalars.} Let $\tilde\gamma\in\mathrm{SL}_2(\mathbb R)$ lift $\gamma$. Since $\Gamma(n)$ and $\tilde\gamma\Gamma(n)\tilde\gamma^{-1}$ both have finite index in $\Gamma$, the group $\Delta=\Gamma(n)\cap\tilde\gamma\Gamma(n)\tilde\gamma^{-1}$ has finite index in both. The $\mathbb Q$-linear span of a finite-index subgroup of $\mathrm{SL}_2(\mathbb Z)$ is $M_2(\mathbb Q)$, as the subgroup contains $\bigl(\begin{smallmatrix}1&h\\0&1\end{smallmatrix}\bigr)$ and $\bigl(\begin{smallmatrix}1&0\\h&1\end{smallmatrix}\bigr)$ for some $h\geq1$. So conjugation by $\tilde\gamma$ maps the span $M_2(\mathbb Q)$ of $\tilde\gamma^{-1}\Delta\tilde\gamma$ onto the span $M_2(\mathbb Q)$ of $\Delta$, and is a $\mathbb Q$-algebra automorphism of $M_2(\mathbb Q)$. By the Skolem--Noether theorem it is conjugation by some $A\in\mathrm{GL}_2(\mathbb Q)$; then $A^{-1}\tilde\gamma$ commutes with $M_2(\mathbb Q)$, hence with $M_2(\mathbb R)$, and is a real scalar. Scaling $A$ to be primitive in $M_2(\mathbb Z)$, $\det\tilde\gamma=1$ gives $\det A>0$ and $\tilde\gamma=\pm A/\sqrt{\det A}$.
\emph{The closure of $\Gamma$ in $\mathrm{PGL}_2(\mathbb Q_p)$ is compact.} By the first step $\Gamma$ embeds in $\mathrm{PGL}_2(\mathbb Q)\subset\mathrm{PGL}_2(\mathbb Q_p)$. Let $K\subset\mathrm{PGL}_2(\mathbb Q_p)$ be the image of $\mathrm{GL}_2(\mathbb Z_p)$, compact and open. The subgroup $\Gamma\cap\mathrm{PSL}_2(\mathbb Z)$ contains $\Gamma(n)$, so it has finite index in $\Gamma$; with coset representatives $\gamma_1,\dots,\gamma_r$ we get $\Gamma\subset\bigcup_i\gamma_iK$, a compact set. Hence the closure $\overline\Gamma$ is a compact subgroup. It contains the image of $\mathrm{SL}_2(\mathbb Z_p)$: for every $s$, $\mathrm{SL}_2(\mathbb Z)\to\mathrm{SL}_2(\mathbb Z/np^s)$ is surjective, so by the Chinese remainder theorem $\Gamma(n)\to\mathrm{SL}_2(\mathbb Z/p^s)$ is surjective, and $\Gamma(n)$ is dense in $\mathrm{SL}_2(\mathbb Z_p)$.
\emph{Fixed points on the tree.} The group $\mathrm{PGL}_2(\mathbb Q_p)$ acts on the Bruhat--Tits tree, whose vertices are the homothety classes of lattices in $\mathbb Q_p^2$, and the stabiliser of the vertex $v_0=[\mathbb Z_p^2]$ is $K$ \cite{locbib:Serre1980Trees}, Ch.~II, \S1. As $\overline\Gamma$ is compact and $K$ open, the orbit $\overline\Gamma v_0$ is finite, so $\overline\Gamma$ fixes a vertex or the midpoint of an edge (loc. cit., Ch.~I, \S6). We show that the image of $\mathrm{SL}_2(\mathbb Z_p)$ fixes no point other than $v_0$. It fixes $v_0$ and acts on the $p+1$ neighbours of $v_0$, which correspond to the lines of $\mathbb F_p^2$, through $\mathrm{SL}_2(\mathbb F_p)$, transitively. Its fixed set is a subtree; if it contained a point $x\neq v_0$, it would contain the first edge $[v_0,v_1]$ of the geodesic from $v_0$ to $x$ up to a point other than $v_0$, and, since $\mathrm{SL}_2(\mathbb Q_p)$ acts without inversion, also $v_1$, contradicting transitivity on the neighbours. Hence the fixed point of $\overline\Gamma$ is $v_0$, and $\overline\Gamma\subset K$.
\emph{Conclusion.} Let $\gamma\in\Gamma$ and $A$ as in the first step. As $\gamma\in K$, $A=\lambda B$ with $\lambda\in\mathbb Q_p^\times$ and $B\in\mathrm{GL}_2(\mathbb Z_p)$. Both $A$ and $B$ have an entry that is a $p$-adic unit and no entry of negative valuation, so $v_p(\lambda)=0$ and $\det A=\lambda^2\det B\in\mathbb Z_p^\times$.
\end{proof}
\subsection{Hecke characters and modularity} \label{subsec:background_galois}
In the Hecke-character arguments, rational Frobenius values are known at the degree-one primes, a set of density one. The proofs below explain why this is sufficient for the uses of \cite[Ch.~II, \S2.4, Proposition~2(iii); Ch.~III, \S2.3, Theorem~2, with \S2.4]{locbib:Serre1989}.
\begin{lemma}\label{lem:v5_hec_cha_ht}
Let $K$ be a number field, Galois over $\mathbb Q$, let $S_0$ be a finite set of rational primes, and let $\mathcal P$ be the set of primes of $K$ of residue degree one over a rational prime not in $S_0$. Let $\ell$ be a prime that splits completely in $K$, let $\lambda$ be a prime of $K$ above $\ell$ and $\iota_\lambda:K\to K_\lambda=\mathbb Q_\ell$ the completion map, let $\delta:\mathcal P\to K^\times$ be a map, and let $\psi:\operatorname{Gal}(\bar K/K)\to\mathbb Q_\ell^\times$ be a continuous character such that:
\begin{description}
\item[(a)] for every $\mathfrak P\in\mathcal P$ not above $\ell$, $\psi$ is unramified at $\mathfrak P$ and $\psi(\mathrm{Frob}_{\mathfrak P})=\iota_\lambda(\delta(\mathfrak P))$, where $\mathrm{Frob}_{\mathfrak P}$ is a geometric Frobenius element at $\mathfrak P$;
\item[(b)] for every place $w$ of $K$ above $\ell$, the restriction of $\psi$ to a decomposition group at $w$ is Hodge--Tate.
\end{description}
Let $T$ be the set of primes of $K$ not above $\ell$ at which $\psi$ is ramified. Then $T$ is finite and disjoint from $\mathcal P$, and there are a nonzero integral ideal $\mathfrak m$ of $K$ whose prime divisors are the primes in $T$ and the primes above $\ell$, and an algebraic Hecke character $\chi$ of $K$ with values in $K$ and modulus $\mathfrak m$, such that:
\begin{enumerate}
\item $\psi$ is unramified at every prime $v\nmid\mathfrak m$, and $\psi(\mathrm{Frob}_v)=\iota_\lambda(\chi(v))$;
\item $\chi(\mathfrak P)=\delta(\mathfrak P)$ for every $\mathfrak P\in\mathcal P$ not above $\ell$.
\end{enumerate}
\end{lemma}
\begin{proof}
For a rational representation, that is, one whose Frobenius traces lie in $K$ at almost all primes, this is the one-dimensional case of Serre's theorem that a locally algebraic abelian representation comes from an algebraic Hecke character \cite{locbib:Serre1989}, Ch.~III, \S2.3, Theorem~2, in its form with coefficients in a number field (loc.\ cit., \S2.4); passing from Hodge--Tate to locally algebraic characters follows \cite{locbib:FontaineMazur1995}, \S6. We check the hypotheses and give the step that differs.
Let $w\mid\ell$. As $\ell$ splits completely in $K$, $K_w=\mathbb Q_\ell$, and the restriction of $\psi$ to a decomposition group at $w$ is Hodge--Tate by (b) and, being one-dimensional, semisimple on inertia; so it is locally algebraic by Tate's theorem (loc.\ cit., Ch.~III, \S1.2; proved in the Appendix to Ch.~III as Theorem~3, p.~III-52). Hence $\psi$ is locally algebraic (loc.\ cit., Ch.~III, \S2.1) and has a modulus of definition (loc.\ cit., \S2.2, Proposition~2, p.~III-11), which can be taken of the form $\mathfrak m=\prod_{v\in T}v^{e_v}\prod_{w\mid\ell}w^{e_w}$ with all $e_v,e_w\geq1$; in particular $T$ is finite. By (a), $\psi$ is unramified at every prime of $\mathcal P$ not above $\ell$, so $T\cap\mathcal P=\emptyset$.
The step that differs is the last: up to it, the proof of Theorem~2 uses only local algebraicity and the modulus of definition, and yields a character $\phi$ of the group $S_{\mathfrak m}$ (loc.\ cit., Ch.~II, \S2.2) over $K_\lambda=\mathbb Q_\ell$ with the same Frobenius values as $\psi$ at the primes $v\nmid\mathfrak m\ell$. Rationality enters only to show that $\phi$ is defined over $K$, by loc.\ cit., Ch.~II, \S2.4, Proposition~2, whose criterion (iii) asks only that $\operatorname{Tr}\phi(F_v)\in K$ for $v$ in a set of places of density one, $F_v$ denoting the arithmetic Frobenius. The primes of $\mathcal P$ prime to $\mathfrak m\ell$ form such a set: the primes of residue degree one over $\mathbb Q$ have density one (loc.\ cit., Ch.~I, \S2.2, p.~I-7), and $S_0$ and the support of $\mathfrak m\ell$ are finite. For such a prime $\mathfrak P$, (a) gives $\operatorname{Tr}\phi(F_{\mathfrak P})=\psi(\mathrm{Frob}_{\mathfrak P})^{-1}=\iota_\lambda(\delta(\mathfrak P))^{-1}\in\iota_\lambda(K)$. So $\phi$ is defined over $K$. The characters of $S_{\mathfrak m}$ defined over $K$ are the algebraic Hecke characters of $K$ with values in $K$ and modulus $\mathfrak m$ (loc.\ cit., Ch.~II, \S2.4, Exercise, and \S2.7); this gives $\chi$ with $\psi(\mathrm{Frob}_v)=\iota_\lambda(\chi(v))$ for every prime $v\nmid\mathfrak m$, which is (1). Finally (2) is (1) at the primes $\mathfrak P\in\mathcal P$ not above $\ell$, which do not divide $\mathfrak m$ as $T\cap\mathcal P=\emptyset$, together with (a) and the injectivity of $\iota_\lambda$.
\end{proof}
\begin{lemma}\label{lem:v5_hec_cha_uni}
Let $K$ be a number field, Galois over $\mathbb Q$, let $S_0$ be a finite set of rational primes, and let $\mathcal P$ be the set of primes of $K$ of residue degree one over a rational prime not in $S_0$. For $i=1,2$ let $\chi_i$ be an algebraic Hecke character of $K$ with values in $K$, modulus $\mathfrak m_i$ and infinity type $(a_{i,\sigma})_{\sigma\in\operatorname{Gal}(K/\mathbb Q)}$, and suppose that $\chi_1(\mathfrak P)=\chi_2(\mathfrak P)$ for all but finitely many $\mathfrak P\in\mathcal P$ prime to $\mathfrak m_1\mathfrak m_2$.
\begin{enumerate}
\item Then $a_{1,\sigma}=a_{2,\sigma}$ for every $\sigma\in\operatorname{Gal}(K/\mathbb Q)$, and $\chi_1=\chi_2$ on $I^{\mathfrak m_1\mathfrak m_2}$.
\item Suppose moreover that $\mathfrak m_1=\mathfrak n\mathfrak r_1$ and $\mathfrak m_2=\mathfrak n\mathfrak r_2$, where $\mathfrak n$, $\mathfrak r_1$, $\mathfrak r_2$ are integral ideals with pairwise disjoint sets of prime divisors. Then there is a unique algebraic Hecke character $\chi$ of $K$ with values in $K$ and modulus $\mathfrak n$ whose restriction to $I^{\mathfrak m_i}$ is $\chi_i$ for $i=1,2$; its infinity type is $(a_{1,\sigma})_\sigma$.
\end{enumerate}
\end{lemma}
\begin{proof}
Part (1) is the analogue, for algebraic Hecke characters, of the uniqueness theorem for compatible rational representations \cite{locbib:Serre1989}, Ch.~I, \S2.3, Theorem, and rests, as its proof does, on the density of the Frobenius elements of a set of places of density one (loc.\ cit., Ch.~I, \S2.2, Corollary~2(b)).
Put $\mathfrak M=\mathfrak m_1\mathfrak m_2$, $c_\sigma=a_{1,\sigma}-a_{2,\sigma}$, and $\xi=\chi_1/\chi_2:I^{\mathfrak M}\to K^\times$. A totally positive $\beta\in K^\times$ with $\beta\equiv1\bmod^\times\mathfrak M$ satisfies $\beta\equiv1\bmod^\times\mathfrak m_i$ for $i=1,2$, so $\xi((\beta))=\prod_\sigma\sigma(\beta)^{c_\sigma}$; and $\xi(\mathfrak P)=1$ for every $\mathfrak P\in\mathcal P$ prime to $\mathfrak M$ outside a finite set $F_0$. Let $P^+_{\mathfrak M}$ be the group of principal ideals with a totally positive generator $\equiv1\bmod^\times\mathfrak M$. By class field theory, $I^{\mathfrak M}/P^+_{\mathfrak M}$ is the Galois group of a finite abelian extension $K_{\mathfrak M}/K$ in which every prime $v\nmid\mathfrak M$ is unramified with Frobenius element corresponding to its class (loc.\ cit., Ch.~II, \S2.1, Remark, and \S2.3).
\emph{The infinity types agree.} Let $K'$ be the Galois closure of $K_{\mathfrak M}$ over $\mathbb Q$. By Chebotarev's density theorem (loc.\ cit., Ch.~I, \S2.2) infinitely many rational primes split completely in $K'$; choose one, $p$, with $p\notin S_0$ and such that no prime of $K$ above $p$ divides $\mathfrak M$ or lies in $F_0$. Let $\mathfrak P$ be a prime of $K$ above $p$. Since $p$ splits completely in $K$, $\mathfrak P\in\mathcal P$, and $\operatorname{Gal}(K/\mathbb Q)$ acts simply transitively on the primes of $K$ above $p$. Since $\mathfrak P$ splits completely in $K_{\mathfrak M}$, its Frobenius element is trivial, so $\mathfrak P=(\beta)$ with $\beta$ totally positive and $\beta\equiv1\bmod^\times\mathfrak M$; hence $\prod_\sigma\sigma(\beta)^{c_\sigma}=\xi(\mathfrak P)=1$. For $\sigma_0\in\operatorname{Gal}(K/\mathbb Q)$, the ideal $(\sigma(\beta))=\sigma(\mathfrak P)$ equals $\sigma_0(\mathfrak P)$ only for $\sigma=\sigma_0$, and otherwise is prime to it. Taking the $\sigma_0(\mathfrak P)$-adic valuation,
\[
0=\sum_\sigma c_\sigma\,v_{\sigma_0(\mathfrak P)}\bigl(\sigma(\beta)\bigr)=c_{\sigma_0}.
\]
\emph{The characters agree.} By the first step $\xi$ is trivial on $P^+_{\mathfrak M}$, so it is a character of the finite group $I^{\mathfrak M}/P^+_{\mathfrak M}=\operatorname{Gal}(K_{\mathfrak M}/K)$, trivial on the Frobenius elements of the primes of $\mathcal P$ prime to $\mathfrak M$ and not in $F_0$. These primes form a set of density one, as $\mathcal P$ has density one (loc.\ cit., p.~I-7), so by loc.\ cit., Ch.~I, \S2.2, Corollary~2(b), their Frobenius elements meet every class. So $\xi=1$, which completes the proof of (1).
\emph{Proof of (2).} Every $\mathfrak a\in I^{\mathfrak n}$ factors uniquely as $\mathfrak a=\mathfrak b\mathfrak c$ with $\mathfrak b$ divisible only by primes dividing $\mathfrak r_1$ and $\mathfrak c$ prime to $\mathfrak r_1$. Then $\mathfrak b\in I^{\mathfrak m_2}$, as no prime dividing $\mathfrak r_1$ divides $\mathfrak n\mathfrak r_2$, and $\mathfrak c\in I^{\mathfrak m_1}$. Put $\chi(\mathfrak a)=\chi_2(\mathfrak b)\chi_1(\mathfrak c)$; this is a homomorphism $I^{\mathfrak n}\to K^\times$. On $I^{\mathfrak m_1}$ it equals $\chi_1$, since there $\mathfrak b=(1)$. On $I^{\mathfrak m_2}$ it equals $\chi_2$: for $\mathfrak a\in I^{\mathfrak m_2}$, $\mathfrak c=\mathfrak a\mathfrak b^{-1}$ lies in $I^{\mathfrak m_1}\cap I^{\mathfrak m_2}=I^{\mathfrak M}$, where $\chi_1=\chi_2$ by (1). It is unique, because $I^{\mathfrak n}$ is generated by $I^{\mathfrak m_1}$ and $I^{\mathfrak m_2}$. For the infinity type, let $\alpha\in K^\times$ be totally positive with $\alpha\equiv1\bmod^\times\mathfrak n$. By the approximation theorem \cite{locbib:Neukirch1999}, Ch.~II, (3.4), there is $\gamma\in K^\times$, positive at every real place, with $\gamma\equiv1\bmod^\times\mathfrak n$, $\gamma/\alpha\equiv1\bmod^\times\mathfrak r_1$ and $\gamma\equiv1\bmod^\times\mathfrak r_2$. Then $\alpha/\gamma$ is totally positive with $\alpha/\gamma\equiv1\bmod^\times\mathfrak m_1$, and $\gamma$ is totally positive with $\gamma\equiv1\bmod^\times\mathfrak m_2$, so
\[
\chi\bigl((\alpha)\bigr)=\chi_1\bigl((\alpha/\gamma)\bigr)\,\chi_2\bigl((\gamma)\bigr)=\prod_\sigma\sigma(\alpha/\gamma)^{a_\sigma}\prod_\sigma\sigma(\gamma)^{a_\sigma}=\prod_\sigma\sigma(\alpha)^{a_\sigma},\qquad a_\sigma=a_{1,\sigma}=a_{2,\sigma}.
\]
\end{proof}
\begin{lemma}\label{lem:v5_irr_cry_two}
\begin{enumerate}
\item Let $\ell$ be a prime, $E$ a finite extension of $\mathbb Q_\ell$, and $\xi:\operatorname{Gal}(\bar{\mathbb Q}_\ell/\mathbb Q_\ell)\to E^\times$ a crystalline character with Hodge--Tate weight $h$, $0\leq h\leq\ell-2$, in the normalisation in which $\mathbb Q_\ell(-1)$ has weight $1$. Then $\xi\chi_\ell^{h}$ is unramified, where $\chi_\ell$ is the $\ell$-adic cyclotomic character.
\item Let $k\geq3$ be an integer, $T$ a finite set of primes, and, for every prime $\ell$, $V_\ell$ a two-dimensional $\mathbb Q_\ell$-vector space with a continuous action of $G_{\mathbb Q}=\operatorname{Gal}(\bar{\mathbb Q}/\mathbb Q)$. Assume:
\begin{description}
\item[(a)] for every prime $p\notin T$ and every prime $\ell\neq p$, $V_\ell$ is unramified at $p$, and the characteristic polynomial $Q_p(X)$ of a geometric Frobenius at $p$ on $V_\ell$ lies in $\mathbb Z[X]$, does not depend on $\ell$, and has roots of absolute value $p^{(k-1)/2}$ under every complex embedding;
\item[(b)] for every prime $\ell\notin T$ with $\ell>k$, the restriction of $V_\ell$ to a decomposition group at $\ell$ is crystalline with Hodge--Tate weights $0$ and $k-1$, in the normalisation in which $\mathbb Q_\ell(-1)$ has weight $1$.
\end{description}
Then $V_\ell$ is absolutely irreducible for every prime $\ell\notin T$ with $\ell>k$.
\end{enumerate}
\end{lemma}
\begin{proof}
\emph{Proof of (1).} The character $\xi\chi_\ell^{h}$ is crystalline with Hodge--Tate weight $0$. As $0\leq h\leq\ell-2$, the rank-one case of the theory of Fontaine and Laffaille \cite{locbib:FontaineLaffaille1982}, Th\'eor\`eme 8.4, applies: the filtered $\varphi$-module of $\xi\chi_\ell^{h}$ is weakly admissible of rank one with trivial filtration, so its Frobenius is a unit, and the corresponding representation is unramified.
\emph{Proof of (2).} Fix a prime $\ell\notin T$ with $\ell>k$, and suppose that $V_\ell\otimes_{\mathbb Q_\ell}\bar{\mathbb Q}_\ell$ is reducible. A $G_{\mathbb Q}$-stable line is spanned by a vector $v$ whose coordinates in a $\mathbb Q_\ell$-basis of $V_\ell$ lie in a finite extension $E$ of $\mathbb Q_\ell$; for $g\in G_{\mathbb Q}$ both $v$ and $gv$ lie in $V_\ell\otimes E$, so $gv\in E^\times v$. Hence there are continuous characters $\chi_1,\chi_2:G_{\mathbb Q}\to E^\times$ and an exact sequence of $E[G_{\mathbb Q}]$-modules
\[
0\to E(\chi_1)\to V_\ell\otimes_{\mathbb Q_\ell}E\to E(\chi_2)\to0 .
\]
The images of $\chi_1,\chi_2$ are compact, so they lie in $\mathcal O_E^\times$.
Let $D\subset G_{\mathbb Q}$ be a decomposition group at $\ell$, identified with $\operatorname{Gal}(\bar{\mathbb Q}_\ell/\mathbb Q_\ell)$. As a $\mathbb Q_\ell[D]$-module, $V_\ell\otimes_{\mathbb Q_\ell}E$ is a direct sum of copies of $V_\ell|_D$, which is crystalline with Hodge--Tate weights $0$ and $k-1$ by (b). Crystalline representations are stable under subquotients, and $D_{\mathrm{HT}}$ is exact on Hodge--Tate representations \cite{locbib:Fontaine1994}, \S1. So each $\chi_i|_D$ is crystalline; its $D_{\mathrm{HT}}$ is a graded $E$-vector space of dimension one, so $\chi_i|_D$ has a single Hodge--Tate weight $h_i$, and $\{h_1,h_2\}=\{0,k-1\}$. As $0\leq h_i\leq k-1\leq\ell-2$, (1) shows that $\chi_i|_D$ is $\chi_\ell^{-h_i}$ times an unramified character.
Next, $\epsilon_i=\chi_i\chi_\ell^{h_i}$ has finite order. It is unramified at $\ell$ by the previous step, and at every prime $p\notin T\cup\{\ell\}$, because $V_\ell$ is unramified there by (a) and so is $\chi_\ell$. By the Kronecker--Weber theorem, $\epsilon_i$ therefore factors through $\operatorname{Gal}(\mathbb Q(\mu_{N^\infty})/\mathbb Q)\cong\prod_{q\in T}\mathbb Z_q^\times$, where $N=\prod_{q\in T}q$. Each $\mathbb Z_q^\times$ is a finite group times a pro-$q$ group. The group $\mathcal O_E^\times$ contains an open pro-$\ell$ subgroup $U$, and the preimage of $U$ in a pro-$q$ group $P$ with $q\neq\ell$ is an open subgroup of $P$ mapped to $U$ trivially, a pro-$q$ group having no nontrivial continuous pro-$\ell$ quotient. As $\ell\notin T$, $\epsilon_i$ has finite image.
Finally we compare absolute values. Let $p\notin T\cup\{\ell\}$ and let $\mathrm{Frob}_p$ be a geometric Frobenius at $p$. The roots of $Q_p$ are $\chi_1(\mathrm{Frob}_p)$ and $\chi_2(\mathrm{Frob}_p)$, and $\chi_i(\mathrm{Frob}_p)=\epsilon_i(\mathrm{Frob}_p)\,p^{h_i}$ with $\epsilon_i(\mathrm{Frob}_p)$ a root of unity. These roots are algebraic numbers, and under every complex embedding $\chi_i(\mathrm{Frob}_p)$ has absolute value $p^{h_i}$; by (a) this equals $p^{(k-1)/2}$. Hence $h_1=h_2=\frac{k-1}2$, contradicting $\{h_1,h_2\}=\{0,k-1\}$ with $k-1\neq0$. So $V_\ell$ is absolutely irreducible.
\end{proof}
The modularity argument needs the Serre weight, including the orientation of a reducible residual extension. It uses the lifting theorems at one auxiliary prime: the hypotheses of \cite[Theorem~10.1(i)]{locbib:KhareWintenberger2009a}, which require Weil--Deligne compatibility at every prime, have not been established for our system.
\begin{lemma}\label{lem:v5_ser_wei_fon}
Let $\ell$ be a prime and $k$ an integer with $3\leq k\leq\ell-1$. Let $V$ be a two-dimensional $\mathbb Q_\ell$-vector space with a continuous action of $G_{\mathbb Q_\ell}=\operatorname{Gal}(\bar{\mathbb Q}_\ell/\mathbb Q_\ell)$, crystalline with Hodge--Tate weights $0$ and $k-1$ in the normalisation in which $\mathbb Q_\ell(-1)$ has weight $1$. Let $T\subset V$ be a $G_{\mathbb Q_\ell}$-stable $\mathbb Z_\ell$-lattice and $\bar W=\operatorname{Hom}_{\mathbb F_\ell}(T/\ell T,\mathbb F_\ell)$. Let $I\subset G_{\mathbb Q_\ell}$ be the inertia subgroup, $\omega$ the mod $\ell$ cyclotomic character and $\omega_2$ a fundamental character of level two. Then $(\bar W\otimes\bar{\mathbb F}_\ell)|_I$ is either $\omega_2^{k-1}\oplus\omega_2^{\ell(k-1)}$ or an extension of the trivial character by $\omega^{k-1}$. Consequently, if $\bar r:G_{\mathbb Q}\to\mathrm{GL}_2(\mathbb F)$, $\mathbb F$ a finite field of characteristic $\ell$, restricts on a decomposition group at $\ell$ to $\bar W\otimes_{\mathbb F_\ell}\mathbb F$, then the weight $k(\bar r)$ of \cite{locbib:Serre1987}, \S2, equals $k$.
\end{lemma}
\begin{proof}
The action of inertia on the reductions of Fontaine--Laffaille lattices is \cite{locbib:FontaineLaffaille1982}, Th\'eor\`eme 5.3.
The Hodge--Tate weights of $V$ lie in $[0,k-1]\subset[0,\ell-2]$, so $\operatorname{Fil}^0D_{\mathrm{cris}}(V)=D_{\mathrm{cris}}(V)$ and $\operatorname{Fil}^\ell D_{\mathrm{cris}}(V)=0$, and no nonzero quotient $V'$ of $V$ has $V'(\ell-1)$ unramified, since $V'$ would have Hodge--Tate weight $\ell-1$. By \cite{bib:diamond2025a}, \S1.1 (from \cite{locbib:FontaineLaffaille1982}, 6.1 and 8.4), $T\cong\mathbb V(A)$ for an object $A$ of $\mathcal{MF}^0$, and the filtration of $A$ has jumps $0$ and $k-1$, each of rank one. As $\mathbb V$ is exact, $T/\ell T\cong\mathbb V(N)$ with $N=A/\ell A$, and as $N$ is killed by $\ell$, $\bar W\cong\underline U_S(N)$.
Extending scalars from $W(\mathbb F_\ell)$ to $W(\bar{\mathbb F}_\ell)$ restricts the Galois action to $I$ \cite{locbib:FontaineLaffaille1982}, 3.11: $\bar W|_I\cong\underline U_S(\bar N)$ for the object $\bar N=N\otimes\bar{\mathbb F}_\ell$ of the category $\tilde{\mathcal M}$ of loc.\ cit., 4.1, with filtration jumps $0$ and $k-1$. Let $L=\operatorname{Fil}^{k-1}\bar N$, a line, and let $\varphi_{\bar N}:\operatorname{gr}\bar N=\bar N/L\oplus L\to\bar N$ be the bijective semilinear map of loc.\ cit., 4.2. Put $I_0=\varphi_{\bar N}(\bar N/L)$ and $I_1=\varphi_{\bar N}(L)$, lines with $\bar N=I_0\oplus I_1$. By loc.\ cit., Lemme 4.7, a line of $\bar N$ is a sub-object if and only if it is stable under the map $f$ of loc.\ cit., 4.6, which sends $\bar N\setminus L$ into $I_0\setminus\{0\}$ and $L\setminus\{0\}$ into $I_1\setminus\{0\}$. So the sub-objects of rank one are $L$, when $I_1=L$, and $I_0$, when $I_0\neq L$.
\begin{itemize}
\item If $I_0=L$, then $I_1\neq L$, $\bar N$ has no sub-object of rank one and is simple, and by loc.\ cit., Proposition 4.4, $\bar N\cong M(2;i)$ with $\{i_0,i_1\}=\{0,k-1\}$. By loc.\ cit., Th\'eor\`eme 5.3, applicable as $0\leq i_n\leq\ell-1$, $\underline U_S(\bar N)$ is a line over $\mathbb F_{\ell^2}$ on which $I$ acts through $\chi_2^{i_0+\ell i_1}$, $\chi_2$ the fundamental character of level two (loc.\ cit., 5.1). Over $\bar{\mathbb F}_\ell$ this is $\omega_2^{k-1}\oplus\omega_2^{\ell(k-1)}$.
\item If $I_0\neq L$, then $I_0$ is a sub-object with filtration jump $0$, isomorphic to $M(1;0)$, and $\bar N/I_0$ has jump $k-1$ and is isomorphic to $M(1;k-1)$. As $\underline U_S$ is exact and contravariant, $\underline U_S(\bar N)$ is an extension of $\underline U_S(I_0)$ by $\underline U_S(\bar N/I_0)$. By loc.\ cit., Th\'eor\`eme 5.3(iii), $I$ acts trivially on the first and through $\chi_1^{k-1}$ on the second, and $\chi_1=\omega$ on $I$.
\end{itemize}
Finally we compute Serre's weight, which depends only on the restriction to $I$ \cite{locbib:Serre1987}, \S2. In the first case $\bar r|_I\otimes\bar{\mathbb F}_\ell\cong\omega_2^{a+\ell b}\oplus\omega_2^{b+\ell a}$ with $a=0$, $b=k-1$ and $0\leq ak$ and every prime $\lambda$ above $\ell$ of the coefficient field of $g$, where $\rho_{g,\lambda}$ is the $\lambda$-adic representation attached to $g$, normalised so that a geometric Frobenius at $p\nmid N_g\ell$ has characteristic polynomial $X^2-a_p(g)X+\psi(p)p^{k-1}$.
\end{lemma}
\begin{proof}
For systems that are compatible in the sense of \cite{locbib:KhareWintenberger2009a}, \S5, this is \cite{locbib:KhareWintenberger2009a}, Theorem 10.1(i). We apply instead the two theorems behind it, Serre's modularity conjecture and the modularity lifting theorem of Khare and Wintenberger, at a single auxiliary prime $\ell$, chosen so that two Frobenius elements force the residual hypotheses.
We first choose the auxiliary prime $\ell$. There is an odd prime $p_1\notin T$ with $a_{p_1}\neq0$: otherwise, for a fixed prime $\ell_1$, $\operatorname{tr}V_{\ell_1}(\mathrm{Frob}_p)=0$ for all odd primes $p\notin T\cup\{\ell_1\}$, so the continuous function $\operatorname{tr}V_{\ell_1}$ would vanish on a dense subset of $G_{\mathbb Q}$, hence everywhere, while its value at $1$ is $2$. Let $\Delta=a_{p_0}^2-4b_{p_0}\in\mathbb Z$, not a square by (d), and $F=\mathbb Q(\sqrt\Delta,\sqrt{p_1})$. Some element of $\operatorname{Gal}(F/\mathbb Q)$ acts nontrivially on both $\sqrt\Delta$ and $\sqrt{p_1}$: the element $(-1,-1)$ of $\operatorname{Gal}(F/\mathbb Q)\cong(\mathbb Z/2)^2$ if $\mathbb Q(\sqrt\Delta)\neq\mathbb Q(\sqrt{p_1})$, and the nontrivial element otherwise. By Chebotarev's theorem infinitely many primes have this Frobenius in $F$, that is, are inert both in $\mathbb Q(\sqrt\Delta)$ and in $\mathbb Q(\sqrt{p_1})$. Fix such a prime $\ell$ with $\ell\notin T\cup\{2,p_0,p_1\}$, $\ell>k$ and $\ell\nmid\Delta a_{p_1}$.
We next show that the residual representation is large. Choose a $G_{\mathbb Q}$-stable $\mathbb Z_\ell$-lattice in $V_\ell$, which exists as $G_{\mathbb Q}$ is compact, let $\rho:G_{\mathbb Q}\to\mathrm{GL}_2(\mathbb Z_\ell)$ be the resulting representation and $\bar\rho:G_{\mathbb Q}\to\mathrm{GL}_2(\mathbb F_\ell)$ its reduction.
\begin{itemize}
\item $\bar\rho$ is irreducible over $\mathbb F_\ell$. By (a), $\bar\rho(\mathrm{Frob}_{p_0})$ has characteristic polynomial $Q_{p_0}\bmod\ell$, whose discriminant $\Delta$ is a non-square in $\mathbb F_\ell^\times$, as $\ell$ is odd, $\ell\nmid\Delta$ and $\ell$ is inert in $\mathbb Q(\sqrt\Delta)$. So $\bar\rho(\mathrm{Frob}_{p_0})$ has no eigenvalue in $\mathbb F_\ell$, and no $\mathbb F_\ell$-line is stable.
\item $\bar\rho$ is absolutely irreducible. Otherwise a stable line $L$ of $\bar\rho\otimes\bar{\mathbb F}_\ell$ is defined over a finite field $\mathbb F\supset\mathbb F_\ell$. Its image $\phi(L)$ under the Frobenius $\phi$ of $\mathbb F/\mathbb F_\ell$ is stable, and $\phi(L)\neq L$, since a $\phi$-stable line has its slope in $\mathbb P^1(\mathbb F_\ell)$ and would be an $\mathbb F_\ell$-line. So $\bar\rho\otimes\mathbb F=L\oplus\phi(L)$, with $G_{\mathbb Q}$ acting by characters $\theta$ and $\phi\circ\theta$. As $c^2=1$, $\theta(c)=\pm1\in\mathbb F_\ell$, so $\phi(\theta(c))=\theta(c)$ and $\det\bar\rho(c)=\theta(c)^2=1$, whereas $\det\bar\rho(c)=-1$ by (c), and $-1\neq1$ in $\mathbb F_\ell$.
\item $\bar\rho|_{G_{\mathbb Q(\zeta_\ell)}}$ is absolutely irreducible. Suppose not, and put $H=G_{\mathbb Q(\zeta_\ell)}$, a normal subgroup with cyclic quotient. By Clifford's theorem $(\bar\rho\otimes\bar{\mathbb F}_\ell)|_H$ is semisimple, hence a sum of two characters $\theta_1,\theta_2$ of $H$. If $\theta_1=\theta_2$, then $\bar\rho(H)$ consists of scalars, $\bar\rho(G_{\mathbb Q})$ is generated by scalars and one element, so it is abelian and $\bar\rho\otimes\bar{\mathbb F}_\ell$ is reducible, which is excluded. So $\theta_1\neq\theta_2$, $G_{\mathbb Q}$ permutes the two isotypic lines, and the stabiliser $G'$ of one of them has index $2$ and contains $H$; every $g\notin G'$ exchanges the lines, so $\operatorname{tr}\bar\rho(g)=0$. Now $G'=G_{\mathbb Q(\sqrt{\ell^*})}$, $\ell^*=(-1)^{(\ell-1)/2}\ell$, the quadratic subfield of $\mathbb Q(\zeta_\ell)$. By quadratic reciprocity $\bigl(\frac{\ell^*}{p_1}\bigr)=\bigl(\frac{p_1}\ell\bigr)=-1$, the last because $\ell$ is inert in $\mathbb Q(\sqrt{p_1})$; so $p_1$ is inert in $\mathbb Q(\sqrt{\ell^*})$, $\mathrm{Frob}_{p_1}\notin G'$, and $a_{p_1}\equiv\operatorname{tr}\bar\rho(\mathrm{Frob}_{p_1})=0\pmod\ell$, contradicting $\ell\nmid a_{p_1}$.
\end{itemize}
We next show that $V_\ell$ is modular. Put $W=\rho^\vee$, a lift of $\bar\rho^\vee$; by the previous step $\bar\rho^\vee$ is odd, absolutely irreducible, and absolutely irreducible on $G_{\mathbb Q(\zeta_\ell)}$, these properties passing to the dual. By Serre's modularity conjecture, proved by Khare and Wintenberger \cite{locbib:KhareWintenberger2009a}, Theorem 9.1, together with Kisin's proof of their Hypothesis (H) \cite{locbib:Kisin2009BT}, Theorem 0.1, $\bar\rho^\vee$ arises from a newform. By (a), $W$ is unramified outside $T\cup\{\ell\}$, and $b_p=\pm p^{k-1}$ (an integer of absolute value $p^{k-1}$), so $\det V_\ell\cdot\chi_\ell^{k-1}$ takes the values $\pm1$ at all $\mathrm{Frob}_p$, $p\notin T\cup\{\ell\}$, and is a character of order at most two; thus $\det W$ is a finite-order character times $\chi_\ell^{k-1}$. By (b), $W$ is crystalline at $\ell$, duals of crystalline representations being crystalline \cite{locbib:Fontaine1994}, \S1, with Hodge--Tate weights $0$ and $k-1$ in the normalisation in which $\chi_\ell$ has weight $1$. So $W\otimes\mathbb C_\ell\cong\mathbb C_\ell\oplus\mathbb C_\ell(k-1)$, that is, $W$ is crystalline of weight $k$ in the sense of \cite{locbib:KhareWintenberger2009a}, \S4, and \cite{locbib:KhareWintenberger2009b}, Definition 3.4, with $2\leq k\leq\ell+1$. By Lemma~\ref{lem:v5_ser_wei_fon}, applied to $V_\ell$ restricted to a decomposition group at $\ell$ and to the lattice of $\rho$, the Serre weight of $\bar\rho^\vee$ is $k$; so $\bar\rho^\vee$ lies in the setting of \cite{locbib:KhareWintenberger2009b}, \S1, and of the paragraph preceding \cite{locbib:KhareWintenberger2009a}, Theorem 4.1 (Serre weight in $[2,\ell+1]$), in which \cite{locbib:KhareWintenberger2009a}, Theorem 4.1, is proved. By \cite{locbib:KhareWintenberger2009a}, Theorem 4.1(2)(i), proved in \cite{locbib:KhareWintenberger2009b}, $W$ arises from a newform. For $k\leq\ell-1$, the case used here, this lifting theorem is due to Diamond, Flach and Guo \cite{bib:diamond2025a}, the theorem of the subsection ``Consequences'' of the section on the Taylor--Wiles construction (see \cite{locbib:KhareWintenberger2009b}, \S10.2). Hence there are a newform $f$ and a prime $\lambda$ of $K_f$ above $\ell$ such that $V_\ell\otimes\bar{\mathbb Q}_\ell$ is isomorphic to $\rho_{f,\lambda}\otimes\bar{\mathbb Q}_\ell$ or to its contragredient. Let $p\notin T\cup\{\ell\}$ with $p\nmid N_f$. The geometric Frobenius at $p$ has determinant $b_p$ on $V_\ell$, of absolute value $p^{k-1}$ by (a), and determinant $\psi_f(p)^{\pm1}p^{\pm(k_f-1)}$ on $\rho_{f,\lambda}$, respectively on its contragredient. As $k\geq3$ and $k_f\geq2$, only $V_\ell\otimes\bar{\mathbb Q}_\ell\cong\rho_{f,\lambda}\otimes\bar{\mathbb Q}_\ell$ is possible, and $k_f=k$. Comparing characteristic polynomials, $a_p(f)=a_p$ and $\psi_f(p)p^{k-1}=b_p$ for all such $p$, the identities holding in $K_f$ because the embedding $K_f\to\bar{\mathbb Q}_\ell$ is injective and $a_p,b_p\in\mathbb Z$.
We next compare $f$ with the whole system. Let $\ell'\notin T$ be a prime with $\ell'>k$ and $\lambda'$ a prime of $K_f$ above $\ell'$. For every prime $p\notin T\cup\{\ell,\ell'\}$ with $p\nmid N_f$, both $V_{\ell'}$ and $\rho_{f,\lambda'}$ are unramified at $p$, and a geometric Frobenius has characteristic polynomial $Q_p$ on both, by (a) and the previous step. These Frobenius elements are dense in $G_{\mathbb Q}$ and characteristic polynomials vary continuously, so $V_{\ell'}\otimes\bar{\mathbb Q}_{\ell'}$ and $\rho_{f,\lambda'}\otimes\bar{\mathbb Q}_{\ell'}$ have the same characteristic polynomial at every element of $G_{\mathbb Q}$, and by the Brauer--Nesbitt theorem isomorphic semisimplifications. As $V_{\ell'}$ is absolutely irreducible by Lemma~\ref{lem:v5_irr_cry_two}(2), so is $\rho_{f,\lambda'}$, and $V_{\ell'}\otimes\bar{\mathbb Q}_{\ell'}\cong\rho_{f,\lambda'}\otimes\bar{\mathbb Q}_{\ell'}$.
It remains to determine the level. Let $p\notin T$ and choose a prime $\ell'\notin T\cup\{p\}$ with $\ell'>k$. By (a), $V_{\ell'}$ is unramified at $p$, hence so is $\rho_{f,\lambda'}$. By local--global compatibility at $p\neq\ell'$ \cite{locbib:Carayol1986}, Th\'eor\`eme (A), the component at $p$ of the automorphic representation of $f$ is then unramified, so $p\nmid N_f$. Therefore $N_f$ is divisible only by primes in $T$, and for every $p\notin T$
\[
Q_p(X)=\det\bigl(X-\mathrm{Frob}_p\mid\rho_{f,\lambda'}\bigr)=X^2-a_p(f)X+\psi_f(p)p^{k-1}.
\]
The lemma holds with $g=f$ and $\psi=\psi_f$.
\end{proof}
\section{A level-seven supercongruence} \label{sec:first_depth}
The trace in Corollary~\ref{cor:v5_asd_con_c7} is identified by comparing $c_7(p)$ with Cooper's sequence at $(p-1)/2$, and then with the Ap\'ery number at the same index. We first state the two congruences together. Their proofs use the modular parametrisation of Section~\ref{sec:level_seven} and the classical Ap\'ery supercongruence of Ahlgren and Ono \cite{locbib:AhlgrenOno2000}.
\begin{thm}\label{thm:v5_mat_fir_dep}
For every odd prime $p$,
\[
c_7(p)\equiv s_7\!\left(\frac{p-1}{2}\right)\equiv A_p^{\eta}\pmod{p^2}.
\]
\end{thm}
\begin{proof}
Put $h=(p-1)/2$. By Lemma~\ref{lem:v5_inv_coo_for}, the first congruence amounts to $d_h\equiv0\pmod p$. By Lemma~\ref{lem:v5_har_for_for}, $d_h$ is the harmonic Cooper sum $e_h$ of Definition~\ref{def:v5_coo_rec_dfm}, and we show that every summand of $e_h$ vanishes modulo $p$, by the symmetry $m\mapsto p-1-m$ of the harmonic numbers. For $0\leq m\leq p-1$, the harmonic numbers in Definition~\ref{def:v5_log_coo_com} are $p$-integral and satisfy
\[
\mathfrak h_{p-1-m}\equiv\mathfrak h_m\pmod p.
\]
Indeed, pairing $j$ with $p-j$ proves $\mathfrak h_{p-1}\equiv0\pmod p$, and subtracting the last $m$ terms gives the displayed congruence.
For each $0\leq k\leq h$, the equalities $h+k=p-1-(h-k)$ and $2h-k=p-1-k$ therefore yield
\[
\mathfrak h_{h+k}+\mathfrak h_{2h-k}-\mathfrak h_k-\mathfrak h_{h-k}
\equiv0\pmod p.
\]
All factorial arguments in the coefficient
\[
\frac{(h+k)!(2h-k)!}{k!^3(h-k)!^3}
\]
are between $0$ and $p-1$, so this coefficient is $p$-integral. The factor $3/2$ is also $p$-integral, including at $p=3$. Hence $e_h\in p\mathbb Z_p$ term by term, and $d_h=e_h\in p\mathbb Z_p$. Applying Lemma~\ref{lem:v5_inv_coo_for} gives
\[
c_7(p)-s_7(h)\equiv-\frac p2d_h\equiv0\pmod{p^2}.
\]
The second congruence $s_7(h)\equiv A_p^{\eta}\pmod{p^2}$ is Proposition~\ref{prop:v5_coo_hal_ind}.
\end{proof}
\begin{definition}\label{def:v5_log_coo_com}
In the notation of Definition~\ref{def:v5_coo_lev_sev}, let $G(Y)=(1+Y)(1-27Y)$, use the formal branch $\sqrt{G(Y)}\in1+Y\mathbb Q[[Y]]$ and define
\[
\rho(Y)=\frac{1}{F(Y)\sqrt{G(Y)}},\qquad
\ell(Y)=\int_0^Y\frac{\rho(T)-1}{T}\,dT,\qquad
\mathcal H(Y)=F(Y)\ell(Y)=\sum_{n\geq0}d_nY^n.
\]
The integral denotes termwise formal integration, with zero constant term. The series $\mathcal H$ is the \textbf{logarithmic Cooper companion}. The \textbf{harmonic numbers} are $\mathfrak h_0=0$ and $\mathfrak h_m=\sum_{j=1}^m1/j$ for integers $m\geq1$.
\end{definition}
\begin{definition}\label{def:v5_coo_ope}
With $\theta=Y\,d/dY$, the \textbf{Cooper operators} are
\[
\mathcal L=\theta^3-Y(2\theta+1)(13\theta^2+13\theta+4)-3Y^2(\theta+1)(3\theta+2)(3\theta+4),
\]
\[
\mathcal D=(1+Y)(1-27Y)\,\theta^2-(13Y+27Y^2)\,\theta-(2Y+6Y^2),
\]
acting on $\mathbb Q[[Y]]$ and on holomorphic functions on open subsets of $\mathbb C^\times$. Up to the factor $Y$ they are Cooper's: $\mathcal D/Y$ and $\mathcal L/Y$ are the second- and third-order operators of \cite[p.~176]{locbib:Cooper2012}.
\end{definition}
\begin{definition}\label{def:v5_coo_rec_dfm}
The \textbf{Cooper recurrence polynomials} are
\[
A(v)=(2v-1)(13v^2-13v+4),\qquad B(v)=3(v-1)\bigl(9(v-1)^2-1\bigr),
\]
with derivatives $A'$, $B'$, so that the recurrence of Definition~\ref{def:v5_coo_lev_sev} reads $n^3s_7(n)=A(n)s_7(n-1)+B(n)s_7(n-2)$ for $n\geq1$. A sequence $(u_n)_{n\geq0}$ satisfies the \textbf{deformed Cooper recurrence} if $u_0=0$, $u_1=9$ and
\[
n^3u_n-A(n)u_{n-1}-B(n)u_{n-2}=-3n^2s_7(n)+A'(n)s_7(n-1)+B'(n)s_7(n-2)\qquad(n\geq2).
\]
For integers $0\leq k\leq n$ put
\[
T(n,k)=\frac{(n+k)!\,(2n-k)!}{k!^3\,(n-k)!^3}.
\]
With the harmonic numbers $\mathfrak h_m$ of Definition~\ref{def:v5_log_coo_com}, the \textbf{harmonic Cooper sums} are, for $n\geq0$,
\[
e_n=\frac32\sum_{k=0}^nT(n,k)\bigl(\mathfrak h_{n+k}+\mathfrak h_{2n-k}-\mathfrak h_k-\mathfrak h_{n-k}\bigr).
\]
\end{definition}
\begin{lemma}\label{lem:v5_zei_cer_for}
Put
\[
\mathcal T(v,u)=\frac{\Gamma(v+u+1)\Gamma(2v-u+1)}{\Gamma(u+1)^3\Gamma(v-u+1)^3},\qquad
Z(v,u)=\frac{P(v,u)\Gamma(v+u-1)\Gamma(2v-u-2)}{\Gamma(u)^3\Gamma(v-u+1)^3},
\]
where
\[
\begin{aligned}
P(v,u)={}&(42v^2-57v+20)u^3+(-175v^3+300v^2-165v+28)u^2\\
&+v(244v^3-488v^2+321v-70)u-v^2(v-1)(115v^2-144v+46).
\end{aligned}
\]
Then $\mathcal T(n,k)=T(n,k)$ for integers $0\leq k\leq n$, and, as meromorphic functions of $(v,u)\in\mathbb C^2$,
\[
v^3\mathcal T(v,u)-A(v)\mathcal T(v-1,u)-B(v)\mathcal T(v-2,u)=Z(v,u+1)-Z(v,u).
\]
Consequently, for every integer $n\geq0$ and as meromorphic functions of $(v,x)$,
\[
\sum_{k=0}^n\Bigl(v^3\mathcal T(v,x+k)-A(v)\mathcal T(v-1,x+k)-B(v)\mathcal T(v-2,x+k)\Bigr)=Z(v,x+n+1)-Z(v,x).
\]
\end{lemma}
\begin{proof}
For integers $0\leq k\leq n$ all four gamma arguments are positive integers, and $\Gamma(m+1)=m!$ gives $\mathcal T(n,k)=T(n,k)$.
For the certificate identity, set
\[
D=(v+u)(v+u-1)(2v-u)(2v-u-1)(2v-u-2)(2v-u-3).
\]
Apply $\Gamma(z+1)=z\Gamma(z)$ to write each of the five terms as a polynomial in $v,u$ times $\beta=\Gamma(v+u-1)\Gamma(2v-u-3)/\bigl(\Gamma(u+1)^3\Gamma(v-u+1)^3\bigr)=\mathcal T(v,u)/D$, and divide by $\beta$. The identity becomes the polynomial equality
\[
\begin{aligned}
&(v-u)^3(v+u-1)P(v,u+1)-u^3(2v-u-3)P(v,u)\\
&\quad=v^3D-A(v)(v-u)^3(v+u-1)(2v-u-2)(2v-u-3)\\
&\qquad\quad-B(v)\bigl((v-u)(v-u-1)\bigr)^3,
\end{aligned}
\]
which holds by expansion. Both sides of the original identity are meromorphic on $\mathbb C^2$ and agree on the open set where the division is legitimate, so they agree identically.
Finally, substitute $u=x+k$ for $k=0,\dots,n$ and sum; the right-hand side telescopes to $Z(v,x+n+1)-Z(v,x)$.
\end{proof}
\begin{lemma}\label{lem:v5_cre_tel_har}
The harmonic Cooper sums $(e_n)_{n\geq0}$ satisfy the deformed Cooper recurrence.
\end{lemma}
\begin{proof}
The proof is by creative telescoping. We deform the Cooper summand by a continuous parameter $r$. The certificate of Lemma~\ref{lem:v5_zei_cer_for} shows that the deformed sums satisfy the Cooper recurrence up to $O(r^2)$, and differentiating at $r=0$ produces the harmonic sums together with the stated inhomogeneity. We use the notation $\mathcal T$, $Z$ of Lemma~\ref{lem:v5_zei_cer_for}.
\emph{The deformed sums.} For $n\geq0$ define, analytically near $r=0$,
\[
a_n(r)=\sum_{k=0}^n\mathcal T(n+r,k+r/2).
\]
By Lemma~\ref{lem:v5_zei_cer_for} and Lemma~\ref{lem:v5_cla_con_for}, $a_n(0)=\sum_kT(n,k)=\sum_kL_{n,k}L_{n,n-k}=s_7(n)$. Logarithmic differentiation of the gamma factors, using $\psi(m+1)=\mathfrak h_m-\gamma$, gives $a_n'(0)=e_n$; the Euler constants cancel. In particular $e_0=0$ and $e_1=9$.
\emph{Telescoping.} For $n\geq2$, apply the telescoped identity of Lemma~\ref{lem:v5_zei_cer_for} with $v=n+r$ and $x=r/2$. The boundary terms are $O(r^2)$. Indeed, $Z(n+r,r/2)=O(r^3)$ because $1/\Gamma(r/2)^3=O(r^3)$ and both numerator gamma factors are regular. At the upper boundary, $Z(n+r,n+1+r/2)$ also contains $1/\Gamma(r/2)^3$; its only possibly singular numerator factor is $\Gamma(n-3+3r/2)$, with at most a simple pole. Hence this boundary is $O(r^2)$, including $n=2,3$.
The sum of $\mathcal T(n-1+r,k+r/2)$ differs from $a_{n-1}(r)$ only by its term $k=n$, and that of $\mathcal T(n-2+r,k+r/2)$ differs from $a_{n-2}(r)$ only by its terms $k=n-1,n$. Every such extra term is $O(r^2)$: the inverse cube of a gamma function at a nonpositive integer supplies a zero of order three, while at most one numerator gamma factor has a simple pole. Consequently
\[
(n+r)^3a_n(r)-A(n+r)a_{n-1}(r)-B(n+r)a_{n-2}(r)=O(r^2).
\]
Differentiating at $r=0$ and substituting $a_m(0)=s_7(m)$, $a_m'(0)=e_m$ gives the assertion.
\end{proof}
\begin{lemma}\label{lem:v5_coo_ope_prd}
\begin{enumerate}
\item $\mathcal LF=0$.
\item If $u,v$ are analytic solutions of $\mathcal Du=\mathcal Dv=0$ on a connected open subset of $\mathbb C\setminus\{0,-1,\frac1{27}\}$, then $\mathcal L(uv)=0$ there.
\item $\mathcal D$ has a unique solution $\phi\in1+Y\mathbb Q[[Y]]$, and $\phi^2=F$.
\end{enumerate}
\end{lemma}
\begin{proof}
Item (1) is the recurrence of the Cooper numbers in operator form; (2) and (3) apply the classical formula for the square of a solution of a second-order equation.
\emph{Proof of (1).} Extracting the coefficient of $Y^n$ in $\mathcal LF$ gives
\[
n^3s_7(n)-(2n-1)(13n^2-13n+4)s_7(n-1)-3(n-1)(3n-4)(3n-2)s_7(n-2)=0.
\]
For $n\geq2$ this is the defining recurrence shifted by one, and for $n=1$ it is the recurrence at index $0$, that is, $s_7(1)=4s_7(0)$; the equation at $n=0$ follows from the initial values.
\emph{Proof of (2).} Put $G=(1+Y)(1-27Y)$. In ordinary derivative form, $\mathcal Du=0$ is $u''+au'+bu=0$ with
\[
a=\frac1Y+\frac{G'}{2G},\qquad b=-\frac{2(1+3Y)}{YG}.
\]
By \cite[Lemma 6.1]{locbib:Cooper2012}, p.~175, the square of a solution satisfies
\[
g'''+3ag''+(a'+4b+2a^2)g'+(2b'+4ab)g=0,
\]
and substitution of $a,b$ identifies this operator with $\mathcal L/(Y^3G)$; note that the coefficient of $\theta^3$ in $\mathcal L$ is $G$. As $uv=\frac14\bigl((u+v)^2-(u-v)^2\bigr)$ and $\mathcal L$ is linear, $\mathcal L(uv)=0$.
\emph{Proof of (3).} The formula for the square used in (2) is a differential-algebraic identity, valid for formal solutions in $\mathbb Q[[Y]]$, with $a,b\in\mathbb Q((Y))$. At $Y=0$ both $\mathcal D$ and $\mathcal L$ have indicial polynomial a power of $\theta$, so their coefficient recurrences have leading coefficients $n^2$ and $n^3$, respectively. Hence each has a unique power-series solution with constant term $1$; denote that of $\mathcal D$ by $\phi$. Then $\phi^2\in1+Y\mathbb Q[[Y]]$ solves $\mathcal L$, and by (1) and uniqueness $\phi^2=F$.
\end{proof}
\begin{lemma}\label{lem:v5_red_ord_the}
The coefficients $(d_n)_{n\geq0}$ of the logarithmic Cooper companion satisfy the deformed Cooper recurrence.
\end{lemma}
\begin{proof}
The series $F\log Y+\mathcal H$ is the product of the two Frobenius solutions of $\mathcal D$, hence a logarithmic solution of $\mathcal L$, and the recurrence is the coefficient form of this fact.
\emph{The logarithmic solution.} Let $\phi$ be as in Lemma~\ref{lem:v5_coo_ope_prd}(3), so $\phi^2=F$; all series below converge near $Y=0$. In ordinary derivative form the coefficient of $\phi'$ in $\mathcal D$ is $a=1/Y+G'/(2G)$, so $\exp(-\int a)=1/(Y\sqrt G)$. Reduction of order gives the second solution
\[
\phi_1=\phi\bigl(\log Y+\ell(Y)\bigr),\qquad\text{since}\qquad
\frac{d}{dY}\bigl(\log Y+\ell(Y)\bigr)=\frac{\rho(Y)}{Y}=\frac{1}{Y\,\phi^2\sqrt{G}},
\]
on a slit neighbourhood of $0$. By Lemma~\ref{lem:v5_coo_ope_prd}(2), $\phi\phi_1=F\log Y+\mathcal H$ solves $\mathcal L$.
\emph{The coefficient form.} Write $\mathcal L=\theta^3-YP_1(\theta)-Y^2P_2(\theta)$ with $P_1(\theta)=(2\theta+1)(13\theta^2+13\theta+4)$ and $P_2(\theta)=3(\theta+1)(3\theta+2)(3\theta+4)$, so $P_1(n-1)=A(n)$ and $P_2(n-2)=B(n)$. Since $\theta^j(g\log Y)=(\theta^jg)\log Y+j\theta^{j-1}g$, one has $\mathcal L(F\log Y)=(\mathcal LF)\log Y+(\partial_\theta\mathcal L)F$, where $\partial_\theta\mathcal L$ is the formal $\theta$-derivative of $\mathcal L$. As $\mathcal LF=0$ (Lemma~\ref{lem:v5_coo_ope_prd}(1)) and $\mathcal L(F\log Y+\mathcal H)=0$,
\[
\mathcal L\mathcal H=-(\partial_\theta\mathcal L)F.
\]
Taking the coefficient of $Y^n$, with $d_m=s_7(m)=0$ for $m<0$, gives the relation of the deformed Cooper recurrence for every $n\geq0$, in particular for $n\geq2$, since $\partial_\theta P_1(\theta)|_{\theta=n-1}=A'(n)$ and $\partial_\theta P_2(\theta)|_{\theta=n-2}=B'(n)$.
\emph{Initial values.} $d_0=0$ because $\ell$ has zero constant term. Since $F=1+4Y+O(Y^2)$ and $\sqrt G=1-13Y+O(Y^2)$, $\rho=1+9Y+O(Y^2)$, so $[Y]\ell=9$ and $d_1=9$.
\end{proof}
\begin{lemma}\label{lem:v5_har_for_for}
For every integer $n\geq0$, $d_n=e_n$.
\end{lemma}
\begin{proof}
By Lemma~\ref{lem:v5_cre_tel_har} and Lemma~\ref{lem:v5_red_ord_the}, both $(e_n)$ and $(d_n)$ satisfy the deformed Cooper recurrence, so $e_0=d_0=0$ and $e_1=d_1=9$. Since $n^3\neq0$, the relation of that recurrence determines its $n$-th term from the two preceding ones for $n\geq2$. Induction on $n$ gives $d_n=e_n$ for all $n\geq0$.
\end{proof}
\begin{lemma}\label{lem:v5_inv_coo_for}
For every integer $n\geq0$,
\[
c_7(2n+1)=[Y^n]F(Y)\exp\!\left(-\frac{2n+1}{2}\ell(Y)\right).
\]
For every odd prime $p$ this implies
\[
c_7(p)-s_7\!\left(\frac{p-1}{2}\right)
\equiv-\frac p2\,d_{(p-1)/2}\pmod{p^2}.
\]
\end{lemma}
\begin{proof}
\emph{The exact formula.} Cooper's identity $z=F(y)$ \cite[Theorem 3.1]{locbib:Cooper2012}, the identity $q\frac{d}{dq}\log y=zw$ of Lemma~\ref{lem:v5_ell_dat_and}(4) and the conic identity $w^2=G(y)$ of Proposition~\ref{prop:v5_lev_sev_squ} give
\[
q\frac{d\log y(q)}{dq}=F(y(q))\sqrt{G(y(q))}.
\]
Both square roots have constant term one. Let $q=\psi(Y)$ be the compositional inverse of $y(q)=q+O(q^2)$. Formal differentiation gives
\[
Y\frac{d\log\psi(Y)}{dY}=\rho(Y),\qquad
\psi(Y)=Y\exp(\ell(Y)).
\]
Thus the inverse of $t=s(Q)$ is
\[
Q(t)=t\exp\!\left(\frac12\ell(t^2)\right).
\]
For $m=2n+1$, invariance of the formal residue under this unit-leading change of variable and the defining differential identity give
\[
\begin{aligned}
c_7(m)
&=\operatorname{Res}_{Q=0}C(Q)Q^{-m}\frac{dQ}{Q}\\
&=\operatorname{Res}_{t=0}F(t^2)Q(t)^{-m}\,dt\\
&=[t^{m-1}]F(t^2)\exp\!\left(-\frac m2\ell(t^2)\right)\\
&=[Y^n]F(Y)\exp\!\left(-\frac m2\ell(Y)\right).
\end{aligned}
\]
This proves the exact formula.
\emph{The congruence.} Fix an odd prime $p$ and put $h=(p-1)/2$. The integrality of $s_7(n)$ is Lemma~\ref{lem:v5_cla_con_for}; $\sqrt G$ and its inverse are integral at every odd prime by recursive coefficient comparison. Hence $\rho\in\mathbb Z_p[[Y]]$. For $1\leq j\leq h$, the coefficient $[Y^j]\ell=([Y^j]\rho)/j$ is $p$-integral. Since $h