Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
lfa:2026:lab01 [2026/10/05 11:04] tpruteanu |
lfa:2026:lab01 [2026/10/05 11:36] (current) tpruteanu |
||
|---|---|---|---|
| Line 22: | Line 22: | ||
| </hidden>*/ | </hidden>*/ | ||
| - | **1.1.2.** $ L=\{w \in \{0,1\}^* \text{ | w contains an odd number of ones} \} $. | + | **1.1.2.** The language of binary words that contains only the words 010 and 1010. |
| + | |||
| + | **1.1.3.** $ L=\{w \in \{0,1\}^* \text{ | w contains an odd number of ones} \} $. | ||
| Line 36: | Line 38: | ||
| - | **1.1.3.** The language of binary words which contain **exactly** two ones. | + | **1.1.4.** The language of binary words which contain **exactly** two ones. |
| /*<hidden> | /*<hidden> | ||
| Line 46: | Line 48: | ||
| </hidden>*/ | </hidden>*/ | ||
| + | **1.1.5.** The language of all binary words having the substring 00101. | ||
| - | **1.1.4.** (*) The language of words which encode binary numbers divisible by 3. | + | **1.1.6.** The language of binary words that start and end with different digits. |
| - | **1.1.5.** (* *) The language of words which encode binary numbers divisible by 3, represented in reverse order (the least significant digit is first). | + | **1.1.7.** (*) The language of words which encode binary numbers divisible by 3. |
| - | **1.1.6.** (*) The language of quaternary words (base 4), that follow the rule that every zero is immediately followed by a sequence of at least 2 consecutive threes and every one is immediately followed by a sequence of at most 2 consecutive twos. | + | **1.1.8.** (* *) The language of words which encode binary numbers divisible by 3, represented in reverse order (the least significant digit is first). |
| - | **1.1.7.** The language of all binary words having the substring 00101. | + | **1.1.9.** (*) The language of quaternary words (base 4), that follow the rule that every zero is immediately followed by a sequence of at least 2 consecutive threes and every one is immediately followed by a sequence of at most 2 consecutive twos. |
| + | |||
| + | **1.1.10.** (*) The langauge of binary words that have an equal number of **01** sequences as **10** sequences. | ||
| /*<hidden> | /*<hidden> | ||
| Line 60: | Line 65: | ||
| * Analyze how each incoming character changes the current available sequence. For example, if we are in state **E** and we read character **1** we reach a final state, but if we read **0** we go back to state **C** since the available seq will be **00** | * Analyze how each incoming character changes the current available sequence. For example, if we are in state **E** and we read character **1** we reach a final state, but if we read **0** we go back to state **C** since the available seq will be **00** | ||
| </hidden>*/ | </hidden>*/ | ||
| - | |||
| - | **1.1.8.** The language of binary words that start and end with different digits. | ||
| /*<hidden> | /*<hidden> | ||
| Line 72: | Line 75: | ||
| ---- | ---- | ||
| - | === 1.2. Describe in natural speak the language accepted by these DFAs. Make sure your description is fit to the DFA and not too broad (covers all words accepted and no other word). === | + | **1.2.1** What happens if we switch all final states to non-final states and vice-versa in a DFA? |
| - | + | ||
| - | <note tip> | + | |
| - | We highly recommend simulating how the automaton behaves on a few test words. | + | |
| - | </note> | + | |
| - | + | ||
| - | **1.2.1** | + | |
| - | + | ||
| - | {{:lfa:2024:lab1-2_2_2.png?300|}} | + | |
| - | /* Cel puțin un grup de: 0 urmat de un număr impar de 1-uri urmat de un număr par de 0-uri */ | + | |
| - | + | ||
| - | **1.2.2** | + | |
| - | + | ||
| - | {{:lfa:2024:lab1-2_2_1.png?500|}} | + | |
| - | /* Cuvinte nevide în care după un grup de 0-uri consecutive urmează fie nimic, fie un număr impar de 1-uri consecutive, | + | |
| - | și după un grup consecutiv de 1-uri urmează fie nimic, fie un număr par de 0-uri consecutive */ | + | |
| - | + | ||
| - | **1.2.3** | + | |
| - | + | ||
| - | {{:lfa:2024:lab1-2_2_3.png?300|}} | + | |
| - | /* Oricâte grupuri de a sau ab sau abc */ | + | |
| - | + | ||
| - | **1.2.4** | + | |
| - | + | ||
| - | {{:lfa:2024:lab1-2_2_4.png?300|}} | + | |
| - | /* Cuvinte nevide peste {0,1}* care nu încep și se termină cu aceași cifră */ | + | |
| - | + | ||
| - | **1.2.5** | + | |
| - | + | ||
| - | {{:lfa:2024:lab1-2_2_5.png?400|}} | + | |
| - | /* Cuvinte de lungime pară care conțin cel puțin un b */ | + | |
| - | + | ||
| - | **1.2.6** | + | |
| - | + | ||
| - | {{:lfa:2024:lab1-2_2_6.png?400|}} | + | |
| - | /* Cuvinte care încep cu a sau b și sunt formate din secvențe alternative (posibil vide) separate prin c în care | + | |
| - | după orice a urmează un b sau după orice b urmează un a; dacă cuvântul începe cu a, prima secvență este de primul tip, | + | |
| - | iar dacă începe cu b. prima secvență este de al doilea tip */ | + | |
| - | + | ||
| - | + | ||
| - | ---- | + | |
| - | + | ||
| - | **1.3.1** What happens if we switch all final states to non-final states and vice-versa in a DFA? | + | |
| - | + | ||
| - | **1.3.2** Prove that if L(M) is infinite, there has to be some cycle in the states graph, such that there is a path from the initial state to the cycle, and from the cycle to a final state. | + | |
| - | **1.3.3** If no such cycle described above exist, L(M) is finite. | + | **1.2.2** Prove that if L(M) is infinite, there has to be some cycle in the states graph, such that there is a path from the initial state to the cycle, and from the cycle to a final state. If no such cycle exists, L(M) has to be finite. |
| - | **1.3.4** Show that if you can construct a DFA to accept L, than you can also construct a DFA to accept $ L \cup \{a\}, \forall a \in \Sigma $. | + | **1.2.3** Show that if you can construct a DFA to accept L, than you can also construct a DFA to accept $ L \cup \{a\}, \forall a \in \Sigma $. |