Dealing with formal logic rules in grouping games