>...there is a more general theorem that essentially says that you can't know in general if a program enjoys any non-trivial property....
That would be Rice's theorem. http://en.wikipedia.org/wiki/Rice%27s_theorem
That would be Rice's theorem. http://en.wikipedia.org/wiki/Rice%27s_theorem
Also, while the halting problem doesn't necessarily say anything about bugs, there is a more general theorem that essentially says that you can't know in general if a program enjoys any non-trivial property (e.g. it prints a "1" at some point, it accesses the network, or it halts). I can't recall the name of the theorem, but the intuitive proof is similar to the halting problem's. This theorem does seem to hint that programs can't be proven to be bug-free in general.