A functor $C \to D$ between categories induces a morphism of presheaf categories $Pre(D) \to Pre(C)$. This functor has a left adjoint given by left Kan extension and I am interested in knowing when this left adjoint preserves pull-back squares.

I'm interested in any conditions that make this happen, but I am particularly interested in a special case. Let me say a little more about the context I am working in, and why I am interested. In the situation that this came up $C$ is a "lluf" subcategory of $D$, that is $C$ has the same objects as $D$ and the functor $C \to D$ is faithful. In that case it is good to call the functor $U:Pre(D) \to Pre(C)$ the forgetful functor. It automatically preserves limits and colimits. Let L be its left-adjoint.

Since C has the same objects as D, this forgetful functor is also conservative, meaning that it reflects isomorphisms. So by general non-sense (specifically Beck's monadicity theorem) this is a monadic adjunction. This means that $Pre(D) = T-alg$ is the category of T-algebras in $Pre(C)$ where T is the monad $T= UL$.

I'm trying to understand conditions under which this monad is cartesian in the sense described at the n-lab. This means, among other things, that the monad T is supposed to send fiber products to fiber products. This is equivalent to having L send fiber products to fiber products. I want to understand when this happens. Does it always happen? Are there reasonable conditions on C or D that ensure that this happens?

Notice that I am not asking for L to be "left-exact", i.e. to commute with all finite limits. This property is generally much too strong. In particular L will not usually preserve terminal objects. This means it doesn't preserve products, but should instead send products to fiber products over $L(1)$.

Here is an example. Let $C = pt$ be the singleton category and $D = G$ be the one object category with morphisms a group G. There is a unique inclusion $C \to D$ which is obviously faithful. The forgetful functor
$$U:Pre(D) \to Pre(C)$$
sends a G-set to its underlying set. The left adjoint L sends a set S to the free G-set $S \times G$. This doesn't preserve terminal objects, but it does commute with fiber products. What is more, the monad $T=UL$ is a classic example of a cartesian monad in the n-lab sense.

I've played around with this, but can't seem to get it to work. I feel like this is going to be a well known result or there is going to be a counter example which sheds light on the situation.

Question: In the context I described above (where $C \to D$ is lluf), does the left adjoint $$L: Pre(C) \to Pre(D)$$ always commute with fiber products? If not what is a counter example, and are there conditions one can place on C and D to ensure that L does commute with fiber products?

Here's an idea for an approach; I don't have time to work it through now, but maybe someone else can? First: "preserves pullbacks"="preserves finite connected limits". Now, the left adjoint $L = f \otimes -$ preserves finite limits iff the original functor $f$ is flat, i.e. "has (co?)filtered (co?)commas". Now, "filtered"="has a cocone under every finite diagram". What if we replace this with "…every finite connected diagram"? Will this condition be equivalent to $f \otimes -$ preserving finite connected limits? I suspect this won't quite work, but that something similar will.
–
Peter LeFanu LumsdaineAug 3 '10 at 22:36

Define: a category is semi-filtered iff every pair of arrows $x \leftarrow z \rightarrow y$ can be completed to a commutative square, and every parallel pair of arrows $f,g \colon x \to y$ have some $h : y \to w$ with $hf = hg$; equivalently, if every finite connected diagram has some co-cone under it. (Afaik, this isn't standard terminology; I don't recall seeing this property discussed, but it almost certainly has been.)

It's filtered if moreover it's non-empty and every pair of objects $x,y$ is connected by some $x \to w \rightarrow y$; equivalently, if every finite diagram has some co-cone under it.

This is a close variant of the standard lemma (see e.g. Mac Lane and Moerdijk Sheaves in Geometry and Logic) that $f_*$ preserves pullbacks and the terminal object (equivalently, all finite limits) iff the opposite of every $(f \downarrow d)$ is filtered, i.e. if $f$ is flat.

Proof: the values of $f_*$ can be computed as colimits over the opposites of comma categories (see this answer). But in $\mathbf{Set}$, finite limits commute with filtered colimits; and similarly, pullbacks commute with semi-filtered colimits.

(The first of these facts is standard. The second follows because in a semi-filtered category, each connected component is filtered; so a semi-filtered colimit is a coproduct of filtered colimits; and pullbacks commute with both coproducts and filtered colimits.)

Here's another way of getting to the same answer as Peter's. A functor $F\colon A\to B$ preserves pullbacks if and only if the induced functor $F/1 \colon A \to B/F1$ preserves all finite limits, where 1 is the terminal object of A. When F is left Kan extension $L\colon Psh(C) \to Psh(D)$ along a functor $f\colon C\to D$, it's not hard to check that Psh(D)/L1 is equivalent to presheaves on the opposite of the category el(L1) of elements of L1 (this is true with any presheaf replacing L1), and that L/1 is left Kan extension along the induced functor $f'\colon C\to el(L1)^{op}$. Thus, we need to know when that functor is flat.

Now an object of $el(L1)^{op}$ is an object $d\in D$ together with a connected component, call it X, of the comma category $(d\downarrow f)$. And a morphism in $el(L1)^{op}$ is a morphism $d_1\to d_2$ such that the induced functor $(d_2\downarrow f) \to (d_1\downarrow f)$ maps $X_2$ to $X_1$. You can then check that the comma category $((d,X)\downarrow f')$ is precisely the connected component X of the comma category $(d\downarrow f)$. Therefore, since $f'$ is flat just when all categories $((d,X)\downarrow f')$ are cofiltered, we conclude that left Kan extension along f preserves pullbacks iff all connected components of all comma categories $(d\downarrow f)$ are cofiltered, i.e. if all $(d\downarrow f)$ are "semi-filtered" in Peter's terminology.

Edit: you also asked for a specific counterexample when $f\colon C\to D$ is the inclusion of a lluf subcategory. Let D be the walking commutative square generated by arrows $a\to b$, $a\to c$, $b\to d$, and $c\to d$, and let C be its lluf subcategory containing the identities and the arrows $b\to d$ and $c\to d$. Then the comma category $(a\downarrow f)$ has two connected components, one of which is not semi-cofiltered.