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
aa:lab:sol:3 [2023/10/27 11:36]
ioana.dabelea
aa:lab:sol:3 [2023/10/31 18:51] (current)
alexandra.udrescu01 [Exercițiul 2]
Line 16: Line 16:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{se termină\Rightarrow ​\text{vom returna x == 111\Rightarrow ​\text{când x este 111}, M^* \text{va tranziţiona în Y} => M^*[111] \rightarrow TRUE \Rightarrow f_{111}(M^*) = TRUE$ +  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] se termină ​ $\Rightarrow ​vom returna x == 111 $\Rightarrow ​când x este 111, M^* va tranziţiona în Y $\Rightarrow ​M^*[111] \rightarrow TRUE \Rightarrow f_{111}(M^*) = TRUE$ 
-  - $ f_{111}(M^*) = TRUE \Rightarrow M^*[111] \rightarrow TRUE \Rightarrow ​\text{am ajuns la return\Rightarrow ​\text{run M[w] din }M^* \text{nu a ciclat\Rightarrow ​\text{M[w] s-a oprit\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{111}(M^*) = TRUE \Rightarrow M^*[111] \rightarrow TRUE \Rightarrow ​am ajuns la return ​$\Rightarrow ​run M[w] nu a ciclat ​\Rightarrow ​M[w] s-a oprit $\Rightarrow f_{h}(M, w) = TRUE$
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{111}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{111}$.
Line 36: Line 36:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{se termină\Rightarrow ​\text{o sa verificăm dacă x este palindrom\Rightarrow ​\text{când x este palindrom}, M^* \text{va tranziţiona în Y ​\Rightarrow f_{p}(M^*) = TRUE$ +  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] se termină ​$\Rightarrow ​o sa verificăm dacă x este palindrom ​$\Rightarrow ​când x este palindrom, ​M^* va tranziţiona în Y  ​\Rightarrow f_{p}(M^*) = TRUE$ 
-  - $ f_{p}(M^*) = TRUE \Rightarrow M^*[x] ​\text{decide daca x este palindrom ​\forall x \Rightarrow ​\text{am ajuns la return\Rightarrow ​\text{run M[w] din }M^* \text{nu a ciclat\Rightarrow ​\text{M[w] s-a oprit\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{p} (M^*) = TRUE \Rightarrow M^*[x] ​decide daca x este palindrom ​ ​$  ​\forall x \Rightarrow ​am ajuns la return ​$  ​\Rightarrow ​run M[w] din  ​$ ​M^* nu a ciclat ​$  ​\Rightarrow ​M[w] s-a oprit $  ​\Rightarrow f_{h} (M, w) = TRUE$
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{p}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{p}$.
Line 55: Line 55:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{se termină\Rightarrow ​\text{o sa calculeze rev(x) deoarece ajunge la return\Rightarrow f_{rev}(M^*) = TRUE$ +  - $ f_{h} (M, w) = TRUE \Rightarrow M[w]  ​$ ​se termină ​$  ​\Rightarrow ​ ​$ ​o sa calculeze rev(x) deoarece ajunge la return ​$  ​\Rightarrow f_{rev} (M^*) = TRUE$ 
-  - $ f_{rev}(M^*) = TRUE \Rightarrow M^*[x] ​\text{calculeaza rev(x) ​\forall x \forall x \Rightarrow ​\text{am ajuns la return\Rightarrow ​\text{run M[w] din }M^* \text{nu a ciclat\Rightarrow ​\text{M[w] s-a oprit\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{rev} (M^*) = TRUE \Rightarrow M^*[x] ​ ​$ ​calculeaza rev(x) ​ ​$  ​\forall x \forall x \Rightarrow ​ ​$ ​am ajuns la return ​$  ​\Rightarrow ​ ​$ ​run M[w] din  ​$ ​M^*  ​$ ​nu a ciclat ​$  ​\Rightarrow ​ ​$ ​M[w] s-a oprit $  ​\Rightarrow f_{h} (M, w) = TRUE$
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{rev}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{rev}$.
Line 76: Line 76:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{se termină\Rightarrow M^*[enc(M^*)] ​\text{se termina\Rightarrow f_{own}(M^*) = TRUE$ +  - $ f_{h} (M, w) = TRUE \Rightarrow M[w]  ​$ ​se termină ​$  ​\Rightarrow M^*[enc(M^*)] ​ ​$ ​se termina ​$  ​\Rightarrow f_{own} (M^*) = TRUE$ 
-  - $ f_{own}(M^*) = TRUE \Rightarrow M^*[enc(M^*)] ​\text{se termina\Rightarrow ​\text{run M[w] din }M^* \text{nu a ciclat\Rightarrow ​\text{M[w] s-a oprit\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{own} (M^*) = TRUE \Rightarrow M^*[enc(M^*)] ​ ​$ ​se termina ​$  ​\Rightarrow ​ ​$ ​run M[w] din  ​$ ​M^*  ​$ ​nu a ciclat ​$  ​\Rightarrow ​ ​$ ​M[w] s-a oprit $  ​\Rightarrow f_{h} (M, w) = TRUE$
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{own}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{own}$.
Line 99: Line 99:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{ ​se termină in n paşi\Rightarrow M^*[w] ​\text{se opreşte ​\forall x \text{, |x| < n}\text{ciclează ​\forall x \text{, |x| >= n\Rightarrow f_{finite}(M^*) = TRUE$ +  - $ f_{h} (M, w) = TRUE \Rightarrow M[w]  ​$  ​se termină in n paşi $  ​\Rightarrow M^*[w] ​ ​$ ​se opreşte ​ ​$  ​\forall x  ​$ ​, |x| < n  ​$ ​ciclează ​ ​$  ​\forall x  ​$ ​, |x| >= n $  ​\Rightarrow f_{finite} (M^*) = TRUE$ 
-  - $ f_{finite}(M^*) = TRUE \Rightarrow M^*[x] ​\text{ ​se opreşte după un număr finit de cuvinte ​}\Rightarrow ​\text{M[w] s-a oprit după un număr finit de paşi\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{finite} (M^*) = TRUE \Rightarrow M^*[x] ​ ​$  ​se opreşte după un număr finit de cuvinte ​ ​$ ​\Rightarrow ​ ​$ ​M[w] s-a oprit după un număr finit de paşi $  ​\Rightarrow f_{h} (M, w) = TRUE$
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{finite}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{finite}$.
Line 121: Line 121:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{se termină\Rightarrow ​\text{cum M^* \text{se poate opri doar pentru x = 101\Rightarrow f_{set}(A, M^*) = TRUE$ +  - $ f_{h} (M, w) = TRUE \Rightarrow M[w]  ​$ ​se termină ​$  ​\Rightarrow ​ ​$ ​cum  ​$  ​M^*  ​$ ​se poate opri doar pentru x = 101 $  ​\Rightarrow ​\forall w f_{set} (A, M^*) = TRUE$ 
-  - $ f_{set}(M^*) = TRUE \Rightarrow M^*[x] ​\text{o să se oprească pentru orice x din A\Rightarrow ​\text{M[w] s-a oprit\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{set} (M^*) = TRUE \Rightarrow M^*[x] ​ ​$ ​o să se oprească pentru orice x din A $  ​\Rightarrow ​ ​$ ​M[w] s-a oprit $  ​\Rightarrow f_{h} (M, w) = TRUE$ 
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{set}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{set}$.
Line 140: Line 141:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{se termină\Rightarrow ​\text{cum M^* \text{printează x la final\Rightarrow f_{x}(M^*) = TRUE$ +  - $ f_{h} (M, w) = TRUE \Rightarrow M[w]  ​$ ​se termină ​$  ​\Rightarrow ​ ​$ ​cum  ​$  ​M^*  ​$ ​printează x la final $  ​\Rightarrow f_{x} (M^*) = TRUE$ 
-  - $ f_{x}(M^*) = TRUE \Rightarrow M^*[x] ​\text{ajunge să printeze x pe bandă\Rightarrow ​\text{M[w] s-a oprit\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{x} (M^*) = TRUE \Rightarrow M^*[x] ​ ​$ ​ajunge să printeze x pe bandă ​$  ​\Rightarrow ​ ​$ ​M[w] s-a oprit $  ​\Rightarrow f_{h} (M, w) = TRUE$ 
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{x}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{x}$.
Line 164: Line 166:
  
 Demonstraţii: ​ Demonstraţii: ​
-  - $ f_{h}(M, w) = TRUE \Rightarrow M[w] \text{se termină\Rightarrow M_{2} \text{acceptă orice x, iar M_{1}[x] ​\text{deja acceptă orice x din construcţie\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ +  - $ f_{h} (M, w) = TRUE \Rightarrow M[w]  ​$ ​se termină ​$  ​\Rightarrow M_{2}   $ acceptă orice x, iar  ​$  ​M_{1} [x]  ​$ ​deja acceptă orice x din construcţie ​$  ​\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq} (M_{1} , M_{2} ) = TRUE$ 
-  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] \Rightarrow ​\text{stim din construcţie căM_{1} \text{acceptă orice x\Rightarrow M_{2} \text{acceptă orice x\Rightarrow M[w] \text{se opreşte\Rightarrow f_{h}(M, w) = TRUE$+  - $ f_{eq} (M_{1} , M_{2} ) = TRUE \Rightarrow M_1[w] \equiv M_2[w] \Rightarrow ​ ​$ ​stim din construcţie că $  ​M_{1}   $ acceptă orice x $  ​\Rightarrow M_{2}   $ acceptă orice x $  ​\Rightarrow M[w]  ​$ ​se opreşte ​$  ​\Rightarrow f_{h} (M, w) = TRUE$ 
  
 Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{eq}$. Din cele 2 direcţii ale demonstraţiei $\Rightarrow f_{h} \le_m f_{eq}$.
Line 188: Line 191:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{all}(M) = \Rightarrow \forall x, M[x] \text{se termină\Rightarrow M_{2} \text{ ​acceptă orice x, iarM_{1} \text{deja acceptă orice x din construcţie\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ +  - $ f_{all} (M) = TRUE \Rightarrow \forall x, M[x]  ​$ ​se termină ​$  ​\Rightarrow M_{2}   $  ​acceptă orice x, iar $  ​M_{1}   $ deja acceptă orice x din construcţie ​$  ​\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq} (M_{1} , M_{2} ) = TRUE$ 
-  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​\text{, ştim din construcţie că M_{1} \text{ ​acceptă orice x\Rightarrow M_{2} \text{ ​acceptă orice x\Rightarrow M[x] \text{se opreşte pentru orice x\Rightarrow f_{all}(M, w) = TRUE$ +  - $ f_{eq} (M_{1} , M_{2} ) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​ ​$ ​, ştim din construcţie că  ​$  ​M_{1}  ​$  ​acceptă orice x $  ​\Rightarrow M_{2}   $  ​acceptă orice x $  ​\Rightarrow M[x]  ​$ ​se opreşte pentru orice x $  ​\Rightarrow f_{all} (M, w) = TRUE$  
  
 ------ ------
Line 216: Line 220:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{any}(M) = M \Rightarrow \exists w, M[w] \text{se termină\Rightarrow M_{2} \text{ ​acceptă orice x, iarM_{1} \text{deja acceptă orice x din construcţie\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ +  - $ f_{any}(M) = M \Rightarrow \exists w, M[w]  ​$ ​se termină ​\Rightarrow M_{2}  ​$  ​acceptă orice x, iar M_{1}  ​$ ​deja acceptă orice x din construcţie ​\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ 
-  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​\text{, ştim din construcţie că M_{1} \text{ ​acceptă orice x\Rightarrow M_{2} \text{ ​acceptă orice x\Rightarrow \exists w \text{ ​astfel încât ​M[w] \text{ ​se opreşte\Rightarrow f_{any}(M, w) = TRUE$ +  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​ ​$ ​, ştim din construcţie că M_{1}  ​$  ​acceptă orice x \Rightarrow M_{2}  ​$  ​acceptă orice x \Rightarrow \exists w  ​$  ​astfel încât ​M[w]  ​$  ​se opreşte ​\Rightarrow f_{any}(M, w) = TRUE$ 
  
 ------ ------
Line 239: Line 243:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{p} = TRUE \Rightarrow \forall x M \text{decide daca e palindrom\Rightarrow M_{2} \text{ ​acceptă orice x, iarM_{1} \text{deja acceptă orice x din construcţie\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ +  - $ f_{p} = TRUE \Rightarrow \forall x M  ​$ ​decide daca e palindrom ​\Rightarrow M_{2}  ​$  ​acceptă orice x, iar M_{1}  ​$ ​deja acceptă orice x din construcţie ​\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ 
-  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​\text{, ştim din construcţie că M_{1} \text{ ​acceptă orice x\Rightarrow M_{2} \text{ ​acceptă orice x\Rightarrow M \text{ ​decide corect dacă x este palindrom\Rightarrow f_{p} = TRUE$+  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​ ​$ ​, ştim din construcţie că M_{1}  ​$  ​acceptă orice x \Rightarrow M_{2}  ​$  ​acceptă orice x \Rightarrow M  ​$  ​decide corect dacă x este palindrom ​\Rightarrow f_{p} = TRUE$
  
 -------- --------
Line 260: Line 264:
  
 Demonstraţii:​ Demonstraţii:​
-  - $ f_{own} = TRUE \Rightarrow M[enc(M)] ​\text{ ​se termină\Rightarrow M_{2} \text{ ​acceptă orice x, iarM_{1} \text{deja acceptă orice x din construcţie\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ +  - $ f_{own} = TRUE \Rightarrow M[enc(M)] ​ ​$  ​se termină ​\Rightarrow M_{2}  ​$  ​acceptă orice x, iar M_{1}  ​$ ​deja acceptă orice x din construcţie ​\Rightarrow M_1[w] \equiv M_2[w] \Rightarrow f_{eq}(M_{1},​ M_{2}) = TRUE$ 
-  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​\text{, ştim din construcţie că M_{1} \text{ ​acceptă orice x\Rightarrow M_{2} \text{ ​acceptă orice x\Rightarrow M[enc(M)] ​\text{ ​se termină\Rightarrow f_{own} = TRUE$+  - $ f_{eq}(M_{1},​ M_{2}) = TRUE \Rightarrow M_1[w] \equiv M_2[w] ​ ​$ ​, ştim din construcţie că M_{1}  ​$  ​acceptă orice x \Rightarrow M_{2}  ​$  ​acceptă orice x \Rightarrow M[enc(M)] ​ ​$  ​se termină ​\Rightarrow f_{own} = TRUE$
  
 ===== Exercițiul 3 ===== ===== Exercițiul 3 =====