Put stuff into a struct and made a signature that fits.
Moved this function over. Some of the names are horrible though.
Functor business done, at least as far as get_distinguishing_formulae is concerned; it's been moved inside the functor totally.
We don't need the open S1 statement any more - everything that needed
those functions is inside the functor.
Made S2.
Made S4, and replaced get_nk_pairs1 and get_nk_pairs2 with functions
from S4.