| ▲ | ernsheong 4 hours ago | ||||||||||||||||||||||
Alan Turing already proved with the Halting Problem that reasoning about program correctness is not possible. But we still try. Wikipedia: [1] 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. | |||||||||||||||||||||||
| ▲ | muraiki 4 hours ago | parent | next [-] | ||||||||||||||||||||||
When you write a recursive function, Lean’s kernel requires a termination proof, unless the function is a partial or marked as unsafe. In those cases, they can’t be used in proofs. https://lean-lang.org/doc/reference/latest/Definitions/Recur... | |||||||||||||||||||||||
| ▲ | lmm 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
And Alonzo Church proved in 1940 that you can avoid this problem by using a typed language in which all programs halt. But sadly some programmers still resist this. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | mkl 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
We care only about a very small and narrow subset of possible programs, not any arbitrary one. It's possible to solve this kind of problem in large enough classes of program to be useful. | |||||||||||||||||||||||
| ▲ | ashton314 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
> reasoning about program correctness is not possible Not possible for all problems. We cannot decide correctness (ie adherence to a specification) for all programs, but we can definitely recognize a good chunk of cases (both positive and negative) that are useful. The Halting Problem itself is recognizable. The surprising result of Turing’s work was that we can’t decide it. | |||||||||||||||||||||||
| ▲ | DonaldPShimoda 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
> Alan Turing already proved with the Halting Problem that reasoning about program correctness is not possible. This is so reductive a framing as to be essentially useless [0]. I think maybe you want to learn more about program correctness, formal verification, and programming language semantics before you make such statements in the future. [0] See, e.g., type-checking. | |||||||||||||||||||||||
| ▲ | raincole 4 hours ago | parent | prev [-] | ||||||||||||||||||||||
> a given arbitrary program and input Keyword emphasis mine. | |||||||||||||||||||||||
| |||||||||||||||||||||||