\section{The arithmetic parameter of the trace} \label{fl:sec:arithmetic-trace} Section~\ref{fl:sec:conservation} produced a nonzero trace function $\varphi$. This section shows that it has the right parameter: Theorem~\ref{fl:thm:arithmetic-family-trace} says that the functional $h\mapsto[h,\varphi]$ on functions with compact support is an eigenvector of every excursion operator, with eigenvalue given by $\rho$. By Proposition~\xref{I}{fl:prop:cuspidal-excursion-character} this makes $\varphi$ a cusp form with parameter $\vartheta_G\rho$ (Corollary~\ref{fl:cor:arithmetic-family-eigenfunction}). Here $\vartheta_G$ is the Chevalley involution of $\widehat G$ (Section~\ref{fl:app:conventions}); it appears because the pairing with functions of compact support exchanges a parameter with its Chevalley dual. Accordingly, in Section~\ref{fl:sec:exceptional-assembly} the construction is applied to $\vartheta_G\sigma$ in place of $\sigma$. For a single Hecke eigensheaf the argument is due to Braverman and Varshavsky and to V.~Lafforgue: the eigensheaf defines, for every finite set of legs, a map from the cohomology of shtukas to the fibre of its eigenvalue, and these maps are compatible with creation, annihilation and the action of the Weil groups; an excursion operator is then computed on the eigenvalue. Two things have to be added here. First, the compatibility of these maps with partial Frobenius morphisms was left unwritten in \cite[Proposition~15.1]{VLa18}; we prove it in Proposition~\ref{fl:lem:closed-weil-transport}. Secondly, we have a family $\mathcal F_W$ and not a single eigensheaf. Its Hecke identities involve only the geometric local system, and a geometric local system has several arithmetic structures: the image $g$ of Frobenius can be multiplied by any $z$ in the centralizer $Z$ of the geometric monodromy. The maps just described therefore take values in functions of $z$, and an excursion operator acts on them as multiplication by the function $z\mapsto \nu_{\rho_z}(e)$, where $\rho_z$ is the parameter with Frobenius image modified by $z$ (Proposition~\ref{fl:lem:excursion-selector-contraction}). The function of $z$ attached to the coefficient $R=k[\pi_0(Z)]$ is supported on the twisted conjugacy class of $z=1$, on which $\rho_z$ is conjugate to $\rho$ (Lemma~\ref{fl:lem:regular-component-selector}). This gives the theorem. \subsection{Setting and statement} \begin{setup}\label{rw:setup:trace} Let $G$ be split, simply connected and semisimple, let $Y=\Bun_{G,D}$ for the original curve $X$ and a nonempty effective divisor $D$, which may be nonreduced, and let $U=X-\operatorname{supp}D$. The coefficient field $k$ is an algebraic closure of $\mathbb Q_\ell$, with a fixed square root of $q$. Sheaves are considered on the base change of $Y$, $U$ and of the stacks below to $\overline{\mathbb F}_q$, and $\operatorname{Fr}$ denotes the $q$-Frobenius endomorphism of such a base change; it is linear over $\overline{\mathbb F}_q$. For a finite set $I$ and $J\subset I$, the partial Frobenius $\Frob_J$ of $U^I$ is $\operatorname{Fr}$ on the coordinates in $J$ and the identity on the others. \smallskip\noindent\emph{The local system.} Let $\rho$ be a $\widehat G$-local system on $U$. For a representation $V$ of $\widehat G^I$ let $V_\rho$ be the associated lisse sheaf on $U^I$; on $\overline{\mathbb F}_q$ it comes with isomorphisms $\theta_J:\Frob_J^*V_\rho\simeq V_\rho$. Let $Z\subset\widehat G$ be a reductive subgroup centralizing the image of the geometric fundamental group. The group $Z^I$ then acts on $V_\rho$ over $\overline{\mathbb F}_q$; for $z\in Z$ we write $z_J$ for its action through the legs in $J$, and $z=z_I$. Let $\phi$ be a geometric Frobenius element of the Weil group of $U$ and put $g=\rho(\phi)^{-1}$, the image of an arithmetic Frobenius element. We assume that $g$ normalizes $Z$ and put $\alpha=\Ad(g)|_Z$. Since $\theta$ induces on a fibre the action of $\phi$, \begin{equation}\label{rw:eq:theta-alpha} \theta_J\circ\Frob_J^*(z_J)=\alpha^{-1}(z)_J\circ\theta_J . \end{equation} For $z\in Z$ let $\rho_z$ be the parameter of the Weil group with the same restriction to the geometric fundamental group as $\rho$ and with $\rho_z(\phi)=zg^{-1}$; equivalently, $V_{\rho_z}$ is $V_\rho$ with $\theta_J$ replaced by $z_J\theta_J$. This is a homomorphism because $Z$ centralizes the geometric image. For an excursion datum $e=(I,f,\boldsymbol\gamma)$ with $\boldsymbol\gamma=(\gamma_i)\in W_F^I$, the value $\nu_{\rho_z}(e)=f((\rho_z(\gamma_i))_{i\in I})$ is a regular function of $z$. \smallskip\noindent\emph{The family.} We are given a $k$-linear functor $W\mapsto\mathcal F_W$ from finite-dimensional representations of $Z$ to locally bounded constructible complexes on $Y$. For a lisse sheaf $\mathcal W$ on a scheme $B$ with an action of $Z$ we put $\mathcal F(\mathcal W)=\bigoplus_W\mathcal F_W\boxtimes \underline{\Hom}_Z(W,\mathcal W)$ on $Y\times B$, the sum being over the irreducible representations. Let $\mathrm{Hecke}_I$ be the stack over $U^I$ of modifications of $G$-bundles with level structure along $D$, with its maps $a,b$ to $Y$ given by the source and the target and its map $\ell$ to $U^I$, and let $\mathcal S_{I,V}$ be the Satake kernel on it, in the normalization of \cite[Definition~4.5 and (4.8)]{VLa18}. The Hecke functor is $\mathsf H_{I,V}(K)=(b,\ell)_!(\mathcal S_{I,V}\otimes a^*K)$. The family is a Hecke family with Frobenius in the sense of Definition~\ref{rw:def:hecke-family}. With the normalizations just fixed, this means the following. \begin{enumerate} \item[(F1)] \emph{Hecke isomorphisms.} For all $I$, $V$ and $W$ there are isomorphisms $\mathsf H_{I,V}(\mathcal F_W)\simeq\mathcal F(W\otimes V_\rho)$ on $Y\times U^I$, where $Z$ acts diagonally on $W\otimes V_\rho$. They are natural in $W$ and in $V$, are the identity for the trivial representation, and are compatible with restriction to diagonals of $U^I$ and with convolution: for $I=J\sqcup J'$ and $V=V_1\boxtimes V_2$ the isomorphism for $(I,V)$ is the composite of those for $(J,V_1)$ and $(J',V_2)$ under the convolution isomorphism of Satake kernels. Here naturality in $V$, restriction to diagonals and convolution refer to the corresponding structures of the kernels $\mathcal S_{I,V}$ \cite[Notation~4.9, Propositions~4.10 and~4.12]{VLa18}. \item[(F2)] \emph{Frobenius covariance.} There are isomorphisms $c_W:\operatorname{Fr}^*\mathcal F_W\simeq\mathcal F_{\alpha^*W}$, natural in $W$, where $r_W:Z\to\mathrm{GL}(W)$ denotes the action of $Z$ on a representation $W$, and $\alpha^*W$ is $W$ with the action $z\mapsto r_W(\alpha(z))$. \item[(F3)] \emph{Compatibility.} The Satake kernel has its Frobenius structure $\Phi_{\mathcal S}:\operatorname{Fr}^*\mathcal S_{I,V}\simeq \mathcal S_{I,V}$ \cite[(3.5)]{VLa18}, which gives $\operatorname{Fr}^*\mathsf H_{I,V}(K)\simeq \mathsf H_{I,V}(\operatorname{Fr}^*K)$, where on the left $\operatorname{Fr}$ is the Frobenius of $Y\times U^I$. Under this identification the two isomorphisms \[ \operatorname{Fr}^*\mathsf H_{I,V}(\mathcal F_W) \longrightarrow\mathcal F(\alpha^*W\otimes V_\rho), \] namely the Hecke isomorphism for $W$ followed by $c$ and $\theta_I$, and $\mathsf H_{I,V}(c_W)$ followed by the Hecke isomorphism for $\alpha^*W$, are equal. \end{enumerate} In (F3) we used that $\theta_I:\alpha^*\operatorname{Fr}^*V_\rho\to V_\rho$ commutes with the action of $Z$, by \eqref{rw:eq:theta-alpha}. The family of Theorem~\ref{fl:thm:compact-automorphic-family}, restricted as in Proposition~\ref{fl:prop:passive-bundle-restriction}, has this structure. For simply connected $G$ the Schubert dimensions are even, so no sign occurs in the commutativity constraint \cite[Remarks~1.19 and~1.21]{VLa18}. \smallskip\noindent\emph{The trace function.} A map $\lambda:\alpha^*W\to W$ of representations of $Z$ makes $\mathcal F_W$ a Weil complex, with structure map $\mathcal F_\lambda\circ c_W:\operatorname{Fr}^*\mathcal F_W\to \mathcal F_W$. We call such a map $\lambda$ a \emph{closing map}. Let \[ \Pi=\pi_0(Z),\qquad R=k[\Pi],\qquad \lambda_R:\alpha^*R\to R,\quad e_\gamma\mapsto e_{\alpha^{-1}(\gamma)}, \] where $Z$ acts on $R$ by left translation, and let $\varphi$ be the trace function of the Weil complex $(\mathcal F_R,\lambda_R)$. \end{setup} \begin{theorem}[Excursion equations for the trace] \label{fl:thm:arithmetic-family-trace} In Setup~\ref{rw:setup:trace}, assume that $Z^\circ$ is a torus and that $1-\alpha:Z^\circ\to Z^\circ$ is an isogeny. For every excursion datum $e=(I,f,\boldsymbol\gamma)$ with $\boldsymbol\gamma\in W_F^I$, the pairing \begin{equation}\label{fl:eq:trace-empty-map} L_\varphi(h)= \sum_{[y]\in Y(\mathbb F_q)} \frac{h(y)\varphi(y)}{|\operatorname{Aut}(y)(\mathbb F_q)|} \qquad\bigl(h\in C_c(Y(\mathbb F_q),k)\bigr) \end{equation} satisfies \[ L_\varphi S_e=\nu_\rho(e)L_\varphi, \qquad \nu_\rho(e)=f\bigl((\rho(\gamma_i))_{i\in I}\bigr). \] \end{theorem} \begin{remark}[Conventions] \label{rw:rem:trace-conventions} Let $u_C$ be the arithmetic Frobenius of the curve, acting on the coefficients. With the conventions which precede Lemma~\ref{fl:lem:coarse-covariance}, the automorphisms of the stack of bundles and of the spectral stack are the transports $u_{\rm aut}(\mathcal E)=(u_C^{-1})^*\mathcal E$ and $u_{\rm spec}(\tau)=(u_C^{-1})^*\tau$. The descent isomorphism $c:u_C^*\rho\simeq\rho$ has matrix $g$ in the marked fibre, so $u_{\rm spec}$ acts on the centralizer through $\alpha^{-1}$, where $\alpha=\operatorname{Ad}(g)|_Z$, and the covariance of Lemma~\ref{fl:lem:coarse-covariance} is \[ u_{\rm aut}^*\mathcal F_W \simeq\mathcal F_{(\alpha^{-1})^*W}. \] On the special fibre $u_{\rm aut}\circ\operatorname{Fr}_Y$ is the absolute Frobenius, whose pullback is canonically the identity on \'etale sheaves. Inverting the covariance gives \[ \operatorname{Fr}_Y^*\mathcal F_W \simeq\mathcal F_{\alpha^*W}, \] which is (F2). On the legs the corresponding map is $u_C^{-1}$, whose pullback is identified with $\operatorname{Fr}_U^*$ in the same way, and the isomorphism of local systems is \[ \theta=(u_C^{-1})^*(c^{-1}): (u_C^{-1})^*\rho\longrightarrow\rho. \] Its matrix in the marked fibre is $g^{-1}$, and $\theta\circ\operatorname{Fr}^*(z)=\alpha^{-1}(z)\circ\theta$; equivalently $\theta:\alpha^*\operatorname{Fr}^*V_\rho\to V_\rho$ is equivariant under $Z$. By the identity for the universal local system and the Hecke identities, the inverse of the arithmetic covariance is the square (F3). So (F3) is a property of the family which has been constructed, and the direction of $\alpha$ is determined by the construction. For the regular representation $R$ of the group of components the map which plays the role of a closing map for the arithmetic covariance is $(\alpha^{-1})^*R\to R$, $e_\gamma\mapsto e_{\alpha(\gamma)}$; we call it the arithmetic closing map. The closing map of the setup, the geometric one, is its inverse $\lambda_R:\alpha^*R\to R$, $e_\gamma\mapsto e_{\alpha^{-1}(\gamma)}$. The arithmetic and the geometric operator on $\Gamma(\mathfrak F_\rho,P_{\rm reg})$ are inverse to each other, on the exterior algebra $\Lambda$ and on $R$ together, and Proposition~\ref{fl:prop:puncture-exact-trace} shows that the supertraces of both are nonzero. The trace function of a Weil complex is the trace of the geometric operator. The following table collects the two directions. The left column is the arithmetic one, defined by transport by $u_C$; the right column is the geometric one, defined by pullback by Frobenius, and the maps on the right are the inverses of those on the left. \begin{center} \small \renewcommand{\arraystretch}{1.25} \begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.27\textwidth}>{\raggedright\arraybackslash}p{0.33\textwidth}>{\raggedright\arraybackslash}p{0.33\textwidth}@{}} \toprule & arithmetic & geometric\\ \midrule map of the stack of bundles & $u_{\rm aut}:\mathcal E\mapsto(u_C^{-1})^*\mathcal E$ & $\operatorname{Fr}_Y$; the composite $u_{\rm aut}\circ\operatorname{Fr}_Y$ is the absolute Frobenius\\ covariance of the family & $u_{\rm aut}^*\mathcal F_W\simeq\mathcal F_{(\alpha^{-1})^*W}$ & $\operatorname{Fr}_Y^*\mathcal F_W\simeq\mathcal F_{\alpha^*W}$, which is (F2)\\ local system on the legs & $c:u_C^*\rho\to\rho$, with matrix $g$ & $\theta:(u_C^{-1})^*\rho\to\rho$, with matrix $g^{-1}$\\ closing map on $R=k[\Pi]$ & $e_\gamma\mapsto e_{\alpha(\gamma)}$ & $\lambda_R:e_\gamma\mapsto e_{\alpha^{-1}(\gamma)}$\\ operator on $\widehat{\mathfrak g}_x^*$, for an orbit of length $d$ & $q^d\operatorname{Ad}(g_D)^\vee$ & $q^{-d}(\operatorname{Ad}(g_D)^\vee)^{-1}$\\ factor of the supertrace, for an eigenvalue $\lambda$ of $\operatorname{Ad}(g_D)^\vee$ & $1-q^d\lambda$ & $1-q^{-d}\lambda^{-1}$\\ the example of Section~\ref{fl:sec:low-rank-example} & $-64$ & $64/125$\\ \bottomrule \end{tabular} \end{center} \end{remark} \subsection{Functions on the centralizer} Twisted conjugation is the action $h\star z=\alpha(h)zh^{-1}$ of $Z$ on itself. If $z$ is replaced by $h\star z$ then $zg^{-1}$ is replaced by its conjugate under $\alpha(h)$, so that $\rho_{h\star z}=\Ad(\alpha(h))\circ\rho_z$. \begin{definition}[Trace data and matrix coefficients] \label{rw:def:coefficient-functions} Let $V$ be a finite-dimensional representation of $Z$. We write $A(V)$ for the space of regular maps $a:Z\to V^*$ such that \[ a(h\star z)=a(z)\circ r_V(\alpha(h))^{-1} \qquad(h,z\in Z). \] A \emph{trace datum} for $V$ is a pair $(W,\lambda)$ of a finite-dimensional representation $W$ of $Z$ and a map $\lambda:\alpha^*(W\otimes V)\to W$ of representations. Its \emph{matrix coefficient} is \[ a_{W,\lambda}(z)(v) =\Tr\bigl(r_W(z)\circ\lambda(-\otimes v)\bigm|W\bigr). \] \end{definition} For the trivial representation, $A(\mathbf 1)$ is the space $\mathcal O(Z)^\star$ of regular functions invariant under twisted conjugation, and $a_{W,\lambda}(z)=\Tr(r_W(z)\lambda)$. \begin{lemma}[Matrix coefficients] \label{fl:lem:twisted-representation-trace} \begin{enumerate} \item The function $a_{W,\lambda}$ belongs to $A(V)$, and $\lambda\mapsto a_{W,\lambda}$ induces an isomorphism \[ \bigoplus_W\Hom_Z\bigl(\alpha^*(W\otimes V),W\bigr) \xrightarrow{\ \sim\ }A(V), \] the sum being over the irreducible representations of $Z$. \item If $W=\bigoplus_iW_i\otimes M_i$ with $W_i$ irreducible and pairwise nonisomorphic, and $\lambda_i$ denotes the partial trace over $M_i$ of the component of $\lambda$ from $\alpha^*(W_i\otimes M_i\otimes V)$ to $W_i\otimes M_i$, then $a_{W,\lambda}=\sum_ia_{W_i,\lambda_i}$. \item Let $V=V_1\otimes V_2$, let $V_1'$ be another representation and $\vartheta:V_1'\to V_1$ a linear map with $\vartheta\circ r_{V_1'}(z)=r_{V_1}(\alpha^{-1}(z))\circ \vartheta$. Put $W'=W\otimes V_1$ and \[ \lambda':\alpha^*(W\otimes V_1\otimes V_1'\otimes V_2) \longrightarrow W\otimes V_1,\qquad w\otimes v_1\otimes v_1'\otimes v_2\longmapsto \lambda(w\otimes v_1\otimes v_2)\otimes\vartheta(v_1'). \] Then $(W',\lambda')$ is a trace datum for $V_1'\otimes V_2$, and \[ a_{W',\lambda'}(z)=a_{W,\lambda}(z)\circ \bigl(r_{V_1}(z)\vartheta\otimes\id_{V_2}\bigr). \] \end{enumerate} \end{lemma} \begin{proof} (1) Write $\lambda_v=\lambda(-\otimes v)\in\End(W)$. That $\lambda$ is a map of representations means $\lambda_{\alpha(h)v}\,r_W(\alpha(h))=r_W(h)\lambda_v$. Hence \[ a(z)(v)=\Tr\bigl(r_W(z)r_W(h)^{-1} \lambda_{\alpha(h)v}r_W(\alpha(h))\bigr) =a(h\star z)(\alpha(h)v), \] which is the condition defining $A(V)$. Representations of the reductive group $Z$ are semisimple, and by the algebraic Peter--Weyl theorem the maps $\End(W)\to\mathcal O(Z)$, $T\mapsto\Tr(r_W(z)T)$, for $W$ irreducible, are injective and $\mathcal O(Z)$ is the direct sum of their images. Twisted conjugation acts on the image of $\End(W)$ through $T\mapsto r_W(h)T r_W(\alpha(h))^{-1}$, that is, through the natural action on $\Hom(\alpha^*W,W)$. Tensoring with $V^*$ and taking invariants gives the isomorphism. (2) Only the components of $\lambda$ from the $i$th summand to itself contribute to the trace, and the trace over $W_i\otimes M_i$ is the trace over $W_i$ of the partial trace. (3) That $\lambda'$ is a map of representations follows from the property of $\vartheta$. For fixed $v_1'$ and $v_2$ the operator $r_{W'}(z)\lambda'(-\otimes v_1'\otimes v_2)$ on $W\otimes V_1$ sends $w\otimes v_1$ to $r_W(z)\lambda(w\otimes v_1\otimes v_2)\otimes r_{V_1}(z)\vartheta(v_1')$. The trace of an operator of the form $w\otimes v_1\mapsto T(w\otimes v_1)\otimes c$, with $T:W\otimes V_1\to W$ and $c\in V_1$, is the trace of $w\mapsto T(w\otimes c)$. This gives the formula. \end{proof} \begin{lemma}[The regular coefficient] \label{fl:lem:regular-component-selector} Assume that $Z^\circ$ is a torus and that $1-\alpha$ is an isogeny of $Z^\circ$. Then \begin{equation}\label{fl:eq:component-twisted-character} a_{R,\lambda_R} =|\Pi^\alpha|\,1_{\mathscr O},\qquad \mathscr O=\{\alpha(h)h^{-1}:h\in Z\}. \end{equation} The set $\mathscr O$ is a union of connected components of $Z$, and for every excursion datum $e$, \begin{equation}\label{fl:eq:family-excursion-selector} \nu_{\rho_z}(e)\,a_{R,\lambda_R}(z)=\nu_\rho(e)\,a_{R,\lambda_R}(z) \qquad(z\in Z). \end{equation} \end{lemma} \begin{proof} The operator $r_R(z)\lambda_R$ sends $e_\gamma$ to $e_{\bar z\alpha^{-1}(\gamma)}$, where $\bar z$ is the image of $z$ in $\Pi$. Its trace is the number of $\gamma$ with $\bar z=\gamma\alpha^{-1}(\gamma)^{-1}$. Writing $\gamma=\alpha(\delta)$, these are the solutions of $\bar z=\alpha(\delta)\delta^{-1}$; if there is one, the others are its products on the right with elements of $\Pi^\alpha$. Suppose $\bar z=\alpha(\delta)\delta^{-1}$ and let $h_0$ be a lift of $\delta$. Then $z=\alpha(h_0)\,t\,h_0^{-1}$ with $t\in Z^\circ$. The map $s\mapsto\alpha(s)s^{-1}$ is an endomorphism of the torus $Z^\circ$, and it is surjective because $1-\alpha$ is an isogeny. Writing $t=\alpha(s)s^{-1}$ gives $z=\alpha(h_0s)(h_0s)^{-1}\in\mathscr O$. Conversely the image in $\Pi$ of an element of $\mathscr O$ has the required form. This proves \eqref{fl:eq:component-twisted-character} and shows that $\mathscr O$ is the inverse image of a subset of $\Pi$. For $z=\alpha(h)h^{-1}=h\star1$ we have $\rho_z=\Ad(\alpha(h))\circ\rho$, and excursion functions are invariant under simultaneous conjugation. This proves \eqref{fl:eq:family-excursion-selector}. \end{proof} \begin{remark} With the trivial coefficient in place of $R$, all the parameters $\rho_z$ would contribute. The regular representation of $\pi_0(Z)$ restricts the contributions to certain components of $Z$, and the condition that $1-\alpha$ is an isogeny of $Z^\circ$ makes those components a single twisted conjugacy class. Both parts of Lemma~\ref{fl:lem:geometric-centralizer-torus} are used here. \end{remark} \subsection{Traces of correspondences} We recall the trace of a cohomological correspondence relative to a base, in the form in which it will be used. Let $B$ be a scheme of finite type over $\overline{\mathbb F}_q$ and $M$ a scheme separated and of finite type over $B$. Complexes on $M$ are assumed bounded, constructible and universally locally acyclic over $B$; this holds for $K\boxtimes N$ when $M=Y_0\times B$, $K$ is a complex on $Y_0$ and $N$ is lisse on $B$. \begin{definition}[Correspondences with kernel and their traces] \label{rw:def:correspondence-kernel} Let $K$ be a complex on $M$ and $K'$ a complex on a second scheme $M'$ of the same kind; in most of what follows $M'=M$, but in step~5 of the proof of Proposition~\ref{fl:lem:closed-weil-transport} the two are different. A \emph{correspondence with kernel} from $K$ to $K'$ consists of a scheme $H$ separated and of finite type over $B$ with a map $(a,b):H\to M\times_BM'$, a complex $A$ on $H$, the kernel, and a map \[ \eta:A\otimes a^*K\longrightarrow b^!K'. \] The composite with a correspondence $(H',A',\eta')$ from $K'$ to a complex $K''$ on a third such scheme is supported on $H\times_{b,M',a'}H'$, has kernel $A\boxtimes_{M'}A'$, and the map of the composite is deduced from $\eta$ and $\eta'$ by the base change map, as in \cite[\S4.1]{VLa18}. A map $f:K\to K'$ is a correspondence supported on $M$ with kernel $k$. For an endomorphism $F$ of $M$ over $B$ and a map $\phi:F^*K\to K'$, we write $\Psi_\phi$ for the correspondence from $K$ to $K'$ supported on $M$, with $(a,b)=(F,\id)$ and kernel $k$. Let $N$ be a lisse sheaf on $B$ and $\epsilon=(H,A,\eta)$ a correspondence with kernel from $K$ to $K\otimes N$. Let $C$ be its fixed locus, the inverse image of the diagonal of $M\times_BM$, with maps $i:C\to H$, $\pi:C\to M$ and $p:C\to B$. Let $p_H:H\to B$ be the structure map. The map $\eta$ is the same as a map $A\to(a,b)^!(D_{M/B}K\boxtimes_BK)\otimes p_H^*N$, by the duality \begin{equation}\label{fl:eq:trace-relative-Hom} D_{M/B}K\boxtimes_BK' \simeq R\mathcal Hom \bigl(\operatorname{pr}_1^*K,\operatorname{pr}_2^!K'\bigr) \end{equation} of \cite[Proposition~2.5]{LZ22}. The \emph{trace} of $\epsilon$ is the composite \begin{equation}\label{fl:eq:trace-six-functor} \operatorname{tr}(\epsilon):\ i^*A\longrightarrow i^*(a,b)^!(D_{M/B}K\boxtimes_BK)\otimes p^*N \longrightarrow \pi^!(D_{M/B}K\otimes K)\otimes p^*N \longrightarrow\omega_{C/B}\otimes p^*N, \end{equation} in which the middle arrow is the base change map $i^*(a,b)^!\to\pi^!\Delta^*$ and the last is evaluation. The \emph{pairing} of $\epsilon$ is the map \[ \Pi(\epsilon):\ p_!i^*A\xrightarrow{\ p_!\operatorname{tr}(\epsilon)\ } p_!p^!N\longrightarrow N. \] \end{definition} In the language of \cite[Construction~2.6]{LZ22}, a correspondence with kernel from $K$ to $K'$ is a morphism $(H,A)\otimes(M,K)\to(M,K')$ in the symmetric monoidal $2$-category of cohomological correspondences over $B$. The object $(M,K)$ is dualizable because $K$ is universally locally acyclic \cite[Theorem~2.16]{LZ22}, and $\operatorname{tr}(\epsilon)$ is the trace of an endomorphism of a dualizable object \cite[Construction~1.6]{LZ22}, formed with the kernel $(H,A)$ as a parameter and with values in $(B,N)$. No condition on the kernel is needed. The statements of \cite{LZ22} are for torsion coefficients, and we pass to the coefficients $k$ in the usual way. The complexes used below are finite in number and defined over the ring of integers $\mathcal O_E$ of a finite extension $E$ of $\mathbb Q_\ell$. Their reductions modulo the powers of a uniformizer $\varpi$ are universally locally acyclic where the complexes are, so the trace and its properties are available modulo $\varpi^m$ for every $m$, compatibly with reduction. To pass to the limit one needs the cohomology with compact supports of the fixed loci, with coefficients modulo $\varpi^m$, to be bounded independently of $m$. The fixed loci which occur are stacks of shtukas of level $D$ with bounded modifications, truncated by the Harder--Narasimhan polygon (step~1 of the proof of Theorem~\ref{fl:thm:arithmetic-family-trace}). Let $D'\ge D$ be a divisor with the same support and large multiplicities. The stacks of level $D'$, with the same bounds, are quasi-projective schemes, and those of level $D$ are their quotients by the finite group $\ker(G(\mathcal O_{D'})\to G(\mathcal O_D))$ \cite[Remarque~4.3]{VLa18}; here we use that $D$ is not empty and that $G$ is semisimple. This group has a filtration with quotients which are vector spaces over $\mathbb F_q$, so it is a $p$-group and its order is invertible in the coefficients. Hence the cohomology of the quotient is the invariant part of the cohomology of the scheme, and the bounds for schemes of finite type apply. Finally, the maps between the complexes are defined after $\ell$ is inverted, and they need not preserve the integral structures. Since the trace and the identities proved below are multilinear in the maps, they can be checked after the maps have been multiplied by a power of the uniformizer. In the application $D$ contains the divisor $D_{\rm ur}$ of Section~\ref{fl:sec:geometrization}, which is not empty. \begin{lemma}[Properties of the trace] \label{fl:lem:closed-relative-trace} \begin{enumerate} \item[(a)] \emph{Sums and products.} The trace is additive for decompositions of $K$ into direct sums: the trace of an endomorphism of $K_1\oplus K_2$ is the sum of the traces of its two diagonal components. If $K=K_1\boxtimes\mathcal M$ with $\mathcal M$ lisse on $B$ and $\epsilon=\epsilon_1\otimes m$ with $m:\mathcal M\to\mathcal M\otimes N'$, then $\operatorname{tr}(\epsilon)=\operatorname{tr}(\epsilon_1)\otimes \Tr(m)$. \item[(b)] \emph{Base change.} The trace and the pairing are compatible with base change along a map $B'\to B$. \item[(c)] \emph{Proper maps of kernels.} Let $\epsilon=(H,A,\eta)$ and $\epsilon'=(H',A',\eta')$ be correspondences from $K$ to $K\otimes N$, let $m:H\to H'$ be a proper map compatible with the maps to $M\times_BM$, and let $\kappa:m^*A'\to A$. Suppose that $\eta'$ is the pushforward of $\eta$, that is, the composite \[ A'\otimes a'^*K\to m_*\bigl(m^*A'\otimes a^*K\bigr) \xrightarrow{\kappa}m_*(A\otimes a^*K) \xrightarrow{\eta}m_*m^!b'^!(K\otimes N)\to b'^!(K\otimes N). \] Then $\Pi(\epsilon')$ is the composite of $\Pi(\epsilon)$ with the map $p'_!i'^*A'\to p_!i^*A$ given by pullback along the map of fixed loci $C\to C'$ and by $\kappa$. \item[(d)] \emph{Cyclic symmetry.} Let $K_0$ and $K_1$ be complexes on schemes $M_0$ and $M_1$ as above, possibly different, let $\epsilon_1$ be a correspondence from $K_0$ to $K_1$ and $\epsilon_2$ one from $K_1$ to $K_0\otimes N$. The fixed loci of $\epsilon_2\circ\epsilon_1$, an endomorphism of $K_0$, and of $(\epsilon_1\otimes N)\circ\epsilon_2$, an endomorphism of $K_1$, are the same, and $\operatorname{tr}(\epsilon_2\circ\epsilon_1) =\operatorname{tr}((\epsilon_1\otimes N)\circ\epsilon_2)$. \item[(e)] \emph{Frobenius.} Let $B=\Spec\overline{\mathbb F}_q$, let $M$ be defined over $\mathbb F_q$ with Frobenius $\operatorname{Fr}$, and let $\phi:\operatorname{Fr}^*K\to K$. The fixed locus of $\Psi_\phi$ is the finite set $M(\mathbb F_q)$, and $\operatorname{tr}(\Psi_\phi)$ is the function $y\mapsto\Tr(\phi_y\mid K_y)$. \item[(f)] \emph{Open subschemes.} Let $M^\circ\subset M$ be an open subscheme, and let $\epsilon^\circ$ be the restriction of a correspondence $\epsilon=(H,A,\eta)$ from $K$ to $K\otimes N$ to the open subset $H^\circ=a^{-1}(M^\circ)\cap b^{-1}(M^\circ)$ of $H$. Its fixed locus is the open subset $C^\circ=\pi^{-1}(M^\circ)$ of $C$, the trace of $\epsilon^\circ$ is the restriction of the trace of $\epsilon$ to $C^\circ$, and $\Pi(\epsilon^\circ)$ is the composite of $\Pi(\epsilon)$ with the map $p^\circ_!i^{\circ*}A\to p_!i^*A$ of extension by zero. \end{enumerate} \end{lemma} \begin{proof} Statements (a), (b), (c) and (e) are formal or are in the literature; (d) requires an argument, because it is stated there without parameters, and (f) is a direct verification. \smallskip\noindent(a), (b)\enspace The symmetric monoidal $2$-category of \cite[Construction~2.6]{LZ22} is additive in the sheaf, which gives the first part of (a); the second holds because $(B,\mathcal M)$ is dualizable and the trace of a tensor product of endomorphisms is the product of the traces. Base change is a symmetric monoidal functor \cite[Proposition~2.26]{LZ22}, and such functors preserve traces; this is (b). \smallskip\noindent(c)\enspace The pair $(m,\kappa)$ is a morphism $\mu:(H',A')\to(H,A)$ of that category, supported on $H$, and the hypothesis says that $m$ is a $2$-morphism from $\epsilon\circ(\mu\otimes\id)$ to $\epsilon'$. Composition with the coevaluation and the evaluation of $(M,K)$ is functorial for $2$-morphisms, so $m$ induces a $2$-morphism between the traces, which is the assertion; this is the mechanism of the relative Lefschetz--Verdier formula \cite[Theorem~2.21]{LZ22}, here in the case where $M$ does not change. \smallskip\noindent(d)\enspace This is the symmetry of the pairing $\langle u,v\rangle\simeq\langle v,u\rangle$ of \cite[Construction~1.6]{LZ22}, in a form with parameters. Let $X$ and $Y$ be dualizable objects of a symmetric monoidal $2$-category, with evaluations $\mathrm{ev}_X,\mathrm{ev}_Y$ and coevaluations $\mathrm{coev}_X,\mathrm{coev}_Y$, and let \[ u:P_1\otimes X\longrightarrow Y,\qquad v:P_2\otimes Y\longrightarrow X\otimes T \] be morphisms, where $P_1$, $P_2$ and $T$ are arbitrary objects. Consider the morphism $\langle u,v\rangle:P_1\otimes P_2\to T$ obtained as follows: apply $\mathrm{coev}_X\otimes\mathrm{coev}_Y$ to create $X\otimes X^\vee\otimes Y\otimes Y^\vee$; apply $u$ to $P_1\otimes X$ and $v$ to $P_2\otimes Y$; and apply $\mathrm{ev}_Y$ to the result of $u$ with $Y^\vee$, and $\mathrm{ev}_X$ to the factor $X$ of the result of $v$ with $X^\vee$. The trace of $v\circ(P_2\otimes u)$, an endomorphism of $X$ with parameters, is by definition obtained from $\mathrm{coev}_X$, the composite, and $\mathrm{ev}_X$. Inserting between $u$ and $v$ the identity of $Y$, written as the composite $(Y\otimes\mathrm{ev}_Y)\circ(\mathrm{coev}_Y\otimes Y)$, we obtain $\langle u,v\rangle$. In the same way the trace of $(u\otimes T)\circ(P_1\otimes v)$, an endomorphism of $Y$ with parameters, becomes $\langle u,v\rangle$ after insertion of the identity of $X$ between $v$ and $u$. So the two traces are isomorphic, by an isomorphism built from the triangle identities of $X$ and $Y$ and the symmetry; the objects $P_1$, $P_2$ and $T$ are only carried along. We apply this to $X=(M_0,K_0)$, $Y=(M_1,K_1)$, $T=(B,N)$ and the kernels of $\epsilon_1$ and $\epsilon_2$ as $P_1$ and $P_2$; the supports of the two composites are identified by exchanging the two factors of the fibre product. \smallskip\noindent(e), (f)\enspace Statement (e) says that the local terms of the Frobenius correspondence are the traces on the fibres \cite[Corollary~0.9]{GV25}. For (f), each map in \eqref{fl:eq:trace-six-functor} is compatible with restriction to open subsets, since for an open immersion the two pullbacks coincide and commute with all the functors involved; and $p^\circ=p\circ e$ for the open immersion $e:C^\circ\to C$, so that the integration map of $p^\circ$ is that of $p$ composed with the counit $e_!e^*\to\mathrm{id}$. Property (f) concerns open immersions and extension by zero, and property (c) concerns proper maps $m$: an open immersion is not an admissible $2$-morphism in (c). \end{proof} \subsection{The trace pairing} For a finite set $I$ and a representation $V$ of $\widehat G^I$ let $\mathcal H_{I,V}$ be the sheaf $\mathcal H^0_{D,I,V}\otimes k$ of Section~\xref{I}{fl:sec:compact-foundations}, on $U^I$ over $\overline{\mathbb F}_q$: it is the direct limit over $\mu$ of $R^0p_!$ of the Satake sheaf $\mathcal F_{I,V}$ on the stacks $\mathrm{Cht}^{\le\mu}_I$ of shtukas with level $D$. The stack $\mathrm{Cht}_I$ is the locus $b=\operatorname{Fr}\circ a$ in $\mathrm{Hecke}_I$, and $\mathcal F_{I,V}$ is the restriction of $\mathcal S_{I,V}$, where the condition $b=\operatorname{Fr}\circ a$ is understood as a $2$-fibre product: an identification of the two bundles, with their level structures, is part of the datum. The partial Frobenius morphisms of \cite[\S3]{VLa18} induce maps $F_J:\Frob_J^*\mathcal H_{I,V}\to\mathcal H_{I,V}$ \cite[\S4.3]{VLa18}. For $I=\varnothing$ the sheaf $\mathcal H_{\varnothing,\mathbf 1}$ is the space $C_c(Y(\mathbb F_q),k)$. Let $\mathcal A_{I,V}$ be the sheaf on $U^I$ over $\overline{\mathbb F}_q$ whose sections are the regular maps $a$ from $Z$ to sections of $V_\rho^*$ satisfying the condition of Definition~\ref{rw:def:coefficient-functions} for the diagonal action of $Z$. By Lemma~\ref{fl:lem:twisted-representation-trace}(1) it is the direct sum, over the irreducible representations $W$, of the lisse sheaves \[ \mathcal Q_W=\underline{\Hom}_Z\bigl(\alpha^*(W\otimes V_\rho),W\bigr). \] It follows from \eqref{rw:eq:theta-alpha} that \[ \Theta_J:\mathcal A_{I,V}\longrightarrow\Frob_J^*\mathcal A_{I,V}, \qquad(\Theta_Ja)(z)=a(z)\circ z_J\theta_J, \] is well defined; it is an isomorphism. Evaluation at a point $z$ is a map from $\mathcal A_{I,V}$ to the dual of $V_{\rho_z}$ which carries $\Theta_J^{-1}$ to the partial Frobenius structure of that dual. A \emph{trace datum over a base} $\beta:B\to U^I$ is a triple $(\mathcal W,N,\lambda)$ of a lisse sheaf $\mathcal W$ on $B$ with an action of $Z$, a lisse sheaf $N$ on $B$ and a map $\lambda:\alpha^*(\mathcal W\otimes\beta^*V_\rho)\to \mathcal W\otimes N$ commuting with $Z$. Its matrix coefficient $a_{\mathcal W,\lambda}$, defined fibrewise, is a section of $\beta^*\mathcal A_{I,V}\otimes N$. \begin{proposition}[The trace pairing] \label{fl:lem:closed-weil-transport} In Setup~\ref{rw:setup:trace}, for every finite set $I$ and every representation $V$ of $\widehat G^I$ there is a map of sheaves on $U^I$ over $\overline{\mathbb F}_q$, \[ \Pi_{I,V}:\mathcal A_{I,V}\otimes\mathcal H_{I,V}\longrightarrow k, \] with the following properties. \begin{enumerate} \item \emph{Functoriality.} For a map $u:V\to V'$ of representations, $\Pi_{I,V'}(a',\mathcal H(u)h)=\Pi_{I,V}(a'\circ u,h)$. For a map of finite sets $\zeta:I\to I'$, the restriction of $\Pi_{I,V}$ to the corresponding diagonal is $\Pi_{I',V^\zeta}$ under the coalescence isomorphism. \item \emph{No legs.} For a trace datum $(W,\lambda)$ for the trivial representation, with trace function $\varphi_{W,\lambda}$ of $(\mathcal F_W,\lambda)$, \[ \Pi_{\varnothing}(a_{W,\lambda},h) =\sum_{[y]\in Y(\mathbb F_q)} \frac{h(y)\varphi_{W,\lambda}(y)} {|\operatorname{Aut}(y)(\mathbb F_q)|}. \] \item \emph{Partial Frobenius.} For $J\subset I$, sections $a$ of $\mathcal A_{I,V}$ and $h$ of $\Frob_J^*\mathcal H_{I,V}$, \begin{equation}\label{fl:eq:trace-Weil-edge-square} \Pi_{I,V}\bigl(a,F_J(h)\bigr) =\Frob_J^*\Pi_{I,V}\bigl(\Theta_J(a),h\bigr). \end{equation} \end{enumerate} \end{proposition} The proof occupies the rest of this subsection. We first define a pairing for every trace datum. \step{1}{construction} Let $(\mathcal W,N,\lambda)$ be a trace datum over $\beta:B\to U^I$. Fix $\mu$ and let $Y_0\subset Y$ be a quasi-compact open substack defined over $\mathbb F_q$ which contains the bundles that occur in $\mathrm{Cht}^{\le\mu}_I$, for instance one of the open substacks of the Harder--Narasimhan filtration. Put $M=Y_0\times B$ and $F=\operatorname{Fr}\times\id_B$. By adjunction the Hecke isomorphism (F1) is a correspondence with kernel $\epsilon_{\mathcal W}$ from $\mathcal F(\mathcal W)$ to $\mathcal F(\mathcal W\otimes\beta^*V_\rho)$, supported on $\mathrm{Hecke}_I\times_{U^I}B$ with kernel $\mathcal S_{I,V}$. Let \[ \phi_\lambda:\ F^*\mathcal F(\mathcal W\otimes\beta^*V_\rho) \xrightarrow{\ c\ } \mathcal F\bigl(\alpha^*(\mathcal W\otimes\beta^*V_\rho)\bigr) \xrightarrow{\ \mathcal F(\lambda)\ } \mathcal F(\mathcal W)\otimes N . \] The fixed locus of $\Psi_{\phi_\lambda}\circ\epsilon_{\mathcal W}$ is $\mathrm{Cht}_I\times_{U^I}B$, and its kernel there is $\mathcal F_{I,V}$. We define \[ \Pi^{\mathcal W,\lambda}= \Pi\bigl(\Psi_{\phi_\lambda}\circ\epsilon_{\mathcal W}\bigr): \ \beta^*\mathcal H_{I,V}\longrightarrow N, \] after restriction to the truncation by $\mu$ and passage to the cohomology sheaf of degree zero. By Lemma~\ref{fl:lem:closed-relative-trace}(f) the result does not depend on $Y_0$ and is compatible with the transition maps in $\mu$, which are extensions by zero. The relative trace is used here for Artin stacks; the construction and the relative formula of Lefschetz and Verdier hold in that generality, with proper morphisms replaced by proper representable ones \cite[Remark~2.24]{LZ22}. The hypotheses are satisfied. On each truncation the stacks which occur in \eqref{fl:eq:trace-six-functor} are of finite type over $B$. The complexes on the stacks of bundles at the source and at the target are exterior products with lisse complexes on $B$, so they are ULA over $B$. The maps of supports along which we push forward are bounded convolution maps and relative Frobenius maps of bounded Hecke projections, which are representable and proper. The trace, its cyclicity and its restriction to open substacks are then formed with the same duality and base change maps as for schemes. This gives the pairing at level $D$ over the whole of $U^I$, the diagonals included. For an irreducible representation $W$, the tautological map $\alpha^*(W\otimes V_\rho)\to W\otimes\mathcal Q_W^\vee$ is a trace datum over $U^I$ and gives $\Pi^W:\mathcal Q_W\otimes\mathcal H_{I,V}\to k$. We define $\Pi_{I,V}$ as the sum of the maps $\Pi^W$. \step{2}{general trace data} We claim that for every trace datum over a base, \begin{equation}\label{rw:eq:pairing-coefficient} \Pi^{\mathcal W,\lambda} =(\beta^*\Pi_{I,V}\otimes N)(a_{\mathcal W,\lambda}\otimes-). \end{equation} Decompose $\mathcal W=\bigoplus_WW\otimes\mathcal M_W$ with $\mathcal M_W=\underline{\Hom}_Z(W,\mathcal W)$, so that $\mathcal F(\mathcal W)=\bigoplus_W\mathcal F_W\boxtimes \mathcal M_W$. The Hecke isomorphisms and $c$ are natural in the coefficient, hence respect this decomposition and act trivially on the sheaves $\mathcal M_W$. By Lemma~\ref{fl:lem:closed-relative-trace}(a) the trace of $\Psi_{\phi_\lambda}\circ\epsilon_{\mathcal W}$ is the sum over $W$ of the traces obtained from the partial trace over $\mathcal M_W$ of the diagonal component of $\lambda$. The same decomposition holds for $a_{\mathcal W,\lambda}$, by Lemma~\ref{fl:lem:twisted-representation-trace}(2). \step{3}{functoriality and the case without legs} The Hecke isomorphisms are natural in $V$ and compatible with restriction to diagonals, and traces are compatible with base change (Lemma~\ref{fl:lem:closed-relative-trace}(b)). This gives (1). For $I=\varnothing$ the correspondence $\epsilon_W$ is the identity and $\Psi_{\phi_\lambda}$ is the Frobenius correspondence of the Weil complex $(\mathcal F_W,\lambda)$. The stack of its fixed points is the finite groupoid of the bundles defined over $\mathbb F_q$ in the chosen truncation, and the local term on the component of a bundle $y$ is the trace on the stalk at $y$ \cite[Theorem~0.8(a) and Corollary~0.9]{GV25}. The integral over this component carries the weight $|\operatorname{Aut}(y)(\mathbb F_q)|^{-1}$: the point is an atlas of $B\operatorname{Aut}(y)(\mathbb F_q)$, finite \'etale of degree $|\operatorname{Aut}(y)(\mathbb F_q)|$, and the trace map of the atlas followed by the integral over the component is the integral over the point. This gives (2). \step{4}{Frobenius covariance as an identity of correspondences} Let $J$ be a finite set, $V_1$ a representation of $\widehat G^J$, $\beta:B\to U^J$ a base and $\mathcal W$ a lisse sheaf on $B$ with an action of $Z$. In the two fibre products which follow, the Hecke stack is the bounded one which supports the kernel for $V_1$. Let $H=\mathrm{Hecke}_J\times_{U^J,\beta}B$ and $H^\circ=\mathrm{Hecke}_J\times_{U^J,\operatorname{Fr}\beta}B$, the Hecke correspondences over $B$ with legs at $\beta$ and at $\operatorname{Fr}\circ\beta$, and let $\epsilon$ and $\epsilon^\circ$ be the correspondences with kernel given by (F1) on them. Consider the two composites \[ \begin{aligned} \epsilon_{\alpha^*\mathcal W}\circ\Psi_c&:\ \mathcal F(\mathcal W)\rightsquigarrow \mathcal F(\alpha^*\mathcal W)\rightsquigarrow \mathcal F(\alpha^*\mathcal W\otimes\beta^*V_{1,\rho}),\\ \Psi_{c,\theta}\circ\epsilon^\circ_{\mathcal W}&:\ \mathcal F(\mathcal W)\rightsquigarrow \mathcal F(\mathcal W\otimes\beta^*\operatorname{Fr}^*V_{1,\rho}) \rightsquigarrow \mathcal F(\alpha^*\mathcal W\otimes\beta^*V_{1,\rho}), \end{aligned} \] where $\Psi_c$ is the Frobenius correspondence of the covariance $c$, and $\Psi_{c,\theta}$ that of $c$ followed by $\mathcal F(1\otimes\theta_J)$. The first is supported on $H$, with source map $F\circ a$ and target map $b$. The second is supported on $T=H^\circ\times_{b,M,F}M$. The relative Frobenius \[ r:H\longrightarrow T,\qquad u\longmapsto\bigl(\operatorname{Fr}(u),b(u)\bigr), \] is compatible with the source and target maps. It is a base change of the relative Frobenius of the map $(b,\ell):\mathrm{Hecke}_J\to Y\times U^J$, which is representable and of finite type on bounded parts; so $r$ is a finite universal homeomorphism. The kernel on $T$ is the pullback of $\mathcal S_{J,V_1}$, and its pullback by $r$ is $\operatorname{Fr}^*\mathcal S_{J,V_1}$, which $\Phi_{\mathcal S}$ identifies with the kernel on $H$. \emph{Claim.} The correspondence $\Psi_{c,\theta}\circ\epsilon^\circ_{\mathcal W}$ is the pushforward of $\epsilon_{\alpha^*\mathcal W}\circ\Psi_c$ along $(r,\Phi_{\mathcal S})$, in the sense of Lemma~\ref{fl:lem:closed-relative-trace}(c). Indeed, by adjunction a correspondence with kernel $A_T$ supported on $T$, with source and target maps $s$ and $t$, is the same as a map $t_!(A_T\otimes s^*K)\to K'$, and its being the pushforward of a correspondence supported on $H$ means that this map is the composite of the corresponding map for $H$ with the isomorphism \[ t_!(A_T\otimes s^*K)\xrightarrow{\ \sim\ } t_!r_*r^*(A_T\otimes s^*K) \xrightarrow{\ \Phi_{\mathcal S}\ } (tr)_!\bigl(A_H\otimes(sr)^*K\bigr), \] in which the first arrow is an isomorphism because $r$ is a universal homeomorphism. For $\Psi_{c,\theta}\circ\epsilon^\circ_{\mathcal W}$ we have, by base change, $t_!(A_T\otimes s^*K)=\operatorname{Fr}^*\mathsf H_{J,V_1} (\mathcal F(\mathcal W))$, pulled back to $M$, and the displayed isomorphism is the identification $\operatorname{Fr}^*\mathsf H_{J,V_1}(K)\simeq \mathsf H_{J,V_1}(\operatorname{Fr}^*K)$ of (F3). The two maps to be compared are therefore the two isomorphisms of (F3), for the coefficient $\mathcal W$ in place of $W$; they are equal by (F3) and additivity. \step{5}{partial Frobenius} By (1) and additivity in $V$ we may assume $V=V_1\boxtimes V_2$, with $V_1$ a representation of $\widehat G^J$ and $V_2$ one of $\widehat G^{J'}$, $J'=I-J$. By \eqref{rw:eq:pairing-coefficient} it suffices to consider $a=a_{W,\lambda}$ for a trace datum $(W,N,\lambda)$ over $B=U^I$ with $W$ a representation. \emph{The open substacks.} The correspondences below relate bundles which differ by bounded modifications, and an open substack of $Y$ of finite type is not stable under such modifications. If the middle bundle of an iterated modification were required to lie in the same open substack as its ends, the convolution maps would in general not be proper, and Lemma~\ref{fl:lem:closed-relative-trace}(c) could not be applied. We therefore use three open substacks. Fix $\mu$. Bounded modifications change the Harder--Narasimhan polygon of a bundle by a bounded amount, so there are quasi-compact open substacks, defined over $\mathbb F_q$, \[ Y_{\rm a}\subset Y_{\rm b}\subset Y_{\rm c}\subset Y \] with the following properties: $Y_{\rm a}$ contains the first bundle of every shtuka in the truncation by $\mu$ of $\mathrm{Cht}^{(J',J)}_I$; a bundle obtained from a bundle of $Y_{\rm a}$ by a modification with legs in $J'$ bounded by $V_2$ lies in $Y_{\rm b}$; and a bundle obtained from a bundle of $Y_{\rm b}$ by a modification with legs in $J$ bounded by $V_1$ lies in $Y_{\rm c}$. Being defined over $\mathbb F_q$, they are stable under $\operatorname{Fr}$ and under its inverse on points. Let $\epsilon_1$ be the Hecke correspondence with legs in $J$ from $\mathcal F_W$ on $Y_{\rm b}\times B$ to $\mathcal F(W\otimes V_{1,\rho})$ on $Y_{\rm c}\times B$, and $\epsilon_2$ the one with legs in $J'$ from $\mathcal F(W\otimes V_{1,\rho})$ on $Y_{\rm c}\times B$ to $\mathcal F(W\otimes V_\rho)$ on $Y_{\rm b}\times B$. They are composed below in two orders, which are shown in Figure~\ref{rw:fig:two-orders}. \begin{figure}[ht] \centering \begin{tikzcd}[column sep=large,row sep=tiny] \mathcal E_0 \arrow[r,"\epsilon_1","J"'] & \mathcal E_1 \arrow[r,"\epsilon_2","J'"'] & \operatorname{Fr}\mathcal E_0 \\ Y_{\rm b} & Y_{\rm c} & Y_{\rm b}\\[3ex] \mathcal E_1 \arrow[r,"\epsilon_2","J'"'] & \operatorname{Fr}\mathcal E_0 \arrow[r,"\epsilon_1","J"'] & \operatorname{Fr}\mathcal E_1 \\ Y_{\rm a} & Y_{\rm b} & Y_{\rm c} \end{tikzcd} \caption{The two orders of the modifications in step~5. Above: a fixed point of $\Psi_{\phi_\lambda}\circ\epsilon_2\circ\epsilon_1$ is a shtuka in which the modification with legs in $J$ comes first; its ends lie in $Y_{\rm b}$, and the middle bundle then lies in $Y_{\rm c}$. Below: after the cyclic move the modification with legs in $J'$ comes first; the first bundle is taken in $Y_{\rm a}$, and then the middle bundle lies in $Y_{\rm b}$ and the last one in $Y_{\rm c}$. Under each bundle is the open substack which contains it.} \label{rw:fig:two-orders} \end{figure} The composite $\epsilon_2\circ\epsilon_1$ is supported on the part of the iterated Hecke stack $\mathrm{Hecke}^{(J,J')}$ whose two ends lie in $Y_{\rm b}$ and whose middle bundle lies in $Y_{\rm c}$. By the choice of $Y_{\rm c}$ the condition on the middle bundle is automatic. So this is the whole iterated Hecke stack over the ends in $Y_{\rm b}$, its map $m$ to $\mathrm{Hecke}_I$ is proper, and by (F1) the correspondence $\epsilon_W$, taken with $Y_0=Y_{\rm b}$ in step~1, is its pushforward along $m$. The map of kernels required in Lemma~\ref{fl:lem:closed-relative-trace}(c) is the counit: the convolution kernel is the proper direct image of the iterated kernel, and the counit maps the pullback of this direct image to the iterated kernel. The fixed locus of $\Psi_{\phi_\lambda}\circ\epsilon_2\circ\epsilon_1$ is the stack $\mathrm{Cht}^{(J,J')}_I$ of shtukas with two modifications, and, by proper base change of this direct image to the fixed locus, the pullback on cohomology is the isomorphism through which $\mathcal H_{I,V}$ does not depend on the partition \cite[D\'efinition~4.1]{VLa18}. By Lemma~\ref{fl:lem:closed-relative-trace}(c) and then (d), \[ \Pi^{W,\lambda} =\Pi\bigl(\Psi_{\phi_\lambda}\circ\epsilon_2\circ\epsilon_1\bigr) =\Pi\bigl((\epsilon_1\otimes N)\circ\Psi_{\phi_\lambda}\circ\epsilon_2\bigr), \] where the last correspondence is an endomorphism of $\mathcal F(W\otimes V_{1,\rho})$ on $Y_{\rm c}\times B$ with values in $N$; here (d) is applied to complexes on the two different spaces $Y_{\rm b}\times B$ and $Y_{\rm c}\times B$. In this last correspondence the middle bundle, which is $\operatorname{Fr}\mathcal E_0$, is constrained to lie in $Y_{\rm b}$, so its support is in general not the whole of the iterated Hecke stack $\mathrm{Hecke}^{(J',J)}$ over ends in $Y_{\rm c}$, and its convolution map need not be proper. We therefore restrict it to $Y_{\rm a}$. By Lemma~\ref{fl:lem:closed-relative-trace}(f) the pairing of the restriction is the pairing itself on the classes supported over $Y_{\rm a}$, extended by zero, and these include the classes of the truncation by $\mu$. Over $Y_{\rm a}$ the constraint is automatic: the middle bundle is obtained from a bundle of $Y_{\rm a}$ by a modification with legs in $J'$, so it lies in $Y_{\rm b}$. Hence the restricted correspondence is supported on the whole iterated Hecke stack over ends in $Y_{\rm a}$, and its convolution map is proper. Conversely, for a shtuka $(\mathcal E_1\to\operatorname{Fr}\mathcal E_0\to \operatorname{Fr}\mathcal E_1)$ with $\mathcal E_1\in Y_{\rm a}$, the bundle $\mathcal E_0$ lies in $Y_{\rm b}$; so no part of a class supported over $Y_{\rm a}$ is lost on the other side. Now $\Psi_{\phi_\lambda}=\mathcal F(\lambda)\circ\Psi_c$. By naturality of the Hecke isomorphisms in the coefficient, $(\epsilon_1\otimes N)\circ\mathcal F(\lambda)=\mathcal F(\lambda\otimes1) \circ\epsilon_1$, where on the right $\epsilon_1$ is taken with the coefficient $\alpha^*(W\otimes V_\rho)$. By the claim of step~4, applied to $\mathcal W=W\otimes V_\rho$, the correspondence $\epsilon_1\circ\Psi_c$ has pushforward $\Psi_{c,\theta}\circ\epsilon_1^\circ$ along $r$. Composition with the other correspondences preserves this relation. Moreover \[ \mathcal F(\lambda\otimes1)\circ\Psi_{c,\theta}=\Psi_{\phi_{\lambda'}}, \qquad \lambda'=(\lambda\otimes1)\circ(1\otimes\theta_J): \alpha^*\bigl(\mathcal W'\otimes\Frob_J^*V_\rho\bigr) \to\mathcal W'\otimes N, \] with $\mathcal W'=W\otimes V_{1,\rho}$. Thus $(\mathcal W',N,\lambda')$ is a trace datum over the base $\Frob_J:U^I\to U^I$, and $\Psi_{\phi_{\lambda'}}\circ\epsilon_1^\circ\circ\epsilon_2$, restricted to $Y_{\rm a}$, is the correspondence defining its pairing, for the partition $(J',J)$ and with $Y_0=Y_{\rm a}$ in step~1; its convolution map is proper, as we have just seen, so Lemma~\ref{fl:lem:closed-relative-trace}(c) applies to it. On fixed loci $r$ induces the map \[ \mathrm{Cht}^{(J,J')}_I\longrightarrow \mathrm{Cht}^{(J',J)}_I\times_{U^I,\Frob_J}U^I, \] which sends a shtuka $(\mathcal E_0\to\mathcal E_1\to\operatorname{Fr}\mathcal E_0)$ to $(\mathcal E_1\to\operatorname{Fr}\mathcal E_0\to \operatorname{Fr}\mathcal E_1)$. This is the partial Frobenius morphism of \cite[\S3]{VLa18}, and the identification of kernels, which is $\Phi_{\mathcal S}$ on the factor with legs in $J$ and the identity on the other, is the isomorphism of \cite[Propositions~3.3, 3.4 and~4.10]{VLa18}. Hence the pullback on cohomology is the map $F_J$ of \cite[\S4.3]{VLa18}; truncations are treated as there, using \cite[Lemme~3.1]{VLa18}. Lemma~\ref{fl:lem:closed-relative-trace}(c), applied to the finite universal homeomorphism $r$, now gives \[ \Pi^{W,\lambda}\circ F_J=\Pi^{\mathcal W',\lambda'} \qquad\text{on }\Frob_J^*\mathcal H_{I,V}, \] first on the classes which come from the truncation by $\mu$ of the target of the partial Frobenius morphism. For the pullback of such a class the first bundle lies in $Y_{\rm b}$: it is the inverse image under Frobenius of the result of a bounded modification at the legs $J'$ of a bundle in $Y_{\rm a}$. So the two maps of the equality compute the same trace on these classes. Every class comes from such a truncation, and both maps are compatible with extension by zero; the equality follows on the direct limit. By \eqref{rw:eq:pairing-coefficient} the right side is $\Frob_J^*\Pi_{I,V}(a_{\mathcal W',\lambda'},-)$, and by Lemma~\ref{fl:lem:twisted-representation-trace}(3), applied fibrewise with $\vartheta=\theta_J$ and using \eqref{rw:eq:theta-alpha}, we have $a_{\mathcal W',\lambda'}=\Theta_J(a_{W,\lambda})$. This proves \eqref{fl:eq:trace-Weil-edge-square} and completes the proof of Proposition~\ref{fl:lem:closed-weil-transport}. \qed \begin{remark}[Relation to a statement of V.~Lafforgue] \label{rw:rem:lafforgue-conditional} In step~5 the closing map $\lambda$ stays in the path when the first modification is moved past Frobenius, and the coefficient changes from $W$ to $W\otimes V_{1,\rho}$. For a single eigensheaf, when $Z$ is trivial, the matrix coefficients form the sheaf $V_\rho^*$, and \eqref{fl:eq:trace-Weil-edge-square} says that the adjoint maps $\mathcal H_{I,V}\to V_\rho$ commute with the partial Frobenius maps. This is the statement left unwritten in the proof of \cite[Proposition~15.1]{VLa18}; compare \cite[\S4.5.5]{AGKRRVTrace} for sheaves with nilpotent singular support in the absence of level structure. The only input specific to the situation is (F3). \end{remark} \subsection{Evaluating an excursion} Let $H_{I,V}$ be the fibre of $\mathcal H_{I,V}$ at the geometric generic point $\bar\eta_I$ of $U^I$. By Lemma~\xref{I}{fl:lem:unperiodized-specialization} the partial Frobenius maps and the fundamental group act on it through $W_F^I$. The fibre of $\mathcal A_{I,V}$ at $\bar\eta_I$ is the space $A(V)$ for the fibre of $V_\rho$. \begin{proposition}[Excursion operators on matrix coefficients] \label{fl:lem:excursion-selector-contraction} For every excursion datum $e$ with tuple in $W_F^I$, every $a\in\mathcal O(Z)^\star$ and every $h\in C_c(Y(\mathbb F_q),k)$, \[ \Pi_\varnothing(a,S_eh)=\Pi_\varnothing\bigl(\nu_{\rho_\bullet}(e)\,a,h\bigr), \] where $\nu_{\rho_\bullet}(e)\,a$ is the function $z\mapsto \nu_{\rho_z}(e)a(z)$. \end{proposition} \begin{proof} The map $\Pi_{I,V}$ is a map of sheaves, so its fibre at $\bar\eta_I$ is invariant under the geometric fundamental group of $U^I$, and by Proposition~\ref{fl:lem:closed-weil-transport}(3) it is invariant under the partial Frobenius maps, acting on $\mathcal A_{I,V}$ by $\Theta_J^{-1}$. The Frobenius--Weil group of \cite[Remarque~8.18]{VLa18} is generated by the geometric fundamental group and lifts of the partial Frobenius morphisms. Evaluation at $z$ carries its action on $A(V)$ to the action on the dual of the fibre of $V_{\rho_z}$, which factors through the product of the Weil groups. The evaluations being jointly injective, the action on $A(V)$ factors through $W_F^I$ and is \[ (\gamma\cdot a)(z)=a(z)\circ\rho_z(\gamma)^{-1}. \] Thus $\Pi_{I,V}(a,\gamma h)=\Pi_{I,V}(\gamma^{-1}\cdot a,h)$ for $\gamma\in W_F^I$, $a\in A(V)$ and $h\in H_{I,V}$. Write $f((g_i))=\langle\xi,(g_i)x\rangle$ with $x\in V$ and $\xi\in V^*$ invariant under the diagonal group. The operator $S_e$ is the composite of the creation operator of $x$, the action of $\gamma=(\gamma_i)$ on $H_{I,V}$ and the annihilation operator of $\xi$. Creation is the map $\mathcal H(x):\mathcal H_{\{0\},\mathbf 1}\to \mathcal H_{\{0\},V^\Delta}$ followed by the coalescence isomorphism and by specialization to $\bar\eta_I$; annihilation is defined in the same way from $\xi$. The sheaf $\mathcal A_{I,V}$ is a sum of lisse sheaves and $\Pi_{I,V}$ is a map of sheaves, so it commutes with specialization. By Proposition~\ref{fl:lem:closed-weil-transport}(1), \[ \Pi_{I,V}(a',\mathcal C^\sharp_xh)=\Pi_\varnothing(a'(\cdot)(x),h), \qquad \Pi_\varnothing(a,\mathcal C^\flat_\xi h') =\Pi_{I,V}(a\,\xi,h'), \] where $a\,\xi\in A(V)$ is the function $z\mapsto a(z)\xi$; it satisfies the condition of Definition~\ref{rw:def:coefficient-functions} because $\xi$ is invariant under $Z$. Combining the three steps, \[ \Pi_\varnothing(a,S_eh) =\Pi_{I,V}\bigl(\gamma^{-1}\cdot(a\,\xi),\mathcal C^\sharp_xh\bigr) =\Pi_\varnothing\bigl(z\mapsto a(z) \langle\xi,\rho_z(\gamma)x\rangle,h\bigr), \] and $\langle\xi,\rho_z(\gamma)x\rangle=\nu_{\rho_z}(e)$. \end{proof} \begin{proof}[Proof of Theorem~\ref{fl:thm:arithmetic-family-trace}] By Proposition~\ref{fl:lem:closed-weil-transport}(2) and \eqref{rw:eq:pairing-coefficient}, $L_\varphi=\Pi_\varnothing(a_{R,\lambda_R},-)$. By Proposition~\ref{fl:lem:excursion-selector-contraction} and \eqref{fl:eq:family-excursion-selector}, \[ L_\varphi(S_eh) =\Pi_\varnothing\bigl(\nu_{\rho_\bullet}(e)\,a_{R,\lambda_R},h\bigr) =\nu_\rho(e)\,\Pi_\varnothing(a_{R,\lambda_R},h) =\nu_\rho(e)L_\varphi(h).\qedhere \] \end{proof} \begin{corollary}[The parameter of a nonzero trace function] \label{fl:cor:arithmetic-family-eigenfunction} If $\rho$ is semisimple and elliptic and $\varphi\ne0$, then $\varphi$ is a cusp form with compact support and a joint eigenfunction of the excursion operators for all Galois tuples. Its parameter is $\vartheta_G\rho$, where $\vartheta_G$ is the Chevalley involution. \end{corollary} \begin{proof} By Theorem~\ref{fl:thm:arithmetic-family-trace} the linear form $L_\varphi$ satisfies \xeqref{I}{fl:eq:functional-excursion} with $\sigma_{\mathrm{coeff}}=\rho$, for all tuples in the Weil group. Proposition~\xref{I}{fl:prop:cuspidal-excursion-character} then gives both assertions; the Chevalley involution comes from the transposition in that proposition. \end{proof}