In Vellemen's proof book, I keep encountering deriving-second-law-from-first-law type of exercises whose given answers say to just add a negation. For example,
Question 4 of section 2.2:
Show that the second quantifier negation law, which says that ¬∀x P(x) is equivalent to ∃x¬P(x), can be derived from the first, which says that ¬∃x P (x ) is equivalent to ∀x ¬ P (x ). (Hint: Use the double negation law.)
gives a hint saying to replace P(x) with ¬P(x).
I remember being told that we can do whatever we want to an equation as long as we apply it to both sides. Does this apply here?
The "first negation law" says that $\lnot \exists x P(x)$ is equivalent to $\forall x \lnot P(x)$ for every formula $P(x)$. The key word here is: every formula. We can replace $P(x)$ by any formula we want.
So we may replace $P(x)$ by $\lnot P(x)$, because if $P(x)$ is a formula, then so is $\lnot P(x)$.