Proving logical equivalences I've been stuck on this one problem for a couple of days now with no clue on how to complete it. I need to prove the following logical equivalence:

$$\neg((\neg q \wedge \neg p) \vee (r \wedge q) \vee (r \wedge \neg p)) = (\neg q \rightarrow \neg p) \rightarrow \neg(q \rightarrow r).$$

If anyone could shed some light on this matter, please..
 A: The main rules that should help you here are as follows:
$$p \implies q = (\neg p \vee q)$$
$$\neg(p \wedge q) = (\neg p \vee \neg q)$$
$$(p \vee q) \wedge r = (p \wedge r) \vee (q \wedge r)$$
$$(p \wedge q) \vee r = (p \vee r) \wedge (q \vee r)$$
Then, using these rules, the following holds:
\begin{align}
(\neg q \Rightarrow \neg p) \Rightarrow \neg(q \Rightarrow r) &=(\neg(\neg q) \vee \neg p) \Rightarrow \neg(\neg q \vee r). &\text{[By rule 1]}\\
&= (q \vee \neg p) \Rightarrow \neg(\neg q \vee r) &\text{[Double negation]}\\
&= (\neg(q \vee \neg p) \vee \neg(\neg q \vee r)) &\text{[By rule 1]}\\
&= \neg((q \vee \neg p) \wedge (\neg q \vee r)) &\text{[By rule 2]}\\
&= \neg(((q \vee \neg p) \wedge \neg q) \vee ((q \vee \neg p) \wedge r)) &\text{[By rule 3]}\\
&= \neg((q \wedge \neg q)\vee (\neg p \wedge \neg q) \vee (q \wedge r) \vee (\neg p \wedge r)) &\text{[By rule 4]}\\
&= \neg((\neg p \wedge \neg q) \vee (q \wedge r) \vee (\neg p \wedge r)) &\text{[As q and not q is false.]}
\end{align}
A: One way is to write out the whole truth table. Here's another.
Expand the right side, using $A \rightarrow B \equiv \lnot A \vee B$.
$$(\lnot Q \rightarrow \lnot P) \rightarrow \lnot(Q \rightarrow R)$$
$$(Q \vee \lnot P) \rightarrow \lnot(\lnot Q \vee R)$$
$$\lnot (Q \vee \lnot P) \vee \lnot(\lnot Q \vee R)$$
$$(\lnot Q \wedge P) \vee (Q \wedge \lnot R)$$
Distribute the OR across the ANDs:
$$(\lnot Q \vee (Q \wedge \lnot R)) \wedge (P \vee (Q \wedge \lnot R))$$
$$(\lnot Q \vee Q) \wedge (\lnot Q \vee \lnot R) \wedge (P \vee Q) \wedge (P \vee \lnot R)$$
$$(\lnot Q \vee \lnot R) \wedge (P \vee Q) \wedge (P \vee \lnot R)$$
Use De Morgan's laws a bunch of times: $\lnot(A \vee B) \equiv \lnot A \wedge \lnot B$ and $\lnot(A \wedge B) \equiv \lnot A \vee \lnot B$.
$$\lnot \lnot [(\lnot Q \vee \lnot R) \wedge (P \vee Q) \wedge (P \vee \lnot R)]$$
$$\lnot [\lnot (\lnot Q \vee \lnot R) \vee \lnot (P \vee Q) \vee \lnot (P \vee \lnot R)]$$
$$\lnot [(Q \wedge R) \vee (\lnot P \wedge \lnot Q) \vee (\lnot P \wedge R)]$$
$$\lnot [(Q \wedge R) \vee (\lnot P \wedge \lnot Q) \vee (\lnot P \wedge R)]$$
Which, with some switching of operands, is the left side.
A: Start with the right hand side, and rewrite it piece by piece. It is $(\neg A)\vee B$ where $A=q\vee\neg p$ and $B=\neg(\neg q\vee r)=q\wedge\neg r$. Then $\neg A=\neg q\wedge p$, so the right hand side is$$(\neg q\wedge p)\vee(q\wedge\neg r)=(\neg q\vee\neg r)\wedge(p\vee q)\wedge(p\vee\neg r)$$ Its double-negation is $$\neg((q\wedge r)\vee(\neg p\wedge\neg q)\vee(\neg p\wedge r))$$ After a rearrangement, we get the left hand side.
