For any category with pullbacks, it is easy to define the notion of category in , and the definition of an internal functor between such is similarly straightforward. But it is not so obvious how to define presheaves on internal categories, because they must land in the ambient category .
Here is the slick definition: let be a category with pullbacks. Then the bicategory of internal categories, profunctors and transformations in is defined to be , the category of monads and bimodules in , the bicategory of spans in .
So an internal profunctor between internal categories and is a bimodule from to . An internal presheaf on is a right -module, or equivalently a bimodule , where is the discrete category on the terminal object of (as long as has one, of course).
An internal presheaf in is the same thing as an internal diagram in .
Recall that an internal category in is a monad in , and so has an underlying span . Given , a bimodule must be given by a span , together with a right action of and a left action of that are compatible in the sense described at module over a monad.
Composition of spans is given by pullback, so the action of on is given by a morphism of spans , where the pullback is
To say that is a morphism of spans is to require that
commutes. This action must satisfy unit and associativity axioms expressing functoriality of the corresponding presheaf. Similarly, , where the pullback is along , so that this represents a copresheaf. Finally, compatibility of the two actions represents bifunctoriality of the profunctor.