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:24] 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 207: | Line 171: | ||
| 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> | ||