On this page:
1 Practice:   Closure Property of Regular Languages
2 NFAs vs PDAs
3 A Regular Language is also a Context-Free Language?
4 CFL Closure Property

Homework 6

Last updated: Sun, 19 Mar 2023 22:49:19 -0400

Out: Mon Mar 20, 00:00 EST Due: Sun Mar 26, 23:59 EST

This assignment continues to explore context-free languages.

Homework Problems

  1. Practice: Closure Property of Regular Languages (8 points)

  2. NFAs vs PDAs (8 points)

  3. A Regular Language is also a Context-Free Language? (4 + 4 + 4 = 12 points)

  4. CFL Closure Property (6 points)

  5. README (1 point)

Total: 35 points

Submitting

Submit your solution to this assignment in Gradescope hw6. Please assign each page to the correct problem and make sure your solutions are legible.

A submission must also include a README containing the required information.

1 Practice: Closure Property of Regular Languages

Prove that the set of regular languages is closed for the \mathrm{OP3} operation from the Practice: Another Operation on a Language problem in Homework 4.

Specifically,
  • Give the formal statement that must be proved.

  • Give the proof in the form of a statements and justifications table. You proof must use the DFA representation of a regular language, and must use the \hat{\delta} function for that DFA.

2 NFAs vs PDAs

  1. Explain two differences between the formal description of an NFA and the formal description of a PDA.

  2. Two machines are considered equivalent if they recognize the same language (i.e., they accept the same strings).

    Come up with a function \texttt{n2p} : \texttt{NFA} \rightarrow \texttt{PDA} where, given an input NFA that satisfies the formal definition of NFAs from class, e.g., N = (Q_N,\Sigma,\delta_N,q_N,F_N), \texttt{n2p} produces a PDA that satisfies the formal definition of PDAs, e.g., P = (Q_P,\Sigma,\Gamma,\delta_P,q_P,F_P), that is equivalent to the input NFA.

3 A Regular Language is also a Context-Free Language?

Any regular language is also a context-free language!

Give three proofs of this statement, with each one using one of the three representations of regular languages that we have studied: DFAs, NFAs, and regular expressions.

Also, each proof must use the \texttt{n2p} function from the NFAs vs PDAs Problem above. You may also use any other conversion functions we have previously defined, either in lecture, or from previous hws.

4 CFL Closure Property

Choose any operation on languages that we have studied this semester.

Prove that CFLs are closed under that operation.

(Note: For some of the operations we have studied, CFLs are not closed for those operations, so choose carefully).