# Stack (mathematics)

In mathematics a stack or 2-sheaf is, roughly speaking, a sheaf that takes values in categories rather than sets. Stacks are used to formalise some of the main constructions of descent theory, and to construct fine moduli stacks when fine moduli spaces do not exist.
Descent theory is concerned with generalisations of situations where isomorphic, compatible geometrical objects (such as vector bundles on topological spaces) can be "glued together" within a restriction of the topological basis. In a more general set-up the restrictions are replaced with pullbacks; fibred categories then make a good framework to discuss the possibility of such gluing. The intuitive meaning of a stack is that it is a fibred category such that "all possible gluings work". The specification of gluings requires a definition of coverings with regard to which the gluings can be considered. It turns out that the general language for describing these coverings is that of a Grothendieck topology. Thus a stack is formally given as a fibred category over another base category, where the base has a Grothendieck topology and where the fibred category satisfies a few axioms that ensure existence and uniqueness of certain gluings with respect to the Grothendieck topology.

## Overview

Stacks are the underlying structure of algebraic stacks (also called Artin stacks) and Deligne–Mumford stacks, which generalize schemes and algebraic spaces and which are particularly useful in studying moduli spaces. There are inclusions:
   schemes ⊆ algebraic spaces ⊆ Deligne–Mumford stacks ⊆ algebraic stacks (Artin stacks) ⊆ stacks.
Edidin (2003) and Fantechi (2001) give a brief introductory accounts of stacks, Gómez (2001), Olsson (2007) and Vistoli (2005) give more detailed introductions, and Laumon & Moret-Bailly (2000) describes the more advanced theory.

## Motivation and history

   La conclusion pratique à laquelle je suis arrivé dès maintenant, c'est que chaque fois que en vertu de mes critères, une variété de modules (ou plutôt, un schéma de modules) pour la classification des variations (globales, ou infinitésimales) de certaines structures (variétés complètes non singulières, fibrés vectoriels, etc.) ne peut exister, malgré de bonnes hypothèses de platitude, propreté, et non singularité éventuellement, la raison en est seulement l'existence d'automorphismes de la structure qui empêche la technique de descente de marcher.
The concept of stacks has its origin in the definition of effective descent data in Grothendieck (1959). In a 1959 letter to Serre, Grothendieck observed that a fundamental obstruction to constructing good moduli spaces is the existence of automorphisms. A major motivation for stacks is that if a moduli space for some problem does not exist because of the existence of automorphisms, it may still be possible to construct a moduli stack.
Mumford (1965) studied the Picard group of the moduli stack of elliptic curves, before stacks had been defined. Stacks were first defined by Giraud (1966, 1971), and the term "stack" was introduced by Deligne & Mumford (1969) for the original French term "champ" meaning "field". In this paper they also introduced Deligne–Mumford stacks, which they called algebraic stacks, though the term "algebraic stack" now usually refers to the more general Artin stacks introduced by Artin (1974).
When defining quotients of schemes by group actions, it is often impossible for the quotient to be a scheme and still satisfy desirable properties for a quotient. For example, if a few points have non-trivial stabilisers, then the categorical quotient will not exist among schemes, but it will exist as a stack.
In the same way, moduli spaces of curves, vector bundles, or other geometric objects are often best defined as stacks instead of schemes. Constructions of moduli spaces often proceed by first constructing a larger space parametrizing the objects in question, and then quotienting by group action to account for objects with automorphisms which have been overcounted.

## Definitions
### Abstract stacks

A category $c$ with a functor to a category $C$ is called a fibered category over $C$ if for any morphism $F:X\to Y$ in $C$ and any object $y$ of $c$ with image $Y$ (under the functor), there is a pullback $f:x\to y$ of $y$ by $F$. This means a morphism with image $F$ such that any morphism $g:z\to y$ with image $G=F\circ H$ can be factored as $g=f\circ h$ by a unique morphism $h:z\to x$ in $c$ such that the functor maps $h$ to $H$. The element $x=F^{*}y$ is called the pullback of $y$ along $F$ and is unique up to canonical isomorphism.
The category c is called a prestack over a category C with a Grothendieck topology if it is fibered over C and for any object U of C and objects x, y of c with image U, the functor from the over category C/U to sets taking F:V→U to Hom(F*x,F*y) is a sheaf. This terminology is not consistent with the terminology for sheaves: prestacks are the analogues of separated presheaves rather than presheaves. Some authors require this as a property of stacks, rather than of prestacks.
The category c is called a stack over the category C with a Grothendieck topology if it is a prestack over C and every descent datum is effective. A descent datum consists roughly of a covering of an object V of C by a family V$_i$, elements x$_i$ in the fiber over V$_i$, and morphisms f$_{ji}$ between the restrictions of x$_i$ and x$_j$ to V$_{ij}$=V$_i$×$_V$V$_j$ satisfying the compatibility condition f$_{ki}$ = f$_{kj}$f$_{ji}$. The descent datum is called effective if the elements x$_i$ are essentially the pullbacks of an element x with image V.
A stack is called a stack in groupoids or a (2,1)-sheaf if it is also fibered in groupoids, meaning that its fibers (the inverse images of objects of C) are groupoids. Some authors use the word "stack" to refer to the more restrictive notion of a stack in groupoids.

### Algebraic stacks

An algebraic stack or Artin stack is a stack in groupoids X over the fppf site such that the diagonal map of X is representable and there exists a smooth surjection from (the stack associated to) a scheme to X. A morphism Y$\rightarrow$ X of stacks is representable if, for every morphism S $\rightarrow$ X from (the stack associated to) a scheme to X, the fiber product Y ×$_X$ S is isomorphic to (the stack associated to) an algebraic space. The fiber product of stacks is defined using the usual universal property, and changing the requirement that diagrams commute to the requirement that they 2-commute. See also morphism of algebraic stacks for further information.
The motivation behind the representability of the diagonal is the following: the diagonal morphism $\Delta :{\mathfrak {X}}\to {\mathfrak {X}}\times {\mathfrak {X}}$ is representable if and only if for any pair of morphisms of algebraic spaces $X,Y\to {\mathfrak {X}}$, their fiber product $X\times _{\mathfrak {X}}Y$ is representable.
A Deligne–Mumford stack is an algebraic stack X such that there is an étale surjection from a scheme to X. Roughly speaking, Deligne–Mumford stacks can be thought of as algebraic stacks whose objects have no infinitesimal automorphisms.

#### Local structure of algebraic stacks

Since the inception of algebraic stacks it was expected that they are locally quotient stacks of the form $[{\text{Spec}}(A)/G]$ where $G$ is a linearly reductive algebraic group. This was recently proved to be the case: given a quasi-separated algebraic stack ${\mathfrak {X}}$ locally of finite type over an algebraically closed field $k$ whose stabilizers are affine, and $x\in {\mathfrak {X}}(k)$ a smooth and closed point with linearly reductive stabilizer group $G_{x}$, there exists an etale cover of the GIT quotient $(U,u)\to (N_{x}//G_{x},0)$, where $N_{x}=(J_{x}/J_{x}^{2})^{\vee }$, such that the diagram
   ${\begin{matrix}([W/G_{x}],w)&\to &([N_{x}/G_{x}],0)\\\downarrow &&\downarrow \\(U,u)&\to &(N_{x}//G_{x},0)\end{matrix}}$
is cartesian, and there exists an etale morphism
   $f:([W/G_{x}],w)\to ({\mathfrak {X}},x)$
inducing an isomorphism of the stabilizer groups at $w$ and $x$.

## Examples
### Elementary examples

* Every sheaf ${\mathcal {F}}:C^{op}\to Sets$ from a category $C$ with a Grothendieck topology can canonically be turned into a stack. For an object $X\in {\text{Ob}}(C)$, instead of a set ${\mathcal {F}}(X)$ there is a groupoid whose objects are the elements of ${\mathcal {F}}(X)$ and the arrows are the identity morphism.
* More concretely, let $h$ be a contravariant functor
    $h:(Sch/S)^{op}\to Sets$
    Then, this functor determines the following category $H$
   * an object is a pair $(X\to S,x)$ consisting of a scheme $X$ in $(Sch/S)^{op}$ and an element $x\in h(X)$
   * a morphism $(X\to S,x)\to (Y\to S,y)$ consists of a morphism $\phi :X\to Y$ in $(Sch/S)$ such that $h(\phi )(y)=x$.
    Via the forgetful functor $p:H\to (Sch/S)$, the category $H$ is a category fibered over $(Sch/S)$. For example, if $X$ is a scheme in $(Sch/S)$, then it determines the contravariant functor $h=\operatorname {Hom} (-,X)$ and the corresponding fibered category is the stack associated to X. Stacks (or prestacks) can be constructed as a variant of this construction. In fact, any scheme $X$ with a quasi-compact diagonal is an algebraic stack associated to the scheme $X$.

### Stacks of objects

* A group-stack.
* The moduli stack of vector bundles: the category of vector bundles V→S is a stack over the category of topological spaces S. A morphism from V→S to W→T consists of continuous maps from S to T and from V to W (linear on fibers) such that the obvious square commutes. The condition that this is a fibered category follows because one can take pullbacks of vector bundles over continuous maps of topological spaces, and the condition that a descent datum is effective follows because one can construct a vector bundle over a space by gluing together vector bundles on elements of an open cover.
* The stack of quasi-coherent sheaves on schemes (with respect to the fpqc-topology and weaker topologies)
* The stack of affine schemes on a base scheme (again with respect to the fpqc topology or a weaker one)

### Constructions with stacks
#### Stack quotients

If $X$ is a scheme $(Sch/S)$ and $G$ is a smooth affine group scheme acting on $X$, then there is a quotient algebraic stack $[X/G]$, taking a scheme $Y\to S$ to the groupoid of $G$-torsors over the $S$-scheme $Y$ with $G$-equivariant maps to $X$. Explicitly, given a space $X$ with a $G$-action, form the stack $[X/G]$, which (intuitively speaking) sends a space $Y$ to the groupoid of pullback diagrams
   $[X/G](Y)={\begin{Bmatrix}Z&{\xrightarrow {\Phi }}&X\\\downarrow &&\downarrow \\Y&{\xrightarrow {\phi }}&[X/G]\end{Bmatrix}}$
where $\Phi$ is a $G$-equivariant morphism of spaces and $Z\to Y$ is a principal $G$-bundle. The morphisms in this category are just morphisms of diagrams where the arrows on the right-hand side are equal and the arrows on the left-hand side are morphisms of principal $G$-bundles.

#### Classifying stacks

A special case of this when X is a point gives the classifying stack BG of a smooth affine group scheme G: ${\textbf {B}}G:=[pt/G].$ It is named so since the category $\mathbf {B} G(Y)$, the fiber over Y, is precisely the category $\operatorname {Bun} _{G}(Y)$ of principal $G$-bundles over $Y$. Note that $\operatorname {Bun} _{G}(Y)$ itself can be considered as a stack, the moduli stack of principal G-bundles on Y.
An important subexample from this construction is $\mathbf {B} GL_{n}$, which is the moduli stack of principal $GL_{n}$-bundles. Since the data of a principal $GL_{n}$-bundle is equivalent to the data of a rank $n$ vector bundle, this is isomorphic to the moduli stack of rank $n$ vector bundles $Vect_{n}$.

##### Moduli stack of line bundles

The moduli stack of line bundles is $B\mathbb {G} _{m}$ since every line bundle is canonically isomorphic to a principal $\mathbb {G} _{m}$-bundle. Indeed, given a line bundle $L$ over a scheme $S$, the relative spec
   ${\underline {\text{Spec}}}_{S}({\text{Sym}}_{S}(L^{\vee }))\to S$
gives a geometric line bundle. By removing the image of the zero section, one obtains a principal $\mathbb {G} _{m}$-bundle. Conversely, from the representation $id:\mathbb {G} _{m}\to {\text{Aut}}(\mathbb {A} ^{1})$, the associated line bundle can be reconstructed.

#### Gerbes

A gerbe is a stack in groupoids that is locally nonempty, for example the trivial gerbe $BG$ that assigns to each scheme the groupoid of principal $G$-bundles over the scheme, for some group $G$.

#### Relative spec and proj

If A is a quasi-coherent sheaf of algebras in an algebraic stack X over a scheme S, then there is a stack Spec(A) generalizing the construction of the spectrum Spec(A) of a commutative ring A. An object of Spec(A) is given by an S-scheme T, an object x of X(T), and a morphism of sheaves of algebras from x*(A) to the coordinate ring O(T) of T.
If A is a quasi-coherent sheaf of graded algebras in an algebraic stack X over a scheme S, then there is a stack Proj(A) generalizing the construction of the projective scheme Proj(A) of a graded ring A.

### Moduli stacks
#### Moduli of curves

* Mumford (1965) studied the moduli stack M$_{1,1}$ of elliptic curves, and showed that its Picard group is cyclic of order 12. For elliptic curves over the complex numbers the corresponding stack is similar to a quotient of the upper half-plane by the action of the modular group.
* The moduli space of algebraic curves ${\mathcal {M}}_{g}$ defined as a universal family of smooth curves of given genus $g$ does not exist as an algebraic variety because in particular there are curves admitting nontrivial automorphisms. However there is a moduli stack ${\mathcal {M}}_{g}$, which is a good substitute for the non-existent fine moduli space of smooth genus $g$ curves. More generally there is a moduli stack ${\mathcal {M}}_{g,n}$ of genus $g$ curves with $n$ marked points. In general this is an algebraic stack, and is a Deligne–Mumford stack for $g\geq 2$ or $g=1,n\geq 1$ or $g=0,n\geq 3$ (in other words when the automorphism groups of the curves are finite). This moduli stack has a completion consisting of the moduli stack of stable curves (for given $g$ and $n$), which is proper over Spec Z. For example, ${\mathcal {M}}_{0}$ is the classifying stack $B{\text{PGL}}(2)$ of the projective general linear group. (There is a subtlety in defining ${\mathcal {M}}_{1}$, as one has to use algebraic spaces rather than schemes to construct it.)

#### Kontsevich moduli spaces

Another widely studied class of moduli spaces are the Kontsevich moduli spaces parameterizing the space of stable maps between curves of a fixed genus to a fixed space $X$ whose image represents a fixed cohomology class. These moduli spaces are denoted
   ${\overline {\mathcal {M}}}_{g,n}(X,\beta )$
and can have wild behavior, such as being reducible stacks whose components are non-equal dimension. For example, the moduli stack
   ${\overline {\mathcal {M}}}_{1,0}(\mathbb {P} ^{2},3[H])$
has smooth curves parametrized by an open subset $U\subset \mathbb {P} ^{9}=\mathbb {P} (\Gamma (\mathbb {P} ^{2},{\mathcal {O}}(3)))$. On the boundary of the moduli space, where curves may degenerate to reducible curves, there is a substack parametrizing reducible curves with a genus $0$ component and a genus $1$ component intersecting at one point, and the map sends the genus $1$ curve to a point. Since all such genus $1$ curves are parametrized by $U$, and there is an additional $1$ dimensional choice of where these curves intersect on the genus $1$ curve, the boundary component has dimension $10$.

#### Other moduli stacks

* A Picard stack generalizes a Picard variety.
* The moduli stack of formal group laws classifies formal group laws.
* An ind-scheme such as an infinite projective space and a formal scheme is a stack.
* A moduli stack of shtukas is used in geometric Langlands program. (See also shtukas.)

### Geometric stacks
#### Weighted projective stacks

Constructing weighted projective spaces involves taking the quotient variety of some $\mathbb {A} ^{n+1}-\{0\}$ by a $\mathbb {G} _{m}$-action. In particular, the action sends a tuple
   $g\cdot (x_{0},\ldots ,x_{n})\mapsto (g^{a_{0}}x_{0},\ldots ,g^{a_{n}}x_{n})$
and the quotient of this action gives the weighted projective space $\mathbb {WP} (a_{0},\ldots ,a_{n})$. Since this can instead be taken as a stack quotient, the weighted projective stack $^{pg30}$ is
   ${\textbf {WP}}(a_{0},\ldots ,a_{n}):=[\mathbb {A} ^{n}-\{0\}/\mathbb {G} _{m}]$
Taking the vanishing locus of a weighted polynomial in a line bundle $f\in \Gamma ({\textbf {WP}}(a_{0},\ldots ,a_{n}),{\mathcal {O}}(a))$ gives a stacky weighted projective variety.

#### Stacky curves

Stacky curves, or orbicurves, can be constructed by taking the stack quotient of a morphism of curves by the monodromy group of the cover over the generic points. For example, take a projective morphism
   ${\text{Proj}}(\mathbb {C} [x,y,z]/(x^{5}+y^{5}+z^{5}))\to {\text{Proj}}(\mathbb {C} [x,y])$
which is generically etale. The stack quotient of the domain by $\mu _{5}$ gives a stacky $\mathbb {P} ^{1}$ with stacky points that have stabilizer group $\mathbb {Z} /5$ at the fifth roots of unity in the $x/y$-chart. This is because these are the points where the cover ramifies.

#### Non-affine stack

An example of a non-affine stack is given by the half-line with two stacky origins. This can be constructed as the colimit of two inclusion of $[\mathbb {G} _{m}/(\mathbb {Z} /2)]\to [\mathbb {A} ^{1}/(\mathbb {Z} /2)]$.

## Quasi-coherent sheaves on algebraic stacks

On an algebraic stack one can construct a category of quasi-coherent sheaves similar to the category of quasi-coherent sheaves over a scheme.
A quasi-coherent sheaf is roughly one that looks locally like the sheaf of a module over a ring. The first problem is to decide what one means by "locally": this involves the choice of a Grothendieck topology, and there are many possible choices for this, all of which have some problems and none of which seem completely satisfactory. The Grothendieck topology should be strong enough so that the stack is locally affine in this topology: schemes are locally affine in the Zariski topology so this is a good choice for schemes as Serre discovered, algebraic spaces and Deligne–Mumford stacks are locally affine in the etale topology so one usually uses the etale topology for these, while algebraic stacks are locally affine in the smooth topology so one can use the smooth topology in this case. For general algebraic stacks the etale topology does not have enough open sets: for example, if G is a smooth connected group then the only etale covers of the classifying stack BG are unions of copies of BG, which are not enough to give the right theory of quasicoherent sheaves.
Instead of using the smooth topology for algebraic stacks one often uses a modification of it called the Lis-Et topology (short for Lisse-Etale: lisse is the French term for smooth), which has the same open sets as the smooth topology but the open covers are given by etale rather than smooth maps. This usually seems to lead to an equivalent category of quasi-coherent sheaves, but is easier to use: for example it is easier to compare with the etale topology on algebraic spaces. The Lis-Et topology has a subtle technical problem: a morphism between stacks does not in general give a morphism between the corresponding topoi. (The problem is that while one can construct a pair of adjoint functors f$_*$, f*, as needed for a geometric morphism of topoi, the functor f* is not left exact in general. This problem is notorious for having caused some errors in published papers and books.) This means that constructing the pullback of a quasicoherent sheaf under a morphism of stacks requires some extra effort.
It is also possible to use finer topologies. Most reasonable "sufficiently large" Grothendieck topologies seem to lead to equivalent categories of quasi-coherent sheaves, but the larger a topology is the harder it is to handle, so one generally prefers to use smaller topologies as long as they have enough open sets. For example, the big fppf topology leads to essentially the same category of quasi-coherent sheaves as the Lis-Et topology, but has a subtle problem: the natural embedding of quasi-coherent sheaves into O$_X$ modules in this topology is not exact (it does not preserve kernels in general).

## Other types of stack

Differentiable stacks and topological stacks are defined in a way similar to algebraic stacks, except that the underlying category of affine schemes is replaced by the category of smooth manifolds or topological spaces.
More generally one can define the notion of an n-sheaf or n–1 stack, which is roughly a sort of sheaf taking values in n–1 categories. There are several inequivalent ways of doing this. 1-sheaves are the same as sheaves, and 2-sheaves are the same as stacks. They are called higher stacks.
A very similar and analogous extension is to develop the stack theory on non-discrete objects (i.e., a space is really a spectrum in algebraic topology). The resulting stacky objects are called derived stacks (or spectral stacks). Jacob Lurie's under-construction book Spectral Algebraic Geometry studies a generalization that he calls a spectral Deligne–Mumford stack. By definition, it is a ringed ∞-topos that is étale-locally the étale spectrum of an E$_∞$-ring (this notion subsumes that of a derived scheme, at least in characteristic zero.)

## Set-theoretical problems

There are some minor set theoretical problems with the usual foundation of the theory of stacks, because stacks are often defined as certain functors to the category of sets and are therefore not sets. There are several ways to deal with this problem:
* One can work with Grothendieck universes: a stack is then a functor between classes of some fixed Grothendieck universe, so these classes and the stacks are sets in a larger Grothendieck universe. The drawback of this approach is that one has to assume the existence of enough Grothendieck universes, which is essentially a large cardinal axiom.
* One can define stacks as functors to the set of sets of sufficiently large rank, and keep careful track of the ranks of the various sets one uses. The problem with this is that it involves some additional rather tiresome bookkeeping.
* One can use reflection principles from set theory stating that one can find set models of any finite fragment of the axioms of ZFC to show that one can automatically find sets that are sufficiently close approximations to the universe of all sets.
* One can simply ignore the problem. This is the approach taken by many authors.