Throughout my answer, I will regard $\rightarrow$ as right-associative. This cuts down on the number of parentheses substantially, and means that e.g. $A \rightarrow B \rightarrow C$ stands for $A \rightarrow (B \rightarrow C)$. Similarly, $(A \rightarrow B) \rightarrow C \rightarrow D$ stands for $(A \rightarrow B) \rightarrow (C \rightarrow D)$. However, I do include some of the unnecessary parentheses when I think they substantially help comprehension.
Since $\neg (P \rightarrow \neg Q)$ is the definition of the conjunction $P \wedge Q$ in the classical Hilbert system, you're really defining your biconditional as $(\varphi \rightarrow \psi) \wedge (\psi \rightarrow \varphi)$. So we only need to derive $(P \wedge Q) \rightarrow P$ in our Hilbert system, and the required result involving the biconditional will follow immediately by substituting $\varphi \rightarrow \psi$ in place of $P$ (and $\psi \rightarrow \varphi$ in place of $Q$).
We can expand the definition of $\wedge$ in $(P \wedge Q) \rightarrow P$ to arrive at $\neg(P \rightarrow \neg Q) \rightarrow P$. Deriving this will be our goal.
For the rest of the exercise, we will require two standard lemmata, and we will repeatedly employ a well-known trick. The trick is that whenever you have a derivation of $A \rightarrow B$, you can get a derivation of $(C \rightarrow A) \rightarrow (C \rightarrow B)$ as follows.
- $A \rightarrow B$ (by assumption)
- $(A \rightarrow B) \rightarrow C \rightarrow (A \rightarrow B)$ (an instance of A1)
- $C \rightarrow A \rightarrow B$ (modus ponens from 1,2)
- $(C \rightarrow A \rightarrow B) \rightarrow (C \rightarrow A) \rightarrow (C \rightarrow B)$ (an instance of A2)
- $(C \rightarrow A) \rightarrow C \rightarrow B$ (modus ponens from 3,4)
Using this trick will keep our proofs fairly short. You'll have to be familiar with the trick anyway, since you'll eventually need to use it in the proof of the deduction theorem.
The first standard lemma we'll need is double-negation introduction, that is $\vdash A \rightarrow \neg\neg A$. You should try to prove this yourself, but if you get stuck, you can read a solution here.
The second standard lemma we'll need is the so-called principle of explosion, $\vdash \neg A \rightarrow (A \rightarrow B)$. This one's surprisingly hard to find here, so I'll just write down a proof for you:
- $(\neg B \rightarrow \neg A) \rightarrow A \rightarrow B$ (an instance of A3)
- $(\neg A \rightarrow \neg B \rightarrow \neg A) \rightarrow (\neg A \rightarrow A \rightarrow B)$ (by the trick)
- $\neg A \rightarrow \neg B \rightarrow \neg A$ (an instance of A1)
- $\neg A \rightarrow A \rightarrow B$ (modus ponens from 3,2)
Now, we have all the tools we need to reach our goal! We can argue as follows:
- $(P \rightarrow \neg Q) \rightarrow \neg\neg (P \rightarrow \neg Q)$ (by 1st lemma)
- $(\neg P \rightarrow P \rightarrow \neg Q) \rightarrow \neg P \rightarrow \neg\neg (P \rightarrow \neg Q)$ (by the trick)
- $\neg P \rightarrow P \rightarrow \neg Q$ (by 2nd lemma)
- $\neg P \rightarrow \neg\neg (P \rightarrow \neg Q)$ (modus ponens from 3,2)
- $(\neg P \rightarrow \neg\neg (P \rightarrow \neg Q)) \rightarrow \neg (P \rightarrow \neg Q) \rightarrow P$ (an instance of A3)
- $\neg (P \rightarrow \neg Q) \rightarrow P$ (modus ponens from 4,5)