Halting Problem

120 views
Skip to first unread message

Tambet Väli

unread,
Dec 10, 2020, 12:29:46 PM12/10/20
to golang-nuts

Isn't this kind of a solution to a Halting Problem, if code is able to detect another, which has the same kind of halting problem?

For example:

func Halting(a, iterate bool) {
  if iterate {
    atrue, afalse bool
    atrue = Halting(true, false)
    afalse = Halting(false, false)
  }
  For a {
      i = i + 1
      if i > 100 {
        return false
      }
    }
    return true
}

Halting(a, iterate)

Isn't the solution, whether this fits another program with halting problem - in this simple case the solution is simply a != a.

Axel Wagner

unread,
Dec 10, 2020, 1:21:39 PM12/10/20
to Tambet Väli, golang-nuts
I don't really understand what you are trying to say. The halting problem (there is one, it's not a property of programs) is to write a program that can detect if an arbitrary other program halts for a given input. If you can only determine if a certain class of programs (and/or only on certain inputs) halts, you haven't solved the halting problem.

Obviously it's possible to determine that *some* programs terminate. For example, it's pretty trivial to write a program that can prove that `func main() {}` halts.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/a1b369ac-11bd-4308-9b52-3bc708cb8fffn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages