2.4-2.9

2.4-2.9 - Solution to CS243 Assignment3 1. Text (Sipser,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Solution to CS243 Assignment3 1. Text (Sipser, second edition) Chapter 2 (p.128) 2.4 2.4b S 0 | 1 | 0R0 | 1R1 R 0R | 1R | ε 2.4c S 0T | 1T T 0S | 1S | ε 2.4e S ε | 0 | 1 | 0S0 | 1S1 2.4f (V, , Φ , S), where V={S}, and = {0,1} 2. Text (Sipser, second edition) Chapter 2 (p.129) 2.6bd 2.6b S R | T | W W ba | XW | WX (out of order) X b | a R a | aR | aRb (in order, but more a) T b | Tb | aTb (in order, but more b) 2.6d S R#Y | Y#R | Y Y ε | a | b | aYa | bYb | a#R#a | b#R#b (x i = x j R occurs in Y) R R#X | X (any number of strings) X aX | bX | ε (any string) 3. Text (Sipser, second edition) Chapter 2 (p.129) 2.9 S AR | TC A aA | ε C cC | ε R bRc | ε T aTb | ε This CFG is ambiguous. It has two derivation for abc: abc abc | | A R T C / \ / \ aR bRc aTb cC | | | | ε ε ε ε
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4. Text (Sipser, second edition) Chapter 2 (p.130) 2.20 Proof idea: Let N B be the NFA for the language B. We can construct the following PDA to recognize A\B. This PDA non-deterministically enters N B , and move within N B based on what is on the stack top: (1) if it’s a symbol a, then move to q k = δ B (q i ,a); (2) if it’s a variable V, then replace the stack top with string y, based on rules specified in the CFG of language A. It can be seen that if the PDA end up in the accept state for input string w, there must exist a
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/07/2011 for the course CS 501 taught by Professor Sm during the Spring '11 term at Indiana.

Page1 / 4

2.4-2.9 - Solution to CS243 Assignment3 1. Text (Sipser,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online