1 / 7

Review

Review. So far… Regular sets/expressions define FSA accept Regular grammars generate Algorithm to transform expression graphs into regular expressions that define regular languages Today Use of pumping lemma to demonstrate a language is not regular Context-free grammars.

mahlah
Download Presentation

Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Review • So far… • Regular sets/expressions define • FSAaccept • Regular grammars generate • Algorithm to transform expression graphs into regular expressions that define regular languages • Today • Use of pumping lemma to demonstrate a language is not regular • Context-free grammars Regular Languages

  2. Pumping Lemma Regular Languages • The pumping lemma for regular languages requires strings in regular language to admit decompositions satisfying certain repetition properties • Consider a string z=aba in L(M) • z can be decomposed into substrings u, v, w where u=a, v=b, and w=a, and z=uvw • The strings abiacan be obtained by pumping b in aba • The strings are accepted by DFA since the repetition of v simply adds additional trips around the loop b a a 1 2 3 >

  3. Pumping Lemma Regular Languages • Lemma 6.6.1 • Let G be the state diagram of a DFA with k states. Any path of length k in G contains a cycle. • Proof • A path of length k contains k+1 nodes (states). Since there are only k nodes in G, there must be a node, qi, that occurs in at least two positions in the path. The subpath from the first occurrence of qito the second produces a cycle b a a 1 2 3 > qi

  4. Pumping Lemma Regular Languages • Corollary 6.6.2 • Let G be the state diagram of a DFA with k states and let p be the path of length k or more. The path p can be decomposed into subpaths q, r, and s where p=qrs, the |qr| ≤ k, and r is a cycle

  5. Pumping Lemma Regular Languages • Theorem 6.6.3 (Pumping Lemma for Regular Languages) • Let L be a regular language that is accepted by a DFA M with k states. Let z be any string in L, with length(z)≥k. Then z can be written as uvw with length(uv)≤k, length(v)>0, and uviw L for all i ≥0 • Proof: • Let z L be a string with length n>k. Processing z in M generates a path of length n in the state diagram of M. By corollary 6.6.2, this path can be broken into subpaths q, r, and s, where r is a cycle in the diagram. The decomposition of z into u, v, w consists of string generated by paths q, r, and s.

  6. Pumping Lemma Non Regular Languages • The pumping lemma can be used to show a language is non-regular • To demonstrate a language is not regular, it is sufficient to find one string that does not satisfy the conditions of the pumping lemma • To use the pumping lemma to show a language is not regular • It is necessary to choose a string z in L and show that there is not decomposition uvw for z for which uviw is in L for all i ≥0

  7. Pumping Lemma Non Regular Languages • Example: L={aibi| i ≥ 0} • Assume L is regular, and let k be the number specified by the pumping lemma • Let z be the string akbkand |z|≥ k. There exist substrings u, v, w, such that z=uvw, |uv|<k, |v|>0, and uviw is in L for all i ≥0 • Pumping v twice generates uv2w= aiajajak-i-jbk=akajbk • Since j>0, then k+j≠k, which is a contradiction, thus ak+jbk is not in L. Since z in L cannot be decomposed to satisfy the conditions of the pumping lemma, L is not regular u v w ai aj ak-i-jbk i+j< k j >0

More Related