>>14398671The problem is that to detect a loop, you would need to be able to track every state of a system. A Turing machine has infinite states, so this is not possible.
It IS possible on systems with a limited amount of states. For example, an 8 bit machine would have states. You could run a sequence of instructions and detect if it reaches a state it has already reached before. If so, then it's an infinite loop.
It's much more difficult on actual modern computers, which have states with their memory alone (so not counting registers, hard drives, etc).
You can have rules for certain, well-defined loops. But the halting problem is undecidable for the superset of loops, not all loops within that set.