RestricedSet implements a set with restrictions defined by a given block