Reduce repeated code in set operations and check that DFAs have the same alphabets for set operations