Problème 1.

Give regular expression for the languages bellow

1.a

L={anbm(n+m)%2=0}L = \{ a^nb^m \mid (n+m) \% 2 = 0 \}
L=(aa)(bb)+a(aa)b(bb)L = (aa)^*(bb)^* + a(aa)^*b(bb)^*

1.b

L={ww does not contain the substring: aba}L = \{ w \mid w \text{ does not contain the substring: } aba \}
L=b+ba+b+b(ab+)abL = b^* + b^*a^+b^* + b^*(ab^+)^*ab^*

1.c

L={ww has an even number of bs}L = \{ w \mid w \text{ has an even number of } b' \text{s}\}
L=a+ababaL = a^* + a^*ba^*ba^*

Problème 2.

Minimize the number of states in this DFA via quotient construction. Show all your steps, specifically in your table where you are “marking” nodes indicate which iteration you marked them on.

Final states {0,3}\{ 0, 3 \}, and non-final states are {1,2,4,5,6,7,8,9}\{ 1, 2, 4, 5, 6, 7, 8, 9 \}

Initial table with all pairs:

      0 1 2 3 4 5 6 7 8 9
    ---------------------
0   |   *       * *
1   | *   *       *
2   |   *   *       *
3   |     *   *       *
4   |       *   *     *
5   | *       *   *   * *
6   | * *       *   *   *
7   |     *       *   * *
8   |       * * *   *   *
9   |           * * * *

Mark based on final/non-final states:

      0 1 2 3 4 5 6 7 8 9
    ---------------------
0   |   ✓       ✓ ✓
1   | ✓
2   |       ✓
3   |     ✓   ✓       ✓
4   |       ✓
5   | ✓
6   | ✓
7   |
8   |       ✓
9   |

first iteration.

{0,2} -(a) {1,3}: not marked {0,2} -(b) {6,7}: not marked {0,3} -(a) {1,4}: not marked {0,3} -(b) {6,8}: not marked {0,4} -(a) {1,5}: not marked {0,4} -(b) {6,8}: not marked {0,7} -(a) {1,9}: not marked {0,7} -(b) {6,8}: not marked {0,8} -(a) {1,9}: not marked {0,8} -(b) {6,5}: not marked {0,9} -(a) {1,7}: not marked {0,9} -(b) {6,6}: not marked

      0 1 2 3 4 5 6 7 8 9
    ---------------------
0   |   ✓       ✓ ✓
1   | ✓
2   |       ✓
3   |     ✓   ✓       ✓
4   |       ✓
5   | ✓
6   | ✓
7   |
8   |       ✓
9   |

second iteration.

{1,2} -(a) {2,3}: marked so we mark {1,2} {1,5} -(a) {2,0}:

      0 1 2 3 4 5 6 7 8 9
    ---------------------
0   |   ✓       ✓ ✓
1   | ✓
2   |   x   ✓
3   |     ✓   ✓       ✓
4   |       ✓
5   | ✓
6   | ✓
7   |
8   |       ✓
9   |

sorry I gave up

Problème 3.

Your friend is looking at the formal definition of the pumping lemma and they think something is wrong

L is regular     (kk>0:(x,y,zxyzLy>k:(u,v,wy=uvwvϵ:(ii0:xuviwzL))))L \text{ is regular } \implies (\exists k \mid k>0: (\forall x,y,z \mid xyz \in L \land |y| > k: ( \exists u,v,w \mid y=uvw \land v \neq \epsilon: (\forall i | i \geq 0: xuv^iwz \in L))))

They understand the argument it is crafted around, that is, due to the fact that strings are arbitrarily long and a DFA has finite states there must be a segment of accepted strings which “loop” in the machine. However, they claim for the pumping lemma above to hold, LL must be infinite, because if LL was finite the argument about “looping” no longer holds. Therefore, the pumping lemma only holds when LL is infinite.

You can see where your friend is coming from, but they are incorrect. Why? Be precise in your argument, that is, show how if LL is finite, then

(kk>0:(x,y,zxyzLy>k:(u,v,wy=uvwvϵ:(ii0:xuviwzL))))(\exists k \mid k > 0: (\forall x,y,z \mid xyz \in L \land |y| > k: ( \exists u,v,w \mid y=uvw \land v \neq \epsilon: (\forall i | i \geq 0: xuv^iwz \in L))))

evaluates to true. (hint: If LL is finite, there is a “longest string”)

Solution

Let \ell be the length of the longest string in LL. We can choose a pumping length kk such that k=+1k \geq \ell = \ell+1.

Now let’s evaluate the following statement

(x,y,zxyzLy>k:(u,v,wy=uvwvϵ:(ii0:xuviwzL)))(\forall x,y,z \mid xyz \in L \land |y| > k: ( \exists u,v,w \mid y=uvw \land v \neq \epsilon: (\forall i | i \geq 0: xuv^iwz \in L)))

Since k>k > \ell, there doesn’t exist a string xyzLxyz \in L such that y>k|y| > k. Therefore, antecendent of the implication xyzLy>pxyz \in L \land |y| > p is always false.

Therefore, the entire inner implication is vacuously true, and the entire statement is true. Therefore, the pumping lemma holds for finite languages.

Problème 4.

Using the Pumping Lemma, prove the following languages are not regular. Make your steps in the “game” and variable choices very clear for each question.

Pumping Lemma

There exists a pumping length pp such that sL,sp\forall s \in L, |s| \geq p, we can write s=xyzs = xyz such that

i. y>0|y| > 0

ii. xyp|xy| \leq p

iii. i0,xyizL\forall i \geq 0, xy^iz \in L

4.a

L={anmbmann,m0}L = \{ a^{nm}b^ma^n \mid n,m \geq 0 \}

Assume LL is regular.

Let s=ap2bpaps = a^{p^2}b^pa^p. sLs \in L since choosing n=p,m=pn=p,m=p, and s=p2+2pp|s|=p^2+2p \geq p for p1p \geq 1.

By the pumping lemma, we can write s=xyzs=xyz satisfying conditions i) and iii). Since xyp|xy| \leq p, yy must consist of only aa‘s. Let y=aky = a^k for 1kp1 \leq k \leq p.

Consider string xy0z=xz=ap2kbpapxy^0z = xz = a^{p^2-k}b^pa^p. From condition iii), this must be in LL.

However, xzxz has the first block of aa to length p2kp^2-k and last block of length pp. To be in LL, we must have p2k=pmp^2-k=p \cdot m for some integer mm. But p2k>pp^2-k>p for p2p \geq 2, so there is no such mm exists, which means xzLxz \notin L.

Thus, it contradicts the pumping lemma, and LL is not regular. \square

4.b

L={wwwΣ}L = \{ww \mid w \in \Sigma^*\}

Assume LL is regular.

Let s=apbpapbps = a^pb^pa^pb^p. sLs \in L since chos\sin g w=apbpw=a^pb^p and s=4pp|s|=4p \geq p for p1p \geq 1.

By pumping lemma, we can write s=xyzs=xyz satisfying conditions i) and iii). Since xyp|xy| \leq p, yy must consist of only aa‘s. Let y=aky = a^k for 1kp1 \leq k \leq p.

Consider the string xy2z=xakyakbpapbpxy^2z = xa^kya^kb^pa^pb^p. By condition iii) of the pumping lemma, this must be in LL.

However, xy2zxy^2z to be in LL, it must be the for of wwww for some wΣw \in \Sigma^*. But the first half of xy2zxy^2z is ap+kbpa^{p+k}b^p and the second half is apbpa^pb^p. Since kpk \leq p. So xy2zLxy^2z \notin L.

Thus, it contradicts the pumping lemma, and LL is not regular. \square

4.c

L={ak3k0}L = \{ a^{k^3} \mid k \leq 0 \}

Assume LL is regular.

Let s=ap3s = a^{p^3}. sLs \in L since choosing k=pk=p, and s=p3p|s|=p^3 \geq p for p1p \geq 1.

By the pumping lemma, we can write s=xyzs=xyz satisfying conditions i) and iii). Since xyp|xy| \leq p, yy must consist of only aa‘s. Let y=aky = a^k for 1kp1 \leq k \leq p.

Consider the string xy2z=xakyakz=ap3+kxy^2z = xa^kya^kz = a^{p^3+k}. By condition iii) of the pumping lemma, this must be in LL.

However, xy2zxy^2z to be in LL, it must be of the form ak3a^{k^3} for some k0k \leq 0. p3<p3+k<(p+1)3p^3 < p^3+k < (p+1)^3, which means p3+kp^3+k is not a perfect cube, so xy2zLxy^2z \notin L.

Thus, it contradicts the pumping lemma, and LL is not regular. \square