@neauoire no. the key bit he gets wrong is "a given Turing machine". what the Halting Problem says is that it's impossible to construct a universal function that says whether any arbitrary program will halt, and to prove this, postulates that such a function - halts(x) - has been found, and asks what will happen when we call

   p(function f) {
if halts(f) {
while(1);
} else {
return 0;
}
halts(p);