Języki, automaty i obliczenia/Test 8: Dalsze algorytmy dla języków regularnych. Problemy rozstrzygalne: Różnice pomiędzy wersjami

Z Studia Informatyczne
Przejdź do nawigacjiPrzejdź do wyszukiwania
Rogoda (dyskusja | edycje)
Nie podano opisu zmian
 
m Zastępowanie tekstu – „<math> ” na „<math>”
 
(Nie pokazano 6 pośrednich wersji utworzonych przez tego samego użytkownika)
Linia 2: Linia 2:
Wskaż, które z poniższych struktur są monoidami:
Wskaż, które z poniższych struktur są monoidami:


<rightoption reply="Dobrze"><math>\displaystyle (\mathds{Z}_{mod\ 2}, \cdot)</math></rightoption>  
<rightoption reply="Dobrze"><math>(\mathbb{Z}_{mod\ 2}, \cdot)</math></rightoption>  
<wrongoption reply="Źle"><math>\displaystyle (\mathds{N}_1, +)</math>, gdzie <math>\displaystyle \mathds{N}_1=\{1,2,3,...\}</math></wrongoption>
<wrongoption reply="Źle"><math>(\mathbb{N}_1, +)</math>, gdzie <math>\mathbb{N}_1=\{1,2,3,...\}</math></wrongoption>
<wrongoption reply="Źle"><math>\displaystyle (\mathds{N}_p,+)</math>, gdzie <math>\displaystyle \mathds{N}_p</math> jest zbiorem wszystkich liczb pierwszych</wrongoption>
<wrongoption reply="Źle"><math>(\mathbb{N}_p,+)</math>, gdzie <math>\mathbb{N}_p</math> jest zbiorem wszystkich liczb pierwszych</wrongoption>
<rightoption reply="Dobrze"><math>\displaystyle (\mathds{R}, \cdot)</math></rightoption>
<rightoption reply="Dobrze"><math>(\mathbb{R}, \cdot)</math></rightoption>
<rightoption reply="Dobrze"><math>\displaystyle (\mathds{Z}, +)</math></rightoption>
<rightoption reply="Dobrze"><math>(\mathbb{Z}, +)</math></rightoption>
</quiz>
</quiz>


Linia 13: Linia 13:
Wskaż stwierdzenia prawdziwe:
Wskaż stwierdzenia prawdziwe:


<wrongoption reply="Źle"><math>\displaystyle abbaaa \in \{aa,bb\}^*</math></wrongoption>  
<wrongoption reply="Źle"><math>abbaaa \in \{aa,bb\}^*</math></wrongoption>  


<rightoption reply="Dobrze"><math>\displaystyle abbaaa \in \{a,b\}^*</math></rightoption>
<rightoption reply="Dobrze"><math>abbaaa \in \{a,b\}^*</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle abbaaa \in \{abb,a\}^*</math></rightoption>
<rightoption reply="Dobrze"><math>abbaaa \in \{abb,a\}^*</math></rightoption>


<wrongoption reply="Źle"><math>\displaystyle abbaaa \in \{ba, ab\}^*</math></wrongoption>
<wrongoption reply="Źle"><math>abbaaa \in \{ba, ab\}^*</math></wrongoption>


<rightoption reply="Dobrze"><math>\displaystyle abbaaa \in \{aa, ab, ba\}^*</math></rightoption>
<rightoption reply="Dobrze"><math>abbaaa \in \{aa, ab, ba\}^*</math></rightoption>
</quiz>
</quiz>


Linia 28: Linia 28:
Wskaż, które z poniższych odwzorowań są homomorfizmami:
Wskaż, które z poniższych odwzorowań są homomorfizmami:


<wrongoption reply="Źle"><math>\displaystyle h: (\mathds{R},+) \rightarrow (\mathds{Z},+)</math>, <math>\displaystyle h(x)=3x</math></wrongoption>  
<wrongoption reply="Źle"><math>h: (\mathbb{R},+) \rightarrow (\mathbb{Z},+)</math>, <math>h(x)=3x</math></wrongoption>  


<rightoption reply="Dobrze"><math>\displaystyle h: (\mathds{R},+) \rightarrow (\mathds{R},+)</math>, <math>\displaystyle h(x)=3x</math></rightoption>
<rightoption reply="Dobrze"><math>h: (\mathbb{R},+) \rightarrow (\mathbb{R},+)</math>, <math>h(x)=3x</math></rightoption>


<wrongoption reply="Źle"><math>\displaystyle h: (\mathds{R}, \cdot) \rightarrow (\mathds{R}, \cdot)</math>,  
<wrongoption reply="Źle"><math>h: (\mathbb{R}, \cdot) \rightarrow (\mathbb{R}, \cdot)</math>,  
<math>\displaystyle h(x)=3x</math></wrongoption>
<math>h(x)=3x</math></wrongoption>


<rightoption reply="Dobrze"><math>\displaystyle h: \{a,b\}^* \rightarrow \{a,b\}^*</math>, <math>\displaystyle h(a)=a^2</math>,  
<rightoption reply="Dobrze"><math>h: \{a,b\}^* \rightarrow \{a,b\}^*</math>, <math>h(a)=a^2</math>,  
<math>\displaystyle h(b)=ab^2</math></rightoption>
<math>h(b)=ab^2</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle h: \{a,b\}^* \rightarrow (\mathds{Z},+)</math>, <math>\displaystyle h(a)=1</math>, <math>\displaystyle h(b)=1</math></rightoption>
<rightoption reply="Dobrze"><math>h: \{a,b\}^* \rightarrow (\mathbb{Z},+)</math>, <math>h(a)=1</math>, <math>h(b)=1</math></rightoption>
</quiz>
</quiz>




<quiz>
<quiz>
Dany niech będzie system przepisujący <math>\displaystyle RS=(\{a,b,c\},  
Dany niech będzie system przepisujący <math>RS=(\{a,b,c\},  
\{(a,b),(b,c),(b,a),(cc,b))</math> oraz niech <math>\displaystyle I=\{ccb\}</math>. Wskaż  
\{(a,b),(b,c),(b,a),(cc,b))</math> oraz niech <math>I=\{ccb\}</math>. Wskaż  
stwierdzenia prawdziwe:
stwierdzenia prawdziwe:


<wrongoption reply="Źle"><math>\displaystyle abc \in L_{gen}(RS, I)</math></wrongoption>  
<wrongoption reply="Źle"><math>abc \in L_{gen}(RS, I)</math></wrongoption>  


<rightoption reply="Dobrze"><math>\displaystyle ccb \in L_{gen}(RS, I)</math> </rightoption>
<rightoption reply="Dobrze"><math>ccb \in L_{gen}(RS, I)</math> </rightoption>


<rightoption reply="Dobrze"><math>\displaystyle bb \in L_{gen}(RS, I)</math></rightoption>
<rightoption reply="Dobrze"><math>bb \in L_{gen}(RS, I)</math></rightoption>


<wrongoption reply="Źle"><math>\displaystyle aab \in L_{gen}(RS, I)</math></wrongoption>  
<wrongoption reply="Źle"><math>aab \in L_{gen}(RS, I)</math></wrongoption>  


<rightoption reply="Dobrze"><math>\displaystyle aa \in L_{gen}(RS, I)</math></rightoption>  
<rightoption reply="Dobrze"><math>aa \in L_{gen}(RS, I)</math></rightoption>  
   
   
</quiz>
</quiz>
Linia 62: Linia 62:
<quiz>
<quiz>
Wyrażenie regularne  
Wyrażenie regularne  
<center><math>\displaystyle ((aa+bb)^*(ab+ba)(aa+bb)^*(ab+ba))^*(aa+bb)^*</math></center>  
<center><math>((aa+bb)^*(ab+ba)(aa+bb)^*(ab+ba))^*(aa+bb)^*</math></center>  
reprezentuje język:
reprezentuje język:
   
   
<rightoption reply="Dobrze"><math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = 2k</math>, <math>\displaystyle \sharp_bw = 2l</math>,  
<rightoption reply="Dobrze"><math>\{w \in \{a,b\}^*:\ \sharp_aw = 2k</math>, <math>\sharp_bw = 2l</math>,  
<math>\displaystyle k,l >0\}</math></rightoption>
<math>k,l >0\}</math></rightoption>


<wrongoption reply="Źle"><math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw - \sharp_bw = 0 (mod 2)\}</math></wrongoption>
<wrongoption reply="Źle"><math>\{w \in \{a,b\}^*:\ \sharp_aw - \sharp_bw = 0 (mod 2)\}</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = \sharp_bw = 2k, k \geq  
<wrongoption reply="Źle"><math>\{w \in \{a,b\}^*:\ \sharp_aw = \sharp_bw = 2k, k \geq  
0\}</math></wrongoption>
0\}</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw - \sharp_bw = 1 (mod 2)\}</math></wrongoption>
<wrongoption reply="Źle"><math>\{w \in \{a,b\}^*:\ \sharp_aw - \sharp_bw = 1 (mod 2)\}</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle \{w \in \{a,b\}^*: \sharp_aw = 4k</math>, <math>\displaystyle \sharp_bw = 4l</math>, <math>\displaystyle k,  
<wrongoption reply="Źle"><math>\{w \in \{a,b\}^*: \sharp_aw = 4k</math>, <math>\sharp_bw = 4l</math>, <math>k,  
l \geq 0\}</math></wrongoption>
l \geq 0\}</math></wrongoption>
   
   
Linia 83: Linia 83:
<quiz>
<quiz>


Niech <math>\displaystyle A=\{a,b\}</math> oraz <math>\displaystyle L=aA^*a</math>. Wskaż zdania prawdziwe:
Niech <math>A=\{a,b\}</math> oraz <math>L=aA^*a</math>. Wskaż zdania prawdziwe:


<wrongoption reply="Źle">minimalny automat akceptujący <math>\displaystyle L</math> ma 5 stanów</wrongoption>
<wrongoption reply="Źle">minimalny automat akceptujący <math>L</math> ma 5 stanów</wrongoption>


<rightoption reply="Dobrze">ilość klas równoważności prawej kongruencji syntaktycznej  
<rightoption reply="Dobrze">ilość klas równoważności prawej kongruencji syntaktycznej  
<math>\displaystyle P_L^r</math> wyznaczonej przez <math>\displaystyle L</math> jest równa 4</rightoption>
<math>P_L^r</math> wyznaczonej przez <math>L</math> jest równa 4</rightoption>


<wrongoption reply="Źle"><math>\displaystyle A^* \backslash L = bA^*b + b</math></wrongoption>
<wrongoption reply="Źle"><math>A^* \backslash L = bA^*b + b</math></wrongoption>


<rightoption reply="Dobrze"><math>\displaystyle A^* \backslash L = bA^*+aA^*b+a+1</math></rightoption>
<rightoption reply="Dobrze"><math>A^* \backslash L = bA^*+aA^*b+a+1</math></rightoption>


<rightoption reply="Dobrze">monoid przejśc minimalnego automatu akceptującego <math>\displaystyle L</math> ma 6  
<rightoption reply="Dobrze">monoid przejśc minimalnego automatu akceptującego <math>L</math> ma 6  
elementów</rightoption>
elementów</rightoption>
   
   
Linia 102: Linia 102:
<quiz>
<quiz>


Niech <math>\displaystyle L</math> będzie dowolnym językiem regularnym. Wskaż zdania prawdziwe:
Niech <math>L</math> będzie dowolnym językiem regularnym. Wskaż zdania prawdziwe:


<rightoption reply="Dobrze"><math>\displaystyle L</math> jest rozpoznawany przez pewien niedeterministyczny automat skończenie stanowy z pustymi przejściami</rightoption>
<rightoption reply="Dobrze"><math>L</math> jest rozpoznawany przez pewien niedeterministyczny automat skończenie stanowy z pustymi przejściami</rightoption>


<rightoption reply="Dobrze"><math>\displaystyle L</math> jest rozpoznawany przez automat deterministyczny  
<rightoption reply="Dobrze"><math>L</math> jest rozpoznawany przez automat deterministyczny  
skończenie stanowy</rightoption>
skończenie stanowy</rightoption>


<rightoption reply="Dobrze"><math>\displaystyle L</math> jest rozpoznawany przez niedeterministyczny automat z pustymi przejściami o jednoelementowym zbiorze stanów początkowych</rightoption>
<rightoption reply="Dobrze"><math>L</math> jest rozpoznawany przez niedeterministyczny automat z pustymi przejściami o jednoelementowym zbiorze stanów początkowych</rightoption>


<wrongoption reply="Źle">Nie istnieje automat niedeterministyczny z pustymi przejściami rozpoznający <math>\displaystyle L</math> i taki, że zbiór stanów początkowych jest jednoelementowy</wrongoption>
<wrongoption reply="Źle">Nie istnieje automat niedeterministyczny z pustymi przejściami rozpoznający <math>L</math> i taki, że zbiór stanów początkowych jest jednoelementowy</wrongoption>


<wrongoption reply="Źle">Nie istnieje gramatyka lewoliniowa generująca <math>\displaystyle L</math></wrongoption>
<wrongoption reply="Źle">Nie istnieje gramatyka lewoliniowa generująca <math>L</math></wrongoption>
   
   
</quiz>
</quiz>
Linia 120: Linia 120:
<quiz>
<quiz>


Niech <math>\displaystyle L_1</math>, <math>\displaystyle L_2</math> będą językami rozpoznawanymi odpowiednio przez  
Niech <math>L_1</math>, <math>L_2</math> będą językami rozpoznawanymi odpowiednio przez  
automaty o <math>\displaystyle n_1</math> i <math>\displaystyle n_2</math> stanach. Aby stwierdzić, dla dowolnego  
automaty o <math>n_1</math> i <math>n_2</math> stanach. Aby stwierdzić, dla dowolnego  
słowa <math>\displaystyle w</math>, czy jest ono rozpoznawane przez oba automaty, wystarczy  
słowa <math>w</math>, czy jest ono rozpoznawane przez oba automaty, wystarczy  
skonstruować odpowiedni automat mający
skonstruować odpowiedni automat mający


<rightoption reply="Dobrze"><math>\displaystyle n_1 \cdot n_2</math> stanów</rightoption>
<rightoption reply="Dobrze"><math>n_1 \cdot n_2</math> stanów</rightoption>


<rightoption reply="Dobrze"><math>\displaystyle O(n_1+n_2)</math> stanów</rightoption>
<rightoption reply="Dobrze"><math>O(n_1+n_2)</math> stanów</rightoption>


<wrongoption reply="Źle"><math>\displaystyle n_1</math> stanów</wrongoption>
<wrongoption reply="Źle"><math>n_1</math> stanów</wrongoption>


<wrongoption reply="Źle"><math>\displaystyle n_2</math> stanów</wrongoption>
<wrongoption reply="Źle"><math>n_2</math> stanów</wrongoption>


<wrongoption reply="Źle">3 stany</wrongoption>
<wrongoption reply="Źle">3 stany</wrongoption>
Linia 140: Linia 140:
<quiz>
<quiz>


Język <math>\displaystyle L</math> składa się ze wszystkich słów nad alfabetem <math>\displaystyle A=\{a,b\}</math>  
Język <math>L</math> składa się ze wszystkich słów nad alfabetem <math>A=\{a,b\}</math>  
nie zawierających podsłowa <math>\displaystyle a^3</math>. Wskaż wyrażenie regularne  
nie zawierających podsłowa <math>a^3</math>. Wskaż wyrażenie regularne  
reprezentujące <math>\displaystyle L</math>:
reprezentujące <math>L</math>:


<wrongoption reply="Źle"><math>\displaystyle (b^*(1+a+aa)b^*)^*</math></wrongoption>
<wrongoption reply="Źle"><math>(b^*(1+a+aa)b^*)^*</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle (b^*(1+a+aa)bb^*)^*</math></wrongoption>
<wrongoption reply="Źle"><math>(b^*(1+a+aa)bb^*)^*</math></wrongoption>


<rightoption reply="Dobrze"><math>\displaystyle (b+ab+aab)^*+(b+ab+aab)^*a+(b+ab+aab)^*aa</math></rightoption>
<rightoption reply="Dobrze"><math>(b+ab+aab)^*+(b+ab+aab)^*a+(b+ab+aab)^*aa</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle ((1+a+aa)bb^*)^*(1+a+aa)</math></rightoption>
<rightoption reply="Dobrze"><math>((1+a+aa)bb^*)^*(1+a+aa)</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle b^*(a+aa)bb^*)^*(1+a+aa)</math></rightoption>
<rightoption reply="Dobrze"><math>b^*(a+aa)bb^*)^*(1+a+aa)</math></rightoption>
   
   
</quiz>
</quiz>
Linia 159: Linia 159:
<quiz>
<quiz>


Wskaż warunki równoważne temu, by język <math>\displaystyle L</math> był akceptowany przez  
Wskaż warunki równoważne temu, by język <math>L</math> był akceptowany przez  
automat skończenie stanowy:
automat skończenie stanowy:
   
   
<wrongoption reply="Źle">Istnieje liczba naturalna <math>\displaystyle N \geq 1</math> taka, że każde słowo  
<wrongoption reply="Źle">Istnieje liczba naturalna <math>N \geq 1</math> taka, że każde słowo  
<math>\displaystyle w \in L</math> o długości <math>\displaystyle |w| \geq N</math> można przedstawić jako katenację  
<math>w \in L</math> o długości <math>|w| \geq N</math> można przedstawić jako katenację  
<math>\displaystyle w = v_1uv_2</math>, gdzie <math>\displaystyle v_1, v_2 \in A^*</math>, <math>\displaystyle u \in A^+</math> oraz <math>\displaystyle v_1u^*v_2  
<math>w = v_1uv_2</math>, gdzie <math>v_1, v_2 \in A^*</math>, <math>u \in A^+</math> oraz <math>v_1u^*v_2  
\subset L</math>.</wrongoption>
\subset L</math>.</wrongoption>


<rightoption reply="Dobrze">Istnieje skończony monoid <math>\displaystyle M</math> i homomorfizm <math>\displaystyle \phi: A^*  
<rightoption reply="Dobrze">Istnieje skończony monoid <math>M</math> i homomorfizm <math>\phi: A^*  
\rightarrow M</math> taki, że <math>\displaystyle \phi^{-1}(\phi(L)) = L</math>.</rightoption>
\rightarrow M</math> taki, że <math>\phi^{-1}(\phi(L)) = L</math>.</rightoption>


<wrongoption reply="Źle"><math>\displaystyle L</math> jest sumą wybranych klas równoważności pewnej  
<wrongoption reply="Źle"><math>L</math> jest sumą wybranych klas równoważności pewnej  
kongruencji <math>\displaystyle \rho</math> na <math>\displaystyle A^*</math>: <center><math>\displaystyle L = \cup_{w \in L}[w]_\rho.</math></center></wrongoption>
kongruencji <math>\rho</math> na <math>A^*</math>: <center><math>L = \cup_{w \in L}[w]_\rho</math>.</center></wrongoption>


<rightoption reply="Dobrze"><math>\displaystyle L \in \mathcal{REG}(A^*)</math>.</rightoption>
<rightoption reply="Dobrze"><math>L \in \mathcal{REG}(A^*)</math>.</rightoption>


<wrongoption reply="Źle"><math>\displaystyle L</math> jest akceptowany przez deterministyczny automat  
<wrongoption reply="Źle"><math>L</math> jest akceptowany przez deterministyczny automat  
skończenie stanowy z jednym stanem końcowym.</wrongoption>
skończenie stanowy z jednym stanem końcowym.</wrongoption>
   
   
Linia 182: Linia 182:


<quiz>
<quiz>
Automat <math>\displaystyle \mathcal{A}=(S, A, s_0, f, F)</math>, gdzie <math>\displaystyle S=\{s_0, s_1, s_2,  
Automat <math>\mathcal{A}=(S, A, s_0, f, F)</math>, gdzie <math>S=\{s_0, s_1, s_2,  
s_3\}</math>, <math>\displaystyle A=\{a,b\}</math>, <math>\displaystyle F=\{s_1\}</math>,  
s_3\}</math>, <math>A=\{a,b\}</math>, <math>F=\{s_1\}</math>,  


<center>
<center>
Linia 189: Linia 189:
|+ <span style="font-variant:small-caps"></span>
|+ <span style="font-variant:small-caps"></span>
|-  
|-  
|  <math>\displaystyle f</math>  ||  <math>\displaystyle s_0</math>  ||  <math>\displaystyle s_1</math>  ||  <math>\displaystyle s_2</math>  ||   
|  <math>f</math>  ||  <math>s_0</math>  ||  <math>s_1</math>  ||  <math>s_2</math>  ||   
<math>\displaystyle s_3</math>  
<math>s_3</math>  
|-
|-
|  <math>\displaystyle a</math>  ||  <math>\displaystyle s_1</math>  ||  <math>\displaystyle s_0</math>  ||  <math>\displaystyle s_3</math>  ||  <math>\displaystyle s_2</math>  
|  <math>a</math>  ||  <math>s_1</math>  ||  <math>s_0</math>  ||  <math>s_3</math>  ||  <math>s_2</math>  
|-
|-
|  <math>\displaystyle b</math>  ||  <math>\displaystyle s_3</math>  ||  <math>\displaystyle s_2</math>  ||  <math>\displaystyle s_1</math> ||  <math>\displaystyle s_0</math>  
|  <math>b</math>  ||  <math>s_3</math>  ||  <math>s_2</math>  ||  <math>s_1</math> ||  <math>s_0</math>  
|-
|-
|  
|  
Linia 204: Linia 204:
<rightoption reply="Dobrze">jest automatem minimalnym</rightoption>
<rightoption reply="Dobrze">jest automatem minimalnym</rightoption>


<wrongoption reply="Źle">rozpoznaje język <math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = 2k,  
<wrongoption reply="Źle">rozpoznaje język <math>\{w \in \{a,b\}^*:\ \sharp_aw = 2k,  
\sharp_bw = 2l+1</math>, <math>\displaystyle k,l \geq 0\}</math></wrongoption>
\sharp_bw = 2l+1</math>, <math>k,l \geq 0\}</math></wrongoption>


<wrongoption reply="Źle">rozpoznaje język <math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = 2k,  
<wrongoption reply="Źle">rozpoznaje język <math>\{w \in \{a,b\}^*:\ \sharp_aw = 2k,  
\sharp_bw = 2l</math>, <math>\displaystyle k,l \geq 0\}</math></wrongoption>
\sharp_bw = 2l</math>, <math>k,l \geq 0\}</math></wrongoption>


<rightoption reply="Dobrze">rozpoznaje język <math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = 2k+1,  
<rightoption reply="Dobrze">rozpoznaje język <math>\{w \in \{a,b\}^*:\ \sharp_aw = 2k+1,  
\sharp_bw = 2l</math>, <math>\displaystyle k,l \geq 0\}</math></rightoption>
\sharp_bw = 2l</math>, <math>k,l \geq 0\}</math></rightoption>


<wrongoption reply="Źle">rozpoznaje język <math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = 2k+1,  
<wrongoption reply="Źle">rozpoznaje język <math>\{w \in \{a,b\}^*:\ \sharp_aw = 2k+1,  
\sharp_bw = 2l+1</math>, <math>\displaystyle k,l \geq 0\}</math></wrongoption>
\sharp_bw = 2l+1</math>, <math>k,l \geq 0\}</math></wrongoption>


</quiz>
</quiz>
Linia 222: Linia 222:
Które z poniższych równości dla wyrażeń regularnych są prawdziwe?
Które z poniższych równości dla wyrażeń regularnych są prawdziwe?
   
   
<rightoption reply="Dobrze"><math>\displaystyle r^*r^*=r^*</math></rightoption>
<rightoption reply="Dobrze"><math>r^*r^*=r^*</math></rightoption>


<wrongoption reply="Źle"><math>\displaystyle (r+s)^*=r^*+s^*</math></wrongoption>
<wrongoption reply="Źle"><math>(r+s)^*=r^*+s^*</math></wrongoption>


<rightoption reply="Dobrze"><math>\displaystyle (r^*+s^*)^*=(r^*s^*)^*</math></rightoption>
<rightoption reply="Dobrze"><math>(r^*+s^*)^*=(r^*s^*)^*</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle r+r=r</math></rightoption>
<rightoption reply="Dobrze"><math>r+r=r</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle (rs)^*r=r(sr)^*</math></rightoption>
<rightoption reply="Dobrze"><math>(rs)^*r=r(sr)^*</math></rightoption>


</quiz>
</quiz>
Linia 238: Linia 238:
Wskaż języki regularne:
Wskaż języki regularne:
   
   
<rightoption reply="Dobrze"><math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = \sharp_bw\ (mod\ 3)\}</math></rightoption>
<rightoption reply="Dobrze"><math>\{w \in \{a,b\}^*:\ \sharp_aw = \sharp_bw\ (mod\ 3)\}</math></rightoption>


<wrongoption reply="Źle"><math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw = \sharp_bw\}</math></wrongoption>
<wrongoption reply="Źle"><math>\{w \in \{a,b\}^*:\ \sharp_aw = \sharp_bw\}</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle \{w \in \{a,b\}^*:\ |w|=2^n, n > 0\}</math></wrongoption>
<wrongoption reply="Źle"><math>\{w \in \{a,b\}^*:\ |w|=2^n, n > 0\}</math></wrongoption>


<rightoption reply="Dobrze"><math>\displaystyle \{w \in \{a,b\}^*:\ \sharp_aw \cdot \sharp_bw = 100\}</math></rightoption>
<rightoption reply="Dobrze"><math>\{w \in \{a,b\}^*:\ \sharp_aw \cdot \sharp_bw = 100\}</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle \{a^n:\ n=3k </math>  lub  <math>\displaystyle  n=5k,\ k \geq 0\}</math></rightoption>
<rightoption reply="Dobrze"><math>\{a^n:\ n=3k</math>  lub  <math>n=5k,\ k \geq 0\}</math></rightoption>


</quiz>
</quiz>
Linia 252: Linia 252:


<quiz>
<quiz>
Dany jest automat <math>\displaystyle \mathcal{A}=(S, A, s_0, f, F)</math>, gdzie  
Dany jest automat <math>\mathcal{A}=(S, A, s_0, f, F)</math>, gdzie  
<math>\displaystyle S=\{s_0,s_1,s_2\}</math>, <math>\displaystyle A=\{a,b\}</math>, <math>\displaystyle F=\{s_0,s_1\}</math>,<br>
<math>S=\{s_0,s_1,s_2\}</math>, <math>A=\{a,b\}</math>, <math>F=\{s_0,s_1\}</math>,<br>




Linia 260: Linia 260:
|+ <span style="font-variant:small-caps"></span>
|+ <span style="font-variant:small-caps"></span>
|-  
|-  
|  <math>\displaystyle f</math>  ||  <math>\displaystyle s_0</math>  ||  <math>\displaystyle s_1</math>  ||  <math>\displaystyle s_2</math>  
|  <math>f</math>  ||  <math>s_0</math>  ||  <math>s_1</math>  ||  <math>s_2</math>  
|-
|-
|  <math>\displaystyle a</math>  ||  <math>\displaystyle s_1</math>  ||  <math>\displaystyle s_0</math>  ||  <math>\displaystyle s_2</math>  
|  <math>a</math>  ||  <math>s_1</math>  ||  <math>s_0</math>  ||  <math>s_2</math>  
|-
|-
|  <math>\displaystyle b</math>  ||  <math>\displaystyle s_0</math>  ||  <math>\displaystyle s_2</math>  ||  <math>\displaystyle s_2</math>  
|  <math>b</math>  ||  <math>s_0</math>  ||  <math>s_2</math>  ||  <math>s_2</math>  
|-
|-
|  
|  
Linia 273: Linia 273:
Wskaż zdania prawdziwe:
Wskaż zdania prawdziwe:


<rightoption reply="Dobrze"><math>\displaystyle L(\mathcal{A})=(a^2+b)^*(a+1)</math>.</rightoption>
<rightoption reply="Dobrze"><math>L(\mathcal{A})=(a^2+b)^*(a+1)</math>.</rightoption>


<wrongoption reply="Źle">Równoważny automat minimalny ma 2 stany.</wrongoption>
<wrongoption reply="Źle">Równoważny automat minimalny ma 2 stany.</wrongoption>


<rightoption reply="Dobrze">Jeśli <math>\displaystyle w \in L(\mathcal{A})</math>, to dla każdych <math>\displaystyle v,u \in A^*</math> takich, że  
<rightoption reply="Dobrze">Jeśli <math>w \in L(\mathcal{A})</math>, to dla każdych <math>v,u \in A^*</math> takich, że  
<math>\displaystyle w=vbu</math> zachodzi <math>\displaystyle \sharp_av = 2k</math> dla pewnego <math>\displaystyle k \geq 0</math>.</rightoption>
<math>w=vbu</math> zachodzi <math>\sharp_av = 2k</math> dla pewnego <math>k \geq 0</math>.</rightoption>


<wrongoption reply="Źle"><math>\displaystyle a^*b^* \subset L(\mathcal{A})</math>.</wrongoption>
<wrongoption reply="Źle"><math>a^*b^* \subset L(\mathcal{A})</math>.</wrongoption>


<wrongoption reply="Źle">Jeśli <math>\displaystyle w \in L(\mathcal{A})</math>, to <math>\displaystyle a^2b</math> jest podsłowem  
<wrongoption reply="Źle">Jeśli <math>w \in L(\mathcal{A})</math>, to <math>a^2b</math> jest podsłowem  
słowa <math>\displaystyle w</math>.</wrongoption>
słowa <math>w</math>.</wrongoption>


</quiz>
</quiz>
Linia 289: Linia 289:


<quiz>
<quiz>
Dany niech będzie automat niedeterministyczny <math>\displaystyle \mathcal{A}_{ND}=(Q,  
Dany niech będzie automat niedeterministyczny <math>\mathcal{A}_{ND}=(Q,  
A, \{q_0\}, f, F)</math>, gdzie <math>\displaystyle Q=\{q_0, q_1, q_2\}</math>, <math>\displaystyle A=\{a,b\}</math>,  
A, \{q_0\}, f, F)</math>, gdzie <math>Q=\{q_0, q_1, q_2\}</math>, <math>A=\{a,b\}</math>,  
<math>\displaystyle F=\{q_2\}</math>,<br>
<math>F=\{q_2\}</math>,<br>




Linia 298: Linia 298:
|+ <span style="font-variant:small-caps"></span>
|+ <span style="font-variant:small-caps"></span>
|-  
|-  
|  <math>\displaystyle f</math>  ||  <math>\displaystyle q_0</math>  ||  <math>\displaystyle q_1</math>  ||  <math>\displaystyle q_2</math>  
|  <math>f</math>  ||  <math>q_0</math>  ||  <math>q_1</math>  ||  <math>q_2</math>  
|-
|-
|  <math>\displaystyle a</math>  ||  <math>\displaystyle \{q_1\}</math>  ||  <math>\displaystyle \{q_0,q_2\}</math>  ||  <math>\displaystyle \{q_2\}</math>  
|  <math>a</math>  ||  <math>\{q_1\}</math>  ||  <math>\{q_0,q_2\}</math>  ||  <math>\{q_2\}</math>  
|-
|-
|  <math>\displaystyle b</math>  ||  <math>\displaystyle \emptyset</math>  ||  <math>\displaystyle \emptyset</math>  ||  <math>\displaystyle \{q_1\}</math>  
|  <math>b</math>  ||  <math>\emptyset</math>  ||  <math>\emptyset</math>  ||  <math>\{q_1\}</math>  
|-
|-
|  
|  
Linia 311: Linia 311:
Wskaż zdania prawdziwe:
Wskaż zdania prawdziwe:
   
   
<rightoption reply="Dobrze"><math>\displaystyle L(\mathcal{A}_{ND})=a^2(a+ba)^*</math>.</rightoption>
<rightoption reply="Dobrze"><math>L(\mathcal{A}_{ND})=a^2(a+ba)^*</math>.</rightoption>


<rightoption reply="Dobrze"><math>\displaystyle L(\mathcal{A}_{ND})=a(aa^*b)^*aa^*</math>.</rightoption>
<rightoption reply="Dobrze"><math>L(\mathcal{A}_{ND})=a(aa^*b)^*aa^*</math>.</rightoption>


<wrongoption reply="Źle">Równoważny automat deterministyczny posiada 3 stany.</wrongoption>
<wrongoption reply="Źle">Równoważny automat deterministyczny posiada 3 stany.</wrongoption>


<wrongoption reply="Źle"><math>\displaystyle L(\mathcal{A}_{ND})=a^2(a^*b)^*aa^*</math>.</wrongoption>
<wrongoption reply="Źle"><math>L(\mathcal{A}_{ND})=a^2(a^*b)^*aa^*</math>.</wrongoption>


<rightoption reply="Dobrze">Równoważny minimalny automat deterministyczny posiada 4 stany.</rightoption>
<rightoption reply="Dobrze">Równoważny minimalny automat deterministyczny posiada 4 stany.</rightoption>
Linia 349: Linia 349:
|+ <span style="font-variant:small-caps"></span>
|+ <span style="font-variant:small-caps"></span>
|-  
|-  
|  <math>\displaystyle f</math>  ||  <math>\displaystyle s_0</math>  ||  <math>\displaystyle s_1</math>  ||  <math>\displaystyle s_2</math>  ||  <math>\displaystyle s_3</math>  
|  <math>f</math>  ||  <math>s_0</math>  ||  <math>s_1</math>  ||  <math>s_2</math>  ||  <math>s_3</math>  
|-
|-
|  <math>\displaystyle a</math>  ||  <math>\displaystyle s_1</math>  ||  <math>\displaystyle s_0</math>  ||  <math>\displaystyle s_3</math>  ||  <math>\displaystyle s_2</math>  
|  <math>a</math>  ||  <math>s_1</math>  ||  <math>s_0</math>  ||  <math>s_3</math>  ||  <math>s_2</math>  
|-
|-
|  <math>\displaystyle b</math>  ||  <math>\displaystyle s_3</math>  ||  <math>\displaystyle s_2</math>  ||  <math>\displaystyle s_1</math>  ||  <math>\displaystyle s_0</math>  
|  <math>b</math>  ||  <math>s_3</math>  ||  <math>s_2</math>  ||  <math>s_1</math>  ||  <math>s_0</math>  
|-
|-
|  
|  
Linia 360: Linia 360:




<rightoption reply="Dobrze"><math>\displaystyle (\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(b),\tau_{\mathcal{A}}(ab)\},  
<rightoption reply="Dobrze"><math>(\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(b),\tau_{\mathcal{A}}(ab)\},  
\circ)</math></rightoption>
\circ)</math></rightoption>


<wrongoption reply="Źle"><math>\displaystyle (\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a)\},\circ)</math></wrongoption>
<wrongoption reply="Źle"><math>(\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a)\},\circ)</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle (\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(ab)\},\circ)</math></wrongoption>
<wrongoption reply="Źle"><math>(\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(ab)\},\circ)</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle (\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(b)\},\circ)</math></wrongoption>
<wrongoption reply="Źle"><math>(\{\tau_{\mathcal{A}}(1),\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(b)\},\circ)</math></wrongoption>


<wrongoption reply="Źle"><math>\displaystyle (\{\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(b),\tau_{\mathcal{A}}(ab),\tau_{\mathcal{A}}(ba)\},  
<wrongoption reply="Źle"><math>(\{\tau_{\mathcal{A}}(a),\tau_{\mathcal{A}}(b),\tau_{\mathcal{A}}(ab),\tau_{\mathcal{A}}(ba)\},  
\circ)</math></wrongoption>
\circ)</math></wrongoption>


Linia 376: Linia 376:


<quiz>
<quiz>
Niech <math>\displaystyle L_1,L_2</math> będą językami regularnymi. Wskaż problemy  
Niech <math>L_1,L_2</math> będą językami regularnymi. Wskaż problemy  
rozstrzygalne.
rozstrzygalne.
   
   
<rightoption reply="Dobrze"><math>\displaystyle w \in L_1</math></rightoption>
<rightoption reply="Dobrze"><math>w \in L_1</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle w \in L_1 \cap L_2</math></rightoption>
<rightoption reply="Dobrze"><math>w \in L_1 \cap L_2</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle L_1 \cap L_2 = \emptyset</math></rightoption>
<rightoption reply="Dobrze"><math>L_1 \cap L_2 = \emptyset</math></rightoption>


<rightoption reply="Dobrze">nieskończoność <math>\displaystyle L_1</math></rightoption>
<rightoption reply="Dobrze">nieskończoność <math>L_1</math></rightoption>


<rightoption reply="Dobrze"><math>\displaystyle L_1 = \emptyset</math></rightoption>
<rightoption reply="Dobrze"><math>L_1 = \emptyset</math></rightoption>


</quiz>
</quiz>
Linia 413: Linia 413:
   
   
<rightoption reply="Dobrze">istnieje algorytm minimalizacji automatu działający w  
<rightoption reply="Dobrze">istnieje algorytm minimalizacji automatu działający w  
czasie <math>\displaystyle n\log n</math></rightoption>
czasie <math>n\log n</math></rightoption>


<wrongoption reply="Źle">żaden algorytm minimalizacji nie może działać szybciej niż  
<wrongoption reply="Źle">żaden algorytm minimalizacji nie może działać szybciej niż  
w czasie <math>\displaystyle O(n^2)</math></wrongoption>
w czasie <math>O(n^2)</math></wrongoption>


<wrongoption reply="Źle">algorytm minimalizacji zawsze zwróci automat o mniejszej  
<wrongoption reply="Źle">algorytm minimalizacji zawsze zwróci automat o mniejszej  

Aktualna wersja na dzień 22:13, 11 wrz 2023

Wskaż, które z poniższych struktur są monoidami:

(mod 2,)

(1,+), gdzie 1={1,2,3,...}

(p,+), gdzie p jest zbiorem wszystkich liczb pierwszych

(,)

(,+)


Wskaż stwierdzenia prawdziwe:

abbaaa{aa,bb}*

abbaaa{a,b}*

abbaaa{abb,a}*

abbaaa{ba,ab}*

abbaaa{aa,ab,ba}*


Wskaż, które z poniższych odwzorowań są homomorfizmami:

h:(,+)(,+), h(x)=3x

h:(,+)(,+), h(x)=3x

h:(,)(,), h(x)=3x

h:{a,b}*{a,b}*, h(a)=a2, h(b)=ab2

h:{a,b}*(,+), h(a)=1, h(b)=1


Dany niech będzie system przepisujący RS=({a,b,c},{(a,b),(b,c),(b,a),(cc,b)) oraz niech I={ccb}. Wskaż stwierdzenia prawdziwe:

abcLgen(RS,I)

ccbLgen(RS,I)

bbLgen(RS,I)

aabLgen(RS,I)

aaLgen(RS,I)


Wyrażenie regularne

((aa+bb)*(ab+ba)(aa+bb)*(ab+ba))*(aa+bb)*

reprezentuje język:

{w{a,b}*: aw=2k, bw=2l, k,l>0}

{w{a,b}*: awbw=0(mod2)}

{w{a,b}*: aw=bw=2k,k0}

{w{a,b}*: awbw=1(mod2)}

{w{a,b}*:aw=4k, bw=4l, k,l0}


Niech A={a,b} oraz L=aA*a. Wskaż zdania prawdziwe:

minimalny automat akceptujący L ma 5 stanów

ilość klas równoważności prawej kongruencji syntaktycznej PLr wyznaczonej przez L jest równa 4

A*L=bA*b+b

A*L=bA*+aA*b+a+1

monoid przejśc minimalnego automatu akceptującego L ma 6 elementów


Niech L będzie dowolnym językiem regularnym. Wskaż zdania prawdziwe:

L jest rozpoznawany przez pewien niedeterministyczny automat skończenie stanowy z pustymi przejściami

L jest rozpoznawany przez automat deterministyczny skończenie stanowy

L jest rozpoznawany przez niedeterministyczny automat z pustymi przejściami o jednoelementowym zbiorze stanów początkowych

Nie istnieje automat niedeterministyczny z pustymi przejściami rozpoznający L i taki, że zbiór stanów początkowych jest jednoelementowy

Nie istnieje gramatyka lewoliniowa generująca L


Niech L1, L2 będą językami rozpoznawanymi odpowiednio przez automaty o n1 i n2 stanach. Aby stwierdzić, dla dowolnego słowa w, czy jest ono rozpoznawane przez oba automaty, wystarczy skonstruować odpowiedni automat mający

n1n2 stanów

O(n1+n2) stanów

n1 stanów

n2 stanów

3 stany


Język L składa się ze wszystkich słów nad alfabetem A={a,b} nie zawierających podsłowa a3. Wskaż wyrażenie regularne reprezentujące L:

(b*(1+a+aa)b*)*

(b*(1+a+aa)bb*)*

(b+ab+aab)*+(b+ab+aab)*a+(b+ab+aab)*aa

((1+a+aa)bb*)*(1+a+aa)

b*(a+aa)bb*)*(1+a+aa)


Wskaż warunki równoważne temu, by język L był akceptowany przez automat skończenie stanowy:

Istnieje liczba naturalna N1 taka, że każde słowo wL o długości |w|N można przedstawić jako katenację w=v1uv2, gdzie v1,v2A*, uA+ oraz v1u*v2L.

Istnieje skończony monoid M i homomorfizm ϕ:A*M taki, że ϕ1(ϕ(L))=L.

L jest sumą wybranych klas równoważności pewnej

kongruencji

ρ

na

A*

:

L=wL[w]ρ.

L𝒢(A*).

L jest akceptowany przez deterministyczny automat skończenie stanowy z jednym stanem końcowym.


Automat 𝒜=(S,A,s0,f,F), gdzie S={s0,s1,s2,s3}, A={a,b}, F={s1},

f s0 s1 s2

s3

a s1 s0 s3 s2
b s3 s2 s1 s0

jest automatem minimalnym

rozpoznaje język {w{a,b}*: aw=2k,bw=2l+1, k,l0}

rozpoznaje język {w{a,b}*: aw=2k,bw=2l, k,l0}

rozpoznaje język {w{a,b}*: aw=2k+1,bw=2l, k,l0}

rozpoznaje język {w{a,b}*: aw=2k+1,bw=2l+1, k,l0}


Które z poniższych równości dla wyrażeń regularnych są prawdziwe?

r*r*=r*

(r+s)*=r*+s*

(r*+s*)*=(r*s*)*

r+r=r

(rs)*r=r(sr)*


Wskaż języki regularne:

{w{a,b}*: aw=bw (mod 3)}

{w{a,b}*: aw=bw}

{w{a,b}*: |w|=2n,n>0}

{w{a,b}*: awbw=100}

{an: n=3k lub n=5k, k0}


Dany jest automat 𝒜=(S,A,s0,f,F), gdzie S={s0,s1,s2}, A={a,b}, F={s0,s1},


f s0 s1 s2
a s1 s0 s2
b s0 s2 s2

Wskaż zdania prawdziwe:

L(𝒜)=(a2+b)*(a+1).

Równoważny automat minimalny ma 2 stany.

Jeśli wL(𝒜), to dla każdych v,uA* takich, że w=vbu zachodzi av=2k dla pewnego k0.

a*b*L(𝒜).

Jeśli wL(𝒜), to a2b jest podsłowem słowa w.


Dany niech będzie automat niedeterministyczny 𝒜ND=(Q,A,{q0},f,F), gdzie Q={q0,q1,q2}, A={a,b}, F={q2},


f q0 q1 q2
a {q1} {q0,q2} {q2}
b {q1}

Wskaż zdania prawdziwe:

L(𝒜ND)=a2(a+ba)*.

L(𝒜ND)=a(aa*b)*aa*.

Równoważny automat deterministyczny posiada 3 stany.

L(𝒜ND)=a2(a*b)*aa*.

Równoważny minimalny automat deterministyczny posiada 4 stany.


Twierdzenie orzekające o równości zachodzącej pomiędzy rodziną języków regularnych a rodziną języków rozpoznawanych przez automaty o skończonej liczbie stanów znane jest jako:

twierdzenie Nerode'a

teza Churcha

lemat Ardena

lemat o pompowaniu

twierdzenie Kleene'ego


Wskaż monoid przejść automatu o następującej funkcji przejścia:

f s0 s1 s2 s3
a s1 s0 s3 s2
b s3 s2 s1 s0


({τ𝒜(1),τ𝒜(a),τ𝒜(b),τ𝒜(ab)},)

({τ𝒜(1),τ𝒜(a)},)

({τ𝒜(1),τ𝒜(a),τ𝒜(ab)},)

({τ𝒜(1),τ𝒜(a),τ𝒜(b)},)

({τ𝒜(a),τ𝒜(b),τ𝒜(ab),τ𝒜(ba)},)


Niech L1,L2 będą językami regularnymi. Wskaż problemy rozstrzygalne.

wL1

wL1L2

L1L2=

nieskończoność L1

L1=


Algorytm determinizacji automatu:

jest deterministyczny

działa w czasie wielomianowym

może się zapętlić

działa w czasie eksponencjalnym

kończy działanie błędem, jeśli na wejściu podany został automat deterministyczny


Wskaż zdania prawdziwe:

istnieje algorytm minimalizacji automatu działający w czasie nlogn

żaden algorytm minimalizacji nie może działać szybciej niż w czasie O(n2)

algorytm minimalizacji zawsze zwróci automat o mniejszej liczbie stanów niż automat podany na wejściu

algorytmy minimalizacji są algorytmami niedeterministycznymi

algorytmy minimalizacji nie działają dla automatów jednostanowych