TITLE: When should I be doing cohomology?
QUESTION [47 upvotes]: Background: I'm a logic student with very little background in cohomology etc., so this question is fairly naive.

Although mathematical logic is generally perceived as sitting off on its own, there are some striking applications of algebraic/geometric/combinatorial ideas to logic. In general, I'm very interested in the following broad question: 

"How should I go about looking for pieces of mathematics far from mathematical logic, which have bearing on some piece of mathematical logic?"

Right now, I'm specifically interested in the following: 

"When should I think 'cohomology!'?"

The specific example I'm motivated by is a pair of papers by Dan Talayco (http://arxiv.org/pdf/math/9311205.pdf, http://www.sciencedirect.com/science/article/pii/0168007295000240) in which he develops cohomology theories for two purely set-theoretic objects: Hausdorff gaps, and particularly weird infinite trees ("Todorcevic trees").
At the beginning of his paper on Hausdorff gaps, Talayco mentions that

"the original observation that gaps are cohomological in nature is due to Blass."

This is something I want to be able to do! I can tell that e.g. Hausdorff gaps are all about "not being able to fill something in," but it's a long way between that vague statement and the intuition that there should be a cohomology theory around it, let alone coming up with the specifics. So my question is:

Question. When should I suspect that some piece of mathematics (ideally far from algebra/geometry) has a cohomological interpretation, and how should I go about figuring out what the specifics should be?

To clarify: although 'useful' is always good, I'm just asking how I can tell that cohomology can be attached to some piece of mathematics (especially logic), regardless of whether it yields new results.

REPLY [21 votes]: As Steven Gubkin and Ryan Budney have already pointed out, cohomology is often used to measure how far a "locally consistent" object is from being "globally consistent".  I thought I might describe another example of this in set theory, which it turns out contains a lot of open problems.  As far as I know, this example hasn't been written down anywhere, so I'll have to be a bit verbose.  I won't attempt an actual answer to the OP's question, but I hope that what I write down might be helpful.
Disclaimer: Justin Moore told me about this problem many years ago, when I was just beginning grad school.  What I'm writing down is what I've been able to reconstruct from my memory of that conversation; it might not be the most up-to-date information on the problem, or the best description of it.
Given a subset $A$ of $\omega$, let $\Gamma(A) = \prod_{n\in A} \mathbb{Z} / \bigoplus_{n\in A} \mathbb{Z}$.  Thus, an element of $\Gamma(A)$ can be described as the equivalence class of a function $f : A\to\mathbb{Z}$, where the equivalence is "$f$ and $g$ differ on at most finitely-many coordinates."
Now given a family $\mathcal{A}\subseteq\mathcal{P}(\omega)$, and an $n < \omega$, we define the groups $$ C_n(\mathcal{A}) = \prod_{A_1,\ldots,A_n} \Gamma(A_1\cap\cdots \cap A_n)$$
When $n = 0$, this definition is a little ambiguous, so we take the opportunity to identify $C_0(\mathcal{A})$ with $\Gamma(\omega)$.  (One can argue that that's the correct way of doing things, but I'll leave it to the reader.)  Now we can define coboundary maps $\delta_n : C_n\to C_{n+1}$ (for all $n$, including $n = 0$) by $$\delta_n(F)(A_1,\ldots,A_{n+1}) = \sum_{k=0}^n (-1)^k F(A_1,\ldots,\widehat{A_{k+1}},\ldots,A_{n+1})$$ where as usual $\widehat{A_{k+1}}$ means we drop $A_{k+1}$ from the list.  One can prove as usual that $\delta_{n+1}\circ \delta_n = 0$, so $H_n(\mathcal{A}) = \ker{\delta_{n+1}} / \textrm{im}\;\delta_n$ makes sense.
If you work through the definitions, you can see that $\delta_0$ maps a function (or more accurately, its equivalence class) to its restrictions to elements of $\mathcal{A}$.  $\delta_1$ takes a collection of functions defined on members of $\mathcal{A}$ to their differences (on the pairwise intersections).
Hence, a member of $\ker{\delta_1}$ is a family of functions $f_A : A\to \mathbb{Z}$ ($A\in\mathcal{A}$) such that $f_A\upharpoonright A\cap B$ and $f_B\upharpoonright A\cap B$ agree mod-finite for every $A,B$.  Such families have been studied before by set theorists, and are called coherent families.  The question of whether such a coherent family is in $\textrm{im}\;\delta_0$ is exactly what comes up in Dow, Simon and Vaughan's paper "Strong homology and the proper forcing axiom".  They prove there the following (I'm paraphrasing a little bit):
Theorem 1: Assume $\mathfrak{d} = \omega_1$.  Then there is a $P$-ideal $\mathcal{I}\subseteq\omega$ (in fact, $\mathcal{I}$ is just $\emptyset\times\textrm{fin}$) such that $H_0(\mathcal{I}) \neq 0$.
Theorem 2: Assume the Proper Forcing Axiom.  Then $H_0(\mathcal{I}) = 0$ for every $P_{\aleph_1}$-ideal $\mathcal{I}$.
Actually, it's not hard to prove that $2^\omega < 2^{\omega_1}$ implies that $H_0(\mathcal{A})$ has size $2^{\omega_1}$, whenever $\mathcal{A}$ is a $\subset^*$-increasing $\omega_1$-sequence in $\mathcal{P}(\omega)$.  Moreover, Velickovic proves Theorem 2 from just OCA in his paper "OCA and automorphisms of $\mathcal{P}(\omega)/\mathrm{fin}$".
Okay, so we have a lot of natural questions!
Question: What is the possible behavior of $H_n(\mathcal{A})$ for various sets $\mathcal{A}$, and $n\ge 1$?  Does PFA (or MM, or whatever) imply that they're all trivial, whenever (say) $\mathcal{A}$ is a $P$-ideal?  Can we consistently get $H_n(\mathcal{A}) \neq 0$ for all $n\ge 1$?  All at the same time?  Etc.
Here's another, entirely unrelated problem.  It's known that for every $n$, there is a $\sigma$-$n$-linked poset of size $\mathfrak{b}$, which has no $n+1$-linked subset of size $\mathfrak{b}$.  (See Todorcevic, "Remarks on cellularity in products.")  Can you express this using cohomology (or maybe homology)?