I began studying some formal logic for possible future proof and type theory dives. I am at the very beginning, Gentzen style natural deductions. Some of these proof rules defies my intuition so I wanted to ask for some clarification.
Suppose we want to prove that $\neg (P \Rightarrow Q) \Rightarrow P$. Informally speaking:
- Assume $\neg (P \Rightarrow Q)$, show $P$.
To show $P$, we will use proof by contradiction and we will assume $\neg P$.
{ At this stage, we have premises $\neg (P \Rightarrow Q)$ and $\neg P$ in our environment $\Gamma$ }
Now, If we can show $(P \Rightarrow Q)$ from $\Gamma$, we can conclude $\bot$ and complete our proof.
To show $(P \Rightarrow Q)$, assume $P$ and show $Q$.
{ At this stage, we have premises $\neg (P \Rightarrow Q)$, $\neg P$ and $P$ in our environment $\Gamma$ }
This is our proof strategy, informally. Below I show this as a formal proof tree. I hope it is readable enough, I had to play a lot with frac of $\LaTeX$. Notationally, $[P]^x$ means that $P$ is an assumption that is going to be removed from $\Gamma$ at the proof step $x$ somewhere below. efq stands for ex falso quodlibet.
$$ \dfrac{\dfrac{\neg (P \Rightarrow Q) \quad \dfrac{\dfrac{[\neg P]^y \space [P]^x}{\dfrac{\bot}{Q}\ \text{efq}}\ \neg-E}{P \Rightarrow Q} \ \Rightarrow - I^x \quad}{\dfrac{\bot}{P}\ \text{efq-y}}} {\neg (P \Rightarrow Q) \Rightarrow P}\ \Rightarrow - I^z $$
This was an example in Jean Gallier's Discrete Mathematics book. I feel like I got the mechanical parts understood. Still, my head hurts when thinking about how I assumed both $P$ and $\neg P$ to prove something. How do you guys understand this? How can we assume both $P$ and $\neg P$, isn't that absurd? What am I missing so that I feel like this proof is bogus? Why do I feel like I can prove anything with this?
As a programmer, I suspect these assumptions are like local variables in a function from a computer program. For example, that assumption of $P$ is valid only in the program that proves $Q$ and is removed from the stack after that. Trying to use it for any other proof would be using an already deleted variable etc. I am not sure about forming this analogy though, since it is not mentioned in the book. I want logician's explanation.


If you discharge an assumption labelled $z$ you should remember to actually label the assumption.
Also, ex falso quodlibet is not a rule of discharging; the rule to discharge $y$ is negation introduction, which needs to be followed by double negation elimination (though some do combine it into Reduction Ad Absurdum (RAA)).
$$ \dfrac{ \dfrac{ \dfrac{ \dfrac{ \lower{1.5ex}{[\neg (P \to Q)]^z} \quad \dfrac{ \dfrac{ \dfrac{[\lnot P]^y\quad[P]^x}{\bot}{\lnot E} }{Q}{\rm efq} }{P\to Q}{\to I^x} }{\bot}{\rm efq} }{\lnot\lnot P}{\lnot I^y} }{P}{\lnot\lnot E} }{\neg (P \to Q) \to P}{\to I^z} $$
Yes, that is how Reduction to Absurdity proofs operate: "If this assumption was true it, then what follows would be absurd, so therefore it cannot be true."
In this proof: When given $\lnot (P\to Q)$ should we also assume $\lnot P$, then we could prove $P\to Q$ (through the ex falso quodlibet subproof), which is absurd, so therefore $\lnot (P\to Q)$ entails $P$, and so we deduce $\lnot(P\to Q)\to P$.
Here's the fitch style representation which may be easier to follow. $$\def\fitch#1#2{\quad\begin{array}{|l}#1 \\\hline #2\end{array}}\fitch{}{\fitch{~1.~\lnot(P\to Q)}{\fitch{2.~\lnot P}{\fitch{~3.~P}{~4.~\bot\hspace{14ex}\lnot e, 2,3\\~5.~Q\hspace{14ex}\text{efq},4}\\~6.~P\to Q\hspace{12ex}{\to}i,3-5\\~7.~\bot\hspace{17ex}\lnot e,1,6}\\~8.~\lnot\lnot P\hspace{18ex}\lnot i,2-7\\~9.~P\hspace{21ex}\lnot\lnot e,8}\\10.~\lnot(P\to Q)\to P\hspace{10ex}{\to}i,1-9}$$
In this notation we keep track of the order in which assumptions are raised and discharged by indentation. Here we see that a contradiction can be derived on raising the third assumption, and so we may validly derive $Q$ within that context (because whatever $Q$ may be, it is at least as true as an absurdity).
Ex falso Quodlibet: If we can say "false is true", then we may say anything is true.