1 / 17

CSCI 3130: Formal languages and automata theory Tutorial 9

CSCI 3130: Formal languages and automata theory Tutorial 9. Chin. Reminder. Homework 5 is due at next Tuesday! No tutorial next week! :D This is the last one. Undecidable problems for CFGs. ALL CFG = {< G> : G is a CFG that generates all strings} ALL CFG is undecidable Reduction

galia
Download Presentation

CSCI 3130: Formal languages and automata theory Tutorial 9

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 3130: Formal languagesand automata theoryTutorial 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 • ALLCFG = {<G>: G is a CFG that generates all strings} • ALLCFG is undecidable • Reduction • ATM = {<M, w>: M is a TM that does not accept w} = {<M, w>: M rejects or loops on input w} • ATM is unrecognizable ⇒ ATM is undecidable • If ALLCFG is decidable then ATM is decidable. • Contradiction.

  4. Undecidable problems for CFGs • ALLCFG = {<G>: G is a CFG that generates all strings} • ALLCFG is undecidable • Suppose it is decidable, then there exists a universal TM H string H(string <G>) { // 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 <M> and w) string U(string <M>, string w){ If M does not accept w, return <G> that generates all strings If M accepts w, return <G> that does not generate all strings } • If we can simulate H(U(<M>,w)), then U decides ATM and so ATM is decidable.

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

  6. Undecidable problems for CFGs • Computation history • #q0ab%ab#xq1b%ab# . . . #xx%xx☐qa# • Each #xxxxxx# tells you the configuration of the TM in each step qacc q1 … … a a b b a b ☐ ☐ abq1a a/bR q1 qacc abbqacc

  7. Undecidable problems for CFGs • Computation history • Suppose the current configuration is #xbq1xab# • What does the next configuration look like? • The head must be one symbol left or one symbol right #xbq1xab# • 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 <G>.

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

  9. Undecidable problems for CFGs T G (CFG) (collection of tiles) a, b, c, 1, 2, 3 Terminals: Variables: S, T, B 1 2 3 Productions: bab cc c ab a ab T → cT2 T → aT3 S → T | B T → babT1 T → c2 T → a3 T → bab1 B → abB2 B → abB3 B → ccB1 B → ab2 B → ab3 B → cc1

  10. Undecidable problems for CFGs • EQCFG= {<G1, G2>: G1and G2 are two CFGs that describe the same language} • Is it decidable?

  11. Undecidable problems for CFGs • EQCFG = {<G1, G2>: G1 and G2 are two CFGs that descript the same language} • EQCFG is undecidable. • Same idea as EQTM • If EQCFG is decidable, ALLCFG is also decidable. • Let G1 to be a CFG that generates all inputs.

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

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

  14. Post Correspondence Problem • PCP1 : PCP over the alphabet S = {1}. • The alphabet of a tile is the set of symbols that appear on the tiles. • PCP1 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. 111 1 11 11111

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

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

  17. End • Questions?

More Related