Implement term product unifier merging algorithm