Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lfa:2024:lab11 [2025/01/09 00:09]
cata_chiru
lfa:2024:lab11 [2025/01/09 00:14] (current)
cata_chiru [11.2. Closed under CFLs]
Line 168: Line 168:
 Let \( L_1 \) be a context-free language and \( P = (K_1, \Sigma, \Gamma, \Delta_1, q^{1}_{0}, F_1) \)  ​ Let \( L_1 \) be a context-free language and \( P = (K_1, \Sigma, \Gamma, \Delta_1, q^{1}_{0}, F_1) \)  ​
 be its respective PDA.  ​ be its respective PDA.  ​
 +
 +Let \( L_2 \) be a regular language and \( A = (K_2, \Sigma, \delta, q_{20}, F_2) \) be its respective DFA.  ​
  
 We build the following PDA \( (K, \Sigma, \Gamma, \Delta, q_0, F) \) where:  ​ We build the following PDA \( (K, \Sigma, \Gamma, \Delta, q_0, F) \) where:  ​
 +
 - \( K = K_1 \times K_2 \)  ​ - \( K = K_1 \times K_2 \)  ​
 +
 - \( q_0 = (q^{1}_{0}, q^{2}_{0}) \)  ​ - \( q_0 = (q^{1}_{0}, q^{2}_{0}) \)  ​
- 
-Let \( L_2 \) be a regular language and \( A = (K_2, \Sigma, \delta, q_{20}, F_2) \) be its respective DFA.  ​ 
  
 Transition rules for \( \Delta \):  ​ Transition rules for \( \Delta \):  ​
  
 1. \( ((q_1, q_2), c, \alpha, (q_1', q_2'), \beta) \in \Delta \)  ​ 1. \( ((q_1, q_2), c, \alpha, (q_1', q_2'), \beta) \in \Delta \)  ​
-   if \( (q_1, c, \alpha, q_1', \beta) \in \Delta_1 \) and   +   iff \( (q_1, c, \alpha, q_1', \beta) \in \Delta_1 \) and \( \delta(q_2, c) = q_2' \).  ​
-   \( \delta(q_2, c) = q_2' \).  ​+
  
 2. \( ((q_1, q_2), \epsilon, \alpha, (q_1', q_2), \beta) \in \Delta \)  ​ 2. \( ((q_1, q_2), \epsilon, \alpha, (q_1', q_2), \beta) \in \Delta \)  ​
-   if \( (q_1, \epsilon, \alpha, q_1', \beta) \in \Delta_1 \).  ​+   iff \( (q_1, \epsilon, \alpha, q_1', \beta) \in \Delta_1 \).  ​
  
-Accepting states:  ​ 
 - \( F = F_1 \times F_2 \)  ​ - \( F = F_1 \times F_2 \)  ​
  
Line 192: Line 192:
 **11.2.6.** Difference with a regular language is a closure property. **11.2.6.** Difference with a regular language is a closure property.
 <hidden Solution 11.2.6.> <hidden Solution 11.2.6.>
-Let \( \) be a context-free language and \( \) a regular language. $ \overline{B} $ is regular, as complement is a closure property for regular languages. From 11.2.5, we know that the intersection is closed between CFLs and Regular Languages, and write $ \setminus ​\cap \overline{B} $.+Let \( L_1 \) be a context-free language and \( L_2 \) a regular language. 
 + 
 +$ \overline{L_2} $ is regular, as complement is a closure property for regular languages. 
 + 
 +From 11.2.5, we know that the intersection is closed between CFLs and Regular Languages, and write $ L_1 \setminus ​L_2 L_1 \cap \overline{L_2} $.
  
 </​hidden>​ </​hidden>​