1
|
1 \defineUnit{grammatik}{% |
|
2 \begin{frame} |
|
3 \frametitle{Grammatiken} |
|
4 \setbeamercovered{dynamic} |
|
5 |
3
|
6 \begin{definition}[Grammatik] |
|
7 Eine \structure{(Phrasenstruktur-)Grammatik} $G = (V, \Sigma, P, S)$ ist ein 4-Tupel: |
1
|
8 \begin{description} |
|
9 \item[V] endlich viele \alert{Nichtterminale} (Variablen) |
|
10 \item[$\Sigma$] ein Alphabet von \alert{Terminalen} |
3
|
11 \item[P] endlich viele \alert{Produktionen} $\subseteq \left( V \cup \Sigma \right)^* \times \left( V \cup \Sigma \right)^*$ |
|
12 \item[S] ein \alert{Startsymbol} (Axiom) |
1
|
13 \end{description} |
3
|
14 Ist $(l, r) \in P$, so schreibt man \structure{$l \rightarrow r$}. |
1
|
15 \end{definition} |
|
16 |
3
|
17 \vfill |
|
18 |
|
19 \begin{example}[] |
1
|
20 $\Sigma = \left\{ 0, 1 \right\}$. Grammatik für alle Wörter ungerader Länge, bei denen alle Nullen vor der ersten Eins stehen und weniger Nullen als Einsen vorhanden sind. |
3
|
21 \visible<2>{ |
|
22 \begin{align} |
|
23 S \rightarrow 0S1 \mid S11 \mid 1 |
|
24 \end{align} |
|
25 } |
1
|
26 \end{example} |
|
27 \end{frame} |
|
28 } |
|
29 |
|
30 \defineUnit{ableitung}{% |
|
31 \begin{frame} |
|
32 \frametitle{Ableitungsrelation} |
|
33 \setbeamercovered{dynamic} |
|
34 |
|
35 \begin{definition}[Ableitungsrelation] |
3
|
36 Eine Grammatik $G$ induziert eine \structure{Ableitungsrelation} $\rightarrow_G$ auf Wörtern über $V \cup \Sigma$. Seien $x, y$ solche Wörter und |
|
37 \begin{align} |
|
38 z &= x\alert{\alpha}y\\ |
|
39 z^\prime &= x\alert{\beta}y\\ |
|
40 \intertext{Dann ist} |
|
41 z &\rightarrow_G z^\prime |
|
42 \end{align} |
|
43 gdw. es eine Regel $\alert{\alpha \rightarrow \beta}$ in $P$ gibt. |
1
|
44 \end{definition} |
|
45 |
3
|
46 \vfill |
|
47 |
|
48 \begin{example}[] |
1
|
49 Mit den Produktionen $S \rightarrow 0S1 \mid S11 \mid 1$: |
|
50 \begin{align*} |
|
51 S &\rightarrow_G 0S1 \rightarrow_G 00S11 \rightarrow_G 00S1111 \rightarrow_G 0011111 \\ |
3
|
52 \intertext{Es gilt also} |
|
53 S &\rightarrow_G^* 0011111 |
1
|
54 \end{align*} |
|
55 \end{example} |
|
56 \end{frame} |
|
57 } |
|
58 |
3
|
59 \defineUnit{sprachtypen}{% |
|
60 \begin{frame} |
|
61 \frametitle{Sprachtypen} |
|
62 |
|
63 Sei $G = (V, \Sigma, P, S)$ eine Grammatik und $\alpha \rightarrow \beta \in P$ beliebig. |
|
64 \begin{definition}[Monotonie] |
|
65 $G$ heißt \structure{(längen-)monoton}, wenn für $\alpha \neq S$ gilt |
|
66 \begin{align} |
|
67 \alert{\abs{\alpha} \leq \abs{\beta}} |
|
68 \end{align} |
|
69 und falls $S \to \epsilon \in P$, dann kommt $S$ nie auf der rechten Seite vor. |
|
70 \end{definition} |
|
71 |
|
72 \vfill |
|
73 |
|
74 \begin{definition}[Chomsky-Typen] |
|
75 Seien $A \in V$, $\gamma, \delta \in (V \cup \Sigma)^*$ und $\beta^\prime \in (V \cup \Sigma)^+$.\\ |
|
76 Damit $G$ vom \structure{Typ k} ist, muss für $\alpha$ und $\beta$ gelten |
|
77 \begin{center} |
|
78 \tabulinesep=4pt |
|
79 \begin{tabu} to .8\textwidth{X[1,c,m]|[.5pt]X[2,c,m]X[2,c,m]} |
|
80 & $\alpha$ & $\beta$\\\tabucline[.5pt]{-} |
|
81 \structure{Typ 0} & beliebig & beliebig\\ |
|
82 \structure{Typ 1} & $= \alert{\gamma} A \alert{\delta}$ & $= \alert{\gamma} \beta^\prime \alert{\delta}$\\ |
|
83 \structure{Typ 2} & $\in V$ & beliebig\\ |
|
84 \structure{Typ 3} & $\in V$ & $\in \Sigma^+ \cup \Sigma^*V$\\ |
|
85 \end{tabu} |
|
86 \end{center} |
|
87 Ab Typ 1 muss $G$ auch \alert{monoton} sein. |
|
88 \end{definition} |
|
89 \end{frame} |
|
90 } |
|
91 |
1
|
92 \defineUnit{cfl}{% |
|
93 \begin{frame}[c] |
|
94 \frametitle{Kontextfreie Sprache} |
|
95 \setbeamercovered{dynamic} |
|
96 |
|
97 \begin{definition}[Kontextfreie Sprache] |
|
98 Eine kontextfreie Grammatik $G = (V, \Sigma, P, S)$ \alert{erzeugt} die Sprache |
|
99 \[ |
|
100 L(G) := \left\{ w \in \Sigma^* \mid S \rightarrow_G^* w \right\} |
|
101 \] |
|
102 Eine Sprache $L \subseteq \Sigma^*$ heißt \alert{kontextfrei} gdw es eine kontextfreie Grammatik $G$ gibt mit $L = L(G)$. |
|
103 \end{definition} |
|
104 \end{frame} |
|
105 } |
|
106 |
|
107 \defineUnit{induktivesprachdefinition}{% |
|
108 \begin{frame} |
|
109 \frametitle{Induktive Sprachdefinition} |
|
110 \setbeamercovered{dynamic} |
|
111 |
|
112 \begin{block}{Induktive Sprachdefinition} |
|
113 Die \alert{induktive Definition} ($\Longrightarrow$) erzeugt Wörter \alert{bottom-up}, setzt also kleine Wörter zu größeren zusammen. |
|
114 \end{block} |
|
115 |
|
116 \begin{example}[Vorbereitung 3] |
|
117 Mit den Produktionen $S \rightarrow 0S1 \mid S11 \mid 1$: |
|
118 |
|
119 \begin{align*} |
|
120 1 &\in L_G(S) \\ |
|
121 u \in L_G(S) \quad \Longrightarrow \quad 0\alert{u}1 &\in L_G(S) \\ |
|
122 u \in L_G(S) \quad \Longrightarrow \quad \alert{u}11 &\in L_G(S) |
|
123 \end{align*} |
|
124 |
|
125 Also z.B: |
|
126 |
|
127 \[ |
|
128 1 \in L_G(S) \Longrightarrow 0\alert{1}0 \in L_G(S) \Longrightarrow \alert{010}11 \in L_G(S) |
|
129 \] |
|
130 \end{example} |
|
131 \end{frame} |
|
132 } |
|
133 |
|
134 \defineUnit{cnf}{% |
|
135 \begin{frame} |
|
136 \frametitle{CNF} |
|
137 \setbeamercovered{dynamic} |
|
138 |
|
139 \begin{definition}[Chomsky-Normalform] |
|
140 Eine kontextfreie Grammatik ist in \alert{Chomsky-Normalform} (CNF) genau dann wenn alle Produktionen die Form |
|
141 \[ |
|
142 A \rightarrow \alert{a} \quad \text{oder} \quad A \rightarrow \alert{BC} |
|
143 \] |
|
144 haben. |
|
145 \end{definition} |
|
146 |
|
147 \vfill |
|
148 |
|
149 \begin{theorem} |
|
150 Zu \alert{jeder} CFG $G$ existiert eine CFG $G'$ in Chomsky-Normalform mit |
|
151 \[ |
|
152 L(G') = L(G) \alert{\setminus \left\{ \epsilon \right\}} |
|
153 \] |
|
154 \end{theorem} |
|
155 \end{frame} |
|
156 } |
|
157 |
|
158 \defineUnit{cnfkonstruktion}{% |
|
159 \begin{frame} |
|
160 \frametitle{CNF Konstruktion} |
|
161 \setbeamercovered{dynamic} |
|
162 |
|
163 \begin{block}{Idee} |
|
164 Sei $G = (V, \Sigma, P, S)$ eine CFG. |
|
165 \begin{enumerate} |
|
166 \item<1,2-> Eliminiere \alert{$\epsilon$-Produktionen} |
|
167 \item<1,3-> Eliminiere \alert{Kettenproduktionen} |
|
168 \item<1,4-> \alert{Ersetze Terminale} durch Nichtterminale |
|
169 \item<1,5-> \alert{Verkürze Ketten} von Nichtterminalen der Länge $\geq 3$ |
|
170 \end{enumerate} |
|
171 \end{block} |
|
172 |
|
173 \vspace{1em} |
|
174 |
|
175 \only<2> { |
|
176 Sind \alert{$B \rightarrow \epsilon$} und \alert{$A \rightarrow \alpha B \beta$} in $P$, dann füge \alert{$A \rightarrow \alpha \beta$} hinzu. Entferne danach alle $\epsilon$-Produktionen. |
|
177 \begin{align*} |
|
178 S &\rightarrow Ab, \quad A \rightarrow aAA \mid \epsilon \\ |
|
179 \intertext{wird zu:} |
|
180 S &\rightarrow \alert{Ab \mid b} \\ |
|
181 A &\rightarrow \alert{aAA \mid aA \mid a} |
|
182 \end{align*} |
|
183 } |
|
184 |
|
185 \only<3> { |
|
186 Sind \alert{$A \rightarrow B$} und \alert{$B \rightarrow \alpha$} in $P$, dann füge \alert{$A \rightarrow \alpha$} hinzu. Entferne danach alle Kettenproduktionen und unerreichbaren Symbole. |
|
187 \begin{align*} |
|
188 S &\rightarrow A, \quad A \rightarrow a \mid B, \quad B \rightarrow bS \\ |
|
189 \intertext{wird zu:} |
|
190 A &\rightarrow \alert{a \mid bS} \\ |
|
191 S &\rightarrow \alert{a \mid bS} |
|
192 \end{align*} |
|
193 } |
|
194 |
|
195 \only<4> { |
|
196 Ersetze jedes \alert{$a \in \Sigma$} in einer rechten Seite \alert{länger als $1$} durch ein neues Nichtterminal. |
|
197 \begin{align*} |
|
198 S &\rightarrow aa \mid Bb \mid b, \quad B \rightarrow \ldots \\ |
|
199 \intertext{wird zu:} |
|
200 S &\rightarrow \alert{X_aX_a \mid BX_b \mid b} \\ |
|
201 X_a &\rightarrow \alert{a}, \quad X_b \rightarrow \alert{b} |
|
202 \end{align*} |
|
203 } |
|
204 |
|
205 \only<5> { |
|
206 Ersetze jede Produktion der Form $A \rightarrow B_1B_2\ldots B_k$ durch neue Nichtterminale mit Produktionen der Länge $2$. |
|
207 \begin{align*} |
|
208 S &\rightarrow X_aX_bBX_a, \quad X_a \rightarrow a, \quad X_b \rightarrow b, \quad B \rightarrow \ldots \\ |
|
209 \intertext{wird zu:} |
|
210 S &\rightarrow \alert{X_aT_1} \\ |
|
211 T_1 &\rightarrow \alert{X_bT_2}, \quad T_2 \rightarrow \alert{BX_a} \\ |
|
212 \end{align*} |
|
213 } |
|
214 \end{frame} |
|
215 } |
|
216 |
|
217 \defineUnit{nuetzlichessymbol}{% |
|
218 \begin{frame} |
|
219 \frametitle{Eigenschaften von Symbolen} |
|
220 \setbeamercovered{dynamic} |
|
221 |
|
222 \begin{definition} |
|
223 Sei $G = (V, \Sigma, P, S)$ eine CFG. \\ |
|
224 Ein Symbol $X \in V \cup \Sigma$ ist |
|
225 \begin{description} |
|
226 \item[nützlich] es gibt $S \rightarrow_G^* w \in \Sigma^*$ in der X \alert{vorkommt} |
|
227 \item[erzeugend] es gibt $\alert{X} \rightarrow_G^* w \in \Sigma^*$ |
|
228 \item[erreichbar] es gibt $S \rightarrow_G^* \alpha \alert{X} \beta$ |
|
229 \end{description} |
|
230 \end{definition} |
|
231 |
|
232 \vfill |
|
233 |
|
234 \begin{theorem} |
|
235 Nützliche Symbole \alert{sind} erzeugend und erreichbar. Aber \alert{nicht} notwendigerweise umgekehrt. |
|
236 \[ |
|
237 S \rightarrow AB \mid a, \quad A \rightarrow b |
|
238 \] |
|
239 \end{theorem} |
|
240 \end{frame} |
|
241 } |
|
242 |
|
243 \defineUnit{cfpl}{% |
|
244 \begin{frame} |
|
245 \frametitle{Pumping Lemma für CFLs} |
|
246 \setbeamercovered{dynamic} |
|
247 |
|
248 \begin{theorem}[Pumping Lemma für kontextfreie Sprachen] |
|
249 Sei $L \subseteq \Sigma^*$ kontextfrei. Dann gibt es ein $n > 0$, so dass sich \alert{jedes} $z \in L$ mit $|z| \geq n$ so in \alert{$z = uvwxy$} zerlegen lässt, dass |
|
250 \begin{itemize} |
|
251 \item $vx \alert{\neq \epsilon}$ |
|
252 \item $|vwx| \alert{\leq n}$ |
|
253 \item $\forall i \alert{\geq 0}. uv^iwx^iy \in L$ |
|
254 \end{itemize} |
|
255 \end{theorem} |
|
256 |
|
257 \vfill |
|
258 |
|
259 \begin{center} |
|
260 \begin{columns} |
|
261 \begin{column}{.4\textwidth} |
|
262 \begin{tikzpicture} |
|
263 \coordinate (outer) at (2, 2.4); |
|
264 \coordinate (middle) at (2.2, 1.2); |
|
265 \coordinate (inner) at (2.2, 0.6); |
|
266 % outer |
|
267 \draw[fill=tumred!40] (0, 0) -- (1.2, 0) -- (middle) -- (3.2, 0) -- (4, 0) -- (outer) node[above] {$S$} -- (0, 0); |
|
268 % middle |
|
269 \draw[fill=tumgreen!40] (1.2, 0) -- (1.7, 0) -- (inner) -- (2.7, 0) -- (3.2, 0) -- (middle) -- (1.2, 0); |
|
270 % inner |
|
271 \draw[fill=tumblue!40] (1.7, 0) -- (inner) -- (2.7, 0) -- (1.7, 0); |
|
272 |
|
273 % path |
|
274 \draw[dashed, thick] (outer) -- (middle) -- (inner); |
|
275 \draw[fill] (outer) circle (1pt); |
|
276 \draw[fill] (middle) circle (1pt); |
|
277 \draw[fill] (inner) circle (1pt); |
|
278 |
|
279 % nodes |
|
280 \node[below] at (0.6, 0) {$u$}; |
|
281 \node[below] at (1.45, 0) {$v$}; |
|
282 \node[below] at (2.2, 0) {$w$}; |
|
283 \node[below] at (2.95, 0) {$x$}; |
|
284 \node[below] at (3.6, 0) {$y$}; |
|
285 \end{tikzpicture} |
|
286 \end{column} |
|
287 \begin{column}{.4\textwidth} |
|
288 \begin{tikzpicture} |
|
289 \coordinate (outer) at (2, 2.4); |
|
290 \coordinate (middle) at (2.2, 1.2); |
|
291 \coordinate (inner) at (2.2, 0.6); |
|
292 % outer |
|
293 \draw[fill=tumred!40] (0, 0) -- (1.2, 0) -- (middle) -- (3.2, 0) -- (4, 0) -- (outer) node[above] {$S$} -- (0, 0); |
|
294 % inner |
|
295 \draw[fill=tumblue!40] (1.7, 0.6) -- (middle) -- (2.7, 0.6) -- (1.7, 0.6); |
|
296 |
|
297 % path |
|
298 \draw[dashed, thick] (outer) -- (middle); |
|
299 \draw[fill] (outer) circle (1pt); |
|
300 \draw[fill] (middle) circle (1pt); |
|
301 |
|
302 % nodes |
|
303 \node[below] at (0.6, 0) {$u$}; |
|
304 \node[below] at (2.2, 0) {$w$}; |
|
305 \node[below] at (3.6, 0) {$y$}; |
|
306 \end{tikzpicture} |
|
307 \end{column} |
|
308 \end{columns} |
|
309 \end{center} |
|
310 \end{frame} |
|
311 } |
|
312 |
|
313 \defineUnit{cyk}{% |
|
314 \begin{frame} |
|
315 \frametitle{CYK} |
|
316 \setbeamercovered{dynamic} |
|
317 |
|
318 \begin{definition}[Cocke-Younger-Kasami-Algorithmus] |
|
319 Der \alert{CYK-Algorithmus} entscheidet das Wortproblem für kontextfreie Grammatiken in Chomsky-Normalform in $\Oh(n^3)$. \\ |
|
320 Gegeben eine \alert{Grammatik} $G = (V, \Sigma, P, S)$ in CNF und ein \alert{Wort} $w = a_1 \ldots a_n \in \Sigma^*$. |
|
321 Mit \[ V_{ij} := \left\{ A \in V \mid A \rightarrow_G^* \alert{a_i \ldots a_j} \right\}\] |
|
322 ist \[ w \in L(G) \Leftrightarrow S \in V_{\alert{1n}} \] |
|
323 \end{definition} |
|
324 |
|
325 \begin{align*} |
|
326 V_{ii} &= \left\{ A \in V \mid (A \rightarrow a_i) \in P \right\} \\ |
|
327 V_{ij} &= \left\{ A \in V \mid \exists k, B \in V_{ik}, C \in V_{k+1,j} \;.\; (A \rightarrow BC) \in P \right\} |
|
328 \end{align*} |
|
329 \end{frame} |
|
330 } |
|
331 |
|
332 \defineUnit{cykbeispiel}{% |
|
333 \begin{frame} |
|
334 \frametitle{CYK} |
|
335 \setbeamercovered{dynamic} |
|
336 |
|
337 \begin{block}{Idee} |
|
338 Kombiniere \alert{Teilwörter} zum ganzen Wort, wenn möglich. |
|
339 \begin{enumerate} |
|
340 \item Initialisiere mit den \alert{$V_{ii}$}. |
|
341 \item<3-5> Befülle die Tabelle von unten nach oben. |
|
342 \end{enumerate} |
|
343 \end{block} |
|
344 |
|
345 \[ S \rightarrow AB \mid BC, \quad A \rightarrow BA \mid a, \quad B \rightarrow CC \mid b, \quad C \rightarrow AB \mid a \] |
|
346 \begin{center} |
|
347 \extrarowsep=5pt |
|
348 \begin{tabu}to .8\textwidth{r|X[c]|X[c]|X[c]|X[c]|} |
|
349 \tabucline{2-2} |
|
350 4 & \alt<-4>{}{$S,\ldots$} \\ \tabucline{2-3} |
|
351 3 & \alt<-3>{}{$\emptyset$} & \alt<-3>{}{$S, A, C$} \\ \tabucline{2-4} |
|
352 2 & \alt<-2>{}{$A$} & \alt<-2>{}{$B$} & \alt<-2>{}{$B$} \\ \tabucline{2-5} |
|
353 1 & \alt<-1>{}{$B$} & \alt<1>{}{$A,C$} & \alt<1>{}{$A,C$} & \alt<1>{}{$A,C$} \\ \tabucline{2-5} |
|
354 \multicolumn{1}{r}{} & \multicolumn{1}{c}{\alert{b}} & \multicolumn{1}{c}{\alert{a}} & \multicolumn{1}{c}{\alert{a}} & \multicolumn{1}{c}{\alert{a}} \\ |
|
355 \end{tabu} |
|
356 \end{center} |
|
357 \end{frame} |
|
358 } |
|
359 |
|
360 \defineUnit{pda}{% |
|
361 \begin{frame} |
|
362 \frametitle{Kellerautomaten} |
|
363 \setbeamercovered{dynamic} |
|
364 |
|
365 \begin{definition}[Kellerautomat] |
|
366 Ein \alert{PDA} (Push-Down-Automaton) ist ein Tupel $P = (Q, \Sigma, \Gamma, \delta, q_0, Z_0, F)$ aus einer/einem |
|
367 \begin{itemize} |
|
368 \item endlichen Menge von \alert{Zuständen} $Q$ |
|
369 \item endlichen \alert{Eingabealphabet} $\Sigma$ |
|
370 \item endlichen \alert{Kelleralphabet} $\Gamma$ |
|
371 \item \alert{Übergangsfunktion} $\delta : Q \times \left( \Sigma \cup \{\epsilon\} \right) \times \Gamma \to P(Q \times \Gamma^*)$ |
|
372 \item \alert{Startzustand} $q_0 \in Q$ |
|
373 \item \alert{Kellerinitialisierung} $Z_0 \in \Gamma$ |
|
374 \item Menge von \alert{Endzuständen} $F \subseteq Q$ |
|
375 \end{itemize} |
|
376 \end{definition} |
|
377 |
|
378 \begin{center} |
|
379 \begin{tikzpicture}[automaton, node distance=4cm] |
|
380 \node[state] (q0) {$q_i$}; |
|
381 \node[state] (q1) [right of = q0] {$q_j$}; |
|
382 |
|
383 \draw[every edge] (q0) edge node {$a, X/\gamma$} (q1); |
|
384 \end{tikzpicture} |
|
385 \end{center} |
|
386 \end{frame} |
|
387 } |
|
388 |
|
389 \defineUnit{pdaakzeptanz}{% |
|
390 \begin{frame} |
|
391 \frametitle{Kellerautomaten} |
|
392 \setbeamercovered{dynamic} |
|
393 |
|
394 \begin{definition}[Kellerautomat] |
|
395 Ein \alert{PDA} (Push-Down-Automaton) ist ein Tupel $P = (Q, \Sigma, \Gamma, \delta, q_0, Z_0, F)$ aus einer/einem |
|
396 \begin{itemize} |
|
397 \item \alert{Übergangsfunktion} $\delta : Q \times \left( \Sigma \cup \{\epsilon\} \right) \times \Gamma \to P(Q \times \Gamma^*)$ |
|
398 \end{itemize} |
|
399 \end{definition} |
|
400 |
|
401 \vfill |
|
402 |
|
403 \begin{definition}[Akzeptanz] |
|
404 Ein PDA $P$ akzeptiert $w \in \Sigma^*$ \alert{mit Endzustand} gdw |
|
405 \[ \exists \alert{f \in F}, \gamma \in \Gamma^*.(q_0, w, Z_0) \rightarrow_P^* (\alert{f}, \epsilon, \gamma) \] |
|
406 Ein PDA $P$ akzeptiert $w \in \Sigma^*$ \alert{mit leerem Keller} gdw |
|
407 \[ \exists q \in Q.(q_0, w, Z_0) \rightarrow_P^* (q, \epsilon, \alert{\epsilon}) \] |
|
408 \end{definition} |
|
409 \end{frame} |
|
410 } |
|
411 |
|
412 \defineUnit{pdabeispiel}{% |
|
413 \begin{frame} |
|
414 \frametitle{Kellerautomaten} |
|
415 \setbeamercovered{dynamic} |
|
416 |
|
417 \begin{definition}[Kellerautomat] |
|
418 Ein \alert{PDA} (Push-Down-Automaton) ist ein Tupel $P = (Q, \Sigma, \Gamma, \delta, q_0, Z_0, F)$ aus einer/einem |
|
419 \begin{itemize} |
|
420 |
|
421 \item \alert{Übergangsfunktion} $\delta : Q \times \left( \Sigma \cup \{\epsilon\} \right) \times \Gamma \to P(Q \times \Gamma^*)$ |
|
422 \end{itemize} |
|
423 \end{definition} |
|
424 |
|
425 \vfill |
|
426 |
|
427 \begin{example}[] |
|
428 PDA akzeptierend \alert{mit leerem Keller} zu $L = \left\{ a^nb^n \mid n \in \N \right\}$. |
|
429 |
|
430 \centering |
|
431 \begin{tikzpicture}[automaton] |
|
432 |
|
433 \node[state, initial] (q0) {$q_0$}; |
|
434 \node[state] (q1) [right of = q0] {$q_1$}; |
|
435 |
|
436 \draw[->] (q0) edge [bend left] node {$\epsilon, A/A$} (q1); |
|
437 \draw[->] (q0) edge [bend right] node [below] {$\epsilon, Z_0/Z_0$} (q1); |
|
438 |
|
439 \draw[->] (q0) edge [loop above] node {$a, Z_0/AZ_0$} (q0); |
|
440 \draw[->] (q0) edge [loop below] node {$a, A/AA$} (q0); |
|
441 |
|
442 \draw[->] (q1) edge [loop above] node {$b, A/\epsilon$} (q1); |
|
443 \draw[->] (q1) edge [loop below] node {$\epsilon, Z_0/\epsilon$} (q1); |
|
444 \end{tikzpicture} |
|
445 \end{example} |
|
446 \end{frame} |
|
447 } |
|
448 |
|
449 \defineUnit{kontextfreiesprachen}{% |
|
450 \begin{frame} |
|
451 \frametitle{Kontextfreie Sprachen} |
|
452 \setbeamercovered{dynamic} |
|
453 |
|
454 \begin{center} |
|
455 \begin{tikzpicture}[node distance=3cm] |
|
456 \node (CFG) {CFG}; |
|
457 \node (CNF) [right of = CFG] {CNF}; |
|
458 \node (PDAe) [right of = CNF] {PDA$_\epsilon$}; |
|
459 \node (PDAf) [right of = PDAe] {PDA$_F$}; |
|
460 |
|
461 \draw [every edge, <->] (CFG) -- (CNF); |
|
462 \draw [every edge, <->] (CNF) -- (PDAe); |
|
463 \draw [every edge, <->] (PDAe) -- (PDAf); |
|
464 \end{tikzpicture} |
|
465 \end{center} |
|
466 |
|
467 \vfill |
|
468 |
|
469 \begin{itemize} |
|
470 \item \alert{Abschlusseigenschaften} |
|
471 \end{itemize} |
|
472 \begin{table} |
|
473 \begin{tabu}to \textwidth{X[c]|ccccc} |
|
474 & Schnitt & Vereinigung & Komplement & Produkt & Stern \\ \tabucline{} |
|
475 REG & ja & ja & ja & ja & ja\\ |
|
476 CFL & nein & ja & nein & ja & ja |
|
477 \end{tabu} |
|
478 \end{table} |
|
479 |
|
480 \begin{itemize} |
|
481 \item \alert{Entscheidbarkeit} |
|
482 \end{itemize} |
|
483 \begin{table} |
|
484 \begin{tabu}to \textwidth{X[c]|cccc} |
|
485 & Wortproblem & Leerheit & Äquivalenz & Schnittproblem\\ \tabucline{} |
|
486 DFA & $\Oh(n)$ & ja & ja & ja \\ |
|
487 CFG & $\Oh(n^3)$ & ja & nein & nein |
|
488 \end{tabu} |
|
489 \end{table} |
|
490 \end{frame} |
|
491 } |