construct the submonoid of a monoid G generated by the image of a map X -> G
construct the submonoid of a monoid G generated by the image of a map X -> G, part 2