第3章词法讲述.ppt

  1. 1、本文档共101页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第3章词法讲述

DFA的最小化算法—英文描述 1. Construct an initial partition∏ of the set of states with two groups:the accepting states F and the nonaccepting states S-F. 2. Apply the procedure PP. to ∏ to construct a new partition ∏new. 3. If ∏new =∏,let ∏final=∏ and continue with step (4). Otherwise,repeat step(2) with ∏:= ∏new. 4. Choose one state in each group of the partition ∏final as the representative for the group.the representatives will be the states of the reduced DFA M’.let s be a representative state, and suppose on input a there is a transition from s to r on a. Let the start state of M’ be the representative of the group containing the start state s0 of M,and let the accepting states of M’ be the representatives that are in F. Note that each group of ∏final either consists only of states in F or has no states in F. 5. If M’ has a dead state, that is, a states d that is no accepting and that has transition to itself on all input symbols, the remove d from M’,Also remove any states not reachable from the start state. Any transition to d from other states become undefined. 2 while (C中存在尚未被标记的子集T)do { 标记T; for 每个输入字母a do { U:= ?-closure(move(T,a)); if U不在C中 then 将U作为未标记的子集加在C中 } } NFA的确定化 例子 4 f 3 5 6 2 1 i ? ? ? ? a a a a b b b b 4 f 3 5 6 2 1 i ? ? ? ? a a a a b b b b 等价的DFA a C D B A E F S b a a a a a b b b b b a b F 确定有穷自动机的化简 说一个有穷自动机是化简了的,即是说,它没有多余状态并且它的状态中没有两个是互相等价的。一个有穷自动机可以通过消除多余状态和合并等价状态而转换成一个最小的与之等价的有穷自动机。 所谓有穷自动机的多余状态,是指这样的状态:从自动机的开始状态出发,任何输入串也不能到达的那个状态;或者从这个状态没有通路到达终态。 ? DFA的最小化就是寻求最小状态DFA 最小状态DFA的含义: 没有多余状态(死状态) 没有两个状态是互相等价(不可区别) 两个状态s和t可区别:不满足 兼容性——同是终态或同是非终态 传播性——从s出发读入某个a?a???和从 t出发读入某个a到达的状态等价。 C和D同是终态,读入a到达C和F, C和F同是终态, C和F读入a都到达C,读入b都到达E. C和D等价 a C D B A E F S b a a a a a b b b b b a b F 最小状态DFA 对于一个DFA M =(K,∑,f, k0,,kt),存在一个最小状态DFA M’ =(K’,∑,f’, k0’,,kt’),,使L(M’)=L(M). 结论 接受L的最小状态有穷自动机不计同构是唯一的。 “分割法” DFA的最小化算法的核心 把一个DFA的状态分成一些不相交的子集,使得任何不同的两子集的状态都

文档评论(0)

441113422 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档