csc 3130: automata theory and formal languages

20
CSC 3130: Automata theory and formal languages Andrej Bogdanov http://www.cse.cuhk.edu.hk/ ~andrejb/csc3130 The Chinese University of Hong Kong More undecidable languages Fall 2009

Upload: finn

Post on 21-Jan-2016

43 views

Category:

Documents


0 download

DESCRIPTION

Fall 2009. The Chinese University of Hong Kong. CSC 3130: Automata theory and formal languages. More undecidable languages. Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130. Summary of last lecture. U. input x. M on input x. program 〈 M 〉. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSC 3130: Automata theory and formal languages

CSC 3130: Automata theory and formal languages

Andrej Bogdanov

http://www.cse.cuhk.edu.hk/~andrejb/csc3130

The Chinese University of Hong Kong

More undecidable languages

Fall 2009

Page 2: CSC 3130: Automata theory and formal languages

Summary of last lecture

Uinput x

program 〈 M 〉

M on input x

The universal TM U takes as inputs a program Mand a string x and simulates M on x

The program M itself is specified as a TM!

Page 3: CSC 3130: Automata theory and formal languages

by complementationnot recognizable:

recognizable:

undecidable:

We can simulate M on input w

by Turing’s Theorem

recognizable:

undecidable

We can simulate M on input x

by reduction from ATM

Summary of last lecture

ATM = { 〈 M, w 〉 : M is a TM that accepts input w}

ATM = { 〈 M, w 〉 : M is a TM that does not accept w}

HALTTM = { 〈 M, w 〉 : M is a TM that halts on input w}

Page 4: CSC 3130: Automata theory and formal languages

More undecidable problems

AEPSTM = { 〈 M 〉 : M is a TM that accepts input }

SOMETM = { 〈 M 〉 : M is a TM that accepts some input}

EQTM = { 〈 M, M’ 〉 : M and M’ accept the same inputs}

decidable recognizable butundecidable

unrecognizable

Page 5: CSC 3130: Automata theory and formal languages

Example 1

• Step 1: You gotta believe it– To know if M accepts , it looks like we have to

simulate it– But then we might end up in a loop

• Step 2: Use what you know

AEPSTM = { 〈 M 〉 : M is a TM that accepts input }

ATM is undecidable

Page 6: CSC 3130: Automata theory and formal languages

Proof by “reduction”

• Show that if AEPSTM can be decided,

... so can ATM

AEPSTM = { 〈 M 〉 : M is a TM that accepts input }

Areject if not

accept if M accepts 〈M〉

?〈 M, w 〉

reject if not

accept if M accepts w

Page 7: CSC 3130: Automata theory and formal languages

Proof by “reduction”

〈 M, w 〉

reject if not

accept if M accepts w

Areject if not

accept if M accepts 〈 M〉

A〈 M’ 〉

M’ is a Turing Machine such that:

If M accepts w, then M’ accepts If M does not accept w, then M’ does not accept M’ on input = M on input w

Page 8: CSC 3130: Automata theory and formal languages

Proof by “reduction”

〈 M, w 〉

reject if not

accept if M accepts w

A〈 M’ 〉

M’: On input z,

If z = , then simulate M on w and return its answerOtherwise, reject

construct

M’

M’

q0

qaccqrej

☐/☐R

☐/☐L

q1

run M

write w

oth

ers

Page 9: CSC 3130: Automata theory and formal languages

The argument

• We assume AEPSTM is decidable. Let A be a decider.

• We describe (in high level) a TM that decides ATM:

S: On input 〈 M, w 〉 : Construct the following TM M’:

Run A on input 〈 M’ 〉 and return its answer.

M’: On input z, If z = , then simulate M on w and return answer Otherwise, reject

S accepts 〈 M, w 〉

R accepts 〈 M’ 〉

M’ accepts

M accepts w

Page 10: CSC 3130: Automata theory and formal languages

Recognizable or not?

AEPSTM = { 〈 M 〉 : M is a TM that accepts input }

decidable recognizable butundecidable

unrecognizable

Turing Machine that recognizes AEPSTM:

On input 〈 M 〉 : Simulate M on input and return answer.

Page 11: CSC 3130: Automata theory and formal languages

Example 2

SOMETM = { 〈 M 〉 : M is a TM that accepts some input}

• Step 1: You gotta believe it– To know if M accepts, it looks like we have to

simulate it– But then we might end up in a loop

• Step 2: Use what you know

ATM is undecidable AEPSTM is undecidable

Page 12: CSC 3130: Automata theory and formal languages

Example 2

〈 M, w 〉

reject if not

accept if M accepts

Areject if not

accept if M accepts some input〈 M〉

A〈 M’ 〉

M’ is a Turing Machine such that:

If M accepts w, then M’ accepts some inputIf M does not accept w, then M’ does not accept anything

Page 13: CSC 3130: Automata theory and formal languages

Example 2

〈 M, w 〉

reject if not

accept if M accepts w

A〈 M’〉

construct

M’

M’: On any input,

Simulate M on wReturn its answer

decidable recognizable butundecidable

unrecognizable

M accepts w

M’ accepts some input

Page 14: CSC 3130: Automata theory and formal languages

Is it recognizable?

• Attempt to recognize SOMETM:

SOMETM = { 〈 M 〉 : M is a TM that accepts some input}

Simulate M on input Simulate M on input Simulate M on input Simulate M on input ...

Accept if one of them accepts

... but there are infinitely many!

Page 15: CSC 3130: Automata theory and formal languages

Is it recognizable?

• Attempt to recognize SOMETM:

SOMETM = { 〈 M 〉 : M is a TM that accepts some input}

For all possible strings x (in lexicographic order):

Simulate M on input x

If it accepts, accept.If it rejects, reject.

lexicographic order: , 0, 1, 00, 01, 10, 11, 000, 001, ...

what if M loops on but M accepts, say, 11?

Page 16: CSC 3130: Automata theory and formal languages

Is it recognizable?

• Description of recognizer for SOMETM:

SOMETM = { 〈 M 〉 : M is a TM that accepts some input}

For all possible strings x (in lexicographic order):

For all strings y that come before x

If it accepts, accept.If it rejects or doesn’t finish, continue.

k := 1

k := k + 1

Simulate M on y for k steps

Page 17: CSC 3130: Automata theory and formal languages

Execution of Turing Machine

• Execution:

inputs 0 1 00 01 ...

Simulate M on for 1 step

Simulate M on for 2 stepsSimulate M on 0for 2 steps

Simulate M on for 3 stepsSimulate M on 0for 3 stepsSimulate M on 1for 3 steps...

If M accepts some w,execution will see thisin some stage of thesimulation

decidable recognizable butundecidable

unrecognizable

Page 18: CSC 3130: Automata theory and formal languages

Example 3

• Step 1: You gotta believe it

• Step 2: Use what you know

decidable recognizable butundecidable

unrecognizable

ATM is recognizablebut undecidable

AEPSTM is recognizablebut undecidable

SOMETM is recognizablebut undecidable ATM is unrecognizable

EQTM = { 〈 M1, M2 〉 : M1 and M2 accept the same inputs}

Page 19: CSC 3130: Automata theory and formal languages

Example 3

EQTM = { 〈 M1, M2 〉 : M1 and M2 accept the same inputs}

?〈 M, w 〉

rej/loop if M accepts w

accept if M rej/loops on w

Arej/loop if not

accept if M1, M2 accept same inputs〈 M1, M2 〉

ATM = { 〈 M, w 〉 : M is a TM that does not accept w}

Page 20: CSC 3130: Automata theory and formal languages

Example 3

Arej/loop if not

accept if M1, M2 accept same inputs〈 M1, M2 〉

〈 M, w 〉

A

〈 M1 〉

〈 M2 〉

rej/loop if M accepts w

accept if M rej/loops on w

M1: “On any input: Run M on w”M2: “Reject”

M1, M2 accept same inputs M rej/loops on w