Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lfa:2024:lab03 [2024/10/20 13:23] cata_chiru |
lfa:2024:lab03 [2024/10/22 08:13] (current) cata_chiru |
||
---|---|---|---|
Line 126: | Line 126: | ||
</hidden> | </hidden> | ||
- | |||
- | ** 3.2.5 ** | ||
- | |||
- | $ E1 = (a\mid b)^*aa^* \mid \epsilon $ | ||
- | \\ | ||
- | $ E2 = (a\mid ba)^*(b\mid ba)^* $ | ||
- | |||
- | |||
- | <hidden 3.2.5><note important> | ||
- | Both E1 and E2 have an infinite language, so comparing them is not an option. | ||
- | |||
- | We can see that for example E2 accepts b, while E1 does not accept it, so the expressions are not equivalent. | ||
- | |||
- | Fun fact: E1 was proposed by a student as a solution for 3.2.2 last year, while E2 is the actual solution. | ||
- | </note></hidden> | ||
- | |||
- | |||
- | ** 3.2.6 ** | ||
- | |||
- | $ E1 = ((ab^*a)^+b)^* $ | ||
- | \\ | ||
- | $ E2 = (a(b\mid aa)^*ab)^* $ | ||
- | |||
- | |||
- | <hidden 3.2.6><note important> | ||
- | Both E1 and E2 have an infinite language, so comparing them is not an option. | ||
- | |||
- | We can try looking for words that are accepted by one and not by the others, but we can't easily find such words. ! This does not mean they are equivalent ! | ||
- | |||
- | We should transform each expression into its min DFA and check if they are the same (number of states, transitions, alphabet, initial/final states) (renaming of states might be needed). | ||
- | |||
- | Plot twist: They are the same. | ||
- | |||
- | The purpose of this exercise is to understand how to approach regex equivalence, not how to solve this given comparison per | ||
- | se. | ||
- | </note></hidden> | ||
Line 175: | Line 139: | ||
- | <hidden><note important> | + | <hidden 3.3.1><note important> |
We can observe that E2 accepts ε, while E1 does not so they are not equivalent. | We can observe that E2 accepts ε, while E1 does not so they are not equivalent. | ||
\\ | \\ | ||
Line 189: | Line 153: | ||
- | <hidden><note important> | + | <hidden 3.3.2><note important> |
Since both E1 and E2 have a finite language, we could just compute the language and check if they are equivalent. | Since both E1 and E2 have a finite language, we could just compute the language and check if they are equivalent. | ||
Language is L = {abb, abc, abd, abe, acd, ace}, therefore they are equivalent. | Language is L = {abb, abc, abd, abe, acd, ace}, therefore they are equivalent. | ||
Line 202: | Line 166: | ||
- | <hidden><note important> | + | <hidden 3.3.3><note important> |
Both E1 and E2 have an infinite language, so comparing them is not an option. | Both E1 and E2 have an infinite language, so comparing them is not an option. | ||
We can see that for example E2 accepts b, while E1 does not accept it, so the expressions are not equivalent. | We can see that for example E2 accepts b, while E1 does not accept it, so the expressions are not equivalent. | ||
- | Fun fact: E1 was proposed by a student as a solution for 3.2.2 last year, while E2 is the actual solution. | + | Fun fact: E1 was proposed by a student as a solution for 3.4.1 some year ago, while E2 is the actual solution. |
</note></hidden> | </note></hidden> | ||
Line 218: | Line 182: | ||
- | <hidden><note important> | + | <hidden 3.3.4><note important> |
Both E1 and E2 have an infinite language, so comparing them is not an option. | Both E1 and E2 have an infinite language, so comparing them is not an option. | ||