$\newcommand{\E}{\mathbb{E}}\newcommand{\A}{\mathscr{A}}\newcommand{\psh}{\operatorname{Psh}}\newcommand{\set}{\mathsf{Set}}\newcommand{\op}{^{\mathsf{op}}}\require{AMScd}$The TLDR is: Given that we know what the subobject classifier looks like on representables, how can we prove it acts as a subobject classifier on all presheaves? I am close, but there is an encoding process that I have tried for a very long time to envisage, and I just can't (failed attempt below!). This is a long question because I am showing every process and piece of working in as much detail as is appropriate. If this is a duplicate in the sense that someone else has already demonstrated a subobject classifier for a presheaf category, by all means link the post, but this won't be a full duplicate unless they somehow mimic my approach exactly.
Question and approach:
Let $\A$ be a small category. I was tasked to identify the subobject classifier $\Omega$ in the presheaf category $\psh_\A=[\A\op,\set]$. Let $H_\bullet$ denote the Yoneda embedding $\A\hookrightarrow\psh_\A$: if such $\Omega$ were to exist, then by the Yoneda Lemma we would have: $$\Omega(A)\cong\psh_\A(H_A,\Omega)\cong\{\text{subobjects of $H_A$}\},\quad\forall A\in\A$$This is ok since $\psh_\A$ is well-powered in this case of $\A$ small. We need also to identify a contravariant arrow map.
Given a subobject $(F,\alpha)\subseteq\A(\cdot,A)$ and $f\in\A(A',A)$, construct a pullback, giving the new objects arbitrary titles: $$\begin{CD}\Lambda(B)@>\tau_B>>F(B)\\@V\sigma_BVV@VV\alpha_BV\\\A(B,A')@>>f\circ(\cdot)>\A(B,A)\end{CD}$$Now for all $q\in\A(B,B')$, observe that, by naturality of $\alpha:F\implies\A(\cdot,A)$, we have: $$\alpha_B\circ F(q)\circ\tau_{B'}=(\alpha_{B'}(\cdot)\circ q)(\tau_{B'})=(\alpha_{B'}\circ\tau_{B'})\circ q=f\circ\sigma_{B'}(\cdot)\circ q:\Lambda(B')\to\A(B',A)$$So the arrows $\sigma_{B'}(\cdot)\circ q:\Lambda(B')\to\A(B',A')$ and $F(q)\circ\tau_{B'}:\Lambda(B')\to F(B)$ commute with the pullback square, hence there exists a unique arrow - call it $\Lambda(q)$ - $\Lambda(B')\to\Lambda(B)$ such that the following square (and the other one involving $\tau$) commutes: $$\begin{CD}\Lambda(B')@>\Lambda(q)>>\Lambda(B)\\@V\sigma_{B'}VV@VV\sigma_BV\\\A(B',A')@>>(\cdot)\circ q>\A(B,A')\end{CD}$$It is straightforward to see that this definition makes $\Lambda$ functorial, $\A\op\to\set$. Furthermore, as $\alpha$ is a monic natural transformation, it can be shown that each $\alpha_B$ is monic, and thus each $\sigma_B$ is monic as a pullback of a monic, finally giving $\sigma:\Lambda\implies\A(\cdot,A')$ as a monic natural transformation, hence a subobject. As subobjects are equivalence classes of these monics, the fact that pullbacks are only unique up to isomorphism is not a problem, and this definition is well-defined independent of the representative $(F,\alpha)$ for similar reasons.
Then defining $\Omega(f)[(F,\alpha)]=[(\Lambda,\sigma)]$ through this construction will also clearly make $\Omega$ functorial, $\A\op\to\set$.
So we have a working definition of $\Omega$ that handles representables well. I think that, to demonstrate $\Omega$ as a general subobject classifier, we need to invoke the theorem of colimits of representables.
Take an arbitrary $X\in\psh_\A$ - define (for brevity): $$\E:=\int_{\A}X:=\text{the category of elements of $X$}$$And define $Q:\E\to\A$ by $(A,x)\mapsto A$ and $((A',X(p)x)\overset{p}{\to}(A,x))\mapsto p\in\A(A',A)$. It can be shown that the following colimit identity holds: $$X\cong\lim_{\to\E}H_Q:=\lim_{\to\E}(H_\bullet\circ Q)$$Since $\E$ is a small category as inherited from $\A$. Then, to verify $\Omega$ is a subobject classifier for $X$, I can try (using the representables preserve (co)limits theorem) to use the fact that $\Omega$ is a subobject classifier in general if and only if: $$\begin{align}\{\text{subobjects of $X$}\}&\cong\psh_\A(X,\Omega)\\&\cong\psh_\A(\lim_{\to\E}H_Q,\Omega)\\&\cong\lim_{\leftarrow\E\op}\psh_\A(H_Q,\Omega)\\&\cong\lim_{\leftarrow\E\op}\Omega(Q(\cdot))\\\tag{$\ast$}&\cong\{(y_{A,x})\in\prod_{(A,x)\in\E}\Omega(A):\Omega(f)(y_{A,x})=y_{A',X(f)x},\,\forall f\in\A(A',A)\}\end{align}$$
The task at hand is to construct such an element $(y_{A,x})_{(A,x)\in\E}$ for all subobjects $(F,\alpha)\subseteq H_A$ and to find an inverse of this process. I don't think there are any slick categorical tricks to help me here - I just had to manually try, fail, and eventually arrive at a workable solution. I think I have done this now, and present my solution below. My questions are:
- How can we construct subobjects from data $(y_{A,x})_{(A,x)\in\E}\in(\ast)$, and visa versa?
- Is there an easier way? This seems an unusual amount of work (the book the exercises are from does not usually set labour intensive problems)
This question originally featured a solution to $1)$. However, I've since realised that it is incomplete. Passing to a computer science analogy, it is too lossy; we cannot actually extricate well-defined subobjects from the encoding that I use (there is enormous double counting in my reconstruction process). I'll leave it below hidden as a spoiler (because it is not terribly relevant but it is evidence of an attempt). Furthermore, I did not anywhere need the limit criterion $\Omega(f)(y_{A,x})=y_{A',X(f)x}$.
My main difficulty with this is thinking of a way to bijectively encode maps $F(A)\overset{\alpha_A}{\implies}X(A)$ into subobjects $S_x(B)\hookrightarrow\A(B,A)$. How can we relate arrows into $\A(B,A)$ with elements $(A,x)$? My best attempt is the one left below, where I thought that defining a subset of $\A(B,A)$ by those arrows $p$ for which $\overline{x}_B(p)$ is in the image $\alpha_BF(B)$ - but this process actually leaves either entirely empty or entirely full subsets. I just cannot see a way to complete this diagram: $$\begin{CD}\\F(B)@>?>>\A(B,A)\\@V1_{F(B)}VV@VV\overline{x}_BV\\F(B)@>>\alpha_B>X(B)\end{CD}$$Where $?$ is dependent on $(A,x)$ fixed. $\overline{x}$ denotes the Yoneda isomorphism, which is the only conceivable way of turning elements $x$ into arrows involved with $\A(\cdot,A)$.
Fix a presheaf $X\in\psh_\A$, a subobject $(F,\alpha)\subseteq X$ and $(A,x)\in\E$. I denote the Yoneda isomorphism with a bar: $\overline{(\cdot)}:X(\bullet)\to\psh_\A(H_\bullet,X)$. Define, for all $B\in\A$: $$S_x(B)=\{p\in\A(B,A):\overline{x}_B(p)\in\alpha_B(F(B))\}$$And for all $q\in\A(B',B)$ I claim that $S_x(q):S_x(B)\to S_x(B'),\,p\mapsto p\circ q$ is well-defined, since, by naturality: $$\begin{align}\overline{x}_{B'}\circ(p\circ q)&=X(q)\circ\overline{x}_B(p)\in X(q)(\alpha_B(F(B)))\\&=\alpha_{B'}(F(q)(F(B)))\\&\subseteq\alpha_{B'}(F(B))\end{align}$$This definition makes $S_x$ functorial and moreover $S_x(B)$ has the obvious injective inclusions into $\A(B,A)$ for all $B$, which define natural transformations by choice of $S_x(q)$, hence we may call $S_x$ a subobject of $H_A$. Now consider any $f\in\A(A',A)$ - we want to verify the equation $\Omega(f)(S_x)=S_{X(f)x}$ up to isomorphism. However, due to the nice nature of the (anonymous) inclusion arrows, it is straightforward to verify that the following is a pullback square: $$\begin{CD}S_{X(f)x}(B)@>f\circ(\cdot)>>S_x(B)\\@VVV@VVV\\\A(B,A')@>>f\circ(\cdot)>\A(B,A)\end{CD}$$As soon as it is checked that the arrows are well defined. However, by the construction of the Yoneda isomorphism, $\overline{(X(f)x)}_B(p)=X(f\circ p)x=\overline{x}_B(f\circ p)$, so $\overline{(X(f)x)}_B(p)\in\alpha_B(F(B))$ implies $\overline{x}_B(f\circ p)\in\alpha_B(F(B))$ trivially. Thus, setting $y_{A,x}:=S_x$ for all $(A,x)\in\E$ gives us an element of $(\ast)$. Now we need to go the other way. Take any $(y_{A,x})_{(A,x)\in\E}\in(\ast)$ and write the functor/transformation pairs as $(G_x,\beta_x)$. Define for $B\in\A$ the set: $$F(B)=\sum_{(A,x)\in\E}\overline{x}_B(\beta_{x,B}(G_x(B)))/\sim$$Where $\sim$ identifies equal elements (all the above disjoint components are subsets of $X(B)$). For $q\in\A(B',B)$ put $F(q)=\sum_{(A,x)\in\E}X(q)$ which by double naturality produces elements of $\overline{x}_{B'}(\beta_{x,B'}(G(q)(G_x(B))))\subseteq\overline{x}_{B'}(\beta_{x,B'}(G(B')))$ when acting on the $(A,x)$th disjoint component, so $F(q):F(B)\to F(B')$ holds. This definition obviously makes $F$ functorial, and moreover we have obvious inclusion transformations $F(B)\hookrightarrow X(B)$ by coalescing the disjoint components; since we took a quotient, these are injective inclusions. It remains to check naturality of these inclusions, but this is obvious by the definition of $F(q)$.
Consider the set of objects $(A,x)$ of the category of elements $\int X$ of the presheaf $X$. The functorial nature of the presheaf is captured by the fact that any morphism $f\colon A\to B$ determines a function an element of the from $(B,x)$ to an element $(A,f^*x)$, in such a way that $g^*f^*x=(f\circ g)^*x$ and $\mathrm{id_A}^*x=x$.
In the case where $X$ is a representable functor, the element $(B,x)$ corresponds to a morphism $x$ with domain $B$, and $f^*x$ is literally the composition $x\circ f$, i.e. $f^*$ acts by pre-composition. Let's adopt this terminology for arbitrary presheaves and not just representables.
From this point of view, a natural transformation from another presheaf $Y$ to $X$ consists of functions sending $(A,y)\to(A,\alpha_A(y))$ so that $f^*\alpha_A(y)=\alpha_B(f^*y))$. We can say that the natural transformation is a function from elements of $\int Y$ to elements of $\int X$ that is invariant under pre-composition.
In particular, a natural transformation whose components are monomorphisms determines a subset of elements of $\int X$ that is stable under under pre-composition. Moreover, two such natural transformations are equivalent (as subobject of the presheaf $X$) if and only if they determine the same set of elements of $X$.
In the case where $X$ is representable, the subobjects of $X$ correspond to sets of morphisms with the same codomain (the representing object) that are stable under pre-composition. Call such a set a sieve.
The would-be subobject classifier $\Omega$ is a presheaf whose elements are sieves. The functorial structure is given by specifying "pre-composition" on sieves. Explicitly, given a a morphism $f\colon A\to B$, the pre-composition with $f$ of a sieve of morphisms with codomain $B$ is the sieve of morphisms with codomain $A$ consists of all morphisms which when followed by $f$ result in a morphism in the sieve on $B$.
A natural transformation to the would-be subobject classifier $\Omega$ is then a precomposition-invariant function sending elements of $X$ to sieves. Thus the would-be subobject classifier is an actual subobject classifier if pre-composition stable sets of element of $X$ correspond to pre-composition invariant functions sending elements of $X$ to sieves.
Given a pre-composition invariant set of elements of $X$, for each element $(B,x)$ define the sieve of morphisms with codomain $B$ to be those $f\colon A\to B$ for which $(A,f^*x)$ is in the set.
Conversely, given a pre-composition stable function sending each element $(B,x)$ to a sieve on $B$, define the associated pre-composition stable set of elements to consist of those $(B,x)$ for which $\mathrm{id}_B\colon B\to B$ is contained in the sieve on $B$ associated to $(B,x)$.