2正则语言及泵引理

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
程序实现: Int Factor(int n) { if (n<0) printf(“error”); if n==0 return 1; else return n*Factor(n-1); }
//无此语句,会导致error //通常用栈结构实现
如第1,2句 均无,则死循环,涉及以后学习的 图灵机停机问题,
2012-7-26 8/53
Thm 1.28: RL ~ RE ep66
cp40(读一下)
Thm 1.28 L is RL there exists RE E such that L=E 通常 L={ ..|….} E形如 (a+b)C+(d.g)*
(无穷) 集合表达式 有限字母 有限运算 构造,可计算 We need to prove both ways: 左边 右边 • If a language is described by a regular expression, then it is regular (Lemma 1.29)上次实际上已证 左边 右边 •(Last week we saw how we can convert a regular expression R into an NFA M such that L(R)=L(M))上次已完 成FA的确定化 • Today we do the second part: 左边 右边, 给机造表达式 •If a language is regular, then it can be described by a regular expression (Lemma 1.32)
Book :《计算理论导引》
Introduction to the Theory of Computation Chapter 1&2 RL, pumping lemma .CFL
特别鸣谢:唐常杰教授提供的素材及原稿
2012-7-26
1/53
2012-7-26
2/53
• Chapter 1: • RE = Regular Languages, • non-regular languages
N! ,denoted as F(N), is defined as F(0)=1; //递归基础 (程序终止条件) F(N)=NF(N-1) if N >= 1 //递归 (减1)结构
程序实现: Int Factor(int n) { if (n<0) printf(“error”); if n==0 return 1; //无此语句,会导致error else return n*Factor(n-1); //通常用栈结构实现 } 如第1,2句均无,则死循环,称为 图灵机不停机,
• RL pumping lemma
• Chapter 2: • Context-Free Languages (CFLs)
2012-7-26
3/53
Biblioteka Baidu
补充ep55-ep64 cp29• 复习上次 • 自动机的合成 • 正规语言 •
2012-7-26
4/53
Regular Expressions
(Def. 1.26 ) ep64 cp38 递归法下定义,适合本身是递归结构的对象 例 数学模型:
2012-7-26
13/53
Thm 1.28: RL ~ RE
ep66 cp40(读一下)
给自动机 造表达式
Today we do the second part: 左边 右边, 即: •If a language is regular, then it can be described by a regular expression (Lemma 1.32) •分两步 •1 RL 有 DFA M识别(定义),把DFA 转化称广义的GDFA •2 把广义的GDFA转化称 正则表达式 RE •下页先引入广义的GDFA •普通的DFA中一个边相当于一个语句 •广义的GDFA 自动机的边可以是正则表达式(自动机),相 当相当于 程序可以调用(子)程序
2012-7-26
14/53
Generalized NFA
给自动机 造表达式 ep70-73 , cp41-42
Generalized non-deterministic finite automaton M=(Q, , , qstart, qaccept) with • Q finite set of states • the input alphabet • qstart the start state • qaccept the accept state • :(Q-{qaccept})(Q-{qstart}) R the transition function • (R is the set of regular expressions over ) •惟一区别 自动机的边推广为 RE (子程序,子自动机)
2012-7-26 5/53
Regular Expressions
(Def. 1.26 ) ep64 cp38 递归法下定义,适合本身是递归结构的对象 写论文时常用 例 阶乘 数学模型:
N! ,denoted as F(N), is defined as F(0)=1; //递归基础 (程序终止条件) F(N)=NF(N-1) if N >= 1 //递归 (减1)结构
2012-7-26 10/53
Thm 1.28: RL ~ RE ep66
cp40(读一下)
Thm 1.28 L is RL there exists RE E such that L=E 通常 L={ ..|….} E形如 (a+b)C+(d.g)*
(无穷) 集合表达式 有限字母 有限运算 构造,可计算 We need to prove both ways: 左边 右边 • If a language is described by a regular expression, then it is regular (Lemma 1.29)上次实际上已证 左边 右边 •(Last week we saw how we can convert a regular expression R into an NFA M such that L(R)=L(M))上次已完 成FA的确定化 • Today we do the second part: 左边 右边, 给机 造 表达式 •If a language is regular, then it can be described by a regular expression (Lemma 1.32)
2012-7-26 9/53
Thm 1.28: RL ~ RE ep66
cp40(读一下)
Thm 1.28 L is RL there exists RE E such that L=E 通常 L={ ..|….} E形如 (a+b)C+(d.g)*
(无穷) 集合表达式 有限字母 有限运算 构造,可计算 We need to prove both ways: 左边 右边 • If a language is described by a regular expression, then it is regular (Lemma 1.29)上次实际上已证 左边 右边 •(Last week we saw how we can convert a regular expression R into an NFA M such that L(R)=L(M))上次已完 成FA的确定化 • Today we do the second part: 左边 右边, 给机造表达式 •If a language is regular, then it can be described by a regular expression (Lemma 1.32)
2012-7-26
12/53
Thm 1.28: RL ~ RE
ep66 cp40(读一下)
给自动机 造表达式
Today we do the second part: 左边 右边, 即: •If a language is regular, then it can be described by a regular expression (Lemma 1.32) •分两步 •1 RL 有 DFA M识别(由定义),把DFA 转化为广义的GDFA •2 把广义的GDFA转化称 正则表达式 RE •下页先引入广义的GDFA • 自动机的边可以是正则表达式(自动机),相当相当于 程序可 以调用(子)程序
2012-7-26 6/53
Regular Expressions 正则表达式
(Def. 1.26 ) ep64 cp38
递归法下定义,适合本身是递归结构的对象,构造性的
Given an alphabet , R is a regular expression if 1. R = a, with a 2. R = 递归基础 3. R = 4. R = (R1R2), with R1 and R2 regular expressions 5. R = (R1R2), with R1 and R2 regular expressions 6. R = (R1*), with R1 a regular expression 递归结构,增加 一个运算符号 的 构造方法
2012-7-26 15/53
Generalized NFA 给自动机 造表达式 ep70-73 ,
cp41-42
Generalized nondeterministic finite automaton M=(Q, , , qstart, qaccept) with • Q finite set of states 状态 不包括终点 • the input alphabet • qstart the start state 下一状态, 不包括起点 • qaccept the accept state • :(Q-{qaccept})(Q-{qstart}) R the transition function • (R is the set of regular expressions over ) • 惟一区别 自动机的边推广为 RE (子程序,子自动机)
2012-7-26 11/53
Thm 1.28: RL ~ RE
ep66 cp40(读一下)
给 机 造表达式
Today we do the second part: 左边 右边, 即: •If a language is regular, then it can be described by a regular expression (Lemma 1.32) •分两步 •1 RL 有 DFA M识别(定义),把DFA 转化称广义的GDFA •2 把广义的GDFA转化称 正则表达式 RE •下页先引入广义的GDFA • 自动机的边可以是正则表达式(自动机),相当相当于 程 序可以调用(子)程序
2012-7-26 7/53
Regular Expressions 正则表达式
(Def. 1.26 中文:定义2.26 ) ep64 cp39
递归法下定义,适合本身是递归结构的对象,构造性的
Given an alphabet , R is a regular expression if 1. R = a, with a 2. R = 递归基础 3. R = 4. R = (R1R2), with R1 and R2 regular expressions 5. R = (R1R2), with R1 and R2 regular expressions 6. R = (R1*), with R1 a regular expression 递归结构,增加 一个运算符号 的 构造方法
2012-7-26
16/53
相关文档
最新文档