Starting files are available from my public cs46 folder
cd ~/cs46/
cp -r examples/homework/wk4 homework/
git status
git add homework/wk4
git commit -m "week4 start"
git push
You may work with a partner and submit a common solution on this homework.
In lab practice
- A homomorphism is a function $f: \Sigma \mapsto \Gamma^*$ from one alphabet to strings over another alphabet. We can extend $f$ to operate on strings by definine $f(w) = f(w_1)f(w_2)\cdots f(w_n)$, where $w=w_1w_2\cdots w_n$ and each $w_i \in \Sigma$. We can also extend $f$ to operate on a language by defining $f(A) = \{ f(w) | w \in A \}$ for a language $A$.
- Describe a construction that shows the class of regular languages is closed under homomorphism. Given a DFA $M$ for $A$, and a homomorphism $f$, construct $M'$ that recognizes $f(A)$.
- If $M$ is a DFA is $M'$ also a DFA?
- Show that non-regular languages are not closed under homomorphism.
- Many programming languages use braces $\{ \}$ , and parentheses $()$ to group functions, blocks, classes, etc. These braces and parentheses must be balanced in the sense that you cannot have a closing brace without a previous matching opening brace, and all open braces must eventually have a matching closing brace. Design a context free grammar that generates balanced statements containing braces and parentheses. The following examples are legal: ()(); (({}){}{{}}); {}(), but (( and (} are not.
- Are the following statements true or false?
- Every subset of a regular language is regular
- Every regular language has a regular proper subset
- If $L$ is regular, then so is $\{ xy: x \in L, y \not \in L \}$
- $\{w : w =w^R \}$ is regular
- If $L$ is a regular language then so is $\{w: w \in L \text{ and } w^R \in L\}$
- $\{ xyx^R: x,y \in \Sigma^* \}$ is regular
Remember to run git add, git commit, and git push to submit your assignments. If you are working with a partner, both you and your partner need to hand in the lab, but I will grade the most recent push. Include both names at the top of your homework.