Question: Consider the following program. Does $f(1)=\infty$?
\begin{align*} f(i):=&|\text{while } \frac{1}{i}>0\\ &||i\leftarrow i+1\\ &|i \end{align*}
I would say that $f(1)=\infty$ is a true statement. The program does not terminate, but one could consider the sequence of points $\{x_i\}_{i\in \mathbb{N}}$ given by $x_i:=\frac{1}{i}$, so that $\{x_i\}_{i\in \mathbb{N}}$ converges to the limit $0$ which makes $\underbrace{\frac{1}{i}}_{=0}>0$ false which means $f(1)=\infty$. However, I could be wrong.
The final result of the function would depend on the method of division you'd end up using, at least if this function is executed by a computer.
One thing we can be sure of, however, is that the result of f(1) will under no circumstance be 0.
After all, the input of the function is
1and the loops keeps increasing the value ofi.For example, if the function is executed using integer division,
(1 / 2) > 0would be false, and the function would end up yielding a result.However, the result would be
2, not0.Therefore, the function either runs out of resources, or returns something larger than 0 - but never 0.
Although I'm answering this question as a programmer, rather than as mathematician, the logic remains true whether it be mathematical or programmatic: Even if we assume the loop can run to infinity, and we assume 1 divided by infinity as greater than 0, the function would produce infinity, not 0.
Pure logic dictates that
f(1) != 0, whichever notation is preferred :)Since I'm writing this as a programmer on the internet anyway, I might as well provide proof along with this answer.
I wrote the following snippet:
(I would have used
if ($n < INT_MAX)but that results in a 3+ seconds runtime)Long story short,
assert(f(1) === INF);passes, andIs indeed
float(INF).Run this code