Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lfa:2022:lab08-the-pumping-lemma [2022/11/27 00:32]
alexandra.udrescu01
lfa:2022:lab08-the-pumping-lemma [2022/12/09 08:55] (current)
pdmatei
Line 18: Line 18:
  
 **8.1.1.** Show that the pumping lemma holds for finite languages. **8.1.1.** Show that the pumping lemma holds for finite languages.
 +
  
 <hidden Solution>​ <hidden Solution>​
Line 28: Line 29:
  
 </​hidden>​ </​hidden>​
 +
  
 **8.1.2.*** Find a language which is not regular for which the pumping lemma holds. **8.1.2.*** Find a language which is not regular for which the pumping lemma holds.
Line 36: Line 38:
  
 **8.2.1.** $  L = \{ \: A^n B^m \: | \: 0 \leq n \leq m \: \} $ **8.2.1.** $  L = \{ \: A^n B^m \: | \: 0 \leq n \leq m \: \} $
 +
 +
  
 <hidden Solution>​ <​note>​ <hidden Solution>​ <​note>​
Line 60: Line 64:
 </​hidden>​ </​hidden>​
  
-**8.2.2.** $  L = \{ \: w \in \{A,B\}^* \: | \: \#A(w) = \#B(w) \: \} $+ 
 +**8.2.2.** $  L = \{ \: w \in \{A,B\}^* \: | \: \#_A(w) = \#_B(w) \: \} $ 
  
 <hidden Solution>​ <​note>​ <hidden Solution>​ <​note>​
Line 84: Line 90:
  
 </​hidden>​ </​hidden>​
 +
  
 **8.2.3.** $math[L = \{(01)^n(10)^n \mid n > 0 \} ] **8.2.3.** $math[L = \{(01)^n(10)^n \mid n > 0 \} ]
 +
 +
  
 <hidden Solution>​ <​note>​ <hidden Solution>​ <​note>​
Line 142: Line 151:
  
 </​hidden>​ </​hidden>​
 +
  
 **8.2.4.** $  L = \{ \: w \in \{A,B\}^* \: | \: \text{w is a palindrome} \: \} $ **8.2.4.** $  L = \{ \: w \in \{A,B\}^* \: | \: \text{w is a palindrome} \: \} $
 +
 +
  
 <hidden Solution>​ <​note>​ <hidden Solution>​ <​note>​
Line 168: Line 180:
  
 **8.2.5.** $  L = \{ \: w \in \{0\}^* \: | \: \text{the length of w is a prime number} \: \} $ **8.2.5.** $  L = \{ \: w \in \{0\}^* \: | \: \text{the length of w is a prime number} \: \} $
 +
 +
  
  
Line 192: Line 206:
  
 </​hidden>​ </​hidden>​
 +
  
  
 **8.2.6.** $  L = \{ \: w \in \{0\}^* \: | \: \text{the length of w is a power of two} \: \} $ **8.2.6.** $  L = \{ \: w \in \{0\}^* \: | \: \text{the length of w is a power of two} \: \} $
 +
  
  
Line 222: Line 238:
 </​hidden>​ </​hidden>​
  
-**8.2.7.** $  L = \{ \: ww^R  \: | \: w\in \{0,1\}^* \}  + 
-$+**8.2.7.** $  L = \{ \: ww^R  \: | \: w\in \{0,1\}^* \} $ 
 + 
 + 
 + 
 +<hidden Solution>​ <​note>​ 
 + 
 +For a fixed n, pick a word w_n \in L $ and $ w_n = xyz $: 
 + 
 +$ w_n = 0^n110^n $ 
 + 
 +$ x = 0^a $ 
 + 
 +$ y = 0^b, b \ge 1 $ 
 + 
 +$ z = 0^{n-a-b}10^n $ 
 + 
 +Find k such that $ xy^kz \notin L $:  
 + 
 +$ w_k = 0^{n+(k-1)b}110^n $ 
 + 
 +Pick $ k = 2 $ => $ w_2 = 0^{n+b}110^n \notin L $ because $ b \ge 1 $ 
 + 
 +=> Complement of Pumping Lemma holds => L is not a regular language 
 +</​note>​ 
 + 
 +</​hidden>​