public Module gen(Module mod) { Set<Sentence> res = new HashSet<>(); for (Sort sort : iterable(mod.definedSorts())) { Production prod = Production( "is" + sort.name(), Sorts.Bool(), Seq( Terminal("is" + sort.name()), Terminal("("), NonTerminal(Sorts.K()), Terminal(")")), Att().add(Attribute.FUNCTION_KEY).add(Attribute.PREDICATE_KEY, sort.name())); if (!mod.productions().contains(prod)) res.add(prod); } return Module( mod.name(), mod.imports(), (scala.collection.immutable.Set<Sentence>) mod.localSentences().$bar(immutable(res)), mod.att()); }