京都大学 情報学研究科 知能情報学専攻 2024年8月実施 専門科目 S-5
Author
itsuitsuki
Description
Consider deterministic finite state automata (Q,Σ,δ,q0,F), where Q is a finite set of states, Σ is a finite set of characters, δ:Q×Σ→Q is a transition function, q0∈Q is a start state, and F⊆Q is a set of accept states. Also, ϵ∈Σ∗ denotes the empty string.
Let Σ={0,1,2,…,9}. For w∈Σ∗, n(w) returns an integer number represented by w. For example, n(52)=52 and n(068)=68. For ϵ, we define n(ϵ)=0.
(1) Depict the state transition diagram of a deterministic finite state automaton (∣Q∣≤2) that accepts L1={w∈Σ∗∣n(w)≡0(mod2)}.
(2) Depict the state transition diagram of a deterministic finite state automaton (∣Q∣≤3) that accepts L2={w∈Σ∗∣n(w)≡0(mod3)}.
(3) Show Q,δ, and F of a deterministic finite state automaton that accepts L3={w∈Σ∗∣n(w)≡0(modk)} for any k≥2. You may use mod to describe δ.
(4) Let L4={w∈Σ+∣h(w)=0 or w=0}, where h(w) returns the first character of string w. Show Q,δ, and F of a deterministic finite state automaton that accepts L3∩L4 for any k≥2. You may use mod to describe δ.
题目描述
考虑确定性有限自动机 (Q,Σ,δ,q0,F),其中 Q 是有限状态集,Σ 是有限字符集,δ:Q×Σ→Q 是转移函数,q0∈Q 是初始状态,F⊆Q 是接受状态集;ϵ∈Σ∗ 表示空串。
令 Σ={0,1,2,…,9}。对 w∈Σ∗,n(w) 表示字符串 w 所代表的十进制整数,允许前导零,例如 n(52)=52、n(068)=68,并规定 n(ϵ)=0。
-
画出一个状态数满足 ∣Q∣≤2、接受语言
L1={w∈Σ∗∣n(w)≡0(mod2)}
的确定性有限自动机状态转移图。
-
画出一个状态数满足 ∣Q∣≤3、接受语言
L2={w∈Σ∗∣n(w)≡0(mod3)}
的确定性有限自动机状态转移图。
-
对任意 k≥2,给出接受
L3={w∈Σ∗∣n(w)≡0(modk)}
的确定性有限自动机的 Q,δ,F;描述 δ 时可以使用取模运算。
-
定义
L4={w∈Σ+∣h(w)=0 或 w=0},
其中 h(w) 返回字符串 w 的首字符。对任意 k≥2,给出接受 L3∩L4 的确定性有限自动机的 Q,δ,F;描述 δ 时可以使用取模运算。
- 余数自动机:以当前十进制前缀对 k 的余数作为状态,并按读入数字更新余数。
- 乘积自动机与前导零约束:组合整除性状态和首字符合法性状态,同时正确处理空串及单独的字符串“0”。
- 正则语言的封闭性:通过自动机交构造体现正则语言对交运算的封闭性。