I have seen it said on Mathematics Stack Exchange that proofs by contrapositive are generally preferred over proofs by contradiction (for instance here and here). In other words, it is bad style to prove an implication $P\to Q$ by assuming $P\land\neg Q$, and then giving a direct proof of $\neg Q\to\neg P$ without using the assumption $P$, and then deriving the contradiction $P\land\neg P$. There are many reasons why this might be considered bad style, but to me the most significant one is the following:
- If in a proof by contradiction you establish a number of intermediate results $A_1,A_2,\dots,A_n$, then those results are not guaranteed to be valid outside of the contradictory framework you are working in—they are being used to construct a logical house of cards that will eventually topple. However, if you give a direct proof of $\neg Q\to\neg P$, then any intermediate results you establish along the way are valid. By phrasing the proof by contrapositive as a proof by contradiction, you are at risk of misleading the reader.
However, let's actually consider an example. The proof given below seems typical of what you might find in an introductory analysis book. Pay attention to the bolded sentence below:
Theorem: If a sequence of real numbers is increasing and bounded above, then its supremum is its limit.
Proof: Let $(a_n)_{n\in\mathbb N}$ be a sequence of real numbers, and let $\{a_n\}$ be the set of terms in $(a_n)_{n\in\mathbb N}$. By the least-upper-bound property of the real numbers, $l=\sup\{a_n\}$ exists in $\mathbb R$. Now, for every $\pmb{\varepsilon>0}$ there is an $\pmb{N>0}$ such that $\pmb{a_N>l-\varepsilon}$, as otherwise $\pmb{l-\varepsilon}$ would be an upper bound of $\pmb{\{a_n\}}$, which contradicts the definition of $\pmb{l}$. Since $(a_n)_{n\in\mathbb N}$ is increasing, if $n>N$, then $c\ge a_n\ge a_N>c-\varepsilon$, and so $|c-a_n|<\varepsilon$. Hence, by the definition of the limit of a sequence, $a_n\to\sup\{a_n\}$ as $n\to\infty$.
The claim being made in the bolded sentence above is $$ (\forall\varepsilon > 0)(\exists N>0)(a_N>l-\varepsilon) \, . $$ And the way this claim is proven is by showing that $$ \neg(\forall\varepsilon > 0)(\exists N>0)(a_N>l-\varepsilon)\to(\text{$l-\varepsilon$ is an upper bound of $\{a_n\}$})\land(l=\sup\{a_n\}) \, , $$ which is a contradiction. But notice that we just as well could have proven the claim by directly proving that $$ \neg(\forall\varepsilon > 0)(\exists N>0)(a_N>l-\varepsilon)\to(\text{$l-\varepsilon$ is an upper bound of $\{a_n\}$}) $$ and so by considering the contrapositive of this claim, we see that $$ (\text{$l-\varepsilon$ is not an upper bound of $\{a_n\}$})\to(\forall\varepsilon > 0)(\exists N>0)(a_N>l-\varepsilon) \, . $$ Since $l=\sup\{a_n\}$, we know that the premise of the above statement is true, and so the conclusion follows.
In this example, does it really matter that the proof by contrapositive above is phrased as a proof by contradiction? And if not, why are the objections to proof by contradiction raised above not relevant here? When is it important to care about whether a proof is by contrapositive, or proof by contradiction?