COMP20121 The Implementation and Power of Computer Languages Power - - PowerPoint PPT Presentation

comp20121 the implementation and power of computer
SMART_READER_LITE
LIVE PREVIEW

COMP20121 The Implementation and Power of Computer Languages Power - - PowerPoint PPT Presentation

COMP20121 The Implementation and Power of Computer Languages Power Part http://www.cs.man.ac.uk/ petera/2121/index.html . Peter Aczel room: CS2.52, tel: 56155 petera@cs.man.ac.uk email: School of Computer Science, University of


slide-1
SLIDE 1

COMP20121 The Implementation and Power of Computer Languages ‘Power’ Part

http://www.cs.man.ac.uk/∼petera/2121/index.html .

Peter Aczel room: CS2.52, tel: 56155 email:

petera@cs.man.ac.uk

School of Computer Science, University of Manchester

COMP20121 - Section 0 – p.1/307

slide-2
SLIDE 2

COMP20121, ‘power’ part: section 4 LECTURE TEN

Section 4: Computability ctd

COMP20121 - Section 4 – p.212/307

slide-3
SLIDE 3

The previous lecture

In the previous lecture we started looking at TMs as computational devices.

COMP20121 - Section 4 – p.213/307

slide-4
SLIDE 4

The previous lecture

In the previous lecture we started looking at TMs as computational devices. We considered

  • Variants of TMs,
  • The power of TMs,
  • Simulating a von Neumann machine.

COMP20121 - Section 4 – p.213/307

slide-5
SLIDE 5

Plan of this lecture

In this lecture we consider

  • Models of computation
  • The Church-Turing Thesis
  • The power of computers
  • The Halting Problem
  • Unrecognisable languages
  • Recognisable, but undecidable

languages

COMP20121 - Section 4 – p.214/307

slide-6
SLIDE 6

Models of computation

T here are many more models of computation than Turing machines and von Neumann machines.

COMP20121 - Section 4 – p.215/307

slide-7
SLIDE 7

Models of computation

T here are many more models of computation than Turing machines and von Neumann machines. See Exercises 30 and 31 for other examples.

COMP20121 - Section 4 – p.215/307

slide-8
SLIDE 8

Models of computation

T here are many more models of computation than Turing machines and von Neumann machines. See Exercises 30 and 31 for other examples. And, of course, there are many computer languages we might use in order to compute something, such as C and Java.

COMP20121 - Section 4 – p.215/307

slide-9
SLIDE 9

Models of computation

An obvious question then is whether some forms of computations are more powerful than others.

COMP20121 - Section 4 – p.216/307

slide-10
SLIDE 10

Models of computation

An obvious question then is whether some forms of computations are more powerful than others. The Church-Turing Thesis says that most

  • f these notions lead to the same result:

For example, TMs are precisely as powerful as C or Java programs.

COMP20121 - Section 4 – p.216/307

slide-11
SLIDE 11

The power of computers

Are there problems which no computer can solve?

COMP20121 - Section 4 – p.217/307

slide-12
SLIDE 12

The power of computers

Are there problems which no computer can solve? In C or Java a program may run forever (well, until it runs out of memory), and we have already seen that Turing machines may not halt.

COMP20121 - Section 4 – p.217/307

slide-13
SLIDE 13

The power of computers

It would be nice to have a compiler that would be able to detect this at compile-time, rather than us having to wait until run-time. Even at run-time, we might not be sure whether the program just took too long, or whether there is a non-terminating loop somewhere.

COMP20121 - Section 4 – p.218/307

slide-14
SLIDE 14

The power of computers

The question of deciding whether a given program (or TM) will terminate for a given input is known as the Halting Problem.

COMP20121 - Section 4 – p.218/307

slide-15
SLIDE 15

The Halting Problem

Assume we have written a program Halt which takes two files as its input.

COMP20121 - Section 4 – p.219/307

slide-16
SLIDE 16

The Halting Problem

Assume we have written a program Halt which takes two files as its input.

  • In file1, it expects the code for a

program.

COMP20121 - Section 4 – p.219/307

slide-17
SLIDE 17

The Halting Problem

Assume we have written a program Halt which takes two files as its input.

  • In file1, it expects the code for a

program.

  • In file2, it expects the input for the

program held in file1.

COMP20121 - Section 4 – p.219/307

slide-18
SLIDE 18

The Halting Problem

Hence a call of Halt has the form

Halt file1 file2.

COMP20121 - Section 4 – p.219/307

slide-19
SLIDE 19

The Halting Problem

Hence a call of Halt has the form

Halt file1 file2.

What is the behaviour of this program? We assume that when we run

Halt file1 file2

the program will always terminate. There are two possible outcomes.

COMP20121 - Section 4 – p.219/307

slide-20
SLIDE 20

The Halting Problem

  • The program prints ‘does terminate’,

which means that if we run the program in file1 on the input in

file2, that program will terminate.

COMP20121 - Section 4 – p.220/307

slide-21
SLIDE 21

The Halting Problem

  • The program prints ‘does terminate’,

which means that if we run the program in file1 on the input in

file2, that program will terminate.

  • The program prints ‘does not

terminate’, so that if we run the program in file1 on the input in

file2, that program will not

terminate.

COMP20121 - Section 4 – p.220/307

slide-22
SLIDE 22

A new program, DHalt

We now change the program Halt and thus create a new program which we call

  • DHalt. We do this by taking the code for

Halt and making the following two kinds

  • f modifications:

COMP20121 - Section 4 – p.221/307

slide-23
SLIDE 23

A new program, DHalt

  • Whenever we find a print statement of

‘does terminate’ we replace it by a non-terminating loop

COMP20121 - Section 4 – p.221/307

slide-24
SLIDE 24

A new program, DHalt

  • Whenever we find a print statement of

‘does terminate’ we replace it by a non-terminating loop, for example

x=0;while (x>=0) do x=x+1;

COMP20121 - Section 4 – p.221/307

slide-25
SLIDE 25

A new program, DHalt

  • Whenever we find a print statement of

‘does terminate’ we replace it by a non-terminating loop .

  • Whenever we find a print statement of

‘does not terminate’ we remove the ‘not’, so that instead ‘does terminate’ will be printed.

COMP20121 - Section 4 – p.221/307

slide-26
SLIDE 26

A new program, DHalt

Note that these are purely syntactic opera- tions which merely involve going through the code looking for print instructions. Also note that the only way for DHalt not to termi- nate is by running into one of the loops we have put into the code of Halt to create it.

COMP20121 - Section 4 – p.222/307

slide-27
SLIDE 27

A new program, DHalt

We make one more change: We assume that DHalt only takes one input file

file, which it uses in the place of both, file1 and file2. Hence a call of DHalt looks like this: DHalt file.

COMP20121 - Section 4 – p.223/307

slide-28
SLIDE 28

The behaviour of DHalt

So how can the new program DHalt behave? Again there are two cases.

COMP20121 - Section 4 – p.224/307

slide-29
SLIDE 29

The behaviour of DHalt

So how can the new program DHalt behave? Again there are two cases.

  • Either the program runs forever. (In that

case, the program in the input file will terminate when run on the input in the input file.)

COMP20121 - Section 4 – p.224/307

slide-30
SLIDE 30

The behaviour of DHalt

  • Or the program will eventually print ‘does

terminate’. (In that case, the program in the input file will not terminate when run

  • n the input in the input file.)

COMP20121 - Section 4 – p.224/307

slide-31
SLIDE 31

The behaviour of DHalt

Now assume we have a file dhalt which contains a copy of the code for DHalt. We try to find out what happens if we run

DHalt dhalt. Again there are two

cases.

COMP20121 - Section 4 – p.224/307

slide-32
SLIDE 32

Self-application

  • The program terminates. Then

COMP20121 - Section 4 – p.225/307

slide-33
SLIDE 33

Self-application

  • The program terminates. Then

◮ DHalt prints ‘does terminate’.

COMP20121 - Section 4 – p.225/307

slide-34
SLIDE 34

Self-application

  • The program terminates. Then

◮ DHalt prints ‘does terminate’. ◮ Hence Halt dhalt dhalt

prints ‘does not terminate’.

COMP20121 - Section 4 – p.225/307

slide-35
SLIDE 35

Self-application

  • The program terminates. Then

◮ DHalt prints ‘does terminate’. ◮ Hence Halt dhalt dhalt

prints ‘does not terminate’.

◮ That means that the program in

dhalt (which is DHalt) will not

terminate when run on the input

dhalt.

COMP20121 - Section 4 – p.225/307

slide-36
SLIDE 36

Self-application

  • The program terminates. Then

◮ DHalt prints ‘does terminate’. ◮ Hence Halt dhalt dhalt

prints ‘does not terminate’.

◮ That means that the program in

dhalt (which is DHalt) will not

terminate when run on the input

dhalt.

This is a contradiction.

COMP20121 - Section 4 – p.225/307

slide-37
SLIDE 37

Self-application

  • The program does not terminate. Then

COMP20121 - Section 4 – p.226/307

slide-38
SLIDE 38

Self-application

  • The program does not terminate. Then

◮ Halt dhalt dhalt prints

‘does terminate’.

COMP20121 - Section 4 – p.226/307

slide-39
SLIDE 39

Self-application

  • The program does not terminate. Then

◮ Halt dhalt dhalt prints

‘does terminate’.

◮ That means that the program in

dhalt (which is DHalt) will

terminate when run on the input

dhalt.

COMP20121 - Section 4 – p.226/307

slide-40
SLIDE 40

Self-application

  • The program does not terminate. Then

◮ Halt dhalt dhalt prints

‘does terminate’.

◮ That means that the program in

dhalt (which is DHalt) will

terminate when run on the input

dhalt.

This is a contradiction.

COMP20121 - Section 4 – p.226/307

slide-41
SLIDE 41

Self-application

  • The program does not terminate. Then

◮ Halt dhalt dhalt prints

‘does terminate’.

◮ That means that the program in

dhalt (which is DHalt) will

terminate when run on the input

dhalt.

This is a contradiction. So a program like Halt cannot exist!

COMP20121 - Section 4 – p.226/307

slide-42
SLIDE 42

Encoding Turing machines

If we want to apply a similar trick to Turing machines we have to be able to use a TM as the input to another TM.

COMP20121 - Section 4 – p.227/307

slide-43
SLIDE 43

Encoding Turing machines

If we want to apply a similar trick to Turing machines we have to be able to use a TM as the input to another TM. In other words, we have to find a syntactic description for Turing machines. This is also known as an encoding. For this we have to decide what the underlying alphabet should be. This could, for example, be a binary encoding, that is

  • ver the alphabet {0, 1}.

COMP20121 - Section 4 – p.227/307

slide-44
SLIDE 44

Encoding Turing machines

We need to be able to encode the transition table, that is we need to be able to encode

COMP20121 - Section 4 – p.227/307

slide-45
SLIDE 45

Encoding Turing machines

We need to be able to encode the transition table, that is we need to be able to encode

  • States:

COMP20121 - Section 4 – p.227/307

slide-46
SLIDE 46

Encoding Turing machines

We need to be able to encode the transition table, that is we need to be able to encode

  • States: Whichever underlying

alphabet we choose, this shouldn’t be hard.

COMP20121 - Section 4 – p.227/307

slide-47
SLIDE 47

Encoding Turing machines

We need to be able to encode the transition table, that is we need to be able to encode

  • States: Whichever underlying

alphabet we choose, this shouldn’t be hard.

  • Tape symbols:

COMP20121 - Section 4 – p.227/307

slide-48
SLIDE 48

Encoding Turing machines

We need to be able to encode the transition table, that is we need to be able to encode

  • States: Whichever underlying

alphabet we choose, this shouldn’t be hard.

  • Tape symbols: We need to be able to

encode these in the underlying alphabet.

COMP20121 - Section 4 – p.227/307

slide-49
SLIDE 49

Encoding Turing machines

  • Movement symbols L, R and N: No

difficulty here.

COMP20121 - Section 4 – p.228/307

slide-50
SLIDE 50

Encoding Turing machines

  • Movement symbols L, R and N: No

difficulty here.

  • Starting state, possibly accepting

states.

COMP20121 - Section 4 – p.228/307

slide-51
SLIDE 51

Encoding Turing machines

  • Movement symbols L, R and N: No

difficulty here.

  • Starting state, possibly accepting

states. Every entry in the transition table can be described by a quintuple

no of state current symbol no of new state symbol to write move.

COMP20121 - Section 4 – p.228/307

slide-52
SLIDE 52

Encoding Turing machines

We may assume that there is an extra symbol, e.g. #, to separate entries from each other. We can list start and accepting states before or after the

  • quintuples. Then a TM can be encoded

as one long string over the chosen alphabet with # added.

COMP20121 - Section 4 – p.229/307

slide-53
SLIDE 53

Encoding Turing machines

We use M to refer to the encoding of a machine M. It is customary to choose an encoding within the tape alphabet for M.

COMP20121 - Section 4 – p.229/307

slide-54
SLIDE 54

How many strings over Σ?

The fact that we can encode Turing machines into strings over some alphabet tells us something about them: There can

  • nly be countably many of them.

COMP20121 - Section 4 – p.230/307

slide-55
SLIDE 55

How many strings over Σ?

The fact that we can encode Turing machines into strings over some alphabet tells us something about them: There can

  • nly be countably many of them.

Let Σ be any alphabet. Then there are infinitely many strings over this alphabet (even if it consists of just one letter!), but this is a countable infinity.

COMP20121 - Section 4 – p.230/307

slide-56
SLIDE 56

How many strings over Σ?

Countably infinite means that we can list these strings, which means that we can number them: There’s a first, a second, a third, and so on.

COMP20121 - Section 4 – p.231/307

slide-57
SLIDE 57

How many strings over Σ?

Countably infinite means that we can list these strings, which means that we can number them: There’s a first, a second, a third, and so on. This numbering proceeds in such a way that when you give me any string you choose, I must be able to tell you which number it will get.

COMP20121 - Section 4 – p.231/307

slide-58
SLIDE 58

How many strings over Σ?

Countably infinite means that we can list these strings, which means that we can number them: There’s a first, a second, a third, and so on. This numbering proceeds in such a way that when you give me any string you choose, I must be able to tell you which number it will get. In other words, our list

  • f strings contains every string there is.

COMP20121 - Section 4 – p.231/307

slide-59
SLIDE 59

How many strings over Σ?

This listing works as follows: First give all the strings consisting of one symbol, then all the strings consisting of two symbols, then all the strings consisting of three symbols,. . . .

COMP20121 - Section 4 – p.232/307

slide-60
SLIDE 60

How many strings over Σ?

This listing works as follows: First give all the strings consisting of one symbol, then all the strings consisting of two symbols, then all the strings consisting of three symbols,. . . . If Σ has n elements, then there are n different strings consisting of one letter,

n2 consisting of two letters, n3 many

consisting of three letters, and so on.

COMP20121 - Section 4 – p.232/307

slide-61
SLIDE 61

How many strings over Σ?

This demonstrates that the set Σ∗ of all strings over Σ is countably infinite.

COMP20121 - Section 4 – p.232/307

slide-62
SLIDE 62

How many Turing machines?

  • Clearly not every string over our

underlying alphabet will be a proper encoding of a Turing machine. Many of them will be meaningless if we try to interpret them as Turing machines.

COMP20121 - Section 4 – p.233/307

slide-63
SLIDE 63

How many Turing machines?

  • Clearly not every string over our

underlying alphabet will be a proper encoding of a Turing machine. Many of them will be meaningless if we try to interpret them as Turing machines.

  • Nonetheless we can use the list of all

strings to obtain a list of all Turing machines: We just leave out the strings which don’t encode a machine, and adjust the numbers accordingly.

COMP20121 - Section 4 – p.233/307

slide-64
SLIDE 64

How many Turing machines?

It should be clear that there are infinitely many TMs over any given alphabet, and the above argument tells us that we are once again talking about a countable infinity.

COMP20121 - Section 4 – p.233/307

slide-65
SLIDE 65

How many languages over Σ?

  • A language over Σ is a subset of Σ∗,

which we know to be countably infinite.

COMP20121 - Section 4 – p.234/307

slide-66
SLIDE 66

How many languages over Σ?

  • A language over Σ is a subset of Σ∗,

which we know to be countably infinite.

  • Hence we are asking: How many

subsets does a countably infinite set have?

COMP20121 - Section 4 – p.234/307

slide-67
SLIDE 67

How many languages over Σ?

  • A language over Σ is a subset of Σ∗,

which we know to be countably infinite.

  • Hence we are asking: How many

subsets does a countably infinite set have?

  • Clearly there must be infinitely many:

Merely the one-element subsets provide us with infinitely many subsets.

COMP20121 - Section 4 – p.234/307

slide-68
SLIDE 68

How many languages over Σ?

  • A language over Σ is a subset of Σ∗,

which we know to be countably infinite.

  • Hence we are asking: How many

subsets does a countably infinite set have?

  • Clearly there must be infinitely many:

Merely the one-element subsets provide us with infinitely many subsets.

  • But this time, we have an uncountable

infinity.

COMP20121 - Section 4 – p.234/307

slide-69
SLIDE 69

How many subsets of a countably. . .

Let A be an infinite countable set, with elements a1, a2, . . . Because we know that A is infinite, we know that this list goes on forever.

COMP20121 - Section 4 – p.235/307

slide-70
SLIDE 70

How many subsets of a countably. . .

Let A be an infinite countable set, with elements a1, a2, . . . Because we know that A is infinite, we know that this list goes on forever. Assume that we have a list which contains all the subsets of A, starting with A1, A2, . . .

COMP20121 - Section 4 – p.235/307

slide-71
SLIDE 71

How many subsets of a countably. . .

Let A be an infinite countable set, with elements a1, a2, . . . Because we know that A is infinite, we know that this list goes on forever. Assume that we have a list which contains all the subsets of A, starting with A1, A2, . . . We can describe every such set by saying which of the elements

  • f A belong to it.

COMP20121 - Section 4 – p.235/307

slide-72
SLIDE 72

How many subsets of a countably. . .

For A1, this might look as follows.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

COMP20121 - Section 4 – p.236/307

slide-73
SLIDE 73

How many subsets of a countably. . .

We can describe our entire list of sets in this way.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

COMP20121 - Section 4 – p.236/307

slide-74
SLIDE 74

How many subsets of a countably. . .

We describe a set B by stipulating its members.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

? ? ? ? ? ? . . .

COMP20121 - Section 4 – p.236/307

slide-75
SLIDE 75

How many subsets of a countably. . .

Because a1 is not in A1, we decide that it should be in B.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

  • ?

? ? ? ? . . .

COMP20121 - Section 4 – p.236/307

slide-76
SLIDE 76

How many subsets of a countably. . .

Because a2 is in A2, we decide that it should not be in B.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

  • ?

? ? ? . . .

COMP20121 - Section 4 – p.236/307

slide-77
SLIDE 77

How many subsets of a countably. . .

Because a3 is in A3, we decide that it should not be in B.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

  • ?

? ? . . .

COMP20121 - Section 4 – p.236/307

slide-78
SLIDE 78

How many subsets of a countably. . .

Because a4 is not in A4, we decide that it should be in B.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

  • ?

? . . .

COMP20121 - Section 4 – p.236/307

slide-79
SLIDE 79

How many subsets of a countably. . .

It should be clear now how to continue with the definition of B:

an is in B iff an is not in An.

COMP20121 - Section 4 – p.237/307

slide-80
SLIDE 80

B does not appear on the list

When we compare B with A1, we note that they differ as far as element a1 is concerned.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

  • ?

? . . .

COMP20121 - Section 4 – p.238/307

slide-81
SLIDE 81

B does not appear on the list

When we compare B with A2, we note that they differ as far as element a2 is concerned.

Set\ element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

  • ?

? . . .

COMP20121 - Section 4 – p.238/307

slide-82
SLIDE 82

B does not appear on the list

When we compare B with the nth element An, we note that they differ as far as element an is concerned.

Set\element

a1 a2 a3 a4 a5 a6

. . .

A1

  • . . .

A2

  • . . .

A3

  • . . .

A4

  • . . .

. . .

B

  • ?

? . . .

COMP20121 - Section 4 – p.238/307

slide-83
SLIDE 83

B does not appear on the list

Hence B does not appear on the list!

COMP20121 - Section 4 – p.238/307

slide-84
SLIDE 84

B does not appear on the list

Hence B does not appear on the list! This means that our list never contained all the subsets of A. Since we assumed it was an arbitrary such list, we have to deduce that such a list cannot exist. So A has uncountably many subsets.

COMP20121 - Section 4 – p.238/307

slide-85
SLIDE 85

B does not appear on the list

This method for showing that a list does not contain everything it was supposed to contain is known as the diagonalization method.

COMP20121 - Section 4 – p.239/307

slide-86
SLIDE 86

Unrecognizable languages

We have now demonstrated the following:

COMP20121 - Section 4 – p.240/307

slide-87
SLIDE 87

Unrecognizable languages

We have now demonstrated the following:

  • There are countably infinitely many

Turing machines. Hence there are at most countably infinitely many Turing-recognizable languages (the languages recognized by these TMs).

COMP20121 - Section 4 – p.240/307

slide-88
SLIDE 88

Unrecognizable languages

We have now demonstrated the following:

  • There are countably infinitely many

Turing machines. Hence there are at most countably infinitely many Turing-recognizable languages (the languages recognized by these TMs).

  • There are uncountably many

languages over a given alphabet.

COMP20121 - Section 4 – p.240/307

slide-89
SLIDE 89

Unrecognizable languages

Hence there must be uncountably many languages which are not Turing-recognizable!

COMP20121 - Section 4 – p.241/307

slide-90
SLIDE 90

An undecidable language

If we translate the idea of the program

DHalt for Turing machines, the question

could be changed to:

COMP20121 - Section 4 – p.242/307

slide-91
SLIDE 91

An undecidable language

If we translate the idea of the program

DHalt for Turing machines, the question

could be changed to: Can we have a Turing machine which, given the code M for a TM M and an input string α, will decide whether or not

M accepts α?

COMP20121 - Section 4 – p.242/307

slide-92
SLIDE 92

An undecidable language

This is a variation of the Halting Problem, just for Turing machines. We could alternatively choose a TM which, given the code M for a TM M and an input string

α, will decide whether or not M halts for

input α. (Note that in order to accept α, M will have to halt.) We will look at this question later.

COMP20121 - Section 4 – p.243/307

slide-93
SLIDE 93

An undecidable language

Theorem 4.1 The language

LTM = {(M, α) | M is a TM which accepts α}

is not decidable.

COMP20121 - Section 4 – p.244/307

slide-94
SLIDE 94

An undecidable language

Theorem 4.1 The language

LTM = {(M, α) | M is a TM which accepts α}

is not decidable. You should have expected this result, because of the Church-Turing thesis and its similarity to the Halting Problem.

COMP20121 - Section 4 – p.244/307

slide-95
SLIDE 95

A recognizable but undecidable lang.

The language

LTM = {(M, α) | M is a TM which accepts α}

is not decidable, but it is Turing-recognizable!

COMP20121 - Section 4 – p.245/307

slide-96
SLIDE 96

A recognizable but undecidable lang.

The language

LTM = {(M, α) | M is a TM which accepts α}

is not decidable, but it is Turing-recognizable! We will only give a brief argument for this.

COMP20121 - Section 4 – p.245/307

slide-97
SLIDE 97

A recognizable but undecidable lang.

There is a ‘universal Turing machine’ U which can simulate every other TM!

COMP20121 - Section 4 – p.246/307

slide-98
SLIDE 98

A recognizable but undecidable lang.

There is a ‘universal Turing machine’ U which can simulate every other TM! Given an encoding M for a TM M and a string

α, U will behave like M for the input string α. U recognizes the language LTM.

COMP20121 - Section 4 – p.246/307

slide-99
SLIDE 99

A recognizable but undecidable lang.

To see how U works, assume that it has

  • ne tape with the encoding M of M,

and another tape with the input string α. What it then does is to use the first tape to read off what to do. It carries out those actions on the second tape, thus mimicking

M’s action.

COMP20121 - Section 4 – p.246/307

slide-100
SLIDE 100

A recognizable but undecidable lang.

If U thus works out that M accepts α (which requires M to halt) it will accept the pair (M, α).

COMP20121 - Section 4 – p.246/307

slide-101
SLIDE 101

A recognizable but undecidable lang.

If U thus works out that M accepts α (which requires M to halt) it will accept the pair (M, α). If M goes on forever, so will U! Note that U recognizes LTM, but does not decide it.

COMP20121 - Section 4 – p.246/307