Adds support to reverse iteration on messages, threads and tags. To revew and think if makes sense to include them on notmuch or wait until they have a real use. The patch 3 "Move the logic of threads iterator out of 'valid'" is just a reorganization of the code, I think it makes sense to include it in notmuch even if we decide that the reverse iterators are not included.