recursively enumerable and recursive languagesryan/cse4083/busch/class19.pdf · 2 recall definition...

62
class19.pdf Page 2. RE and Recursive. Linz 6th, §11.1 Def RE. Linz 6 th Definition 11.1 Def Recursive. Linz 6 th Definition 11.2 Page 28. lang not RE. Linz 6th, §11.1 [Thm 11.2 by counting argument] Thm 11.3 by diagonalization Page 50. Recursive is of RE Linz 6th, §11.1 [Thm 11.4 If L and L complement both re, then both recursive. L recursive, then L complement recursive.] Thm 11.5 a non-recursive, but re language 1

Upload: others

Post on 29-Sep-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

class19.pdf

• Page 2. RE and Recursive. Linz 6th, §11.1• Def RE. Linz 6th Definition 11.1

• Def Recursive. Linz 6th Definition 11.2

• Page 28. ∃ lang not RE. Linz 6th, §11.1 • [Thm 11.2 by counting argument]

• Thm 11.3 by diagonalization

• Page 50. Recursive is 𝑝𝑟𝑜𝑝𝑒𝑟 𝑠𝑢𝑏𝑠𝑒𝑡 of RE Linz 6th, §11.1• [Thm 11.4 If L and L complement both re, then both

recursive. L recursive, then L complement recursive.]

• Thm 11.5 ∃ a non-recursive, but re language1

Page 2: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

2

Recursively Enumerable and

Recursive

Languages

Page 3: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

3

Recall

Definition (class 18.pdf)

Definition 10.4, Linz, 6th, page 279

An enumeration procedure for is a

Turing Machine that generates

all strings of one by one

Let be a set of strings. S

S

S

and

each string is generated in finite time.

Page 4: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

4

Definition:

A language is recursively enumerable

if some Turing machine accepts it

Page 5: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

5

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

Lwif then halts in a non-final stateM

or loops forever

Page 6: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

6

Definition (11.2, page 287):

A language is recursive

if some Turing machine accepts it

and halts on any input string

In other words:

A recursive language has a

membership algorithm.

Page 7: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

7

For any string :

Let be a recursive languageL

and the Turing Machine that accepts itM

Lw

w

if then halts in a final state M

Lwif then halts in a non-final stateM

L is a recursive language if there is a Turing Machine M such that

Page 8: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

8

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 9: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

9

Recursive

Recursively Enumerable

Non Recursively Enumerable

Page 10: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

10

We will prove:

1. If a language is recursive then

there is an enumeration procedure for it.

Linz 6th, page 287.

2. A language is recursively enumerable

if and only if there is an enumeration

procedure for it.

Linz 6th, page 287.

Page 11: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

11

Theorem:

if a language is recursive then

there is an enumeration procedure for it

L

Page 12: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

12

Proof:

MM~

Enumeration Machine

Accepts LEnumerates all

strings of input alphabet

Page 13: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

13

If the alphabet is then

can enumerate strings as follows:

},{ baM~

abaaabba

bbaaaaab......

Page 14: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

14

Enumeration procedure

Repeat:

M~ generates a string

M

w

checks if Lw

YES: print to output w

NO: ignore w

End of Proof

Page 15: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

15

Example:

M~

a

baaabba

bbaaaaab......

)(ML

b

ab

bbaaa

......

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

Enumeration

Output

b

ab

bbaaa

......

Page 16: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

16

Theorem:

if language is recursively enumerable, then there is an enumeration procedure

for it

L

Page 17: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

17

Proof:

MM~

Enumeration Machine

Accepts LEnumerates all

strings of input alphabet

Page 18: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

18

If the alphabet is then

can enumerate strings as follows:

},{ baM~

abaaabba

bbaaaaab

Page 19: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

19

Enumeration procedure

Repeat: M~ generates a string

M

w

checks if Lw

YES: print to output w

NO: ignore w

NAIVE APPROACH

Problem: If

machine may loop forever

Lw

M

Page 20: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

20

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 21: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

21

M~ Generates third string 3w

M executes first step on 3w

second step on 2w

third step on 1w

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

Page 22: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

22

1w 2w 3w 4w

1

Step

in

string

1 1 1

2 2 2 2

3 3 3 3

Page 23: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

23

If for any string the

machine halts in a final state,

then it prints on the output

Miw

iw

End of Proof

Page 24: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

24

Theorem:

If for language

there is an enumeration procedure,

then is recursively enumerable

L

L

Page 25: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

25

Proof:

w

Input Tape

Enumerator

for LCompare

Machine that

accepts L

Page 26: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

26

Turing machine that accepts L

Repeat:

• Using the enumerator,

generate the next string of L

For input string w

• Compare generated string with w

If same, accept and exit loop

End of Proof

Page 27: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

27

We have proven:

A language is recursively enumerable

if and only if

there is an enumeration procedure for it

Page 28: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

28

A Language which is not

Recursively Enumerable

Page 29: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

29

We want to find a language that

is not Recursively Enumerable

This language is not accepted by any

Turing Machine

Page 30: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

30

Consider alphabet }{a

Strings: ,,,, aaaaaaaaaa

1a 2a 3a 4a

Page 31: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

31

Consider Turing Machines

that accept languages over alphabet }{a

They are countable:

,,,, 4321 MMMM

Page 32: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

32

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 33: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

33

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Page 34: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

34

Consider the language

)}(:{ iii MLaaL =

L consists from the 1’s in the diagonal

Page 35: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

35

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

},,{ 43 aaL =

Page 36: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

36

Consider the language

)}(:{ iii MLaaL =

L consists from the 0’s in the diagonal

)}(:{ iii MLaaL =

L

Page 37: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

37

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

},,{ 21 aaL =

Page 38: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

38

Theorem:

Language is not recursively enumerableL

Page 39: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

39

Proof:

is recursively enumerableL

Assume for contradiction that

There must exist some machine

that accepts kM

L

LML k =)(

Page 40: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

40

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Question: ?1MMk =

Page 41: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

41

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 42: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

42

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Question: ?2MMk =

Page 43: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

43

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 44: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

44

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

Question: ?3MMk =

Page 45: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

45

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 46: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

46

Similarly: ik MM

)(

)(

ii

ki

MLa

MLa

)(

)(

ii

ki

MLa

MLa

for any i

Because either:

or

Page 47: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

47

Therefore, the machine cannot exist kM

Therefore, the language is not recursively enumerable

L

End of Proof

Page 48: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

48

Observation:

There is no algorithm that describes L

(otherwise would be accepted by

some Turing Machine)

L

Page 49: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

49

Recursive

Recursively Enumerable

Non Recursively Enumerable

L

Page 50: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

50

A Language which is Recursively Enumerable

and not Recursive

Page 51: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

51

We want to find a language which

There is a

Turing Machine

that accepts

the language

The machine

doesn’t halt

on some input

Is recursively

enumerable

But not

recursive

Page 52: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

52

We will prove that the language

)}(:{ iii MLaaL =

Is recursively enumerable

but not recursive

Page 53: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

53

1a 2a 3a 4a

)( 1ML

0 1 10

)( 2ML

)( 3ML

01 0 1

0 1 11

)( 4ML 0 10 0

},,{ 43 aaL =

Page 54: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

54

The language

Theorem:

)}(:{ iii MLaaL =

is recursively enumerable

Page 55: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

55

Proof:

We will give a Turing Machine that

accepts L

Page 56: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

56

Turing Machine that accepts L

For 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 57: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

57

Observation:

)}(:{ iii MLaaL =

)}(:{ iii MLaaL =

Recursively enumerable

Not recursively enumerable

(Thus, also not recursive)

Page 58: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

58

Theorem:

The language )}(:{ iii MLaaL =

is not recursive

Page 59: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

59

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 reject

If rejects then accept

M

M

Page 60: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

60

Therefore:

L is recursive

But we know:

L is not recursively enumerable

thus, not recursive

CONTRADICTION!!!!

Page 61: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

61

Therefore, is not recursiveL

End of Proof

Page 62: Recursively Enumerable and Recursive Languagesryan/cse4083/busch/class19.pdf · 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 An enumeration procedurefor

62

L

Recursive

Recursively Enumerable

Non Recursively Enumerable

L