Given two categories $I$ and $J$ we say that *colimits of shape $I$ commute with limits of shape $J$* in the category of sets, if for any functor $F : I \times J \to \text{Set}$ the canonical map $$\textrm{colim}\_{i\in I} \text{lim}\_{j\in J} F(i,j) \to \textrm{lim}\_{j\in J} \text{colim}\_{i\in I} F(i,j)$$ is an isomorphism.


The standard examples are a) filtered colimits commute with finite limits and b) sifted colimits commute with finite products. (Those statements can be regarded as definitions of which categories $I$ are filtered or sifted respectively, but both terms have independent definitions for which these commutation results are propositions.) A third, less known example is to take $I$ a finite group and $J$ a cofiltered category, in other words, if $G$ is a finite group and $X\_j$ is an inverse system of $G$-sets, then the canonical map $$(\varprojlim\_{j\in J} X\_j)/G \to \varprojlim\_{j \in J}(X\_j/G)$$ is an isomorphism.


Now, all of these examples are easy to prove separately ([here](http://www.matem.unam.mx/omar/notes/fingrpcomm.html)'s a proof of the $G$-set result, for example) but I see no unifying pattern. Is there a simple criterion for when $I$-colimits and $J$-colimits commute in the category of sets?


[Note: It's true that $I$ is filtered (resp. sifted) if and only if for all finite (resp. finite discrete) $J$ the diagonal functor $I \to I^J$ is final; but I don't think that for arbitrary $I$ and $J$, if the diagonal $I \to I^J$ is final then $I$-colimits commute with $J$-limits. If I'm wrong and that condition on the diagonal actually is sufficient for commutation: why? and is it also necessary?]



Which colimits commute with which limits in the category of sets?
Some very involved necessary and sufficient conditions are found in a [paper of Foltz](http://archive.numdam.org/article/DIA_1981__5__A1_0.pdf) (in French). Some observations on his paper:


1. An elementary observation (Proposition 3, section 1, p. F 12): $I$-colimits commute in $\mathrm{Set}$ with $P$-limits iff $I$-limits commute with discrete $\pi\_0(P)$-colimits and also with $P'$-colimits for each connected component $P'$ of $P$. Foltz then analyzes separately the cases of $P$ discrete and of $P$ connected.
2. He separately analyzes the conditions that the canonical comparison map be always injective and that it be always surjective.
3. He treats some examples of interest at the end, including the colimits that commute in $\mathrm{Set}$ with pullbacks and those that commute in $\mathrm{Set}$ with equalizers. But it doesn't appear that he discusses how to recover characterizations of filtered or sifted limits.
4. Foltz's criteria are expressed in terms of certain certain subdivision categories, and a lot of zig-zags. Unfortunately, he doesn't discuss how to relate his criteria to other more familiar ones, such as the finality of certain diagonal functors. But it might be possible to convert his criteria into such forms.


Some things are known about the general phenomenon of limits commuting with colimits:


* Albert and Kelly's "The Closure of a Class of Colimits" discusses which limit-weights commute in $\mathrm{Set}$ with all the colimit-weights that a given class commutes with -- which is sort of the "square" of the commutation relation you're interested in. This is what Albert and Kelly call the "closure" of a class of colimits, and nowadays is typically referred to as the *saturation*.
* There are also some good [notes](http://www.tac.mta.ca/tac/volumes/14/17/14-17abs.html) by Kelly and Schmitt which discuss the formal aspects of the situation, which is enough to gain some meaningful insight into the important case of *absolute* colimits -- those which commute with *every* limit.


Both of these papers are written in the context of enriched categories, which means they don't provide terribly *specific* information about the case of $\mathrm{Set}$-enrichment, but at least clarify the formal situation.


More specifically, as Mike Shulman notes, you might want to take a look at the


* ABLR paper, [available from Steve Lack's website](http://maths.mq.edu.au/%7Eslack/papers/acc.html). They use a condition on a class of limit weights $\mathbb{D}$ that they call "soundness." In fact, soundness is explicitly a simplifying assumption about which colimits commute with $\mathbb{D}$-limits in $\mathrm{Set}$. All the examples which are well-known (like finite/filtered and finite-discrete/sifted) satisfy soundness; it seems to account for why they're so nice to work with.
* Some further work has been done on developing the theory of these "sound doctrines", especially by Claudia Centazzo; Lack and Rosicky's "On the notion of Lawvere Theory" also starts to consider what the enriched case might look like.


But very little seems to be known about which "doctrines" (classes of limit-weights) are sound in general. In fact, the only examples given by ABLR of non-sound doctrines are the doctrine of pullbacks, and the doctrine of pullbacks + terminal objects -- neither of which is saturated! The saturation of the latter is, of course, all finite limits, which *is* sound. The conical saturation of pullbacks is the class of simply-connected and finitely-presentable categories, [as discovered by Paré](http://books.google.com/books?hl=en&lr=&id=vZa--LndYTYC&oi=fnd&pg=PA731&ots=sSvf0xRnA8&sig=3Ypxmt83D73-G4oTOqIdC6nWG5A#v=onepage&q&f=false), which is *not* sound -- this can be seen by adapting ABLR's argument concerning pullbacks (Example 2.3.vii).


Linked references:


* François Foltz, [*Sur la commutation des limites*](http://archive.numdam.org/article/DIA_1981__5__A1_0.pdf), Diagrammes 1981
* Kelly and Schmitt, [*Notes on enriched categories with colimits of some class*](http://www.tac.mta.ca/tac/volumes/14/17/14-17abs.html), Theory and Applications of Categories 2005
* Adámek, Borceux, Lack, Rosický, [*A classification of accessible categories*](http://maths.mq.edu.au/%7Eslack/papers/acc.html), Journal of Pure and Applied Algebra, 2002.
* Paré, [*Simply connected limits*](http://books.google.com/books?hl=en&lr=&id=vZa--LndYTYC&oi=fnd&pg=PA731&ots=sSvf0xRnA8&sig=3Ypxmt83D73-G4oTOqIdC6nWG5A#v=onepage&q&f=false), Canadian Journal of Mathematics, 1990


