Algorithm

The following algorithm determines <D>, the submonoid of a given monoid M generated by a given subset D.
We shall use the notation xN for {xn | N}.


  1. S := {e}.
  2. N := D.
  3. While N is not empty   do
                         S := S N;         N := (xD xN)\S
  4. Return S.