計算理論 (期中考) 20081121.doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
計算理論 (期中考) (總分120,得分超過100分以100分計) (12%) Give the state diagram of a DFA for each of the following languages. In all parts ? = {0, 1}. (a) {w | w does not contain the substring 01 } (b) {w | w does not contain the substring 1010 } (c) {w | w has an even number of 0s and the number of 1s is a multiple of 3} Ans: (a) DFA of So the DFA of L is (b) DFA of So the DFA of L is (c) (8%) Prove that every NFA can be converted to an equivalent one that has a single accept. Your need give (a) the state diagram and (b) the formal definition for the equivalent one. Ans: (a) ε ε ε ε qf (b) Original NFA (Q , Σ , δ , q0 , F ) New NFA (Q1 , Σ , δ1 , q0 , {qf}) Q1 = Q∪{qf} δ1( q , a ) =δ( q , a ) if q ? F or a ≠ε δ1( q , a ) =δ( q , a )∪{qf} if q ? F and a =ε (8%) Let B and C be languages over ? = {0, 1}. Define B ? C = {w? B | for some y ? C, strings w and y contain equal numbers of 1s}. Show that the class of regular languages is closed under the operation ?. Ans: see textbook page 97 1.44 (16%) Say that string x is a prefix of string y if a string z exists where xz = y and that x is a proper prefix of y if in addition x ? y. In each of the following parts we define an operation on a language A. Show that the class of regular languages is closed under that operation. (a) NOPREFIX(A) = {w ? A | no proper prefix of w is a member of A}. (b) NOEXTEND(A) = { w ? A | w is not the proper prefix of any string in A}. Ans: (a) see textbook page 96 1.40.a (b) Original NFA (Q , Σ , δ , q0 , F ) New NFA (Q , Σ , δ , q0 , F1 ) ?q? F1 , q? F and if qqt then qt ? F. (16%) Prove that the following languages are not regular. (a) { 0n 1m 0n | m, n ? 0} (b) {0m1n | m?n} (c) { w | w ? {0, 1}* is not a palindrome} (d) { wtw | w, t ? {0, 1}+ } Ans: (a) Choose w = 0p 1q 0p , p is the pumping length. Let w = xyz , where | xy | ? p , | y | ? 1. Then y = 0k , 1 ? k ? p. So xy2z = 0p+k 1q 0p ? L Therefore L is not regular. (b) If L={0m1n | m?n} is regular then is regular. But ∩{0m1n |

文档评论(0)

勤能补拙 + 关注
实名认证
内容提供者

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

1亿VIP精品文档

相关文档