Tip:
Highlight text to annotate it
X
Going through it together, vladimir immediately returns 1,
so it halts in pretty much 1 step.
So yes, this does not loop forever.
To figure out the value of nabokov, we call nabokov,
which causes us to call nabokov, which causes us to call nabokov.
This is one of those infinite loops.
Not my most symmetric infinity symbol ever.
We never actually get a value out of this.
We call ourselves over and over again.
This procedure does not halt.
You might be thinking, "Oh, eventually we will run out of stack space,"
or more prosaic concerns like that, but remember here
I want you to think in the abstract.
We're assuming this mythical halts procedure.
How about pale? X is 0, while True, x is x + 1.
We actually looked at this before.
This loop does not halt, does not terminate.
How about fire?
We start out with x is 0 and y is 1000,
and as long as x is less than y, we add 2 to x and we add y to 1.
After a little bit, this will be 2 and 1001, then this will be 4 and 1002,
this will be 6 and 1003.
And although it doesn't look like it now, eventually x will catch up to y
because x is growing twice as fast.
For example, after 1000 steps, x will be 2000 and y will also be 2000,
at which point we'll break out of this loop.
So fire does in fact halt.
Pale Fire was a 1962 novel by Nabokov.
He's perhaps more famous for Lolita.
He was a Russian author who did a lot of writing in English.
All right. We didn't see anything bad. That all looked fine.
We could figure out just by staring at things whether they halted or not.
Why am I predicting doom and gloom? We didn't have any problems.