# Does validity of contrapostive proofs require the Law of Excluded Middle?

I remember that during my first proofs class the hardest thing I had accepting were the logic we had to learn, and it seems I still have questions about.

So I was thinking about why when the contrapositive is proved true then it implies that the original statement was true. The way I've been thinking about it is by considering a statement about an element of some set $A$. Letting $Q(x)$ represent $x\in A$ such that this statement holds true for, so the way I've translated $$Q\rightarrow P\Longleftrightarrow \sim P\rightarrow \sim Q$$ to $$Q(x)\subseteq P(x)\Longleftrightarrow P(x)^{c}\subseteq Q(x)^{c}$$ This makes sense initially to me since it does seem that elements that follow $\sim P$ would be element that don't belong to $P(x)$ (i.e. they belong to $P^{c}(x)$) Thus this would make sense to me because $P(x)\cup P(x)^{c}=A$ since it seems that either P or $\sim P$ must hold for an element.

I guess the main question if this last statement is possible would rely on: is the law of excluded middle always hold? Could you perhaps have a nonsense statement, so its negation is also nonsense, and no possible element is from either. Or perhaps the way I'm thinking about contrapositive statements is wrong?

In classical logic every statement has a truth value, even if it is nonsense like "if the Moon is made of cheese then the sky is made of rubber" (this one is true because any implication with a false premise is defined to be true). The law of excluded middle is a law of classical logic, so it is always true as an axiom, in particular for any set either $x\in A$ or $x\notin A$ is always true.
There are alternative systems of logic where this law is not adopted, intuitionistic logic for example, but there the interpretation is not that $x\in A$ and $x\notin A$ are both nonsense, but rather that there is no "constructive" way to establish either. See more in Can one prove by contraposition in intuitionistic logic?