amalgamation

Work on the amalgamation algorithm, testing if a given word is in the
subgroup H[f] and if it is rewriting it into the other will be done
through a separate function called hf_test.