Counting techniques for inclusion, equivalence and membership problems