R06-C-問2
2025年2月21日大约 3 分钟
問2
アルファベット 上の文字列 (各 に対し )に対し、2次元ベクトルの系列 (各 に対し , は整数)を次のように定義する:
すなわち、 は、原点からスタートして の矢印の向きに従って2次元格子点上を遷移したときの軌跡を表す。 また、各 に対し、 のとき( によって原点から遠ざかる方向に遷移したとき) を前進ステップ、そうでないとき( によって原点に近づく方向に遷移したとき) を後進ステップと呼ぶ。
文字列 が往復的であることを、任意の後進ステップ に対し、
が存在し、 が成り立つことと定義する。すなわち,往復的な文字列 に おいては,後進ステップ i による から への遷移は,i に対応する前進ステッ プ による から への遷移を逆にたどるものとなっている.往復的で の最後の要素が原点であるような文字列 a からなる言語
言語 を以下のように定義する:
について,次の各問いに答えよ.
- 以下の文字列 が の要素であるか否かをそれぞれ判定せよ。
- 次の図は、アルファベットを に限定した言語 を最終状態によって受理するプッシュダウンオートマトン(PDA)の状態遷移図の一部である。空欄 ①, ②, ③ を埋めよ。(2か所の ③ には同じものが入る。)
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[->, shorten >=1pt, auto, semithick]
% 定义状态节点
\node[circle, draw] (s_) at (-2, 0) {$S_-$};
\node[double,circle, draw] (s0) at (0, 0) {$S_0$};
\node[circle, draw] (s+) at (2, 0) {$S_+$};
% 定义状态转移
\path
(s_)
edge[loop left] node[left] {
$\leftarrow, \leftarrow /\leftarrow\leftarrow$,\\
$\rightarrow,\leftarrow /\epsilon$} ()
edge[bend right] node[below] {3} (s0)
(s0)
edge[bend right] node[above] {${1}$} (s_)
edge[bend left] node[above] {$\rightarrow, Z / \rightarrow Z$} (s+)
(s+)
edge[loop right] node[above] {${2}$} ()
edge[bend left] node[below] {${3}$} (s0);
\draw[->] (-0.5, -0.5) -- (s0);
\end{tikzpicture}
\end{document}
遷移規則 は,遷移元の状態で読んだ入力文字が ,スタックの先頭文字が のとき,遷移先の状態に遷移し,スタックの先頭を文字 から文字列 に置き換える動作を表す.ただし, は空文字列を表す.初期状態では,スタックは,空であることを表す特殊文字 のみを保持しているとする. は初期状態であり唯一の最終状態でもある. ヒント:状態 ,, は,それぞれ,,, であることを表す
- 次の図は、言語 を最終状態で受理するPDAの状態遷移図の一部である。ただし、②と③は、(2)で求めたものと同じである。④と⑤を埋めよ。
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[->, shorten >=1pt, auto, semithick]
% 定义状态节点
\node[double, circle, draw] (s0) at (-2, -2) {$S_0$};
\node[circle, draw] (s0plus) at (-2, 2) {$S_{0+}$};
\node[circle, draw] (splusplus) at (2, 2) {$S_{++}$};
\node[circle, draw] (splus0) at (2, -2) {$S_{+0}$};
% 定义状态转移
\path
% S0+ 到其他节点
(s0plus) edge[bend left] node[above] {$\to, \uparrow / \to Y \uparrow$} (splusplus)
edge[bend left] node[right] {3} (s0)
edge[loop above] node {4} (s0plus)
% S++ 到其他节点
(splusplus) edge[bend left] node {$\epsilon, Y / \epsilon$} (s0plus)
edge[bend left] node[right] {$\epsilon, X / \epsilon$} (splus0)
edge[loop right] node[right] {5} (splusplus)
% S+0 到其他节点
(splus0) edge[bend left] node {3} (s0)
edge[bend left] node {$\uparrow, \to / \uparrow X \to$} (splusplus)
edge[loop right] node[right] {2} (splus0)
% S0 到其他节点
(s0) edge[bend left] node {$\uparrow, Z / \uparrow Z$} (s0plus)
edge[bend left] node {$\epsilon, Z / \to Z$} (splus0);
\draw[->] (-3, -3) -- (s0);
\end{tikzpicture}
\end{document}
ヒント:このPDAは、 と の全ての符号の組に対応する9個の状態を持つ。このうち、 を表す状態 (初期状態であり唯一の最終状態でもある)、 を表す状態 、 を表す状態 、 を表す状態 の4つの状態間の状態遷移図のみ示してある。
链接到当前文件 1