Automatic Generation of Morphological Set Recognition Algorithms