Differences

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

Link to this comparison view

Next revision
Previous revision
lfa:2024:lab06 [2024/11/08 20:20]
stefan.sterea created
lfa:2024:lab06 [2024/11/12 00:59] (current)
stefan.sterea
Line 21: Line 21:
  
 <​hidden><​note tip> <​hidden><​note tip>
-  * assume the states are labeled ​as integers ​starting ​with 0and that 0 is the unique ​initial state of both DFAs (this can be easily obtained from any previous transformation)+Without loss of generality, ​assume the states are labeled ​with numbers ​starting ​from 0 and 0 is their initial state.  
-  * give an ordering to the symbols of the alphabet. Write $math[\delta] as string by the following rules: +Give an ordering to the symbols of the alphabet ​and perform ​DFS on the two DFAs simultaneously,​ relabeling the states as you discover them 
-    * we sort each transition $math[\delta(q,​c)=q'​],​ by $math[q] first and by $math[c], secondWe append each transition ​given this ordering (//​smaller//​ states first, then for each state, output the order of the $math[\delta(q,​c)] transitions according to $math[c]. +with the lowest label number availableAlways choose transitions according to the given order of the alphabetAt the end, check whether their 
-  * two minimal DFAs accept ​the same language **iff**: +transition tables are identical and they have the same final states.
-    ​* ​they have the same string representation of $math[\delta] and +
-    * have the same final states.+
  
 Another more elegant approach is to use state equivalence. We can treat two (not necessarily minimal) DFAs as one and the same, and compute the (in)distinguishability table over all states, in a single go. Finally, the DFAs accept the same language iff their initial states are indistinguishable. Another more elegant approach is to use state equivalence. We can treat two (not necessarily minimal) DFAs as one and the same, and compute the (in)distinguishability table over all states, in a single go. Finally, the DFAs accept the same language iff their initial states are indistinguishable.
Line 123: Line 121:
 </​note></​hidden>​ </​note></​hidden>​
  
-5.2.4. (**Optional**) Determine if the following regexes are **equivalent**:​ $math[(1\cup\epsilon)(00^*1)^*0^*and $math[(10\cup 0)^*(01 \cup 1)^*(0 \cup \epsilon)]+5.2.4. (**Optional**) Determine if the following regexes are **equivalent**:​ $ (1\cup\epsilon)(00^*1)^*0^* ​and $ (10\cup 0)^*(01 \cup 1)^*(0 \cup \epsilon) ​$
  
-<​hidden>​ +5.2.5. Consider the following sequence ​of DFAs $ D_n $ which all accept ​the language $ L(a^+b^*) $.
-<note tip>The two languages are not equivalent because ​of word "​110" ​which is accepted by the second regex, but rejected by the first regex.</​note>​ +
-</​hidden>​+
  
 +{{:​lfa:​2024:​lab6-2_5_d0.png?​300 |}}
 +{{:​lfa:​2024:​lab6-2_5_d1.png?​450|}}
 +{{:​lfa:​2024:​lab6-2_5_d2.png?​450|}}
 +...and so on
 +
 +<hidden Formal definition of the sequence above>
 +<​note>​
 +\begin{align*}
 +&D_n = (K_n, \Sigma, \delta_n, q_0, F_n) & &n \geq 0 \\
 +&K_n = \{S, X\} \cup \{A_i, B_i\}_{i=0}^n \\
 +&\Sigma = \{a, b\} \hspace{3em} q_0 = S & &F_n = \{A_i, B_i\}_{i=0}^n \\
 +\end{align*} \begin{align*}
 +\delta_n(S, a) &= A_n & \delta_n(A_0,​ a) &= A_0 & \delta_n(A_i,​ a) &= A_{i-1} & &i \geq 1 \\
 +\delta_n(S, b) &= X   & \delta_n(A_0,​ b) &= B_n & \delta_n(A_i,​ b) &= B_n     & &i \geq 1 \\
 +\delta_n(X, a) &= X   & \delta_n(B_0,​ a) &= X   & \delta_n(B_i,​ a) &= X       & &i \geq 1 \\
 +\delta_n(X, b) &= X   & \delta_n(B_0,​ b) &= B_0 & \delta_n(B_i,​ b) &= B_{i-1} & &i \geq 1
 +\end{align*}
 +</​note>​
 +</​hidden>​
 +Use Hopcroft'​s algorithm to minimise the first few DFAs in the sequence. Count the number of steps performed and the number of splits. Determine the time complexity of the algorithm.
 +{{:​lfa:​2024:​lab6-hopcroft.png?​500|}}
  
-5.2.5. (**Extra**) Apply the **Brzozowski** minimisation algorithm on DFA 1.+5.2.6. (**Extra**) Apply the **Brzozowski** minimisation algorithm on DFA 1.
  
 <note important>​Brzozowski minimisation:​ **minDfa(A) = toDfa(reverse(toDfa(reverse(A))))**</​note>​ <note important>​Brzozowski minimisation:​ **minDfa(A) = toDfa(reverse(toDfa(reverse(A))))**</​note>​