I am tackling the halting problem right now and its remarkable theorem. My book states $\text{HALT}(x,y)$ is true if $\psi^{(1)}_{\mathcal P}$ is defined and conversely $\text{HALT}(x,y)$ is false if $\psi^{(1)}_{\mathcal P}$ is undefined.
The purpose of the theorem, of course, is showing that $\text{HALT}(x,y)$ is a not computable predicate. I will report the extract of the proof given:
Suppose $\text{HALT}(x,y)$ were computable. Then we could construct the program $\mathcal P$:
$$[A]\;\;\;\;\;\text{IF HALT}(X,X)\text{ GOTO } A$$
It is quite clear that $\mathcal P$ has been constructed so that
\begin{equation} \psi^{(1)}_{\mathcal P}= \begin{cases} \text{undefined} \;\;\; \text{if HALT}(x,x) \\ 0 \;\;\;\;\;\;\;\;\;\;\;\;\;\;\text{if ~HALT}(x,x) \end{cases} \end{equation}
I don't understand how $\psi^{(1)}_{\mathcal P}$ is undefined if $\text{HALT}(x,x)$ is true, shouldn't $Y$ be equal to $0$ by default and moreover how could a non-terminating program be defined can have $0$ as output value. What am I missing here?
Edit: $\psi^{(1)}_{\mathcal P}(x)$ is the value of the output variable $Y$ at the terminal snapshot.