On this page:
1 Fun With Regular Expressions
2 Fun With Induction
3 Reversing Strings
4 Another Closed Operation

Homework 3

Last updated: Tue, 15 Feb 2022 19:57:42 -0500

Out: Mon Feb 14, 00:00 EST Due: Sun Feb 20, 23:59 EST

This assignment explores regular expressions.

Homework Problems

  1. Fun With Regular Expressions (5 points)

  2. Fun With Induction (6 points)

  3. Reversing Strings (4 6 points)

  4. Another Closed Operation (10 points)

  5. README (1 point)

Total: 26 28 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{x},\texttt{y},\texttt{z}\right\}):
  1. \left\{\right\}

  2. \left\{\varepsilon\right\}

  3. \left\{\texttt{xy},\texttt{yz}\right\}

  4. \left\{w\mid w\textrm{ contains the substring }\texttt{xyz}\right\}

  5. \left\{w\mid w\textrm{ is a string that starts and ends with the same symbol}\right\}

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

2 Fun With Induction

Prove that the following statement is true, for z\neq 1:

\sum_{i=0}^m z^i=\frac{1-z^{m+1}}{1-z}

Use induction on one of the natural numbers in the equation.

Make sure to clearly state all the necessary components of such a proof, including:
  1. which value the induction is "on",

  2. base case(s),

  3. and inductive case(s) (where each includes an inductive hypothesis)

In addition, each case should clearly state:
  1. the subgoal that needs to be proved in that case,

  2. and a proof of that subgoal that is a step-by-step derivation, starting from a known definition or theorem, and ending in the desired goal, along with a justification for why each step is valid.

3 Reversing Strings

This problem has two parts:

4 Another Closed Operation

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

\mathrm{REV}(A) = \left\{w\mid w = \mathrm{rev}(x),\textrm{ for some }x\in A\right\}

Use regular expressions and proof by induction.