Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
lfa:lab08-push-down-automata [2020/11/21 22:30] ruxandrarusu created |
lfa:lab08-push-down-automata [2020/12/04 22:08] (current) dmihai |
||
---|---|---|---|
Line 2: | Line 2: | ||
**Exercise 1.** Write PDAs for the following languages: | **Exercise 1.** Write PDAs for the following languages: | ||
- | 1.1. $ L = \{\: w \in \{A,B\}^* \| w is a palindrome\} $ | + | |
- | 1.2. L = {w in {A,B}* . #A(w) =/= #B(w)} | + | **1.1.** $ L = \{\: w \in \{A,B\}^* \ | \:w \text{ is a palindrome}\} $ |
- | 1.3. L = {A^nB^{m+n}C^n . n,m >= 0} | + | |
- | 1.4. L = {A^nB^nC^mD^m . n,m >= 0} U {A^nB^mC^mD^n . n,m >= 0} | + | **1.2.** $ L = \{\: w \in \{A,B\}^* \ | \: \text{#}A(w) \neq \: \text{#}B(w) \} $ |
- | 1.5. L = {A^iB^jC^k . i = j or j = k} | + | |
- | 2. Acceptance by empty stack. | + | **1.3.** $ L = \{ A^{m} B^{m+n} C^{n} \ | \: n, m \geq 0 \} $ |
+ | |||
+ | **1.4.** $ L = \{ A^{n}B^{n}C^{m}D^{m} | \: \ n,m \geq 0 \} \cup \{ A^nB^mC^mD^n | \: \ n,m \geq 0 \} $ | ||
+ | |||
+ | **1.5.** $ L = \{ A^{i}B^{j}C^{k} | \: \text{ i=j or j=k} \} $ | ||
+ | |||
+ | **Exercise 2.** Acceptance by empty stack. | ||
Consider the following definition for an accepted word, by a PDA: | Consider the following definition for an accepted word, by a PDA: | ||
- | (q0, w, Z0) |- (q,e,e) where q is any state from K | + | $(q_{0}, w, Z_{0}) \vdash (q,e,e)$ where $ q $ is any state from K. |
- | Prove that a language is CF iff it can be accepted by a PDA via the empty-stack definition. | + | |
- | (Hint, you need to prove two parts) | + | Prove that a language is CF if it can be accepted by a PDA via the empty-stack definition. |
- | Collapse | + | |
+ | (**Hint**, you need to prove two parts) |