recursively enumerable and recursive languages

60
1 Recursively Enumerable and Recursive Languages

Upload: horace-gregory

Post on 18-Jan-2018

907 views

Category:

Documents


63 download

DESCRIPTION

Definition: A language is recursively enumerable if some Turing machine accepts it

TRANSCRIPT

Page 1: Recursively Enumerable and Recursive Languages

1

Recursively Enumerable and

Recursive

Languages

Page 2: Recursively Enumerable and Recursive Languages

2

Definition:A language is recursively enumerableif some Turing machine accepts it

Page 3: Recursively Enumerable and Recursive Languages

3

For string :

Let be a recursively enumerable languageL

and the Turing Machine that accepts itM

Lw∈

w

if then halts in a final state M

Lw∉if then halts in a non-final stateMor loops forever

Page 4: Recursively Enumerable and Recursive Languages

4

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 5: Recursively Enumerable and Recursive Languages

5

For string :

Let be a recursive languageL

and the Turing Machine that accepts itM

Lw∈

w

if then halts in a final state M

Lw∉if then halts in a non-final stateM

Page 6: Recursively Enumerable and Recursive Languages

6

We will prove:

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 7: Recursively Enumerable and Recursive Languages

7

Recursive

Recursively Enumerable

Non Recursively Enumerable

Page 8: Recursively Enumerable and Recursive Languages

8

We will first prove:

• If a language is recursive then there is an enumeration procedure for it

• A language is recursively enumerable if and only if there is an enumeration procedure for it

Page 9: Recursively Enumerable and Recursive Languages

9

Theorem:if a language is recursive then there is an enumeration procedure for it

L

Page 10: Recursively Enumerable and Recursive Languages

10

Proof:

MM~

Enumeration Machine

Accepts LEnumerates allstrings of input alphabet

Page 11: Recursively Enumerable and Recursive Languages

11

If the alphabet is then can enumerate strings as follows:

},{ baM~

abaaabbabbaaaaab......

Page 12: Recursively Enumerable and Recursive Languages

12

Enumeration procedure

Repeat:

M~ generates a string

M

w

checks if Lw∈

YES: print to output wNO: ignore w

End of Proof

Page 13: Recursively Enumerable and Recursive Languages

13

Example:

M~

abaaabbabbaaaaab......

)(ML

b

ab

bbaaa

......

,....},,,{ aaabbabbL =Enumeration

Output

b

ab

bbaaa

......

Page 14: Recursively Enumerable and Recursive Languages

14

Theorem:

if language is recursively enumerable thenthere is an enumeration procedure for it

L

Page 15: Recursively Enumerable and Recursive Languages

15

Proof:

MM~

Enumeration Machine

Accepts LEnumerates allstrings of input alphabet

Page 16: Recursively Enumerable and Recursive Languages

16

If the alphabet is then can enumerate strings as follows:

},{ baM~

abaaabbabbaaaaab

Page 17: Recursively Enumerable and Recursive Languages

17

Enumeration procedure

Repeat: M~ generates a string

M

w

checks if Lw∈

YES: print to output wNO: ignore w

NAIVE APPROACH

Problem:If machine may loop forever

Lw∉M

Page 18: Recursively Enumerable and Recursive Languages

18

M~

M

1w

executes first step on

BETTER APPROACH

1w

M~ Generates second string 2w

M executes first step on 2w

second step on 1w

Generates first string

Page 19: Recursively Enumerable and Recursive Languages

19

M~ Generates third string 3w

M executes first step on 3w

second step on 2w

third step on 1w

And so on............

Page 20: Recursively Enumerable and Recursive Languages

20

1w 2w 3w 4w L

1Step instring

L

1 1 1

2 2 2 2

3 3 3 3

Page 21: Recursively Enumerable and Recursive Languages

21

If for any string machine halts in a final statethen it prints on the output

Miw

iw

End of Proof

Page 22: Recursively Enumerable and Recursive Languages

22

Theorem:

If for language there is an enumeration procedurethen is recursively enumerable

L

L

Page 23: Recursively Enumerable and Recursive Languages

23

Proof:

wInput Tape

Enumeratorfor L

Compare

Machine that accepts L

Page 24: Recursively Enumerable and Recursive Languages

24

Turing machine that accepts L

Repeat:• Using the enumerator, generate the next string ofL

For input string w

• Compare generated string with wIf same, accept and exit loop

End of Proof

Page 25: Recursively Enumerable and Recursive Languages

25

We have proven:

A language is recursively enumerable if and only if there is an enumeration procedure for it

Page 26: Recursively Enumerable and Recursive Languages

26

A Language which is not

Recursively Enumerable

Page 27: Recursively Enumerable and Recursive Languages

27

We want to find a language thatis not Recursively Enumerable

This language is not accepted by anyTuring Machine

Page 28: Recursively Enumerable and Recursive Languages

28

Consider alphabet }{a

Strings: K,,,, aaaaaaaaaa

1a 2a 3a 4a L

Page 29: Recursively Enumerable and Recursive Languages

29

Consider all Turing Machinesthat accept languages over alphabet }{a

They are countable:

K,,,, 4321 MMMM

Page 30: Recursively Enumerable and Recursive Languages

30

Example language accepted by

},,{)( aaaaaaaaaaaaML i =

},,{)( 642 aaaML i =

iM

Alternative representation

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

)( iML

L

0 1 1 10 0 0 L

Page 31: Recursively Enumerable and Recursive Languages

31

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

Page 32: Recursively Enumerable and Recursive Languages

32

Consider the language

)}(:{ iii MLaaL ∈=

L consists from the 1’s in the diagonal

Page 33: Recursively Enumerable and Recursive Languages

33

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

},,{ 43 KaaL =

Page 34: Recursively Enumerable and Recursive Languages

34

Consider the language

)}(:{ iii MLaaL ∈=

L consists from the 0’s in the diagonal

)}(:{ iii MLaaL ∉=

L

Page 35: Recursively Enumerable and Recursive Languages

35

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

},,{ 21 KaaL =

Page 36: Recursively Enumerable and Recursive Languages

36

Theorem:Language is not recursively enumerableL

Page 37: Recursively Enumerable and Recursive Languages

37

Proof:

is recursively enumerableLAssume for contradiction that

There must exist some machinethat accepts

kML

LML k =)(

Page 38: Recursively Enumerable and Recursive Languages

38

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

Question: ?1MMk =

Page 39: Recursively Enumerable and Recursive Languages

39

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

Answer: 1MMk ≠)(

)(

11

1

MLa

MLa k

Page 40: Recursively Enumerable and Recursive Languages

40

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

Question: ?2MMk =

Page 41: Recursively Enumerable and Recursive Languages

41

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

Answer: 2MMk ≠)(

)(

22

2

MLa

MLa k

Page 42: Recursively Enumerable and Recursive Languages

42

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

Question: ?3MMk =

Page 43: Recursively Enumerable and Recursive Languages

43

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

Answer: 3MMk ≠)(

)(

33

3

MLa

MLa k

Page 44: Recursively Enumerable and Recursive Languages

44

Similarly: ik MM ≠

)(

)(

ii

ki

MLa

MLa

)(

)(

ii

ki

MLa

MLa

for any i

Because either:

or

Page 45: Recursively Enumerable and Recursive Languages

45

Therefore, the machine cannot exist kM

Therefore, the languageis not recursively enumerable

L

End of Proof

Page 46: Recursively Enumerable and Recursive Languages

46

Observation:

There is no algorithm that describes L

(otherwise would be accepted by some Turing Machine)

L

Page 47: Recursively Enumerable and Recursive Languages

47

Recursive

Recursively Enumerable

Non Recursively EnumerableL

Page 48: Recursively Enumerable and Recursive Languages

48

A Language which is Recursively Enumerable

and not Recursive

Page 49: Recursively Enumerable and Recursive Languages

49

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 50: Recursively Enumerable and Recursive Languages

50

We will prove that the language

)}(:{ iii MLaaL ∈=

Is recursively enumerablebut not recursive

Page 51: Recursively Enumerable and Recursive Languages

51

1a 2a 3a 4a

)( 1ML

L

0 1 10 L

)( 2ML

)( 3ML

01 0 1 L

0 1 11 L

)( 4ML 0 10 L0

},,{ 43 KaaL =

Page 52: Recursively Enumerable and Recursive Languages

52

The language

Theorem:

)}(:{ iii MLaaL ∈=

is recursively enumerable

Page 53: Recursively Enumerable and Recursive Languages

53

Proof:

We will give a Turing Machine thataccepts L

Page 54: Recursively Enumerable and Recursive Languages

54

Turing Machine that accepts LFor any input string w

• Compute , for which iaw=• Find Turing machine iM

(using the enumeration procedure for Turing Machines)

• Simulate on inputiMia

• If accepts, then accept iM w

i

End of Proof

Page 55: Recursively Enumerable and Recursive Languages

55

Observation:

)}(:{ iii MLaaL ∈=

)}(:{ iii MLaaL ∉=

Recursively enumerable

Not recursively enumerable

(Thus, also not recursive)

Page 56: Recursively Enumerable and Recursive Languages

56

Theorem:

The language )}(:{ iii MLaaL ∈=

is not recursive

Page 57: Recursively Enumerable and Recursive Languages

57

Proof:Assume for contradiction that is recursive

Then is recursive:

L

LTake the Turing Machine that accepts M L halts on any input:M

If accepts then rejectIf rejects then accept

MM

Page 58: Recursively Enumerable and Recursive Languages

58

Therefore:

L is recursive

But we know:

L is not recursively enumerablethus, not recursive

CONTRADICTION!!!!

Page 59: Recursively Enumerable and Recursive Languages

59

Therefore, is not recursiveL

End of Proof

Page 60: Recursively Enumerable and Recursive Languages

60

L

Recursive

Recursively Enumerable

Non Recursively EnumerableL