Let $X = (X\_1 \rightrightarrows X\_0)$ be a category in schemes, such that the source and target maps are both smooth. By an argument using finite limits we can construct a subscheme $X\_1^{iso} \subset X\_1$ such that $X^{iso} = (X\_1^{iso} \rightrightarrows X\_0)$ is a groupoid in schemes, and this is universal in the sense that any internal functor $Y\to X$ from a groupoid $Y$ factors (strictly!) through $X^{iso}$.


My question is, can we show that the source and target maps of $X^{iso}$, which are composites $X\_1^{iso} \hookrightarrow X\_1 \to X\_0$, are also smooth? If the inclusion of the scheme of invertible arrows was an open immersion I think we would be done.


I would also be happy if the proof only went through for algebraic spaces instead of schemes (this might be easier, who knows!).


This is a vast generalisation of [the question I asked at M.SE a while back](https://math.stackexchange.com/questions/24318/is-the-inclusion-of-the-group-of-units-in-an-algebraic-monoid-an-open-immersion), which dealt with the case that the category $X$ was a monoid. User 'Matt E' showed it was true for the case that the monoid was smooth and of finite type over a field.



Categories internal to schemes and subschemes of invertible arrows
The answer to your question is "yes". We need the following properties of $X\_1^{iso}$:


1. The map $X\_1^{iso} \to X\_1$ given by $(f,g) \mapsto f$ on scheme-valued points is a monomorphism. This is straightforward from uniqueness of inverses.
2. $s,t: X\_1 \to X\_0$ are formally smooth. We use this for existence of a lift of an infinitesimal deformation.
3. $s,t: X\_1 \to X\_0$ are locally of finite presentation. Using basic permanence properties (see e.g., [Stacks 02KL](http://www.math.columbia.edu/algebraic_geometry/stacks-git/locate.php?tag=02KL) with $X=S=X\_1$ and $Y = X\_0$), we find that $i: X\_0 \to X\_1$ is also locally of finite presentation. Combining with the fiber product construction, the two maps from $X\_1^{iso}$ to $X\_0$ are also lfp.
4. Infinitesimal formal categories are formal groupoids. This is basically the statement that tangent spaces have abelian group structure.


We will show that the monomorphism $X\_1^{iso} \to X\_1$ is formally étale by rephrasing Matt E's argument in a bit more generality. 


Let $j: U \to T$ be a closed immersion of affine schemes over $X\_0$ defined by a square zero ideal $I$. Let $\bar{f}$ be a $U$-point of $X\_1^{iso}$, and let $f$ be a $T$-point of $X\_1$, such that $f \circ j$ is equal to $\bar{f}$ followed by the monomorphism. By assumption, $\bar{f}$ has an inverse $\bar{g}$, and by formal smoothness of both $s,t: X\_1 \to X\_0$, there exists some $T$-point $\tilde{g}$ of $X\_1$ that restricts to the $U$-point $\bar{g}$.


We now translate by $\tilde{g}$ to bring us to an infinitesimal neighborhood of the origin. $\bar{g}$ and $\bar{f}$ are inverses as $U$-points, so $\tilde{g} f$ and $f \tilde{g}$ are $T$-points whose restriction to $U$ factors through identity. The square zero condition on $I$ gives an additive bijection between lifts of the identity and elements of $\operatorname{Hom}\_{\mathcal{O}\_U}(e\_U^\*\Omega\_{X\_1/X\_0},I)$, where $e\_U: U \to X\_1$ is the identity section (SGAI Exp. 3 Proposition 5.1). Because the Hom space is an abelian group, we can easily form inverses by negating. Translating back yields $(\tilde{g} f)^{-1} \tilde{g} = \tilde{g} (f \tilde{g})^{-1}$ as the unique inverse of $f$.


To summarize, if $f$ is a $T$-point in $X\_1$ whose restriction to $U$ factors through $X\_1^{iso}$, then there is a unique $T$-point $(f,f^{-1})$ in $X\_1^{iso}$ that maps to $f$. Thus, $X\_1^{iso} \to X\_1$ is formally étale, and the composition with either source or target $X\_1 \to X\_0$ is formally smooth and locally of finite presentation, hence smooth.


This argument works for algebraic spaces without change (although you may need to find new references).


