Slingshooting against the necessity of identity
The set is the empty set if p is false, otherwise it is the set of all numbers. Hence iff either p and q are both false or p and q are both true. So
1)
Moreover, (1) isn't contingent. It doesn't just happen to be the case at our world that iff p and q have the same truth value. Such truths of logic and set theory hold with necessity:
2)
Now assume the necessity of identity:
3)
From (1) and (3) it follows that
4)
And from (2) and (4) it follows that
5)
But (5) is absurd. (In fact, (5), together with the innocent assumption that there is any necessary truth, entails that all truths are necessary truths: let p be the necessary truth and q any other truth.)
So what's wrong?
(2) is true (in the right-to-left direction) only if "{x:x in N & p}" etc are construed as non-rigid designators--i.e., as picking out, wrt a world w, the set of all x such that in w: (x is in N and p), rather than the set of all x such that in the actual world: (x is in N and p).
The rest of the derivation fails if they are so construed.
If we construe "{x:x in N & p}" in the way described, then from 1 and 3 it only follows that:
(4*) (p < - > q) -> (w)(z)(w={x:x in N & p} & z={x:x in N & q} -> NEC:(w=z))
and from 2 and 4*, 5 does not follow.