Transparency No. ?-0 Formal Language and Automata Theory Chapter 6 Homomorphisms (lecture 10) Transparency No. 6-1.

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
Advertisements

CPSC Compiler Tutorial 4 Midterm Review. Deterministic Finite Automata (DFA) Q: finite set of states Σ: finite set of “letters” (input alphabet)
Lecture 8 From NFA to Regular Language. Induction on k= # of states other than initial and final states K=0 a a* b a c d c*a(d+bc*a)*
Transparency No. 2-1 Formal Language and Automata Theory Homework 3.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
Transparency No. 2-1 Formal Language and Automata Theory Chapter 2 Deterministic Finite Automata (DFA) (include Lecture 3 and 4)
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Transparency No Formal Language and Automata Theory Chapter 10 The Myhill-Nerode Theorem (lecture 15,16 and B)
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
1 Languages and Finite Automata or how to talk to machines...
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
Transparency No. 3-1 Formal Language and Automata Theory Chapter 3 Nondeterministic Finite Automata (NFA) (include lecture 5 and 6)
Transparency No Formal Language and Automata Theory Chapter 10 The Myhill-Nerode Theorem (lecture 15,16 and B)
Transparency No. 7-1 Formal Language and Automata Theory Chapter 7 Limitations of Finite Automata (lecture 11 and 12)
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Transparency No. P2C1-1 Formal Language and Automata Theory Part II Pushdown Automata and Context-Free Languages.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Non-Deterministic Automata Regular Expressions.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Lecture 4UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
Transparency No. 8-1 Formal Language and Automata Theory Chapter 8 DFA state minimization (lecture 13, 14)
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Prof. Busch - LSU1 NFAs accept the Regular Languages.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
CHAPTER 1 Regular Languages
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
Lecture # 12. Nondeterministic Finite Automaton (NFA) Definition: An NFA is a TG with a unique start state and a property of having single letter as label.
1 Regular Expressions Reading: Chapter 3. 2 Regular Expressions vs. Finite Automata Offers a declarative way to express the pattern of any string we want.
1 Closure Properties of Regular Languages L 1 and L 2 are regular. How about L 1  L 2, L 1  L 2, L 1 L 2, L 1, L 1 * ?
CS 203: Introduction to Formal Languages and Automata
Chapter 3 Regular Expressions, Nondeterminism, and Kleene’s Theorem Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Finite Automata Chapter 1. Automatic Door Example Top View.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Lecture #4 Thinking of designing an abstract machine acts as finite automata. Advanced Computation Theory.
Lecture #5 Advanced Computation Theory Finite Automata.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Cpt S 317: Spring 2009 Reading: Chapter 3
CIS Automata and Formal Languages – Pei Wang
Non Deterministic Automata
Closure Properties of Regular Languages
CSE 105 theory of computation
Pushdown Automata.
Chapter 2 FINITE AUTOMATA.
Properties of Regular Languages
CS 154, Lecture 3: DFANFA, Regular Expressions.
4. Properties of Regular Languages
Non-Deterministic Finite Automata
Non Deterministic Automata
CSE 2001: Introduction to Theory of Computation Fall 2009
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Closure Properties of Regular Languages
Finite-State Machines with No Output
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
Kleene’s Theorem (Part-3)
Presentation transcript:

Transparency No. ?-0 Formal Language and Automata Theory Chapter 6 Homomorphisms (lecture 10) Transparency No. 6-1

Homomorphisms Transparency No. 6-2 Homomorphisms (the definition) Def: A homomorphism is a mapping h:  * ->  * s.t. for all x,y in  * h(xy) = h(x) h(y) (10-1) h(  ) =  (10.2) Note: (10.2) is not needed since h(  ) = h(   ) = h(  ) h(  ) => |h(  )| = |h(  )|+|h(  )| ==> |h(  )| = 0 ==> h(  ) = . Property 1: Any homomorphism h:  * ->  * is uniquely determined by its value on . I.e., if g,h:  * ->  * are morphism s.t. g(a)=h(a) for all a in , then g = h (I.e., g(x) = h(x) for all x in  *). Pf: if x = x 1 x 2 …x n => h(x) = h(x 1 x 2 …x n ) = h(x 1 )h(x 2 )…h(x n ) = g(x 1 )…g(x n ) = g(x 1 x 2 …x n ) = g(x). Conclusion: to specify a homomorphism h:  *->  * completely, it suffices to specify its values on .

Homomorphisms Transparency No. 6-3 More about homomorphisms h:  * ->  *: a homomorphim; A: a subset of  *; B: a subset of  * h(A) = def {h(x) |x in A}   * is the image of A under h. h -1 (B) = def {x | h(x) in B}   * is the preimage of B under h. Theorem 10: h:  *->  * a homomorphism;B: a regular language over  ==> h -1 (B) is regular too. Pf : M=(Q, , ,s,F) : a DFA s.t. L(M) = B => let M’ = (Q, ,  ’,s,F) where  ’(q,a) =  (q,h(a)) for all a in . Property of M’:  ’(q,x) =  (q,h(x)) for all q in Q and x in  * (10.3) by simple induction on |x|, left as an exercise. => for all x in  *, x  L(M’) iff  ’(s,x)  F iff  (s,h(x))  F iff x  L(M) = B => h -1 (B) = L(M’) is regular. QED

Homomorphisms Transparency No. 6-4 Example: EX: h:{a,b}* -> {0,1}* s.t. h(a) = 01 and h(b) = 10. B= L(M) M : ==> M’ = ?      

Homomorphisms Transparency No. 6-5 Theorem 10.2 h :  * ->  *: a homoporphism; A   *: a regular set => h(A) is regular. Let  be any reg. expr. S.t. L(  ) = A. Let  ’ be the reg. expr. obtained from  by replacing every letter a in  appearing in  with the string h(a) in  *. eg: if h(a) =000, h(b) = 11,  = [(a+b)*ab] =>  ’ = (000+11)*00011  ’ can be defined inductively as follows: _____ (exercise) Property: for any reg. expr.  over . L(  ’) = h(L(  )) --- (10.4) Hence L(  ’) = h(L(  )) = h(A) is regular. To prove 10.4, we require: for all C,D   * and any family of subsets C i   *, i  I, h(CD) = h(C) h(D) --- (10.5) h(U i  I C i ) = U i  I h(C i ) --- (10.6) ==> can be proved direct from definition.

Homomorphisms Transparency No. 6-6 proof of 10.4: pf: by induction on  : case 1:  = a   : L(a’) = L(h(a)) = {h(a)} = h(L(a))  =  => L(  ’) = L(  ) = {} = h({}) = h(L(  )).  = e (note: since e =  * L(e’) can be covered by other case ) Ind. cases: 1. L((  +  )’) = L(  ’ +  ’) = L(  ’) U L(  ’) = h(L(  )) U h(L(  )) = h(L(  ) U L(r)) = h(L(  +r)) 2. L((   )’) = L(  ’  ’) = L(  ’)L(  ’) = h(L(  )) h(L(  )) = h(L(  )L(  )) = h(L(  )) 3. L((  *)’) = L((  ’)*) = U k  0 (L(  ’)) k = U k  0 (h(L(  ))) k = U k  0 h(L(  ) k ) = h( U k  0 L(  ) k ) = h( L(  )*) = h(L(  *)).

Homomorphisms Transparency No. 6-7 Example: EX: h:{0,1}* -> {a,b}* s.t. h(0) = ab and h(1) = ba. A= L(M) M : ==> h(A) is accepted by M’ = ?      

Homomorphisms Transparency No. 6-8 Quiz Q1: Is it true that “ h(A) is regular => A is regular “ ? Notes: 1. h(A) = B does not mean h -1 (B) = A. Hence Q1 is not a consequence of Theorem counter example: Let A = {a n b n | n  0 } h: {a,b}* -> {a,b}* with h(a)=h(b) = a => h(A) = {a 2n | n  0 } = B is regular, but A can be shown to be not regular. 3. h -1 (B) = ______  A. ans: {x  {a,b}* | |x| = 2n }. Exercise: Given a homomorphism h:  *   * and a FA M, find a FA M’ s.t. L(M’) = h (L(M)).

Homomorphisms Transparency No. 6-9 Automata with  -transiiton Def: A NFA with e-transition is a structure M = (Q, ,e, ,S,F) where Q, , ,S,F are the same as in NFAs and e is a special symbol not in  (standing for the empty string  ). for each M, define M e = (Q,  U{e}, ,S,F) to be a usual NFA over the alphabet  U{e}. Define acceptance for automata with e-transitions as follows: for all x in  *, M accepts x if  y in (  U{e})* s.t. M e accepts y under usual definition and x is obtained from y by erasing all e from y. I.e., x = h(y) where h(  U{e})* ->  * with h(a) = a for a in  and h(e) = . In other words, L(M) = def h(L(M e )). Hence if A is accepted by a NFA-e machine M => A = L(M) and B = L(M e )  (  U{e})* is regular with h(B) = A. => A is regular too.

Homomorphisms Transparency No Application of homomorphisms : Haming distance x, y: two bit strings, A: a set of bit strings; k  0 : any number. H(x,y) = # of positions at which they differ if |x| = |y|, or infinite if |x|  |y|. H(x,A) = min y  A H(x,y) N k (A) = {x | H(x,A)  k } is the set of strings of Haming distance at most k from A. Example: 1. N 0 ({000}) = {000}, 2. N 1 ({000}) = ? 3. N 2 ({000}) = ? 4. N 2 ({001, 11}) = {0,1} 3 - {110} U {0,1} 2. Ex3Hw2: if A is regular, then so is N k (A) for any k  0.

Homomorphisms Transparency No Applications of homomorphisms  = {0,1};  x  = { 00, 01,10,11} = { } define top, btm :    with top( ) = x and btm( ) = y. top and btm can be extended to homomorphism (  x  )* ->  * eg: top( ) = 0001 and btm( ) = 1011 D k = def {x  (  x  )* | x contains no more than k occurrences of (0,1) or (1,0) } is certainly regular (why?) = {x  (  x  )* | H(top(x), btm(x))  k }.     xyxy xyxy        

Homomorphisms Transparency No Applications of homomorphisms (cont’d) Now let A be any regular set over  => N k (A) = top (btm -1 (A)  D k ) where btm -1 (A) is the set of (x,y) with y  A, D k is the set of (x,y) with H(x,y)  k btm -1 (A)  D k is the set of (x,y) with y  A and H(x,y)  k top (btm -1 (A)  D k ) is the set of x s.t.  y  A with H(x,y)  k = the set of x with H(x,A)  k = N k (A). Hence N k (A) is regular if A is regular.