Generating all possible rules