Let $\mathbb{H}$ be the set of all Turing machines that halt on all inputs. Consider the following Turing machine $T$. On input $\langle S \rangle$ where $S \in \mathbb{H}$ (note that the angle brackets indicate a string encoding of $S$), $T$ does the following:
- Simulate $S$ on $\langle S \rangle$.
- If $S$ accepts, reject. If $S$ rejects, accept.
Because $S \in \mathbb{H}$, $S$ will always halt. Thus, $T$ will always halt, which implies $T \in \mathbb{H}$. Note that $T$ decides the language
$$\{\langle S \rangle \mid \text{$S \in \mathbb{H}$ and $S$ rejects $\langle S \rangle$}\}.$$
But $T$ accepts $\langle T \rangle$ if and only if $T$ rejects $\langle T \rangle$—this is a contradiction. Where is the error in this logic?