text:
\section*{Introduction}

Let $R$ be a ring, possibly non-commutative, and free of finite rank over $\mathbbm{Z}$. Let $(A,\iota)$ consist of an abelian scheme $A$ over a base $S$, and an injective ring homomorphism $\iota: R \hra \mathrm{End}_S(A)$ giving an $R$-action on $A$. Take $M$ to be a projective finitely presented right $R$-module. Serre's tensor construction associates to this data a new abelian scheme $M\otimes_R A$ over $S$, which is characterized by its functor of points $\mathrm{Sch}_{/S} \rightarrow \mathrm{Ab},\ T \mapsto M\otimes_R A(T)$ (Definition \ref{serredef}). The map $A \mapsto M\otimes_R A$ is functorial in $A$ and $M$, and preserves many desirable properties of $A$. This suggests the possibility of using it to relate families of abelian schemes. In order to do this, we first need to equip $M\otimes_R A$ with extra structures, in particular a polarization.

To obtain representable moduli spaces of abelian schemes, the objects parametrized are typically abelian schemes $A$ with the choice of a polarization $\lambda$. This is a map $\lambda: A \rightarrow A^\vee$, with $A^\vee$ the dual abelian scheme of $A$, such that for every geometric point $\overline{s} \rightarrow S$, the induced morphism of abelian varieties $\lambda_{\overline{s}}: A_{\overline{s}} \rightarrow A^\vee_{\overline{s}}$ comes from an ample line bundle on $A_{\overline{s}}$ (\cite[\S6]{GIT}, \cite{FaltingsChai}). When parametrizing triples $(A,\iota,\lambda)$, $\lambda$ is often required to be compatible with the $R$-action $\iota$, in the following sense.

Assume $R$ is equipped with a positive involution $r\mapsto r^*$ (Definition \ref{posinv}). Then the pair $(A,\iota)$ has a dual $(A^\vee,\iota^\vee)$, where $A^\vee$ is the dual abelian scheme of $A$, and $\iota^\vee(r) = \iota(r^*)^\vee$, for $r\in R$. A polarization $\lambda: A \rightarrow A^\vee$ is said to be $R$-linear if $\lambda \circ \iota(r) = \iota^\vee(r) \circ \lambda$. The objects of the moduli spaces we consider are triples $(A,\iota,\lambda)$ consisting of an abelian scheme $A$, an $R$-action $\iota$, and an $R$-linear polarization $\lambda$.

To work with well-behaved $R$-modules $M$, we assume $M_\mathbbm{Q}$ is free over $R_\mathbbm{Q}$. In order to apply Serre's construction $A \mapsto M\otimes_R A$ to moduli spaces, we must systematically equip the abelian schemes $M\otimes_R A$ with polarizations.  Our first theorem shows that if $A$ comes in a triple $(A,\iota,\lambda)$, it's enough to equip $M$ with a positive-definite $R$-hermitian structure, which we now define.

The dual module $M^\vee = \mathrm{Hom}_R(M,R)$ has a natural right $R$-module structure, where $r\in R$ acts on $f\in M^\vee$ by $(f\cdot r)(m) = r^* f(m)$. Then $R$-linear maps $h: M \rightarrow M^\vee$ may be identified with sesquilinear forms $H: M\times M \rightarrow R$ via $H(m,m')=h(m)(m')$. Such a map $h$ is called \textit{hermitian} if $H(m,m')=H(m',m)^*$, and \textit{non-degenerate} if it's an isomorphism. Since $M_\mathbbm{Q}\simeq R_\mathbbm{Q}^n$, we may identify $h$ with an element of $H_n(R_\mathbbm{Q})$, the set of $n\times n$ hermitian matrices with entries in $R_\mathbbm{Q}$. Then $H_n(R_\mathbbm{Q})\otimes \mathbbm{R}$ is a formally real Jordan algera (Definition \ref{Jalg}) over $\mathbbm{R}$. We say $h$ is \textit{positive-definite} if its image under $H_n(R_\mathbbm{Q}) \subset H_n(R_\mathbbm{Q})\otimes \mathbbm{R}$ is positive (Definition \ref{posdefn}). This notion does not depend on the choice of isomorphism $M_\mathbbm{Q} \simeq R_\mathbbm{Q}^n$ (Lemma \ref{Pprop2}). \\

\textbf{Theorem A.} \textit{Let $h: M \rightarrow M^\vee$ be $R$-linear. The map $h\otimes \lambda: M\otimes_R A \rightarrow M^\vee \otimes_R A^\vee$ is a polarization on $M\otimes_R A$ if and only if $h$ is a positive definite $R$-valued hermitian form.}\\

The above is Theorem \ref{mainthm} in the main text. That the abelian scheme dual to $M\otimes_R A$ is $M^\vee \otimes_R A^\vee$ is proved in Proposition \ref{duality}.  A special case of the above theorem is due to Serre \cite[appx]{LauterSerre}, where $A$ is a particular elliptic curve in characteristic $p$. We also show that under some extra assumptions on $A$, if $\lambda$ is principal, then $h\otimes \lambda$ is principal if and only if $h$ is non-degenerate (Proposition \ref{mainprop}). For instance, it's enough to assume $\mathrm{End}_S(A)$ is free over $R$.

We then apply the above result to the following moduli problem. Let $K$ be a CM-field of degree $2g$ over $\mathbbm{Q}$, $\Phi$ a CM-type for $K$, and $n$ a positive integer. Let $L\subset \mathbbm{C}$ be the reflex field of $(K,\Phi)$. To every locally noetherian scheme $S$ over $\operatorname{Spec} {\calO_L}$ we associate the category $\mathcal{M}_\Phi^n(S)$ of triples $(A,\iota,\lambda)$ consisting of an abelian scheme $A$ of relative dimension $ng$ over $S$, an injective ${\calO_K}$-action $\iota$, and an ${\calO_K}$-linear principal polarization $\lambda$. We also require that $(A,\iota,\lambda)$ satisfy the \textit{ideal condition} $J_\Phi \mathrm{Lie}_S(A)=0$, where $J_\Phi$ is the kernel of
$$ {\calO_K}\otimes {\calO_L} \rightarrow \prod_{\phi\in \Phi} \mathbbm{C}^{(\phi)},\ \ \ (\alpha \otimes \beta)\mapsto (\phi(\alpha)\cdot \beta)_\phi.$$
Morphisms of $\mathcal{M}_\Phi^n(S)$ are ${\calO_K}$-linear isomorphisms of abelian schemes that preserve the polarizations (see Definition \ref{modspace}).

The ideal condition is a refinement of the \textit{signature condition}, which says for $a\in {\calO_K}$, the characteristic polynomial of the induced action of $\iota(a)$ on $\mathrm{Lie}_S(A)$ should equal
\begin{align} \label{detcon} \prod_{\phi \in \Phi}(T-\phi(a))^n \in {\calO_L}[T],\end{align}
where the right hand side is a global section of $\mathcal{O}_S[T]$ in the image of ${\calO_L}[T] \rightarrow \mathcal{O}_S[T]$ induced by the structure morphism of $S$. The ideal condition implies (\ref{detcon}) (see Corollary \ref{J->char}). If $n=1$ or the base $S$ has characteristic zero, the signature condition also implies the ideal condition. They both impose a strong rigidity that makes $\mathcal{M}_\Phi^n$ generically a zero-dimensional Deligne-Mumford stack. However in characteristic $p>0$, for $p$ ramified in $L$, the signature condition is insufficient to guarantee a well-behaved moduli space. The ideal condition on the other hand ensures that $\mathcal{M}_\Phi^n$ is proper and smooth of relative dimension zero over $\operatorname{Spec} {\calO_L}$  (Theorem \ref{etprop}). See $\S$3.1 for a more thorough discussion of these conditions.

We note that $\mathcal{M}_\Phi^1$ is the moduli stack of abelian schemes with CM by ${\calO_K}$ of type $\Phi$. The stacks $\mathcal{M}_\Phi^n$ are zero-dimensional versions of moduli spaces considered by S. Kudla and M. Rapoport (\cite{KR_11}, \cite{KR_09}), which are integral models of Shimura varieties of unitary type.

Using Theorem A, we can apply Serre's construction to the problem of constructing objects in $\mathcal{M}_\Phi^n$. Let $\mathrm{Herm}_n({\calO_K})$ denote the category of pairs $(M,h)$ consisting of projective finitely presented ${\calO_K}$-modules $M$ of rank $n$, equipped with a positive-definite non-degenerate ${\calO_K}$-hermitian structure $h: M \rightarrow M^\vee$. Then for $(M,h) \in \mathrm{Herm}_n({\calO_K})$ and $(A,\iota,\lambda) \in \mathcal{M}_\Phi^1$, we can construct the object
$$ (M,h) \otimes (A,\iota,\lambda) = (M\otimes_R A, \mathbb{1}_M \otimes \iota, h \otimes \lambda) \in \mathcal{M}_\Phi^n.$$

To describe all objects in $\mathcal{M}_\Phi^n$ that can be constructed in this way we define a tensor product of categories, by explicitly supplying generators and relations (Definition \ref{tensordef}). We apply this construction to define a groupoid $ \mathrm{Herm}_n({\calO_K}) \otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1(S)$ for each $S$. This is carried out in $\S 2$. We suggest that the reader skip details of the otherwise intuitive abstract constructions in $\S2$, and consult the section as needed. Aside from the definitions the main result in $\S 2$ is Proposition \ref{morprop}, which by a combinatorial argument gives a concise description of the morphisms in the tensor product groupoid.

Serre's construction then induces a functor
$$ \Sigma_S: \mathrm{Herm}_n({\calO_K}) \otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1(S) \rightarrow \mathcal{M}_\Phi^n(S).$$

For $\Sigma_S$ to have any significance, $\mathcal{M}^1(S)$ must be non-empty. If
$\mathcal{M}_\Phi^1(\mathbbm{C})\neq \emptyset$, then by replacing $L$ by some finite
extension, we can assume this is always the case. We can show
$\mathcal{M}_\Phi^1(\mathbbm{C})$ is always non-empty, unless $K/F$ is unramified at all
finite primes (Theorem \ref{existence}). If $\mathcal{M}_\Phi^n(\mathbbm{C})$ is non-empty
and $n$ is odd, then $\mathcal{M}_\Phi^1(\mathbbm{C})$ is also non-empty (Proposition
\ref{nodd}). In general, we assume $\mathcal{M}_\Phi^1(\mathbbm{C})$ is non-empty.

We show that the functor $\Sigma_S$ is an equivalence of categories for
$S=\operatorname{Spec}(k)$, where $k$ is an algebraically closed field of characteristic $0$.
This is done by reducing to an explicit construction over $\mathbbm{C}$ (Proposition
\ref{basek}). We also show that for $S$ connected and locally noetherian over a
finite extension of $L$, each object $(A,\iota,\lambda)$ is \'etale locally on
$S$ in the image of some $\Sigma_U$ (Proposition \ref{fintyp}).

The functor $S \mapsto \mathrm{Herm}_n({\calO_K}) \otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1(S)$ defines a separated presheaf on the big \'etale site over $\operatorname{Spec} {\calO_L}$. Letting $\mathrm{Herm}_n({\calO_K}) \otimes \mathcal{M}_\Phi^1$ denote the associated stack, Serre's construction then induces a morphism
$$ \Sigma: \mathrm{Herm}_n({\calO_K}) \otimes \mathcal{M}_\Phi^1 \rightarrow \mathcal{M}_\Phi^n.$$

\textbf{Theorem B.} If $\mathcal{M}_\Phi^1(\mathbbm{C})\neq \emptyset$, \textit{$\Sigma$ is
an isomorphism of stacks.}\\

The above is Theorem \ref{mainiso} in the article. The proof proceeds by first showing the functor $\Sigma_S$ is fully faithful (Proposition \ref{fullfaith}). This is done by finding the general form of a morphism in $\mathcal{M}_\Phi^n$, and comparing that with the concise presentation of morphisms in the tensor product defined in $\S$ 2. Essential surjectivity of $\Sigma$ is proved on the stalks of geometric points, first in characteristic zero by explicit construction, then extended to characteristic $p$ by smoothness of $\mathcal{M}_\Phi^n$ over $\operatorname{Spec} {\calO_L}$.

The fact that $\mathcal{M}_\Phi^n \rightarrow \operatorname{Spec} {\calO_L}$ is \'etale and proper is crucial
(Theorem \ref{etprop}). When either $n=1$ or $K$ is quadratic imaginary, it is
a theorem of B. Howard \cite{unitary1,unitary2}. The ideal condition $J_\Phi
\mathrm{Lie}_S(A)=0$ allows us to generalize Howard's proof to all CM fields $K$. Thus
for the purpose of obtaining a well-behaved moduli space, it is sufficient. On
the other hand, if $(A,\iota,\lambda)$ is a CM abelian scheme of type
$(K,\Phi)$, it automatically satisfies the ideal condition. Furthermore, so
does $M\otimes_{\calO_K} A$ for all $(M,h)\in \mathrm{Herm}_n({\calO_K})$. Thus for a statement
like Theorem $B$ to hold, the codomain of the map $\Sigma$ must be a moduli
space of objects satisfying the ideal condition. In that sense the ideal
condition is also necessary.

For a restatement of the content of Theorem $B$ without the language of higher categories see Theorem \ref{vanilla} in the text.

\subsection*{Acknowledgements}

Much of the content in this article is part of the author's thesis, written at the University of Toronto under the supervision of S. Kudla. I thank Professor Kudla for suggesting the problem and for subsequent encouragements. I thank Brian Conrad and Florian Herzig for looking over an early draft, and offering helpful comments and suggestions.

I also thank Ben Howard, who read the first version carefully, spotting mistakes and suggesting improvements. In particular the ideal condition $J_\Phi \mathrm{Lie}_S(A)=0$ in the definition of $\mathcal{M}_\Phi^n$ was suggested by him. I express gratitude to the anonymous referee for patiently reading the article, uncovering many mistakes, and suggesting significant improvements and simplifications, especially in the proofs of the final sections.
\tableofcontents
\section*{Notation}
We collect here some of the notations and conventions used throughout.

\begin{tabular}{p{2cm} p{12cm}}
$R:$ & A ring, possibly non-commutative, free of finite rank over $\mathbbm{Z}$. In particular, of characteristic zero. \\

$(R,*):$ & $R$ equipped with a positive involution $r \mapsto r^*$ (Definition \ref{posinv})\\

$M:$ & A projective finitely presented right $R$-module \\
$M^\vee$: & The dual $R$-module $\mathrm{Hom}_R(M,R)$. A left $R$-module, where $r\in R$ acts on $f\in M^\vee$ by $(r\cdot f)(m)=rf(m)$, $m\in M$. Given $(R,*)$, also a right $R$-module, with $(f\cdot r)(m)=r^*f(m)$\\

$S:$ & A locally noetherian scheme\\

$A:$ & An abelian scheme over $S$ \\

$(A,\iota):$ & $A$ equipped with an $R$-action, an injective ring map $\iota: R \hra \mathrm{End}_S(A)$\\

$A^\vee:$ & The dual abelian scheme of $A$ \\

$(A^\vee,\iota^\vee):$ & $A^\vee$ with the $R$-action $\iota^\vee(r) = \iota(r^*)^\vee$ \\

$(A,\iota,\lambda):$ & $(A,\iota)$ with a polarization $\lambda: A \rightarrow A^\vee$ that is $R$-linear: $\lambda \circ \iota(r) = \iota^\vee(r)\circ \lambda$ for all $r\in R$. In $\S 3$, $\lambda$ is always principal\\

$\mathrm{Hom}_S(A,B):$ & The group of $S$-homomorphisms of abelian schemes $A\rightarrow B$ \\

$\mathrm{Hom}_R(A,B):$ & The group of $R$-linear $S$-homomorphisms $A \rightarrow B$\\
$(K,\Phi):$ & A CM field $K$ of degree $g$ over $\mathbbm{Q}$, and a CM-type $\Phi$ for $K$ \\
$L:$ & The reflex field of $(K,\Phi)$, as a subfield of $\mathbbm{C}$\\
${\calO_K}:$ & The ring of integers of $K$\\
${\calO_L}:$ & The ring of integers of $L$\\
$\sigma: $ & Complex conjugation on $K$ and $L$. Also the positive involution on ${\calO_K}$\\

$\mathrm{Ab}:$ & The category of abelian groups \\

$R\textendash\mathrm{Mod}:$ &  The category of left $R$-modules \\
$\mathrm{Mod}\textendash R:$ & The category of right $R$-modules\\
$\mathrm{Sch}_{/S}:$ & The category of locally noetherian schemes over $S$
\end{tabular}\\

If $M\in \mathrm{Mod}\textendash R$ is also in $\mathrm{P}\textendash \mathrm{Mod}$ for another ring $P$, and if the actions of $P$ and $R$ commute, $M$ is called a $P\textendash R$-module. An $R\textendash R$-module is called an $R$-bimodule.

For $X,T\in \mathrm{Sch}_{/S}$, $X(T)$ denotes the set of $S$-scheme homomorphisms $T \rightarrow X$. If $f: X \rightarrow Y$ is a map of $S$-schemes, $f_T: X(T) \rightarrow Y(T)$ is the function $\varphi \mapsto f\circ \varphi$.

\section{Serre's Construction}

In this section we recall the Serre tensor construction, then establish some basic properties of the abelian schemes arising from it, such as the possible homomorphisms between them, their Tate modules, Lie algebras, and their dual abelian schemes. We then study the polarizations on such abelian schemes.

Let $R$ be a ring, possibly non-commutative, and free of finite rank over $\mathbbm{Z}$. An \textit{abelian scheme with an $R$-action} is a pair $(A,\iota)$, where $A$ is an abelian scheme over some base $S$, and $\iota: R \hra \mathrm{End}_S(A)$ in an injective ring homomorphism.

\begin{defn}\label{serredef}Let $(A,\iota)$ be an abelian scheme with an $R$-action, and $M$ a projective finitely presented right $R$-module. The \textbf{Serre tensor construction}, denoted $M\otimes_R A$, is the group functor
\[ M\otimes_R A: \mathrm{Sch}_{/S} \longrightarrow \mathrm{Ab},\ \ \ T \mapsto M\otimes_R A(T),\]
from $S$-schemes to abelian groups.
\end{defn}

A fact we take for granted is that $M\otimes_R A$ is representable by an abelian scheme over $S$, also denoted by $M\otimes_R A$. This follows from the projective and finitely presented assumption on $M$. Briefly put, suppose $R^n \rightarrow R^m \rightarrow M \rightarrow 0$ is a presentation of $M$, and let $\mathfrak{M}\in M_{m\times n}(R)$ denote the matrix of the map $R^n \rightarrow R^m$. For any group scheme $G$ over $S$ with an $R$-action, one may define the functor $\mathrm{Sch}_{/S} \rightarrow \mathrm{Ab},\ T \mapsto M\otimes_R G(T)$ as above. It will be representable by the kernel of the group-scheme homomorphism $G^m \rightarrow G^n$ given by the matrix $\mathfrak{M}^T\in M_{n\times m}(R) \subset M_{n\times m}(\mathrm{End}_S(G))$. The functor $G\mapsto M\otimes_R G$ then commutes with base change, and preserves many properties of the group scheme $G$, including those required of an abelian scheme: proper, smooth, and geometrically connected fibres. For more information see \cite[\S7]{Conrad_revisited}.

For two rings $P$ and $R$, by a $P\textendash R$-module we mean an abelian group that
is a right $R$-module and a left $P$-module, such that the actions of $P$ and
$R$ commute.
If $(A,\iota)$ is as above, and $M$ is a $P\textendash R$-module, projective and finitely presented over $R$, and torsion-free over $P$, then the action of $P$ on the $T$-valued points $M\otimes_R A(T)$, for $T\in \mathrm{Sch}_{/S}$, equips $M\otimes_R A$ with a $P$-action. In particular, if $R$ is commutative, $M\otimes_R A$ always has an $R$-action.

Let $(A,\iota)$, $(B,\jmath)$ be abelian schemes with an $R$-action. An \textit{$R$-linear} homomorphism $\phi: A \rightarrow B$ is a homomorphism of abelian schemes satisfying $\phi\circ \iota(r) = \jmath(r) \circ \phi$ for all $r\in R$.  If $f: M \rightarrow N$ is a homomorphism of projective finitely presented right $R$-modules, and $\phi: A \rightarrow B$ an $R$-linear homomorphism of abelian schemes, by $f\otimes \phi: M\otimes_R A \rightarrow N\otimes_R B$ we denote the map given on $T$-valued points by
$$ (f\otimes \phi)_T: M\otimes_R A(T) \rightarrow N\otimes_R B(T),\ \ \ m\otimes a \mapsto f(m)\otimes \phi(a),\ \ \ T\in \mathrm{Sch}_{/S}.$$
When $\phi$ is the identity map $\mathbbm{1}_A: A \rightarrow A$, we also write $f_A$ for $f\otimes \mathbbm{1}_A$.

Note that if $M=R^n$, $M\otimes_R A$ is canonically isomorphic to $A^n$. We will often hide this equivalence and write $A^n = R^n\otimes_R A$.

\subsection{Homomorphisms} Our first task is to study homomorphisms $M\otimes_R
A \rightarrow N\otimes_R B$. The key proposition is as follows.
\begin{prop}\label{homprop}
Let $A$ be an abelian scheme over $S$, with action by a ring $R$, and suppose $M$ is a projective finitely presented right $R$-module. Let $B$ be another abelian scheme over $S$, with action by a ring $P$, and $N$ a projective and finitely presented right $P$-module.
\begin{enumerate}
\item[(a)] There is a canonical isomorphism of abelian groups
	\[ \Psi: N\otimes_P \mathrm{Hom}_S(A,B) \otimes_R M^\vee \cong \mathrm{Hom}_S(M\otimes_R A,N\otimes_P B),\]
	mapping a pure tensor $n\otimes \phi \otimes f$ to the morphism given on $T$-valued points by $$\Psi(n\otimes \phi \otimes f)_T: M\otimes_R A(T) \rightarrow N\otimes_P B(T),\ \ \ m\otimes a \mapsto n\otimes \phi(f(m)a),\ \ \ T\in \mathrm{Sch}_{/S}$$
	\item[(b)] Suppose $P=R$ and $M$, $N$ are $R$-bimodules, so that $M\otimes_R A$, $N\otimes_R B$ acquire $R$-actions. The above isomorphism, restricted to $R$-linear homomorphisms, gives a canonical isomorphism
	\[ \Psi: N\otimes_R \mathrm{Hom}_R(A,B) \otimes_R M^\vee \cong \mathrm{Hom}_R(M\otimes_R A,N\otimes_R B).\]
	\item[(c)] With $M$, $N$, $R$ as in (b), suppose $R$ is moreover commutative. Then there's a canonical isomorphism of $R$-modules
	\[ \mathrm{Hom}_R(M,N) \otimes_R \mathrm{Hom}_R(A,B) \cong \mathrm{Hom}_R(M\otimes_R A,N\otimes_R B),\]
	mapping $h\otimes \phi$ to the morphism given on $T$-valued points by $h\otimes \phi_T$, for $T\in \mathrm{Sch}_{/S}$.
\end{enumerate}
\end{prop}
\begin{proof} For part (a), the statement is obvious if $M$ and $N$ are free. For the general case, pick finitely presented projective right $R-$ and $P-$modules $M'$ and $N'$ respectively, so that $M_0=M\oplus M'$ and $N_0 = N\oplus N'$ are free of finite rank. Then the isomorphism
$$N_0 \otimes_P \mathrm{Hom}_S(A,B) \otimes_R M_0^\vee \cong \mathrm{Hom}_S(M_0\otimes_R A, N_0\otimes_P A)$$
decomposes into a direct sum of four morphisms of abelian groups, all of which must be isomorphisms, one of which coincides with the morphism in the statement. The explicit form of the map may be checked by following through the canonical isomorphisms involved.

The other parts are similar. For $(b)$, first assume $M\simeq R^m$ and $N\simeq R^n$, so that $\mathrm{Hom}(M\otimes_R A, N\otimes_R B)$ may be identified with $M_n(\mathrm{Hom}(A,B))$, the additive group of $m\times n$ matrices with entries in $\mathrm{Hom}(A,B)$. The claim becomes equivalent to the fact that $R$-linear elements of $M_n(\mathrm{Hom}(A,B))$ correspond to matrices with $R$-linear entries. The general case may be deduced by picking complementary projective modules as in part (a).

For $(c)$ note that the left and right $R$-actions on $\mathrm{Hom}_R(A,B)$ agree by definition of $R$-linearity. The claim then follows from $(b)$ and the associativity of tensor products of $R$-bimodules, plus the fact that the canonical morphism $M^\vee \otimes_R N \rightarrow \mathrm{Hom}_R(M,N)$ is an isomorphism since $M$ and $N$ are finitely presented and projective.
\end{proof}

\subsection{Lie algebra and Tate module.}

The following lemma says taking the Tate module or Lie algebra of an abelian scheme commutes with applying Serre's construction.

\begin{lemma}\label{lielem}
Let $A$ be an abelian scheme over a base $S$, equipped with an action $\iota: R \rightarrow \mathrm{End}_S(A)$ by a ring $R$. Suppose $M$ is a projective finitely presented right $R$-module. There is then a canonical isomorphism of group schemes
\[ T_l(M\otimes_R A) \cong M\otimes_R T_l(A),\]
as well as a canonical isomorphism of $\mathcal{O}_S$-modules
\[ \mathrm{Lie}_S(M\otimes_R A) \cong M\otimes_R \mathrm{Lie}_S(A).\]
\end{lemma}

\begin{proof}
For any positive integer $N$, the sequence
$$ 0 \rightarrow M\otimes_R A[N] \rightarrow M\otimes_R A \overset{N}{\rightarrow} M\otimes_R A \rightarrow 0$$
is exact since $M$ is a flat $R$-module. The first claim follows by passing to the limit.

For the second assertion we use the functorial description of $\mathrm{Lie}_S(A)$ given by
\[ \mathrm{Lie}_S(A) (U) = \ker(A(U[\epsilon]) \rightarrow A(U)),\]
for $U\subset S$ \cite[Exp II, 3.9]{SGA3TomeI}. Here $A(U[\epsilon]) \rightarrow A(U)$ is induced by $U \rightarrow U[\epsilon]$, which is constructed as follows. $U[\epsilon] = U\times_{\operatorname{Spec}(\mathbbm{Z})} \mathbbm{Z}[\epsilon]$, where $\mathbbm{Z}[\epsilon]$ is the ring of dual numbers. The map $U \rightarrow U[\epsilon]$ comes from applying the fibre product functor $U\times_{\operatorname{Spec} \mathbbm{Z}} \textendash $ to the morphism $\operatorname{Spec} \mathbbm{Z} \rightarrow \operatorname{Spec} \mathbbm{Z}[\epsilon]$, and the latter corresponds to the ring homomorphism $\mathbbm{Z}[\epsilon] \rightarrow \mathbbm{Z}$ that sends $\epsilon$ to $0$. The claim follows again from the fact that $M\otimes_R -$ preserves kernels by flatness.
\end{proof}

\subsection{The dual abelian scheme}

In this section we study how the Serre construction interacts with the duality theories of abelian schemes and projective $R$-modules. Recall that the dual $M^\vee=\mathrm{Hom}_R(M,R)$ of a right $R$-module $M$, is naturally a left $R$-module, with $r\in R$ acting on $f\in M^\vee$ by $(r \cdot f)(m) = r\cdot f(m)$. Similarly, if $(A,\iota)$ is an abelian scheme with an $R$-action. The map $r \mapsto \iota(r)^\vee$ gives a \textit{right} $R$-action on $A^\vee$. Here in order to avoid a doubling-up of notation, we use the convenient fact that $R$ is often equipped with a positive involution.

\begin{defn}\label{posinv}
A \textit{positive involution ring} $(R,*)$ is a ring $R$, free of finite rank over $\mathbbm{Z}$, equipped with an involution $r\mapsto r^*$ such that $(a,b) \mapsto \operatorname{Tr}_{R_\mathbbm{Q}/\mathbbm{Q}}(ab^*)$ is positive-definite on $R_\mathbbm{Q}$.
\end{defn}

When $R$ is equipped with an involution $*$, every left $R$-module is also a right $R$-module, and vice versa. Specifically, $M^\vee$ is a right $R$-module, with $r\in R$ acting on $f \in M^\vee$ by
\begin{align}\label{dualmodR} (f\cdot r)(m) = r^* f(m), \ \ \ m \in M.\end{align}
Then if $f: M \rightarrow N$ is a homomorphism of right $R$-modules, so is the dual map $f^\vee: N^\vee \rightarrow M^\vee$.

Let $\mu_r: R \rightarrow R$ denote left-multiplication by $r\in R$. Then every right $R$-linear map $f: R \rightarrow R$ is equal to $\mu_{f(1)}$. The bijection $R \rightarrow R^\vee,\ r\mapsto \mu_r$, is however, an isomorphism of \textit{left} $R$-modules. To obtain a right $R$-module isomorphism, we twist it by $*$. Thus we identify $R$ and $R^\vee$ as right $R$-modules via
\begin{align}\label{RRdual} R \xrightarrow{\raisebox{-5pt}{$\sim$}} R^\vee:\ \ r \mapsto \mu_{r^*}, &  &  R^\vee \xrightarrow{\raisebox{-5pt}{$\sim$}} R:\ \ \ f \mapsto f(1)^*.\end{align}

Then $(R^n)^\vee$, which is canonically identified with $(R^\vee)^n$, can also be identified with $R^n$ when $R$ has an involution. Whenever possible, we will tacitly make this identification. In particular, if $M$ and $N$ satisfy $M\oplus N = R^n$, we write $M^\vee \oplus N^\vee = R^n$.

Let $\mathscr{P}=\mathscr{P}_R$ denote the category of projective finitely presented right $R$-modules. Given $M\in \mathscr{P}$, the dual $M^\vee$ considered as a right $R$-module via (\ref{dualmodR}) is again an object in $\mathscr{P}$. The map $M \mapsto M^\vee$ defines a contravariant functor from $\mathscr{P}$ to itself, sending a morphism $f: M \rightarrow N$ to its dual $f^\vee: N^\vee \rightarrow M^\vee$. We will write $(M^\vee)^\vee=M$ by abuse of notation, hiding a canonical isomorphism.

Fixing a base scheme $S$, by $\mathscr{A} = \mathscr{A}(S)$ we denote the category of abelian schemes over $S$, with group scheme homomorphisms as arrows. The contravariant functor $\mathscr{A} \rightarrow \mathscr{A}$ sending $A$ to the dual abelian scheme $A^\vee$ satisfies $(A^\vee)^\vee \cong A$. We will also hide this equivalence in the notation, and write $(A^\vee)^\vee = A$.

Let $\mathscr{A}_R=\mathscr{A}_R(S)$ denote the category of pairs $(A,\iota)$ consisting of an abelian scheme $A$ over the fixed base $S$, and an action $\iota: R \hra \mathrm{End}_S(A)$ by a positive involution ring $(R,*)$. The morphisms in $\mathscr{A}_R$ are required to be $R$-linear group scheme homomorphisms. Given $(A,\iota)\in \mathscr{A}_R$, the dual pair $(A^\vee,\iota^\vee)$ consists of the dual abelian scheme $A^\vee$, and an action $\iota^\vee$ of $R$ on $A^\vee$ defined by $\iota^\vee(r) = \iota(r^*)^\vee$. Then $(A,\iota) \mapsto (A^\vee,\iota^\vee)$ is a contravariant functor from $\mathscr{A}_R$ to itself.

Let $\mathcal{S} : \mathscr{P} \times \mathscr{A}_R \rightarrow \mathscr{A},$ be the functor induced by Serre's construction sending $(M,A)$ to $M\otimes_R A$.

\begin{prop} \label{duality}The following diagram commutes up to canonical isomorphism:
\begin{align*}
\xymatrix{ \mathscr{P} \times \mathscr{A}_R \ar[r]^-{\mathcal{S}} \ar[d]_{\vee \times \vee} & \mathscr{A} \ar[d]^\vee \\
\mathscr{P} \times \mathscr{A}_R \ar[r]_-{\mathcal{S}} & \mathscr{A}. }
\end{align*}
In other words, for $M\in \mathscr{P}$, $(A,\iota)\in \mathscr{A}_R$, and $f\in \mathrm{Mor}(\mathscr{P})$, $\phi\in \mathrm{Mor}(\mathscr{A}_R)$, we have
$$ (M\otimes_R A)^\vee \cong M^\vee \otimes_R A^\vee, \ \ \ (f\otimes \phi)^\vee \cong f^\vee \otimes \phi^\vee.$$
The isomorphism $\Phi=\Phi_{M,A}: M^\vee \otimes_R A^\vee \rightarrow (M\otimes_R A)^\vee$ is characterized as follows. For $T\in \mathscr{A}$, and
$g\otimes t \in M^\vee \otimes_R \mathrm{Hom}_S(T,A^\vee)$, the map $\Phi_T(g \otimes t)\in \mathrm{Hom}_{S}(T, (M \otimes_R A)^\vee)$ is the dual of the homomorphism $M\otimes_R A \rightarrow T^\vee$ given on $U$-valued points by
$$ M\otimes_R A(U) \rightarrow T^\vee(U),\ \ \  m\otimes u \mapsto t^\vee \circ \iota(g(m))\circ u, \ \ \ U\in \mathrm{Sch}_{/S}.$$

\end{prop}
\begin{proof} Let $T$ be an abelian scheme over $S$. We have canonical isomorphisms
\begin{align*} \mathrm{Hom}_S(T, M^\vee \otimes_R A^\vee) & \cong M^\vee \otimes_R \mathrm{Hom}_S(T,A^\vee) \\ & \cong \mathrm{Hom}_S(A,T^\vee)\otimes_R M^\vee  \\ & \cong \mathrm{Hom}_S(M\otimes_R A,T^\vee) \\ & \cong \mathrm{Hom}_S(T,(M\otimes_R A)^\vee),
\end{align*}
where the first and third isomorphisms follow from Proposition \ref{homprop}, and the second is $f \otimes \phi \mapsto \phi^\vee \otimes f$. Letting $T=M^\vee\otimes_R A^\vee$, the canonical morphism $M^\vee\otimes_R A^\vee \rightarrow (M\otimes_R A)^\vee $ corresponds to the identity element in
$$ \mathrm{Hom}_S(M^\vee \otimes_R A^\vee, M^\vee \otimes_R A^\vee) \cong \mathrm{Hom}_S(M^\vee \otimes_R A^\vee, (M\otimes_R A)^\vee),$$
and its inverse $ (M\otimes_R A)^\vee \rightarrow M^\vee \otimes_R A^\vee$ corresponds likewise to the identity in
$$ \mathrm{Hom}_S((M\otimes_R A)^\vee,M^\vee \otimes_R A^\vee) \cong \mathrm{Hom}_S( (M\otimes_R A)^\vee, (M\otimes_R A)^\vee),$$
which comes from setting $T=(M\otimes_ R A)^\vee$.

The explicit form of the statement, as well as the relation $(f\otimes
\phi)^\vee=f^\vee \otimes \phi^\vee$, may be checked by following through these
isomorphisms carefully.
\end{proof}

\subsection{Polarizations}

We wish to show a correspondence between polarizations on $M\otimes_R A$ and positive-definite $R$-hermitian structures on $M$. First we show a correspondence between hermitian structures on $M$ and symmetric morphisms $M\otimes_R A \rightarrow (M\otimes_R A)^\vee$. Then we show the ampleness property, which is required of a symmetric morphism to be a polarization, corresponds to the positivity of the associated hermitian structure, as an element of a formally real Jordan algebra.

We recall some definitions and basic facts about polarizations of abelian schemes. Let $A$ be an abelian scheme over a base $S$. The Poincar\'e correspondence $\mathscr{P}_A$, is a universal line bundle on $A\times_S A^\vee$ that induces, for any abelian scheme $B/S$, a canonical isomorphism of groups
\[ \mathrm{Hom}_S(B,A^\vee) \cong \mathrm{Corr}_S(A,B),\ \ \ (\phi: B \rightarrow A^\vee) \mapsto (\mathbbm{1}_A \times \phi)^* (\mathscr{P}_A).\]
Here $\mathrm{Corr}_S(A,B)$ denotes the group of correspondences on $A\times_S B$ \cite[I.1.7]{FaltingsChai}.

Let $\Delta: A \rightarrow A \times_S A$ be the diagonal. For a morphism $f: A \rightarrow A^\vee$ of abelian schemes, let $\mathcal{L}_f$ denote the correspondence $(1\times f)^* \mathscr{P}_A$ on $A\times_S A$, and $\mathscr{L}_f = \Delta^*(\mathcal{L}_f)$ the associated line bundle on $A$. If $g: B \rightarrow A$ is a homomorphism of abelian schemes, then the pullbacks of $\mathscr{L}_f$ and $\mathcal{L}_f$ under $g$ and $g\times g$ correspond to the map $g^\vee \circ f \circ g: B \rightarrow B^\vee$. In other words:

\begin{equation}\label{pullbackrels} g^*\mathscr{L}_f = \mathscr{L}_{g^\vee \circ f \circ g}\ \ ,\ \ \ (g\times g)^* \mathcal{L}_f = \mathcal{L}_{g^\vee \circ f \circ g}.
\end{equation}

If $\mathcal{L}$ is a correspondence on $A\times_S A$, its associated map $\lambda: A \rightarrow A^\vee$ is \textit{symmetric} if and only if $\mathcal{L}$ is a symmetric correspondence, meaning $s^*(\mathcal{L}) \simeq \mathcal{L}$ with $s: A \times A \rightarrow A \times A$ the coordinate flip map.

A \textit{polarization} on an abelian variety $A_0$ is a symmetric homomorphism $\lambda: A_0 \rightarrow A_0^\vee$, associated to a correspondence $\mathcal{L}_\lambda$ as above, such that the line bundle $\mathscr{L}_\lambda=\Delta^*(\mathcal{L}_\lambda)$ on $A_0$ is ample. A polarization on the abelian scheme $A$ is a symmetric homomorphism $\lambda: A \rightarrow A^\vee$ such that for every geometric point $\overline{s} \rightarrow S$, $\lambda_{\overline{s}}: A_{\overline{s}} \rightarrow {A_{\overline{s}}}^\vee$ is a polarization of abelian varieties. A \textit{principal} polarization is one that is also an isomorphism.

The choice of a polarization on an abelian scheme $A$ induces a \textit{Rosati involution} $\phi\mapsto \rho(\phi)$ on $\mathrm{End}^0(A) = \mathrm{End}(A)\otimes \mathbbm{Q}$, determined by the commutativity of the following diagram in the isogeny category:
 \[ \begin{xymatrix}{ A \ar[r]^\lambda \ar[d]_{\rho(\phi)} & A^\vee \ar[d]^{\phi^\vee} \\
 	A \ar[r]^\lambda & A^\vee. }
 \end{xymatrix}
 \]

Let $(R,*)$ be a ring with involution, and $(A,\iota)$ a pair consisting of an abelian scheme $A$, and an $R$-action $\iota: R \hra \mathrm{End}_S(A)$. Then the dual abelian scheme $A^\vee$ may also be equipped with an $R$-action $\iota^\vee$ via $\iota^\vee(r) = \iota(r^*)^\vee$. A polarization $\lambda: A \rightarrow A^\vee$ is $R$-linear if and only if $\lambda \circ \iota(r) = \iota(r^*)^\vee \circ \lambda$ for all $r\in R$. By the above diagram, this is equivalent to $\iota(r^*) = \rho(\iota(r))$, so that a polarization $\lambda$ is $R$-linear if and only if the action $\iota: R \rightarrow \mathrm{End}_S(A)$ maps the involution $*$ to the Rosati involution $\rho$.

Let $(A,\iota,\lambda)$ be as above, with $\lambda$ an $R$-linear polarization, and denote by $\mathcal{L} = \mathcal{L}_\lambda$ the correspondence associated to it. The behaviour of the pullback of $\mathcal{L}$ under the product $f\times g$ of various maps $f,g\in \mathrm{End}(A)$ is described by the following proposition:

\begin{prop}
	The map $l: \mathrm{End}(A) \times \mathrm{End}(A) \rightarrow \mathrm{Corr}(A,A)$ given by $l(x,y) = (x\times y)^* \mathcal{L}$ satisfies the linearity relations
	\begin{align*}
	& l(x+y,z) = l(x,z) \otimes l(y,z) \\
	& l(x,y+z) = l(x,y) \otimes l(x,z)\\
	& l(x,y\circ \iota(r)) = l(x\circ \iota(r^*), y),
	\end{align*}
	for all $x,y,z \in \mathrm{End}(A)$, and $r\in R$.
\end{prop}

\begin{proof}
A corollary of the theorem of the cube \cite[p.59]{Mum} states that if $f,g,h: X \rightarrow Y$ are maps of abelian varieties, and $\mathscr{L}$ is a line bundle on $B$, then:
\[ (f+g+h)^*\mathscr{L} \cong (f+g)^* \mathscr{L} \otimes (g+h)^* \mathscr{L} \otimes (f+h)^* \mathscr{L} \otimes f^* \mathscr{L}^{-1} \otimes g^* \mathscr{L}^{-1} \otimes h^* \mathscr{L}^{-1}.
\]
The first property follows from the above applied to $f=(x\times 0)$, $g=(y\times 0)$, $h=(0\times z)$, and $\mathscr{L} = \mathcal{L}_\lambda$, with the second being similar. The third property follows from the $R$-linearity of $\lambda$.
\end{proof}

Let $A$ be an abelian scheme with an $R$-action, equipped with an $R$-linear polarization $\lambda$, and suppose $f: M \rightarrow M^\vee$ is any $R$-linear homomorphism. For $f\otimes \lambda: M\otimes_R A \rightarrow M^\vee \otimes_R A^\vee$ to be a polarization, it must be a symmetric morphism. We will show that's equivalent to $f$ being $R$-hermitian. First, recall the definitions.

Let $(R,*)$ be a ring with an involution, and $M$ a projective finitely presented right $R$-module. A $\mathbbm{Z}$-bilinear form $F: M\times M \rightarrow R$ is called \textit{sesquilinear} if $F(mr,nr')=r^*F(m,n)r'$ for all $m,n\in M$, and $r,r'\in R$. By the tensor-hom adjunction formula, sesquilinear forms $F$ are in bijection with linear maps $f \in \mathrm{Hom}_R(M,M^\vee)$ via $f(m)(n) = F(m,n)$. A sesquilinear form $F$ is called \textit{hermitian} if $F(m,n)^*=F(n,m)$ for all $m,n\in M$.

Let $p: R^n \twoheadrightarrow M$ be a fixed presentation of $M$.  If $\{\sigma_i : R \hra R^n\}_{i=1}^n$ are the $n$ coordinate embeddings into $R^n$, the elements $\{e_i = p\circ \sigma_i(1)\}_{i=1}^n$ generate $M$. A sesquilinear form $F$ on $M$ is then hermitian if and only if the $n\times n$ matrix having $ij$th entry $F(e_i,e_j)$ is hermitian. That is, if and only if $F(e_i,e_j)=F(e_j,e_i)^*$ for $1 \leq i,j\leq n$.

We clarify some notations and canonical identifications for the next proposition. Recall that $R^\vee$ is identified with $R$, as in (\ref{RRdual}), hence $(R^\vee)^n$ with $R^n$. The dual of the coordinate embeddings $\sigma_i: R \hra R^n$ are identified with projections $\pi_i: R^n \twoheadrightarrow R$. If $A$ is an abelian scheme with an $R$-action, the maps $\sigma_i \otimes \mathbbm{1}_A: R\otimes_ R A \rightarrow R^n\otimes_R A$ are identified with coordinates embeddings $s_i: A \rightarrow A^n$. By Proposition \ref{duality}, the dual of $s_i$ is the $i$th projection $(\pi_i)_{A^\vee}: (A^\vee)^n \rightarrow A^\vee$. Similarly, the $R$-dual of $p: R^n \twoheadrightarrow M$ is an injective map $p^\vee: M^\vee \hra R^n$, and $p \otimes \mathbbm{1}_A$ is identified with $p_A: A^n \twoheadrightarrow M\otimes_R A$ with dual $p_A^\vee=(p^\vee)_{A^\vee}: M^\vee \otimes_R A^\vee \hra (A^\vee)^n$.

Let $\psi = p_A^\vee \circ (f\otimes \lambda) \circ p_A \in  \mathrm{End}_S(A^n, (A^\vee)^n)$. Then $\psi$ is represented by an $n\times n$ matrix with cofficients in $\mathrm{Hom}_S(A,A^\vee)$. Specifically, $\psi$ is determined by its $ij$th entries $\psi_{ij}:A \rightarrow A^\vee$, given by
\[\psi_{ij} = s_j^\vee \circ \psi \circ s_i ,\ \ \ 1 \leq i,j \leq n.\]

\begin{prop}\label{symprop}
	With $f\otimes \lambda$ and $\psi$ as above, the following are equivalent:
	\begin{enumerate}
		\item $f \otimes \lambda$ is symmetric.
		\item $\psi$ is symmetric.
		\item $\psi_{ij} = (\psi_{ji})^\vee$ for $1 \leq i,j \leq n$.
		\item $f$ is hermitian.
	\end{enumerate}
\end{prop}

\begin{proof}
We have $\psi^\vee = (p_A)^\vee \circ (f\otimes \lambda)^\vee \circ p_A$, so $(1)$ implies $(2)$. As $M$ is projective, $p$ has a section $s: M \rightarrow R^n$ so that $p \circ s = \mathbbm{1}_M$. Then $p_A \circ s_A = (p\circ s)_A = \mathbbm{1}_{M\otimes_R A}$ and dually $s_A^\vee \circ p_A ^\vee = \mathbbm{1}_{M^\vee \otimes_R A^\vee}$. If $\psi$ is symmetric, so is $s_A^\vee \circ \psi \circ s_A = f\otimes \lambda$, so $(2)$ also implies $(1)$.

We have
\[ (\psi_{ij})^\vee = (s_j^\vee \circ \psi \circ s_i)^\vee = s_i^\vee \circ \psi^\vee \circ s_j = (\psi^\vee)_{ji}\]
so that $(2)$ implies $(3)$. Conversely if $\psi_{ij} = (\psi_{ji})^\vee = (\psi^\vee)_{ij}$ for all $1\leq i,j \leq n$, then $\psi$ and $\psi^\vee$ as matrices in $M_n(\mathrm{Hom}_S(A,A^\vee))$ have the same entries and so must be equal. Thus $(3)$ implies $(2)$.

Now we have
$$ \psi_{ij} = s_j^\vee \circ \psi \circ s_i  = s_j^\vee \circ p_A^\vee \circ (f\otimes \lambda) \circ p_A \circ s_i = (p_A \circ s_j)^\vee \circ (f\otimes \lambda) \circ (p_A \circ s_i).$$

Proposition \ref{duality} identifies the dual of $p_A \circ s_j: A \rightarrow M\otimes_R A$ with the map $M^\vee \otimes_R A^\vee \rightarrow A^\vee$ induced by $(p\circ \sigma_j)^\vee: M^\vee \rightarrow R$. In other words, allowing canonical identifications we have
$$ s_j^\vee \circ p_A^\vee  = (\sigma_j \otimes \mathbb{1}_A)^\vee \circ (p\otimes \mathbbm{1}_A)^\vee = (\sigma_j^\vee \otimes \mathbbm{1}_{A^\vee})\circ (p^\vee \otimes \mathbbm{1}_{A^\vee}) = (\sigma_j^\vee \circ p^\vee) \otimes \mathbbm{1}_{A^\vee} = (p \circ \sigma_j)^\vee \otimes \mathbbm{1}_A^\vee.$$
Then
\begin{align}\label{psiij} \psi_{ij} = ((p \circ \sigma_j)^\vee \otimes \mathbbm{1}_{A^\vee}) \circ (f\otimes \lambda) \circ ((p \circ \sigma_i)\otimes \mathbbm{1}_A) = ((p \circ \sigma_j)^\vee \circ f \circ (p \circ \sigma_i)) \otimes \lambda.\end{align}

Writing $f_{ij} = (p\circ \sigma_j)^\vee \circ f \circ (p \circ \sigma_i)$, the right hand side above is a map $f_{ij} \otimes \lambda: R\otimes_R A \rightarrow R^\vee \otimes_R A^\vee$. It is identified with $\psi_{ij}: A \rightarrow A^\vee$ via isomorphisms $R\otimes_R A \cong A$ and $R^\vee \otimes_R A^\vee \cong A^\vee$ as follows. The isomorphism $A \rightarrow R\otimes_R A$ is given on $T$-valued points by sending $t\in A(T)$ to $1\otimes t\in R\otimes_R A(T)$, with inverse $r\otimes t \mapsto \iota(r)\circ t$. The isomorphism $R^\vee \otimes_R A^\vee \rightarrow A^\vee$ sends a $T$-valued point $\alpha \otimes t\in R^\vee\otimes_R A^\vee(T)$ to $\iota^\vee(\alpha(1)^*)\circ t$, via the identification $R^\vee \cong R,\ \alpha \mapsto \alpha(1)^*$, as in (\ref{RRdual}). Then according to (\ref{psiij}), $\psi_{ij}$ is given on $T$-valued points by
\begin{align} \label{psiij2} (\psi_{ij})_T: A(T) \rightarrow A^\vee(T),\ \ \  t \mapsto \iota^\vee((f_{ij}(1)(1))^*)\circ \lambda_T(t).\end{align}
Now recalling the notation $e_i = p \circ \sigma_i(1)\in M$, we have $f_{ij}(1) = (p \circ \sigma_j)^\vee \circ f \circ (p\circ \sigma_i)(1) = (p \circ \sigma_j)^\vee (f(e_i)): R \rightarrow R$.
Identifying $f: M \rightarrow M^\vee$ with a sesquilinear form $F: M\times M \rightarrow R$, $f(e_i)\in M^\vee$ is the map $x\mapsto F(e_i,x)$. Then $(p\circ \sigma_j)^\vee (f(e_i))\in R^\vee$ is the map $r \mapsto F(e_i, (p \circ \sigma_j)(r))$, which under $R^\vee \cong R$ is identified with $F(e_i,e_j)^*$. Thus writing $F_{ij}$ for $F(e_i,e_j)$, (\ref{psiij2}) gives
$\psi_{ij} = \iota^\vee (F_{ij}^*) \circ \lambda = \lambda \circ \iota(F_{ij}^*).$ Similarly, we have
$$(\psi_{ji})^\vee = (\lambda \circ \iota(F_{ji}^*))^\vee = \iota(F_{ji}^*)^\vee \circ \lambda = \iota^\vee (F_{ji})\circ \lambda = \lambda \circ \iota(F_{ji}).$$
Then $\psi_{ij} = (\psi_{ji})^\vee$ if and only if $\lambda \circ \iota(F_{ij}^* - F_{ji}) = 0$. As $\lambda$ is an isogeny and $\iota$ is injective, this happens if and only if $F_{ij}^* = F_{ji}$. This shows the equivalence of (3) and (4).
\end{proof}

Now we recall Jordan algebras and the notion of positivity in a formally real Jordan algebra over $\mathbbm{R}$. We relate positivity in certain matrix Jordan algebras with the usual notion of a positive-definite matrix. Then we define positive-definite $R$-hermitian structures $h: M \rightarrow M^\vee$, which correspond to polarizations on $M\otimes_R A$. The reference for this material is \cite{Braun1966} and \cite{McCrimmon2004}.

\begin{defn} \label{Jalg} Let $k$ be a field, with $\text{char}(k)\neq 2$, and let $R$ be an algebra over $k$, not necessarily associative, with multiplication denoted by $\circ$. Then $(R,\circ)$ is called a \textbf{Jordan algebra} if it is commutative, and
\[ (u\circ u)\circ (u\circ v) = u \circ ((u\circ u)\circ v),\ \ \ \forall u,v\in R.\]
A Jordan algebra $R$ is called \textbf{formally real} if for all $u,v \in R$,  $$u\circ u + v \circ v = 0  \iff u=v=0.$$
\end{defn}

Any associative $k$-algebra $R$ can be turned into a Jordan algebra $(R,\circ)$ by setting
\[ x \circ y = \frac{1}{2} (xy + yx).\]

We restrict to the case where $k$ is subfield of $\mathbbm{R}$, so that it makes sense to speak of positive elements of $k$. Let $R$ be a finite associative $k$-algebra equipped with a positive involution $r \mapsto r^*$, so that $(x,y) \mapsto \operatorname{Tr}_{R/k}(y^*x)$ is positive definite. The elements of $R$ fixed by the involution are called \textit{symmetric}. The positivity of the involution implies that the subalgebra of symmetric elements $S\subset R$ is formally real. For any $n>0$, the matrix algebra $M_n(R)$ inherits a positive involution $X\mapsto X^*$ from $R$, given by $(X_{ij})\mapsto (X_{ji}^*)$. Its symmetric elements are the formally real Jordan algebra $H_n(R)$ of $n\times n$ hermitian matrices.

\begin{defn} \label {Jpos} An element $u$ of a formally real Jordan algebra over the real numbers $\mathbbm{R}$ is called \textbf{positive}, and denoted $u>0$, if all the eigenvalues of the $\mathbbm{R}$-linear map $L_u: v \mapsto u\circ v$ are positive.
\end{defn}

If $R$ is any one of: the real numbers $\mathbbm{R}$, complex numbers $\mathbbm{C}$, or the standard quaternions $\mathbbm{H}$, it can be considered as a Jordan algebra over $\mathbbm{R}$, with a positive involution given by the identity map on $\mathbbm{R}$, complex conjugation on $\mathbbm{C}$, and the standard involution on $\mathbbm{H}$. In all three cases, the matrices in $H_n(R)$ are unitarily diagonalizable. For a matrix $X\in H_n(R)$, the eigenvalues of the operator $L_X: R \rightarrow R,\ L_X(Y) = X\circ Y = \frac{1}{2} (XY+YX)$ are of the form $\frac{1}{2}(d_i + d_j)$ where $d_i$ are the ordinary eigenvalues of $X$ as a matrix. It follows that $X > 0$ in $H_n(R)$, if and only if $X$ is a positive definite matrix in the usual sense.

Now suppose $R=K$ is a CM field, with maximal totally real subfield $F$. Then $K$ is an algebra over $F$, with complex conjugation defining a positive involution. The formally real Jordan algebra $H_n(K)\otimes \mathbbm{R}$ over $\mathbbm{R}$ is isomorphic to a product of algebras $H_n(\mathbbm{R})$ and $H_n(\mathbbm{C})$, one for each embedding of $K$ in $\mathbbm{C}$. A matrix $X\in H_n(K)$ is positive in $H_n(K)\otimes \mathbbm{R}$ if and only if it is positive in each factor of the product. It follows that $X >0$ if and only if the eigenvalues of $X$ are totally positive algebraic numbers.

To show the connection between Jordan algebras and polarizations, we recall a result characterizing ample line bundles on abelian varieties from Mumford's book \cite{Mum}. Let $A$ be an abelian variety over an algebraically closed field, equipped with a polarization $\lambda$. Then $\lambda$ induces a Rosati involution on $\mathrm{End}(A)_\mathbbm{Q}$. We denote by $\mathrm{End}(A)^{\mathrm{sym}}$ and $\mathrm{End}(A)_\mathbbm{Q}^{\mathrm{sym}}$ the elements fixed by the Rosati involution, in $\mathrm{End}(A)$ and $\mathrm{End}(A)_\mathbbm{Q}$ respectively.

The following theorem is from \cite[p.208]{Mum}, where the term \textit{totally positive} is used for what we call positive.

\begin{thm}[\textbf{Ampleness Criterion}]
For $r\in \mathrm{End}(A)^{\mathrm{sym}}$, the line bundle $\mathscr{L}_{\lambda \circ r} \in \mathrm{Pic}(A)$ is ample if and only if $r$ is \textit{positive} in the formally real Jordan algebra $\mathrm{End}(A) \otimes \mathbbm{R}$.
\label{amplcrit}
\end{thm}

We will often use the following corollary.

\begin{cor}\label{ampcor}
Let $S$ be a connected scheme, $A$ an abelian scheme over $S$, $\lambda: A \rightarrow A^\vee$ a polarization, and $r\in \mathrm{End}_S(A)$. Then $\lambda \circ r$ is a polarization if and only if $r$ is positive in the formally real Jordan algebra $\mathrm{End}_S(A)\otimes \mathbbm{R}$.
\end{cor}
\begin{proof}
Using the rigidity lemma of \cite[Ch. 6]{GIT}, one easily reduces to the case where $S$ is the spectrum of an algebraically closed field. For $\lambda \circ r$ to be a polarization, it must be a symmetric morphism, so that
$$\lambda \circ r = (\lambda \circ r)^\vee = r^\vee \circ \lambda = \lambda \circ r^*$$ where $r^*$ is the Rosati involution of $\lambda$ applied to $r$, and the identity is that of elements in $\mathrm{End}(A)_\mathbbm{Q}$. As $\lambda$ is invertible in $\mathrm{End}(A)_\mathbbm{Q}$, we get $r=r^*$, i.e. $r\in \mathrm{End}(A)_\mathbbm{Q}^\mathrm{sym}$. Then by Mumford's ampleness criterion, the line bundle $\mathscr{L}_{\lambda \circ r}$ corresponding to $\lambda \circ r$ is ample if and only if $r$ is positive in $\mathrm{End}(A) \otimes \mathbbm{R}$.
\end{proof}

To establish the claimed correspondence between hermitian structures on $M$ and polarizations on $M\otimes_R A$, we require one condition on the ring $R$, and another on the module $M$. The condition on $M$ allows us to define the notion of a positive-definite $R$-hermitian structure on $M$, and the condition on $R$ ensures that this definition is sound. The condition on $R$ always holds for rings that admit  a triple $(A,\iota,\lambda)$, and the condition on $M$ holds often, such as for the applications we have in mind. The key property which we require of positive involution rings $(R,*)$ is as follows.

\begin{defn}\label{Pdef}
A positive involution ring $(R,*)$ is said to satisfy \textbf{property (P)}, if for every matrix $Q$ in $GL_n(R_\mathbbm{Q})$ the hermitian matrix $Q^*Q \in H_n(R_\mathbbm{Q})$ is positive in the formally real Jordan algebra $H_n(R)\otimes \mathbbm{R}$.
\end{defn}

The following lemma shows that property (P) holds in all cases of interest.

\begin{lemma}\label{Pprop}
Let $(R,*)$ be a positive involution ring. If there exists a triple $(A,\iota,\lambda)$, then $R$ satisfies property (P).
\end{lemma}
\begin{proof}
Since for any point $s$ of the base scheme $S$ the map $\mathrm{End}_S(A) \rightarrow \mathrm{End}_{k(s)}(A_s)$ is injective, we can assume $A$ is an abelian variety. Let $Q\in GL_n(R_\mathbbm{Q})$. After multiplying by a positive integer we can assume $Q$ has entries in $R$, and so defines an $R$-linear isogeny $\phi: A^n \rightarrow A^n$. Since the $R$-linear map $\lambda^n: A^n \rightarrow (A^\vee)^n$ is a polarization on $A^n$, the line bundle $\mathscr{L}_{\lambda^n}$ is ample, therefore the line bundle $\mathscr{L}_{\phi^\vee \circ \lambda^n \circ \phi}=\phi^* \mathscr{L}_{\lambda^n}$ is also ample, as $\phi$ is an isogeny. Since $\lambda$ is $R$-linear, $\phi^\vee \circ \lambda^n \circ \phi = \lambda^n \circ \psi$, where $\psi: A^n \rightarrow A^n$ is given by the hermitian matrix $Q^*Q$ with coefficients in $R$. By the ampleness criterion, the symmetric element $\psi$ is positive in the formally real Jordan algebra $H_n(R_\mathbbm{Q})\otimes \mathbbm{R} \subset \mathrm{End}(A^n)\otimes \mathbbm{R}$, where it is identified with $Q^*Q$.
\end{proof}

A projective finitely presented module $M$ over a Dedekind domain is automatically a lattice in $M_\mathbbm{Q}$. For general rings $R$, we make the following definition.

\begin{defn}\label{lattice}A \textbf{lattice} $M$ over $R$ is a projective finitely presented right $R$-module $M$ such that $M_\mathbbm{Q}$ is free over $R_\mathbbm{Q}$.
\end{defn}

The key positivity notion is as follows.

\begin{defn}\label{posdefn} Suppose $(R,*)$ satisfies property (P). A hermitian lattice $(M,h)$ is \textbf{positive definite} if for some isomorphism $\eta: R^n_\mathbbm{Q} \rightarrow M_\mathbbm{Q}$, the standard matrix $T\in H_n(R_\mathbbm{Q})$ of the map $\eta^\vee \circ h_\mathbbm{Q} \circ \eta$ is positive in the formally real Jordan algebra $H_n(R)\otimes \mathbbm{R}$.
\end{defn}

The following lemma shows that the above definition does not depend on the choice of $\eta$.

\begin{lemma}\label{Pprop2}
	Let $(R,*)$ be a positive involution ring with property (P). Let $Q\in GL_n(R_\mathbbm{Q})$ and $T\in H_n(R_\mathbbm{Q})$. Then $T>0$ in $H_n(R_\mathbbm{Q})\otimes \mathbbm{R}$ if and only if $QTQ^*>0$.
\end{lemma}

\begin{proof}
	Let $J_1$ denote the Jordan algebra $H_n(R_\mathbbm{Q})$, and $J_{QQ^*}$ the algebra with the same underlying abelian group as $J_1$ and product defined by
		\[ X\circ_{QQ^*} Y = \frac{1}{2} \left(X(QQ^*)^{-1}Y + Y(QQ^*)^{-1}X\right).\]
    Then $J_{QQ^*}$ is a formally real Jordan algebra with unit element $QQ^*$, and the map $T\mapsto QTQ^*$ is an isotopy of Jordan algebras $J_1\rightarrow J_{QQ^*}$ \cite[p.14]{McCrimmon2004}. It can be extended $\mathbbm{R}$-linearly to an isotopy $J_1\otimes \mathbbm{R} \rightarrow J_{QQ^*}\otimes \mathbbm{R}$ of formally real Jordan algebras over $\mathbbm{R}$.

	The set of positive elements of a formally real Jordan algebra $J$ over $\mathbbm{R}$ is an open convex cone, identified with the connected component of the identity in the units $J^\times$ of $J$ \cite[p.18]{McCrimmon2004}. An isotopy of Jordan algebras preserves the positive cone.

	The positive cone of $J_{QQ^*}\otimes \mathbbm{R}$, which is the same topological space as $J_1 \otimes \mathbbm{R}$, is the connected component of its identity element $QQ^*$. Since $(R,*)$ satisfies property (P), $QQ^*$ is positive in $J_1\otimes \mathbbm{R}$, therefore it lies in the same connected component as the identity element of $J_1\otimes \mathbbm{R}$. Thus the isotopy $T \mapsto QTQ^*$ maps the positive cone of $J_1\otimes \mathbbm{R}$ to itself, and so $T>0$ if and only if $QTQ^*>0$.
\end{proof}

The main result of this section (Theorem A from the introduction), is as follows.

\begin{thm} \label{mainthm}
	Let $(R,*)$ be a positive involution ring, $(A,\iota)$ an abelian scheme with an $R$-action, and $M$ a lattice over $R$. Suppose $\lambda: A \rightarrow A^\vee$ is an $R$-linear polarization and $h: M \rightarrow M^\vee$ is an $R$-linear map. Then $h\otimes \lambda: M \otimes_R A \rightarrow M^\vee \otimes_R A^\vee$ is a polarization if and only if $(M,h)$ is hermitian and positive definite.
\end{thm}

\begin{proof}
By Proposition \ref{symprop}, $h \otimes \lambda$ is symmetric if and only if $h$ is hermitian, so we can assume this is the case. Such a symmetric map is by definition a polarization if and only if it is a polarization of abelian varieties on geometric fibres. Since Serre's construction commutes with fibre products, $h\otimes \lambda$ is a polarization if and only if $(h\otimes \lambda)_s \cong  h\otimes \lambda_s$ is a polarization for all geometric points $s \rightarrow S$. Thus we can assume $A$ is an abelian variety over an algebraically closed field.

We fix an isomorphism $\eta: R^n_\mathbbm{Q} \rightarrow M_\mathbbm{Q}$, through which we identify $M\subset M_\mathbbm{Q}$ with its pre-image in $R^n_\mathbbm{Q}$. Let $T\in H_n(R_\mathbbm{Q})$ be the matrix of $\eta^\vee \circ h_\mathbbm{Q}\circ \eta$ as in Definition \ref{posdefn}. Since the inclusion $M\subset R^n_\mathbbm{Q}$ becomes an isomorphism after tensoring with $\mathbbm{Q}$, there is a positive integer $k$ such that $kR^n \subset M$. Let $\kappa: R^n \rightarrow M$ denote multiplication by $k$. Using the identification $A^n=R^n \otimes_R A$, we obtain an isogeny $\kappa_A = \kappa \otimes \mathbbm{1}_A: A^n \rightarrow M\otimes_R A$. Now let $f = \kappa^\vee \circ h \circ \kappa$ and consider the map $f\otimes \lambda: A^n \rightarrow (A^\vee)^n$. Since $h\otimes \lambda$ is symmetric, so is $f\otimes \lambda = \kappa_A^\vee \circ (h\otimes \lambda) \circ \kappa_A$. The matrix of $f$ is a positive integer multiple of $T$, so $(R^n,f)$ is positive-definite if and only if $(M,h)$ is. Since $\kappa_A$ is an isogeny, the line bundle $\kappa_A^*(\mathscr{L}_{h \otimes \lambda}) = \mathscr{L}_{f\otimes \lambda}$ is ample if and only if $\mathscr{L}_{h\otimes \lambda}$ is ample. It follows that it's enough to prove the theorem for $(R^n,f)$ in place of $(M,h)$.

Now $f\otimes \lambda: A^n \rightarrow (A^\vee)^n$ factors as $\lambda^n \circ f_A$, where $\lambda^n: A^n \rightarrow (A^\vee)^n$ is the product polarization of $A^n$ obtained from $\lambda$. By Corollary \ref{ampcor}, $\lambda^n \circ f_A$ is a polarization if and only if $f_A \in \mathrm{End}(A^n)$ is positive in the formally real Jordan algebra $\mathrm{End}(A^n)\otimes \mathbbm{R}$. It remains to show this is the case if and only if $f$ is positive definite.

Let us use $*$ again to denote the Rosati involution on $\mathrm{End}(A)\otimes \mathbbm{Q}$ induced by $\lambda$. The algebra isomorphism $M_n(\mathrm{End}(A)\otimes \mathbbm{Q}))\cong \mathrm{End}(A^n)\otimes \mathbbm{Q}$ identifies the Rosati involution induced by $\lambda^n$ on $\mathrm{End}(A^n)\otimes\mathbbm{Q}$ with the positive involution $(X_{ij}) \rightarrow (X^*_{ji})$ on $M_n(\mathrm{End}(A)\otimes \mathbbm{Q})$. Thus the symmetric elements in $\mathrm{End}(A^n)\otimes \mathbbm{Q}$ are identified with hermitian matrices $H_n(\mathrm{End}(A)\otimes \mathbbm{Q})$. The map $f \mapsto f_A$ is a morphism of formally real Jordan algebras $H_n(R_\mathbbm{Q}) \rightarrow H_n(\mathrm{End}(A)\otimes \mathbbm{Q})$. It is the same as the map induced by the $R$-action $\iota: R \hra \mathrm{End}(A)$, so it is in particular injective. Now considering $H_n(R_\mathbbm{Q})$ as a subalgebra of $\mathrm{End}(A^n)\otimes\mathbbm{Q}$, it follows that $f_A > 0$ in $ \mathrm{End}(A^n)\otimes \mathbbm{R}$ if and only if $f>0$ in $H_n(R)\otimes \mathbbm{R}$. In other words, $f \otimes \lambda$ is a polarization if and only if $f$ is positive-definite, and so the same holds for $h$.
\end{proof}

Under some extra assumptions, we can extend this theorem further to characterize principal polarizations. Recall that a hermitian form $h: M \rightarrow M^\vee$ is called non-degenerate if it's an isomorphism.

\begin{prop}\label{mainprop}
Under the conditions of Theorem \ref{mainthm}, suppose that furthermore $\lambda: A \rightarrow A^\vee$ is principal, and that either:
\begin{itemize}
\item[(i)] The (left) $R$-module of endomorphisms $\mathrm{End}_S(A)$ is faithfully flat,

\textit{or}
\item[(ii)] $R$ is commutative, and the $R$-module of $R$-linear endomorphisms $\mathrm{End}_R(A)$ is faithfully flat.
\end{itemize}

Then $h\otimes \lambda$ is a principal polarization if and only if $h$ is a non-degenerate positive definite hermitian form.
\end{prop}

\begin{proof}
It's clear that if $h$ is non-degenerate and $\lambda$ is principal, $h\otimes \lambda$ is an isomorphism. Conversely, suppose $h\otimes \lambda$ is an isomorphism. Since $h\otimes \lambda$ factors as a composition of the isomorphism $\mathbbm{1}_M \otimes \lambda: M\otimes_R A \rightarrow M\otimes_R A^\vee$ with the map $h\otimes \mathbbm{1}_A : M\otimes_R A \rightarrow M^\vee\otimes_R A$, the latter is also an isomorphism. Now consider this isomorphism on the $A$-valued points of $M\otimes_R A$:
\[ (h\otimes \mathbbm{1}_A)_A : M\otimes_R \mathrm{End}_S(A) \xrightarrow{\raisebox{-5pt}{$\sim$}} M^\vee \otimes_R \mathrm{End}_S(A),\ \ \ m\otimes \phi \mapsto h(m)\otimes \phi. \]
Evidently, this is the tensor product of the map of right $R$-modules $h: M \rightarrow M^\vee$ with the left $R$-module $\mathrm{End}_S(A)$. If the latter is faithfully flat, $h$ is an isomorphism.

Now suppose $R$ is commutative. Then $M$ is a bimodule, $M\otimes_R A$ and $M^\vee \otimes_R A^\vee$ inherit $R$-actions, and the isomorphisms $h\otimes \lambda$, $h \otimes \mathbbm{1}_A$ and $\mathbbm{1}_M \otimes \lambda$ are all $R$-linear. Consider the commutative diagram

\[ \begin{xymatrix}{ M\otimes_R \mathrm{End}_S(A) \ar[rr]^{(h \otimes \mathbbm{1}_A)_A} && M^\vee \otimes_R \mathrm{End}_S(A) \\
M\otimes_R \mathrm{End}_R(A) \ar@{^{(}->}[u] \ar[rr] && M^\vee \otimes_R \mathrm{End}_R(A) \ar@{^{(}->}[u]}.
\end{xymatrix} \]

Knowing the top arrow is an isomorphism, we claim the bottom one is also one. Injectivity is clear from the diagram, so we must show surjectivity.

Let $\Psi: M^\vee \otimes_R A \rightarrow M\otimes_R A$ be the inverse of $h\otimes \mathbbm{1}_A$. Since $h\otimes \mathbbm{1}_A$ is $R$-linear, so is $\Psi$. By Proposition \ref{homprop}(c) it corresponds to an element of $\mathrm{Hom}_R(M^\vee,M) \otimes_R \mathrm{End}_R(A)$, which is of the form $\sum_i \alpha_i \otimes s_i$, for $R$-linear $\alpha_i : M^\vee \rightarrow M$ and $s_i \in \mathrm{End}_R(A)$. Then on $T$-valued points of $M^\vee \otimes_R A$, $\Psi$ is given by:
\[ \Psi_T : M^\vee \otimes_R A(T) \rightarrow M \otimes_R A(T),\ \ \ f \otimes t \mapsto \sum_{i} \alpha_i(f) \otimes (s_i \circ t).\]
Letting $T=A$, we consider the map $\Psi_A$ restricted to $M^\vee \otimes_R \mathrm{End}_R(A) \subset M^\vee \otimes_R \mathrm{End}(A)$. If $t \in \mathrm{End}_R(A)$, we also have $s_i \circ t \in \mathrm{End}_R(A)$, and so $\Psi(f \otimes t)=\sum_i \alpha_i(f) \otimes (s_i \circ t) \in M\otimes_R \mathrm{End}_R(A)$. This shows the inverse of $(h\otimes \mathbbm{1}_A)_A$, when restricted to $M^\vee \otimes_R \mathrm{End}_R(A)$, takes values in $M\otimes_R \mathrm{End}_R(A)$. In other words $(h\otimes \mathbbm{1}_A)_A$ restricted to $M\otimes_R \mathrm{End}_R(A)$ is surjective onto $M^\vee \otimes_R \mathrm{End}_R(A)$. This proves the map
\[ (h\otimes \mathbbm{1}_A)_A: M\otimes_R \mathrm{End}_R(A) \longrightarrow M^\vee \otimes_R \mathrm{End}_R(A),\ \ \ m\otimes s \mapsto h(m) \otimes s\]
is an isomorphism. Now, the above map is just the tensor product of $h$ with the identity map of the $R$-module $\mathrm{End}_R(A)$. Thus if the latter is faithfully flat, $h$ is an isomorphism.
\end{proof}

We note that in particular the proposition applies when $A$ is an abelian scheme with CM by the ring of integers $R={\calO_K}$ of a CM field $K$, since then $\mathrm{End}_{R}(A)=R$.

\section{Tensor Product of Categories}

In this section we define the action of a monoidal category on another category, and the tensor product of two categories with such actions. Then we assume the monoidal category is a 2-group, which is to say its objects are invertible with respect to the monoidal product, and we show the morphisms of the tensor product in this case have a concise form. With the application to moduli spaces in mind, we assume one of the tensor factors is a groupoid and the other is fibred in groupoids over some base category. Then we show under certain conditions the resulting tensor product is also fibred in groupoids over the same base.

\subsection{Definitions}

A monoidal category is a category equipped with a product on objects resembling the tensor product of modules. We recall the definition from \cite[p. 162]{catmac}.

\begin{defn}  A \textbf{monoidal category} is a category $\mathcal{C}$ equipped with the following data: a bifunctor $\Box: \mathcal{C} \times \mathcal{C} \rightarrow \mathcal{C}$, an identity object $e \in \mathcal{C}$, and for all $a$, $b$, $c\in \mathcal{C}$ a canonical \textit{associator} isomorphism
\[ \alpha_{a,b,c}: (a\square b)\square c \xrightarrow{\raisebox{-5pt}{$\sim$}} a\square (b\square c),\]
along with left and right \textit{unitor} isomorphisms
\[ \lambda_a: e\square a \xrightarrow{\raisebox{-5pt}{$\sim$}} a,\ \ \ \rho_a: a\square e \xrightarrow{\raisebox{-5pt}{$\sim$}} a.\]
The isomorphisms are required to satisfy the following \textit{pentagon} and \textit{triangle} relations:
\[
\begin{array}{ll}
\begin{xymatrix}{ & ((a\Box b)\Box c)\Box d \ar[dl]_{\alpha_{a,b,c}\Box d} \ar[dr]^{\alpha_{a \Box b,c,d}} & \\
(a \Box (b \Box c))\Box d \ar[d]_{\alpha_{a,b\Box c,d}} &  & (a \Box b)\Box (c \Box d) \ar[d]^{\alpha_{a,b,c\Box d}}\\
a \Box ((b \Box c)\Box d) \ar[rr]^{a \Box \alpha_{b,c,d}} & & a \Box (b \Box (c \Box d)) }\end{xymatrix} &
\begin{xymatrix} {\\(a\Box e)\Box b \ar[rr]^{\alpha_{a,e,b}} \ar[dr]_{\rho_a \Box b} & & a\Box (e\Box b). \ar[dl]^{a\Box \lambda_b} \\ & a \Box b & } \end{xymatrix}
\end{array}
\]
\end{defn}

We will omit the symbol $\Box$ and write $ab$ instead of $a\Box b$ for short.

\begin{defn} A \textbf{left action} of a monoidal category $\mathcal{C}$ on a category $\mathcal{X}$ is the data consisting of: a bifunctor $\mathcal{C} \times \mathcal{X} \rightarrow \mathcal{X}: (a,X) \mapsto aX$, and for all $a$, $b \in C$, $X \in \mathcal{X}$, canonical associator and left unitor isomorphisms
\[ \alpha_{a,b,X}: (ab)X \xrightarrow{\raisebox{-5pt}{$\sim$}} a(bX),\ \ \ \ \lambda_X: eX \xrightarrow{\raisebox{-5pt}{$\sim$}} X\]
satisfying the pentagon and triangle relations
$$ \alpha_{a,b,cX} \circ \alpha_{ab,c,X} = a\alpha_{b,c,X} \circ \alpha_{a,bc,X} \circ \alpha_{a,b,c}X,\ \ \  a\lambda_X \circ \alpha_{a,e,X} = \rho_a X.$$

A \textbf{right action} of a monoidal category $\mathcal{C}$ on a category $\mathcal{Y}$ is defined similarly, as a bifunctor $\mathcal{Y} \times \mathcal{C} \rightarrow \mathcal{Y}: (Y,a) \mapsto Ya$, with canonical associator isomorphisms $\alpha_{Y,a,b}: (Ya)b \xrightarrow{\raisebox{-5pt}{$\sim$}} Y(ab)$, and right unitors $\rho_Y: Ye \xrightarrow{\raisebox{-5pt}{$\sim$}} Y$, satisfying the analogous pentagon and triangle relations.
\end{defn}
By the coherence theorem of Mac Lane \cite[p.165] {catmac}, the pentagon and triangle relations are enough to ensure that all other expected associativity relations hold up to canonical isomorphisms.

We want to a define a tensor product of categories over a monoidal category. Such tensor products are usually defined for additive categories \cite{SaavCat,DelCat}. For example, for $k$-linear categories where $k$ is a field, they have explicit constructions via generators and relations \cite{Tambara2001}. We require a similar notion, but for categories with no enriched structure. For this purpose we imitate the explicit construction in \cite{Tambara2001}, but leave out the additive features.

\begin{defn}\label{tensordef} Let $\mathcal{C}$ be a monoidal category, and let $\mathcal{X}$ (resp. $\mathcal{Y}$) be a category with a right (resp. left) action of $\mathcal{C}$. The tensor product $\boldsymbol{\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}}$ is the following category. The objects consist of symbols $X\otimes Y$, for $X\in \operatorname{Ob}(\mathcal{X})$ and $Y\in \operatorname{Ob}(\mathcal{Y})$. The morphisms are generated by two families:
\begin{itemize}
\item[I.] Symbols of the form $$\phi \otimes \psi: X\otimes Y \rightarrow X'\otimes Y',$$
for all $(\phi: X \rightarrow X') \in \mathrm{Mor}(\mathcal{X})$, $(\psi: Y \rightarrow Y') \in \mathrm{Mor}(\mathcal{Y})$.
\item[II.] Associators symbols
\[ \alpha_{X,a,Y}: Xa\otimes Y \rightarrow X\otimes aY,\]
and their inverses
\[\alpha'_{X,a,Y}: X\otimes aY \rightarrow Xa\otimes Y,\]
for all $X\in \mathcal{X}$, $Y\in \mathcal{Y}$, $a\in \mathcal{C}$.
\end{itemize}
The relations imposed on the generators are:
\begin{enumerate}
\item[I.] Functoriality of $\otimes$:
\[ \mathbbm{1}_X \otimes \mathbbm{1}_Y = \mathbbm{1}_{X\otimes Y},\ \ \ (\phi \otimes \psi) \circ (\phi' \otimes \psi') = (\phi \circ \phi') \otimes (\psi \circ \psi'),\ \ {\phi \in \mathrm{Mor}(\mathcal{X}),\ \psi \in \mathrm{Mor}(\mathcal{Y})}.\]
\item[II.] Naturality of associators: commutativity of the diagram
\[
\begin{array}{ll}
\begin{xymatrix}{ Xa\otimes Y \ar[r]^{\alpha_{X,a,Y}} \ar[d]_{\phi u \otimes \psi} & X\otimes aY \ar[d]^{\phi\otimes u \psi}\\
X'a'\otimes Y' \ar[r]_{\alpha_{X',a',Y'}} & X'\otimes a'Y'.}\end{xymatrix}
\end{array}
\]
for all $(\phi: X \rightarrow X')\in \mathrm{Mor}(\mathcal{X}), (\psi: Y \rightarrow Y')\in \mathrm{Mor}(\mathcal{Y})$, $(u: a \rightarrow a')\in \mathrm{Mor}(\mathcal{C})$.
\item[III.] Isomorphic property of associators:
\[ \alpha_{X,a,Y} \circ \alpha'_{X,a,Y} = \mathbbm{1}_{X\otimes aY},\ \ \ \alpha'_{X,a,Y} \circ \alpha_{X,a,Y} = \mathbbm{1}_{Xa\otimes Y},\ \ \ \mathrm{for\ all\ }X\in \mathcal{X},\ Y\in \mathcal{Y},\ a\in \mathcal{C}.\]
\item[IV.] The pentagon and triangle relations:
\[ \alpha_{X,a,bY} \circ \alpha_{Xa,b,Y} = (\mathbbm{1}_X \otimes \alpha_{a,b,Y}) \circ \alpha_{X,ab,Y} \circ (\alpha_{X,a,b} \otimes \mathbbm{1}_Y),\ \ \ (\mathbbm{1}_X \otimes \lambda_Y) \circ \alpha_{X,e,Y} = \rho_X\otimes \mathbbm{1}_Y.\]
\end{enumerate}
\end{defn}

Again by Mac Lane's coherence theorem \cite[p. 165]{catmac} the pentagon and triangle relations above, together with their counterparts in the definitions of the monoidal category $C$, and the actions of $C$ on $\mathcal{X}$ and $\mathcal{Y}$, imply that all expected associativity relations hold up to canonical isomorphism. Thus for instance, up to canonical isomorphism, the object $Xa_1a_2..a_r \otimes b_1b_2...b_s Y \in \mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$ with $a_i$, $b_j \in \mathcal{C}$ is well-defined.

\subsection{Tensor product over a 2-group}

The morphisms of the tensor product described above are words in the generator symbols, satisfying relations. A more concise representation is possible when the objects in the monoidal category are invertible with respect to the monoidal product. This is the case for our application in $\S 3$.

\begin{defn}\label{2gpdef}
A \textbf{2-group} is a monoidal category $\mathcal{C}$ such that for each $a\in \mathcal{C}$ there exists another object $a^{-1}\in \mathcal{C}$, and an isomorphism
\[ I_a: a\Box a^{-1} \xrightarrow{\raisebox{-5pt}{$\sim$}} e,\]
where $e\in \mathcal{C}$ is the identity object.
\end{defn}
Note that the object $a^{-1}$ is not necessarily unique, and neither is $I_a: a \Box a^{-1} \rightarrow e$, even for a particular choice of $a^{-1}$. In the following, we will assume that the choices satisfy $(a^{-1})^{-1}=a$.

The 2-group we will later apply the results of this section to is $\mathrm{Herm}_1({\calO_K})$, the category of non-degenerate positive-definite rank-one hermitian modules over the ring of integers ${\calO_K}$ of a CM field $K$. The isomorphism classes of $\mathrm{Herm}_1({\calO_K})$ form the group of classes of hermitian forms, classically denoted $\mathfrak{C}(K)$ \cite[$\S$14.5]{ShimuraCM}.

Let $\mathcal{X}$ and $\mathcal{Y}$ be categories with a right and left action by a 2-group $\mathcal{C}$, respectively. To prevent the congestion of symbols later on, we define the following auxiliary isomorphisms. For $X \in \mathcal{X}$, $Y\in \mathcal{Y}$, $a\in \mathcal{C}$, we have
\begin{align} \mu_{X,a}: (Xa)a^{-1} \xrightarrow{\raisebox{-5pt}{$\sim$}} X,\ \ \ \ \mu_{a,Y}: a^{-1}(aY) \xrightarrow{\raisebox{-5pt}{$\sim$}} Y, \end{align}
given by $\mu_{X,a} = \rho_X \circ (\mathbbm{1}_X I_a)\circ \alpha_{X,a,a^{-1}}$, and $\mu_{a,Y} = \lambda_Y \circ (I_{a^{-1}} \mathbbm{1}_Y) \circ \alpha_{Y,a^{-1},a}^{-1}$. Note that these depends on a choice of $a^{-1}$, $I_a$ and $I_{a^{-1}}$.

For each $X\otimes Y \in \mathcal{X} \otimes \mathcal{Y}$, we also have an isomorphism
\begin{align}\label{omegmap} \omega_{a,X,Y}: Xa \otimes a^{-1}Y \xrightarrow{\raisebox{-5pt}{$\sim$}} X\otimes Y
\end{align}
given by
\begin{equation} \label{formomeg} \omega_{a,X,Y} = (\mathbbm{1}_{X}\otimes \mu_{a^{-1},Y})\circ \alpha_{X,a,a^{-1}Y}.
\end{equation}
In other words, $\omega_{a,X,Y}$ is the diagonal morphism in the diagram
\begin{align}\label{omegsquare} \begin{xymatrix}{
Xa\otimes a^{-1}Y \ar[d]_{\alpha_{Xa,a^{-1},Y}'} \ar[rr]^-{\alpha_{X,a,a^{-1}Y}} \ar[drr]^{\omega_{a,X,Y}} & & X \otimes a(a^{-1}Y) \ar[d]^{\mathbbm{1}_X \otimes \mu_{a^{-1},Y}}\\
(Xa)a^{-1} \otimes Y \ar[rr]_-{\mu_{X,a}\otimes \mathbbm{1}_Y} & & X\otimes Y,
}\end{xymatrix}\end{align}
which commutes as a consequence of relations II and IV in Definition \ref{tensordef}.

For each $\phi \otimes \psi: X \otimes Y \rightarrow X'\otimes Y'$ and $a\in\mathcal{C}$, we also have a diagram
\begin{align}\label{omegfunc}\begin{xymatrix}{X a \otimes a^{-1}Y \ar[rr]^{\phi a \otimes a^{-1} \psi} \ar[d]_{\omega_{a,X,Y}}& & X'a \otimes a^{-1}Y' \ar[d]^{\omega_{X',a,Y'}}
\\ X \otimes Y \ar[rr]_{\phi\otimes \psi}& & X'\otimes Y',
}\end{xymatrix}
\end{align}
commuting as a consequence of relation II in Definition \ref{tensordef}, along with functorial properties of the action of $\mathcal{C}$.

We will show that every morphism $X'\otimes Y' \rightarrow X\otimes Y$ in $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$ can be written in the form $\omega_{a,X,Y}\circ (\phi\otimes \psi)$ for some $a\in \mathcal{C}$, $\phi\in \mathrm{Mor}(\mathcal{Y})$, $\psi\in \mathrm{Mor}(\mathcal{X})$. The following lemma is the essential reduction step in the proof.

\begin{lemma}\label{redlem} Suppose $\tau = \alpha_2 \circ (\phi\otimes \psi)\circ \alpha_1$ is a morphism of $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$, where $\phi \in \mathrm{Mor}(\mathcal{X})$, $\psi\in \mathrm{Mor}(\mathcal{Y})$ and $\alpha_1$, $\alpha_2$ are associator morphisms in $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$. Then we can also write
\[ \tau =(\phi_1 \otimes \psi_1) \circ \alpha \circ (\phi_2 \otimes \psi_2),\]
where $\alpha$ is another associator, and $\phi_1$, $\phi_2 \in \mathrm{Mor}(\mathcal{X})$, $\psi_1$, $\psi_2 \in \mathrm{Mor}(\mathcal{Y})$.
\end{lemma}

\begin{proof}
The associators $\alpha_1$ and $\alpha_2$ can each either have the form $\alpha_{X,a,Y}$ or its inverse $\alpha_{X,a,Y}'$. Of the four possibilities, we look at the case where $\alpha_1$ and $\alpha_2$ have the form
\[\alpha_1 = \alpha_{X,a,Y}: Xa\otimes Y \rightarrow X\otimes aY, \ \ \ \alpha_2 =\alpha_{X',b,Y'}: X'b \otimes Y' \rightarrow X'\otimes bY',\]
so that we have $\phi\otimes \psi: X\otimes aY \rightarrow X'b\otimes Y'$. The other three cases are similar.

The claim then follows from the commutativity of the diagram
\[\begin{xymatrix}{ Xa\otimes Y \ar[rr]^{\alpha_{X,a,Y}} \ar[d]_{\mathbbm{1}_{Xa}\otimes \mu_{a,Y}^{-1}} && X\otimes aY \ar[rr]^{\phi\otimes \psi} && X'b \otimes Y' \ar[rr]^{\alpha_{X',b,Y'}}&& X'\otimes bY'\\
Xa\otimes a^{-1}aY \ar[rr]^{\phi a \otimes a^{-1}\psi} && (X'b)a \otimes {a}^{-1}Y' \ar[rr]^{\alpha_{X',b,a} \otimes \mathbbm{1}_{a^{-1}Y'}} && X'(ba)\otimes a^{-1}Y' \ar[rr]^{\alpha_{X',ba,a^{-1}Y'}} && X'\otimes (ba)(a^{-1}Y') \ar[u]^{\mathbbm{1}_{X'} \otimes F}.
}\end{xymatrix}
\]
Here the morphism $F$ is the composition
\[ \begin{xymatrix}{ (ba)(a^{-1}Y') \ar[rr]^{\alpha'_{ba,a^{-1},Y'}} & & ((ba)a^{-1})Y' \ar[rr]^{(\alpha_{b,a,a^{-1}}) \mathbbm{1}_{Y'}} && (b(aa^{-1}))Y' \ar[rr]^-{(bI_a)\mathbbm{1}_{Y'}} && (be)Y'\ar[rr]^{\rho_b \mathbbm{1}_{Y'} }  && bY'}. \end{xymatrix}\]
Checking that this diagram does indeed commute is straight-forward using the axioms of $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$. In particular, one uses the triangle and pentagon relations and the naturality of associators.
\end{proof}

Here is the main result on presentations of morphisms in $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$.

\begin{prop}\label{morprop}
Let $\mathcal{X}$ (resp. $\mathcal{Y}$) be categories with a right (resp. left) action of a 2-group $\mathcal{C}$. Then every morphism $\tau: X\otimes Y \rightarrow X'\otimes Y'$ in $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$ has a presentation as a composition
\begin{align} \begin{xymatrix}{
X\otimes Y \ar[rr]^-{\phi\otimes \psi} & &  X'a \otimes a^{-1}Y'\ar[rr]^-{\omega_{a,X',Y'}} & & X'\otimes Y',}
\end{xymatrix}
\end{align}
for some object $a\in \mathcal{C}$, and morphisms $\phi$, $\psi$ in $\mathcal{X}$, $\mathcal{Y}$, respectively. Alternatively, $\tau$ can also be written as $(\phi' \otimes \psi') \circ \omega_{a',X,Y}^{-1},$ for some other $\phi'$, $\psi'$, $a'$.
\end{prop}

\begin{proof}
By definition, a morphism $\tau$ of $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$ is a string of symbols, each one of two types: associator morphisms $\alpha$, and tensor morphisms $\phi \otimes \psi$. Since a composition of two tensor morphisms is another tensor morphism, a word representing a general morphism can be reduced until the associators occurring in it are each separated by one tensor morphism (possibly the identity). Then as long as there remain at least two associators in the presentation of $\tau$, Lemma \ref{redlem} applies, and each time the number of associators can be reduced by one. The process necessarily ends with a presentation of the form $(\phi_1 \otimes \psi_1) \circ \alpha \circ (\phi_2 \otimes \psi_2$).

Then to finish the proof it suffices to show the claim for a morphism of the form $(\phi \otimes \psi) \circ \alpha$. Assuming $\alpha = \alpha_{X,a,Y}$ and $\phi\otimes\psi: X\otimes aY \rightarrow X' \otimes Y'$, this follows from the commutativity of the diagram
\[\begin{xymatrix}{ Xa \otimes Y \ar[rd]_{\mathbbm{1}_{Xa}\otimes \mu_{a,Y}^{-1}} \ar[r]^{\alpha_{X,a,Y}} & X\otimes aY \ar[rr]^{\phi \otimes \psi} & & X'\otimes Y'  \\
& Xa \otimes a^{-1}(aY) \ar[rr]^{\phi a \otimes a^{-1} \psi} \ar[u]_{\omega_{X,a^{-1},aY}}& & X'a \otimes a^{-1}Y'\ar[u]^{\omega_{X',a,a^{-1}Y}} \ar[rr]_{\alpha_{X',a,a^{-1}Y'}} & & X'\otimes a(a^{-1}Y') \ar[ull]_{\mathbbm{1}_{X'} \otimes \mu_{a^{-1},Y'}}}.
\end{xymatrix}
\]
The commutativity of the two triangles on the left and right follow from instances of (\ref{omegsquare}). The middle square is itself an instance of (\ref{omegfunc}).

In case $\alpha$ is of the form $\alpha'_{X,a,Y}$, a similar diagram gives a nearly identical presentation for $(\phi\otimes \psi) \circ \alpha$, wherein $a$ is replaced by $a^{-1}$. The alternative presentation of $\tau$ in the form $(\phi' \otimes \psi')\circ \omega_{a',X,Y}^{-1}$ results from yet other similar diagrams, with directions reversed.
\end{proof}

Now we consider the case where $\mathcal{X}$ in $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$ is a groupoid, and $\mathcal{Y}$ is fibred in groupoids over a base. We show that $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$ is also fibred in groupoids, under some general conditions which we now define.

\begin{defn}\label{fibrewise} Let $p: \mathcal{Y} \rightarrow \mathcal{S}$ be a functor, and $\mathcal{C}$ a monoidal category acting on $\mathcal{Y}$ on the left. Then $\mathcal{C}$ is said to act \textbf{fibrewise} on $\mathcal{Y}$, if $p$ is a coequalizer in the diagram
\[ \begin{xymatrix}{ \mathcal{C}\times \mathcal{Y} \ar@<0.5ex>[r]^{\Box} \ar@<-.5ex>[r]_{p_{\mathcal{Y}}} & \mathcal{Y} \ar[r]^p & \mathcal{S},
}\end{xymatrix}\\
\]
and if $p$ sends the associators and unitors of the action of $\mathcal{C}$ to identity morphisms of $S$. Here $\Box$ denotes the action of $\mathcal{C}$, and $p_{\mathcal{Y}}$ is projection onto the second factor.
\end{defn}

\begin{defn}\label{obfree}
The left action of a monoidal category $\mathcal{C}$ on a category $\mathcal{Y}$ is said to be \textbf{free on objects} if whenever $aY \simeq bY$ in $\mathcal{Y}$ for some $Y\in \mathcal{Y}$, and $a$, $b \in \mathcal{C}$, then $a\simeq b$ in $\mathcal{C}$.
\end{defn}

One can define a free action on the right analogously. These definitions appear essentially in \cite{Grayson1976} and \cite[pp. 339-340]{kbook}, though neither spell out the behaviour on associators and unitors for a fibrewise action.

Recall that a category is called \textit{left-cancellative} if all its morphisms are monic. We introduce the following relative version.

\begin{defn} \label{relcan} A category $\mathcal{Y}$ lying over $\mathcal{S}$ via $\pi: \mathcal{Y} \rightarrow \mathcal{S}$ is called \textbf{left-cancellative over} $\boldsymbol{\mathcal{S}}$, if for any morphism $h: Z \rightarrow X$ in $\mathcal{Y}$, and any pair of morphisms $f: X \rightarrow Y$ and $g: X \rightarrow Y$ such that $\pi(f)=\pi(g)$, we have $f=g$ whenever $h \circ f = h \circ g$.
\end{defn}

\begin{lemma}\label{canlem}A category fibred in groupoids $\mathcal{Y} \rightarrow \mathcal{S}$ is left-cancellative over $\mathcal{S}$.
\end{lemma}
\begin{proof}
Let $f: X \rightarrow Y$, $g: X \rightarrow Y$, and $h: Z \rightarrow Y$ be morphisms in $\mathcal{Y}$, and suppose $f\circ h = g \circ h$, with $f$ and $g$ lying over the same morphism in $\mathcal{S}$. Since $\mathcal{Y}$ is fibred in groupoids, every morphism of $\mathcal{Y}$ is cartesian. In particular $f$ is cartesian, hence exists a unique morphism $\rho: X \rightarrow X$ lying over $\mathbbm{1}_{S}$ such that $g = \rho \circ f$. Then we have $f \circ h = \rho \circ f \circ h$.  Since $f\circ h$ is also cartesian, $\rho$ is also the unique morphism $X \rightarrow X$ over $\mathrm{id}_S$ satisfying $f\circ h = \rho \circ f \circ h$. As $\mathbbm{1}_X$ already satisfies this, $\rho = \mathbbm{1}_X$, therefore $g = f$.
\end{proof}

\begin{prop}\label{fiberedprop}
Let $\mathcal{X}$ be a groupoid on which a 2-group $\mathcal{C}$ acts on the right, and $p: \mathcal{Y} \rightarrow \mathcal{S}$ a category fibred in groupoids on which $\mathcal{C}$ acts on the left fibrewise and free on objects. Suppose furthermore that $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$ is left-cancellative over $\mathcal{S}$. Then $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$ is fibred in groupoids over $\mathcal{S}$ via $\pi: \mathcal{X} \otimes_\mathcal{C} \mathcal{Y} \rightarrow \mathcal{S}$ defined by
\[ \pi(X\otimes Y) = p(Y),\ \ \ \pi(\phi \otimes \psi) = p(\psi),\ \ \ \pi(\alpha_{X,a,Y})=p(\mathbbm{1}_Y).\]
\end{prop}
\begin{proof}
Let $\alpha: T \rightarrow S$ be a morphism in $\mathcal{S}$, and $X\otimes Y$ an object in $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$ over $S$. We must first show that $\alpha$ lifts to a morphism in $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$ with target $X\otimes Y$. Now $Y\in \mathcal{Y}$ lies over $S\in \mathcal{S}$. Since $\mathcal{Y}$ is fibred in groupoids over $\mathcal{S}$, there exists an object $Y_T\in \mathcal{Y}$ over $T$ and a morphism $\psi: Y_T \rightarrow Y$ lifting $\alpha$. Therefore $\mathbbm{1}_X \otimes \psi: X\otimes Y_T \rightarrow X\otimes Y$ is a morphism lifting $\alpha$ to $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$ .

Now suppose $f: X' \otimes Y' \rightarrow X \otimes Y$ lies over $\alpha: S' \rightarrow S$, and $g: X''\otimes Y'' \rightarrow X\otimes Y$ over $\beta: S'' \rightarrow S$. Suppose $\gamma: S' \rightarrow S''$ satisfies $\beta \circ \gamma = \alpha$. We must show there exists a unique morphism $h: X'\otimes Y' \rightarrow X''\otimes Y''$ lying over $\gamma$, such that $g \circ h = f$.

Using the alternate presentation of a morphism given in Proposition \ref{morprop}, we can write $f = (\phi'\otimes \psi')\circ \omega_a$ where $\omega_a: X'\otimes Y' \rightarrow X'a\otimes a^{-1}Y'$ is a canonical isomorphism for some $a \in \mathcal{C}$, and similarly $g = (\phi'' \otimes \psi'') \circ \omega_b$ for some $b\in \mathcal{C}$. Then $\pi(\omega_a) = \mathbbm{1}_{S'}$ and $\pi(\omega_b) = \mathbbm{1}_{S''}$ since $\mathcal{C}$ acts fibrewise on $\mathcal{Y}$, and so $\phi' \otimes \psi'$ and $\phi'' \otimes \psi''$ are also lifts of $\alpha$ and $\beta$ to $\mathcal{X} \otimes_\mathcal{C} \mathcal{Y}$. Since $\omega_a$ and $\omega_b$ are isomorphisms, we have $g\circ h = f$ if and only if $(\phi''\otimes \psi'') \circ h' = (\phi'\otimes \psi')$, where $h'=\omega_b \circ h \circ \omega_a^{-1}$. Therefore it's enough to assume $f = \phi' \otimes \psi'$ and $g = \phi'' \otimes \psi''$, and show there's a unique $h$ lying over $\gamma$ such that $(\phi'' \otimes \psi'')\circ h = \phi' \otimes \psi'$.

We have $p(\psi')=\pi(\phi'\otimes \psi') = \alpha$, and $p(\psi'')=\pi(\phi''\otimes \psi'') = \beta$. As $\mathcal{Y}$ is fibred in groupoids over $\mathcal{S}$, there exists a unique lift $\eta: Y' \rightarrow Y''$ of $\gamma$ to $\mathcal{Y}$, such that $\psi'' \circ \eta = \psi'$. Now, the maps $\phi'$ and $\phi''$ are isomorphisms since $\mathcal{X}$ is a groupoid. Hence, setting $\xi = {\phi''}^{-1} \circ \phi'$, we obtain a map $\xi \otimes \eta: X'\otimes Y' \rightarrow X'' \otimes Y''$ lifting $\gamma$, which satisfies the desired property $(\phi'' \otimes \psi'') \circ (\xi \otimes \eta) = \phi' \otimes \psi'$. If $h: X'\otimes Y' \rightarrow X'' \otimes Y''$ is any other lift such that $g \circ h = f = g \circ (\xi \otimes \eta)$ we have $h = \xi\otimes \eta$ since $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$ is left-cancellative over $\mathcal{S}$. This shows the lift we constructed is unique, which finishes the proof that $\mathcal{X}\otimes_\mathcal{C} \mathcal{Y}$ is fibred in groupoids over $\mathcal{S}$.
\end{proof}

\section{Application to Moduli Spaces of Abelian Schemes.}

In this section, using the results from \S 1, we apply the Serre tensor construction to certain moduli spaces of polarized abelian schemes related to PEL Shimura varieties. In the complex case, we show that we can construct all objects of the relevant target moduli space in this way. Over a general base scheme, using deformation theory we show that all abelian schemes in the target family can be constructed \textit{\'etale locally on the base}. These results are formulated as an equivalence of categories in the complex case, and an isomorphism of stacks in general.

\subsection{The moduli space $\mathcal{M}_\Phi^n$}

Let $K$ be a CM-field of degree $2g$ over $\mathbbm{Q}$, $\Phi$ a CM-type for $K$, and $n>0$ an integer. Let $L$ be the reflex field of $(K,\Phi)$. By ${\calO_K}$, resp. ${\calO_L}$, we denote the ring of integers of $K$, resp. $L$. We define a moduli space $\mathcal{M}_\Phi^n$ over $\operatorname{Spec} {\calO_L}$ as follows.

\begin{defn}\label{modspace}
For a locally noetherian scheme $S$ over $\operatorname{Spec} {\calO_L}$, $\mathcal{M}_\Phi^n(S)$ is the category whose objects are triples $(A,\iota,\lambda)$ where:
\begin{itemize}
\item$A$ is an abelian scheme of relative dimension $ng$ over $S$.
\item $\iota: {\calO_K} \hra \mathrm{End}_S(A)$ is an injective ring homomorphism taking complex conjugation on ${\calO_K}$ to the Rosati involution on $\mathrm{End}_S(A)_\mathbbm{Q}$.
\item $\lambda: A \rightarrow A^\vee$ is an ${\calO_K}$-linear principal polarization.
\end{itemize}
In addition, the triple $(A,\iota,\lambda)$ is required to satisfy the following \textit{ideal condition}. Let the ideal $J_\Phi$ be the kernel of the map
\begin{equation}\label{J} {\calO_K}\otimes {\calO_L} \rightarrow \prod_{\phi\in \Phi} \mathbbm{C}^{(\phi)},\ \ \ (\alpha \otimes \beta)\mapsto (\phi(\alpha)\cdot \beta)_\phi.\end{equation}
Here $\mathbbm{C}^{(\phi)}$ denotes $\mathbbm{C}$, considered as a $K$-algebra via $\phi: K \hra \mathbbm{C}$. We require that the action of ${\calO_K} \otimes {\calO_L}$ on $\mathrm{Lie}_S(A)$ satisfy
\begin{align} \label{idealcon} J_\Phi \mathrm{Lie}_S(A)=0.
\end{align}
The morphisms of $\mathcal{M}_\Phi^n(S)$ are defined to be ${\calO_K}$-linear isomorphisms of abelian schemes preserving the polarizations.
\end{defn}

The functor $S \mapsto \mathcal{M}_\Phi^n(S)$ defines a category fibred in groupoids over the category $\mathrm{Sch}_{/{\calO_L}}$ of locally noetherian ${\calO_L}$-schemes. It is representable by a Deligne-Mumford stack over $\operatorname{Spec} {\calO_L}$, which we also denote by $\mathcal{M}_\Phi^n$. When $n=1$, it is an integral model of the stack of principally polarized abelian varieties with CM by $(K,\Phi)$.

We first show $\mathcal{M}_\Phi^n$ is \'etale and proper over $\operatorname{Spec} {\calO_L}$ (Theorem \ref{etprop}), generalizing results of B. Howard for the $n=1$ case \cite[Theorem 2.1.3]{unitary1}, as well as for $K$ quadratic imaginary \cite[Proposition 2.1.2]{unitary2}. Our proof is essentially the same, using the deformation theory of abelian schemes. The key to adapting Howard's proof is the ideal condition, which we now discuss.

In order to obtain a well-behaved moduli space, one typically imposes restrictions on the action of $\iota(a)$ induced on $\mathrm{Lie}_S(A)$, for all $a\in {\calO_K}$. For instance to obtain integral models of PEL Shimura varieties attached to unitary groups of a certain signature, one may impose a corresponding \textit{signature condition} by prescribing the characteristic polynomial of $\iota(a)$ acting on $\mathrm{Lie}_S(A)$. For us, the relevant abelian schemes are those that are, over $\mathbbm{C}$, isogenous to the $n$th power of a CM abelian variety of type $\Phi$. The corresponding signature condition is then
\begin{flalign} \label{charpo} \mathrm{charpoly}(\iota(a)|_{\mathrm{Lie}_S(A)},X) = \prod_{\phi\in \Phi} (X- \phi(a))^n,\end{flalign}
where the right hand side is identified with its image under the map ${\calO_L}[X] \rightarrow \calO_S[X]$ induced by the structure morphism $S \rightarrow \operatorname{Spec} {\calO_L}$.

However, over characteristic $p>0$ for $p$ is ramified in $K$, the signature condition is not restrictive enough, since in that case some of the different embeddings $\phi\in \Phi$ coincide. For example, let $K$ be quadratic imaginary, so that $L=K$ and $\Phi$ consists of a single embedding $\phi: K \hra \mathbbm{C}$. Let $S$ be a scheme over $\operatorname{Spec} {\calO_K}$ of characteristic $p$, where $p$ is ramified in $K$. Then for any $a\in {\calO_K}$, $a$ and $a^\sigma$ have the same image under ${\calO_K} \rightarrow \calO_S$, so that $\phi$ and $\phi\sigma$ are indistinguishable through the ${\calO_K}$-action on $\calO_S$, and the signature condition is always satisfied. This is a general defect of the signature condition that causes the moduli space to acquire vertical components over ramified primes $p$, and so fail to be flat over $\operatorname{Spec} {\calO_K}$.

For $K$ quadratic imaginary, the \textit{wedge condition} of G. Pappas \cite{Pappas2000}, formulated using exterior powers of $\iota(a)$ acting on $\mathrm{Lie}_S(A)$, is one approach to fixing the defect over ramified primes. The resulting moduli spaces are expected to be flat in general, and this has been verified in important special cases. The wedge condition corresponding to the signature condition (\ref{charpo}) is simply $\iota(a) = \phi(a)$, i.e that the two actions of ${\calO_K}$ on $\mathrm{Lie}_S(A)$ should coincide. The resulting moduli space is then proper and smooth over $\operatorname{Spec} {\calO_K}$, of relative dimension zero \cite[2.1.2]{unitary2}. However, it's not clear how to extend the wedge condition to the general CM case, since when $L\neq K$ there is no way to directly compare the actions of ${\calO_K}$ and ${\calO_L}$.

For all CM fields $K$, the \textit{ideal condition} (\ref{idealcon}) fixes the above defect for the specific signature condition (\ref{charpo}), which we are interested in. It is equivalent to (\ref{charpo}) if $n=1$, or if $S$ has characteristic is $0$. In general it \textit{implies} (\ref{charpo}) (see Corollary \ref{J->char}).

If $A\in \mathcal{M}_\Phi^1(S)$, so that it satisfies the ideal condition, and $M$ is a projective finitely presented ${\calO_K}$-module, then $M\otimes_{\calO_K} A$ also satisfies the ideal condition (by Lemma \ref{lielem}). This show that if we want $\mathcal{M}_\Phi^n$ to consist of objects arising from the Serre construction (at least \'etale locally), the ideal condition on $\mathcal{M}_\Phi^n$ is \textit{necessary}. On the other hand, we would like $\mathcal{M}_\Phi^n$ to have desirable properties such as flatness. We will show that for this purpose the ideal condition is also \textit{sufficient}, in the sense that $\mathcal{M}^n_\Phi$ as defined is \'etale and proper over $\operatorname{Spec} {\calO_L}$ (Theorem \ref{etprop}). This fact is key to the proof of the main theorem in the last section.

First we expose some basic properties of the ideal $J_\Phi$. Following the notation of \cite{unitary1}, let $\mathrm{Lie}_\Phi$ denote $({\calO_K} \otimes {\calO_L})/J_\Phi$, so that there's an exact sequence of ${\calO_K}\otimes {\calO_L}$-modules
\begin{equation}\label{Jseq} \xymatrix{0 \ar[r] & J_\Phi \ar[r] & {\calO_K}\otimes {\calO_L} \ar[r] & \mathrm{Lie}_\Phi \ar[r] & 0}.\end{equation}
Since $\mathrm{Lie}_\Phi$ may be identified with the image of the map (\ref{J}), it is torsion-free, hence projective as an ${\calO_L}$-module. Then the above sequence splits, as a sequence of ${\calO_L}$-modules. In particular $J_\Phi$ is a direct ${\calO_L}$-module summand of ${\calO_K}\otimes {\calO_L}$.

Recall that $\sigma: {\calO_K} \rightarrow {\calO_K}$ denotes complex conjugation. We will also use it to denote the ${\calO_L}$-linear automorphism it induces on ${\calO_K} \otimes {\calO_L}$.

\begin{lemma}\label{Jprops} The ideal $J_\Phi$ satisfies the following properties:
\begin{enumerate}
\item[(a)] $J_\Phi J_\Phi^\sigma = J_\Phi \cap J_\Phi^\sigma = 0$
\item[(b)] $J_\Phi$ is a projective ${\calO_L}$-module of rank $g$ (where $2g=[K:\mathbbm{Q}]$).
\item[(c)] Suppose $T$ is a local ${\calO_L}$-algebra, and $D$ is a free $({\calO_K}\otimes T)$-module of rank $n$. Then $J_\Phi D$ is the unique direct summand of $D$ as a $T$-module, that is ${\calO_K}$-stable, has rank $ng$ over $T$, and satisfies $J_\Phi (D/M) = 0$.
\end{enumerate}
\end{lemma}
\begin{proof}

For an embedding $\phi: {\calO_K} \hra \mathbbm{C}$, let $\phi_L: {\calO_K}\otimes {\calO_L} \rightarrow \mathbbm{C}$ denote the ring homomorphism $\alpha \otimes \beta \mapsto \phi(\alpha)\beta$. By definition, an element $x\in J_\Phi$ satisfies $\phi_{L}(x)=0$ for all $\phi\in \Phi$. Similarly, for $x\in J_\Phi^\sigma = J_{\Phi^\sigma}$ we have $\phi_{L}(x)=0$ for $\phi \in \Phi\sigma$. It follows that for $x\in J_\Phi \cap J_\Phi^\sigma$, we have $\phi_{L}(x)=0$ for all embeddings $\phi: {\calO_K} \hra \mathbbm{C}$. But the map
$${\calO_K} \otimes {\calO_L} \rightarrow \prod_{\phi: {\calO_K} \hra \mathbbm{C}} \mathbbm{C}^{(\phi)},\ \ \ (\alpha \otimes \beta) \mapsto (\phi(\alpha)\beta)_\phi$$
is injective, so $x=0$, which shows $J_\Phi \cap J_\Phi^\sigma = 0$. Since $J_\Phi J_\Phi^\sigma \subseteq J_\Phi \cap J_\Phi^\sigma$, this proves (a).

For (b), we first note that ${\calO_K} \otimes {\calO_L}$ is free of rank $2g$ over ${\calO_L}$. Since $J_\Phi$ is an ${\calO_L}$-submodule of ${\calO_K}\otimes {\calO_L}$, it is torsion-free, and hence projective. To verify its rank, we show that the dimension of $J_\Phi^0=J_\Phi\otimes \mathbbm{Q}$ as a vector space over $L$ is equal to $g$. Let $\widetilde{L}$ be a finite extension of $L$ in $\mathbbm{C}$ containing the image of all embeddings $K \hra \mathbbm{C}$. It's then enough to check that $\dim_{\widetilde{L}} J_\Phi^0 \otimes_L \widetilde{L} = g$. Now note that $\sigma: J_\Phi \rightarrow J_{\Phi\sigma}$ is an isomorphism of ${\calO_L}$-modules, so that $\dim_L J_\Phi^0 = \dim_L (J_{\Phi\sigma}^0)$. We claim $(J_\Phi^0 \oplus J_{\Phi\sigma}^0)\otimes_L \widetilde{L} \cong K\otimes \widetilde{L}$ as vector spaces over $\widetilde{L}$. Since $\dim_{\widetilde{L}} K\otimes_\mathbbm{Q} \widetilde{L} = 2g$, (b) then follows. Now, we have an isomorphism
$$ K\otimes \widetilde{L} \xrightarrow{\raisebox{-5pt}{$\sim$}} \prod_{\phi\in \Phi} \widetilde{L}^{(\phi)} \times \prod_{\phi' \in \Phi\sigma} \widetilde{L}^{(\phi')},\ \ \  \alpha\otimes \beta \mapsto \left((\phi(\alpha)\beta)_{\phi \in \Phi} ,  (\phi'(\alpha)\beta)_{\phi'\in \Phi\sigma}\right),$$
where each $\widetilde{L}^{(\phi)}$ is a copy of $\widetilde{L}$, viewed as a $K$-algebra via  $\phi$. Let $e_1 = (1,\cdots, 1,0,\cdots,0)$ and $e_2=(0,\cdots,0,1,\cdots, 1)$ be elements of the right hand side above, such that $e_1 + e_2 = (1,\cdots ,1)$. Then the corresponding elements $\epsilon_1$ and $\epsilon_2$ in $K\otimes \widetilde{L}$ are idempotents satisfying $\epsilon_1 + \epsilon_2 = 1$ and $\epsilon_1 \epsilon_2=0$, with $\epsilon_1\in J_{\Phi\sigma}^0\otimes_L \widetilde{L}$ and $\epsilon_2 \in J_\Phi^0 \otimes_L \widetilde{L}$. It follows that $\epsilon_1 (K\otimes \widetilde{L}) = J_{\Phi\sigma}^0 \otimes_L \widetilde{L}$ and $\epsilon_2 (K\otimes \widetilde{L}) = J_\phi^0 \otimes_L \widetilde{L}$, and that $J_\Phi^0 \otimes_L \widetilde{L} + J_{\Phi\sigma}^0\otimes_L \widetilde{L} = K\otimes \widetilde{L}$. By part (a), the sum $J_\Phi^0 + J_{\Phi\sigma}^0$ is direct, therefore so is $J_\Phi^0\otimes_L \widetilde{L} + J_{\Phi\sigma}^0\otimes_L \widetilde{L}$, from which it follows that $(J_\Phi^0 \oplus J_{\Phi\sigma}^0)\otimes_L \widetilde{L} \simeq K\otimes \widetilde{L}$.

For part (c), recall that $J_\Phi$ is a direct summand of ${\calO_K}\otimes {\calO_L}$ as an ${\calO_L}$-module, since as such the exact sequence (\ref{Jseq}) is split. It follows that $J_\Phi D$ is a direct summand of $D$ as a $T$-module. As it is isomorphic to $J_\Phi ({\calO_K}\otimes T)^n \cong (J_\Phi \otimes_{\calO_L} T)^n$, by (b) it also has rank $ng$ over $T$, so it satisfies the properties mentioned in part (c). Now suppose $M$ is another such direct summand of $D$. The condition $J_\Phi (D/M)=0$ implies $J_\Phi D \subset M$. Let $J'$ and $M'$ be $T$-submodules of $D$ complementary to the direct summands $J_\Phi D$ and $M$, so that $M \oplus M'= (J_\Phi D) \oplus J' = D$. We have $(M/J_\Phi D) \oplus M' \cong J'$, and so $(M/J_\Phi D) \oplus M' \oplus (J_\Phi D) \cong D$. It follows that $M/(J_\Phi D)$ is a projective $T$-module. But since $M$ and $J_\Phi D$ both have rank $ng$ over $T$, the rank of $M/J_\Phi D$ must be zero, hence $M=J_\Phi D$.
\end{proof}

For an abelian scheme $A$ defined over $S$, we denote the first algebraic de Rham homology $H_1^\mathrm{DR}(A/S) = \mathcal{H} om_{\calO_S}(H^1_\mathrm{DR}(A/S), \calO_S)$ by $\mathbbm{D}_A(S)$. There's a fundamental Hodge filtration, an exact sequence of locally free $\calO_S$-modules
\begin{align} \label{H} 0 \rightarrow \mathrm{Fil}^1 \mathbbm{D}_A(S) \rightarrow \mathbbm{D}_A(S) \rightarrow \mathrm{Lie}_S(A) \rightarrow 0. \end{align}

When $S=\operatorname{Spec} T$, the above may be identified with an exact sequence of projective $T$-modules by passing to global sections. We will often make this identification when $S$ is affine.

\begin{prop} \label{Dfree} Let $T$ be a local ${\calO_L}$-algebra with a separable residue field $\mathbbm{F}$, $S=\operatorname{Spec} T$, and $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(S)$. Then:
\begin{enumerate}
\item[(a)] $\mathbbm{D}_A(S)$ is free of rank $n$ over ${\calO_K}\otimes T$.
\item[(b)] The choice of an isomorphism $({\calO_K}\otimes T)^n \xrightarrow{\raisebox{-5pt}{$\sim$}} \mathbbm{D}_A(S)$ leads to an isomorphism of short exact sequences
\begin{equation*}\xymatrix{0 \ar[r] & J_\Phi({\calO_K} \otimes T)^n \ar[r] \ar[d]^\simeq & ({\calO_K} \otimes T)^n \ar[r]\ar[d]^\simeq & \mathrm{Lie}_\Phi \otimes_{\calO_L} T^n \ar[r]\ar[d]^\simeq & 0\\
0 \ar[r] & \mathrm{Fil}^1 \mathbbm{D}_A(S) \ar[r] & \mathbbm{D}_A(S) \ar[r] & \mathrm{Lie}_S(A) \ar[r] & 0. }
\end{equation*}
\end{enumerate}
\end{prop}
\begin{proof}
For (a), we first consider the case $T= \mathbbm{F}$. If the characteristic of $\mathbbm{F}$ is zero, then $\mathbbm{D}_A(F)=H_1^\mathrm{DR}(A/\mathbbm{F})$ is free of rank $n$ over ${\calO_K}\otimes \mathbbm{F}$ by comparison with Betti homology. If the characteristic is $p>0$, one first shows that the covariant Dieudonn\'e module $D(A)$ is free of rank $n$ over ${\calO_K}\otimes W(\mathbbm{F})$. This is proved in \cite[Lemme 1.3]{Rapo78}, where it is stated in terms of $H^1_{cris}(A)$. The result then follows by $H^{\mathrm{DR}}_1(A/\mathbbm{F}) \cong D(A)\otimes_{W(\mathbbm{F})} \mathbbm{F}$.

Now let $T$ be any local ring with residue field $\mathbbm{F}$ and $S=\operatorname{Spec} T$. Let $A_0$ denote $A\otimes \mathbbm{F}$. We have $\mathbbm{D}_A(S)\otimes_T \mathbbm{F} \cong \mathbbm{D}_{A_0}(\mathbbm{F}) \simeq ({\calO_K}\otimes \mathbbm{F})^n$. Let $\{x_1,\cdots,x_n\}$ be the lift to $\mathbbm{D}_A(S)$ of an $({\calO_K}\otimes \mathbbm{F})$-basis for $\mathbbm{D}_{A_0}(\mathbbm{F})$, and let $({\calO_K}\otimes T)^n \rightarrow \mathbbm{D}_A(S)$ be the ${\calO_K}\otimes T$-linear map sending $e_i$ to $x_i$. By Nakayama's lemma for the local ring $T$, this map is surjective. Let $K$ denote the kernel. Since $\mathbbm{D}_A(S)$ is projective over $T$, we have $({\calO_K}\otimes T)^n \simeq K\oplus \mathbbm{D}_A(S)$, which shows $K$ is also projective, hence free. Now applying $\textendash \otimes_T \mathbbm{F}$ to the isomorphism $({\calO_K}\otimes T)^n \simeq K\oplus \mathbbm{D}_A(S)$ shows that $K\otimes_T \mathbbm{F}=0$, which implies $K=0$ by considering rank. Thus the map $({\calO_K} \otimes T)^n \rightarrow \mathbbm{D}_A(S)$ is also injective, hence an isomorphism.

For part (b), note that since $({\calO_K}\otimes T)^n \cong ({\calO_K}\otimes {\calO_L})\otimes_{\calO_L} T^n$, the first row can be obtained by tensoring (\ref{Jseq}) with $T^n$ over ${\calO_L}$, so it is exact. The ideal condition $J_\Phi \mathrm{Lie}_S(A) = 0$ and the exactness of the second row together imply that the composition $J_\Phi({\calO_K} \otimes T)^n \rightarrow ({\calO_K}\otimes T)^n \rightarrow \mathbbm{D}_A(S)$ lands in $\mathrm{Fil}^1 \mathbbm{D}_A(S)$, providing the map on the left. Exactness of the first row then provides the map on the right. As $\mathrm{Lie}_S(A)$ is a projective $T$-module of dimension $ng$, $\mathrm{Fil}^1 \mathbbm{D}_A(S)$ is a direct summand of $\mathbbm{D}_A(S)$ satisfying the conditions in Lemma \ref{Jprops}(c), so it must coincide with $J_\Phi \mathbbm{D}_A(S)$, which is the image of $J_\Phi ({\calO_K} \otimes T)^n$ in $\mathbbm{D}_A(S)$. Therefore the map on the left is also an isomorphism. Then since the vertical maps in the middle and the left are isomorphisms, so is the one on the right.
\end{proof}

\begin{cor}\label{J->char}Let $S$ be a scheme locally of finite type over $\operatorname{Spec} {\calO_L}$, and $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(S)$. Then for each $a\in {\calO_K}$,
$$\mathrm{charpoly}(\iota(a)|_{\mathrm{Lie}_S(A)},X) = \prod_{\phi\in \Phi} (X- \phi(a))^n.$$
\end{cor}
\begin{proof}
The assertion is an identity of global sections of $\calO_S[X]$, the given polynomial being identified with its image under ${\calO_L}[X] \rightarrow \calO_S[X]$. Since such an identity may be checked at the stalks of $\calO_S[X]$, we may assume $S=\operatorname{Spec} T$, where $T$ is a local ${\calO_L}$-algebra. Furthermore, since $S$ is locally of finite type over $\operatorname{Spec} {\calO_L}$, the residue field of $T$ either has characteristic zero, or is a finite extension of the residue field of a closed point in $\operatorname{Spec} {\calO_L}$. In either case, it is separable. Now by Lemma \ref{Dfree}(b), $\mathrm{Lie}_S(A)$ is isomorphic to $\mathrm{Lie}_\Phi \otimes_{\calO_L} T^n$ as an ${\calO_K}\otimes T$-module. The characteristic polynomial of $a \in {\calO_K}$ acting on $\mathrm{Lie}_\Phi$ can be seen to equal $\prod_{\phi\in \Phi}(X-\phi(a))$ using the isomorphism $\mathrm{Lie}_\Phi \otimes \mathbbm{Q} \simeq \prod_{\phi \in \Phi} K^{(\phi)}L$. The image of the same polynomial under ${\calO_L}[X] \rightarrow T[X]$ gives the characteristic polynomial of $a\in {\calO_K}$ acting on $\mathrm{Lie}_\Phi \otimes_{\calO_L} T$. Therefore $a\in {\calO_K}$ acting on $\mathrm{Lie}_S(A) \simeq \mathrm{Lie} \otimes_{\calO_L} T^n \cong (\mathrm{Lie} \otimes_{\calO_L} T)^n$ has characteristic polynomial $\prod_{\phi \in \Phi} (X-\phi(a))^n.$
\end{proof}

We now turn to the deformation theory of abelian schemes to prove $\mathcal{M}_\Phi^n$ has the expected properties. Let us fix a point $y\in \operatorname{Spec} {\calO_L}$. The \'etale local ring $\widehat{\mathcal{O}_{L,y}^\mathrm{\makebox[2pt]{}sh}}$ of $\operatorname{Spec} {\calO_L}$ at $y$ is the completion of the ring of integers of the maximal unramified extension of $\mathcal{O}_{L,y}$. Following the notation of \cite{unitary1}, we denote it by $W_\Phi$. Its residue field, a separable closure of $k(y)$, will be denoted $\mathbbm{F}$. Let $\mathcal{C}_\Phi$ be the category of complete local noetherian $W_\Phi$-algebras with residue field $\mathbbm{F}$, and $\mathcal{A}_\Phi$ its subcategory of artinian rings. The relevant facts from deformation theory of abelian schemes \cite[Ch. 2]{Lansthesis} are summarized as follows.

Let $T' \twoheadrightarrow T$ be a surjection in $\mathcal{C}_\Phi$ with kernel $I$ satisfying $I^2=0$. Set $S=\operatorname{Spec} T$ and $S'=\operatorname{Spec} T'$. An abelian scheme $A/S$ always lifts to some abelian scheme $A'/S'$, and for any such $A'$ there's a canonical isomorphism $\mathbbm{D}_{A'}(S')\otimes_{T'} T \cong \mathbbm{D}_A(S)$. Furthermore, the $T'$-module $\mathbbm{D}_{A'}(S')$ is up to canonical isomorphism independent of the choice of the lift. For convenience we hide away the canonical isomorphisms, erasing $A'$ from the notation and writing $\widetilde{\mathbbm{D}}_A(S')$ instead of $\mathbbm{D}_{A'}(S')$. The submodule $\mathrm{Fil}^1 \mathbbm{D}_{A'}(S')$ of $\widetilde{\mathbbm{D}}_A(S')$ on the other hand does depend on the choice of the lift, and determines it completely. More specifically, there is a bijection between lifts $A'/S'$ of $A/S$, and projective $T'$-submodules $M$ of $\widetilde{\mathbbm{D}}_A(S')$ such that $M\otimes_{T'} T \cong \mathrm{Fil}^1 \mathbbm{D}_{A}(S)$ via the isomorphism $\widetilde{\mathbbm{D}}_{A}(S') \otimes_{T'} T \cong \mathbbm{D}_A(S)$.

Let $A'/S'$ be a lift of $A/S$. For an element $\phi \in \mathrm{End}_S(A)$, the induced $T$-module endomorphism of $\mathbbm{D}_A(S)$ lifts canonically to a morphism $\phi_*: \widetilde{\mathbbm{D}}_A(S') \rightarrow \widetilde{\mathbbm{D}}_A(S')$. Then $\phi$ lifts (uniquely) to an endomorphism of abelian schemes $\phi': A' \rightarrow A'$ if and only if $\phi_*$ leaves the corresponding $T'$-submodule $\mathrm{Fil}^1\mathbbm{D}_{A'}(S')$ invariant. In particular, an ${\calO_K}$-action $\iota: {\calO_K} \hra \mathrm{End}_S(A)$ lifts (uniquely) to an ${\calO_K}$-action $\iota'$ on $A'$ if and only if $\mathrm{Fil}^1\mathbbm{D}_{A'}(S')$ is an ${\calO_K}$-submodule of $\widetilde{\mathbbm{D}}_A(S')$.

A polarization $\lambda: A \rightarrow A^\vee$ induces a symplectic pairing $\langle\ ,\ \rangle_\lambda$ on $\mathbbm{D}_A(S)$ which lifts to a pairing on $\widetilde{\mathbbm{D}}_A(S')$, denoted $\langle\ ,\ \rangle_\lambda'$. Given a lift $A'/S'$ of $A/S$, $\lambda$ lifts (uniquely) to a map $\lambda': A' \rightarrow {A'}^\vee$ if and only if the submodule $\mathrm{Fil}^1 \mathbbm{D}_{S'}(A')$ of $\widetilde{\mathbbm{D}}_A(S')$ is totally isotropic for $\langle\ ,\ \rangle_\lambda'$. In that case $\lambda'$ is a polarization for $A'$, and it is principal if $\lambda$ is. If $A$ has an ${\calO_K}$-action that lifts to $A'$ and $\lambda$ is ${\calO_K}$-linear, so is $\lambda'$. In addition, the Rosati involution induced by $\lambda$ corresponds to the adjoint for the pairing $\langle\ ,\ \rangle_\lambda'$, so that $\langle ax,y \rangle_\lambda' = \langle x,a^\sigma y \rangle_\lambda'$ for all $x,y\in \widetilde{\mathbbm{D}}_A(S')$, $a\in {\calO_K}$.

Putting the above facts together, we see that lifting a triple $(A,\iota,\lambda)$ over $S$ to $(A',\iota',\lambda')$ over $S'$ is equivalent to lifting the Hodge filtration $\mathrm{Fil}^1 \mathbbm{D}_A(S)$ of $A$ to an ${\calO_K}$-stable projective $T'$-submodule of $\widetilde{\mathbbm{D}}_A(S')$ that is totally isotropic with respect to the pairing $\langle\ ,\ \rangle_\lambda'$. Such a lift satisfies the ideal condition if and only if $J_\Phi \widetilde{\mathbbm{D}}_A(S') \subseteq \mathrm{Fil}^1 \mathbbm{D}_{A'}(S')$.

\begin{prop}\label{1lift} Every object in $\mathcal{M}_\Phi^n(\mathbbm{F})$ lifts uniquely to $\mathcal{M}_\Phi^n(T)$, for all $T\in \mathcal{C}_\Phi$.
\end{prop}
\begin{proof}Every $T$ in $\mathcal{C}_\Phi$ is an inverse limit of its quotients, which are artinian rings in $\mathcal{A}_\Phi \subset \mathcal{C}_\Phi$. Then it's enough to show the claim for $T\in \mathcal{A}_\Phi$, since $\mathcal{M}_\Phi^n$ is an algebraic stack for which formal deformations are effective. Each such artinian ring has a surjective map to $\mathbbm{F}$ which is a composition of finitely many surjections in $\mathcal{A}_\Phi$, with square-zero kernels. Therefore it suffices to show that for a surjective map $T' \twoheadrightarrow T$ in $\mathcal{A}_\Phi$ having square-zero kernel, with $S = \operatorname{Spec} T$ and $S' = \operatorname{Spec} T'$, every object $(A,\iota,\lambda)$ of $\mathcal{M}_\Phi^n(S)$ lifts uniquely to an object of $\mathcal{M}_\Phi^n(S')$. For such an object $(A,\iota,\lambda)$, we have the Hodge filtration of projective $T$-modules (\ref{H}). By Proposition \ref{Dfree}, $\mathrm{Fil}^1 \mathbbm{D}_A(S)$ is the $T$-submodule $J_\Phi \mathbbm{D}_A(S)$ of $\mathbbm{D}_A(S)$. For the same reason, any lift $(A',\iota',\lambda')$ of $(A,\iota,\lambda)$ to $S'$, if such exists, would have $\mathrm{Fil}^1 \mathbbm{D}_{A'}(S')= J_\Phi \mathbbm{D}_{A'}(S') = J_\Phi \widetilde{D}_A(S')$, and would therefore be unique, by the deformation theory outlined above.

Now we claim $M=J_\Phi \widetilde{\mathbbm{D}}_A(S')\subset \widetilde{\mathbbm{D}}_A(S')$ does indeed correspond to a lift of $(A,\iota,\lambda)$ to $S'$. It lifts the Hodge filtration since $M\otimes_{T'} T = J_\Phi \widetilde{\mathbbm{D}}_A(S')\otimes_{T'} T \cong J_\Phi \mathbbm{D}_A(S)$, which is equal to $\mathrm{Fil}^1 \mathbbm{D}_A(S)$ as we have just noted. Since $M$ is ${\calO_K}$-stable, the pair $(A,\iota)$ lifts (uniquely) to a pair $(A',\iota')$. Since $J_\Phi \widetilde{\mathbbm{D}}_A(S') \subseteq M$, the pair $(A',\iota')$ satisfies the ideal condition. It remains to show that $M$ is totally isotropic for $\langle\ ,\ \rangle_\lambda'$. For $x,y\in \widetilde{\mathbbm{D}}_A(S')$ and $r,s\in J_\Phi$, we have
$$ \langle rx,sy \rangle_\lambda' = \langle s^\sigma r x,y \rangle_\lambda' = 0,$$
since $s^\sigma r =0$ by Lemma \ref{Jprops}(a).
\end{proof}
\begin{thm}\label{etprop}
The stack $\mathcal{M}_\Phi^n$ is \'etale and proper over $\operatorname{Spec} {\calO_L}$.
\end{thm}
\begin{proof}
Let $\mathbbm{F}$ be a separably closed field, and $\overline{x}: \operatorname{Spec} \mathbbm{F} \rightarrow \mathcal{M}_\Phi^n$ a geometric point of $\mathcal{M}_\Phi^n$. Let $\overline{y}: \operatorname{Spec} \mathbbm{F} \rightarrow \operatorname{Spec} {\calO_L}$ be the underlying geometric point, with image $y\in \operatorname{Spec} {\calO_L}$. Fix a surjective \'etale morphism $M \twoheadrightarrow \mathcal{M}$ from a scheme $M$. Then $\overline{x}$ lifts to a map $\operatorname{Spec} \mathbbm{F} \rightarrow M$ with image $x\in M$ lying over $y\in \operatorname{Spec}({\calO_L})$, and $M \rightarrow \operatorname{Spec}({\calO_L})$ induces a map of \'etale local rings $\mathcal{O}_{L,y}^\mathrm{\makebox[2pt]{}sh} \rightarrow \mathcal{O}_{M,x}^\mathrm{\makebox[2pt]{}sh}$. To show $\mathcal{M}_\Phi^n \rightarrow \operatorname{Spec}({\calO_L})$ is \'etale, it's enough to show the induced map on completions $$\widehat{\mathcal{O}_{L,y}^\mathrm{\makebox[2pt]{}sh}} \rightarrow \widehat{\mathcal{O}_{M,x}^\mathrm{\makebox[2pt]{}sh}}$$ is an isomorphism. The ring $\widehat{\mathcal{O}_{L,y}^\mathrm{\makebox[2pt]{}sh}}$, which is the completion of the ring of integers of the maximal unramified extension of $\mathcal{O}_{L,y}$, will be denoted $W_\Phi$ as before. The ring $\widehat{\mathcal{O}_{M,x}^\mathrm{\makebox[2pt]{}sh}}$, which is up to isomorphism independent of the choice of $M\twoheadrightarrow \mathcal{M}_\Phi^n$, will be denoted $R_\mathcal{M}$.

The geometric point $\overline{x}$ lifts uniquely to a map $\operatorname{Spec} \mathbbm{F} \rightarrow \operatorname{Spec} R_\calM$, whose image lies over $x\in M$. The image of the corresponding ring homomorphism $R_\calM \rightarrow \mathbbm{F}$ is the separable closure $\mathbbm{F}'$ of the residue field $k(x)$ of $\mathcal{O}_{M,x}$ in $\mathbbm{F}$. Then $\operatorname{Spec} \mathbbm{F} \rightarrow \operatorname{Spec} R_\calM$ factors uniquely through $\operatorname{Spec} \mathbbm{F} \rightarrow \operatorname{Spec} \mathbbm{F}'$, so it is harmless to assume $\mathbbm{F}$ itself is the residue field of $R_\calM$. Then since $M \rightarrow \operatorname{Spec} {\calO_L}$ is locally of finite type, $\mathbbm{F}$ is also the residue field of $W_\Phi$.

Let $\mathcal{C}_\Phi$ be the category of complete local noetherian $W_\Phi$-algebras with residue field $\mathbbm{F}$. If $(A_x,\iota_x,\lambda_x)\in \mathcal{M}_\Phi^n(\mathbbm{F})$ corresponds to $\overline{x}: \operatorname{Spec} \mathbbm{F} \rightarrow \mathcal{M}_\Phi^n$, then for any $T\in \mathcal{C}_\Phi$, the set $\mathrm{Hom}_{W_\Phi}(R_\calM,T)$ corresponds to lifts of $(A_x,\iota_x,\lambda_x)$ to $\mathcal{M}_\Phi^n(T)$. By Proposition \ref{1lift}, there is a unique such lift for every $T$, hence a unique morphism $R_\calM \rightarrow T$ of $W_\Phi$-algebras. In other words, $R_\calM$ is an initial object of $\mathcal{C}_\Phi$. Since $W_\Phi$ is also an initial object, the map $W_\Phi \rightarrow R_\calM$ must be an isomorphism. This proves $\mathcal{M}_\Phi^n \rightarrow \operatorname{Spec} {\calO_L}$ is \'etale.

The fact that $\mathcal{M}_\Phi^n$ is proper over $\operatorname{Spec} {\calO_L}$ follows from the valuative criterion of properness. The proof is identical to the quadratic imaginary case in \cite[Proposition 2.1.2]{unitary1}. It amounts to showing that for $k$ the fraction field of a discrete valuation ring, a triple $(A,\iota,\lambda)$ defined over $\operatorname{Spec} k$ in $\mathcal{M}_\Phi^n$ has potentially good reduction. In the unequal characteristic case this follows from the fact that the objects in $\mathcal{M}_\Phi^n(\mathbbm{C})$ are isogenous to powers of CM abelian varieties. In the equal characteristic case it follows from what we have already shown, that $\mathcal{M}_\Phi^n$ is \'etale over $\operatorname{Spec} {\calO_L}$.
\end{proof}

Next we begin the systematic construction of the morphisms and objects of $\mathcal{M}_\Phi^n$.

\subsection{Serre construction of $\mathcal{M}_\Phi^n$: the morphisms}

Let $(K,\Phi)$ be, as in the previous section, a CM-field of degree $2g$ over $\mathbbm{Q}$, and set $R={\calO_K}$. Let $\mathrm{Herm}_n(R)$ denote the category of pairs $(M,h)$ consisting of a projective finitely presented $R$-module $M$ of rank $n$, and a non-degenerate positive-definite $R$-hermitian form $h: M \rightarrow M^\vee$. It follows from Theorem \ref{mainthm}, that given an object $(A,\iota,\lambda)$ of $\mathcal{M}_\Phi^1(S)$, and another $(M,h)$ of $\mathrm{Herm}_n(R)$, the triple
$$(M\otimes_R A, \iota \otimes \mathbbm{1}_A, h\otimes \lambda)$$
is well-defined. We will denote this object by
$$ (M,h) \otimes (A,\iota,\lambda).$$

Since $R$ is commutative, $M\otimes_R A$ has a natural $R$-action, and the $\calO_S$-module isomorphism $\mathrm{Lie}_S(M\otimes_R A) \cong M\otimes_R \mathrm{Lie}_S(A)$ of Lemma \ref{lielem} is $R$-linear. It follows that since $A$ satisfies the ideal condition, so does $M\otimes_R A$. Hence, $(M,h) \otimes (A,\iota,\lambda)$ is an object of $\mathcal{M}^n_\Phi(S)$.

It follows that the 2-group $\mathrm{Herm}_1(R)$ acts on $\mathcal{M}_\Phi^1(S)$ on the left via the Serre construction. It also acts on $\mathrm{Herm}_n(R)$ on the right via ordinary tensor product. Thus, as described in $\S 2$, we can form the the tensor product category
$$ \mathrm{Herm}_n(R) \otimes_{\mathrm{Herm}_1(R)} \mathcal{M}_\Phi^1(S).$$

To avoid confusion with the Serre construction, we denote the objects of this category by
$$(M,h) \boxtimes (A,\iota,\lambda).$$
Likewise, we denote the pure tensor morphisms in the same category by $f\boxtimes \phi$. There is then a functor
$$\Sigma_S: \mathrm{Herm}_n(R) \otimes_{\mathrm{Herm}_1(R)} \mathcal{M}_\Phi^1(S) \longrightarrow \mathcal{M}_\Phi^n(S),$$
given on objects by
$$ \Sigma_S: (M,h)\boxtimes (A,\iota,\lambda) \mapsto (M,h) \otimes (A,\iota,\lambda),$$
sending morphisms $f\boxtimes \phi$ to $f\otimes \phi$, and mapping associator isomorphisms to their counterparts. The purpose of most of this section is to prove the following.
\begin{prop}\label{fullfaith}
The functor $\Sigma_S: \mathrm{Herm}_n(R)\otimes_{\mathrm{Herm}_1(R)}\mathcal{M}_\Phi^1(S) \longrightarrow \mathcal{M}_\Phi^n(S)$ is fully faithful.
\end{prop}

To prove this, we will first characterize the morphisms in $\mathcal{M}_\Phi^n$ that are in the image of the functor $\Sigma_S$, and then compare our result with the description given in $\S$2 of the morphisms of the category $\mathrm{Herm}_n(R)\otimes_{\mathrm{Herm}_1(R)}\mathcal{M}_\Phi^1(S)$.

For general abelian schemes $A$ and $B$ over a connected base $S$, and a point $s\in S$, by the rigidity lemma of \cite[Ch. 6]{GIT}, the map $\mathrm{Hom}_S(A,B) \rightarrow \mathrm{Hom}_{k(s)}(A_s,B_s)$ given by base change to the fibre at $s$ is injective. For $R$-linear maps of abelian schemes in $\mathcal{M}_\Phi^1(S)$, we have the following.

\begin{thm}\label{hombij}
Let $S$ be a connected locally noetherian ${\calO_L}$-scheme, let $(A,\iota,\lambda)$, $(B,\jmath,\mu)  \in \mathcal{M}_\Phi^1(S)$, and suppose $\mathrm{Hom}_R(A,B)\neq 0$. If $k$ is a field, $s=\operatorname{Spec}(k)$ and $s \rightarrow S$ is a morphism over $\operatorname{Spec} {\calO_L}$, the base change map $\mathrm{Hom}_R(A,B) \rightarrow \mathrm{Hom}_R(A_s,B_s)$ is bijective.
\end{thm}
\begin{proof}
By the rigidity lemma of \cite[\S 6.1]{GIT}, the map in question is injective, so we must prove surjectivity.

Let $s_0$ denote the image of $s\rightarrow S$ and $k_0=k(s_0)$. First we show that we can replace $s \rightarrow S$ in the statement with $\operatorname{Spec}(k_0) \rightarrow S$. We recall the standard argument showing every $R$-linear morphism $\phi: A_k \rightarrow B_k$ is already defined over $k_0$. For this we can replace $k$ with an algebraic closure, since that can only increase the set of morphisms $A_k \rightarrow B_k$. Let $l$ denote the separable closure of $k_0$ in $k$. Any morphism of abelian varieties over $k_0$ can be defined over a finite separable extension of $k_0$. It follows that $\mathrm{Hom}(A_k,B_k)=\mathrm{Hom}(A_l,B_l)$ and that $\mathrm{Gal}(l/k_0)$ acts on the latter continuously. Since the injective map $\mathrm{Hom}_R(A_{k_0}, B_{k_0}) \rightarrow \mathrm{Hom}_R(A_k,B_k)$ is one of rank-one projective $R$-modules, it has a finite cokernel. Then there's a positive integer $n$, such that given any $R$-linear $k$-morphism $\phi: A_k \rightarrow B_k$, the morphism $n\phi$ is defined over $k_0$. In other words, for any $\sigma \in \mathrm{Gal}(l/k_0)$, we have $(n\phi)^\sigma = n\phi$. Then $n(\phi^\sigma - \phi)=0$, since the multiplication-by-$n$ map is defined over $k_0$. That implies $\phi^\sigma = \phi$, since $\mathrm{Hom}_R(A_k,B_k)$ is torsion-free. Thus $\phi$ is $\mathrm{Gal}(l/k_0)$-invariant, so it is defined over $k_0$. That proves we can assume $s\in S$, $k=k(s)$.

Next we claim that the functor $\mathcal{H}: \mathrm{Sch}_{/S} \rightarrow \mathrm{Ab}$, $U \mapsto
\mathrm{Hom}_R(A_U,B_U)$ is representable by an \'etale $S$-scheme. Let $\mathcal{H}_0:
\mathrm{Sch}_{/S} \rightarrow \mathrm{Ab}$ denote the hom sheaf $U \mapsto \mathrm{Hom}_{\mathrm{Sch}_{/U}}(A_U,B_U)$.
$\mathcal{H}_0$ is representable by a scheme, since $A$ and $B$ are finitely
presented and flat, and the polarized abelian scheme $A$ is projective over
$S$. $\mathcal{H}_0$ is also a group scheme, since the functor takes values in
abelian groups and the restriction maps are group homomorphisms. The kernel of
the ``evaluation at identity" map $\mathcal{H}_0 \rightarrow B$, is a group scheme
representing the functor $\mathcal{H}_1: \mathrm{Sch}_{/S} \rightarrow \mathrm{Ab},\ U \mapsto
\mathrm{Hom}_U(A_U,B_U)$, which takes values in homomorphisms of abelian schemes. Let
$r_1,\cdots,r_n$ be generators of $R$ as a free $\mathbbm{Z}$-module of finite rank.
Consider the group scheme homomorphism $\mathcal{H}_1 \rightarrow \mathcal{H}_1^n$ whose $i$th
coordinate map $\mathcal{H}_1 \rightarrow \mathcal{H}_1$ sends a $U$-valued point $\phi_U: A_U
\rightarrow B_U$ to $\jmath_U(r_i) \circ \phi_U - \phi_U\circ \iota_U(r_i)$. The
kernel of $\mathcal{H}_1 \rightarrow \mathcal{H}_1^n$ is the group scheme representing the functor
$\mathcal{H}$.

To show that $\mathcal{H}$ is \'etale over $S$ amounts to showing that the morphism $\mathcal{H} \rightarrow S$ is formally \'etale, and locally of finite presentation. First we show it's formally \'etale.

Let $T_0\hra T$ be a closed immersion of $S$-schemes defined by a square-zero sheaf of $\mathcal{O}_T$-ideals. Let $(u: A_{T_0} \rightarrow B_{T_0}) \in \mathcal{H}(T_0)$ be an $R$-linear morphism of abelian schemes. We must show that $u$ lifts uniquely to an $R$-linear morphism $\widetilde{u}: A_T \rightarrow B_T$. The uniqueness is automatic by infinitesimal rigidity \cite[Lemma 2.2.2.1]{Lansthesis}, so we must show existence. For any such $u$, the induced map $u_*: \mathbbm{D}_A(T_0) \rightarrow \mathbbm{D}_B(T_0)$ on de Rham homology lifts uniquely to a map $\widetilde{u}_*: \widetilde{\mathbbm{D}}_A(T) \rightarrow \widetilde{\mathbbm{D}}_B(T)$ of $\mathcal{O}_T$-modules \cite[2.1.6.4]{Lansthesis}. The morphism $u$ lifts to a $\widetilde{u}: A_T \rightarrow B_T$ if and only if $\widetilde{u}_*$ respects the Hodge filtrations \cite[2.1.6.9]{Lansthesis}. By Proposition \ref{Dfree}, we must show $\widetilde{u}_*(J_\Phi \widetilde{\mathbbm{D}}_A(T))\subset J_\Phi\widetilde{\mathbbm{D}}_B(T)$. This follows from $J_\Phi \subset R\otimes{\calO_L}$, and the fact that $\widetilde{u}_*$ is $R \otimes {\calO_L}$-linear. It is $R$-linear since $u$ is, and ${\calO_L}$-linear since it's a morphism of $\mathcal{O}_{T}$-modules and the action of ${\calO_L}$ is via ${\calO_L} \rightarrow \calO_S \rightarrow \mathcal{O}_T$. This shows $\mathcal{H} \rightarrow S$ is formally \'etale.

To show $\mathcal{H} \rightarrow S$ is locally of finite presentation, let $\{T_i\}_{i\in I}$ be a filtered inverse system of affine $S$-schemes, and put $T=\varprojlim T_i$. We must show $\varinjlim \mathcal{H}(T_i) = \mathcal{H}(T)$.

Note that we can assume $T$ and $T_i$ are all connected. That's because if
$T=\coprod T_\alpha$ is the connected component decomposition of $T$, it
induces a decomposition of the maps $T \rightarrow T_i$ and $T_i \rightarrow T_j$ into maps
on connected affine schemes $T_\alpha \rightarrow T_{\alpha,i}$ and $T_{\alpha,i} \rightarrow
T_{\alpha,j}$ which are all compatible for each fixed index $\alpha$. It's easy
to check that $T_\alpha = \varprojlim T_{\alpha,i}$. Since $\mathcal{H}(T) = \coprod
\mathcal{H}(T_\alpha)$, it's enough to show $\mathcal{H}(T_{\alpha}) = \varinjlim
\mathcal{H}(T_{\alpha,i})$ for each $\alpha.$ Thus we assume $T$, $T_i$ are connected.

We fix an $R$-linear isogeny $\psi: B \rightarrow A$, which exists since $\mathrm{Hom}_R(A,B)\neq 0$, and $A, B$ are CM. For any connected $S$-scheme $U$ we define
$$ \tau_U: \mathcal{H}(U) \rightarrow R,\ \ \ (\varphi: A_U \rightarrow B_U) \mapsto \iota_{U}^{-1}(\psi_U \circ \varphi),$$
which is injective since each $\psi_U$ is an isogeny, and for $U$ connected $\iota_U: R \rightarrow \mathrm{End}_R(A_U)$ is an isomorphism. Then the maps $\tau_{T_i}$ identify $\{\mathcal{H}(T_i)\}_{i_\in I}$ with a filtered direct system of ideals of $R$ where the transition maps are inclusions. Any such system is eventually constant since $R$ is noetherian. Thus there exists an index $j\in I$ such that $\varinjlim \mathcal{H}(T_i) = \mathcal{H}(T_j)$ and $\mathcal{H}(T_j) \rightarrow \mathcal{H}(T)$ is an isomorphism. This shows $\mathcal{H} \rightarrow S$ is locally of finite presentation. Since it is also formally \'etale, $\mathcal{H} \rightarrow S$ is \'etale. Furthermore, $\mathcal{H} \rightarrow S$ is also surjective, since it admits a section, namely the identity section of $\mathcal{H}$ as a group scheme.

It follows that there is a universal morphism $\Phi: A_\mathcal{H} \rightarrow B_\mathcal{H}$, and that the given $R$-morphism $\phi_s: A_s \rightarrow B_s$ is obtained from it by base change via a unique $S$-scheme morphism $\rho_s: \operatorname{Spec} k(s) \rightarrow \mathcal{H}$. Let $u\in \mathcal{H}$ be the image of this morphism, and $U\subset \mathcal{H}$ a connected open subscheme containing $u$, so that we can consider $\rho_s$ as a map $\operatorname{Spec} k(s) \rightarrow U$. Then the restriction $\Phi_U: A_U \rightarrow B_U$ of the universal morphism $\Phi$ is a lift of $\phi_s: A_s \rightarrow B_s$ to an \'etale neighbourhood $(U,u)$ of $(S,s)$. If $V\subset S$ is the open image of $U \rightarrow S$, we claim that $\Phi_U$ descends to a map $\phi_V: A_V \rightarrow B_V$. Let $\phi_1, \phi_2 \in \mathrm{Hom}_R(A_{U\times U},B_{U\times U})$ denote the pullbacks of $\Phi_U$ via the two projections $U\times U \rightarrow U$. We must show $\phi_1 = \phi_2$. Since the map $\mathrm{Hom}_R(A,B) \rightarrow \mathrm{Hom}_R(A_s,B_s)$ is an injection of rank-one projective $R$-modules, there's a positive integer $n$ such that $n\phi_s: A_s \rightarrow B_s$ lifts to a morphism $\phi': A\rightarrow B$. Then the base change $\phi'_U: A_U \rightarrow B_U$ of $\phi'$ via $U \rightarrow S$ must coincide with $n\Phi_U$, because they both lift $n\phi_s$, and $U$ is connected. Let $\phi'_1$, $\phi'_2 \in \mathrm{Hom}_R(A_{U\times U},B_{U\times U})$ denote the two pullbacks of $\phi'_U$ via the two projections $U\times U \rightarrow U$. Since $\phi'_U$ descends to an $S$-morphism $\phi': A \rightarrow B$, we have $\phi'_1 = \phi'_2$. Since $\phi'_U = n\Phi_U$, that means $n\phi_1 = n\phi_2$, so that $n(\phi_1 - \phi_2)=0$ in $\mathrm{Hom}_R(A_{U\times U},B_{U\times U})$. As the latter is torsion-free, we have $\phi_1 = \phi_2$, so that $\Phi_U: A_U \rightarrow B_U$ descends to a map $\phi_V: A_V \rightarrow B_V$ extending $\phi_s: A_s \rightarrow B_s$.

We have shown that a given morphism $\phi_s: A_s \rightarrow B_s$ defined at a point
$s\in S$ can be extended to an open neighbourhood $V\subset S$. Next we show it
can be extended to all of $S$. Let $r\in R$ denote $\tau_s(\phi_s) =
\iota_s^{-1}(\psi_s \circ \phi_s)$ where $\psi: B \rightarrow A$ and $\tau_s$
are
as before. We define the subset $S_r\subset S$ by
$$ S_r = \{ x\in S : \exists \phi_x\in \mathrm{Hom}_R(A_x,B_x),\ \ \tau_x(\phi_x)=r\}.$$

We claim that it's enough to show $S=S_r$. By what we have already proved that would imply there is an open cover $\{V_\alpha\}_{\alpha\in I}$ of $S$ consisting of connected open subsets of $S$, such that over each $V_\alpha$ there exists a morphism $\phi_\alpha: A_{V_\alpha} \rightarrow B_{V_\alpha}$ with $\tau_{V_\alpha}(\phi_\alpha)=r$. To show that all these morphisms glue together to a single morphism $\phi: A \rightarrow B$ we need to show they coincide on overlaps $V_{\alpha\beta}=V_\alpha \cap V_\beta$. Suppose $\phi_\alpha: A_{V_\alpha} \rightarrow B_{V_\alpha}$ and $\phi_\beta: A_{V_\beta} \rightarrow B_{V_\beta}$ are two such morphisms extending $\phi_x:A_x \rightarrow B_x$ and $\phi_y: A_y \rightarrow B_y$ for $x\in V_\alpha$ and $y \in V_\beta$, and that $V_{\alpha \beta} \neq \emptyset$. Then for any connected component $U$ of $V_{\alpha\beta}$ we have $\tau_{U}(\phi_\alpha |_U) = \tau_{V_\alpha}(\phi_\alpha) = r = \tau_{V_\beta}(\phi_\beta) = \tau_{U}(\phi_\beta|_U)$. Since $\tau_{U}$ is injective, that shows $\phi_\alpha|_U = \phi_\beta|_U$ and it follows that $\phi_\alpha|_{V_{\alpha\beta}} = \phi_\beta|_{V_{\alpha\beta}}$ as required. Then the family $\{\phi_{\alpha}\}_{\alpha \in I}$ glues to a single morphism $\phi: A \rightarrow B$ which extends $\phi_s : A_s \rightarrow B_s$.

It remains to prove $S=S_r$. First we assume $S$ is irreducible. Since $S_r$ is a non-empty open subset of $S$, it contains its generic point $\eta$. Let $x \in S$ be any other point. Then there exists a discrete valuation ring $D$ and a map $\operatorname{Spec} D \rightarrow S$ such that the generic point $\eta_0$ of $\operatorname{Spec} D$ is mapped to $\eta$, the special point $x_0$ is mapped to $x$, and the extension $k(\eta_0)/k(x_0)$ is identified with $k(\eta)/k(x)$. For simplicity we pretend $\eta_0 = \eta$ and $x_0 = x$. Let $A_D$ and $B_D$ denote the base change of $A$ and $B$ to $\operatorname{Spec} D$. Since $A_D$ and $B_D$ are abelian schemes, they are N\'eron models for their generic fibers $A_\eta$ and $B_\eta$. Since $\eta\in S_r$, there is a homomorphism $\phi_\eta : A_\eta \rightarrow B_\eta$ over $k(\eta)$ such that $\tau_{\eta}(\phi_\eta) = r$. By the N\'eron mapping property $\phi_\eta$ lifts to a homomorphism $\phi_D: A_D \rightarrow B_D$ over $\operatorname{Spec} D$, with $\tau_{\operatorname{Spec} D}(\phi_D)=\tau_{\eta}(\phi_\eta)=r$. Then base change to the special fiber induces a homomorphism $\phi_x : A_x \rightarrow B_x$ over $k(x)$ with $\tau_{x}(\phi_x)= \tau_{\operatorname{Spec} D}(\phi_D)=r$, which shows $x\in S_r$. Since $x\in S$ was arbitrary this shows $S=S_r$.

Now assume $S$ is connected and noetherian, and let $Z$ be an irreducible component. If $Z_r = Z \cap S_r$ is non-empty, by the irreducible case we have $Z\subset S_r$. Then $S$ is a disjoint union of two closed subsets: the union of the (finitely many) irreducible components intersecting $S_r$ and the union of the other components. Since the former is non-empty and $S$ is connected we have $S=S_r$.

Finally suppose $S$ is a connected locally noetherian scheme as in the statement. Since $S_r$ is non-empty and open, it's enough to show it's also closed. Suppose $c\in S$ is a point in the boundary of $S_r$. If $T$ is a connected noetherian open subscheme of $S$ containing $c$, then $T_r = T\cap S_r$ is non-empty, therefore $T=T_r$ and $c\in T \subset S_r$. Then $S_r$ contains its boundary, and is therefore closed. Since $S$ is connected it follows that $S=S_r$ as required.
\end{proof}

Now let $S\in \mathrm{Sch}_{/{\calO_L}}$ be connected, and suppose $(A,\iota,\lambda)$ and $(B,\jmath,\mu)$ are objects in $\mathcal{M}_\Phi^1(S)$. In a moment we will show that the $R$-module $\mathrm{Hom}_R(A,B)$ can always be equipped with a positive-definite non-degenerate $R$-hermitian structure, by applying the above proposition to reduce to the complex case. To do this, we set up a few preliminaries.

We have an isomorphism of abelian groups
\begin{equation}\label{rosati} \mathrm{Hom}_R(A,B) \xrightarrow{\raisebox{-5pt}{$\sim$}} \mathrm{Hom}_R(B,A),\ \ \ f\mapsto f' \overset{\mathrm{def}}{=} \lambda^{-1}\circ f^\vee \circ \mu.\end{equation}
This isomorphism depends on the choice of principal polarizations $\lambda$ and $\mu$, but it is compatible with other choices via uniquely induced $R$-linear automorphisms. Then up to canonical identifications, the family of maps $f\mapsto f'$ defined for each pair $A$ and $B$ occurring in triples in $\mathcal{M}_\Phi^1(S)$, satisfies $(f')'=f$ and $(f\circ g)' = g'\circ f'$. On each $\mathrm{End}_R(A)$, it coincides with the Rosati involution induced by $\lambda$. Thus we justify the following.

\begin{defn} \label{Rosdual} For $f\in \mathrm{Hom}_R(A,B)$, $f'\in \mathrm{Hom}_R(B,A)$ as above is called the \textbf{Rosati dual} of $f$.
\end{defn}

The $R$-linearity condition on principal polarizations implies that the isomorphism (\ref{rosati}) is $R$-antilinear. It follows that to equip $\mathrm{Hom}_R(A,B)$ with a sesquilinear form
$$ H: \mathrm{Hom}_R(A,B) \times \mathrm{Hom}_R(A,B) \rightarrow R,$$
it's enough to find an $R$-bilinear map
$$ P: \mathrm{Hom}_R(A,B) \times \mathrm{Hom}_R(B,A) \rightarrow R,$$
and set $H(f_1,f_2) = P(f_2, f_1')$. Such a bilinear map in turn corresponds to an $R$-linear homomorphism $\pi: \mathrm{Hom}_R(A,B)\otimes_R \mathrm{Hom}_R(B,A) \rightarrow R$. Then $H$ is non-degenerate if and only if $P$ is a perfect pairing, if and only if $\pi$ is an isomorphism. As $\mathrm{Hom}_R(A,B)$ and $\mathrm{Hom}_R(B,A)$ are projective of rank one, that happens if and only if $\pi$ is \textit{surjective}. The sesquilinear form $H$ is hermitian if and only if $P(f,g)=P(g',f')^\sigma$, and positive-definite if and only if $P(f, f')\in R$ is totally positive.

If we identify $R$ with $\mathrm{End}_R(A)$ via $\iota$, composition of morphisms gives a natural $R$-linear map
\begin{align}\label{pidef}\pi: \mathrm{Hom}_R(A,B) \otimes_R \mathrm{Hom}_R(B,A) \rightarrow R,\ \ \pi(f \otimes g) = \iota^{-1}(g \circ f).\end{align}
We note that using $\jmath$ would give the same construction, since in fact
\begin{align}\label{i=j}
\iota^{-1}(g \circ f) =\jmath^{-1}(f \circ g).
\end{align}
Indeed, let $s=\iota^{-1}(g \circ f)$ and assume $g\neq 0$, the equality being otherwise trivial. Since $g$ is $R$-linear, we have $g \circ f \circ g = \iota(s) \circ g = g \circ \jmath(s)$. Since $g$ is an isogeny, that implies $f\circ g = \jmath(s)$, so $\jmath^{-1}(f\circ g) = s = \iota^{-1}(g\circ f)$.

Since $\iota$ maps complex conjugation to the Rosati involution, for $f\in \mathrm{Hom}_R(A,B)$, $g\in \mathrm{Hom}_R(B,A)$, we also have
$$P(g',f')^\sigma = (\iota^{-1}(g'\circ f'))^\sigma = \iota^{-1}((g'\circ f')')=\iota^{-1}(f\circ g) = P(f,g).$$
Hence the corresponding sesquilinear form $H$ on $\mathrm{Hom}_R(A,B)$ is hermitian. It is also positive-definite: for a non-zero $\phi \in \mathrm{Hom}_R(A,B)$ we have $\phi' \circ \phi = \lambda^{-1} \circ \phi^\vee \circ \mu  \circ \phi$. As $\phi$ is an isogeny, $\phi^\vee \circ \mu \circ \phi = \lambda \circ (\phi' \circ \phi)$ is a polarization on $A$. By Corollary \ref{ampcor}, $\phi' \circ \phi \in \mathrm{End}_R(A)$ is positive in $\mathrm{End}_S(A)\otimes\mathbbm{R}$, and so $H(\phi,\phi)=\iota^{-1}(\phi' \circ \phi)$ is totally positive in $R$. Now, the map $\pi$ may not be surjective, so the positive-definite hermitian form $H$ obtained this way is not always non-degenerate. Nevertheless, we have the following.

\begin{prop}\label{prinhom}
Let $(A,\iota,\lambda)$, $(B,\jmath,\mu)$ $\in \mathcal{M}_\Phi^1(S)$, with $\mathrm{Hom}_R(A,B)\neq 0$. The image of $$\pi: \mathrm{Hom}_R(A,B)\otimes_R \mathrm{Hom}_R(B,A) \rightarrow R,\ \ \ f \otimes g \mapsto \iota^{-1}(g \circ f),$$
is a principal ideal of $R$, generated by a totally positive element.
\end{prop}
\begin{proof}
Let $\psi\in \mathrm{Hom}_R(A,B)$ be a fixed non-zero map, and put $N=\iota^{-1}(\psi'\circ \psi)$. As noted in the previous paragraph, $N$ is a totally positive element of $R$. Define $R$-module embeddings
$$ \alpha: \mathrm{Hom}_R(A,B) \hra R,\ \ \ f \mapsto \iota^{-1}(\psi'\circ f),$$
$$ \beta: \mathrm{Hom}_R(B,A) \hra R, \ \ \ g \mapsto \iota^{-1}(g \circ \psi),$$
and let $\mathfrak{c}$ denote the image of $\alpha$ in $R$. Since $\iota$ intertwines complex conjugation $\sigma$ on $R$ with the Rosati involution on $\mathrm{End}_R(A)$, we have
$$\beta(f') = \iota^{-1} ( f' \circ \psi) = \iota^{-1} ( (\psi' \circ f)') = \alpha(f)^\sigma.$$
Then since $f\mapsto f'$ is a bijection, the image of $\beta$ in $R$ is $\mathfrak{c}^\sigma$. We claim that the following diagram is commutative:
\begin{align*}
\begin{xymatrix}{ \mathrm{Hom}_R(A,B) \otimes_R \mathrm{Hom}_R(B,A) \ar[d]_{\alpha\otimes \beta} \ar[rr]^-{f\otimes g \mapsto g\circ f} && \mathrm{End}_R(A)\ar[d]^{N \iota^{-1}}\\
\mathfrak{c}\otimes_R \mathfrak{c}^\sigma \ar[rr]_{x\otimes y \mapsto xy} && R.}
\end{xymatrix}
\end{align*}
First, using $R$-linearity of $\psi$ and (\ref{i=j}) we have
$$\psi \circ g \circ f = \psi \circ \iota(\iota^{-1}(g \circ f)) = \jmath(\iota^{-1}(g\circ f))\circ \psi = f \circ g \circ \psi,$$
then using the above
$$ N\pi(f\otimes g) = N\iota^{-1} (g \circ f) = \iota^{-1}(\psi' \circ \psi \circ g \circ f) = \iota^{-1}(\psi' \circ f \circ g \circ \psi) = \alpha(f) \beta(g).$$

It follows that the image of $\pi$ is $\mathfrak{c} \mathfrak{c}^\sigma N^{-1}$. Since $N$ is totally positive, this shows the statement of the proposition is equivalent to triviality of $N_{K/F}(\mathfrak{c}) = (\mathfrak{c} \mathfrak{c}^\sigma)\cap {\calO_F}$ in the narrow class group of $F$. As this only depends on the class of $\mathfrak{c}$ in the ideal class group of $K$, it's enough to verify it for any fractional ideal of $K$ isomorphic to $\mathrm{Hom}_R(A,B)$. This we do by reduction to the complex case.

By Theorem \ref{hombij}, we can assume $S=\operatorname{Spec} k$, for some algebraically
closed field $k$. If $k$ has positive characteristic, by Theorem \ref{etprop}
(in this case due to B. Howard \cite[Thm. 2.1.3]{unitary1}), we can lift the
triples in $\mathcal{M}_\Phi^1$ to characteristic zero. Once in characteristic zero,
the standard argument of descending to a finitely generated extension of the
base field allows us to embed the field of definition in $\mathbbm{C}$. Thus we may
assume $A$ and $B$ are complex abelian varieties.

The following facts about complex abelian varieties with complex multiplication are taken from \cite[IV-V]{ShimuraCM}. We fix an ordering $\Phi=\{\phi_1,\cdots, \phi_g\}$ of the CM-type $\Phi$. For a fractional ideal $\mathfrak{a} \subset K$, we set
\begin{equation} \label{phia} \Phi(\mathfrak{a}) = \{ (\phi_1(a),\cdots, \phi_g(a))\in \mathbbm{C}^g: a\in \mathfrak{a}\}.\end{equation}
Then $\Phi(\mathfrak{a})$ is a lattice in $\mathbbm{C}^g$, isomorphic to $\mathfrak{a}$ as an $R$-module. Since $A$ and $B$ have CM by the full ring of integers $R$ of $K$, of type $\Phi$, there are fractional ideals $\mathfrak{a}$, $\mathfrak{b}$ of $K$ such that $A(\mathbbm{C})\simeq \mathbbm{C}^g/\Phi(\mathfrak{a})$ and $B(\mathbbm{C})\simeq \mathbbm{C}^g/\Phi(\mathfrak{b})$ as complex tori.

Given an $R$-linear map $\phi\in \mathrm{Hom}_R(A,B)$, by passing to the universal cover one obtains an $R$-linear transformation $\mathbbm{C}^g \rightarrow \mathbbm{C}^g$, with the action of $r\in R$ on $\mathbbm{C}^g$ given by $(z_1,\cdots,z_g)\mapsto (\phi_1(r)z_1,\cdots,\phi_g(r)z_g)$. The transformation is determined by its restriction to $\Phi(\mathfrak{a})$, which takes values in $\Phi(\mathfrak{b})$. Now any $R$-linear homomorphism $\mathfrak{a} \rightarrow \mathfrak{b}$ must be multiplication by some element in $\mathfrak{b} \mathfrak{a}^{-1}$. Conversely, any such element gives rise to an $R$-linear homomorphism $A \rightarrow B$. In other words, our specific complex uniformizations of $A$ and $B$ provide isomorphisms of $R$-modules $\mathrm{Hom}_R(A,B) \simeq \mathfrak{b} \mathfrak{a}^{-1}$ and $\mathrm{Hom}_R(B,A)\simeq \mathfrak{a} \mathfrak{b}^{-1}$.

The dual abelian variety $A^\vee$ is isomorphic, as a complex torus, to $\mathbbm{C}^g/\Phi(\mathfrak{a}^*)$, where
$$\mathfrak{a}^* = \{ x\in K: \operatorname{Tr}_{K/\mathbbm{Q}}(x \mathfrak{a}^\sigma) \subset \mathbbm{Z}\} =  (\mathfrak{a}^\sigma \delta_K)^{-1},$$
and $\delta_K$ is the different ideal of $K/\mathbbm{Q}$. An $R$-linear homomorphism $A \rightarrow A^\vee$ then corresponds to an element $\zeta \in (\mathfrak{a} \mathfrak{a}^\sigma \delta_K)^{-1}$. Such a map is a polarization if and only if
\begin{align}\label{polzeta} \zeta^\sigma = -\zeta,\ \ \text{and}\ \ \Im \phi_i(\zeta) > 0,\ \ \ i = 1,\cdots g,\end{align}
where $\Im(z)$ denotes the imaginary part of $z\in \mathbbm{C}$. In order for the polarization to be principal, $\zeta$ must further satisfy $\zeta \mathfrak{a}  = (\mathfrak{a}^\sigma \delta_K)^{-1}$.

Now let $\zeta$ and $\zeta'$ be elements of $K$ corresponding to $\lambda: A \rightarrow A^\vee$ and $\mu: B \rightarrow B^\vee$, so that
$$ \zeta \mathfrak{a} = (\mathfrak{a}^\sigma \delta_K)^{-1},\ \ \ \zeta' \mathfrak{b} = (\mathfrak{b} ^\sigma \delta_K)^{-1}.$$
Then $ \mathfrak{b}\frakb^\sigma(\mathfrak{a}\fraka^\sigma )^{-1} = (\zeta' \zeta^{-1}),$ so that $N_{K/F}(\mathfrak{b} \mathfrak{a}^{-1})$ is a principal ideal generated by $\zeta' \zeta^{-1}$. The conditions (\ref{polzeta}) on $\zeta$ and $\zeta'$ together imply that $\zeta' \zeta^{-1}$ is a totally positive element of $F$. In other words, $N_{K/F}(\mathfrak{b} \mathfrak{a}^{-1})$ is trivial in the narrow class group of $F$, which was enough to prove the proposition.
\end{proof}

The following corollary is an immediate consequence.

\begin{cor}\label{hermhom}
Let $(A,\iota,\lambda)$, $(B,\jmath,\mu)$ $\in\mathcal{M}_\Phi^1(S)$ with $\mathrm{Hom}_R(A,B)\neq 0$. If $N$ is a totally positive generator of the ideal in Proposition \ref{prinhom}, then
$$ \mathrm{Hom}_R(A,B) \times \mathrm{Hom}_R(A,B) \rightarrow R,\ \ \ (f,g) \mapsto \iota^{-1}(f' \circ g) N^{-1}$$
is a positive-definite non-degenerate $R$-hermitian form on $\mathrm{Hom}_R(A,B)$.\hfill $\Box$
\end{cor}

Now we begin the task of describing the morphisms in $\mathcal{M}_\Phi^n(S)$ between objects arising from Serre's tensor construction. Let $(M,h)$, $(N,k) \in \mathrm{Herm}_n(R)$ and $(A,\iota,\lambda)$, $(B,\jmath,\mu) \in \mathcal{M}_\Phi^1(S)$, for a fixed connected locally noetherian scheme $S\in \mathrm{Sch}_{/{\calO_L}}$. Let
\begin{equation}\label{psi}  \Psi: (M,h)\otimes (A,\iota,\lambda) \rightarrow (N,k)\otimes (B,\jmath,\mu),\end{equation}
be a morphism in $\mathcal{M}_\Phi^n$. In general, $\Psi$ may not be a pure tensor of the form $f \otimes \phi$, for any $R$-linear homomorphisms $f: M \rightarrow N$ and $\phi: A \rightarrow B$. Furthermore, even when $\Psi=f \otimes \phi$, the maps $f$ and $\phi$ may not be morphisms in $\mathrm{Herm}_n(R)$ and $\mathcal{M}_\Phi^1(S)$, i.e. structure-preserving isomorphisms. In that case, the situation is as follows.

\begin{lemma}\label{pureten} Let $(M,h)$, $(N,k) \in \mathrm{Herm}_n(R)$, and $(A,\iota,\lambda)$, $(B,\jmath,\mu) \in \mathcal{M}_\Phi^1(S)$. Suppose that $f: M \rightarrow N$ and $\phi: A \rightarrow B$ are $R$-linear homomorphisms, such that $f\otimes \phi: (M,h) \otimes (A,\iota,\lambda) \rightarrow (N,k) \otimes (B,\jmath,\mu)$ is a morphism in $\mathcal{M}_\Phi^n(S)$. Then there exists a totally real unit $r\in R^\times$ such that
$$ f: (M,h) \rightarrow (N,r\cdot k)\ \ \text{and}\ \ \phi: (A,\iota,\lambda) \rightarrow (B,\jmath,r^{-1} \cdot \mu)$$
are morphisms in $\mathrm{Herm}_n(R)$ and $\mathcal{M}_\Phi^1(S)$, respectively.
\end{lemma}
\begin{proof}
Since $f\otimes \phi$ is a morphism in $\mathcal{M}_\Phi^n(S)$, we have
$$h\otimes \lambda = (f\otimes \phi)^\vee \circ (k \otimes \mu) \circ (f\otimes \phi) = (f^\vee \otimes \phi^\vee ) \circ (k\otimes \mu) \circ (f \otimes \phi) = (f^\vee \circ k \circ f) \otimes (\phi^\vee \circ \mu \circ \phi).$$
As $\lambda$ is principal, it generates the $R$-module $\mathrm{Hom}_R(A,A^\vee)$, so for some $r\in R$ we have
\begin{equation} \label{tenpb} \phi^\vee \circ \mu \circ \phi = r\cdot \lambda,\ \ \ h = r\cdot (f^\vee \circ k \circ f).\end{equation}

Now we have
$$M^\vee \supseteq \operatorname{im}(f^\vee \circ  k \circ f) \supseteq r \cdot \operatorname{im}(f^\vee\circ k \circ f) = \operatorname{im}(h),$$
where $\operatorname{im}(\cdot)$ denotes the image of a map. But since $h$ as an isomorphism is surjective, we have $\operatorname{im}(h)=M^\vee$. Therefore the above containments are equalities, and so $$M^\vee = \operatorname{im}(h) = r \cdot \operatorname{im}(f^\vee \circ k \circ f) = rM^\vee.$$
By Nakayama's lemma, $M^\vee=rM^\vee$ implies $r$ is a unit in $R$. Now, the map $\phi: A \rightarrow B$ is an isogeny, so $\phi^\vee \circ \mu \circ \phi = r\cdot \lambda =  \lambda \circ \iota(r)$ is a polarization on $A$. By Corollary \ref{ampcor}, $r$ must be totally positive.

On the other hand, since $r$ is a unit and $\lambda$ is an isomorphism, so is $\lambda \circ \iota(r) = \phi^\vee \circ \mu \circ \phi$. In particular, the isogeny $\phi$ is injective, and is therefore an isomorphism. The map $R \rightarrow \mathrm{Hom}_R(A,B),\ r \mapsto \phi\circ \iota(r)$ is then an isomorphism of $R$-modules, and by Proposition \ref{homprop}(c), so is
$$ \mathrm{Hom}_R(M,N) \rightarrow \mathrm{Hom}_R(M\otimes_R A,N\otimes_R B),\ \ \ g \mapsto g\otimes \phi.$$
Since $f$ maps to an isomorphism $f\otimes \phi$ on the right hand side, it must itself be an isomorphism of modules. Finally, as $r\in R$ is a totally positive unit, $(N,r \cdot k)$ and $(B,\jmath,r ^{-1}\cdot \mu)$ are objects of $\mathrm{Herm}_1(R)$ and $\mathcal{M}_\Phi^1(S)$. The relation $(\ref{tenpb})$ now shows that $f$ and $\phi$ are structure-preserving, hence morphisms in $\mathrm{Herm}_n(R)$ and $\mathcal{M}_\Phi^1(S)$ as claimed.
\end{proof}

As noted above, a given morphism $\Psi: (M,h)\otimes (A,\iota,\lambda) \rightarrow (N,k) \otimes (B,\jmath, \mu)$ in $\mathcal{M}_\Phi^n(S)$ may not be a pure tensor of the form $f\otimes \phi$. However, we will show that it can always be written as a composition of a pure tensor with a morphism of a particular type, which we now construct.

Let $(\mathfrak{a},\alpha) \in \mathrm{Herm}_1(R)$ and suppose $(\mathfrak{a}',\alpha') \in \mathrm{Herm}_1(R)$ is an inverse of $(\mathfrak{a},\alpha)$, meaning there exists an isomorphism
\begin{align}\label{kappa}\kappa: (\mathfrak{a},\alpha)\otimes_R (\mathfrak{a}',\alpha') \xrightarrow{\raisebox{-5pt}{$\sim$}} (R,\mathbbm{1}).\end{align}
Let $(N',k') = (N,k)\otimes_R (\mathfrak{a},\alpha)$ and $(B',\lambda',\mu') =(\mathfrak{a}',\alpha')\otimes (B,\lambda,\mu)$. Then we have an isomorphism
\begin{equation}\label{omega_k} \omega_\kappa: (N',k')\otimes (B',\jmath',\mu') \rightarrow (N,k) \otimes (B,\jmath,\mu),\end{equation}
given on $T$-valued functorial points by
$$ (\omega_\kappa)_T: (N\otimes_R \mathfrak{a})\otimes_R (\mathfrak{a}' \otimes_R B(T)) \rightarrow N\otimes_R B(T),\ \ \ (n\otimes x)\otimes (y \otimes t) \mapsto n\otimes \kappa(x\otimes y)\cdot t.$$

The map $\omega_\kappa$ is evidently an $R$-linear isomorphism of abelian schemes. In fact, it is also an isomorphism of triples, which is to say $\omega_\kappa^\vee \circ (k\otimes \mu) \circ \omega_\kappa = k'\otimes \mu'$. Verifying this amounts to showing the dual of a canonical associator isomorphism $(M_0\otimes_R N_0) \otimes_R A_0 \rightarrow M_0 \otimes(N_0 \otimes_R A_0)$, is identified under Proposition \ref{duality} with the canonical associator $M_0^\vee \otimes (N_0^\vee \otimes_R A_0^\vee) \rightarrow (M_0^\vee \otimes N_0^\vee) \otimes_R A_0^\vee$. This can be checked using the explicit formula for the identification, stated in Proposition \ref{duality}.

The morphism $\omega_\kappa$ above is in general not a pure tensor. Indeed, assume $\omega_\kappa = f\otimes \phi$. By Lemma \ref{pureten}, $\phi: B'=\mathfrak{a}'\otimes_R B \rightarrow B$ must be an $R$-linear isomorphism, which implies $\mathfrak{a}' \simeq R$ (say by considering $B$-valued points), therefore also $\mathfrak{a} \simeq R$. This shows if the rank-one projective $R$-module $\mathfrak{a}$ is not free, the map $\omega_\kappa$ will never be a pure tensor.

Suppose we have a general morphism $\Psi$ in $\mathcal{M}_\Phi^n$ of the form (\ref{psi}). We will show that $\Psi$ can be written as $\omega_\kappa \circ (f\otimes \phi)$. Now, $\omega_\kappa$ depends on a pair of inverse objects $(\mathfrak{a},\alpha)$, $(\mathfrak{a}',\alpha')$ $\in \mathrm{Herm}_1({\calO_K})$, and an isomorphism $\kappa$ is as in (\ref{kappa}). By Lemma \ref{pureten}, $\phi: A \rightarrow (\mathfrak{a}'\otimes B)$ must be an isomorphism of abelian schemes. Considering $\phi$ on $A$-valued points gives $\phi_A: \mathrm{End}_R(A) \xrightarrow{\raisebox{-5pt}{$\sim$}} \mathfrak{a}' \otimes_R \mathrm{Hom}_R(A,B)$, hence $\mathfrak{a} \simeq \mathrm{Hom}_R(A,B)$, and therefore $\mathfrak{a}'\simeq \mathrm{Hom}_R(B,A)$ by Proposition \ref{prinhom}. Thus if $\Psi$ has the form $\omega_\kappa \circ (f\otimes \psi)$, with $\omega_\kappa$ depending on some $(\mathfrak{a},\alpha)$, $(\mathfrak{a}',\alpha')$, and $\kappa$, it also has that form with $\mathfrak{a} = \mathrm{Hom}_R(A,B)$ and $\mathfrak{a}' = \mathrm{Hom}_R(B,A)$. We will show that this is indeed always the case, and that furthermore there is a canonical choice for $\kappa$. For this we require the following two lemmas, the first of which is used to prove the second.

\begin{lemma}\label{lemlem} Suppose $(A,\iota)$ and $(B,\jmath)$ are abelian schemes with $R$-actions, and $\mathfrak{a}$ is a rank-one projective $R$-module. Let $\mathfrak{a}'=\mathrm{Hom}_R(\mathfrak{a},R)$ be equipped with its natural $R$-module structure (not twisted by $*$), and set $B_\mathfrak{a}=\mathfrak{a} \otimes_R B$. Then there is a commutative diagram
$$\begin{xymatrix}{
\mathfrak{a} \otimes_R \mathfrak{a}' \otimes_R \mathrm{Hom}_R(A,B) \otimes_R \mathrm{Hom}_R(B,A) \ar[r]^-{\cong} \ar[d]_{\cong} & \mathrm{Hom}_R(A,B_\mathfrak{a})\otimes_R \mathrm{Hom}_R(B_\mathfrak{a},A) \ar@{->}[d]^{f\otimes g \mapsto g\circ f} \\
\mathrm{Hom}_R(A,B) \otimes_R \mathrm{Hom}_R(B,A) \ar@{->}[r]_{f\otimes g\mapsto g\circ f} & \mathrm{End}_R(A),
} \end{xymatrix}$$
where the top and left arrows are canonical isomorphisms.
\end{lemma}
\begin{proof}
We have canonical isomorphisms
$$ \mathfrak{a} \otimes_R \mathrm{Hom}_R(A,B) \cong \mathrm{Hom}_R(R,\mathfrak{a}) \otimes_R \mathrm{Hom}_R(A,B) \cong \mathrm{Hom}_R(R\otimes_R A, \mathfrak{a} \otimes_R B) \cong \mathrm{Hom}_R(A,B_\mathfrak{a}),$$
where Proposition \ref{homprop}(c) is used in the middle step. Explicitly, $a\otimes \phi \in \mathfrak{a} \otimes_R \mathrm{Hom}_R(A,B)$ is mapped to the morphism $A \rightarrow B_\mathfrak{a}$, which sends $t\in A(T)$ to $a \otimes \phi_T(t) \in B_\mathfrak{a}(T)$, for $T\in \mathrm{Sch}_{/S}$.

Similarly, there is a canonical isomorphism
$$ \mathfrak{a}'\otimes_R \mathrm{Hom}_R(B,A) = \mathrm{Hom}_R(\mathfrak{a},R) \otimes_R \mathrm{Hom}_R(B,A) \cong \mathrm{Hom}_R(\mathfrak{a} \otimes_R B, R \otimes_R A) \cong \mathrm{Hom}_R(B_\mathfrak{a}, A),$$
mapping $f \otimes \psi \in \mathfrak{a}' \otimes_R \mathrm{Hom}_R(B,A)$ to the morphism $B_\mathfrak{a} \rightarrow A$ which sends $a \otimes u \in \mathfrak{a}\otimes_R B(U)$ to $\iota(f(a)) \circ \psi_U(u)\in A(U)$, for $U\in \mathrm{Sch}_{/S}$.

We take the top arrow in the diagram to be the tensor product of the above two canonical isomorphisms. We take the left arrow to be induced by the canonical isomorphism $\mathfrak{a} \otimes_R \mathfrak{a}' \cong R$. On pure tensors it is given by $a\otimes f\otimes \phi \otimes \psi \mapsto \phi \circ \iota(f(a)) \otimes \psi$.

The composition of the left and bottom arrows maps the element $a\otimes f \otimes \phi \otimes \psi$ to $\psi \circ \phi \circ \iota(f(a))$, which is equal to $\iota(f(a))\circ \psi\circ \phi$, since $\phi$ and $\psi$ are $R$-linear. The composition of the top and right arrows maps the same element to the morphism $A \rightarrow A$ that sends $t\in A(T)$ to $\iota(f(a)) \circ \psi(\phi(t))$, for $T\in \mathrm{Sch}_{/S}$. The latter is just the functorial description of the former, so the diagram commutes.
\end{proof}

\begin{lemma}\label{twistlemma} Let $(A,\iota,\lambda)$ and $(B,\jmath,\mu)$ be objects in $\mathcal{M}_\Phi^1(S)$, such that $\mathrm{Hom}_R(A,B)\neq 0$. Let $(B',\jmath')$ denote $\mathrm{Hom}_R(B,A) \otimes_R B$, equipped with the induced $R$-action. Then:
\begin{itemize}
\item[(a)] $\mathrm{Hom}_R(A,B')\simeq R$ as $R$-modules.
\item[(b)] If $(A,\iota) \simeq (B',\jmath')$, the map
$$ \mathrm{Hom}_R(A,B)\otimes_R \mathrm{Hom}_R(B,A) \longrightarrow \mathrm{End}_R(A),\ \ \ f\otimes g \mapsto g\circ f$$
is an isomorphism of $R$-modules.
\end{itemize}
\end{lemma}
\begin{proof}
Using $A\cong R \otimes_R A$ and Proposition \ref{homprop}(c) we obtain a canonical isomorphism
\begin{align}\label{HomABp}
\mathrm{Hom}_R(A,B')&\cong\mathrm{Hom}_R(R\otimes_R A,\mathrm{Hom}_R(B,A)\otimes_R B) \cong \mathrm{Hom}_R(B,A) \otimes_R \mathrm{Hom}(A,B).
\end{align}
By Proposition \ref{prinhom}, composition of morphisms identifies the right hand side above with a principal ideal in $\mathrm{End}_R(A)\simeq R$. This shows (a).

For (b), by Lemma \ref{lemlem} we have a canonical isomorphism
\begin{flalign*}
&\mathrm{Hom}_R(A,B')\otimes_R \mathrm{Hom}_R(B',A) \cong \mathrm{Hom}_R(A,B) \otimes_R \mathrm{Hom}_R(B,A)
\end{flalign*}
which is compatible with the two maps $f\otimes g \mapsto g\circ f$ from either side to $\mathrm{End}_R(A)$. Thus both sides are identified with the same ideal of $\mathrm{End}_R(A)$. If $\phi:  (A,\iota) \rightarrow (B',\jmath')$ is an isomorphism, this ideal contains the image of $\phi \otimes \phi^{-1}$ from the left-hand side, which is $\mathbbm{1}_A \in \mathrm{End}_R(A)$, so the image of $f \otimes g \mapsto g \circ f$ is the entire ring. This proves (b).
\end{proof}

\begin{comment}
We would like to characterize the morphisms
\[ \Psi: (M\otimes_R A, \iota_M, h \otimes \lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N\otimes_R B, \jmath_N, k\otimes \mu)\]
between the corresponding objects in $\mathcal{M}_\Phi^n$ arising from Serre's construction. Because of the existence of associator morphisms for the Serre tensor product, such a $\Psi$ is not always a pure tensor of the form $f\otimes \phi$. On the other hand, we have a a criterion for detecting when $\Psi$ does take that form, in the following lemma.

\begin{lemma}\label{bootstrap0}
Suppose
$$\Psi: (M\otimes_R A, \iota_M,h \otimes \lambda)\xrightarrow{\raisebox{-5pt}{$\sim$}} (N\otimes_R B, J, M),$$
is a morphism in $\mathcal{M}_\Phi^n(S)$, and that $\mathrm{Hom}_R(A,B)$ is a free $R$-module of rank 1. Then there exists a polarization $\mu_0: B \rightarrow B^\vee$, a non-degenerate positive-definite $R$-hermitian structure $k_0$ on $N$, and isomorphisms
\[ f: (M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N,k_0),\ \ \ \phi: (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (B,\jmath,\mu_0),\]
such that $J = \jmath_{N}$, $M = k_0 \otimes \mu_0$, and $\Psi = f \otimes \phi$.
\end{lemma}
\begin{proof}
Since $\mathrm{Hom}_R(A,B)\simeq R$, it follows from Proposition \ref{homprop}(c), that if $\phi: A \rightarrow B$ is a generator of the $R$-module $\mathrm{Hom}_R(A,B)$, then $\Phi = f \otimes \phi$, for some $R$-linear map $f: M \rightarrow N$ of $R$-modules. Similarly, as $B$ admits a principal polarization $\mu$, the $R$-module $\mathrm{Hom}_R(B,B^\vee)$ is also free of rank 1, generated by $\mu$, and $M=k_0 \otimes \mu$ for some $R$-linear map $k_0: N \rightarrow N^\vee$. Since $M$ is a principal polarization, by Proposition \ref{mainprop} of section 1, $k_0$ must be a non-degenerate positive definite $R$-hermitian form on $N$.

Since $\Psi=f\otimes \phi$ is a morphism of $\mathcal{M}_\Phi^n$, it is compatible with polarizations, and so
$$ h\otimes \lambda = (f\otimes \phi)^\vee \circ (k_0 \otimes \mu) \circ (f\otimes \phi) = (f^\vee \circ k_0 \circ f) \otimes (\phi^\vee \circ \mu \circ \phi).$$
Now since $\lambda$ is a generator of $\mathrm{Hom}_R(A,A^\vee)$, it follows that for some $r\in R$ we have
$$h = f^\vee \circ k_0 \circ f \circ r,\ \ \ \ \ \phi^\vee \circ \mu \circ \phi = r \circ \lambda,$$
where we have abused notation for the action of $r\in R$. Now on the one hand $h$ is surjective, and on the other $h = r \circ f^\vee \circ k_0 \circ f$ by linearity. Therefore we have
$$ M = \operatorname{im}(h) = r \operatorname{im}(f^\vee \circ k_0 \circ f) = r\operatorname{im}(h) = rM,$$
and so $r\in R$ must be a unit by Nakayama's lemma. Thus $\phi^\vee \circ \mu \circ \phi = r\circ \lambda$ is invertible, so $\phi$ is injective, and hence being an isogeny, it is an isomorphism. Now using $\phi$ to identify $\mathrm{Hom}_R(A,B)$ with $R$, by Proposition \ref{homprop}(c), since $\Psi=f\otimes \phi$ is an isomorphism, so is $f$. It remains to show that $\phi$ and $f$ are actually morphisms in $\mathcal{M}_\Phi^1$ and $\mathrm{Herm}_n(R)$, for suitable structures $\mu_0$ and $k_0$ on $B$ and $N$.

Since $\mu$ is a principal polarization, and $\phi$ is an isomorphism, $\phi^\vee \circ \mu \circ \phi = r \circ \lambda$ is also a principal polarization, and so the unit $r$ must be totally positive. Then $r^{-1}\mu$ is also a principal polarization, and $r\circ k_0$ is also a positive-definite non-degenerate hermitian structure. Replacing $k_0$ by $rk_0$ and setting $\mu_0 = r^{-1} \mu$, we have $M=k_0 \otimes \mu_0$, and
$$ h = f^\vee \circ k_0 \circ f,\ \ \ \phi^\vee \circ \mu_0 \circ \phi = \lambda,$$
and so $\phi:(A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (B,\jmath, \mu_0)$ and $f:(M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N,k_0)$ are morphisms in $\mathcal{M}_\Phi^1(S)$ and $\mathrm{Herm}_n(R)$, as remained to show.
\end{proof}

Given a totally positive unit $r\in R^\times$, multiplication by $r$ defines a positive-definite non-degenerate $R$-hermitian structure on $R$, which is trivial if and only $r$ is of the form $u\overline{u}$ for $u\in R^\times$. We denote the corresponding object of $\mathrm{Herm}_1(R)$ by $\mathfrak{r}$, and we let $\mathfrak{r}'$ similarly correspond to multiplication by $r^{-1}$.

\begin{lemma}\label{bootstrap}
Suppose $\mathrm{Hom}_R(A,B) \simeq R$ as an $R$-module, and that
$$\Psi: (M\otimes_R A, \iota_M,h \otimes \lambda)\xrightarrow{\raisebox{-5pt}{$\sim$}} (N\otimes_R B, \jmath_N, k\otimes \mu),$$
is a morphism in $\mathcal{M}_\Phi^n(S)$. Then there exists a totally positive unit $r\in R^\times$, and isomorphisms
\[ f: (M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N,k) \otimes \mathfrak{r},\ \ \ \phi: (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} \mathfrak{r}' \otimes_R (B,\jmath,\mu),\]
such that $\Psi = \omega \circ (f \otimes \phi)$, where
$$\omega: ((N,k)\otimes_R \mathfrak{r}) \otimes (\mathfrak{r}' \otimes_R (B,\jmath,\mu)) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N\otimes_R B, \jmath_N, k\otimes \mu)$$
is the canonical isomorphism given on points by $(n\otimes a)\otimes (a'\otimes t) \mapsto (n\otimes \jmath(aa')\circ t)$.
\end{lemma}
\begin{proof}
Since $\mathrm{Hom}_R(A,B)\simeq R$, it follows from Proposition \ref{homprop}(c) that given the choice of a generator $\phi_0: A \rightarrow B$ for the $R$-module $\mathrm{Hom}_R(A,B)$, we have $\Psi = f_0 \otimes \phi_0$ for a unique $R$-linear map $f_0: M \rightarrow N$.

The map $\Psi=f_0\otimes \phi_0$ is a morphism in $\mathcal{M}_\Phi^n$, so it is compatible with polarizations:
$$ h\otimes \lambda = (f_0\otimes \phi_0)^\vee \circ (k \otimes \mu) \circ (f_0\otimes \phi_0) = (f_0^\vee \circ k \circ f_0) \otimes (\phi_0^\vee \circ \mu \circ \phi_0).$$
Since $\lambda$ generates the free $R$-module $\mathrm{Hom}_R(A,A^\vee)$, for some $r\in R$ we have
$$\phi_0^\vee \circ \mu \circ \phi_0 = r \cdot \lambda = \lambda \circ \iota(r),\ \ \ h = r\cdot 				(f_0^\vee \circ k \circ f_0) = f_0^\vee \circ k \circ f_0 \circ m_r,$$
where $m_r$ denotes multiplication by $r$. Since $h$ is an $R$-linear isomorphism, $r$ must be a unit of $R$. Indeed, this follow from Nakayama's lemma, and the observation
$$ M = \operatorname{im}(h) = r \operatorname{im}(f_0^\vee \circ k \circ f_0) = r \operatorname{im}(h) = rM,$$
where $\operatorname{im}(\cdot)$ denotes the image. Note that \textit{a priori} $\operatorname{im}(f_0^\vee \circ k \circ f_0) \supseteq \operatorname{im}(h)$, but the reverse inclusion also holds since $h$ is surjective.

Since $r$ is a unit, $\phi_0^\vee \circ \mu \circ \phi_0 = \lambda \circ \iota(r)$ is invertible, which shows $\phi_0$ is injective. Since $\phi_0: A \rightarrow B$ is an isogeny, it must be an isomorphism of abelian schemes (not necessarily of triples). On the other hand, $\phi_0^\vee \circ \mu \circ \phi_0 = \lambda \circ \iota(r)$ is a polarization, so the unit $r$ must be totally positive. That implies the map $r\cdot k: N \rightarrow N, n \mapsto r\cdot k(n)$ is another positive-definite non-degenerate $R$-hermitian form on $N$, and $\mu\circ \jmath(r^{-1}): B \rightarrow B$ is another $R$-linear principal polarization on $B$. Now using Proposition \ref{homprop}(c) again, since $\Psi=f_0\otimes \phi_0$ and $\phi_0$ are both isomorphisms, $f_0: M \rightarrow N$ is also an isomorphism of $R$-modules. On the level of structures we obtain morphisms
$$ f_0: (M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N,r\cdot k),\ \ \ \phi_0: (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (B,\jmath, \mu \circ \jmath(r^{-1})),$$
in $\mathrm{Herm}_n(R)$ and $\mathcal{M}_\Phi^1(S)$, respectively.

Now let $\mathfrak{r} = (R,m_r)$ and $\mathfrak{r}' = (R, m_{r^{-1}})$ denote objects of $\mathrm{Herm}_1(R)$ as in the statement, where here $m_r: R \rightarrow R,\ x\mapsto rx$. We have canonical isomorphisms
$$ \alpha: (N,k)\otimes (R,\mathfrak{r}) \rightarrow (N,r\cdot k), \ \ \  \beta: (R,\mathfrak{r}')\otimes (B,\jmath,\mu) \xrightarrow{\raisebox{-5pt}{$\sim$}} (B,\jmath, \mu \circ \jmath(r^{-1})),$$
arising from $N\otimes_R R \cong N$ and $R\otimes_R B \cong B$. Setting $f= \alpha^{-1}\circ f_0$ and $\phi = \beta^{-1} \circ \phi_0$, we have $\Psi = \omega \circ (f\otimes \phi)$, where $\omega$ is the map
$$\omega: ((N,k)\otimes_R \mathfrak{r}) \otimes (\mathfrak{r}' \otimes_R (B,\jmath,\mu)) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N\otimes_R B, \jmath_N, k\otimes \mu),\ \ \ (n\otimes a)\otimes (a'\otimes t) \mapsto (n\otimes \jmath(aa')\circ t),$$
as was claimed.
\end{proof}
\end{comment}

Finally, we can give an explicit description of all the morphisms between objects produced by Serre's construction in $\mathcal{M}_\Phi^n$.

\begin{thm}\label{morthm}Let $(A,\iota,\lambda)$, $(B,\jmath,\mu) \in \mathcal{M}_\Phi^1(S)$ and $(M,h)$, $(N,k)\in \mathrm{Herm}_n(R)$, and take
$$\Psi: (M,h) \otimes (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N,k) \otimes (B,\jmath,\mu)$$
to be a general morphism in $\mathcal{M}_\Phi^n$. Then there exist positive-definite non-degenerate $R$-hermitian forms $\alpha$ and $\alpha'$ on $\mathfrak{a} = \mathrm{Hom}_R(A,B)$ and $\mathfrak{a}' = \mathrm{Hom}_R(B,A)$, as well as morphisms
$$ f: (M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N, k) \otimes (\mathfrak{a}, \alpha), \ \ \ \phi: (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (\mathfrak{a}' \otimes_R \alpha') \otimes (B,\jmath,\mu), $$
in $\mathrm{Herm}_n(R)$ and $\mathcal{M}_\Phi^1$, respectively, such that $\Psi = \omega \circ (f \otimes \phi)$, where $\omega$ is the canonical isomorphism given on $T$-valued points, for $T\in \mathrm{Sch}_{/S}$, by
$$ \omega_T: (N\otimes_R \mathfrak{a}) \otimes (\mathfrak{a}' \otimes_R B(T)) \xrightarrow{\raisebox{-5pt}{$\sim$}} N\otimes_R B(T),\ \ \ (n \otimes f)\otimes (g\otimes t)\mapsto n \otimes (g\circ f \circ t),$$
\end{thm}

\begin{proof}
By Corollary \ref{hermhom} we can equip $\mathfrak{a}$ and $\mathfrak{a}'$ with hermitian structures $\alpha$, $\alpha'$, with $(\mathfrak{a},\alpha)$ and $(\mathfrak{a}',\alpha')$ in $\mathrm{Herm}_1(R)$, such that there exists \textit{some} isomorphism $\kappa: (\mathfrak{a},\alpha)\otimes_R (\mathfrak{a}',\alpha')\simeq (R,\mathbbm{1})$. In a moment we will show that there are canonical choices for $\kappa$, $\alpha$ and $\alpha'$, but for now we make a choice.

Now put
$$(B',\jmath',\mu')=(\mathfrak{a}',\alpha')\otimes(B,\jmath, \mu),\ \ \ (N',k')=(N,k)\otimes(\mathfrak{a},\alpha).$$

Then we have the isomorphism $\omega_0: (N\otimes_R \mathfrak{a})\otimes_R (\mathfrak{a}'\otimes_R B) \xrightarrow{\raisebox{-5pt}{$\sim$}} B$ of (\ref{omega_k}), which depends on $\kappa$, and is given on $T$-valued points by
$$ \omega_{0,T}: (N\otimes_R \mathfrak{a})\otimes_R (\mathfrak{a}' \otimes_R B(T)) \rightarrow N\otimes_R B(T),\ \ \ (n\otimes x)\otimes (y \otimes t) \mapsto n\otimes \kappa(x\otimes y)\cdot t.$$
Let $\Psi_0 = \omega_0^{-1} \circ \Psi$, so that
$$\Psi_0: (M,h) \otimes (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N',k') \otimes (B',\jmath',\mu').$$

By Lemma \ref{twistlemma}(a) we have $\mathrm{Hom}_R(A,B')\simeq R$. This implies, via Proposition \ref{homprop}(c), that every element of $\mathrm{Hom}_R(M\otimes_R A, N'\otimes_R B')$ is a pure tensor, including $\Psi_0$. Then by Lemma \ref{pureten} there exists a totally positive unit $r\in R^\times$ and isomorphisms
$$f: (M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N',r\cdot k'),\ \ \ \phi: (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (B',\jmath',r^{-1}\cdot \mu'),$$
in $\mathrm{Herm}_1(R)$ and $\mathcal{M}_\Phi^1(S)$, such that $\Psi_0 = f \otimes \phi$. In particular, $\Psi = \omega_0 \circ (f\otimes \phi)$.

Now, the fact that $\phi: (A,\iota) \rightarrow (B',\jmath')$ is an isomorphism implies there are canonical choices for $\alpha$, $\alpha'$ and $\kappa$ to begin with. Indeed, by Lemma \ref{twistlemma}(b), the image of $\mathrm{Hom}_R(A,B)\otimes_R \mathrm{Hom}_R(B,A) \rightarrow R$, given by $f \otimes g \mapsto \iota^{-1}(g \circ f)$ is all of $R$, and so by the construction of Corollary \ref{hermhom} we can take $\alpha: \mathfrak{a} \rightarrow \mathfrak{a}^\vee$ to be $\alpha(f): f_0 \mapsto \iota^{-1}(f' \circ f_0)$, where $f'$ is the Rosati dual of $f$ (Definition \ref{Rosdual}). Then the corresponding $\alpha': \mathfrak{a}' \rightarrow \mathfrak{a}'^\vee$ will be $\alpha'(g): g_0 \mapsto \iota^{-1}(g_0 \circ g')$. The $R$-module isomorphism $\kappa: \mathfrak{a} \otimes \mathfrak{a}' \rightarrow R$, $f\otimes g \mapsto \iota^{-1}(g \circ f)$ will identify $(\mathfrak{a},\alpha)\otimes_R (\mathfrak{a}',\alpha')$ with the map $R \rightarrow R^\vee$ that sends $s\in R$ to $(x\mapsto s^*x)$, in other words with $(R,\mathbbm{1})$. Hence $\kappa$ is an isomorphism $(\mathfrak{a},\alpha)\otimes_R (\mathfrak{a}',\alpha') \xrightarrow{\raisebox{-5pt}{$\sim$}} (R,\mathbbm{1})$.  With this choice the map $\omega_0$ defined above will equal $\omega$ as in the statement of the theorem, and so $\Psi = \omega \circ (f\otimes \phi)$.

Finally, note that we can absorb $r$ into $k'$ and $r^{-1}$ into $\mu'$ by replacing $(\mathfrak{a},\alpha)$ as defined above with $(\mathfrak{a},r \cdot \alpha)$ and $(\mathfrak{a}',\alpha')$ with $(\mathfrak{a}', r^{-1}\cdot \alpha')$. Since the map $\kappa: (\mathfrak{a},\alpha)\otimes_R (\mathfrak{a}',\alpha') \xrightarrow{\raisebox{-5pt}{$\sim$}} (R,\mathbbm{1})$ is still an isomorphism after this replacement, we still have $\Psi = \omega \circ (f\otimes \phi)$, and now
$$f: (M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N',k'),\ \ \ \phi: (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (B',\jmath', \mu')$$
are morphisms in $\mathrm{Herm}_1(R)$ and $\mathcal{M}^1_\Phi(S)$.
\end{proof}

We note that the map $\omega$ in the statement of the theorem has the same form as $\omega_{a,X,Y}$ of (\ref{formomeg}) from $\S2$. Indeed, with notation as in the statement of the theorem, let $X=(N,k)$, $Y=(B,\jmath,\mu)$, and $a=(\mathfrak{a},\alpha)$. The pair $(\mathfrak{a}',\alpha')$ can be taken as the inverse object $a^{-1}$, with $I_a: a \Box a^{-1} \xrightarrow{\raisebox{-5pt}{$\sim$}} e$ given by $\kappa: (f\otimes g)\mapsto \iota^{-1}(g\circ f)$. Then the morphism $\omega_{a,X,Y}: Xa\boxtimes a^{-1}Y \xrightarrow{\raisebox{-5pt}{$\sim$}} X \boxtimes Y$ of (\ref{formomeg}) is mapped to $\omega$ in the statement of Theorem \ref{morthm} by the Serre construction functor
$$\Sigma_S: \mathrm{Herm}_n(R) \otimes_{\mathrm{Herm}_1(R)} \mathcal{M}_\Phi^1(S) \longrightarrow \mathcal{M}_\Phi^n(S),$$
$$ (M,h) \boxtimes (A,\iota,\lambda) \mapsto (M,h) \otimes (A,\iota,\lambda).$$

We can now prove the claim, made at the beginning of this section (Proposition \ref{fullfaith}), that the above functor is fully faithful.

\begin{proof}[Proof of Proposition \ref{fullfaith}:] Surjectivity of $\Sigma_S$ on morphisms follows from Theorem \ref{morthm} and the previous remark, since every morphism $\Psi$ of $\mathcal{M}_\Phi^n(S)$ has the form $\omega \circ (f\otimes \phi)$, and $\omega$ is in the image of $\Sigma_S$. We show injectivity by comparing Theorem \ref{morthm} and Proposition \ref{morprop}.

Given a morphism
$$\tau: (M,h)\boxtimes (A,\iota,\lambda) \rightarrow (N,k)\boxtimes (B,\jmath,\mu)$$
in $\mathrm{Herm}_n(R)\otimes_{\mathrm{Herm}_1(R)} \mathcal{M}_\Phi^1(S)$, by Proposition \ref{morprop} we can write $\tau = \omega_0 \circ (f\boxtimes \phi)$, where $\omega_0=\omega_{(N,k),(B,\jmath,\mu),(\mathfrak{a},\alpha)}$ depends on $(\mathfrak{a},\alpha)$, $(\mathfrak{a}',\alpha')$ $\in \mathrm{Herm}_1(R)$, and an isomorphism $I_{(\mathfrak{a},\alpha)}: (\mathfrak{a},\alpha)\otimes_R (\mathfrak{a}', \alpha') \rightarrow (R,\mathbbm{1})$. Specifically, $\omega$ is given by (\ref{formomeg}) in $\S2$. It has the same general form as $\omega_\kappa$ in (\ref{omega_k}), and is in fact mapped to it by $\Sigma_S$ with $\kappa = I_{(\mathfrak{a},\alpha)}$. The morphism $f\boxtimes \phi$ is of the form
$$ f\boxtimes \phi: (M,h) \boxtimes (A,\iota,\lambda) \rightarrow (N',k') \boxtimes (B',\jmath',\mu'),$$
with $(B',\jmath',\mu') = (\mathfrak{a}',\alpha') \otimes (B,\jmath,\mu)$ and $(N',k')=(N,k)\otimes_R (\mathfrak{a},\alpha)$.

Now the fact that $\phi: A \rightarrow B'$ is an $R$-linear isomorphism on the one hand implies that $\mathfrak{a} \simeq \mathrm{Hom}_R(A,B)$ and $\mathfrak{a}'\simeq \mathrm{Hom}_R(B,A)$ (cf. paragraph before Lemma \ref{lemlem}), so that in representing $\tau$ as $\omega_0 \circ (f \boxtimes \phi)$ we can take $\mathfrak{a} = \mathrm{Hom}_R(A,B)$ and $\mathfrak{a}' =\mathrm{Hom}_R(B,A)$. On the other hand it also implies, by Lemma \ref{twistlemma}(b), that with this choice of $\mathfrak{a}$ and $\mathfrak{a}'$ the map $\kappa: \mathfrak{a}\otimes_R \mathfrak{a}' \rightarrow R,\ f \otimes g \mapsto \iota^{-1}(g \circ f)$ is an isomorphism of modules. It then follows that for any $\alpha: \mathfrak{a} \rightarrow \mathfrak{a}^\vee$ such that $(\mathfrak{a},\alpha)\in \mathrm{Herm}_1({\calO_K})$, there is a unique $\alpha': \mathfrak{a}' \rightarrow (\mathfrak{a}')^\vee$ such that $\kappa: (\mathfrak{a},\alpha)\otimes_R (\mathfrak{a}',\alpha') \rightarrow (R,\mathbbm{1})$ is an isomorphism of hermitian structures. Therefore in representing $\tau$ as $\omega_0 \circ (f \boxtimes \phi)$ we can also arrange that $\Sigma_S(\omega_0)=\omega$, with $\omega$ as in the statement of Theorem \ref{morthm}.

Now let $\tau_0$ be another morphism such that $\Sigma_S(\tau_0)=\Sigma_S(\tau)$. We must show $\tau_0 = \tau$. By the same argument as above, $\tau_0$ can be written as $\omega_0' \circ (f_0 \boxtimes \phi_0)$, with $\Sigma_S(\omega_0')=\omega$, and
$$ f_0 : (M,h) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N_0,k_0)= (N,k)\otimes_R (\mathfrak{a},\alpha_0),\ \ \ \phi_0: (A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (B_0,\jmath_0,\mu_0)= (\mathfrak{a}',\alpha_0')\otimes (B,\jmath,\mu).$$
Here $\mathfrak{a}=\mathrm{Hom}_R(A,B)$ and $\mathfrak{a}'=\mathrm{Hom}_R(B,A)$ are as before, equipped with possibly different hermitian structures $\alpha_0$ and $\alpha_0'$. We claim that we can also take $\alpha_0 = \alpha$ and $\alpha_0' = \alpha'$, i.e. $\omega_0'=\omega_0$.

Since $\alpha$ and $\alpha_0$ are positive-definite non-degenerate hermitian structures on the same rank-one projective module, we must have $\alpha_0 = r^{-1}\cdot \alpha$ and $\alpha_0'=r\cdot \alpha'$, for some totally positive unit $r\in R$. In particular, $(B_0,\jmath_0,\mu_0) = (\mathfrak{a}',r\cdot \alpha')\otimes (B,\jmath,\mu)= (B',\jmath',r\cdot \mu')$. We also have isomorphisms of triples $\phi: (A,\iota,\lambda) \rightarrow (B',\jmath',\mu')$ and $\phi_0: (A,\iota,\lambda) \rightarrow (B_0,\jmath_0,\mu_0)$, hence $\phi_0 \circ \phi^{-1}:(B',\jmath',\mu') \xrightarrow{\raisebox{-5pt}{$\sim$}}(B_0,\jmath_0,\mu_0) = (B',\jmath',r\cdot \mu')$. Then $\phi_0 \circ \phi^{-1}=\jmath'(r_0)$ for some $r_0\in R^\times$, and
$$\mu' = \jmath'(r_0)^\vee \circ (\mu' \circ \jmath'(r)) \circ \jmath'(r_0) = \mu' \circ \jmath'(r_0^\sigma r_0 r),$$ which implies $r_0^\sigma r_0 r = 1$. It follows that the map $\mu_{r_0}: \mathfrak{a} \rightarrow \mathfrak{a},\ x \mapsto r_0^{-1} x$ gives an isomorphism $(\mathfrak{a},\alpha) \xrightarrow{\raisebox{-5pt}{$\sim$}} (\mathfrak{a},r^{-1} \cdot \alpha) = (\mathfrak{a},\alpha_0)$, which shows we can take $\alpha = \alpha_0$, and $\alpha' = \alpha_0'$. As a result, we can write $\tau_0 = \omega_0 \circ (f_0 \boxtimes \phi_0)$ where $\omega_0$ is the same map as in $\tau=\omega_0 \circ (f\boxtimes \phi)$. Then we have $f \otimes \phi = \omega^{-1} \circ \Sigma_S(\tau) = \omega^{-1}\circ \Sigma_S(\tau_0) = f_0 \otimes \phi_0$. Hence, to prove $\tau = \tau_0$ it suffices to show $f\otimes \phi = f_0\otimes \phi_0$ implies $f \boxtimes \phi = f_0\boxtimes \phi_0$.

Assume $f\otimes \phi = f_0 \otimes \phi_0$. Since $\phi_0: A \rightarrow B'$ and $\phi: A \rightarrow B'$ are $R$-linear isomorphisms, we have $\phi^{-1}\circ \phi_0 = \iota(r)$ for some $r\in R$, so that $\phi_0 = r \cdot \phi$. By $f\otimes \phi = f_0 \otimes \phi_0$, that implies $f = r\cdot f_0$. Now $\phi$ and $\phi_0$ are also isomorphisms of triples, so $\iota(r)$ is an automorphism of $(A,\iota,\lambda)$, hence $\lambda = \iota(r)^\vee \circ \lambda \circ \iota(r) = \lambda \circ \iota(r^\sigma r)$, and so $r^\sigma r = 1$. It follows that $\mu_{r}:(R,\mathbbm{1}) \rightarrow (R,\mathbbm{1}),\ x \mapsto rx$ is an automorphism of $(R,\mathbbm{1})$. Now, we have a diagram
$$ \begin{xymatrix} {
(M,h)\boxtimes (A,\iota,\lambda)  \ar@{..>}[d]\\
(N',k')\boxtimes (B',\jmath',\mu')  &((M,h)\otimes_R(R,\mathbbm{1}))\boxtimes (A,\iota,\lambda) \ar[r] \ar[d]_{(f_0\otimes \mu_r)\boxtimes \phi} \ar[ul] & (M,h)\boxtimes ((R,\mathbbm{1})\otimes (A,\iota,\lambda)\ar[d]^{f_0\boxtimes (\mu_r\otimes \phi)} \ar[ull]\\
& ((N',k')\otimes_R (R,\mathbbm{1}))\boxtimes (B',\jmath',\mu') \ar[r] \ar[ul] &(N',k')\boxtimes ((R,\mathbbm{1})\otimes (B',\jmath',\mu')), \ar[ull]}
\end{xymatrix}$$
where the oblique arrows are induced by left and right unitor isomorphisms, and the horizontal arrows are associators. The square and the two triangles commute by the naturality and triangle axioms of the categorical tensor product. The long parallelogram commutes if and only if the dotted arrow is $f_0\boxtimes (r \cdot \phi) = f_0\boxtimes \phi_0$, and the short parallelogram commutes if and only if it is $(r\cdot f_0)\boxtimes \phi = f\boxtimes \phi$. The commutativity of each parallelogram implies that of the other, therefore $f\boxtimes \phi = f_0\boxtimes \phi_0$.

Thus we have shown that $\Sigma_S(\tau) = \Sigma_S(\tau_0)$ implies $\tau = \tau_0$, which proves $\Sigma_S$ is injective on morphisms. This finishes the proof that $\Sigma_S$ is fully faithful.
\end{proof}

\subsection{Serre construction of $\mathcal{M}_\Phi^n$: the objects}

In this section we look for triples in $\mathcal{M}_\Phi^n(S)$ that come from the Serre construction. When $S=\operatorname{Spec} \mathbbm{C}$, we show every object is Serre constructible using an equivalence between $\mathcal{M}_\Phi^n(\mathbbm{C})$ and a category of linear-algebraic data. For general $S$ we show that every object of $\mathcal{M}_\Phi^n(S)$ is \textit{\'etale locally on the base} Serre constructible. This is done by using Theorem \ref{etprop} to reduce to the complex case.

The following lemma simplifies the task of spotting Serre constructible triples.

\begin{lemma}\label{pairenough}
Suppose $(B,\jmath, \mu)$ and $(A,\iota,\lambda)$ are objects in $\mathcal{M}_\Phi^n(S)$ and $\mathcal{M}_\Phi^1(S)$ respectively, $M$ is a projective finitely presented ${\calO_K}$-module of rank $n$, and $\Psi: M\otimes_{\calO_K} A \rightarrow B$ is an ${\calO_K}$-linear isomorphism of abelian schemes. Then there exists a unique non-degenerate positive-definite ${\calO_K}$-hermitian form $h: M \rightarrow M^\vee$ such that $\Psi: (M,h) \otimes (A,\iota,\lambda) \rightarrow (B,\jmath,\mu)$ is an isomorphism of triples.
\end{lemma}

\begin{proof}
Since $\Psi$ is an ${\calO_K}$-linear isomorphism, the map $\lambda_M=\Psi^\vee \circ \mu \circ \Psi$ is an ${\calO_K}$-linear principal polarization on $M\otimes_{\calO_K} A$. As $\lambda$ generates the ${\calO_K}$-module $\mathrm{Hom}_{\calO_K}(A,A^\vee)$, by Proposition \ref{homprop}(c), we have $\lambda_M = h\otimes \lambda$ for a unique ${\calO_K}$-linear map $h: M \rightarrow M^\vee$. By Proposition \ref{mainprop}, $h$ must be a positive-definite non-degenerate ${\calO_K}$-hermitian form. Then $(M,h)\otimes (A,\iota,\lambda)$ is an object of $\mathcal{M}_\Phi^n(S)$, and $\Psi$ pulls $\mu$ back to $h\otimes \lambda$, so it is an isomorphism of triples.
\end{proof}

Thus when checking whether a triple in $\mathcal{M}_\Phi^n$ comes from Serre's construction, we only need to verify that the underlying abelian scheme is of the form $M\otimes_{\calO_K} A$, and then its polarization has the form $h\otimes \lambda$ automatically.

We now consider the case $S=\operatorname{Spec} \mathbbm{C}$. For any field embedding $\phi: K \rightarrow \mathbbm{C}$, let $\mathbbm{C}^{(\phi)}$ denote $\mathbbm{C}$ as a $K\otimes\mathbbm{C}$-algebra, with structure homomorphism $K\otimes \mathbbm{C} \rightarrow \mathbbm{C}^{(\phi)}, a\otimes z \rightarrow \phi(a)z$. Then the direct sum $\mathbbm{C}^\Phi = \bigoplus_{\phi\in \Phi}\mathbbm{C}^{(\phi)}$ is also a $K\otimes \mathbbm{C}$-algebra, with an induced homomorphism $K\otimes \mathbbm{C} \rightarrow \mathbbm{C}^\Phi$. The restriction $K\otimes \mathbbm{R} \rightarrow \mathbbm{C}^\Phi,\ a\otimes s \mapsto (\phi(a)s)_{\phi\in \Phi}$ is then an isomorphism of $K$-algebras. If $V$ is any $K$-vector space, we obtain a $K$-linear isomorphism
\begin{equation}\label{Cphi} V \otimes \mathbbm{R} \cong V \otimes_K (K \otimes \mathbbm{R}) \simeq V \otimes_K \mathbbm{C}^\Phi \cong \bigoplus_{\phi \in \Phi} V \otimes_{K} \mathbbm{C}^{(\phi)}.\end{equation}

For a complex abelian variety $A$ with an ${\calO_K}$-action, $H=H_1(A,\mathbbm{Z})$ is a projective finitely presented ${\calO_K}$-module, and $H\otimes \mathbbm{R}$ can be identified with the tangent space of $A$ at the identity. The structure of $A$ as a complex variety then induces a complex structure $J$ on $H\otimes \mathbbm{R}$. As the action of ${\calO_K}$ on $A$ is algebraic, the induced ${\calO_K}$-action on $H\otimes \mathbbm{R}$  commutes with $J$, therefore $J$ is $K\otimes \mathbbm{R}$-linear.

\begin{lemma}\label{Cstruct} Let $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(\mathbbm{C})$ and $V=H_1(A,\mathbbm{Q})$. If $V\otimes \mathbbm{R}$ is equipped with the $\mathbbm{C}$-vector space structure induced by $A$ as a complex variety, the isomorphism $\psi: V\otimes \mathbbm{R} \simeq V\otimes_K \mathbbm{C}^\Phi$ of (\ref{Cphi}) is $K\otimes \mathbbm{C}$-linear.
\end{lemma}
\begin{proof}
If $I_\Phi: K\otimes \mathbbm{C} \rightarrow \mathbbm{C}^\Phi$ denotes the $(K\otimes \mathbbm{C})$-algebra structure map of $\mathbbm{C}^\Phi$, we have a $K\otimes \mathbbm{C}$-linear isomorphism
$$\pi: K\otimes \mathbbm{C} \xrightarrow{\raisebox{-5pt}{$\sim$}} \mathbbm{C}^\Phi \oplus \mathbbm{C}^{\Phi{\sigma}},\ \ \xi \mapsto (I_\Phi(\xi), I_{\Phi\sigma}(\xi)).$$

Let $\epsilon = \pi^{-1}(1,0)$ and $\epsilon' = \pi^{-1}(0,1)$, so that $ \epsilon + \epsilon' = 1$ and $\epsilon \cdot \epsilon' = 0.$ We claim that $\epsilon$ and $\epsilon'$ belong to $K\otimes L\subset K\otimes \mathbbm{C}$. Fix a finite Galois extension $\widetilde{L}/\mathbbm{Q}$ containing the Galois closures of $K/\mathbbm{Q}$ and $L/\mathbbm{Q}$. Since $(1,0)$ and $(0,1)$ are contained in $\pi(K\otimes \widetilde{L}) = \widetilde{L}^\Phi \oplus \widetilde{L}^{\Phi\sigma}$, we have $\epsilon,\epsilon'\in K\otimes \widetilde{L}$. Here $\widetilde{L}^\Phi$ denotes $\bigoplus_{\phi\in \Phi} \widetilde{L}^{(\phi)}$.

For any $\zeta \in K\otimes \mathbbm{C}$ and $\tau \in \mathrm{Aut}(\mathbbm{C})$, by $\zeta^\tau$ we denote $(\mathbbm{1}_K\otimes \tau)(\zeta)$. Now let $\tau\in \mathrm{Gal}(\widetilde{L}/L)$ and $\zeta\in K\otimes \widetilde{L}$. The reflex field $L$ satisfies $\tau \Phi = \Phi$ by definition. It follows that the coordinates of $I_\Phi(\zeta^\tau)$ and $I_\Phi(\zeta)$ differ by a permutation, as do the coordinates of $I_{\Phi\sigma}(\zeta^\tau)$ and $I_{\Phi\sigma}(\zeta)$. When $\zeta = \epsilon$, the former coordinates are all 1 and the latter all $0$, so they are invariant under permutations. That implies $\pi(\epsilon^\tau) = \pi (\epsilon)$, hence $\epsilon^\tau = \epsilon$. Then $\epsilon$ is invariant under the action of $\mathrm{Gal}(\widetilde{L}/L)$ on $K\otimes \widetilde{L}$, and so belongs to $K\otimes L$. Since $1\in K\otimes L$, so does $\epsilon'=1-\epsilon$.

The ideal condition on $(A,\iota,\lambda)$ asserts that $V\otimes \mathbbm{R}$ is annihilated by the kernel of ${\calO_K}\otimes {\calO_L} \rightarrow \mathbbm{C}^\Phi$. As we are in characteristic zero, that's the same as annihilation by the kernel of $K\otimes L \rightarrow \mathbbm{C}^\Phi$. Since $\epsilon,\epsilon'\in K\otimes L$, this kernel is the principal $(K\otimes L)$-ideal generated by $\epsilon'$. Then if the map $\alpha: K\otimes \mathbbm{C} \rightarrow \mathrm{End}(V\otimes \mathbbm{R})$ denotes the $(K\otimes\mathbbm{C})$-module structure on $V\otimes \mathbbm{R}$, the ideal condition is equivalent to $\alpha(\epsilon')=0$. Since $1 = \epsilon + \epsilon'$, that implies
\begin{align}\label{alphaJ} \alpha(\xi) = \alpha(\epsilon \xi),\ \ \ \text{for all }\xi \in K\otimes \mathbbm{C}.\end{align}

Similarly, if $\beta: K\otimes \mathbbm{C} \rightarrow \mathrm{End}(V\otimes_K \mathbbm{C}^\Phi)$ denotes the $(K\otimes \mathbbm{C})$-module structure, we have $\beta(\epsilon_\Phi')=0$ since $\beta$ factors through $K\otimes \mathbbm{C} \rightarrow \mathbbm{C}^\Phi$ by definition. Hence,
\begin{align}\label{betaJ} \beta(\xi) = \beta(\epsilon \xi),\ \ \ \text{for all }\xi\in K\otimes \mathbbm{C}.\end{align}

We claim that for any $\xi \in K\otimes \mathbbm{C}$, there exists $\zeta \in K\otimes \mathbbm{R}$ such that $\epsilon \xi  = \epsilon \zeta$. In fact, if $\pi(\xi) = (x,y)$, let $\zeta = \pi^{-1}(x, x^\sigma)$. Since in general $\pi(\xi^\sigma) = (y^\sigma,x^\sigma)$ for any $\xi$, we have $\pi(\zeta^\sigma) = \pi(\zeta)$, hence $\zeta \in K\otimes \mathbbm{R}$. Then $\pi(\epsilon \xi) = (x,0) = \pi(\epsilon \zeta)$, therefore $\epsilon \xi = \epsilon \zeta$. Since the map $\psi$ is $K\otimes \mathbbm{R}$-linear, it then follows from (\ref{alphaJ}) and (\ref{betaJ}) that for all $u\in V\otimes \mathbbm{R}$,
$$ \psi(\alpha(\xi)u) = \psi(\alpha(\epsilon \xi)u) = \psi( \alpha(\epsilon \zeta)u) =\psi( \alpha(\zeta)u) =  \beta(\zeta)\psi(u) = \beta(\epsilon \zeta)\psi(u) = \beta(\epsilon \xi) \psi(u) = \beta(\xi) \psi(u),$$
hence $\psi$ is in fact $K\otimes \mathbbm{C}$-linear.
\end{proof}

A triple $(A,\iota,\lambda)$ over $\mathbbm{C}$ is uniquely determined up to isomorphism by the lattice $H=H_1(A,\mathbbm{Z})$, the induced ${\calO_K}$-module structure on $H$, the complex structure on $H\otimes \mathbbm{R} \cong \mathrm{Lie}_\mathbbm{C}(A)$, and the Riemann form $E: H\times H \rightarrow \mathbbm{Z}$ induced by $\lambda$. The above lemma shows that if $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(\mathbbm{C})$, the complex structure on $H\otimes \mathbbm{R}$ is determined by the ${\calO_K}$-module structure of $H$. In that case $(A,\iota,\lambda)$ is determined up to isomorphism by the ${\calO_K}$-module $H$ and the Riemann form $E: H\times H \rightarrow \mathbbm{Z}$.

Given any projective finitely presented ${\calO_K}$-module $H$, we can equip $U=H\otimes \mathbbm{R}$ with a complex structure via the isomorphism (\ref{Cphi}), so that $A=U/H$ is a complex torus with an ${\calO_K}$-action. Then an alternating bilinear form $E: H\times H \rightarrow \mathbbm{Z}$ equips $A$ with a polarization $\lambda$ if and only if the form $(x,y)\mapsto E_\mathbbm{R}(ix,y)$ is positive-definite, where $E_\mathbbm{R}: U\times U \rightarrow \mathbbm{R}$ is the $\mathbbm{R}$-linear extension of $E$. In that case $\lambda$ is principal if and only if $E$ is non-degenerate, and it is ${\calO_K}$-linear if and only if
\begin{equation}\label{Elinear} E(ax,y)=E(x,a^\sigma y),\ \ a\in {\calO_K},\ x,y\in H.\end{equation}

Now, any bilinear form $E: H\times H \rightarrow \mathbbm{Z}$ satisfying the above relation corresponds uniquely to a $\delta_K^{-1}$-valued sesquilinear form $F: H\times H \rightarrow \delta_K^{-1}$ such that $E = \operatorname{Tr}_{K/\mathbbm{Q}} E$, where $\delta_K^{-1}$ is the inverse different of $K/\mathbbm{Q}$. The correspondence is given explicitly as follows. Suppose $E: H\times H \rightarrow \mathbbm{Z}$ is a $\mathbbm{Z}$-bilinear form on $H$ satisfying (\ref{Elinear}). Let $\{\alpha_j\}$ be a $\mathbbm{Z}$-basis for ${\calO_K}$, and $\{\beta_j\}$ the trace-dual basis for $\delta_K^{-1}$. Then $F: H\times H \rightarrow \delta_K^{-1}$ is given by
\begin{align}\label{bigf} F(x,y) = \sum_j E(x,\alpha_j y)\beta_j.\end{align}
Since $\{\alpha_j^\sigma\}$ and $\{\beta_j^\sigma\}$ are also a pair of trace-dual bases for ${\calO_K}$ and $\delta_K^{-1}$, it follows that the form $E$ is alternating if and only if $F$ is \textit{skew-hermitian}:
$$F(y,x)=-F(x,y)^\sigma,\ \ x,y\in H.$$

Given a skew-hermitian form $F$ as above, for any $x\in H$, $\zeta= F(x,x)$ is purely imaginary: $\zeta = -\zeta^\sigma$. Since $K$ is a CM field, it is also \textit{totally purely imaginary}: $\phi(\zeta) = -\phi(\zeta)^\sigma$ for all $\phi\in \mathrm{Hom}(K,\mathbbm{C})$. It follows that if $\zeta\neq 0$, there exists a unique CM-type $\Psi \subset \mathrm{Hom}(K,\mathbbm{C})$ such that $\Im(\psi(\zeta))< 0$ for all $\psi\in \Psi$.

\begin{defn}\label{skewdef} Suppose $\mathfrak{d}$ is a fractional ideal of $K$ such that $\mathfrak{d}^\sigma = \mathfrak{d}$. A $\mathfrak{d}$-valued skew hermitian form $F: H\times H \rightarrow \mathfrak{d}$ is called \textit{negative-definite along} $\Phi$, if $\Im(\phi(F(x,x)))<0$ for all non-zero $x\in H$, $\phi\in \Phi$.
\end{defn}

Now let $H$ be a projective finitely presented ${\calO_K}$-module, and equip $U=H\otimes \mathbbm{R}$ with a complex structure via the isomorphism $U \simeq H_\mathbbm{Q}\otimes_K \mathbbm{C}^\Phi$ of (\ref{Cphi}). Let $E: H\times H \rightarrow \mathbbm{Z}$ be an alternating bilinear form on $H$ satisfying (\ref{Elinear}), and $F: H\times H \rightarrow \delta_K^{-1}$ its corresponding $\delta_K^{-1}$-valued skew-hermitian form.

\begin{lemma}\label{negdef} The alternating form $E: H\times H \rightarrow \mathbbm{Z}$ is a Riemann form for $U/H$ if and only if $F: H\times H \rightarrow \delta_K^{-1}$ is negative-definite along $\Phi$.
\end{lemma}
\begin{proof}
Let $E_\mathbbm{R}: U \times U \rightarrow \mathbbm{R}$ denote the $\mathbbm{R}$-linear extension of $E$. Let $U^{(\phi)}$ be the complex subspace of $U=H\otimes \mathbbm{R}$ corresponding to $H_\mathbbm{Q} \otimes_K \mathbbm{C}^{(\phi)} \subset H_\mathbbm{Q} \otimes_K \mathbbm{C}^\Phi$ via (\ref{Cphi}), and $E^{(\phi)}$ the restriction of $E_\mathbbm{R}$ to $U^{(\phi)}\times U^{(\phi)}$. We claim there's an orthogonal decomposition $E_\mathbbm{R} = \bigoplus_{\phi\in \Phi} E^{(\phi)}$. Indeed, for each $\phi\in \Phi$ consider the element $(0,\cdots,0,1,0,\cdots,0)\in \mathbbm{C}^\Phi$ with the $1$ in the $\mathbbm{C}^{(\phi)}$-component. This element corresponds to some $\epsilon_\phi \in K\otimes \mathbbm{R}$ under $K\otimes\mathbbm{R} \simeq \mathbbm{C}^\Phi$, and multiplication by $\epsilon_\phi$ is the projection map $U \rightarrow U^{(\phi)}$. We have $\epsilon_\phi^2 = \epsilon_\phi$, $\epsilon_\phi \epsilon_\psi = 0$ if $\phi \neq \psi$, and $1 = \sum_{\phi\in \Phi} \epsilon_\phi$. Now each $\epsilon_\phi$ is invariant under $\sigma$, because its image in $\mathbbm{C}^\Phi$ is invariant under complex conjugation. Then if $\phi \neq \psi$, from (\ref{Elinear}) we have $E_\mathbbm{R}(\epsilon_\phi x , \epsilon_\psi y) = E_\mathbbm{R}(x, \epsilon_\phi \epsilon_\psi y) = 0$, from which the orthogonal decomposition $E_\mathbbm{R}=\bigoplus_{\phi\in \Phi}E^{(\phi)}$ follows. Similarly, let $F_\mathbbm{R}: U\times U \rightarrow K\otimes \mathbbm{R}$ be obtained from $F$ by $\mathbbm{R}$-linearity, and let $F^{(\phi)}$ denote its restriction to $U^{(\phi)}$. We also have an orthogonal decomposition $F_\mathbbm{R} = \bigoplus_{\phi\in\Phi} F^{(\phi)}$ for the same reason as before.  Here $F^{(\phi)}$ takes values in $\epsilon_\Phi (K\otimes \mathbbm{R})$, which we may identify with $\mathbbm{C}^{(\phi)}\subset \mathbbm{C}^\Phi$, using $K\otimes \mathbbm{R} \simeq \mathbbm{C}^\Phi$. Viewed this way, $F^{(\phi)}$ is the $\mathbbm{C}$-linear extension of $F$ induced by $\phi: K \hra \mathbbm{C}$.

For each $\phi\in \Phi$, it follows from (\ref{bigf}) and the $\mathbbm{R}$-linearity of $F^{(\phi)}$ that
\begin{flalign*}
 F^{(\phi)}(x,y) &= \sum_j E^{(\phi)}(x,\phi(\alpha_j) y)\phi(\beta_j)\\ &=  \left( \sum_j \Re(\phi(\alpha_j))\phi(\beta_j)\right) E^{(\phi)}(x,y) +  \left(\sum_j \Im(\phi(\alpha_j)) \phi(\beta_j)\right) E^{(\phi)}(x,iy).
 \end{flalign*}
Now for a pair of trace-dual $\mathbbm{Q}$-bases $\{\alpha_j\}$ and $\{\beta_j\}$ of a CM field $K$, there are general identities
$$ \sum_{j} \alpha_j \beta_j =1, \ \ \ \sum_j \alpha_j^\sigma  \beta_j = 0,$$
from which it follows that
$$ \sum_{j} \Re(\phi(\alpha_j)) \phi(\beta_j) = \frac{1}{2},\ \ \ \sum_{j} \Im(\phi(\alpha_j)) \phi(\beta_j) = \frac{i}{2}.$$
Therefore
\begin{equation} F^{(\phi)}(x,y) = \frac{1}{2} E^{(\phi)}(x,y) + \frac{i}{2} E^{(\phi)}(x,iy),\ \ \ \forall x,y\in U^{(\phi)}.\end{equation}
In particular, we obtain $F^{(\phi)}(x,x) = -\frac{i}{2}E^{(\phi)}(ix,x)$. Then $\Im(F^{(\phi)}(x,x))<0$ for all $x\in U^{(\phi)}$ if and only if $(x,y)\mapsto E^{(\phi)}(ix,y)$ is positive-definite on $U^{(\phi)}$. By the orthogonal decomposition $E_\mathbbm{R} = \bigoplus_{\phi\in \Phi} E^{(\phi)}$, that holds for every $\phi\in \Phi$, if and only if $(x,y)\mapsto E_\mathbbm{R}(ix,y)$ is positive-definite. Hence $E$ is a Riemann form if and only if $\Im(F^{(\phi)}(x,x))<0$ for all $x\in U^{(\phi)}$ and $\phi\in \Phi$. By definition, $F$ is negative-definite along $\Phi$ if and only if $\Im(\phi(F(x,x)) < 0$ for all $x\in H$ and $\phi\in \Phi$. The form $F^{(\phi)}$, considered as the $\mathbbm{C}$-linear extension of $F: H\times H \rightarrow \delta_K^{-1}$ via $\phi$, is negative-definite if and only if its restriction to $H\times H$ is negative-definite, therefore the two conditions are equivalent.
\end{proof}

The two lemmas \ref{Cstruct} and \ref{negdef} allow us to characterize objects in $\mathcal{M}_\Phi^n(\mathbbm{C})$ in terms of skew-hermitian structures $F$ that are negative definite along $\Phi$. To state this correspondence in a satisfactory way, it will be convenient to represent such skew-hermitian structures by ${\calO_K}$-linear maps, in the following way.

For a projective finitely presented ${\calO_K}$-module $H$, let $H^*=\mathrm{Hom}_{\calO_K}(H,\delta_K^{-1})\cong H^\vee \otimes_{\calO_k} \delta_K^{-1}$. A $\delta_K^{-1}$-valued sesquilinear form $F$ corresponds to an ${\calO_K}$-linear map $f: H \rightarrow H^*$ via $f(x)(y)=F(x,y)$. We will identify $f$ with $F$ in this way, and speak of skew-hermitian forms $f: H \rightarrow H^*$. Now, there is a canonical isomorphism $(H^*)^*\cong H$, through which the functor $H\mapsto H^*$ becomes a contravariant duality on the category of projective finitely presented ${\calO_K}$-modules. If $f^*: H \rightarrow H^*$ is the dual of $f$, then $f$ is skew-hermitian if and only if $f^* = -f$. We say a skew-hermitian form $f$ is \textit{non-degenerate} if it is an isomorphism. This happens if and only if the corresponding alternating form $E=\operatorname{Tr}_{K/\mathbbm{Q}} F$ is non-degenerate.

Suppose $\mathfrak{d}$ is a fractional ideal $\mathfrak{d}$ of $K$ such that $\mathfrak{d}^\sigma = \mathfrak{d}$. For $\epsilon=\pm 1$, a $\mathfrak{d}$-valued sesquilinear form $G: H\times H \rightarrow \mathfrak{d}$ is called $\epsilon$-hermitian if it satisfies $H(x,y)^\sigma = \epsilon H(y,x)$. Then $\epsilon=1$ corresponds to a hermitian form and $\epsilon=-1$ to skew-hermitian. Such $G$ then correspond to ${\calO_K}$-linear maps $g: H \rightarrow \mathrm{Hom}_{\calO_K}(H,\mathfrak{d})\cong H^\vee \otimes_{\calO_K} \mathfrak{d}$. If $(H,g)$ is a $\mathfrak{d}$-valued $\epsilon$-hermitian form, and $(H',g')$ is $\mathfrak{d}'$-valued $ \epsilon'$-hermitian, then $(H,g)\otimes (H',g')=(H\otimes_{\calO_K} H',g \otimes g')$ is a $\mathfrak{d}\frakd'$-valued $\epsilon\epsilon'$-hermitian form. In particular,  $(H\otimes H',g\otimes g')$ is skew-hermitian if one of $(H,g)$ or $(H',g')$ is hermitian, and the other is skew-hermitian. If $(H,g)$ and $(H',g')$ are either both skew-hermitian, or both hermitian, then $(H\otimes H',g\otimes g')$ is hermitian. If $(H,g)$ is $\mathfrak{d}$-valued skew-hermitian and negative-definite along $\Phi$ (Definition \ref{skewdef}), and $(H',g')$ is $\mathfrak{d}^{-1}$-valued skew-hermitian and negative-definite along $\Phi\sigma$, then $(H,g)\otimes (H',g')$ is ${\calO_K}$-hermitian and positive-definite.

Let $\operatorname{Skew}_\Phi^n({\calO_K})$ denote the category of pairs $(H,f)$, where $H$ is a projective finitely presented ${\calO_K}$-module of rank $n$, and $f: H \rightarrow H^*$ is a non-degenerate $\delta_K^{-1}$-valued skew-hermitian form on $H$ that is negative-definite along $\Phi$. The morphisms of $\operatorname{Skew}_\Phi^n({\calO_K})$ are isomorphisms of ${\calO_K}$-modules which preserve the skew-hermitian forms. The 2-group $\mathrm{Herm}_1({\calO_K})$ then acts on $\operatorname{Skew}_\Phi^n({\calO_K})$ via ordinary tensor product. In other words, if $(H,f)\in \operatorname{Skew}_\Phi^n({\calO_K})$ and $(\mathfrak{a},\alpha)\in \mathrm{Herm}_1({\calO_K})$, then $(H\otimes_{\calO_K} \mathfrak{a}, f\otimes \alpha)\in \operatorname{Skew}_\Phi^n({\calO_K})$.

For $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(\mathbbm{C})$, we can form a pair $(H,f)$ as follows. Let $H=H_1(A,\mathbbm{Z})$ and taking $f$ to be the composition of $H_1(\lambda): H=H_1(A,\mathbbm{Z}) \rightarrow H_1(A^\vee,\mathbbm{Z})$ with the canonical isomorphism $H_1(A^\vee,\mathbbm{Z}) \cong H_1(A,\mathbbm{Z})^*$. Then $f$ is the skew-hermitian form corresponding to the Riemann form induced by $\lambda$, so that $(H,f)\in \operatorname{Skew}_\Phi^n({\calO_K})$. Thus we obtain a functor,
\begin{align} \Theta=\Theta_n: \mathcal{M}_\Phi^n(\mathbbm{C}) \rightarrow \operatorname{Skew}_\Phi^n({\calO_K}),\ \ \ (A,\iota,\lambda) \mapsto (H,f)\end{align}

\begin{prop}\label{skewprop} The functor $\Theta$ is an equivalence of categories. Moreover, it is compatible with the action of $\mathrm{Herm}_1({\calO_K})$, up to canonical isomorphism.
\end{prop}
\begin{proof} Let $\Xi: \operatorname{Skew}_\Phi^n({\calO_K}) \rightarrow \mathcal{M}_\Phi^n(\mathbbm{C})$ be the functor that sends a pair $(H,f)$ to the triple $(A,\iota,\lambda)$ constructed as follows. $A$ is the complex torus $U/H$, where $U=H\otimes \mathbbm{R}$ is equipped with a complex structure via (\ref{Cphi}). The ${\calO_K}$-module structure of $H$ then induces an ${\calO_K}$-action $\iota$ on $A$, and the Riemann form $E(x,y)=\operatorname{Tr}_{K/\mathbbm{Q}}(f(x)(y))$ equips $A$ with a principal ${\calO_K}$-linear polarization $\lambda: A \rightarrow A^\vee$. We give explicit isomorphisms of identity functors with $\Theta \circ \Xi$ and $\Xi \circ \Theta$.

Let $(H,f) \in \operatorname{Skew}_\Phi^n({\calO_K})$, and $(A,\iota,\lambda) = \Xi(H,f)$. Then $A$ is the complex torus $U/H$ constructed above, with the induced ${\calO_K}$-action $\iota$. We let $U^* = H^*\otimes \mathbbm{R}$, and make the identification $(U/H)^\vee  = U^*/H^*$. The map $f:H \rightarrow H^*$ extends $\mathbbm{R}$-linearly to $f_\mathbbm{R}: U \rightarrow U^*$, and then descends to $\widetilde{f}_\mathbbm{R}: U/H \rightarrow U^*/H^*$, which is $\lambda$ by definition. We define an isomorphism $J_H = J_{(H,f)}: H \rightarrow H_1(A,\mathbbm{Z})$ as follows. For $x\in H$, $J_H(x)$ is the homology class of the loop $\gamma_x: [0,1] \rightarrow U/H$, that maps $t\in [0,1]$ to the image of $x\otimes t \in H\otimes \mathbbm{R} = U$ in $U/H$. Then $J_H$ is an isomorphism of lattices, and its straight-forward to verify it is compatible with morphisms. That implies it's an isomorphism of ${\calO_K}$-modules, and that it identifies $H_1(f): H_1(U/H,\mathbbm{Z}) \rightarrow H_1(U^*/H^*,\mathbbm{Z})\cong H_1(U/H,\mathbbm{Z})^*$ with $f$ itself. Then the isomorphisms $J_{(H,f)}: (H,f) \xrightarrow{\raisebox{-5pt}{$\sim$}} \Theta\circ \Xi(H,f)$ give an isomorphism of functors $\mathbbm{1}_{\operatorname{Skew}_\Phi^n({\calO_K})} \xrightarrow{\raisebox{-5pt}{$\sim$}} \Theta \circ \Xi$.

Conversely, for $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(\mathbbm{C})$, let $(H,f)=\Theta(A,\iota,\lambda)$, and equip $U=H\otimes \mathbbm{R}$ with the complex structure transported via (\ref{Cphi}). Then $\Xi\circ \Theta (A,\iota,\lambda)$ is the complex torus $U/H$, equipped with the polarization $\widetilde{f}_\mathbbm{R}: U/H \rightarrow U^*/H^*$ constructed above. We have a canonical isomorphism $I_A = I_{(A,\iota,\lambda)}: U/H \xrightarrow{\raisebox{-5pt}{$\sim$}} A$ defined as follows. Let $V$ denote the complex vector space of holomorphic 1-forms on $A$, and $V'$ its dual space, identified with the tanget space $T_e(A)$. For $a\in {\calO_K}$, the maps $V \rightarrow V: \omega \mapsto \iota(a)^*\omega$ give an ${\calO_K}$-action on $V$. The pairing $H_1(A,\mathbbm{Z}) \times V \rightarrow \mathbbm{C}:\ ([c],\omega) \mapsto \int_{c}{\omega}$ gives an injection $H\hra V'$, which is ${\calO_K}$-linear by a change of variables in the integral. This induces a $K\otimes\mathbbm{R}$-linear isomorphism $U \xrightarrow{\raisebox{-5pt}{$\sim$}} V'$, which by Lemma \ref{Cstruct} is actually $K\otimes \mathbbm{C}$-linear. Since the kernel of the exponential map $\exp: V'=T_e(A) \twoheadrightarrow A$ is the image of $H$ in $V'$, we obtain an ${\calO_K}$-linear isomorphism $I_A: U/H \xrightarrow{\raisebox{-5pt}{$\sim$}} A$ of complex manifolds, indeed of abelian varieties. That $I_A$ is compatible with polarizations is equivalent to the equality $I_{A^\vee}^{-1} = I_A^\vee$. This amounts to the fact that $T_e(A^\vee)$ is canonically isomorphic to the complex antilinear dual of $T_e(A)$. Thus we have a canonical isomorphism $I_{(A,\iota,\lambda)}: \Xi\circ \Theta(A,\iota,\lambda) \xrightarrow{\raisebox{-5pt}{$\sim$}} (A,\iota,\lambda)$, giving an isomorphism of functors $\Xi \circ \Theta \xrightarrow{\raisebox{-5pt}{$\sim$}} \mathbbm{1}_{\mathcal{M}_\Phi^n(\mathbbm{C})}$. This shows that $\Theta$ is an equivalence of categories.

To show $\Theta$ is compatible with the action of $\mathrm{Herm}_1({\calO_K})$, it's enough to show it for $\Xi$, since they are inverse functors up to isomorphism. Let $(H,f)\in \operatorname{Skew}_\Phi^n({\calO_k})$ and $(A,\iota,\lambda)=\Xi(H,f)$, so that $A=U/H$, with $U=H\otimes \mathbbm{R}$. We let $U^* = H^*\otimes \mathbbm{R}$, and identify $U^*/H^*$ with $A^\vee$. Then the polarization $\lambda$ is the map $\widetilde{f}_{\mathbbm{R}}: U/H \rightarrow U^*/H^*$ induced on quotients by the $\mathbbm{R}$-linear extension $f_\mathbbm{R}$ of $f$. For $(\mathfrak{a},\alpha)\in \mathrm{Herm}_1({\calO_K})$, let $(H_\mathfrak{a},f_\mathfrak{a}) = (\mathfrak{a},\alpha)\otimes_{\calO_K} (H,f)$, and $(A_\mathfrak{a},\iota_\mathfrak{a},\lambda_\mathfrak{a})=\Xi(H_\mathfrak{a},f_\mathfrak{a})$. Then we have $A_\mathfrak{a} = U_\mathfrak{a}/ H_\mathfrak{a}$, where $U_\mathfrak{a} = H_\mathfrak{a} \otimes \mathbbm{R}$. The canonical isomorphism $U_\mathfrak{a} = (\mathfrak{a} \otimes_{\calO_K} H)\otimes \mathbbm{R} \cong \mathfrak{a} \otimes_{\calO_K} (H\otimes \mathbbm{R})=\mathfrak{a} \otimes_{\calO_K} U$ then induces an ${\calO_K}$-linear isomorphism of abelian varieties $I_{H,\mathfrak{a}}: U_\mathfrak{a}/H_\mathfrak{a} \xrightarrow{\raisebox{-5pt}{$\sim$}} \mathfrak{a} \otimes_{\calO_K} A$, which is functorial in $H$ and $\mathfrak{a}$. Applying it to $f: H \rightarrow H^*$ and $\alpha: \mathfrak{a} \rightarrow \mathfrak{a}^\vee$ we obtain a commutative diagram

\begin{equation}\begin{xymatrix}{
A_\mathfrak{a} \ar@{=}[r] \ar[d]_{\lambda_\mathfrak{a}} & U_\mathfrak{a} /H_\mathfrak{a} \ar[d]_{\widetilde{f}_{\mathfrak{a},\mathbbm{R}}} \ar[r]^-{I_{H,\mathfrak{a}}} & \mathfrak{a} \otimes_{\calO_K} (U/H) \ar[d]^{\alpha \otimes \tilde{f}_\mathbbm{R}} \ar@{=}[r] & \mathfrak{a} \otimes_{\calO_K} A \ar[d]^{\alpha\otimes \lambda}\\
A_\mathfrak{a}^\vee \ar@{=}[r] & U_{\mathfrak{a}^\vee}^* / H_{\mathfrak{a}^\vee}^* \ar[r]_-{I_{H^*,\mathfrak{a}^\vee}} &\mathfrak{a}^\vee \otimes_{\calO_K} (U^*/H^*) \ar@{=}[r] & \mathfrak{a}^\vee \otimes_{\calO_K} A^\vee.
}\end{xymatrix}
\end{equation}

Then $I_{H,\mathfrak{a}}$ is an isomorphism of triples if and only if it is compatible with polarizations. From the diagram, this is the same as the identity $I_{H^*,\mathfrak{a}^\vee}^{-1} = I_{H,\mathfrak{a}}^\vee$. By the duality theorey of abelian varieties, this is equivalent to the map $I_{H^*,\mathfrak{a}^\vee}\times I_{H,\mathfrak{a}}$ preserving the Poincar\'e line bundle under pullback. That in turn can be verified on the level of tangent spaces using the corresponding Appell-Humbert data. It follows that $I_{(H,f),(\mathfrak{a},\alpha)}: \Xi(H_\mathfrak{a},f_\mathfrak{a}) \xrightarrow{\raisebox{-5pt}{$\sim$}} (\mathfrak{a},\alpha)\otimes_{\calO_K} \Xi(H,f)$ is an isomorphism of triples, functorial in $(H,f)$ and $(\mathfrak{a},\alpha)$. Then the equivalence $\Xi: \operatorname{Skew}_\Phi^n({\calO_K}) \rightarrow \mathcal{M}_\Phi^n(\mathbbm{C})$ is compatible with the action of $\mathrm{Herm}_1({\calO_K})$, and therefore so is $\Theta$.
\end{proof}

Now we proceed to study the functor $$\Sigma_\mathbbm{C}:\mathrm{Herm}_n({\calO_K}) \otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1(\mathbbm{C}) \rightarrow \mathcal{M}_\Phi^n(\mathbbm{C}).$$
For the domain of $\Sigma_\mathbbm{C}$ to be non-empty, $\mathcal{M}_\Phi^1(\mathbbm{C})$ must
contain objects. The following theorem shows this is almost always the case.

\begin{thm}\label{existence} $\mathcal{M}_\Phi^1(\mathbbm{C})\neq \emptyset$ for all CM types
$\Phi$, unless $K/F$ is unramified at every finite place. In that case,
$\mathcal{M}_\Phi^1(\mathbbm{C})\neq
\emptyset$ for exactly half the types.
\end{thm}
\begin{proof}
Assume that for some CM
type $\Phi_0$,
$\mathcal{M}_{\Phi_0}^1(\mathbbm{C})$ is non-empty. As explained in the proof of Proposition
\ref{prinhom} that means we
can find a
fractional ideal $\mathfrak{a}\subset K$ and an element $\zeta \in K$
such that
$$\mathfrak{a} \mathfrak{a}^\sigma \delta_K = (\zeta),\ \ \zeta^\sigma=-\zeta,\ \ \Im
\phi(\zeta)<0\ \ \forall \phi\in \Phi_0,$$
where $\delta_K$ is the different ideal of $K$.
If $\mathcal{M}_\Phi^1(\mathbbm{C})\neq \emptyset$ for some other CM type $\Phi$, we get
another pair $(\mathfrak{b}, \xi)$ with analogous
properties. If we put $\mathfrak{c} = \mathfrak{a} \mathfrak{b}^{-1}$ and $r = \zeta \xi^{-1}$,
then we have
$r\in F$, $\mathfrak{c} \mathfrak{c}^\sigma = (r)$, and for
any $\psi: F \hra \overline{\QQ}$, we have $\phi(r)>0$ if and only if $\Phi \cap \Phi_0$
contains an element of $\mathrm{Hom}(K,\overline{\QQ})$ extending $\psi$.

Let $N_0(K)$ denote the group of pairs $(\mathfrak{c},r)$,
where $\mathfrak{c}$ is a non-zero fractional ideal of $K$, $r\in F^\times$, and
$\mathfrak{c} \mathfrak{c}^\sigma = (r)$. Given $(\mathfrak{c},r)\in N_0(K)$, we may put $\mathfrak{b}
= \mathfrak{a}
\mathfrak{c}^{-1}$ and $\xi = \zeta
r^{-1}$. Then $\mathfrak{b}
\mathfrak{b}^{\sigma} \delta_K = (\xi)$, $\xi^\sigma= -\xi$, and there exists a
unique
CM
type $\Phi$ such that
$(\mathfrak{b},\xi)$ defines an object of $\mathcal{M}_\Phi^1(\mathbbm{C})$. Then $(\mathfrak{c},r)\cdot
\Phi_0 = \Phi$ defines a transitive action of $N_0(K)$ on
the
set of CM types $\Phi$ for which $\mathcal{M}_\Phi^1(\mathbbm{C})$ is non-empty. Let
$N_0^+(K)$ denote the kernel of this action. It coincides with stabilizer
of any $\Phi_0$, and consists of all pairs
$(\mathfrak{c},r)$ such that $\mathfrak{c} \mathfrak{c}^{\sigma} = (r)$ and $r\in F^\times$ is
positive
definite. Then the number of CM types $\Phi$ such that $\mathcal{M}_\Phi^1(\mathbbm{C})\neq
\emptyset$ is equal to $$|N_0(K)/N_0^+(K)|.$$

Let $U_K$, $I_K$, and $P_K$ denote the units of ${\calO_K}$, the non-zero
fractional
ideals of
$K$, and its subgroup of principal ideals, so that $C_K =
I_K/P_K$ is the ideal class group. We also use the corresponding notation for
$F$.
Let
$N_K\subset I_K$ consist of $\mathfrak{c}$ such that $\mathrm{Nm}_{K/F}(\mathfrak{c})=\mathfrak{c}
\mathfrak{c}^\sigma$ is principal and generated by an element of $F$. We have a
surjective map $N_0(K) \rightarrow N_K,
(\mathfrak{c},r)\mapsto \mathfrak{c}$
and an exact sequence
$$ 0 \rightarrow U_F \rightarrow N_0(K) \rightarrow N_K \rightarrow 0,$$
where $u\in U_F$ is identified with $({\calO_K},u)\in N_0(K)$.

Let $P_F^+\subset P_F$ denote the subgroup of principal
ideals that admit a totally positive generator, so that $C^+_F = I_F/P^+_F$ is
the
narrow class group of $F$. We also have a subgroup $N^+_K\subset I_K$
consisting of fractional ideals
$\mathfrak{c}$ such
that $\mathrm{Nm}_{K/F}^+(\mathfrak{c})=\mathfrak{c}\frakc^{\sigma}$ is in $P_F^+$. We get
another exact sequence
$$ 0 \rightarrow U_F^+ \rightarrow N_0^+(K) \rightarrow N_K^+ \rightarrow 0,$$
where $U_F^+\subset U_F$ consists of totally positive units.

From the two exact sequences and the nine-lemma we obtain another exact sequence
\begin{align}\label{split} 0 \rightarrow U_F/U_F^+ \rightarrow N_0(K)/N_0^+(K) \rightarrow N_K/N_K^+
\rightarrow 0.\end{align}

Note that $N_K$ and $N_K^+$ both contain the principal fractional ideals $P_K$,
so that $N_K/N_K^+ = \overline{N}_K/ \overline{N}^+_K$, with $\overline{N}_K = N_K/P_K$ and
$\overline{N}^+_K
= N_K^+/P_K$ considered as subgroups of $C_K$. We then have an exact diagram
$$ \xymatrix{ & & 0\ar[d] & 0 \ar[d] \\
& 0 \ar[r] & \overline{N}^+_K \ar[r] \ar[d] & \overline{N}_K \ar[d] \ar[r] &
\overline{N}_K/\overline{N}^+_K \ar[r] & 0\\
&	0 \ar[r] & C_K \ar@{=}[r] \ar[d]^{\mathrm{Nm}_{K/F}^+} & C_K \ar[d]^{\mathrm{Nm}_{K/F}}
\ar[r] &
0\\
0 \ar[r] & Y \ar[r] & C^+_F \ar[r] & C_F \ar[r] \ar[d] & 0\\
& &  & 0 &
},$$
where $Y$ is kernel of $C_F^+ \rightarrow C_F$. To see that the norm map $N_{K/F}:
C_K \rightarrow
C_F$ is surjective, note that under the reciprocity isomorphism it corresponds
to the restriction
map
$\mathrm{Gal}(H_K/K)\rightarrow \mathrm{Gal}(H_F/F)$, which is
surjective. Here $H_K$ and $H_F$ are the
Hilbert class fields of $K$ and $F$, and $H_F\subset H_K$.

For the narrow
Hilbert
class fields $H_K^+$ and $H_F^+$, we have $H_K^+= H_K$ since $K$ is totally
imaginary, and so $H_F^+\subset H_K$. Again the map $\mathrm{Nm}_{K/F}^+: C_K \rightarrow
C_F^+$ corresponds to the
restriction $\mathrm{Gal}(H_K/K)\rightarrow \mathrm{Gal}(H_F^+/F)$. The latter is surjective if $K
\cap H_F^+ = F$, otherwise the image has index 2, with the quotient isomorphic
to $\mathrm{Gal}(K/F)$. By a standard diagram chase we get an injection
$\overline{N}_K/\overline{N}_K^+ \rightarrow
Y$, induced by $N^+_{K/F}$, which is an isomorphism if $K/F$ is ramified at any
finite prime, and an injection onto a subgroup of index 2 otherwise.

Now fix an ordering $(\psi_1, \cdots, \psi_g)$ of $\mathrm{Hom}(F,\overline{\QQ})$, put $S=
\{\pm
1\}^{[F:\mathbbm{Q}]}$, and consider the homomorphism $U_F \rightarrow S$, $u\mapsto
s=(s_1,\cdots,
s_g)$, where $s_i = \psi_i(u)/|\psi_i(u)|.$ The kernel of this map is $U_F^+$,
hence its image is isomorphic to $U_F/U_F^+$. The cokernel of this map is in
fact isomorphic to $Y$, the kernel of $C_F^+ \rightarrow C_F$, and both are isomorphic
to $\mathrm{Gal}(H_F^+/H_F)$ \cite[p. 47, Lemma
11.2]{ConHur88}. It follows that $|Y|\cdot |U_F/U_F^+|=|S|$, and so from
$\overline{N}_K/\overline{N}^+_K = N_K/N^+_K$ and
(\ref{split}) we obtain

$$|N_0(K)/N_0^+(K)| = \left\{ \begin{array}{ll} 2^{g-1} & \text{if $K/F$ is
unramified at all finite primes} \\ 2^g & \text{ otherwise}\end{array}\right.$$

Suppose $K\cap H_F^+=F$, so that $K/F$ is ramified at some finite prime. Then
considering our initial
assumption we have shown that if $\mathcal{M}_{\Phi}^1(\mathbbm{C})$ is
non-empty for some $\Phi=\Phi_0$, it is non-empty for all $\Phi$. Now the
surjectivity of $N_{K/F}: C_K \rightarrow C_F^+$ implies that $\Phi_0$
always exists. Indeed, if $\zeta_0\in K$ is any totally imaginary number, the
fractional ideal $\zeta_0\delta^{-1}_K$ descends to a fractional ideal of $F$.
Then there exists $\mathfrak{a} \in I_K$ such
that $N_{K/F}(\mathfrak{a}) \zeta_0^{-1} \delta_K$ is a principal ideal generated by
a totally positive element $r\in F$. In other words $\mathfrak{a} \mathfrak{a}^\sigma
\delta_K
=
(\zeta)$, where $\zeta=r\zeta_0$ is totally imaginary. Letting $\Phi_0$ be the
unique CM type for which $\Im(\phi(\zeta))<0$ for all $\phi\in \Phi_0$, we
obtain a pair $(\mathfrak{a},\zeta)$ corresponding to an element of
$\mathcal{M}_{\Phi_0}^1(\mathbbm{C})$.

Now suppose $K/F$ is unramified at all finite places, and pick a
totally imaginary element $\zeta_0\in K$. If $\zeta_0 \delta_K^{-1}$ (as an
ideal of $F$) is in the image of
$N_{K/F}^+$, then proceeding as in the previous case we obtain an element of
$\mathcal{M}_{\Phi_0}^1(\mathbbm{C})$ for some $\Phi_0$.
If $\alpha \delta_K^{-1}$ is not in the image of $N_{K/F}^+$, pick $r \in F$
such
that the class of $r{\calO_F}$ is in $Y$ and also not in the image of $N_{K/F}^+$.
Such an
element always exists, otherwise $N_{K/F}^+$ would be surjective, since it's
surjective onto $C_F^+/Y=C_F$. Then
$r_0\zeta_0 \delta_K^{-1}$ must be in the image of $N_{K/F}^+$, and so as
before we may find $\Phi_0$ such that $\mathcal{M}_{\Phi_0}^1(\mathbbm{C})\neq \emptyset$.

Thus our initial assumption is always satisfied, and $\mathcal{M}_\Phi^1(\mathbbm{C})\neq
\emptyset$ for all $\Phi$, unless $K/F$ is unramified at all finite primes. In
the latter case $\mathcal{M}_\Phi^1(\mathbbm{C})\neq \emptyset$ for $2^{g-1}$ CM types, which
is exactly half of them.
\end{proof}

We note that if $\mathcal{M}_\Phi^1(\mathbbm{C})$ is non-empty for some
$\Phi$, then there exists a number field $L_0$ such that $\mathcal{M}_\Phi^1(\operatorname{Spec}
\mathcal{O}_{L_0})\neq \emptyset$. Indeed, any object of $\mathcal{M}_\Phi^1(\mathbbm{C})$ can be
defined over some number field $L_0$. After enlarging  $L_0$ by a finite
extension we can assume $\mathcal{M}_\Phi^1(L_0)$ contains a
CM abelian variety with good reduction everywhere. Then $\mathcal{M}_\Phi^1(\operatorname{Spec}
\mathcal{O}_{L_0})\neq \emptyset$ by the theory of N\'eron models.

If $n$ is odd, via Proposition \ref{skewprop}, we offer an explicit way to
construct an object of
$\mathcal{M}_\Phi^1(\mathbbm{C})$ given one in $\mathcal{M}_\Phi^n(\mathbbm{C})$.

\begin{prop}\label{nodd}Assume that $n=2m+1$, and $(H,f) \in \operatorname{Skew}_\Phi^n({\calO_K})$.
Then
$(\mathfrak{a}, \alpha)\in \operatorname{Skew}_\Phi^1({\calO_K})$, where
	$$ \mathfrak{a} = \det(H)\otimes_{\calO_K} \delta_K^m,\ \ \ \alpha = (-1)^m
	(\det(f)\otimes \sigma).$$
\end{prop}
\begin{proof}

Since $H$ is a projective finitely presented ${\calO_K}$-module of rank $n$, $\det(H)
= \bigwedge_{\calO_K}^n H$ is a projective of rank one. Since
$f$ is an isomorphism, so is $\det(f): \det(H) \rightarrow \det(H^*)$.

Letting $\mathfrak{a} = \det(H)\otimes_{\calO_K} \delta_K^m$, we have canonical isomorphisms
$$\det(H^*) \otimes_{\calO_K} \delta_K^m \cong \det(H^\vee \otimes_{\calO_K} \delta_K^{-1}) \otimes_{\calO_K} \delta_K^m \cong \det(H)^\vee \otimes_{\calO_K} \delta_K^{m-n} \cong (\det(H)\otimes_{\calO_K} \delta_K^m)^\vee \otimes_{\calO_K} \delta_K^{-1}\cong \mathfrak{a}^*,$$
where we have used $\det(H^\vee \otimes_{\calO_K} \delta_K^{-1})\cong \det(H^\vee)\otimes_{\calO_K} \delta_K^{-n}$ and $\delta_K^\vee \cong \delta_K^{-1}$ in the middle, along with $m-n=-m-1$.

Let us denote the restriction of $\sigma$ to $\delta_K^m$ by the same symbol.
Using the above isomorphism, we obtain the ${\calO_K}$-linear map $\alpha: \mathfrak{a}
\rightarrow
\mathfrak{a}^*$, corresponding to
$$(-1)^m (\det(f)\otimes \sigma): \det(H)\otimes_{\calO_K} \delta_K^m \rightarrow
\det(H^*)\otimes_{\calO_K} \delta_K^m.$$

Note that $\sigma: \delta_K^m \rightarrow \delta_K^m$ corresponds to a non-degenerate positive-definite $\delta_K^{n-1}$-valued hermitian form on $\delta_K^m$ given by $(x,y)\mapsto x^\sigma y$. It follows that $\alpha$ is skew-hermitian and negative-definite along $\Phi$, if and only if $(-1)^m\det(f)$ is so. This we can verify after tensoring with $\mathbbm{Q}$.

Let $F: H\times H \rightarrow \delta_K^{-1}$ denote the sesquilinear form corresponding to $f$,  and $F_\mathbbm{Q}$ its $K$-sesquilinear extension to $H_\mathbbm{Q}$. Let $h_1,\cdots, h_n$ be an orthogonal basis of $H_\mathbbm{Q}$ with respect to $F_\mathbbm{Q}$, and put $\zeta_i = F_\mathbbm{Q}(h_i,h_i)$. The functionals $f_i(x)=\zeta_i^{-1} F(h_i,x)$ on $H_\mathbbm{Q}$ form the dual basis $\{f_i\}$ associated to $\{h_i\}$. The element $\eta= h_1\wedge \cdots \wedge h_n$ is a basis of $\det(H_\mathbbm{Q})$, identified with $\det(H)_\mathbbm{Q}$. Similarly, $\varphi = f_1 \wedge \cdots \wedge f_n$ is a basis of $\det(H^*_\mathbbm{Q})$, identified with $\det(H)_\mathbbm{Q}^\vee \otimes_{\calO_K} \delta_K^{-n}$. Let $\zeta = \prod_{i=1} \zeta_i$. Since $f_\mathbbm{Q}(h_i) = \zeta_i f_i$, we have
$$\det(f_\mathbbm{Q})(\eta) = f_\mathbbm{Q}(h_1)\wedge \cdots \wedge f_\mathbbm{Q}(h_n) = (\zeta_1 f_1) \wedge \cdots \wedge (\zeta_n f_n) =\zeta \varphi.$$

Then $\det(f_\mathbbm{Q})$, as a sesquilinear form $\det(H_\mathbbm{Q})\times \det(H_\mathbbm{Q}) \rightarrow \delta_K^{-n}$ has sole eigenvalue $$\det(f_\mathbbm{Q})(\eta)(\eta) = \zeta \varphi(\eta) =  \zeta (f_1(h_1) \wedge \cdots \wedge f_n(h_n)) = \zeta.$$

Since $(H,f)$ is skew-hermitian, each $\zeta_i$ is purely imaginary. Since $n$
is odd, the product $\zeta$ is also purely imaginary, which shows $\det(f)_\mathbbm{Q}$
is skew-hermitian. Since $(H,f)$ is negative-definite along $\Phi$, each
$\zeta_i$ satisfies $\Im(\phi(\zeta_i))<0$ for all $\phi\in \Phi$. We then have
$\Im(\phi(\zeta)) = (-1)^m \prod_{i=1}^n \Im(\phi(\zeta_i))$, which shows
$(-1)^m \det(f)_\mathbbm{Q}$ is negative-definite along $\Phi$. As $\det(f): \det(H)
\rightarrow \det(H^*)$ and $\sigma: \delta_K^{m} \rightarrow \delta_K^m$ are non-degenerate,
with values in $\delta_K^{-n}$ and $\delta_K^{n-1}$ respectively, $\alpha$ is
non-degenerate and $\delta_K^{-1}$-valued.
\end{proof}

The following proposition is a special case of the main theorem in the next
section.

\begin{prop}\label{basek}
Suppose $\mathcal{M}_\Phi^1(\mathbbm{C})\neq \emptyset$ and $k$ is an algebraically closed
field of characteristic zero. The
functor
$$\Sigma_{k}: \mathrm{Herm}_n({\calO_K}) \otimes \mathcal{M}_\Phi^1(k) \longrightarrow \mathcal{M}_\Phi^n(k)$$
induced by Serre's construction is an equivalence of categories.
\end{prop}
\begin{proof}
We can again assume $k=\mathbbm{C}$ by the standard descent argument. By Proposition
\ref{fullfaith}, the functor $\Sigma_\mathbbm{C}$ is fully faithful, so we must show
essential surjectivity.

Now we have a diagram of categories and functors
$$\begin{xymatrix}{\mathrm{Herm}_n({\calO_K})\otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1(\mathbbm{C}) \ar[r]^-{\Sigma_\mathbbm{C}}\ar[d]_{\mathbbm{1} \otimes \Theta_1} & \mathcal{M}_\Phi^n(\mathbbm{C}) \ar[d]^{\Theta_n}\\
\mathrm{Herm}_n({\calO_K})\otimes_{\mathrm{Herm}_1({\calO_K})} \operatorname{Skew}_\Phi^1({\calO_K}) \ar[r]_-\otimes &\operatorname{Skew}_\Phi^n({\calO_K})}
\end{xymatrix}$$
which is commutative up to isomorphism. The vertical arrows are equivalences of categories by Proposition \ref{skewprop}. To show the top arrow is essentially surjective, it's enough to show the same for the bottom arrow. In other words, it's enough to show every $(H,f)\in \operatorname{Skew}_\Phi^n({\calO_K})$ is isomorphic to $(h\otimes \alpha, M\otimes_{\calO_K} \mathfrak{a})$ for some $(M,h)\in \mathrm{Herm}_n({\calO_K})$ and $(\mathfrak{a},\alpha)\in \operatorname{Skew}_\Phi^1({\calO_K})$.

Let $(\mathfrak{a},\alpha)\in \operatorname{Skew}_\Phi^1({\calO_K})$, with $\mathfrak{a} \subset K$ a fractional
ideal. We can identify $\mathfrak{a}^*$ with $(\mathfrak{a}^\sigma)^{-1}\delta_K^{-1}$ and
$\alpha$ with multiplication by some $\zeta\in K$. Now let $\mathfrak{b} =
\mathfrak{a}^{-1}$ and define $\beta: \mathfrak{b} \rightarrow \mathfrak{b}^* \cong \mathfrak{a}^\sigma
\delta_K^{-1}$ by $\beta(x) = \zeta^{-1} x$. Since $(\mathfrak{a},\alpha)$ is
skew-hermitian and non-degenerate, so is $(\mathfrak{b},\beta)$. Since
$(\mathfrak{a},\alpha)$ is $\delta_K^{-1}$-valued and negative-definite along $\Phi$,
$(\mathfrak{b},\beta)$ is $\delta_K$-valued and negative-definite along $\Phi\sigma$.
Furthermore, the tensor product $(\mathfrak{a}\otimes_{\calO_K} \mathfrak{b}, \alpha \otimes
\beta)$ is isomorphic to $({\calO_K},\mathbbm{1})\in \mathrm{Herm}_1({\calO_K})$.

For $(H,f) \in \operatorname{Skew}_\Phi^n({\calO_K})$, let $(M,h)=(H,f)\otimes_{\calO_K} (\mathfrak{b},\beta)$. Since $f$ and $\beta$ are non-degenerate and skew-hermitian, with values in $\delta_K^{-1}$ and $\delta_K$ respectively, $h$ is non-degenerate, hermitian, and ${\calO_K}$-valued. As $f$ and $\beta$ are negative definite along $\Phi$ and $\Phi\sigma$ respectively, $h$ is positive-definite, therefore $(M,h)\in \mathrm{Herm}_n({\calO_K})$. Now the bottom arrow of the diagram above maps the object $(M,h)\boxtimes (\mathfrak{a},\alpha)$ in $\mathrm{Herm}_n({\calO_K})\otimes_{\mathrm{Herm}_1({\calO_K})} \operatorname{Skew}_\Phi^1({\calO_K})$ to $$(M,h)\otimes_{\calO_K} (\mathfrak{a},\alpha) = (H,f)\otimes_{\calO_K} (\mathfrak{b},\beta)\otimes_{\calO_K} (\mathfrak{a},\alpha)\cong (H,f) \otimes_{\calO_K} ({\calO_K},\mathbbm{1}) \cong (H,f).$$
Hence the bottom arrow is essentially surjective, from which the proposition
follows.
\end{proof}

\begin{comment}
\begin{prop} There exists a fractional ideal $\mathfrak{a} \subset K$, such that the abelian variety $\mathbbm{C}^\Phi/\mathfrak{a}$ admits an ${\calO_K}$-linear prinicpal polarization.
\end{prop}
\begin{proof}
If $A=\mathbbm{C}^\Phi/\mathfrak{a}$, the dual abelian variety $A^\vee$ is isomorphic to $\mathbbm{C}^\Phi/\mathfrak{b}$, where $\mathfrak{b} = (\mathfrak{d}\overline{\mathfrak{a}})^{-1}$, $\mathfrak{d}$ being the different ideal of $K/\mathbbm{Q}$. In this uniformization, any polarization $A \rightarrow A^\vee$ is given by a digonal matrix with entries $\phi_1(\zeta),\cdots,\phi_n(\zeta)$, for a purely imaginary $\zeta\in K$ such that $\operatorname{im}(\phi(\zeta))>0$ for all $\phi \in \Phi$ \cite[$\S$14.2]{ShimuraCM}. Thus $A$ admits a principal polarization if and only if for such a $\zeta$ we have $\zeta \mathfrak{a} = (\mathfrak{d}\overline{\mathfrak{a}})^{-1}$.
\end{proof}
\end{comment}

Now let $k$ be a finite extension of the reflex field $L$, and $S$ a connected locally noetherian scheme over $\operatorname{Spec}(k)$. Suppose $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(S)$.

\begin{prop}\label{fintyp}
For any $s\in S$, there exists an \'etale neighbourhood $U$ of $s$ such that the triple $(A_U,\iota_U,\lambda_U)\in \mathcal{M}_\Phi^n(U)$, obtained from $(A,\iota,\lambda)$ by base change, arises from the Serre construction. In other words $(A_U,\iota_U,\lambda_U)$ lies in the essential image of the functor
$$\Sigma_S: \mathrm{Herm}_n({\calO_K}) \otimes \mathcal{M}_\Phi^1(U) \longrightarrow \mathcal{M}_\Phi^n(U).$$
\end{prop}

\begin{proof}
Let $\mathcal{M}_k = \mathcal{M}_\Phi^n\otimes k \rightarrow \operatorname{Spec}(k)$ be the Deligne-Mumford stack over $\operatorname{Spec}(k)$ obtained by base change. Since $\mathcal{M}_\Phi^n \rightarrow \operatorname{Spec} {\calO_L}$ is \'etale and proper by Proposition \ref{etprop}, so is $\mathcal{M}_k \rightarrow \operatorname{Spec}(k)$. Let $M \twoheadrightarrow \mathcal{M}_k$ be a surjective \'etale morphism from a scheme $M$ to $\mathcal{M}_k$. Then the composition $M \rightarrow \operatorname{Spec} (k)$ is an \'etale morphism of schemes, so $M$ is isomorphic to a disjoint union $\coprod_{\alpha} \operatorname{Spec}(k_\alpha)$, with each $k_\alpha$ a finite (separable) extension of $k$.

Let $S \rightarrow \mathcal{M}_\Phi^n$ be the morphism corresponding to the triple $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(S)$. It lifts uniquely to a morphism $S \rightarrow \mathcal{M}_k$, since $S \rightarrow \operatorname{Spec}({\calO_L})$ factors through $\operatorname{Spec}(k) \rightarrow \operatorname{Spec}({\calO_L})$. Let $S'=S\times_{\mathcal{M}_k} M$ and consider the morphism $S' \rightarrow M$ lying over $S \rightarrow \mathcal{M}_k$. Since $M \rightarrow \mathcal{M}_k$ is \'etale and surjective, so is $S' \rightarrow S$.

Let $s\in S$ be a point. Let $U$ be a connected component of $S'$ containing a point $u$ mapping to $s\in S$, so that $(U,u)$ is an \'etale neighbourhood of $s$. The base change triple $(A_U,\iota_U,\lambda_U)$ corresponds to a morphism $U \rightarrow \mathcal{M}_\Phi^n$ which factors as a composition $U \rightarrow M \rightarrow \mathcal{M}_\Phi^n$. Since $U$ is connected and $M$ is a disjoint union of $\operatorname{Spec}(k_\alpha)$, the map $U \rightarrow M$ further factors through some $\operatorname{Spec}(k') \hra M$, where $k'$ is a finite extension of $k$. Thus, $U \rightarrow \mathcal{M}_\Phi$ can be written as a composition $U \rightarrow \operatorname{Spec} k' \rightarrow \mathcal{M}_\Phi^n$. That means there exists some triple $(A_{k'},\iota_{k'},\lambda_{k'})$ such that $(A_U,\iota_U,\lambda_U)$ is the constant triple obtained from it by base change through $U \rightarrow \operatorname{Spec}(k')$. Now, by Proposition \ref{basek}, the triple $(A_{k'},\iota_{k'},\lambda_{k'})$ can be obtained by Serre's construction, after passing to a finite extension $k''$ of $k'$. By replacing the \'etale neighbourhood $(U,u)$ of $s$ with a smaller one, we can assume $k''=k'$. Then $(A_{k'},\iota_{k'},\lambda_{k'}) \simeq (M,h)\otimes (A_0,\iota_0,\lambda_0)$ for some $(M,h)\in \mathrm{Herm}_n({\calO_K})$, $(A_0,\iota_0,\lambda_0)\in \mathcal{M}_\Phi^1(k')$. Therefore $(A_U,\iota_U,\lambda_U) \simeq (M,h) \otimes ({A_0}_U,{\iota_0}_U,{\lambda_0}_U)$, where $({A_0}_U,{\iota_0}_U,{\lambda_0}_U)\in \mathcal{M}_\Phi^1(U)$ is the triple obtained from $(A_0,\iota_0,\lambda_0)$ by base change along $U \rightarrow \operatorname{Spec}(k')$.
\end{proof}

Proposition \ref{fintyp} says if $S$ is locally noetherian over a finite extension of $L$, each triple $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(S)$ can be obtained \textit{\'etale locally on the base $S$} by Serre's construction. In the next section this is generalized to any locally noetherian $S$ over $\operatorname{Spec} {\calO_L}$, and interpreted in terms of stacks on the big \'etale site $(\mathrm{Sch}_{/{\calO_L}})_{\acute{e}t}$.

\subsection{Stackification}
In this section we will assume that $\mathcal{M}_\Phi^1(\mathbbm{C})$ is non-empty. In
Theorem \ref{existence} we showed that this is almost always the case. In
particular that means $\mathcal{M}_\Phi^1(\operatorname{Spec} \mathcal{O}_{L_0})$ is non-empty for some
number field $L_0$.

We recall some of the constructions from $\S 2$. The 2-group $\mathrm{Herm}_1({\calO_K})$ acts on $\mathrm{Herm}_n({\calO_K})$ via ordinary tensor product. It also acts fibrewise on $\mathcal{M}_\Phi^1$ (Definition \ref{fibrewise}), as a category fibred in groupoids over $\mathrm{Sch}_{/{\calO_L}}$. Let $\mathcal{T}$ denote the tensor product of $\mathrm{Herm}_n({\calO_k})$ and $\mathcal{M}_\Phi^1$ over $\mathrm{Herm}_1({\calO_K})$, i.e. $\mathcal{T} = \mathrm{Herm}_n({\calO_K})\otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1$ in the notation of $\S 2$. We then have a functor $\mathcal{T} \rightarrow \mathrm{Sch}_{/{\calO_L}}$ coming from the $\mathcal{M}_\Phi^1$ factor.

\begin{lemma}The category $\mathcal{T}$ is fibred in groupoids over $\mathrm{Sch}_{/{\calO_L}}$.
\end{lemma}
\begin{proof}
We apply Proposition \ref{fiberedprop} to deduce this, for which we need to show the action of $\mathrm{Herm}_1({\calO_K})$ on $\mathcal{M}_\Phi^1$ is free on objects (Definition \ref{obfree}), and that $\mathcal{T}$ is left-cancellative over $\mathrm{Sch}_{/{\calO_L}}$ (Definition \ref{relcan}).

For $(\mathfrak{a},\alpha)$ and $(\mathfrak{b},\beta)$ in $\mathrm{Herm}_1({\calO_K})$ and $(A,\iota,\lambda)\in \mathcal{M}_\Phi^1(S)$, suppose $(\mathfrak{a},\alpha)\otimes (A,\iota,\lambda)$ is isomorphic to $(\mathfrak{b},\beta)\otimes (A,\iota,\lambda)$. We claim $(\mathfrak{a},\alpha)\simeq (\mathfrak{b},\beta)$. By considering $\mathfrak{a} \otimes_{\calO_K} A \simeq \mathfrak{b} \otimes_{\calO_K} A$ on $A$-valued points we get $\mathfrak{a} \simeq \mathfrak{b}$, so without loss we can assume $\mathfrak{a} = \mathfrak{b}$. An isomorphism $(\mathfrak{a},\alpha)\otimes(A,\iota,\lambda) \simeq (\mathfrak{a},\beta)\otimes (A,\iota,\lambda)$ is in particular an ${\calO_K}$-linear automorphism of the abelian scheme $\mathfrak{a}\otimes_{\calO_K} A$, hence of the form $\mathbbm{1}_\mathfrak{a} \otimes \iota(r)$ for some $r\in {\calO_K}^\times$.
To be an isomorphism of triples it must satisfy $$\alpha \otimes \lambda = (\mathbbm{1}_\mathfrak{a}\otimes \iota(r))^\vee \circ (\beta \otimes \lambda) \circ (\mathbbm{1}_{\mathfrak{a}} \otimes \iota(r)) = (\beta \otimes \lambda) \circ (\mathbbm{1}\otimes \iota(r^\sigma r) = \beta \otimes (\lambda \circ \iota(r^\sigma r))= (r^\sigma r \cdot \beta)\otimes \lambda,$$
which implies $rr^\sigma \cdot \beta = \alpha$. In that case the map $\mu_r: \mathfrak{a} \rightarrow \mathfrak{a},\ x \mapsto rx$ gives an isomorphism $(\mathfrak{a},\alpha)\simeq (\mathfrak{a},\beta)$. This shows the action of $\mathrm{Herm}_1({\calO_K})$ on $\mathcal{M}_\Phi^1$ is free on objects.

To show $\mathcal{T}$ is left-cancellative with respect to $\mathrm{Sch}_{/{\calO_L}}$, consider the functor $\mathcal{T} \rightarrow \mathcal{M}_\Phi^n$ over $\mathrm{Sch}_{/{\calO_L}}$ induced by the Serre tensor construction, which over the fibres $\mathcal{T}_S$ coincides with $\Sigma_S$. We first show this functor is faithful. By Proposition \ref{fullfaith} it is fully faithful on each fibre. Now suppose $\alpha: T \rightarrow S$ is a morphism in $\mathrm{Sch}_{/{\calO_L}}$, and $\xi_1$, $\xi_2$ are maps $(M,h)\boxtimes (A,\iota,\lambda) \rightarrow (N,k)\boxtimes (B,\jmath,\mu)$ in $\mathcal{T}$ lying over $\alpha$, which are mapped to the same morphism in $\mathcal{M}_\Phi^n$. Any such map factors through $\beta = \mathbbm{1}_{(N,k)}\boxtimes p_T: (N,k)\boxtimes (B_T,\jmath_T,\mu_T) \rightarrow (N,k)\boxtimes (B,\jmath,\mu)$, where $p_T: (B_T,\jmath_T,\mu_T) \rightarrow (B,\jmath,\mu)$ is the base change map in $\mathcal{M}_\Phi^1$. Then $\xi_1 = \beta\circ \eta_1$, $\xi_2 = \beta \circ \eta_2$, for morphisms $\eta_1$, $\eta_2$ lying over $\mathbbm{1}_T$. The image of $\mathbbm{1}_{(N,k)}\boxtimes p_T$ under $\mathcal{T} \rightarrow \mathcal{M}_\Phi^n$ is the base change map in $\mathcal{M}_\Phi^n$, so it is in particular strongly cartesian. That implies $\Sigma_{T}(\eta_1) = \Sigma_T(\eta_2)$, which implies $\eta_1 = \eta_2$, since $\Sigma_T$ is faithful. This shows $\mathcal{T} \rightarrow \mathcal{M}_\Phi^n$ is also faithful. Now, since $\mathcal{M}_\Phi^n$ is fibred in groupoids over $\mathrm{Sch}_{/{\calO_L}}$, by Lemma \ref{canlem} it is left-cancellative over $\mathrm{Sch}_{/{\calO_L}}$. Then $\mathcal{T}$ is also left-cancellative over $\mathrm{Sch}_{/{\calO_L}}$, by faithfulness of $\mathcal{T} \rightarrow \mathcal{M}_\Phi^n$. Thus by Proposition \ref{fiberedprop}, $\mathcal{T}$ is also fibred in groupoids over $\mathrm{Sch}_{/{\calO_L}}$.
\end{proof}

We may identify $\mathcal{T}$ with a functor $\mathrm{Sch}_{/{\calO_L}} \rightarrow \rm{(Groupoids)}$ that assigns to each $S\in \mathrm{Sch}_{/{\calO_L}}$ the tensor product of groupoids $\mathrm{Herm}_n({\calO_K})\otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1(S)$. By Proposition \ref{fullfaith}, for each $S\in \mathrm{Sch}_{/{\calO_L}}$ the functor $\Sigma_S: \mathcal{T}(S) \rightarrow \mathcal{M}_\Phi^n(S)$ is fully faithful. Since $\mathcal{T}$ is fibred in groupoids over $\mathrm{Sch}_{/{\calO_L}}$, the functor $\mathcal{T} \rightarrow \mathcal{M}_\Phi^n$ induced by the Serre construction is also fully faithful.

We define $\mathrm{Herm}_n({\calO_K})\otimes \mathcal{M}_\Phi^1$ to be the stack associated to the presheaf $\mathcal{T}$ on the big \'etale site over $\operatorname{Spec} {\calO_L}$. Here we have suppressed the subscript $\mathrm{Herm}_1({\calO_K})$ from the notation to differentiate it from $\mathcal{T}$. Since the functor $\mathcal{T}\rightarrow \mathcal{M}_\Phi^n$ is fully faithful and $\mathcal{M}_\Phi^n$ is a stack, the presheaf $\mathcal{T}$ is already separated. It follows that $\mathrm{Herm}_n({\calO_K})\otimes \mathcal{M}_\Phi^1$ is obtained from $\mathcal{T}$ by one application of the plus construction. In other words, $(\mathrm{Herm}_n({\calO_K})\otimes \mathcal{M}_\Phi^1)(S)$ consists of descent data relative to \'etale coverings of $S$, with the appropriate morphisms \cite[Ch. 3, Lemma 3.2]{LaumMorChamps}.

We thus obtain a commutative diagram of categories fibred in groupoids
\begin{align}\tag{$\triangle$}
\begin{split}
\xymatrix{
& \mathcal{T} \ar[dl]_-{\mathrm{Sheafification\ \ \ }} \ar[dr]^-{\mathrm{Serre\ construction}} \\
\mathrm{Herm}_n({\calO_K}) \otimes \mathcal{M}_\Phi^1 \ar[rr]^-{\Sigma} & & \mathcal{M}_\Phi^n,
}\label{bigdiag}
\end{split}
\end{align}
where $\Sigma$ is the functor induced by the universal property of sheafication.

Our results so far can be summarized as follows: the functor $\Sigma$ in the diagram $(\Delta)$ identifies $\mathrm{Herm}_n({\calO_K})\otimes \mathcal{M}_\Phi^n$ with a full subcategory of $\mathcal{M}_\Phi^n$. Furthermore, when $S$ is locally noetherian over a finite extension of $L$, the induced functor $(\mathrm{Herm}_n({\calO_K})\otimes \mathcal{M}_\Phi^n)(S) \rightarrow \mathcal{M}_\Phi^n(S)$ is an equivalence of categories, by Proposition \ref{fintyp}. The fact that $\mathcal{M}_\Phi^n$ is \'etale over $\operatorname{Spec} {\calO_L}$ allows us to extend this to characteristic $p$.

\begin{prop}\label{perfcharp}
Let $S=\operatorname{Spec}(k)$ for $k$ a perfect field of characteristic $p$. The functor $\Sigma$ in (\ref{bigdiag}) induces an equivalence of categories on the fibre over $S$.
\end{prop}
\begin{proof}
Let $W_k$ be the ring of Witt vectors of $k$, with fraction field $W_k[p^{-1}]$. Since $\mathcal{M}_\Phi^n$ is smooth, an object $(A_0,\iota_0,\lambda_0)\in \mathcal{M}_\Phi^n(k)$ lifts to $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(W_k)$. By Proposition \ref{basek}, after base changing to a finite extension $F$ of $W_k[p^{-1}]$, we have an isomorphism $(A_F,\iota_F,\lambda_F) \simeq (M,h) \otimes (B,\jmath,\mu)$ for some $(B,\jmath,\mu) \in \mathcal{M}_\Phi^1(F)$, and $(M,h)\in \mathrm{Herm}_n({\calO_K})$. Since $B$ has CM, after possibly enlarging $F$ again it has good reduction, and its N\'eron model $\mathscr{B}$ over ${\calO_F}$ is an abelian scheme \cite{SerreTate}.

By the N\'eron mapping property, the action of ${\calO_K}$ and the polarization $\mu$ also lift to $\mathscr{B}$, so we have a triple $(\mathscr{B},\jmath_\mathscr{B}, \mu_{\mathscr{B}})\in \mathcal{M}_\Phi^1({\calO_F})$, and we can form $(M,h) \otimes_{\calO_K} (\mathscr{B},\jmath_\mathscr{B},\mu_{\mathscr{B}}) \in \mathcal{M}_\Phi^n({\calO_F})$. Now it is easy to verify that Serre's construction commutes with taking N\'eron models, so $M \otimes_{\calO_K} \mathscr{B} $ is the N\'eron model of $M \otimes_{\calO_K} B$. On the other hand, the base change $\mathscr{A}$ of $A$ to $\operatorname{Spec} {\calO_F}$ is also a N\'eron model for its generic fibre, which is again $M\otimes_{\calO_K} B$, so we have $\mathscr{A} \simeq M\otimes_{\calO_K} \mathscr{B}$ by uniqueness of the model, which implies $(\mathscr{A},\iota_{{\calO_F}}, \lambda_{{\calO_F}})\simeq (M,h) \otimes (\mathscr{B},\jmath_\mathscr{B},\mu_\mathscr{B})$ by the mapping property.

Let $k'$ denote the residue field of ${\calO_F}$, a finite extension of $k$. The isomorphism $(\mathscr{A},\iota_{{\calO_F}}, \lambda_{{\calO_F}})\simeq (M,h) \otimes (\mathscr{B},\jmath,\mu)$ reduces modulo the prime of ${\calO_F}$ to an isomorphism $(A',\iota',\lambda') \simeq (M,h) \otimes (B',\jmath',\mu')$ over $k'$. Since $(A',\iota',\lambda')$ is the base change of $(A_0,\iota_0,\lambda_0)$ to $k'$, we have shown that an arbitrary triple $(A_0,\iota_0,\lambda_0)\in \mathcal{M}_\Phi^n(k)$ arises from Serre's construction after passing to an \'etale cover $\operatorname{Spec}(k') \rightarrow \operatorname{Spec}(k)$. Thus on the fibre over $\operatorname{Spec}(k)$ the functor $\Sigma$ is essentially surjective, and being fully faithful by Proposition \ref{fullfaith}, is an equivalence of categories.
\end{proof}
We can now prove the main theorem.
\begin{thm} \label{mainiso}
If $\mathcal{M}_\Phi^1(\mathbbm{C})\neq \emptyset$, the functor $\Sigma: \mathrm{Herm}_n({\calO_K}) \otimes
\mathcal{M}_\Phi^1 \rightarrow \mathcal{M}_\Phi^n$ is an isomorphism of stacks.
\end{thm}
\begin{proof}
We will prove this by showing that $\Sigma$ induces equivalences of categories on the stalks of the geometric points of the big \'etale site on $\operatorname{Spec}({\calO_L})$. By definition these are the geometric points $\overline{s} \rightarrow S$, where $S$ is a scheme locally of finite type over $\operatorname{Spec}({\calO_L})$. Since ${\calO_L}$ is a Jacobson ring, it's enough to only consider geometric points $\overline{s} \rightarrow S$ having image $s\in S$ lying over a closed point $t \in\operatorname{Spec}({\calO_L})$ \cite[II, Remark 2.17(b)]{Milne_Etale}. In that case since $S$ is locally of finite type, $s\in S$ is closed and $k(t) \subset k(s)$ is a finite extension. As $k(t)$ is a finite field, $k(s)$ is perfect, and in particular Proposition \ref{perfcharp} applies to $k=k(s)$.

Let $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(S)$ be a triple corresponding to a morphism $S \rightarrow \mathcal{M}_\Phi^n$ and suppose $\overline{s} \rightarrow S$ is a geometric point whose image $s\in S$ is closed, with $k(s)$ perfect. We want to show there exists a finite \'etale morphism $U\rightarrow S$ through which $\overline{s} \rightarrow S$ factors, such that the base change $(A_U,\iota_U,\lambda_U)$ of $(A,\iota,\lambda)$ to $U$ is obtained by the Serre construction.

Let $(A_s,\iota_s,\lambda_s)\in \mathcal{M}_\Phi^n(k(s))$ denote the fibre of $(A,\iota,\lambda)$ over $s$, which corresponds to the composition $\operatorname{Spec} k(s) \rightarrow S \rightarrow \mathcal{M}_\Phi^n$. By Proposition \ref{perfcharp} there exists a finite extension $k'$ of $k(s)$ contained in $k(\overline{s})$, such that the base change $(A_{s'},\iota_{s'},\lambda_{s'})$ of $(A_s,\iota_s,\lambda_s)$ to $s'=\operatorname{Spec}(k')$ is isomorphic to $(M,h)\otimes(B_0,\jmath_0,\mu_0)$ for some $(M,h)\in \mathrm{Herm}_n({\calO_K})$ and $(B_0,\jmath_0,\mu_0)\in \mathcal{M}_\Phi^1(k(s'))$.

Now, let $\mathcal{S}_{(M,h)}: \mathcal{M}_\Phi^1 \rightarrow \mathcal{M}_\Phi^n$ be the morphism of stacks over $\operatorname{Spec} ({\calO_L})$ given on sections by $(B,\jmath,\mu)\mapsto (M,h)\otimes(B,\jmath,\mu)$. Let $S' = S \times_{\mathcal{M}_\Phi^n} \mathcal{M}_\Phi^1$. We have a commutative diagram,
\begin{flalign*}
\begin{xymatrix}{ \overline{s} \ar[r]
& \operatorname{Spec}(k')\ar@{.>}[dr] \ar@/^/[drr]^{(B_0,\jmath_0,\mu_0)} \ar@/_/[ddr]\\ & & S\times_{\mathcal{M}_\Phi^n} \mathcal{M}_\Phi^1 \ar[r]\ar[d] & \mathcal{M}_\Phi^1 \ar^{\mathcal{S}_{(M,h)}}[d] \\ & & S \ar[r]_{(A,\iota,\lambda)} & \mathcal{M}_\Phi^n,
}\end{xymatrix}
\end{flalign*}
where $(A,\iota,\lambda)$ and $(B_0,\jmath_0,\mu_0)$ label their corresponding morphisms into $\mathcal{M}_\Phi^n$ and $\mathcal{M}_\Phi^1$, respectively.

By the universal property of the fibre product, for any morphism $U \rightarrow S$, the base change triple $(A_U,\iota_U,\lambda_U)$ arises from Serre's construction with $(M,h)$, if and only if the map $U\rightarrow S$ factors through $S' \rightarrow S$. Thus $\operatorname{Spec}(k') \rightarrow S$ factors as in the diagram, since $(A_{s'},\iota_{s'},\lambda_{s'})\simeq (M,h)\otimes (B_0,\jmath_0,\mu_0)$. We wish to find a finite \'etale morphism of schemes $U\rightarrow S$, which factors through $S' \rightarrow S$, and through which $\overline{s}\rightarrow S$ factors. The former condition means that $(A_U,\iota_U,\lambda_U)$ arises from Serre's construction with $(M,h)$, and the latter that $U \rightarrow S$ is an \'etale neighbourhood of $\overline{s} \rightarrow S$. We claim that $S' \rightarrow S$ itself is an \'etale morphism of schemes, so that we can take $U=S'$.

We first note that $\mathcal{S}_{(M,h)}: \mathcal{M}_\Phi^1 \rightarrow \mathcal{M}_\Phi^n$ is \'etale, proper, and representable by algebraic spaces. Indeed, by Theorem \ref{etprop} the stacks $\mathcal{M}_\Phi^n$ and $\mathcal{M}_\Phi^1$ are \'etale and proper over $\operatorname{Spec}({\calO_L})$, so any ${\calO_L}$-morphism $\mathcal{M}_\Phi^n \rightarrow \mathcal{M}_\Phi^1$ is \'etale and proper. The morphism $\mathcal{S}_{(M,h)}$ is also representable by algebraic spaces, because tensoring with $(M,h)$ is a faithful functor $\mathcal{M}_\Phi^1(T) \rightarrow \mathcal{M}_\Phi^n(T)$ for any $T\in (\mathrm{Sch}_{/{\calO_L}})$. It follows that $S' \rightarrow S$ is an \'etale and proper morphism of algebraic spaces. Now any separated and locally quasi-finite morphism of algebraic spaces, in particular $S' \rightarrow S$, is representable by schemes. Then since $S$ itself is a scheme, so is $S'$.

Then if $U=S'$, and $u$ is the composition $\overline{s} \rightarrow \operatorname{Spec}(k') \rightarrow S'$, we have the desired \'etale neighbourhood $(u,U)$ of $\overline{s} \rightarrow S$. In other words, we have shown that for every triple $(A,\iota,\lambda)\in \mathcal{M}_\Phi^n(S)$, and every geometric point $\overline{s} \rightarrow S$ whose image $s\in S$ is closed, there exists an \'etale neighbourhood of $\overline{s} \rightarrow S$ such that the triple $(A_U,\iota_U,\lambda_U)$ obtained by base change is in the essential image of $\Sigma_U$. Hence $\Sigma$ induces an essentially surjective functor $\Sigma_{\overline{s}/S}$ on the \'etale stalks at $\overline{s}\rightarrow S$. Since $\Sigma$ is fully faithful by Proposition \ref{fullfaith}, $\Sigma_{\overline{s}/S}$ is an equivalence of categories. As the points $\overline{s}\rightarrow S$ form a very dense subset of all geometric points of the big \'etale site over $\operatorname{Spec} {\calO_L}$, it follows that $\Sigma$ is an isomorphism of \'etale sheaves, hence an isomorphism of stacks.
\end{proof}

To prevent language from obscuring content, we restate the results in plainer terms below.

\begin{thm}\label{vanilla} Let $S$ be a connected locally noetherian scheme over $\operatorname{Spec} {\calO_L}$.
\begin{enumerate}
\item[(a)] For every object $(A,\iota,\lambda)$ of $\mathcal{M}_\Phi^n(S)$, and every point $s\in S$, there exists an \'etale neighbourhood $U \rightarrow S$ of $s$, as well as objects $(M,h)\in \mathrm{Herm}_n({\calO_K})$, $(A_0,\iota_0,\lambda_0)\in \mathcal{M}_\Phi^1(U)$, such that there is an isomorphism of triples
$$(A_{U}, \iota_{U},\lambda_{U}) \xrightarrow{\raisebox{-5pt}{$\sim$}} (M,h)\otimes_{{\calO_K}} (A_0,\iota_0,\lambda_0).$$

\item[(b)] For a morphism $\phi: (A,\iota,\lambda) \rightarrow (B,\jmath,\mu)$ of $\mathcal{M}_\Phi^n(S)$, let $\{U_i \rightarrow S\}_{i\in I}$ be a cover of $S$ by \'etale morphisms such that, as in (a), there are isomorphisms
$$\psi_{i}: (A_{U_i},\iota_{U_i},\lambda_{U_i}) \xrightarrow{\raisebox{-5pt}{$\sim$}} (M_i,h_i)\otimes (A_i,\iota_i,\lambda_i),\ \ \ \psi_i': (B_{U_i},\jmath_{U_i},\mu_{U_i})\xrightarrow{\raisebox{-5pt}{$\sim$}} (N_i,k_i)\otimes (B_i,\jmath_i,\lambda_i).$$
Then there exist $(\mathfrak{a}_i,\alpha_i)\in \mathrm{Herm}_1({\calO_K})$, where $\mathfrak{a}_i = \mathrm{Hom}_{\calO_K}(A_i,B_i)$, and isomorphisms
$$f_i: (M_i,h_i) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N_i,k_i) \otimes_{\calO_K} (\mathfrak{a}_i,\alpha_i),\ \ \phi_i: (A_i,\iota_i,\lambda_i) \xrightarrow{\raisebox{-5pt}{$\sim$}} (\mathfrak{a}_i^{\vee},\alpha_i^\vee) \otimes (B_i,\jmath_i,\mu_i),$$
such that $\psi_i^{-1} \circ \phi \circ \psi_i = \omega_i \circ (f_i \otimes \phi_i)$ for each $i\in I$, and $\omega_i$ is a canonical isomorphism
$$ ((N_i,k_i)\otimes_{\calO_K} (\mathfrak{a}_i,\alpha_i)) \otimes ((\mathfrak{a}_i^\vee,\alpha_i^\vee)\otimes (A_i,\iota_i,\lambda_i)) \xrightarrow{\raisebox{-5pt}{$\sim$}} (N_i,k_i)\otimes (A_i,\iota_i,\lambda_i).$$
\end{enumerate}
\end{thm}

\subsection{A simple example}

We give an example with elliptic curves. Let $(K,\Phi)$ consist of a quadratic imaginary number field $K$ and an embedding $K \subset \mathbbm{C}$. Let $H$ be the Hilbert class field of $K$, and $E$ an elliptic curve with CM by ${\calO_K}$, defined over $H$. Let $F$ be a quadratic extension of $H$, and put $A = \mathrm{Res}^F_H E_F$. Then $A_F \simeq E_F \times E_F \simeq {\calO_K}^2\otimes_{\calO_K} E_F$. We claim $A$ itself is not isomorphic to any $M\otimes_{\calO_K} E'$ over $H$.

Assume $A\simeq M\otimes_{\calO_K} E'$. Since $E'$ is also an elliptic curve with CM by ${\calO_K}$ (defined over $H$), it follows that $E' \simeq E^\tau$ for some $\tau \in \mathrm{Gal}(H/K)$. Then by the main theorem of complex multiplication, $E' \simeq \mathfrak{a} \otimes_{\calO_K} E$ for a fractional ideal $\mathfrak{a} \subset K$. Letting $M_\mathfrak{a} = M\otimes_{\calO_K} \mathfrak{a}$ we have $A\simeq M\otimes_{\calO_K} (\mathfrak{a} \otimes_{\calO_K} E) \cong M_\mathfrak{a} \otimes_{\calO_K} E$. Then $A_F \simeq M_\mathfrak{a} \otimes_{\calO_K} E_F \simeq {\calO_K}^2 \otimes_{\calO_K} E_F$, which implies $M_\mathfrak{a} \simeq {\calO_K}^2$, and $A\simeq {\calO_K}^2\otimes_{\calO_K} E \cong E\times E$. But $E\times E$ is not isomorphic to $\mathrm{Res}^F_H E$, so we reach a contradiction.

To translate into triples, fix $\iota: {\calO_K} \rightarrow \mathrm{End}(E)$, and let $\lambda$ be the canonical ${\calO_K}$-linear principal polarization on $E$. The action of the non-trivial element of $\mathrm{Gal}(F/H)$ on $A_F \simeq E_F \times E_F$ is the flip automorphism that switches the two factors. The product polarization $\lambda_F\times \lambda_F$ on $E_F \times E_F$ commutes with this automorphism, so descends to a polarization $\lambda_0$ on $A$, which is principal and ${\calO_K}$-linear. Likewise, the action of ${\calO_K}$ on $E_F \times E_F$ descends to an action $\iota_0: {\calO_K} \rightarrow \mathrm{End}(A)$. Hence, $(A,\iota_0,\lambda_0)$ is an object of $\mathcal{M}_\Phi^2(H)$. We have seen that $A$ does not arise from the Serre construction, and so $(A,\iota_0,\lambda_0)$ is not in the essential image of the functor $\Sigma_{\operatorname{Spec} H}$. But once base changed to $F$, the triple $(A_F,\iota_{0,F},\lambda_{0,F})\in \mathcal{M}_\Phi^2(F)$ does lie in the essential image of $\Sigma_{\operatorname{Spec} F}$. Specifically, it is isomorphic to $({\calO_K}^2,h)\otimes (E_F,\iota_F,\lambda_F)$, where $h: {\calO_K}^2 \rightarrow ({\calO_K}^2)^\vee$ corresponds to the standard hermitian form $H: {\calO_K}^2 \times {\calO_K}^2 \rightarrow {\calO_K}$, given by $H((x_1,x_2),(y_1,y_2)) = y_1 x_1^\sigma + y_2 x_2^\sigma$.

The above example shows why the functor $S \mapsto \mathrm{Herm}_2({\calO_K})\otimes_{\mathrm{Herm}_1({\calO_K})} \mathcal{M}_\Phi^1(S)$ has to be sheafified. The object $(A,\iota_0,\lambda_0)\in \mathcal{M}_\Phi^2(H)$ arises only \'etale locally from the Serre construction, after passing to the surjective \'etale cover $\operatorname{Spec} F \rightarrow \operatorname{Spec} H$. In other words, $A$ is obtained by a non-trivial gluing of two copies of $M\otimes_{\calO_K} E$, with $M={\calO_K}^2$, along the self-intersection of the \'etale neighbourhood $\operatorname{Spec} F \rightarrow \operatorname{Spec} H$. The automorphism of $M\otimes_{\calO_K} E_F$ used in the gluing is the coordinate flip map of ${\calO_K}^2$. Since this automorphism comes from $M$ and not $E$, the same gluing can not be performed on two copies of $E$. Thus sheafifying the functor $S \mapsto \mathrm{Herm}_n({\calO_K}) \otimes_{\calO_K} \mathcal{M}_\Phi^1(S)$ accounts for those triples that can be constructed \'etale locally via automorphisms of the objects $(M,h)\in \mathrm{Herm}_n({\calO_K})$.

\section*{Final Remarks}

The results of $\S1$, in particular Theorem \ref{mainthm} and Proposition \ref{mainprop}, are more general than the particular use we've made of them. They may have further applications, for instance to moduli spaces of abelian schemes with action by an order in a quaternion algebra.

Since Serre's construction commutes with base change, Proposition \ref{basek} allows a description of the action of $\mathrm{Aut}(\mathbbm{C})$ on $\mathcal{M}_\Phi^n$, by relating it to the description of the action on $\mathcal{M}_\Phi^1$ given by the theory of complex multiplication \cite[appx A]{cmlift}. We hope to further explore this in another article.
\bibliographystyle{plain}
{\small

redpajama_set_name: RedPajamaArXiv