fundamentele informatica 3
play

Fundamentele Informatica 3 voorjaar 2014 A slide from lecture 6 - PDF document

Fundamentele Informatica 3 voorjaar 2014 A slide from lecture 6 http://www.liacs.nl/home/rvvliet/fi3/ Definition 8.10. Unrestricted grammars Rudy van Vliet An unrestricted grammar is a 4-tuple G = ( V, , S, P ), where V kamer 124 Snellius,


  1. Fundamentele Informatica 3 voorjaar 2014 A slide from lecture 6 http://www.liacs.nl/home/rvvliet/fi3/ Definition 8.10. Unrestricted grammars Rudy van Vliet An unrestricted grammar is a 4-tuple G = ( V, Σ , S, P ), where V kamer 124 Snellius, tel. 071-527 5777 and Σ are disjoint sets of variables and terminals, respectively, rvvliet(at)liacs(dot)nl S is an element of V called the start symbol, and P is a set of productions of the form college 7, 24 maart 2014 α → β where α, β ∈ ( V ∪ Σ) ∗ and α contains at least one variable. 8. Recursively Enumerable Languages 8.3. More General Grammars 8.4. Context-Sensitive Languages and The Chomsky Hierarchy 1 2 A slide from lecture 6 A slide from lecture 6 Theorem 8.13. Definition 8.16. Context-Sensitive Grammars For every unrestricted grammar G , there is a Turing machine T A context-sensitive grammar (CSG) is an unrestricted grammar with L ( T ) = L ( G ). in which no production is length-decreasing. In other words, every production is of the form α → β , where | β | ≥ | α | . Proof. 1. Move past input 2. Simulate derivation in G on the tape of a Turing machine A language is a context-sensitive language (CSL) if it can be 3. Equal generated by a context-sensitive grammar. 3 4 A slide from lecture 6 Definition 8.18. Linear-Bounded Automata A linear-bounded automaton (LBA) is a 5-tuple M = ( Q, Σ , Γ , q 0 , δ ) that is identical to a nondeterministic Turing machine, with the A slide from lecture 6 following exception. Theorem 8.19. If L ⊆ Σ ∗ is a context-sensitive language, then there is a linear- There are two extra tape symbols [ and ], assumed not to be elements of the tape alphabet Γ. bounded automaton that accepts L . The initial configuration of M corresponding to input x is q 0 [ x ], with the symbol [ in the leftmost square and the symbol ] in the Proof. . . first square to the right of x . During its computation, M is not permitted to replace either of these brackets or to move its tape head to the left of the [ or to the right of the ]. 5 6 Theorem 8.14. A slide from lecture 6 For every Turing machine T with input alphabet Σ, there is an unrestricted grammar G generating the language L ( T ) ⊆ Σ ∗ . 8.4. Context-Sensitive Languages and the Chomsky Hierarchy Proof. reg. languages reg. grammar FA reg. expression 1. Generate (every possible) input string for T (two copies), determ. cf. languages DPDA with additional (∆∆)’s and state. cf. languages cf. grammar PDA 2. Simulate computation of T for this input string as derivation cs. languages cs. grammar LBA in grammar (on second copy). re. languages unrestr. grammar TM 3. If T reaches accept state, reconstruct original input string. 7 8

  2. A slide from lecture 3 Notation: description of tape contents: xσy or xy b/b ,R b, b ,R ✓✏ ✓✏ ✬✩ ✬✩ ✬✩ ✬✩ ✬✩ configuration xqy = xqy ∆ = xqy ∆∆ ❄ ❄ ∆ / ∆,R a/ $,L $ / $,R ∆ / ∆,S q 0 q 1 q 2 q 3 h a ✲ ✲ ✲ ✲ ✲ ✫✪ ✫✪ ✫✪ ✫✪ ✫✪ initial configuration corresponding to input x : q 0 ∆ x In the third edition of the book, a configuration is denoted as ( q, xy ) or ( q, xσy ) instead of xqy or xqσy . This old notation is also allowed for Fundamentele Informatica 3. 9 10 Theorem 8.14. For every Turing machine T with input alphabet Σ, there is an unrestricted grammar G generating the language L ( T ) ⊆ Σ ∗ . Proof. If L ⊆ Σ ∗ is accepted by a linear-bounded Theorem 8.20. 1. Generate (every possible) input string for T (two copies), with additional (∆∆)’s and state. automaton M = ( Q, Σ , Γ , q 0 , δ ), then there is a context-sensitive 2. Simulate computation of T for this input string as derivation grammar G generating L − { Λ } . in grammar (on second copy). 3. If T reaches accept state, reconstruct original input string. Proof. . . Ad 2. Move δ ( p, a ) = ( q, b, R ) of T yields production p ( σ 1 a ) → ( σ 1 b ) q Ad 3. Propagate h a all over the string h a ( σ 1 σ 2 ) → σ 1 , for σ 1 ∈ Σ h a (∆ σ 2 ) → Λ 11 12 A slide from lecture 6 If L ⊆ Σ ∗ is accepted by a linear-bounded Theorem 8.20. automaton M = ( Q, Σ , Γ , q 0 , δ ), then there is a context-sensitive 8.4. Context-Sensitive Languages grammar G generating L − { Λ } . and the Chomsky Hierarchy Proof. Much like proof of Theorem 8.14, except reg. languages reg. grammar FA reg. expression • consider h a ( σ 1 σ 2 ) as a single symbol determ. cf. languages DPDA • no additional (∆∆)’s needed cf. languages cf. grammar PDA • incorporate [ and ] in leftmost/rightmost symbols of string cs. languages cs. grammar LBA re. languages unrestr. grammar TM 13 14 Chomsky hierarchy 3 reg. languages reg. grammar FA reg. expression Theorem 8.22. Every context-sensitive language L is recursive. 2 cf. languages cf. grammar PDA 1 cs. languages cs. grammar LBA Proof. . . 0 re. languages unrestr. grammar TM What about recursive languages? 15 16

  3. Theorem 8.22. Every context-sensitive language L is recursive. A slide from lecture 6 Proof. Theorem 8.19. Let CSG G generate L If L ⊆ Σ ∗ is a context-sensitive language, then there is a linear- Let LBA M accept strings generated by G (as in Theorem 8.19) bounded automaton that accepts L . Simulate M by NTM T , which Proof. • inserts markers [ and ] 1. Create second tape track • also has two tape tracks 2. Simulate derivation in G on track 2: • maintains list of (different) strings generated so far Write S on track 2 Repeat a. Select production α → β a. Select production α → β b. Select occurrence of α on track 2 (if there is one) b. Select occurrence of α on track 2 (if there is one) c. Try to replace occurrence of α by β c. Try to replace occurrence of α by β d. Compare new string to strings to the right of ] until b. fails (caused by . . . ) until b. fails (caused by . . . ); then Equal or c. fails (caused by . . . ); then reject or c. fails (caused by . . . ); then reject 3. Equal or d. finds match; then reject 17 18 Chomsky hierarchy A slide from lecture 5 3 reg. languages reg. grammar FA reg. expression Corollary. 2 cf. languages cf. grammar PDA 1 cs. languages cs. grammar LBA If L is accepted by a nondeterministic TM T , and if there is no 0 re. languages unrestr. grammar TM input string on which T can possibly loop forever, then L is recursive. S 3 ⊆ S 2 ⊆ S 1 ⊆ R ⊆ S 0 Proof. . . (modulo Λ) 19 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend