1 turing’s thesis. 2 turing’s thesis: any computation carried out by mechanical means can be...

120
1 Turing’s Thesis

Upload: roy-dean

Post on 18-Jan-2016

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

1

Turing’s Thesis

Page 2: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

2

Turing’s thesis:

Any computation carried outby mechanical meanscan be performed by a Turing Machine

(1930)

Page 3: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

3

Computer Science Law:

A computation is mechanical if and only ifit can be performed by a Turing Machine

There is no known model of computationmore powerful than Turing Machines

Page 4: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

4

Definition of Algorithm:

An algorithm for functionis a Turing Machine which computes

)(wf

)(wf

Page 5: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

5

When we say:

There exists an algorithm

Algorithms are Turing Machines

We mean:

There exists a Turing Machinethat executes the algorithm

Page 6: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

6

Turing Machines are “hardwired”

they executeonly one program

A limitation of Turing Machines:

Real Computers are re-programmable

Page 7: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

7

Encoding Turing Machine

Page 8: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

8

Alphabet Encoding

Symbols: a b c d

Encoding: 1 11 111 1111

Page 9: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

9

State Encoding

States: 1q 2q 3q 4q

Encoding: 1 11 111 1111

Head Move Encoding

Move:

Encoding:

L R

1 11

Page 10: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

10

Transition Encoding

Transition: ),,(),( 21 Lbqaq

Encoding: 10110110101

separator

Page 11: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

11

Machine Encoding

Transitions:

),,(),( 21 Lbqaq

Encoding:

10110110101

),,(),( 32 Rcqbq

110111011110101100

separator

Page 12: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

12

A Turing Machine is described with a binary string of 0’s and 1’s

The set of Turing machines forms a language:

each string of the language isthe binary encoding of a Turing Machine

Therefore:

Page 13: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

13

Language of Turing Machines

L = { 010100101,

00100100101111,

111010011110010101, …… }

(Turing Machine 1)

(Turing Machine 2)

……

Page 14: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

14

Countable Sets

Page 15: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

15

Infinite sets are either: Countable

or

Uncountable

Page 16: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

16

Countable set:

There is a one to one correspondencebetween elements of the setand Natural numbers

Any finite set

Any Countably infinite set:

or

Page 17: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

17

Example:

Even integers: ,6,4,2,0

The set of even integersis countable

Positive integers:

Correspondence:

,4,3,2,1

n2 corresponds to 1n

Page 18: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

18

Example: The set of rational numbersis countable

Rational numbers: ,87,43,21

Page 19: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

19

Naïve Proof

Rational numbers: ,31,21,11

Positive integers:

Correspondence:

,3,2,1

Doesn’t work:

we will never count numbers with nominator 2:

,32,22,12

Page 20: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

20

Better Approach

11

21

31

41

12

22

32

13

23

14

Page 21: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

21

11

21

31

41

12

22

32

13

23

14

Page 22: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

22

Rational Numbers: ,22,31,12,21,11

Correspondence:

Positive Integers: ,5,4,3,2,1

Page 23: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

23

We proved:

the set of rational numbers is countable by describing an enumeration procedure

Page 24: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

24

Definition

An enumeration procedure for is aTuring Machine that generatesall strings of one by one

Let be a set of strings S

S

S

and

Each string is generated in finite time

Page 25: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

25

EnumerationMachine for

,,, 321 sss

Ssss ,,, 321

Finite time: ,,, 321 ttt

strings

Soutput

(on tape)

Page 26: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

26

Enumeration MachineConfiguration

Time 0

0q

Time

sq

1x 1s#1t

Page 27: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

27

Time

sq

3x 3s#3t

Time

sq

2x 2s#2t

Page 28: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

28

If for a set there is an enumeration procedure, then the set is countable

Observation:

Page 29: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

29

Example:

The set of all stringsis countable

},,{ cba

We will describe an enumeration procedure

Proof:

Page 30: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

30

Naive procedure:

Produce the strings in lexicographic order:

aaaaaa

......

Doesn’t work: strings starting with will never be produced

b

aaaa

Page 31: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

31

Better procedure:

1. Produce all strings of length 1

2. Produce all strings of length 2

3. Produce all strings of length 3

4. Produce all strings of length 4

..........

Proper Order

Page 32: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

32

Produce strings in Proper Order:

aaabacbabbbccacbcc

aaaaabaac......

length 2

length 3

length 1abc

Page 33: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

33

Theorem: The set of all Turing Machinesis countable

Proof:

Find an enumeration procedure for the set of Turing Machine strings

Any Turing Machine can be encodedwith a binary string of 0’s and 1’s

Page 34: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

34

1. Generate the next binary string of 0’s and 1’s in proper order

2. Check if the string describes a Turing Machine if YES:YES: print string on output tape if NO:NO: ignore string

Enumeration Procedure:

Repeat

Page 35: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

35

Uncountable Sets

Page 36: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

36

A set is uncountable if it is not countable

Definition:

Page 37: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

37

Theorem:

Let be an infinite countable set

The powerset of is uncountable S2 S

S

Page 38: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

38

Proof:

Since is countable, we can write S

},,,{ 321 sssS

Elements of S

Page 39: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

39

Elements of the powerset have the form:

},{ 31 ss

},,,{ 10975 ssss

……

Page 40: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

40

We encode each element of the power setwith a binary string of 0’s and 1’s

1s 2s 3s 4s

1 0 0 0}{ 1s

Powersetelement

Encoding

0 1 1 0},{ 32 ss

1 0 1 1},,{ 431 sss

Page 41: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

41

Let’s assume (for contradiction) that the powerset is countable.

Then: we can enumerate the elements of the powerset

Page 42: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

42

1 0 0 0 0

1 1 0 0 0

1 1 0 1 0

1 1 0 0 1

Powerset element Encoding

1t

2t

3t

4t

Page 43: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

43

Take the powerset elementwhose bits are the complements in the diagonal

Page 44: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

44

1 0 0 0 0

1 1 0 0 0

1 1 0 1 0

1 1 0 0 1

1t

2t

3t

4t

New element: 0011

(birary complement of diagonal)

Page 45: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

45

The new element must be someof the powerset

it

However, that’s impossible:

the i-th bit of must be the complement of itself

from definition of it

it

Contradiction!!!

Page 46: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

46

Since we have a contradiction:

The powerset of is uncountable S2 S

Page 47: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

47

An Application: Languages

Example Alphabet : },{ ba

The set of all Strings:

},,,,,,,,,{},{ * aabaaabbbaabaababaS infinite and countable

Page 48: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

48

Example Alphabet : },{ ba

The set of all Strings:

},,,,,,,,,{},{ * aabaaabbbaabaababaS infinite and countable

A language is a subset of :

},,{ aababaaL

S

Page 49: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

49

Example Alphabet : },{ ba

The set of all Strings:

},,,,,,,,,{},{ * aabaaabbbaabaababaS infinite and countable

The powerset of contains all languages:

}},,,}{,{},{},{{2 aababaabaaS 1L 2L 3L 4L

uncountable

S

Page 50: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

50

Languages: uncountable

Turing machines: countable

1L 2L 3L kL

1M 2M 3M

?

There are more languagesthan Turing Machines

Page 51: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

51

There are some languages not acceptedby Turing Machines

(These languages cannot be described by algorithms)

Conclusion:

Page 52: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

52

Languages Accepted by Turing Machines

Languages not accepted by Turing Machines

kL

Page 53: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

53

Recursively Enumerable and

Recursive Languages

Page 54: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

54

Definition:

A language is recursively enumerableif some Turing machine accepts it

Page 55: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

55

For string :

Let be a recursively enumerable languageL

and the Turing Machine that accepts itM

w

Lwif then halts in a final state M

Lwif then halts in a non-final stateM

or loops forever

Page 56: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

56

Definition:

A language is recursiveif some Turing machine accepts itand halts on any input string

In other words: A language is recursive if there is a membership algorithm for it

Page 57: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

57

For string :

Let be a recursive languageL

and the Turing Machine that accepts itM

w

Lwif then halts in a final state M

Lwif then halts in a non-final stateM

Page 58: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

58

Facts:

1. There is a specific language which is not recursively enumerable (not accepted by any Turing Machine)

2. There is a specific language which is recursively enumerable but not recursive

Page 59: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

59

Recursive

Recursively Enumerable

Non Recursively Enumerable

Page 60: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

60

A Language which is not

Recursively Enumerable

Page 61: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

61

We want to find a language thatis not Recursively Enumerable

This language is not accepted by anyTuring Machine

Page 62: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

62

Consider alphabet }{a

Strings: ,,,, aaaaaaaaaa

1a 2a 3a 4a

Page 63: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

63

Consider Turing Machinesthat accept languages over alphabet }{a

They are countable:

,,,, 4321 MMMM

Page 64: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

64

Example language accepted by

},,{)( aaaaaaaaaaaaML i

},,{)( 642 aaaML i

iM

Alternative representation

1a 2a 3a 4a 5a 6a 7a

)( iML

0 1 1 10 0 0

Page 65: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

65

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Page 66: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

66

Consider the language

)}(:{ iii MLaaL

L consists from the 1’s in the diagonal

Page 67: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

67

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

},,{ 43 aaL )}(:{ iii MLaaL

Page 68: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

68

Consider the language

)}(:{ iii MLaaL

L consists of the 0’s in the diagonal

)}(:{ iii MLaaL

L

Page 69: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

69

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

},,{ 21 aaL )}(:{ iii MLaaL

Page 70: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

70

Theorem:

Language is not recursively enumerableL

Page 71: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

71

Proof:

is recursively enumerableL

Assume for contradiction that

There must exist some machinethat accepts

kML

LML k )(

Page 72: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

72

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Question: ?1MMk

Page 73: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

73

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Answer: 1MMk )(

)(

11

1

MLa

MLa k

Page 74: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

74

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Question: ?2MMk

Page 75: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

75

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Answer: 2MMk )(

)(

22

2

MLa

MLa k

Page 76: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

76

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Question: ?3MMk

Page 77: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

77

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Answer: 3MMk )(

)(

33

3

MLa

MLa k

Page 78: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

78

Similarly: ik MM

)(

)(

ii

ki

MLa

MLa

)(

)(

ii

ki

MLa

MLa

for any i

Because either:

or

Page 79: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

79

Therefore, the machine cannot exist kM

Therefore, the languageis not recursively enumerable

L

End of Proof

Page 80: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

80

Observation:

There is no algorithm that describes L

(otherwise would be accepted by some Turing Machine)

L

Page 81: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

81

Recursive

Recursively Enumerable

Non Recursively Enumerable

L

Page 82: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

82

A Language which is Recursively Enumerable

and not Recursive

Page 83: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

83

We want to find a language which

There is a Turing Machine that accepts the language

The machinedoesn’t halt on some input

Is recursively enumerable

But notrecursive

Page 84: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

84

We will prove that the language

)}(:{ iii MLaaL

Is recursively enumerablebut not recursive

Page 85: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

85

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

},,{ 43 aaL

Page 86: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

86

The language

Theorem:

)}(:{ iii MLaaL

is recursively enumerable

Page 87: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

87

Proof:

We will give a Turing Machine thataccepts L

Page 88: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

88

Turing Machine that accepts LFor any input string w

• Compute , for which iaw• Find Turing machine iM

(using an enumeration procedure for Turing Machines)

• Simulate on inputiMia

• If accepts, then accept iM w

i

End of Proof

Page 89: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

89

Observation:

)}(:{ iii MLaaL

)}(:{ iii MLaaL

Recursively enumerable

Not recursively enumerable

(Thus, also not recursive)

Page 90: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

90

Theorem:

The language )}(:{ iii MLaaL

is not recursive

Page 91: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

91

Proof:

Assume for contradiction that is recursive

Then is recursive:

L

L

Take the Turing Machine that accepts M L

halts on any input:M

If accepts then rejectIf rejects then accept

MM

Page 92: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

92

Therefore:

L is recursive

But we know:

L is not recursively enumerable

thus, not recursive

CONTRADICTION!!!!

Page 93: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

93

Therefore, is not recursiveL

End of Proof

Page 94: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

94

L

Recursive

Recursively Enumerable

Non Recursively Enumerable

L

Page 95: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

95

The Chomsky Hierarchy(Formal Language Hierarchy)

Page 96: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

96

Context-Sensitive Grammars:

and: |||| vu

Productionsvu

String of variablesand terminals

String of variablesand terminals

Page 97: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

97

Non-recursively enumerable

Recursively-enumerable

Recursive

Context-sensitive

Context-free

Regular

The Chomsky Hierarchy

Page 98: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

98

Decidability

Page 99: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

99

Consider problems with answer YES or NO

Examples:

• Does Machine have three states ?M

• Is string a binary number? w

• Does DFA accept any input? M

Page 100: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

100

A problem is decidable if some Turing machinedecides (solves) the problem

Decidable problems:

• Does Machine have three states ?M

• Is string a binary number? w

• Does DFA accept any input? M

Page 101: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

101

Turing MachineInputprobleminstance

YES

NO

The Turing machine that decides (solves) a problem answers YES or NO for each instance of the problem

Page 102: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

102

The machine that decides (solves) a problem:

• If the answer is YES then halts in a yes state

• If the answer is NO then halts in a no state

These states may not be final states

Page 103: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

103

YES states

NO states

Turing Machine that decides a problem

YES and NO states are halting states

Page 104: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

104

Some problems are undecidable:

which means:there is no Turing Machine thatsolves all instances of the problem

A simple undecidable problem:

The membership problem

Page 105: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

105

The Membership Problem

Input: •Turing MachineM

•String w

Question: Does accept ? M w

?)(MLw

Page 106: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

106

Theorem:

The membership problem is undecidable

Proof: Assume for contradiction thatthe membership problem is decidable

(there are and for which we cannotdecide whether )

M w)(MLw

Page 107: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

107

Thus, there exists a Turing Machinethat solves the membership problem

H

HM

w

YES

NO

M accepts w

M rejects w

Page 108: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

108

Let be a recursively enumerable language L

Let be the Turing Machine that acceptsM L

We will prove that is also recursive: L

we will describe a Turing machine thataccepts and halts on any inputL

Page 109: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

109

M accepts ?wNO

YESM

w

Hacceptw

Turing Machine that acceptsand halts on any input

L

reject w

Page 110: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

110

Therefore, L is recursive

But there are recursively enumerablelanguages which are not recursive

Contradiction!!!!

Since is chosen arbitrarily, every recursively enumerable language is also recursive

L

Page 111: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

111

Therefore, the membership problem is undecidable

END OF PROOF

Page 112: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

112

Another famous undecidable problem:

The halting problem

Page 113: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

113

The Halting Problem

Input: •Turing MachineM

•String w

Question: Does halt on input ? M w

Page 114: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

114

If the halting problem was decidable thenevery recursively enumerable languagewould be recursive

Page 115: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

115

Theorem:

The halting problem is undecidable

Proof: Assume for contradiction thatthe halting problem is decidable

Page 116: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

116

There exists Turing Machinethat solves the halting problem

H

HM

w

YES M halts on w

Mdoesn’t halt on

wNO

Page 117: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

117

Let be a recursively enumerable language L

Let be the Turing Machine that acceptsM L

We will prove that is also recursive: L

we will describe a Turing machine thataccepts and halts on any inputL

Page 118: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

118

M halts on ?wYES

NOM

w

Run with input

Mw

Hreject w

acceptw

rejectw

Turing Machine that acceptsand halts on any input

L

Halts on final state

Halts on non-final state

Page 119: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

119

Therefore L is recursive

But there are recursively enumerablelanguages which are not recursive

Contradiction!!!!

Since is chosen arbitrarily, every recursively enumerable language is also recursive

L

Page 120: 1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

120

Therefore, the halting problem is undecidable

END OF PROOF