Problem 1

Yes. There are many examples in the textbook.

Problem 2

  S ↠ C ↠ LCR ↠ aCR
  ↠ aLCRR ↠ aaCRR
  ↠ aaCCRR ↠ aaLCRCRR ↠ aaaCRCRR
  ↠ aaaRCRR ↠ aaabCRR
  ↠ aaabLCRRR ↠ aaabaCRRR
  ↠ aaabaRRR ↠ aaababRR
  ↠ aaababbR
  ↠ aaababbb

Problem 3

Like ((()())) where ( is a and ) is b.

Problem 4



Problem 5

Step 0 — The beginning

   S  → TT | U
   T  → 0T | T0 | #
   U  → 0U00 | #

Step 1 — Adding rule for S0

   S0 → S
   S  → TT | U
   T  → 0T | T0 | #
   U  → 0U00 | #

This step isn’t necessary because S does not appear on the LHS of any rule, but this isn’t mentioned in the book.

Step 2

Remove ε-rules.

There aren’t any. See CFS to CNF for a example.

Step 3

Remove unit rules. There are only two unit rules: S0→S and S→U. Replace the targets of the unit rules with the LHS of rules where the single terminal variable is the RHS. In particular, copy the targets of S to S0 and of U to S. Also, remove the target of the unit.

   S0 → TT | 0U00 | #
   S  → TT | 0U00 | #
   T  → 0T | T0 | #
   U  → 0U00 | #

Step 4α

Add variables as needed to get rid of the rules that are not in the proper Chomsky form. We will use Z for 0, M for 0U, and N for M0 (0U0). See the book (page 111) for more information

   S0 → TT | NZ | #
   S  → TT | NZ | #
   T  → ZT | TZ | #
   Z  → 0
   M  → ZU    
   N  → MZ

Problem 6

Problem 7

  S  → 0A
  A  → 0A | B
  B  → 1C
  C  → 1D
  D  → ε | 0D

Problem 8

Step 0 — The beginning

   S  → aSa | bSb | C
   C  → a | b | ε

Step 1 — Adding rule for S0

   S0 → S
   S  → aSa | bSb | C
   C  → a | b | ε

Step 2

Remove ε-rules.

First remove the C ε-rule. And fix S to deal with the problem.

   S0 → S
   S  → aSa | bSb | aa | bb | ε
   C  → a | b

Next remove the S ε-rule. This will slightly complicate the S0 rules. But, it is OK for S0 to have an ε-rule.

   S0 ⇒ S | ε
   S  ⇒ aSa | bSb | aa | bb
   C  ⇒ a | b

Step 3

Deal with the unit rule S0 ⇒ S.

   S0 ⇒ aSa | bSb | aa | bb | ε
   S  ⇒ aSa | bSb | aa | bb
   C  ⇒ a | b

Step 4α

Add variables as needed to get rid of the rules that are not in the proper Chomsky. We will use A for a, B for b, X for AS and Y for BS.

   S0 → XA | YB | AA | BB | ε
   S  → XA | YB | AA | BB
   C  → a | b
   X  → AS
   Y  → BS
   A  → a
   B  → b

Problem 9

  S0 ⇒ YB ⇒ BSB ⇒ bSB
  ⇒ bXAB ⇒ bASAB ⇒ baSAB
  ⇒ baaaAB
  ⇒ baaaaB
  ⇒ baaaab

Problem 10

Problem 11

Palindrome of letters a and b.

Problem 12

PDA for Problem 8 — plain CFG or Chomsky CFG. Maybe draw on board.

Problem 13

Omit.

Problem 14

Omit.