On this page:
1 Fun With Regular Expressions
2 Practice:   Proving An Operation Closed For Regular Languages
3 Converting Strings To a Different Alphabet
4 Caesar Cipher - Closed?

Homework 3

Last updated: Mon, 10 Oct 2022 16:36:45 -0400

Out: Mon Oct 03, 00:00 EST Due: Sun Oct 09, 23:59 EST

This assignment explores regular expressions.

Homework Problems

  1. Fun With Regular Expressions (5 points)

  2. Practice: Proving An Operation Closed For Regular Languages (6 points)

  3. Converting Strings To a Different Alphabet (4 + 4 = 8 points)

  4. Caesar Cipher - Closed? (10 points)

  5. README (1 point)

Total: 30 points

Submitting

Submit your solution to this assignment in Gradescope hw3. 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 Fun With Regular Expressions

Come up with regular expressions for the following languages (whose strings use alphabet \Sigma = \left\{\texttt{a},\texttt{b}\right\}):
  1. \left\{\texttt{aab},\texttt{abb}\right\}

  2. \left\{x\mid x\textrm{ contains }\texttt{aaa}\textrm{ somewhere in the string }\right\}

  3. \left\{x\mid x\textrm{ is a string that both starts and ends with \texttt{a}}\right\}

  4. \left\{\varepsilon\right\}

  5. \emptyset

If you wish, you may additionally use the following regular expression abbreviations:

2 Practice: Proving An Operation Closed For Regular Languages

Show that the following operation, \mathrm{OP2}, is closed for regular languages:

\mathrm{OP2}(L) = \left\{w\mid L \textrm{ does not contain } w\right\}

3 Converting Strings To a Different Alphabet

4 Caesar Cipher - Closed?

A Caesar cipher is a basic encryption algorithm.

It’s essence can be represented by the \mathrm{map} :\Sigma_1\rightarrow\Sigma_2 and \mathrm{map}_{str}:\Sigma_1^*\rightarrow\Sigma_2^* functions from problem Converting Strings To a Different Alphabet.

Now let’s extend the mapping to languages. Specifically, define a function \mathrm{map}_{lang}:

\mathrm{map}_{lang}(L) = \left\{\mathrm{map}_{str}(w)\mid w\in L\right\}

Prove that \mathrm{map}_{lang} is closed for regular languages.