Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lfa:lab06-closure-properties [2020/11/12 13:19] pdmatei |
lfa:lab06-closure-properties [2022/11/17 19:16] (current) pdmatei |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Closure properties ====== | + | ====== 7. Closure properties ====== |
- | **Exercise 1.** Show that $(10 \cup 0)^*(1 \cup \epsilon)$ and $(1 \cup \epsilon)(00^*1)^*0^*$ are equivalent regular expressions. | + | **7.1.** Show that $(10 \cup 0)^*(1 \cup \epsilon)$ and $(1 \cup \epsilon)(00^*1)^*0^*$ are equivalent regular expressions. Are there several strategies? |
- | **Exercise 2.** Write the "complement" regular expression for $(10 \cup 0)^*(1 \cup \epsilon)$. | + | <hidden> All strategies require building DFAs from the regexes. |
+ | - You can use an existing minimisation algorithm to find the minimal DFAs. Then, label each state from each DFA from 0 to |K|. Fix an ordering of the symbols of the alphabet. Sort the transitions by symbol. Make a textual representation of each DFA which includes the number of states and the sorted transition function. If the textual representations of the two DFAs are identical then they accept the same language. | ||
+ | - Use the indistinguishability algorithm to check if the two initial states of the two DFAs are indistinguishable. | ||
+ | - Check $math[L(A_1) \subseteq L(A_2)] and $math[L(A_2) \subseteq L(A_1)]. The condition $math[L(A) \subseteq L(B)] can be restated as $math[L(A) \cap complement(L(B)) = \emptyset]. Build the complement DFA for B, and use the product construction with A. Check if the resulting DFA has any final state accessible from the initial one. | ||
+ | </hidden> | ||
- | **Exercise 3.** Define the reversal of a language $ L $ as $ rev(L) = \{ w \in \Sigma^* | rev(w) \in L \}$, where $ rev(c_1c_2 \dots c_n) = c_nc_{n - 1} \dots c_1$ , with $ c_i \in \Sigma, 1 \leq i \leq n $. Show that reversal is a closure property. | + | **7.2.** Write the "complement" regular expression for $(10 \cup 0)^*(1 \cup \epsilon)$. |
- | **Exercise 4.** Let $ L \subseteq \Sigma^* $ be a language and $ c \in \Sigma $ a symbol. The quotient of $ L $ and $ c $ is the language defined as $ L/c = \{ w \in \Sigma^* | wc \in L\} $. | + | **7.3.** (Solved during lecture) Define the reversal of a language $ L $ as $ rev(L) = \{ w \in \Sigma^* | rev(w) \in L \}$, where $ rev(c_1c_2 \dots c_n) = c_nc_{n - 1} \dots c_1$ , with $ c_i \in \Sigma, 1 \leq i \leq n $. Show that reversal is a closure property. |
- | **4.1.** Let $ L = L((aaa \cup ba)^*(ab)^* )$. What is the language $ L/a $ ? | + | ===== Quotients ===== |
- | **4.2.** Let $ L = L(a^*)$. What is the language $ L/a $ ? | + | |
- | **4.2.** Prove that if $ L $ is a regular language, then $ L/c$ is a regular language $ \forall c \in \Sigma$. | + | Let $ L \subseteq \Sigma^* $ be a language and $ c \in \Sigma $ a symbol. The quotient of $ L $ and $ c $ is the language defined as $ L/c = \{ w \in \Sigma^* | wc \in L\} $. |
- | **4.3.** Let $ L \subseteq \Sigma^* $ be a language and $ c \in \Sigma $ a symbol. Then $ c / L = \{ w \in \Sigma^* | cw \in L \} $. Prove that if $ L $ is a regular language, then $ a / L $ is a regular language,$ \forall a \in \Sigma$. | + | **7.4.1.** Let $ L = L((aaa \cup ba)^*(ab)^* )$. What is the language $ L/a $ ? |
- | **Exercise 5.** Prove that $ \text{suffix}(L) = \{ w \in \Sigma^* | \exists x \in \Sigma^*, \: \text{such that} \: xw \in L \} $ is a closure property. | + | **7.4.2.** Let $ L = L(a^*)$. What is the language $ L/a $ ? |
- | **Exercise 6.** Define $ min(L) = \{ w \in L | \; \nexists x \in L, \; y \in \Sigma^* \setminus \{\epsilon\}, \: \text{such that} \: xy = w \}$. | + | **7.4.3.** Prove that if $ L $ is a regular language, then $ L/c$ is a regular language $ \forall c \in \Sigma$. |
+ | |||
+ | **7.5.** Let $ L \subseteq \Sigma^* $ be a language and $ c \in \Sigma $ a symbol. Then $ c / L = \{ w \in \Sigma^* | cw \in L \} $. Prove that if $ L $ is a regular language, then $ a / L $ is a regular language,$ \forall a \in \Sigma$. | ||
+ | |||
+ | ===== Suffixes and prefixes ===== | ||
+ | |||
+ | **7.6.** Prove that $ \text{suffix}(L) = \{ w \in \Sigma^* | \exists x \in \Sigma^*, \: \text{such that} \: xw \in L \} $ is a closure property. | ||
+ | |||
+ | ===== Other transformations ===== | ||
+ | Let $ min(L) = \{ w \in L | \; \nexists x \in L, \; y \in \Sigma^* \setminus \{\epsilon\}, \: \text{such that} \: xy = w \}$. | ||
//Example//: If $ L = \{ aab, bab, aa \} $, then $ min(L) = \{ bab, aa \} $. | //Example//: If $ L = \{ aab, bab, aa \} $, then $ min(L) = \{ bab, aa \} $. | ||
- | **6.1.** What is the language $ min(L(a^*)) $ ? | + | **7.7.1.** What is the language $ min(L(a^*)) $ ? |
- | **6.2.** What is the language $ min(L(a^*b)) $ ? | + | **7.7.2.** What is the language $ min(L(a^*b)) $ ? |
- | **6.3.** Prove that $ min $ has the closure property with respect to the regular languages. | + | **7.7.3.** Prove that $ min $ has the closure property with respect to the regular languages. |