TITLE: Piecewise definition of a functor
QUESTION [9 upvotes]: I am in the following situation: I have a category $A$ and an increasing chain of full subcategories $A_0\subseteq A_1\subseteq\, ...\subseteq A_n\subseteq \, ...$ inside $A$, such that any object of $A$ belongs to some $A_n$. Roughly speaking, $A$ is the union of the $A_n$. 
I would like to construct a functor from $A$ to a category $B$, and what I can do is the following: for any $n\in \mathbb N$ I can construct a functor $F_n\colon A_n\to B$ and prove that the restriction of $F_{n+1}$ to $A_n$ is naturally isomorphic to $F_n$.
The question is, can we use these functors $F_n$ to construct a functor $F\colon A\to B$ in some canonical way? Of course one basic requirement would be that $F(a)\cong F_n(a)$ if $a\in A_n$.
I think I can give a construction, but it is quite tedious and definitely it is not nice to give this construction in the context I am writing. So, is there any reference I can quote? Or, do you have any one-line argument for the existence of $F$?

REPLY [8 votes]: Basically you want to prove that $A = \mathrm{colim}_n A_n$ in the $2$-categorical sense. There is a general construction of $2$-colimits; we may use this and check that it is equivalent to $A$. But I think it is a good idea to just wrote down the functor.
Let us denote by $\theta_n : F_n \to F_{n+1}|{A_n}$ the given isomorphisms. These may be composed to compatible isomorphisms $\theta_{n,m} : F_n \to F_m |{A_n}$ for $n \leq m$.
Define $t : \mathrm{Ob}(A) \to \mathbb{N}$ by $t(a) = \min\{n \in \mathbb{N} : a \in A_n\}$. Define $t(a,b) := \max(t(a),t(b))$. The functor $F : A \to B$ is defined as follows: An object $a \in \mathrm{Ob}(A)$ is mapped to $F(a):=F_{t(a)}(a)$. A morphism $f:a \to b$ is mapped to the composition
$$F(f) : \quad F_{t(a)}(a) \xrightarrow{~\large \theta_{t(a),t(a,b)}(a)~} F_{t(a,b)}(a) \xrightarrow{~\large F_{ t(a,b)}(f)~} F_{t(a,b)}(b) \xrightarrow{~\large \theta_{ t(a),t(a,b)}^{-1}(b)~} F_{t(b)}(b).$$
It is easy to check that $F$ is, in fact, a functor. If $a \in A_n$, then $t(a) \leq n$. Hence $\theta_{t(a),n} : F(a)=F_{t(a)}(a) \to F_n(a)$ is an isomorphism. It is natural in $a$; this follows from the construction of $F(f)$. Hence, there is an isomorphism $\vartheta_n : F|{A_n} \cong F_n$. Moreover, these isomorphisms are compatible with the $\theta_n$: The diagram
$$\begin{array}{cc}  F|A_n & \xrightarrow{\large \vartheta_n} & F_n\\ \mathrm{id}\downarrow ~~ && ~~\downarrow \theta_n \\ F|A_{n+1}|A_n & \xrightarrow{\large \vartheta_{n+1}|A_n} & F_{n+1}|A_n\end{array}$$
commutes.