Definition Let $\operatorname{\mathcal{C}}$ and $\operatorname{\mathcal{D}}$ be categories, and let $F: \operatorname{\mathcal{C}}\rightarrow \operatorname{\mathcal{D}}$ be a functor. We say that $F$ is a fibration in groupoids if the following conditions are satisfied:


For every object $Y \in \operatorname{\mathcal{C}}$ and every morphism $\overline{u}: \overline{X} \rightarrow F(Y)$ in $\operatorname{\mathcal{D}}$, there exists a morphism $u: X \rightarrow Y$ in $\operatorname{\mathcal{C}}$ with $\overline{X} = F(X)$ and $\overline{u} = F(u)$.


For every morphism $v: Y \rightarrow Z$ in $\operatorname{\mathcal{C}}$ and every object $X \in \operatorname{\mathcal{C}}$, the diagram of sets

\[ \xymatrix@R =50pt@C=50pt{ \operatorname{Hom}_{\operatorname{\mathcal{C}}}(X,Y) \ar [r]^-{v \circ } \ar [d]^{F} & \operatorname{Hom}_{\operatorname{\mathcal{C}}}(X,Z) \ar [d]^{F} \\ \operatorname{Hom}_{\operatorname{\mathcal{D}}}( F(X), F(Y) ) \ar [r]^-{ F(v) \circ } & \operatorname{Hom}_{\operatorname{\mathcal{D}}}( F(X), F(Z) ) } \]

is a pullback square.

In this case, we will also say that $\operatorname{\mathcal{C}}$ is fibered in groupoids over $\operatorname{\mathcal{D}}$.