Is the formal completion of an affine group necessarily a formal group? Notation and Setting: let $\operatorname{Aff}$ denote the category of affine schemes whose objects are covariant representable functors $\operatorname{X}:\operatorname{Ring}\rightarrow\operatorname{Set}$ and $\operatorname{Spec}:\operatorname{Ring^{op}}\rightarrow\operatorname{Func(Ring, Set)} $ be the contravariant Yoneda embedding of $\operatorname{Ring^{op}}$ in its category of presheaves so that $\operatorname{Aff}\simeq\operatorname{Ring^{op}}$.
In addition, let $\mathcal{O}:\operatorname{Func(Ring, Set)}\rightarrow\operatorname{Ring^{op}}$ be the functor that sends a functor $\operatorname{X}:\operatorname{Ring}\rightarrow\operatorname{Set}$ to the ring of maps $\operatorname{X}\rightarrow \mathbb{A}^1$ (where $\mathbb{A}^1$ is the forgetful functor) so that $\operatorname{Spec}$ and $\mathcal{O}$ are inverse of one another.
Let $\widehat{\operatorname{Aff}}$ be the indization of $\operatorname{Aff}$, i.e. the category whose objects are functors $\operatorname{X}:\operatorname{Ring}\rightarrow\operatorname{Set}$ that are small filtered colimits of affine schemes 
Let $\operatorname{G}\in\operatorname{Aff}$ be a group object (affine group), i.e $\operatorname{(G(R),m_G)}$ is a group for every ring R, whereas $m_G$ is the multiplication map $m_G:\operatorname{G(R)}\times\operatorname{G(R)}\rightarrow\operatorname{G(R)}$ and $\mathcal{O}_G$ the ring of maps $\operatorname{G}\rightarrow\mathbb{A}^1$.
Let $I_0\supseteq I_1 \supseteq I_2 \supseteq \cdots$ be an infinite sequence of ideals in $\mathcal{O}_G$, i.e $I_n\in\mathcal{O}_G$ for every $n$. From Martin's argument we know that the formal colimit $\operatorname{Y}:=\mathrm{colimit}_{n\in\mathbb{Z}_{\geq0}}\operatorname{Spec(\mathcal{O}_{X}/I_n)}$ exists and is not an affine scheme (not representable).    
My general question: When is $\operatorname{Y}$ a formal group, i.e. a group object in $\widehat{\operatorname{Aff}}$?
My considerations were as follows: since $\operatorname{Spec(\mathcal{O}_{G}/I_n)}\subseteq\operatorname{G}$ is a subfunctor for every $n$, the universal property of $\operatorname{Y}$ as a colimit gives us a unique map $\phi:\operatorname{Y}\rightarrow\operatorname{G}$ which implies that $\operatorname{Y}$ is a subfunctor of $\operatorname{G}$ (since every two parallel maps to Y which have the same image on G are equal to one another). In particular, $y\in\operatorname{Y(R)}$ corresponds to a map $f:\mathcal{O}_G\rightarrow R$ such that $I_n\subseteq\operatorname{Ker(f)}$ for some $n$. For every ring R, we thus have $\phi:\operatorname{Y(R)}\rightarrow\operatorname{G(R)}, y\mapsto y$.
This fact, and the example of $\operatorname{Nil}\simeq\mathrm{colimit}_{n\in\mathbb{Z}_{\geq0}}\operatorname{Spec(\mathbb{Z}[x]/(x)^{n})}$ which delivers $\operatorname{(Nil(R),+)}\subseteq\operatorname{(\mathbb{A}^1(R),+)}$ as a subgroup, lead me to the claim:
$\operatorname{Y}$ is a formal group if and only if $\operatorname{Y}$ is a sub group of $\operatorname{G}$ 
Now $\leftarrow$ is trivial. To show $\rightarrow$, we let $\operatorname{Y}$ be a formal group with multiplication map $m_Y$. Now if it is true (this is the point I am not sure about)
that $\phi$ is a map of formal groups and not just a normal natural transforamtion
then we have
$\phi(m_{Y}(y,y'))=m_{G}(\phi(y),\phi(y'))$ which, since $\phi(y)=y$, is equivalent to 
$m_{Y}=m_{G}$ and we are done. 
my specific questions:


*

*Is the universal map $\phi$ necceserally a map of formal groups and if so why?

*Assuming the answer to 1. is negative then: 
2.1 In which cases is $\phi$ indeed a map of formal groups? 
2.2 are there any examples of such situations where $\operatorname{Y}$ is not a subgroup of $\operatorname{G}$? 
Edit: taking S. Carnahan's answer into consideration
Not assuming that $\phi:\operatorname{Y(R)}\rightarrow\operatorname{G(R)}, y\mapsto y$ is automatically a map of formal groups, it follows that that $\phi$ is a map of formal groups iff there is some $k$ such that the kernel of the map given by $m_G(y,y')$ lies in $I_k$. 
Hopf ideals are kernals of maps of Hopf algebras. Thus
saying that $\operatorname{I}$ is a  Hopf ideal is equivalent to saying that the map $\mathcal{O}_{G}\rightarrow\mathcal{O}_{G}/I$ is a map of Hopf algebras which is equivalent to the map $\operatorname{Spec(\mathcal{O}_{G}/I)}\rightarrow\operatorname{Spec(\mathcal{O}_{G})}$ being a map of affine groups.
My question: How do we show that the property $m_G(y,y')$ lies in a certain $I_k$ is equivalent to the fact that $I$ is a Hopf ideal?
Things to take into consideration:


*

*We have that $I_k\subseteq I$.

*We know (Milne Algebraic Groups Pro. 3.12., p.67) that, given a Hopf ideal $I$, any Hopf algebra homomorphism $A\rightarrow B$ whose kernal contains $I$ factors uniquely through $A\rightarrow A/I$

*In the example of $\operatorname{Nil}$ we have for $a\in\operatorname{Nil_n(R)}, b\in\operatorname{Nil_m(R)}, (a+b)\in\operatorname{Nil_{n+m}(R)}$ and thus $k=n+m$. In addition, the map $\mathbb{Z}[x]\rightarrow\mathbb{Z}[x]/(x)\simeq\mathbb{Z}$ is a map of Hopf algebras whose kernal $(x)$ is hence a Hopf ideal. How to show the equivalence in this example?


Thanks
 A: The universal map is not a map of formal groups without some extra condition.  An easy class of counterexamples comes from completions of an affine group along a closed subscheme that does not contain the identity element.  In general, when you want to complete an affine group to get a formal group, you set $I_n = I^n$ for an ideal $I$ that defines a closed subgroup.  That is, $I$ is a Hopf ideal for the coordinate ring.  In particular, $\Delta(I) \subseteq \mathcal{O}_G \otimes I + I \otimes \mathcal{O}_G$, so $\Delta(I_n) \subseteq \sum_{i+j=n} I_i \otimes I_j$.
To be more specific in the language you use, you need your system of ideals to be compatible with multiplication in the following way: If $y$ and $y'$ are $R$-points, such that the maps $\mathcal{O}_G \to R$ have kernel containing $I_n$ and $I_{n'}$, respectively, then there is some $k$ such that the kernel of the map given by $m_G(y,y')$ lies in $I_k$.  You have not specified any structure that forces this condition to hold.  For Hopf ideals, our calculation of $\Delta(I_n)$ shows that setting $k \geq n+n'$ is sufficient.
Here is an explicit example.  We complete the additive group $\mathbb{G}_a = \operatorname{Spec} k[x]$ (for some nonzero commutative ring $k$) at the point $1$, so our ideals are $I_n = (x-1)^n$.  Any $R$-point factors through some map $k[x]/(x-1)^n \to R$, but the product of such $R$-points comes from the composite $k[x] \to k[y,z] \to k[y,z]/((y-1)^m(z-1)^n) \to R$, where the first map takes $x$ to $y+z$, and hence $(x-2)^{m+n} \mapsto ((y-1)+(z-1))^{m+n}$.  Then, this map necessarily factors through $k[x]/(x-2)^{m+n}$. Since $2 \neq 1$ in $k$, this map does not factor through $k[x]/(x-1)^r$ for any positive $r$.
