Turing and Decision Problem


Turing and Decision Problem

Corey
Welcome to the podcast! Today we're diving into a fascinating moment in logic that, surprisingly, led to the very foundation of modern computers. It all starts with a problem called the 'decision problem'.

Anna
That sounds intriguing! So, what exactly is the decision problem? I'm picturing some kind of logical riddle that mathematicians were wrestling with at the turn of the 20th century.

Corey
You're spot on! In logic, we often start with premises – those are your initial assumptions or what you know to be true. Then, we try to reach a conclusion based on those premises. The decision problem asks: 'Is there an automatic test to tell us, definitively, if these premises logically lead to this conclusion?'

Anna
Ah, so it's about whether we can automate the process of determining logical validity. Like, can a machine tell us 'yes, this argument holds' or 'no, it doesn't' for any given set of premises and conclusions in a specific type of logic?

Corey
Exactly! They were particularly interested in 'first-order logic,' which is the kind you'd study in philosophy or math at university. Many brilliant minds tried to figure out if first-order logic was 'decidable' – meaning, could we create an algorithm for this automatic test?

Anna
And I'm guessing from your introduction that Alan Turing was a key player in this. Did he manage to find this magical algorithm, or did he discover something else entirely?

Corey
He discovered something else entirely, and it was a groundbreaking realization. Turing was one of the first to prove that first-order logic is actually *not* decidable. Meaning, no such universal automatic test exists.

Anna
That's a huge revelation! But proving a negative like that, especially about 'every possible program,' sounds incredibly difficult. How do you even begin to show that no program can ever solve something?

Corey
That's the conceptual leap! You can't just run through every single program, of course. Turing's brilliance was in coming up with an indirect proof. He introduced this idea of thinking about programs as 'black boxes' that take inputs and produce outputs.

Anna
Okay, black box programs. So, we feed it a problem, and it gives us an answer. Like, for the decision problem, we'd feed it premises and a conclusion, and it would spit out 'yes' or 'no'.

Corey
Precisely. Now, here's where it gets interesting. Turing introduced another problem, closely related, called the 'halting problem.' This problem asks: 'Given a program and a specific input, will that program eventually halt and give us an answer, or will it run forever in a loop?'

Anna
The halting problem. I can see why that's important. When your computer freezes or gets stuck in a loop, you want to know if it's ever going to finish, or if you should just restart it. A non-halting program is essentially useless.

Corey
Exactly. A halting program, even if it gives a wrong answer, is better than no answer at all. It turns out, our original logical decision problem is very similar to this halting problem. In fact, if you could solve the logical decision problem, you could also solve the halting problem.

Anna
So, if he could prove that the halting problem is unsolvable, then the decision problem must also be unsolvable. That's a clever move! But how do you prove that no machine can ever solve the halting problem?

Corey
This is the really ingenious part of his proof. He uses a proof by contradiction. He says, 'Let's *assume* for a moment that such a machine, let's call it 'h,' exists. This machine 'h' takes a program and its input, and tells us if it will halt or not.'

Anna
Okay, so we're starting with the assumption that a 'halting problem solver' machine, 'h', actually exists. That's a big 'if', but it sets up the contradiction, right?

Corey
Right. Now, if we have this magical machine 'h', Turing shows we can modify it slightly. We'll build a new, larger machine, let's call it 'h+'. Here's how 'h+' works: If 'h' says a program *will* halt, 'h+' is designed to loop forever. But if 'h' says a program *won't* halt, 'h+' is designed to halt immediately.

Anna
Whoa, that's a twist! So 'h+' does the opposite of whatever 'h' predicts. If 'h' says 'yes, it halts,' 'h+' makes sure it doesn't. If 'h' says 'no, it won't halt,' 'h+' makes sure it does.

Corey
Precisely. Now, for the final, mind-bending step. What happens if we feed the machine 'h+' into itself as both the program *and* the input? We're asking: 'Does 'h+' halt given the input 'h+'?'

Anna
Oh, I think I see where this is going... If 'h+' halts when given itself as input, then according to the rules of 'h+', it *should* loop forever, meaning it *doesn't* halt. That's a contradiction!

Corey
Exactly! And on the flip side, if 'h+' *doesn't* halt when given itself as input, then by the rules of 'h+', it *should* halt immediately. Again, a contradiction! In both scenarios, we run into a paradox.

Anna
So, because assuming a solution to the halting problem leads to an inescapable paradox, our initial assumption must be false. Therefore, no such machine 'h' can exist. The halting problem is fundamentally unsolvable.

Corey
That's the logical conclusion. And the amazing part is that Turing's proof doesn't depend on the specific type of machine or program. He showed that *no possible program*, abstract or physical, can solve the halting problem.

Anna
That's incredible! And since solving the decision problem would imply solving the halting problem, it means the decision problem for first-order logic is also unsolvable. It’s a profound limitation on what algorithms can achieve.

Corey
Absolutely. But here’s the really exciting part, and how it relates to modern computers. In order to even construct this proof, Turing had to precisely define what a 'program' or 'machine' actually *is*.

Anna
So, to prove something about all possible programs, he had to standardize what a program fundamentally entails. He had to create a theoretical model of computation itself.

Ask anything
We've read this whole study set, so questions about it get the best answers.