Line 25: Line 25:
  
 
===8.  $L = \{wxw_R| w,x ∈ \{{a,b}\}^+\}$===
 
===8.  $L = \{wxw_R| w,x ∈ \{{a,b}\}^+\}$===
<math>L</math> is regular. <math>L</math> contains all strings starting and ending with <math>a</math> or starting and ending with <math>b</math> and containing at least 3 letters. Moreover, <math>L</math> doesn't contain any other strings. Thus <math>L</math> can be accepted by a <math>DFA</math>.
+
<math>L</math> is regular. <math>L</math> contains all strings starting and ending with <math>a</math> or starting and ending with <math>b</math> and containing at least 3 letters. Moreover, <math>L</math> doesn't contain any other strings. Thus <math>L</math> can be accepted by a <math>DFA</math>. Regular expression for L is a(a+b)^+a + b(a+b)^+b

Revision as of 20:52, 8 February 2014

1. $L = \{wxw | w,x ∈ \{{a,b}\}^*\} $

Here, <math>L</math> contains all strings in <math>\Sigma^*</math>, by making <math>x = (a+b)^*</math> and <math>w = \epsilon</math>. Hence, <math>L</math> is regular.


2. $L = \{wxw| w,x ∈ \{{a,b}\}^+\}$

Here, <math>L</math> doesn't contain all strings in <math>\Sigma^*</math> as the strings like <math>abab</math> are not contained in <math>L</math>. We can see all words starting and ending in <math>a</math> or starting and ending in <math>b</math> are in <math>L</math>. But <math>L</math> also contains words starting with <math>a</math> and ending in <math>b</math> like <math>abbab, aabbbabaab</math> etc where the starting sub-string exactly matches the ending sub-string and at least a letter separates them. To accept such strings we need at least an <math>LBA</math> (this is at least as hard as accepting <math>ww, w \in (a+b)^*</math>), making <math>L</math>, a <math>CSL</math>.

3. $L = \{ww| w ∈ \{{a,b}\}^*\}$

<math>L</math> is <math>CSL</math> as with a <math>PDA</math> we cannot accept <math>ww</math>. <math>PDA</math> is using only a stack and hence it can accept <math>ww_R</math> but not <math>ww</math>.

4. $L = \{ww| w ∈ \{{a,b}\}^+\}$

Same explanation as above, <math>L</math> is <math>CSL</math>

5. $L = \{ww_R| w ∈ \{{a,b}\}^*\}$

ww_R can be accepted by a PDA and hence is CFL. But we need a NPDA for this as there is no deterministic way to identify when w ends and w_R starts. wcw_R, w\in(a+b)^* and c\in{a,b} is accepted by a DPDA and hence is DCFL.

6. $L = \{ww_R| w ∈ \{{a,b}\}^+\}$

Same explanation as above. <math>L</math> is <math>CFL</math>.

7. $L = \{wxw_R| w,x ∈ \{{a,b}\}^*\}$

<math>L</math> is regular. Since, <math>w</math> can be <math>\epsilon</math> and <math>x \in (a+b)^*, L =\Sigma^*</math>.

8. $L = \{wxw_R| w,x ∈ \{{a,b}\}^+\}$

<math>L</math> is regular. <math>L</math> contains all strings starting and ending with <math>a</math> or starting and ending with <math>b</math> and containing at least 3 letters. Moreover, <math>L</math> doesn't contain any other strings. Thus <math>L</math> can be accepted by a <math>DFA</math>. Regular expression for L is a(a+b)^+a + b(a+b)^+b

1. $L = \{wxw | w,x ∈ \{{a,b}\}^*\} $

Here, <math>L</math> contains all strings in <math>\Sigma^*</math>, by making <math>x = (a+b)^*</math> and <math>w = \epsilon</math>. Hence, <math>L</math> is regular.


2. $L = \{wxw| w,x ∈ \{{a,b}\}^+\}$

Here, <math>L</math> doesn't contain all strings in <math>\Sigma^*</math> as the strings like <math>abab</math> are not contained in <math>L</math>. We can see all words starting and ending in <math>a</math> or starting and ending in <math>b</math> are in <math>L</math>. But <math>L</math> also contains words starting with <math>a</math> and ending in <math>b</math> like <math>abbab, aabbbabaab</math> etc where the starting sub-string exactly matches the ending sub-string and at least a letter separates them. To accept such strings we need at least an <math>LBA</math> (this is at least as hard as accepting <math>ww, w \in (a+b)^*</math>), making <math>L</math>, a <math>CSL</math>.

3. $L = \{ww| w ∈ \{{a,b}\}^*\}$

<math>L</math> is <math>CSL</math> as with a <math>PDA</math> we cannot accept <math>ww</math>. <math>PDA</math> is using only a stack and hence it can accept <math>ww_R</math> but not <math>ww</math>.

4. $L = \{ww| w ∈ \{{a,b}\}^+\}$

Same explanation as above, <math>L</math> is <math>CSL</math>

5. $L = \{ww_R| w ∈ \{{a,b}\}^*\}$

ww_R can be accepted by a PDA and hence is CFL. But we need a NPDA for this as there is no deterministic way to identify when w ends and w_R starts. wcw_R, w\in(a+b)^* and c\in{a,b} is accepted by a DPDA and hence is DCFL.

6. $L = \{ww_R| w ∈ \{{a,b}\}^+\}$

Same explanation as above. <math>L</math> is <math>CFL</math>.

7. $L = \{wxw_R| w,x ∈ \{{a,b}\}^*\}$

<math>L</math> is regular. Since, <math>w</math> can be <math>\epsilon</math> and <math>x \in (a+b)^*, L =\Sigma^*</math>.

8. $L = \{wxw_R| w,x ∈ \{{a,b}\}^+\}$

<math>L</math> is regular. <math>L</math> contains all strings starting and ending with <math>a</math> or starting and ending with <math>b</math> and containing at least 3 letters. Moreover, <math>L</math> doesn't contain any other strings. Thus <math>L</math> can be accepted by a <math>DFA</math>. Regular expression for L is a(a+b)^+a + b(a+b)^+b