Download presentation

Presentation is loading. Please wait.

Published byCarlos Switzer Modified over 2 years ago

1
CSCI 3130: Formal languages and automata theory Tutorial 9 Chin

2
Reminder Homework 5 is due at next Tuesday! No tutorial next week! :D This is the last one.

3
Undecidable problems for CFGs ALL CFG = { : G is a CFG that generates all strings} ALL CFG is undecidable Reduction A TM = { : M is a TM that does not accept w} = { : M rejects or loops on input w} A TM is unrecognizable A TM is undecidable If ALL CFG is decidable then A TM is decidable. Contradiction.

4
Undecidable problems for CFGs ALL CFG = { : G is a CFG that generates all strings} – ALL CFG is undecidable – Suppose it is decidable, then there exists a universal TM H string H(string ) { // G is a CFG if G generates all strings, return accept; if G does not generates all strings, return reject; } Consider the following TM U (dependent on and w) string U(string, string w){ If M does not accept w, return that generates all strings If M accepts w, return that does not generate all strings } If we can simulate H(U(,w)), then U decides A TM and so A TM is decidable.

5
Undecidable problems for CFGs ALL CFG = { : G is a CFG that generates all strings} – ALL CFG is undecidable Consider the following TM U (dependent on ) string U(string, string w){ If M does not accept w, return that generates all strings If M accepts w, return that does not generate all strings } We construct U as follows instead: string U(string, string w){ If M does not accept w, construct that generates all strings If M accepts w, construct that generates all strings except the computation history of M(w) return H( ) } How to construct ? We need to construct so that even if M loops on w, generates all strings.

6
Undecidable problems for CFGs Computation history – #q 0 ab%ab#xq 1 b%ab#... #xx%xx q a # – Each #xxxxxx# tells you the configuration of the TM in each step … aba q1q1 abq 1 a q1q1 q acc a/bR abbq acc … abb q acc

7
Undecidable problems for CFGs Computation history – Suppose the current configuration is #xbq 1 xab# – What does the next configuration look like? The head must be one symbol left or one symbol right #xbq 1 xab# – Only these 3 symbols can change Use this fact to design a PDA that generates the computation history (see lecture notes). Convert the PDA to.

8
Undecidable problems for CFGs PCP = { : T is a collection of tiles that contains a top-bottom match} PCP is undecidable AMB = { : G is an ambiguous CFG} AMB is undecidable If AMB is decidable, PCP is decidable. Contradiction.

9
Undecidable problems for CFGs TG (collection of tiles) bab cc c ab a ab 12 3 Productions: T bab T 1 Terminals: B cc B 1 T c T 2 B ab B 2 T a T 3 B ab B 3 a, b, c, 1, 2, 3 (CFG) Variables: S, T, B S T | B T bab1 B cc1 T c2 B ab2 T a3 B ab3

10
Undecidable problems for CFGs EQ CFG = { : G 1 and G 2 are two CFGs that describe the same language} Is it decidable?

11
Undecidable problems for CFGs EQ CFG = { : G 1 and G 2 are two CFGs that descript the same language} EQ CFG is undecidable. Same idea as EQ TM If EQ CFG is decidable, ALL CFG is also decidable. Let G 1 to be a CFG that generates all inputs.

12
Undecidable problems for CFGs EQ CFG = { : G 1 and G 2 are two CFGs that descript the same language} If EQ CFG is decidable, there exists a TM H such that string H(string, string ) { if G 1 and G 2 are equal, return accept; if G 1 and G 2 are not equal, return reject; } Let G 1 to be a CFG that generates all inputs. We construct U as follows string U(string ) { G 1 := a CFG that generates all inputs // hardcode return H(G 1, G); } Given a CFG, U( ) returns accept if G generates all strings, rejects if G does not. Hence ALL CFG is decidable. Contradiction.

13
Post Correspondence Problem PCP 1 : PCP over the alphabet = {1}. – The alphabet of a tile is the set of symbols that appear on the tiles. Is PCP 1 decidable?

14
Post Correspondence Problem PCP 1 : PCP over the alphabet = {1}. – The alphabet of a tile is the set of symbols that appear on the tiles. PCP 1 is decidable. 3 – 1 = 2 2 – 5 = -3 Find x, y such that 2x – 3y = 0. Easy. If exists two tiles like above, accept. Otherwise reject

15
Post Correspondence Problem PCP 2 : PCP over the alphabet = {0, 1}. – The alphabet of a tile is the set of symbols that appear on the tiles. Is PCP 2 decidable?

16
Post Correspondence Problem PCP 2 : PCP over the alphabet = {0, 1}. – The alphabet of a tile is the set of symbols that appear on the tiles. PCP 2 is undecidable. If PCP 2 is decidable, then PCP is also decidable. Represent the alphabet in PCP in binary form.

17
End Questions?

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google