Turing Meets Paradoxes (History of Undecidability Part 3) - Computerphile

The Limits of Self-Reference in Computing: A Philosophical Perspective

As a computer scientist, one would think that the notion of self-reference is something to be avoided, at least when it comes to programming. However, as we delve deeper into the world of computability and undecidability, we find that self-referential systems can pose significant challenges. The barber problem, for instance, is a classic example of self-referential paradoxes. It goes like this: "Is there a barber in town who shaves all the men in town who do not shave themselves?" If such a barber exists, then he must shave himself, which means he does not shave himself, rendering the statement false. On the other hand, if no such barber exists, then he must shave all men who do not shave themselves, including himself, which again leads to a contradiction.

This paradox highlights the problem of self-reference in systems that rely on recursive functions or self-modifying code. When we try to reason about these systems, we find ourselves caught in a web of contradictions and paradoxes. The halting problem, for example, is a fundamental result in computability theory that states that there cannot exist an algorithm that can determine, given an arbitrary program and input, whether the program will run forever or eventually halt. This problem is self-referential because we need to consider the behavior of the algorithm itself, which raises questions about its own halting properties.

The implications of this problem are far-reaching, and they have significant consequences for our understanding of computability and undecidability. For instance, if we try to write a program that analyzes other programs, we may find ourselves caught in a paradoxical loop where the program's ability to analyze itself is dependent on its own halting properties. This can lead to a situation where the program becomes self-referential, making it impossible for us to reason about its behavior.

To avoid these pitfalls, some computer scientists have turned to the use of abstract machines and formal languages that can capture the essence of computability without resorting to self-reference. For example, the notion of PA trees has been used to study the decidability of certain grammars and formal systems. However, even with these tools, we still encounter difficulties when dealing with systems that are too complex or powerful.

The problem is not just theoretical; it has practical implications for computer science as a whole. When we design programs or algorithms that involve self-reference or recursive functions, we need to be aware of the potential risks and consequences. If we are not careful, our creations can become self-referential, leading to paradoxes and undecidability. This is why it is essential for computer scientists to develop a deep understanding of these concepts and to learn from examples like the barber problem.

In fact, the study of self-reference and undecidability has led some researchers to develop new tools and techniques for analyzing and managing complexity. For instance, the concept of compiler compilers has emerged as a way to avoid the pitfalls of self-referential systems. These programs are designed to generate other programs from formal specifications, but they are also equipped with mechanisms that prevent them from becoming self-referential.

Despite these advances, the problem of self-reference remains a significant challenge in computer science. As we continue to push the boundaries of what is possible with computers and programming languages, we must also be aware of the potential risks and consequences. By studying examples like the barber problem and learning from our mistakes, we can develop more robust and reliable systems that avoid the pitfalls of self-reference.

In conclusion, the limits of self-reference in computing are a profound challenge to our understanding of computability and undecidability. While we have made significant progress in developing tools and techniques for managing complexity, we still encounter difficulties when dealing with systems that rely on recursive functions or self-modifying code. As computer scientists, it is essential that we continue to study these concepts and develop new methods for analyzing and managing complexity. Only by doing so can we create more robust and reliable systems that avoid the pitfalls of self-reference.

PAA Trees: A Tool for Studying Decidability

In recent years, researchers have turned to PA trees as a tool for studying decidability in formal languages and grammars. A PA tree is a data structure that represents a set of productions or rules for generating strings from a formal language. The key insight behind PA trees is that they can be used to study the decidability of certain grammars and formal systems, even when those systems are self-referential.

One of the main advantages of PA trees is their ability to capture the essence of computability without resorting to self-reference. By studying the structure and behavior of PA trees, researchers can gain insights into the decidability of certain formal languages and grammars. For example, PA trees have been used to study the decidability of context-free grammars and regular expressions.

However, even with PA trees, we still encounter difficulties when dealing with systems that are too complex or powerful. In particular, when we try to analyze the behavior of PA trees themselves, we find ourselves caught in a web of contradictions and paradoxes. This highlights the need for new methods and techniques for analyzing complexity in formal languages and grammars.

Compiler Compilers: A Tool for Managing Complexity

In response to the challenges posed by self-reference and undecidability, researchers have developed the concept of compiler compilers as a way to manage complexity in formal languages and grammars. These programs are designed to generate other programs from formal specifications, but they are also equipped with mechanisms that prevent them from becoming self-referential.

One of the key benefits of compiler compilers is their ability to avoid the pitfalls of self-reference. By using abstract machines and formal languages that can capture the essence of computability without resorting to self-reference, compiler compilers can ensure that programs generated by these systems are reliable and robust.

However, even with compiler compilers, we still encounter difficulties when dealing with complex or powerful systems. In particular, when we try to analyze the behavior of these programs, we find ourselves caught in a web of contradictions and paradoxes. This highlights the need for new methods and techniques for analyzing complexity in formal languages and grammars.

In conclusion, the study of self-reference and undecidability has led to significant advances in our understanding of computability and decidability. While PA trees and compiler compilers have emerged as powerful tools for managing complexity, we still encounter difficulties when dealing with systems that are too complex or powerful. As computer scientists, it is essential that we continue to study these concepts and develop new methods for analyzing and managing complexity. Only by doing so can we create more robust and reliable systems that avoid the pitfalls of self-reference.

"WEBVTTKind: captionsLanguage: enin the light of knowing how paradoxes can occur in logical systems how undecidability can occur in logical systems we found out that the parallel lines hypothesis for uclid was undecidable from the propositions that he gave we've equally discovered that with Bertrand Russell's barber paradox it's undecidable who should shave the barber it's paradoxical so we now want to drive all of that forward and revisit those paradoxes and undecidability in the context of what if you like the pioneer of computer science Allan Mattis and churing what did he do Ching started his research activity in the mid 1930s and his research field was mathematical logic his approach to doing mathematical logic wasn't just as a dry set of propositions of the sort that frager and Hilbert and Russell were doing although it was well aware of their work of course and he was very well aware of girdle's work basically showing that any system of propositions was necessarily incomplete but no churing had this wonderful idea of inventing almost like a a mechanical machine except it was a pencil and paper exercise now some of you who have seen the Buy Beaver videos will see touring machines in action there's also been a video by my colleague Mark Joo showing you in a very high level kind of way but very effectively why touring's halting problem really is undecidable this pencil and paper computer using nothing but a a paper tape for data a set of program instructions and a read write head that moves that was sufficient he said quite rightly to compute anything that could be computed and it's no good saying well will quantum computers go beyond those not at the moment Quant quum computers at the moment still in the end end up doing touring machines faster and in parallel but there's nothing radically new about them as yet who knows what may happen in the long run Ching's famous 1936 paper then was about David Hilbert's and shidong problem touring of course knowing of girdle's work and having played around with his touring machines basically said there's going to be things here that are undecidable and it very very soon occurred to him that an obvious one to do was the halting problem is it decidable whether that program with that data will Halt and the answer is in certain special cases yes you can but is there a general formula that says yes or no no at the nuts and bolts level The Busy Beaver problem helps you to understand how this comes about but at the more philosophical level if you've seen Mark Jagger's video about how that wonderful machine works if you look at the machine you'll find that inside it there's a thing called H what it does is it says give me a program P give me its data its input which we'll call I will that P with that I hold is it generally decidable this is the magic H machine now what Mark then did which may have some of you but I want to refer this back now to what we know about things like Barber paradoxes and so on if you recall the barber paradox it says the barber shaves all those in the village who do not shave themselves in order to show that something leads to a paradox and there is therefore is undecidable it's got to have that element of nness in it as Bertrand Russell might easily have said where does the not come in in uh Mark and Sha's model the H taking a P taking an I look at the video and you'll see they do two Bolton extras at the rear of that machine and all that those bolt-on extras are doing is reversing the logic if the inner H has decided that it does Halt and delivers a yes then the outer machine turns the yes into spinning round in a loop and not halting conversely if the inner machine H says no it doesn't stop I can see it's looping then the outer machine says oh I'm going to reverse the logic I'm to turn a no into a yes so the outer machine H+ is basically putting the element of nness and denying at the back of the H machine and once you've done that you can model the barber paradox with the H+ machine just as you say to ask of the barber make him reflect on himself should I shave myself or should I not shave myself equally with the H+ machine you say okay I'm going to feed myself to myself I'm going to have the H+ machine with H+ as the program and H+ as its data input and I've now got to say do I Hal so I'm going to restate the barber paradox as follows H+ delivers a halt for all those touring machines that do not halt themselves so another words if the inner H machine comes back and says yes it halt you say no we're not having it halt we make it spin but for the ones which says no it hasn't stopped it's spinning it's going to come back and say yes it does hold so in other words the outer Adon is forcing a halt on you and saying yes I can make the whole thing halt so if H+ delivers a halt for all those churing machines that do not hel halt themselves then what chering machine is it that causes H+ to Hal and as you look at it you realize oh it's exactly the same as the barber so f fine I think the only problem with this if you like philosophical way of doing things and I felt this very strongly when I finally sort of got to grips with this stuff because I had to teach it to people is what sort of system is it which requires you to drive yourself into a paradox to get a proof I mean how does this all affect me as an ordinary computer scientist writing ordinary programs if you're just doing calculations involving I know statistics Website Maintenance weather prediction and so on fine you're not going to be bothered by this but the key word I think is self-referential you get into difficulties with anything that's self referential the barber problem is self-referential because it's saying the barber is a man as well as a barber look inside the system what happens Bertrand Russell's Paradox is self-referential it's looking inside the set of all sets juring halting problem is self-referential it's getting a machine to examine other machines so I felt like swearing a sort of Scouts oath and saying I promise I will never write a a program that analyzes other programs thereby I can avoid trouble but actually if you're a computer scientist you can't totally avoid trouble this stuff does come to bite you because I suddenly started to think ah I'm not going to write a program that analyzes other programs but I'm very interested in programs that can generate other programs how can I prove that if I generator program and this conventionally happens with tools called P of generators sometimes called compiler compilers very similar you give a program specification to a program and it generates another program how can you show that that program you generate will not run into paradoxes and undecidability actually if you're not careful you'll get some nasty results come out of those and some big shocks if you're not aware of the fact that certain things are undecidable I will eventually get round to showing you an example of this it's basically down to just doing Simple PA trees I've done some of these before for things like a plus b star C sometimes you get into things where you can have more than one possible PA tree it's ambiguous and so you think to yourself oh ah ooh I'm writing a paa I better just do a quick check on what's been asked of me just I'll do a quick check to make sure it's not going to lead to an ambiguous set of trees no good you could be trying to compute the uncomputable uh it may be very well hidden but you may end up in a grammar that is so complex that drive you to endless layers of recursive investigation to see if this really is uh decidable or not it could get every bit as bad as aaman in a worst case you might say well you know let's keep it finite I promise I'll never give you anything to PA that's longer than a thousand characters yeah yeah yeah but that doesn't satisfy a mathematician it doesn't satisfy a computer scientist you want General robust Solutions so what actually happens in the case of paes is that the so-called paa generators and there's one I hope to do with you briefly in a future movie one called Yak yet another the compiler compiler it has got the most ingenious hidden way of stopping you blundering into undecidability you give it something that's beyond its powers and it basically it's incapable of knowing it's beyond its powers it just says under these circumstances I am going to do this be warned the PS that I deliver you in these nasty circumstances may not be quite the one you expect so there we are that is an example of undecided ability in action and it's nice to know for the first time that I've been able to give you a concrete example of something where you do need to beware now many of you out there of course would say yeah fine okay so if you're a computer scientist and if you're writing things that generate other programs yes you need to be aware need I be as aware as this if all I'm doing is maintaining a website the answer is maybe not if you have to get less fit before you get more fit Evolution doesn't plan right so it can't see that there's this huge hill in this is Dreadful the barber shaves only those who do not shave themselvesin the light of knowing how paradoxes can occur in logical systems how undecidability can occur in logical systems we found out that the parallel lines hypothesis for uclid was undecidable from the propositions that he gave we've equally discovered that with Bertrand Russell's barber paradox it's undecidable who should shave the barber it's paradoxical so we now want to drive all of that forward and revisit those paradoxes and undecidability in the context of what if you like the pioneer of computer science Allan Mattis and churing what did he do Ching started his research activity in the mid 1930s and his research field was mathematical logic his approach to doing mathematical logic wasn't just as a dry set of propositions of the sort that frager and Hilbert and Russell were doing although it was well aware of their work of course and he was very well aware of girdle's work basically showing that any system of propositions was necessarily incomplete but no churing had this wonderful idea of inventing almost like a a mechanical machine except it was a pencil and paper exercise now some of you who have seen the Buy Beaver videos will see touring machines in action there's also been a video by my colleague Mark Joo showing you in a very high level kind of way but very effectively why touring's halting problem really is undecidable this pencil and paper computer using nothing but a a paper tape for data a set of program instructions and a read write head that moves that was sufficient he said quite rightly to compute anything that could be computed and it's no good saying well will quantum computers go beyond those not at the moment Quant quum computers at the moment still in the end end up doing touring machines faster and in parallel but there's nothing radically new about them as yet who knows what may happen in the long run Ching's famous 1936 paper then was about David Hilbert's and shidong problem touring of course knowing of girdle's work and having played around with his touring machines basically said there's going to be things here that are undecidable and it very very soon occurred to him that an obvious one to do was the halting problem is it decidable whether that program with that data will Halt and the answer is in certain special cases yes you can but is there a general formula that says yes or no no at the nuts and bolts level The Busy Beaver problem helps you to understand how this comes about but at the more philosophical level if you've seen Mark Jagger's video about how that wonderful machine works if you look at the machine you'll find that inside it there's a thing called H what it does is it says give me a program P give me its data its input which we'll call I will that P with that I hold is it generally decidable this is the magic H machine now what Mark then did which may have some of you but I want to refer this back now to what we know about things like Barber paradoxes and so on if you recall the barber paradox it says the barber shaves all those in the village who do not shave themselves in order to show that something leads to a paradox and there is therefore is undecidable it's got to have that element of nness in it as Bertrand Russell might easily have said where does the not come in in uh Mark and Sha's model the H taking a P taking an I look at the video and you'll see they do two Bolton extras at the rear of that machine and all that those bolt-on extras are doing is reversing the logic if the inner H has decided that it does Halt and delivers a yes then the outer machine turns the yes into spinning round in a loop and not halting conversely if the inner machine H says no it doesn't stop I can see it's looping then the outer machine says oh I'm going to reverse the logic I'm to turn a no into a yes so the outer machine H+ is basically putting the element of nness and denying at the back of the H machine and once you've done that you can model the barber paradox with the H+ machine just as you say to ask of the barber make him reflect on himself should I shave myself or should I not shave myself equally with the H+ machine you say okay I'm going to feed myself to myself I'm going to have the H+ machine with H+ as the program and H+ as its data input and I've now got to say do I Hal so I'm going to restate the barber paradox as follows H+ delivers a halt for all those touring machines that do not halt themselves so another words if the inner H machine comes back and says yes it halt you say no we're not having it halt we make it spin but for the ones which says no it hasn't stopped it's spinning it's going to come back and say yes it does hold so in other words the outer Adon is forcing a halt on you and saying yes I can make the whole thing halt so if H+ delivers a halt for all those churing machines that do not hel halt themselves then what chering machine is it that causes H+ to Hal and as you look at it you realize oh it's exactly the same as the barber so f fine I think the only problem with this if you like philosophical way of doing things and I felt this very strongly when I finally sort of got to grips with this stuff because I had to teach it to people is what sort of system is it which requires you to drive yourself into a paradox to get a proof I mean how does this all affect me as an ordinary computer scientist writing ordinary programs if you're just doing calculations involving I know statistics Website Maintenance weather prediction and so on fine you're not going to be bothered by this but the key word I think is self-referential you get into difficulties with anything that's self referential the barber problem is self-referential because it's saying the barber is a man as well as a barber look inside the system what happens Bertrand Russell's Paradox is self-referential it's looking inside the set of all sets juring halting problem is self-referential it's getting a machine to examine other machines so I felt like swearing a sort of Scouts oath and saying I promise I will never write a a program that analyzes other programs thereby I can avoid trouble but actually if you're a computer scientist you can't totally avoid trouble this stuff does come to bite you because I suddenly started to think ah I'm not going to write a program that analyzes other programs but I'm very interested in programs that can generate other programs how can I prove that if I generator program and this conventionally happens with tools called P of generators sometimes called compiler compilers very similar you give a program specification to a program and it generates another program how can you show that that program you generate will not run into paradoxes and undecidability actually if you're not careful you'll get some nasty results come out of those and some big shocks if you're not aware of the fact that certain things are undecidable I will eventually get round to showing you an example of this it's basically down to just doing Simple PA trees I've done some of these before for things like a plus b star C sometimes you get into things where you can have more than one possible PA tree it's ambiguous and so you think to yourself oh ah ooh I'm writing a paa I better just do a quick check on what's been asked of me just I'll do a quick check to make sure it's not going to lead to an ambiguous set of trees no good you could be trying to compute the uncomputable uh it may be very well hidden but you may end up in a grammar that is so complex that drive you to endless layers of recursive investigation to see if this really is uh decidable or not it could get every bit as bad as aaman in a worst case you might say well you know let's keep it finite I promise I'll never give you anything to PA that's longer than a thousand characters yeah yeah yeah but that doesn't satisfy a mathematician it doesn't satisfy a computer scientist you want General robust Solutions so what actually happens in the case of paes is that the so-called paa generators and there's one I hope to do with you briefly in a future movie one called Yak yet another the compiler compiler it has got the most ingenious hidden way of stopping you blundering into undecidability you give it something that's beyond its powers and it basically it's incapable of knowing it's beyond its powers it just says under these circumstances I am going to do this be warned the PS that I deliver you in these nasty circumstances may not be quite the one you expect so there we are that is an example of undecided ability in action and it's nice to know for the first time that I've been able to give you a concrete example of something where you do need to beware now many of you out there of course would say yeah fine okay so if you're a computer scientist and if you're writing things that generate other programs yes you need to be aware need I be as aware as this if all I'm doing is maintaining a website the answer is maybe not if you have to get less fit before you get more fit Evolution doesn't plan right so it can't see that there's this huge hill in this is Dreadful the barber shaves only those who do not shave themselves\n"