In simple type theory, how can I prove that there is no closed term of type?
$$((P \Rightarrow Q) \Rightarrow Q) \Rightarrow P$$
In simple type theory, how can I prove that there is no closed term of type?
$$((P \Rightarrow Q) \Rightarrow Q) \Rightarrow P$$
I will use the fact that a formula is an intuitionistic tautology if and only if it is true in all Heyting algebras.
Introduction:
One convinient source of Heyting algebras is topology, namely, the lattice of open sets (with regard to inclusion) of any topological space is a Heyting algebra. In this example I will take the Heyting algebra of open sets of $\mathbb{R}$. Let $P$ and $Q$ be some open sets, then, we have the following relations
\begin{align} \DeclareMathOperator{inte}{int} P \land Q \quad&\text{ is }\quad P \cap Q \\ P \lor Q \quad&\text{ is }\quad P \cup Q \\ P \to Q \quad&\text{ is }\quad \inte(P^c \cup Q) \\ \bot \quad&\text{ is }\quad \varnothing \\ \top \quad&\text{ is }\quad \mathbb{R} \\ \neg P \quad&\text{ is }\quad P \to \bot = \inte(P^c) \end{align} where $\inte(P)$ is the interior of $P$ (i.e. the largest open set contained in $P$).
Just to demonstrate, we can show that that there is no double-negation elimination substituting $P = (0,1)\cup(1,2)$ and proving $\neg\neg P \to P$ is not $\top$, that is, \begin{align} \neg\neg \big((0,1)\cup(1,2)\big) &= \neg \inte\big((-\infty,0] \cup {1} \cup [2,\infty)\big) \\ &= \neg \big((-\infty,0) \cup (2,\infty)\big) \\ &= (0,2) \\ (0,2) \to \big((0,1)\cup(1,2)\big) &= \inte\big((0,2)^c \cup (0,1)\cup(1,2) \big) \\ &= \inte\big((-\infty,1) \cup (1,\infty)\big) \\ &= (-\infty,1) \cup (1,\infty) &\neq \top ,\end{align} nor law of excluded middle in a similar fashion with $P = (0,\infty)$ $$ (0,\infty) \cup \inte\big((0,\infty)^c\big) = \mathbb{R} \setminus \{0\} \neq \top .$$
Proof:
Now, by showing that some type is inhabited, we prove that the corresponding formula is a tautology. To show that some type is not inhabited, it is enough to show that the formula is not a tautology, that is, there is some valuation such that the formula does not evaluate to $\top$. We start with
$$((P \to Q) \to Q) \to P$$ for \begin{align} P &= \bot,\\ Q &= \top. \end{align}
That is,
\begin{align} P &\to Q &= \bot \to \top = \inte(\varnothing^c \cup \mathbb{R}) &= \top, \\ (P &\to Q) \to Q &= \top \to \top = \inte(\mathbb{R}^c \cup \mathbb{R}) &= \top, \\ \big((P &\to Q) \to Q\big) \to P &= \top \to \bot = \inte(\mathbb{R}^c \cup \bot) &= \bot \neq \top. \end{align}
Hence, it is not a intuitionistic tautology and by the Curry-Howard isomorphism, the corresponding type is not inhabited.
Afterword:
In fact, $\big((P\to Q)\to Q) \to P$ is not a tautology even in classical logic, where it is equivalent to $Q \to P$ and false for $P = \bot$ and $Q = \top$ (it is not a coincidence that I have used this valuation). Moreover, if a formula is not a tautology in classical logic, it cannot be one in in intuitionistic logic. So, we could prove this particular type to be uninhabited just by checking it in classical way, without introducing Heyting algebras. Why then making things complicated? Because I wanted to show how you could do it in a general way. There are other terms, like $\big((P \to Q)\to P) \to P$ which are tautologies in classical logic, but not in intuitionistic logic, and for which such simple approach would not work, while Heyting algebras would.
I hope this helps $\ddot\smile$