News for hackers. Stuff that matters.
Re:Am open to constructive criticism: My Halting Problem sol... by auroralimon on Wednesday March 20, 2024 @06:17PM (#39772670)
Consider: are all programs that don’t halt infinite loops?

Perhaps one which experiences exponential growth in some variable.

Re:Am open to constructive criticism: My Halting Problem sol... by auroralimon on Wednesday March 20, 2024 @07:09PM (#39773122)
So what about a chaotic function like: (assume x is 64bit float)

x = 0.035876; while true { x = 3.5699456 * x * (1 - x); if x == rand() break; } does it halt?

Re:Am open to constructive criticism: My Halting Problem sol... by pantantrant on Wednesday March 20, 2024 @07:40PM (#39773356)
After a finite amount of time, it will either report "Halt" or "Infinite Loop", but my program won't take forever, just a finite amount of time.
Re:Am open to constructive criticism: My Halting Problem sol... by auroralimon on Thursday March 21, 2024 @08:26PM (#39786131)
then you have added nothing to the problem. of course if you run the program and it halts, even if runs until T+heatdeathofuniverse^googleplex (which is a finite time) without an infinite loop, you have not solved the conundrum implied by Turing’s work. Turing proved no algorithm exists that always correctly decides whether, for a given arbitrary program and input, the program halts when run with that input. The essence of Turing's proof is that any such algorithm can be made to produce contradictory output and therefore cannot be correct. He proved it - QED
Re:Am open to constructive criticism: My Halting Problem sol... by pantantrant on Wednesday March 20, 2024 @06:23PM (#39772720)
A turing machine has unbound memory, so this isn't a problem.

Example:

ax is a 2 bit register initialized to 0.

100: add 1 ax

101: jmp 100

ax is 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3

0 is compared to 1, 1 is compared to 3, 3 is compared to 2, 2 is is compared to 2, wait, that's an infinite loop...

Re:Am open to constructive criticism: My Halting Problem sol... by djaouen on Wednesday March 20, 2024 @06:23PM (#39772717)
I think his point is, that there are (due to the limits of longs/BigInts) only a finite number of configurations before an integer overflow. I am not qualified to present an argument against, but I think there are some programs for which the computation time would be greater than the age of the universe. For example, “Print all possible configurations of this 4k monitor”.
Re:Am open to constructive criticism: My Halting Problem sol... by pantantrant on Wednesday March 20, 2024 @06:33PM (#39772811)
Yes, this infinite loop solver would take longer than the universe's age to print all possible configurations of this 4k monitor, but it would take a finite amount of time as opposed to infinite. (Provided that the integer n is big enough as a arbitrary precision fixed point unsigned integer)
Re:Am open to constructive criticism: My Halting Problem sol... by djaouen on Wednesday March 20, 2024 @06:37PM (#39772858)
I think (and I am no expert here, so correct me if I am wrong) that, when it comes to actually written programs, there is little difference between “actually infinite” and “practically infinite”. This is like saying the probability of any particular real number being given by a float is zero because floats are only countable infinite (practically) rather than uncountable infinite. I don’t know, maybe I am talking out of my ass, tho lol
Re:Am open to constructive criticism: My Halting Problem sol... by pantantrant on Wednesday March 20, 2024 @06:41PM (#39772893)
Well, my algorithm only says that it's an infinite loop if it actually is an infinite loop, not a "this loop has been running for 30 seconds" like the Linux Kernel has.