Implement Pierce's pattern generation/enumeration procedure.