I'm a bit puzzled about the following considerations, and am looking for some explanations or maybe some references about it.

**Setting:** Let $E/F$ be a CM extension of number fields ($F$ being totally real) and let $(V, \langle\cdot{},\cdot{}\rangle)$ be a $n$-dimensional nondegenerate $E/F$-hermitian space (with respect to the complex conjugation $c\in\mathrm{Gal}(E/F)$), for some positive integer $n$. *Lattices* will all be of full rank.

One defines a (connected) reductive group scheme $\mathrm{U}(V)$ over $\mathrm{Spec}\,F$ by setting, for all $F$-algebra $R$, $$\mathrm{U}(V)(R) =\{g\in \mathrm{GL}(V\otimes_F R);\, \langle g\cdot{}v,g\cdot{}w\rangle =\langle v,w\rangle,\, \forall v,\,w \in V\otimes_F R\}.$$

By definition, one gets a closed immersion between (affine) $F$-group schemes $\mathrm{U}(V)\hookrightarrow \mathrm{GL}(V_F)=\mathrm{Res}_{E/F}\mathrm{GL}(V)$

Let $\tau$ denote any finite place of $F$. If $L$ is an $\mathcal{O}_E$-lattice in $V$ (resp. an $\mathcal{O}_{E_{\tau}}$–lattice in $V_{\tau}$, with $\mathcal{O}_{E_{\tau}}:=\mathcal{O}_E\otimes_{\mathcal{O}_F}\mathcal{O}_{F_{\tau}}$ and $V_{\tau}=V\otimes_F F_{\tau}$. e.g., if $\tau$ is inert in $E/F$ then $\mathcal{O}_{E_{\tau}}$ is just the ring of integers of the quadratic extension $E_{\tau}=E\otimes_F F_{\tau}$ of $F_{\tau}$, and $V_{\tau}$ is the $n$-dimensional $E_{\tau}$-vector space $V\otimes_E E_{\tau}$) one defines its dual by setting $$L^{\vee}=\{z\in V;\,\langle z, L\rangle \in \mathcal{O}_E\}$$ (resp. $L^{\vee}=\{z\in V_{\tau};\,\langle z, L\rangle \in \mathcal{O}_{E_{\tau}}\}$)

Now, take any $\mathcal{O}_E$-lattice $L$ and assume that $L\subset L^{\vee}$ and set $N=[L^{\vee}:L]$. Take $S$ to be the finite set of finite places of $F$ containing the prime divisors of $N\mathcal{O}_F$, and set $\mathcal{O}_F^S$ to be the ring of $S$-integers in $F$, $$\mathcal{O}_F^S=\{x\in F;\, \mathrm{ord}_v(x)\ge 0, \, \forall v\notin S\}.$$ Away from $S$, the local lattice $L_{\tau}:=L\otimes_{\mathcal{O}_E}\mathcal{O}_{E_{\tau}}$ is self-dual. Accordingly, the local pairing

$$\langle \cdot{},\cdot{}\rangle_{\mathcal{O}_{E_{\tau}}}:\, L_{\tau}\times L_{\tau}\rightarrow \mathcal{O}_{E_{\tau}}$$ is perfect, for all $\tau\notin S$.

- My first question.
*Is the functor which goes from the category of $\mathcal{O}_F^S$-algebras to the category of groups, and sends any $R/\mathcal{O}_F^S$ to the group $$\underline{\mathrm{U}}_V(R):=\{g\in \mathrm{GL}(L\otimes_{\mathcal{O}_F}R);\, \langle g\cdot{}v,g\cdot{}w \rangle=\langle v,w \rangle\in\mathcal{O}_E\otimes_{\mathcal{O}_F}R, \,\forall v,\,w\in L\otimes_{\mathcal{O}_F}R\}$$ (whose restriction to $F$-algebras coincides with $\mathrm{U}(V)$), representable by a smooth $\mathrm{Spec}\,\mathcal{O}_F^S$-group scheme $\underline{\mathrm{U}}_V$, such that $\underline{\mathrm{U}}_V\times\mathrm{Spec}\,F\simeq \mathrm{U}(V)$ ? Moreover, are the fibers $(\underline{\mathrm{U}}_V)_v$ of $\underline{\mathrm{U}}_V$ at $v$ already reductive for all $v\notin S$, or do we possibly need to enlarge $S$ ?*

On the other hand, a more general construction related to reductive groups is described (for instance) in Chapter II of Getz-Hahn's book *An Introduction to Automorphic Representations with a view toward Trace Formulae*, whose online version can be found on this page https://services.math.duke.edu/~hahn/Chapter2.pdf

Namely, one may apply their Lemma 2.4.2 in the following way: the choice of $L$ defines an integral model $\mathrm{GL}(V)_{\mathcal{O}_F}$, namely, whose $R$-points are given by $\mathrm{GL}(L\otimes_{\mathcal{O}_F}R)$ for any $\mathcal{O}_F$-algebra $R$, hence one has a composition of closed immersions $$\mathrm{U}(V)\hookrightarrow \mathrm{GL}(V_F)\hookrightarrow \mathrm{GL}(V)_{\mathcal{O}_F}.$$

By setting $\underline{\mathrm{U}}_V\subset \mathrm{GL}(V)_{\mathcal{O}_F}$ to be the Zariski closure of $\mathrm{U}(V)$ in $\mathrm{GL}(V)_{\mathcal{O}_F}$, then there exists a finite set $S'$ of finite places of $F$, such that $(\underline{\mathrm{U}}_V)_{\mathcal{O}_F^{S'}}$ is a smooth $\mathcal{O}_F^{S'}$-group scheme which is a model for $\mathrm{U}(V)$.

Then, for its generic fiber $\mathrm{U}(V)$ is already reductive, one may apply Proposition 3.1.9 of Conrad's *Reductive group schemes* paper (using a so-called "spreading out" argument) to deduce that the fibers of $(\underline{\mathrm{U}}_V)_{\mathcal{O}_F^{S'}}$ are reductive outside a finite number of places, i.e., that there exists a finite set $S''$ of finite places of $F$ containing $S'$ and such that $(\underline{\mathrm{U}}_V)_{\mathcal{O}_F^{S''}}$ has reductive fibers.

- My second question.
*Is the above construction strictly equivalent to the (more explicit but less general) previous one ? Assuming the previous construction works with $S$, how can one compare $S$ and $S''$ in general ?*

**EDIT**: One of the aims behind my question is to convince myself of the link between the notion of an hyperspecial maximal compact subgroup $K_{\tau}$ of $\mathrm{U}(V)(F_{\tau})$ on the one hand (which arises as the $\mathcal{O}_{F_{\tau}}$-points of my almost-everywhere reductive model obtained by the second construction), and the notion of stabilizer of a self-dual local $\mathcal{O}_{E_{\tau}}$-lattice (which arises as the $\mathcal{O}_{F_{\tau}}$-points of the expected model obtained by the first construction).

Many thanks for any kind of help, and please don't hesitate to relocate this question to Stackexchange if you feel it's not advanced enough.

Yoël.