Solution (source code)

= Solution

Both alternatives can be proved using the same smallness mechanism. We first establish the <initial-object lemma for complete categories with a weakly initial set>, then obtain the two <adjoint functor> existence theorems and their applications.

Let $\mathcal E$ be a <locally small category> with all small <categorical limits> and a <weakly initial set> $(W_i)_{i\in I}$. Its <product in a category> $W=\prod_iW_i$ is weakly initial: given any object, choose a map from some $W_i$ and compose with the corresponding projection. Take the simultaneous <equalizer> $e:E\to W$ of every endomorphism of $W$ and its identity; local smallness makes this a small <categorical limit>. Then $E$ is also weakly initial. If $a,b:E\to X$, form their <equalizer> $j:Y\to E$ and choose $t:W\to Y$. Since $ejt$ is an endomorphism of $W$, the construction of $e$ gives $ejte=e$. Cancelling the <monomorphism> $e$ yields $jte=1_E$. Thus $j$ is both a <monomorphism> and a <split epimorphism>, hence invertible, and $a=b$. There is therefore exactly one arrow from $E$ to every object: $E$ is initial.

The <Freyd general adjoint functor theorem> says that for a <functor> $U:\mathcal A\to\mathcal B$ between <locally small categories>, with $\mathcal A$ complete, a <left adjoint> exists exactly when $U$ preserves all small <categorical limits> and satisfies the <solution-set condition>. That condition requires, for each $B$, a set of arrows $u_i:B\to UA_i$ such that every $u:B\to UA$ factors as $U(f)u_i$ for some $i$ and $f:A_i\to A$.

For sufficiency, the <comma category> $(B\downarrow U)$ is locally small and complete: form a diagram's <categorical limit> in $\mathcal A$, and use <categorical limit> preservation to obtain its arrow from $B$. The solution set is a <weakly initial set> in this <comma category>. The lemma provides an <initial object> $(LB,\eta_B:B\to ULB)$. Its <universal property> gives
$$
\mathcal A(LB,A)\cong\mathcal B(B,UA),\qquad f\longmapsto U(f)\eta_B.
$$
For $h:B\to B'$, define $Lh$ by $U(Lh)\eta_B=\eta_{B'}h$. Uniqueness proves the identity and composition laws and <naturality> of the displayed bijections, hence $L\dashv U$. Conversely, an <adjunction> makes $U$ preserve <categorical limits>, since the corresponding <hom-set> <functors> turn a <categorical limit> cone into a <categorical limit> of sets. The single arrow $\eta_B$ is a solution set. This proves both directions of the theorem.

Now let $F:\mathcal C\to\mathcal D$ have small domain and codomain. The <functor categories> $[\mathcal D,\mathbf{Set}]$ and $[\mathcal C,\mathbf{Set}]$ are locally small, and their <categorical limits> are pointwise. Thus the precomposition <functor> $F^*$ preserves <categorical limits> and its domain is complete. To verify its <solution-set condition>, fix $X:\mathcal C\to\mathbf{Set}$ and an arrow $x:X\to F^*Y$. Let $Y_0\subseteq Y$ be the subfunctor generated by all elements $x_c(a)$, where $c\in\mathcal C$ and $a\in X(c)$. Explicitly,
$$
Y_0(d)=\{Y(g)(x_c(a)):g:Fc\to d,\ a\in X(c)\}.
$$
These sets are stable under every $Y(h)$. If $\kappa$ is an infinite cardinal bounding $|\operatorname{Mor}\mathcal D|$ and $\left|\coprod_cX(c)\right|$, every $Y_0(d)$ has cardinal at most $\kappa$. Replace each such set by a subset of a fixed set of size $\kappa$. There is only a set of choices of these subsets, of their action maps for the set of arrows of $\mathcal D$, and of maps from $X$ to their restrictions. These coded pairs form a solution set: $x$ factors through $F^*Y_0$ and then the inclusion $Y_0\hookrightarrow Y$. The general theorem now yields
$$
\boxed{\operatorname{Lan}_F\dashv F^*.}
$$
Its values may also be written $\operatorname{Lan}_FX(d)=\operatorname{colim}_{(Fc\to d)}X(c)$, the usual <left Kan extension> formula.

For the other alternative, the <categorical limit> form of the <Special adjoint functor theorem> says that a limit-preserving <functor> $U:\mathcal A\to\mathcal B$ has a left adjoint if $\mathcal A$ is locally small, complete and <well-powered>, has a <cogenerating set> $(Q_i)_{i\in I}$, and $\mathcal B$ is locally small. A cogenerating set means that maps into its members distinguish any two parallel arrows. The dual theorem says that a colimit-preserving <functor> from a locally small, cocomplete, <well-copowered category> with a <small generating family> has a right adjoint. These conclusions are also necessary in their preservation clauses.

Here is a proof of the special theorem rather than an invocation of the general theorem without its required solution set. Given $(A,x:B\to UA)$, intersect all subobjects $m:M\hookrightarrow A$ through which $x$ factors after application of $U$. There are only a set of them by well-poweredness. Their intersection is a wide pullback, preserved by $U$, so gives a smallest supporting pair $(A_0,x_0)$. If $p,q:A_0\to Q_i$ satisfy $U(p)x_0=U(q)x_0$, their <equalizer> is a supporting subobject. Minimality makes that <equalizer> invertible, whence $p=q$. Consequently
$$
\mathcal A(A_0,Q_i)\longrightarrow\mathcal B(B,UQ_i),\qquad p\longmapsto U(p)x_0,
$$
is injective. The cogenerating property makes the evaluation arrow from $A_0$ into the <product in a category> of the $Q_i$, one factor for each map $A_0\to Q_i$, a <monic arrow>. Its indexing set at each $i$ is identified with a subset of the fixed set $\mathcal B(B,UQ_i)$. Only a set of such <products in a category> can occur. Each has only a set of subobjects, and each possible subobject has only a set of arrows from $B$ into its image under $U$. These pairs give a <weakly initial set> in $(B\downarrow U)$, since every original pair receives the arrow from its minimal supporting pair. The complete-category lemma now gives the adjoint. Reversing all arrows proves the <colimit> form of the special theorem.

Apply that dual form to $F^*:[\mathcal D,\mathbf{Set}]\to[\mathcal C,\mathbf{Set}]$. Its domain is cocomplete and locally small, and $F^*$ preserves pointwise <colimits>. The set of covariant <representable functors> $\mathcal D(d,-)$ generates the domain: by the <Yoneda lemma>, maps from these representables probe every element at every object and hence distinguish distinct <natural transformations>. Finally, <epimorphisms> in this <functor category> are pointwise surjective. Indeed, their pointwise images form subfunctors; if an image is proper, the two inclusions into the pointwise pushout of two copies of the target over that image distinguish the original map, contradicting epicity. Quotients of a fixed <functor> are therefore specified by compatible equivalence relations on its sets of values, and form a set. Thus the domain is a <well-copowered category>. All special-theorem hypotheses hold, giving
$$
\boxed{F^*\dashv\operatorname{Ran}_F.}
$$
Here the <Right Kan extension> can be written $\operatorname{Ran}_FX(d)=\operatorname{Nat}(\mathcal D(d,F-),X)$. In particular both requested adjoints exist, although the two proofs use different smallness hypotheses.