How does ~ distribute over parentheses? In my recent Discrete Math final exam, we had a question where I thought the answer was false but apparently it is true. It is the following:
$$((\forall x)P(x)) \rightarrow  ((\forall y) Q(y))) \equiv (((\exists y) \sim Q(y) \rightarrow (\sim(\forall x)P(x)))$$
Clearly, this is an application of the definition of implication and I knew this, but I thought that the solution was false since the ~ in 
$$(\sim(\forall x)P(x)))$$ 
should not distribute into the P(x) since I thought that 
$$(\sim(\forall x)P(x)))$$
and 
$$(\sim(\forall x) \sim P(x)))$$
are different. 
I'm thinking its missing an extra pair of parens:
$$((\forall x)P(x)) \rightarrow  ((\forall y) Q(y))) \equiv (((\exists y) \sim Q(y) \rightarrow (\sim((\forall x)P(x))))$$
Am I right here?
 A: I think your basic problem here is that you're misunderstanding the structure of the formula $(\forall x)P(x)$, and this leads you to misunderstand its negation.


*

*$P(x)$ is a formula.

*$(\forall x)P(x)$ is a formula.

*$(\forall x)$ alone is not a formula -- it's just a collection of symbols that can become part of a formula if you put a formula behind it.


The negation symbol only ever applies to an entire formula. It is therefore not possible to negate $(\forall x)$ by itself -- that would mean nothing! So when we write $\sim (\forall x)P(x)$ what you're negating is the entire formula $(\forall x)P(x)$.
Semantically $(\forall x)P(x)$ means, "everything has the $P$ property".
The negation of this is $\sim(\forall x)P(x)$, which means "it is NOT the case that everything has the $P$ property", or in other words "there is something that does not have the $P$ property".
I suspect you were envisaging like $(\sim \forall x)$ meaning "for only some of the $x$", but that's not how the symbolism works.
A: Yes, the two statements are equivalent.  The statement ($a \implies b$) is equivalent to its contrapositive statement ($\sim b \implies \sim a$). It's just that in your problem, the two negations $\sim b$ and $\sim a$ are expressed differently.  One way to write "negation of $(\forall x, P(x))$" is "$\sim (\forall x, P(x))$.  A second way is to write "$\exists x, \sim P(x)$". 
