📝 我的笔记

还没有笔记

选中页面文字后点击「高亮」按钮添加

lecture2打印.ZH段落

📜 原文
📖 逐步解释
∑ 公式拆解
💡 数值示例
⚠️ 易错点
📝 总结
🎯 存在目的
🧠 直觉心智模型
💭 直观想象

1内容

I will read the contents of lecture2打印.ZH.md and lecture2打印.md to align the Chinese and English titles and identify the page numbers for formatting.

2Ch2. COMS3261:
计算机科学理论 Computer Science Theory P1

11. 2026年春 Spring 2026 P1

22. Mihalis Yannakakis Mihalis Yannakakis P1

讲座 2, 26/1/26

33. (确定性) 有限自动机的定义 Definition of (Deterministic) Finite Automaton P1

44. 转移图表示 Transition Diagram representation P1

55. 转移表表示 Transition table representation P2

符号
ins del
$\rightarrow$ 1 0
状态 1 2 0
2 3 1
${ }^{*} 3$ 3 2

示例:k 槽缓冲区自动机

$$ \begin{aligned} & \mathrm{Q}=\{0,1,2, \ldots, \mathrm{k}\} \\ & \Sigma=\{\text { ins, del }\} \\ & \delta: \quad \delta(\mathrm{i}, \text { ins })=\mathrm{i}+1 \text { if } \mathrm{i}<\mathrm{k} \text { else }=\mathrm{k} \\ & \quad \delta(\mathrm{i}, \text { del })=\mathrm{i}-1 \text { if } \mathrm{i}>0 \text { else }=0 \\ & \mathrm{q}_{0}=0 \\ & \mathrm{~F}=\{\mathrm{k}\} \end{aligned} $$

66. DFA对输入的处理 Processing of input by DFA P2

77. 接受路径 Accepting paths P2

88. 示例 Example P2

输入字符串: ins ins ins del ins

路径: $0 \longrightarrow 1 \longrightarrow 2 \longrightarrow 3 \longrightarrow 2 \longrightarrow 3$

$\mathrm{L}(\mathrm{A})=$ 使缓冲区满的操作序列集合

99. 转移函数到字符串的扩展 Extension of transition function to strings P3

归纳定义

```

Basis: $x$ has length 0, i.e. $x=\varepsilon: \delta^{*}(q, \varepsilon)=q$

Induction: $x$ has length $>0$, i.e. $x=y a$, for some $y \in \Sigma^{*}, a \in \Sigma$ :

$\delta^{*}(\mathrm{q}, \mathrm{ya})=\delta\left(\delta^{*}(\mathrm{q}, \mathrm{y}), \mathrm{a}\right)$

$\mathrm{L}(\mathrm{A})=\left\{\mathrm{x} \in \Sigma^{*} \mid \delta^{*}\left(\mathrm{q}_{0}, \mathrm{x}\right) \in \mathrm{F}\right\}$

$=$ set of strings $x$ that label paths from the start state $\mathrm{q}_{0}$

to an accepting state

```

1010. 正则语言 Regular Languages P3

1111. 示例 Example P3

1212. 示例 Example P3

1313. 示例 Example P4

$\mathrm{L}(\mathrm{A})$ 中的样本字符串:11, 011, 01101, 11101, ...

不在 $\mathrm{L}(\mathrm{A})$ 中的样本字符串$\varepsilon, 0,1,101,01010,00101, \ldots$

1414. 示例 Example P4

语言 = 包含两个连续 1 的字符串集合

1515. 示例 Example P4

自动机语言是什么?

1616. 示例 Example P4

自动机语言是什么?

语言 = 不包含两个连续 1 的字符串集合

1717. 补集 Complement P5

定理:如果 $\mathrm{L}$字母表 $\Sigma$ 上的正则语言,那么它的补集 $\bar{L}=\Sigma^{*}-L$ 也是正则的。

即,正则语言补集运算下是封闭

证明:如果确定性有限自动机 $\mathrm{A}$ 识别 $\mathrm{L}$,那么通过切换 $\mathrm{A}$ 中的接受状态非接受状态(即令 $F^{\prime}=Q-F$ ) 获得的自动机 $\mathrm{A}^{\prime}$ 识别补语言 $\bar{L}=\Sigma^{*}-L$

有限自动机

1818. 有限自动机的设计 Design of Finite Automata P5

1919. 示例 Example P6

2020. 示例 Example P6

所以,$\mathrm{Q}=\left\{\mathrm{q}_{0}, \mathrm{q}_{1}, \mathrm{q}_{2}, \mathrm{q}_{3}\right\}$

2121. 示例 Example P6

2222. 转移表表示 Transition table representation P6

2323. 正式证明DFA的正确性 Proving formally correctness of a DFA P7

通常可以同时做两个方向(当且仅当)

2424. 证明方法:对 $\mathrm{x}$ 的长度进行归纳, Proof Method: Induction on length of x , P7

2525. 示例:偶数个 1 Example: even # of 1's P7

归纳假设断言

2626. 形式化证明 Formal Proof P7

$\delta^{*}\left(\mathrm{q}_{0}, \varepsilon\right)=\mathrm{q}_{0}=$ even,并且 $\varepsilon$ 包含偶数个 (0) 1,因此正确

根据归纳假设断言$\mathrm{y}$ 成立

$\delta^{*}\left(\mathrm{q}_{0}, \mathrm{y}\right)=$ $\mathrm{y}$ 中 1 的数量奇偶性

案例分析

  1. $a=0$$\mathrm{x}$ 中 1 的奇偶性 = $\mathrm{y}$ 中 1 的奇偶性

转移图来看,状态保持不变,即

$\delta^{*}\left(\mathrm{q}_{0}, \mathrm{x}\right)=\delta^{*}\left(\mathrm{q}_{0}, \mathrm{y}\right)$,因此正确

  1. $a=1$$\mathrm{x}$ 中 1 的奇偶性 $\neq$ $\mathrm{y}$ 中 1 的奇偶性

转移图来看,状态改变,即

$\delta^{*}\left(\mathrm{q}_{0}, \mathrm{x}\right) \neq \delta^{*}\left(\mathrm{q}_{0}, \mathrm{y}\right)$,因此正确

2727. 示例:1 的数量是 3 的倍数 Example: # of 1's multiple of 3 P7

示例:1 的数量是 k 的倍数

2828. 对于 1 的数量是 $\mathrm{k}$ (对于任何 $\mathrm{k}>1$ ) 的倍数的自动机 Automaton for #1s multiple of $k$ (for any $k>1$ ) P8

2929. 练习题 Practice Problems P8

(例如 $\varepsilon \leftrightarrow 0,0 \leftrightarrow 0,11 \leftrightarrow 3,011 \leftrightarrow 3,110 \leftrightarrow 6, \ldots$ )

示例:偶数个 1

示例:偶数个 0

3030. 示例:偶数个 1 和 0 Example: Both even # 1's and 0's P8

3131. 正则语言的并集、交集 Union, Intersection of Regular Languages P8

定理:如果 $\mathrm{L}_{1}, \mathrm{~L}_{2}$正则语言,那么

3Ch3. 正则语言的并集、交集 Union, Intersection of Regular Languages P9

1Ch3.1. 乘积构造 Product Construction P9

给定两个自动机

$\mathrm{A}_{1}=\left(\mathrm{Q}_{1}, \Sigma, \delta_{1}, \mathrm{q}_{1}, \mathrm{~F}_{1}\right), \quad \mathrm{A}_{2}=\left(\mathrm{Q}_{2}, \Sigma, \delta_{2}, \mathrm{q}_{2}, \mathrm{~F}_{2}\right)$

乘积自动机 $\mathrm{M}=\mathrm{A}_{1} \times \mathrm{A}_{2}=\left(\mathrm{Q}_{1} \times \mathrm{Q}_{2}, \Sigma, \delta,\left(\mathrm{q}_{1}, \mathrm{q}_{2}\right), \mathrm{F}\right)$

其中 $\delta\left(\left(\mathrm{p}_{1}, \mathrm{p}_{2}\right), \mathrm{a}\right)=\left(\delta_{1}\left(\mathrm{p}_{1}, \mathrm{a}\right), \delta_{2}\left(\mathrm{p}_{2}, \mathrm{a}\right)\right), \forall \mathrm{p}_{1} \in \mathrm{Q}_{1} \forall \mathrm{p}_{2} \in \mathrm{Q}_{2} \forall \mathrm{a} \in \Sigma$

对于并集$\mathrm{F}=\left\{\left(\mathrm{p}_{1}, \mathrm{p}_{2}\right) \mid \mathrm{p}_{1} \in \mathrm{F}_{1}\right.$$\left.\mathrm{p}_{2} \in \mathrm{F}_{2}\right\}$

对于交集$\mathrm{F}=\left\{\left(\mathrm{p}_{1}, \mathrm{p}_{2}\right) \mid \mathrm{p}_{1} \in \mathrm{F}_{1}\right.$$\left.\mathrm{p}_{2} \in \mathrm{F}_{2}\right\}$

2Ch3.2. 所有有限集合都是正则的 All finite sets are regular P9

自动机 = 字符串集合 $\mathrm{L}$Trie数据结构 + "" 吸收状态拒绝