apply square rule in set comprehension