Notes on Finite Automata Department of Computer Science Professor Goldberg Textbooks: Introduction to the Theory of Computation by Michael Sipser

Similar documents
CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *

Last time: introduced our first computational model the DFA.

DFA (Deterministic Finite Automata) q a

Finite Automata. d: Q S Q. Finite automaton is M=(Q, S, d, q 0, F) Ex: an FA that accepts all odd-length strings of zeros: q 0 q 1. q i. q k.

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016

INTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x)

Minimum Spanning Trees

The Course covers: Lexical Analysis Syntax Analysis Semantic Analysis Runtime environments Code Generation Code Optimization. CS 540 Spring 2013 GMU 2

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

COMP108 Algorithmic Foundations

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

TOPIC 5: INTEGRATION

Most Complex Regular Ideal Languages

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Lecture 11 Waves in Periodic Potentials Today: Questions you should be able to address after today s lecture:

Minimal DFA. minimal DFA for L starting from any other

CIVL 8/ D Boundary Value Problems - Rectangular Elements 1/7

Formal Languages and Automata

Finite Automata-cont d

1 Nondeterministic Finite Automata

Lecture 08: Feb. 08, 2019

Chapter 16. 1) is a particular point on the graph of the function. 1. y, where x y 1

Multi-Section Coupled Line Couplers

Finite-State Automata: Recap

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

cycle that does not cross any edges (including its own), then it has at least

Homework 3 Solutions

1 Minimum Cut Problem

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

CS 361 Meeting 12 10/3/18

Harvard University Computer Science 121 Midterm October 23, 2012

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

Garnir Polynomial and their Properties

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Linear Algebra Existence of the determinant. Expansion according to a row.

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Basic Polyhedral theory

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

More on automata. Michael George. March 24 April 7, 2014

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

EEO 401 Digital Signal Processing Prof. Mark Fowler

Present state Next state Q + M N

0.1. Exercise 1: the distances between four points in a graph

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued...

1 Introduction to Modulo 7 Arithmetic

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

1 Finite Automata and Regular Expressions

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

CHAPTER 1 Regular Languages. Contents

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

CONIC SECTIONS. MODULE-IV Co-ordinate Geometry OBJECTIVES. Conic Sections

Enforcement of Opacity Security Properties Using Insertion Functions

Coalgebra, Lecture 15: Equations for Deterministic Automata

Lecture 09: Myhill-Nerode Theorem

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Chem 104A, Fall 2016, Midterm 1 Key

Weighted Matching and Linear Programming

Convert the NFA into DFA

Construction of asymmetric orthogonal arrays of strength three via a replacement method

Recall that by Theorems 10.3 and 10.4 together provide us the estimate o(n2 ), S(q) q 9, q=1

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

The Matrix Exponential

(Upside-Down o Direct Rotation) β - Numbers

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Instructions for Section 1

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Combinatorial Networks Week 1, March 11-12

Chapter 2 Finite Automata

1.3 Regular Expressions

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018

UNTYPED LAMBDA CALCULUS (II)

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

The Matrix Exponential

Derangements and Applications

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

ON THE SCOPE OF AVERAGING FOR FRANKL S CONJECTURE

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

Walk Like a Mathematician Learning Task:

Week 3: Connected Subgraphs

QUESTIONS BEGIN HERE!

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

S i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA.

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

QUESTIONS BEGIN HERE!

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

Section 6.1. Question: 2. Let H be a subgroup of a group G. Then H operates on G by left multiplication. Describe the orbits for this operation.

Transcription:

Nots on Finit Automt Dprtmnt of Computr Scinc Profssor Goldrg Txtooks: Introduction to th Thory of Computtion y Michl Sipsr Elmnts of th Thory of Computtion y H. Lwis nd C. Ppdimitriou Ths nots contin th mtril from Thory of Finit Automt which you nd to know in ordr to tk th cours in Computility nd Complxity. Try to solv ll prolms. If you qustions rltd to th mtril prsntd or th prolms, pls snd m n -mil mssg (goldrgcs.rpi.du). 1

1 Finit Automt Trminology: dtrministic (non-dtrministic) finit utomt; input tp; finit control; rding hd; initil stt; finl stts; lngug ccptd y n utomton; Configurtion of n utomton; stt digrm; nondtrministic finit utomton A dtrministic finit utomton is 5-tupl M = (Q, Σ, δ, q 0, F) whr Q finit st of stts Σ n lpht q 0 Q th initil (strt) stt F Q th st of finl (ccpt) stts δ th trnsition function δ : Q Σ Q. S P F Q A configurtion of finit utomton (Q, Σ, δ, q 0, F) is n lmnt of Q Σ. Th currnt configurtion of n utomton is pir {th currnt stt} {th unrd prt of th tp} A configurtion (q, w) yilds in on stp configurtion (q, w ) if thr is σ Σ such tht w = σw nd δ(q, σ) = q. W writ (q, w) M (q, w ). M is th rflxiv, trnsitiv closur of M ; A string w Σ is ccptd y M iff q F such tht (s, w) M (q, ). L(M), th lngug ccptd y M, is th st of ll strings in Σ ccptd y M 2

Prolm 1 Dsign n utomton A = (Q, Σ, δ, q 0, F) whr Σ = {, } such tht () L(A) = {w : w is vn}; () L(A) = {w : w is odd}. Prolm 2 Spcify condition which would gurnt tht for dtrministic utomton A, () L(A) = Σ ; () L(A) =? Prolm 3 Dsign n utomton A = (Q, Σ, δ, q 0, F) with Σ = {, } such tht 1. L(A) = {w : w nd w r vn} 2. L(A) = {w : w nd w r odd} 3. L(A) = {w : w is vn nd w odd} Prolm 4 Dsign n utomton A = (Q, Σ, δ, q 0, F) whr Σ = {,, c} for which L(A) consists of ll words w in Σ such tht 1. ithr w gins with c or it contins 2. vry is immditly followd y c. Prolm 5 Dsign n utomton A = (Q, Σ, δ, q 0, F) whr Σ = {, } for which L(A) consists of ll words w in Σ tht 1. contin ; 2. contin two conscutiv s; 3. do not contin two conscutiv s; 4. hv oth nd ; 3

Prolm 6 Lt Σ = {0, 1, 2,..., 9} nd L th st of ll strings w in Σ such tht th numr w is divisil y 5. 1. Drw fiv-stt DFA which ccpts L; 2. Drw two-stt DFA which ccpts L. Prolm 7 Lt Σ = {0, 1, 2,..., 9}. Drw DFA which ccpts first 3 (5) prim numrs. 4

2 Non-dtrministic finit utomt A non-dtrministic finit utomton is 5-tupl M = (Q, Σ, δ, q 0, F) whr Q finit st of stts Σ n lpht q 0 Q th initil stt F Q st of finl stts δ th trnsition function, δ : Q {Σ ǫ} P(Q). (ǫ is th mpty string; P(Q) is th st of ll susts of Q.) A configurtion of finit utomton (Q, Σ, δ, q 0, F) is n lmnt of Q Σ. A configurtion (q, w) yilds in on stp configurtion (q, w ) if thr is u Σ such tht: w = uw nd q δ(q, u). (q, w) M (q, w ) M is th rflxiv, trnsitiv closur of M. G c H S P Q F c A string w Σ is ccptd y M if thr is pth lld w from th initil stt q 0 to finl stt; q F such tht (q 0, w) M (q, ). L(M) = {w : w is ccptd y M}. Prolm 8 Which of th following strings r ccptd y ths non-dtrministic finit utomt?,,,, (NDFA 1);,,,, (NDFA 2); 00, 01001, 10010, 000, 0000 (NDFA 3). 5

100 0 0 00 1 1 11 NDFA 1 NDFA 2 NDFA 3 Find strings diffrnt from th ov which r ccptd (not ccptd) y th corrsponding utomt. Prolm 9 Drw stt digrms for non-dtrministic finit utomt ccpting ths lngugs: () () () ; () (( ) ) ; (c) (( ) ) ; (d) ( ) ( ). Prolm 10 Which of th following strings r ccptd y nondtrministic finit utomt: ; ; ; ;? ε ε 6

3 Equivlnc of dtrministic nd non-dtrministic utomt. Dfinition 1 Two utomt r quivlnt if thy ccpt th sm lngug (functionl idntity). Givn n NDFA, w construct n quivlnt DFA using two-stp trnsformtion: Stp 1: construct n quivlnt NDFA without trnsitions of lngth > 1; S D A C E B Stp 2: givn n NDFA((Q, Σ, δ, q 0, F) without trnsitions of lngth > 1, construct n quivlnt DFA. S W us th following nottion: E(q) = {p Q : (q, ) M (p, )}. E(q) : is th st of ll stts tht cn rchd from q without ny input; Dfin n quivlnt DFA(Q d, Σ, δ, Q 0, F d ) s follows: Q d : th st P(Q) of ll susts of Q; if Q = {q 0, p, q, r,...}, thn Q d = {, {q 0 }, {q 0, p}, {q 0, q}, {q 0, r},......} A C E B F d δ : th sust of P(Q) comprisd of ll susts of Q tht intrsct with F givn stt Q of M nd n input, δ mps Q into T = δ(q, ) of ll p Q d such tht thr is pth from q Q to p with th first stp ing nd ll othr stps ing th mpty strings Q 0 : th initil stt of M ; Q 0 = E(q 0 ). Thorm 1 M is quivlnt to M. 7

Proof. (sktch) Our gol is to prov tht (q 0, w) M (f, ) for som f F iff (E(q 0 ), w) M (R f, ) for som st R f Q contining f. By induction on w, w prov tht for ny string w Σ nd two stts p nd q in Q, (p, w) M (q, ) iff (E(p), w) M (K, ), ( ) for som st K Q contining q. Hving provd (*), pply it for p = q 0 nd q = f F. Th prt to th lft of iff would mn tht w is ccptd y M, nd th prt to th right of iff would mn tht w is ccptd y M. Prolm 11 Complt th proof of Thorm 7.5. Exmpl: p, q 0 f q Stts: {ø; {q 0 }, {p}, {q}, {f}, {q 0, p}, {q 0, q}, {q 0, f}, {p, q}, {p, f}, {q, f}, {q 0, p, q}, {q 0, p, f}, {q 0, q, f}, {p, q, f}, {q 0, p, q, f}}. Initil stt: {q 0, p, q, f} (ll stts tht r rchl from q 0 using ǫ-pths.) Finl stts: {f, {q 0, f}, {p, f}, {q, f}, {q 0, p, f}, {q 0, q, f}, {p, q, f}, {q 0, p, q, f}. 8

Prolm 12 Enumrt th stts of th dtrministic utomton from th xmpl nd construct th trnsition tl. Minimiztion. Th construction of Thorm 7.5 crts 2 n stts of th quivlnt DFA, whr n is th numr of stts of th initil NDFA. Somtims w cn rduc th numr of stts of th output DFA. Id 1: us th stts of DFA tht cn rchd from E(s). Prolm 13 Prov tht If M is otind from n utomton M y rmoving unrchl stts, thn L(M) = L(M ). Wht hppns if th improvd construction is pplid to dtrministic finit utomton? Id 2: try to find quivlnt stts nd rplc quivlnt stts with on rprsnttiv. Dfinition 2 Lt M = (Q, Σ, δ, q 0, F) DFA with ll stts rchl from q 0. For vry stt q, introduc n utomton M q = (Q, Σ, δ, q, F). Two stts p, q Q r clld k-distinguishl if thr is string w of lngth k which is ccptd y on of M p or M q ut not th othr. Othrwis thy r clld k-indistinguishl. Two stts r clld quivlnt if thy r k-indistinguishl for vry k. Prolm 14 Lt L = L(M) for som DFA with n stts, nd lt M hv two quivlnt stts. Is it possil to construct nw DFA with fwr thn n stts which ccpts th sm lngug? Exmpl: s 1 2 3 4 s 1 2 3 4 S 1;3 2;4 9

A rcursiv dfinition of quivlnt stts: 1. two stts x nd y r clld R 0 quivlnt iff thy r oth finl or oth non-finl 2. stts x nd y r R i+1 -quivlnt iff σ Σ ǫ, δ(σ, x) nd δ(σ, y) r R i -quivlnt; Procdur Contrction (M; M c ) /* Givn n utomton M, th procdur constructs nw utomton M c */ 1. construct squnc R i of quivlnc rltions; 2. lt R # th R i for which R i = R i+1 ; 3. th stts of M c r th quivlnc clsss of R # 4. th finl stts r th clsss of R # composd of th finl stts of M; 5. th initil stt is th clss of R # contining th initil stt of M; 6. for vry stt Q of M c nd vry δ Σ, δ c (Q, σ) is th clss of R # which contins δ(q, σ), whr q Q /* (th choic of q in Q is irrlvnt du to th proprtis of R # ; 10

4 Proprtis of th lngugs ccptd y finit utomt. Lt F dnot th st of lngugs tht r ccptd y finit utomt. Thorm 2 F is closd undr union; conctntion; Kln str; complmnt; nd intrsction. Proof. W nd to prov tht if L 1, L 2 F, thn () L 1 L 2 F; () L 1 L 2 F; (c) L 1 F; (d) Σ L F; () L 1 L 2 F. Thus for ch lttr, w r givn two or on input lngug known to in clss F, nd w nd to construct n utomton, dtrministic or nondtrministic, which ccpts th corrsponding output lngug. For ch cs, w provid simpl digrm which illustrts th corrsponding construction. Kln str: If NDFA M ccpts lngug L, construct nw NDFA to ccpt L s follows: in copy of M introduc mpty trnsitions from ny stt to th initil stt q 0 ; dd nw stt q0 nw nd ssign it to th nw initil stt; introduc th mpty trnsition (q0 nw, q 0 ). q nw 0 q 0 Union: Lt M 1 ccpt L 1 nd M 2 ccpt L 2. Th nw NDFA M contins ll stts from M 1 nd M 2 ; ll trnsitions in M 1 nd M 2 r prsrvd; th finl stts of M is th union of tht in M 1 nd M 2 ; on ddition stt q0 nw is introducd which is st to th nw initil stt; two mpty trnsition r ddd (q0 nw, q 01 ) nd (q0 nw, q 02 ), whr q 01 (rsp. q 01 ) is th initil stt in M 1 (rsp. M 2 ). 11 ε ε ε

q1 0 ε nw q 0 ε q2 0 Conctntion: Similr to th ov. q1 0 ε nw q 0 ε q2 0 Complmnt: Lt NDFA M ccpt L. Thn construct n quivlnt DFA M ; tk copy M of M ; vry stt which is finl (rsp. non-finl) in M mk non-finl (rsp. finl) in M. Intrsction: Us d-morgns idntitis to prsnt th intrsction through th oprtions of th union nd complmnt. 12

5 Rgulr Exprssions nd Finit Automt Prolm 15 Prov tht th following rgulr xprssion dscris th lngug ccptd y th utomton low. (() (c) ) Thorm 3 A lngug is rgulr iff it is ccptd y finit utomt: F = R. Proof. (only if: R F) By dfinition, R is th collction of lngugs tht cn otind y pplying th oprtions union, conctntion, nd Kln str to th mpty st nd th singltons {σ : σ Σ}. Sinc th mpty st nd th singltons r ccptd y finit utomt, (s thorm 7.11) w hv R F. (if: F R). Lt L F nd lt M = (Q, Σ, δ, q 0, F) dtrministic finit utomton ccpting L. If Q = {q 0, q 1, q 2,..., q n }, thn lt L(i, j, k) dnot th st of strings ovr Σ tht gin with q i ; nd with q j ; nd do not pss through ny stt q l whr l k. Clim 1: Th lngug ccptd y th utomton is givn y L = qj FL(0, j, n + 1). Clim 2: i, j, k, L(i, j, k) is rgulr. W us mthmticl induction on k to prov tht vry R(i, j, k) is rgulr lngug. Bs: For ll i nd j, L(i, j, 1) is rgulr cus it is th union of on-lttr lngugs. Induction Stp: Evry pth from q i to q j which psss through q k hs n initil intrvl from q i to q k without intrmdit q k, thn this pth my 13

rpt fw loops from q k to q k, ch without intrmdit q k, nd finlly, nd up with n intrvl from q k to q j, without intrmdit q k. L(k,k,k-1) L(i,k,k-1) k L(k,j,k-1) i j Thus, for k 1, w hv th following idntity L(i, j, k) = L(i, k, k 1) L(k, k, k 1)L(k, k, k 1) L(k, j, k 1). Th rst of th proof is strightforwrd: sinc y induction hypothsis, L(i, k, k 1), L(k, k, k 1),, nd L(k 1, j, k 1) r rgulr, thn y Thorm 7.11, L(i, j, k) dscris rgulr lngug s wll. In prticulr, L(M) is rgulr. Prolm 16 Convrt th following NFA into n quivlnt DFA. S 00 11 A 00 11 B 00 11 00 11 00 11 Prolm 17 Prov tht ny dtrministic utomton which ccpts th lngug L = (0 1 0 1 0) contins > 4 stts. 14

Prolm 18 Tru of fls? Explin. Th lpht Σ is fixd for ll css. () Evry sust of rgulr lngug is rgulr. () Evry rgulr lngug hs propr sust which is lso rgulr. (c) If L is rgulr, thn so is M = {xy : x L nd y L}. (d) L = {w : w = w R } is rgulr lngug. () Th union of rgulr lngugs is rgulr. (f) L = {uvu R : u, v Σ } is rgulr. Prolm 19 A nondtrministic finit utomton is clld simpl if th lngth of vry trnsition is t most 1. Construct simpl finit nondtrministic utomt tht ccpt th following lngugs: () ( ) ; () (( ) ( c) ) ; (c) (() (c) ); (d) ((( c)( c c)) c 2 ). Prolm 20 Apply th construction of th thorm 8.2 to otin rgulr xprssions for th lngugs ccptd y th following utomt:, 15

6 Non-rgulr lngugs. Not vry lngug is rgulr. This clim cn sily provd y compring th crdinlity of th st of ll lngugs in givn lpht nd th st of rgulr xprssions. Th st of ll lngugs is uncountl whil th st of ll rgulr xprssions is countl. Howvr, proving tht prticulr lngug is non-rgulr is usully don with th hlp of pumping lmm which stlishs proprty of vry rgulr lngug. Hnc, if som lngug L dos not hv this proprty, tht lngug is not rgulr. Thr svrl vrsions of th pumping lmm. Pumping lmm: (Th simplst form). Lt L n infinit rgulr lngug. Thn thr r strings x, y, nd z, such tht xy n z L for vry nonngtiv intgr n. Pumping lmm (strongr form): If L is rgulr lngug, thn thr is numr p > 0 such tht for vry w L with w p, thr xists splitting of w into thr prts, w = xyz, such tht 1. xy p; 2. y > 0; nd 3. for vry intgr i 0, string xy i z L. Proof. M. If w L(M) nd w Q, Sinc L is rgulr, thr is n utomton M = (Q, Σ, δ, q 0, F) with L(M) = L. If p is th numr of stts in M, ny string w of lngth p ccptd y M must pss twic through t lst on stt. Thus, w cn split w into thr prts: 1. x th prfix of w which lls th pth from s till th th stt q which is th first to visitd twic; 2. y th sustring of w which lls th smllst cycl contining q; 3. z th rst of w, from p to f. 16

y x p q 0 z f On cn sily s tht th lngth of xy dos not xcd p = Q nd pumping y ny numr of tims, in prticulr, rmovl of y from w yilds string ccptd y th utomton. This complts th proof of th lmm. Commnts 1. Th lmm dos not giv ny indiction s of how xctly string w cn split, xcpt for th ounds on th lngths of xy nd y. 2. Th proprty tht th lmm gurnts must hold for vry string w L, if w p. 3. Th lmm is usully usd to prov tht crtin lngug is not rgulr. Th ojctiv of th proof is to find string w 0 for which ny pumping crts strings tht r not in L. If w cn find t lst on such string, w conclud tht th lngug is not rgulr. 4. From th xmpls low, you cn s tht w cn find such strings nd prov tht pumping crts strings not in L vn though w do not know much out th splitting of w into xyz. Prolm 21 Two initil qustions to clrify th undrstnding of th pumping lmm. 1. Is it importnt tht L is infinit? 2. Is it importnt tht y ǫ? 17

Exmpls of using th Pumping Lmm. Prov tht th following lngugs r not rgulr: () L = { n n : n 0}. Proof: Lt us ssum tht L is rgulr. Thn, thr must xist finit utomton which ccpts L. Lt M n utomton nd lt K st of stts of M. Our gol is to find contrdiction to th ssumption w just md. W will try to do it y slcting n pproprit w L for which th pumping lmm dos not hold. If w rd th lmm, w s tht th proprtis (1) (3) r gurntd for sufficintly long strings, nmly for th strings whos lngth is K. For our lngug L th slction is vry limitd: ll strings r of th form n n for som n 0. W slct string w = n n with n K. Thus, th lngth of th -prt of w is grtr thn K nd th lngth of w is t list twic tht of K. Now w pply th lmm. W know tht th splitting n n = xyz gurntd y th lmm is such tht th comind lngth of x nd y is t most K. This givs us ll w nd, vn though w do not know wht x nd y r: sinc xy n, oth x nd y r in th first prt of w which is composd of s only. If you pump y on tim, forming string xyyz, you incrs th numr of s without incrsing tht of s. Indd, lt us dnot p th lngth of x nd q th lngth of y. From th ov w know tht oth x nd y consist of s only. Thus, x = p nd y = q. Furthrmor, from th scond proprty of th pumping lmm, w hv q > 0. Whn w pump y, th -prt of th nw string is y q longr tht th -prt. Sinc q > 0, w s tht contrry to th lmm, th nw string n+q n is not in L. This contrdiction provs tht L is not rgulr. () L = {ww R : w { } }. Proof: Just lik in th prvious cs, w ssum tht L is rgulr nd, thrfor, thr xists finit utomton M which ccpts it. Agin, lt K st of stts of M. As for (w do it lwys whn w pply th lmm) our gol is gtting contrdiction to th ssumption tht L is rgulr y finding string u L for which th pumping lmm dos not hold. As opposd to th prvious prolm, u cn slctd 18

from grt vrity of strings, sinc for ny w Σ, w hv string v = ww R which is in L. W try to slct w for which th pumping of y in ww R (ltr on) would crt strings not in L. Among mny pproprit strings, w = n fits our gol. W slct string w = n (n K ) which yilds u = n n L (s th dfinition of L). Th lngth of u is mor tht twic tht of K. Now w pply th lmm. W know tht th splitting n n = xyz gurntd y th lmm is such tht th comind lngth of x nd y is t most K. This givs us ll w nd, vn though w do not know wht x nd y r: sinc xy n, oth x nd y r in th first string of s, thrfor oth x nd y r composd of s only. It is sufficint to pump y on tim. This forms string u = xyyz whos lngth is y y > 0 grtr tht of u. Pumping incrss th lngth of th first -suintrvl nd puts oth s in th scond hlf of th nw string. Thrfor u is not of th form givn in th dfinition of L (th scond hlf of th string is th rvrs of th first). This provs tht contrry to th lmm, u is not in L. (c) L = {ww : w { } }. Similr to () nd (). (d) L = {ww : w { } }. Hr w dnots th word otind from w y rplcing ch occurrnc of with n nd vic vrs. Similr to () nd (). () L = { k l c n : n k + l}. Proof: As for, w nd to slct string in L nd pply th pumping lmm in ordr to show tht L is not rgulr. As for, w first ssum tht L is ccptd y finit utomton M; lt K th st of its stts. Slct w = k l c n L for which k K. W will s tht ny such string will do. By th pumping lmm, thr r x, y, nd z for which 1. xy K k; 2. y > 0; nd 3. i 0, string xy i z L. 19

Howvr, if w tk i = n + 1, th lngth of th -prt of th rsulting string coms longr thn tht of th c-prt, which shows tht th rsulting string is not in L. Conclusion: sinc th 3rd proprty of th pumping lmm is violtd, L is not rgulr. () L = { n2 : n 0}. Proof. In this cs, w slct w = n2 with n k, whr k is th numr of stts of th finit utomton ccpting L which (th utomton) is ssumd to xist. If so, n2 = xyz for som x, y, z stisfying () xy k n nd () y > 0. Whn w pump y, y th pumping lmm w must gt string in L, tht is string of th form p2 for som intgr p. Sinc w strtd with n2 nd pumping incrss th lngth of th string, p n + 1. Howvr, th whol incrs of th lngth is xctly y y n. Thus th lngth of th nw string is t most n 2 + n which is smllr thn (n + 1) 2. This contrdiction provs tht L is not rgulr. 20