1 For each language, give a regular expression that generates the language and a DFA that accepts it. L 1 = { w  {0, 1}* : has both 00 and 11 as substrings}

Slides:



Advertisements
Similar presentations
Finite Automata CPSC 388 Ellen Walker Hiram College.
Advertisements

1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2005.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Introduction to Computability Theory
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Introduction to Computability Theory
1 Introduction to Computability Theory Discussion1: Non-Deterministic Finite Automatons Prof. Amos Israeli.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
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.
1 Finite Automata. 2 Finite Automaton Input “Accept” or “Reject” String Finite Automaton Output.
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.
CSC 361Finite Automata1. CSC 361Finite Automata2 Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers.
1.Defs. a)Finite Automaton: A Finite Automaton ( FA ) has finite set of ‘states’ ( Q={q 0, q 1, q 2, ….. ) and its ‘control’ moves from state to state.
Finite Automata Costas Busch - RPI.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Finite-State Machines with No Output
CSCI 2670 Introduction to Theory of Computing August 24, 2005.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
2. Scanning College of Information and Communications Prof. Heejin Park.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.
1 Assignment #1 is due on Friday. Any questions?.
1 Prove the following languages over Σ={0,1} are regular by giving regular expressions for them: 1. {w contains two or more 0’s} 2. {|w| = 3k for some.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CHAPTER 1 Regular Languages
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
Finite State Machines 1.Finite state machines with output 2.Finite state machines with no output 3.DFA 4.NDFA.
1 For each language, give a DFA that accepts it. L 1 = { w  {a, b}* : w at most 2 a’s} L 2 = { w  {0, 1}* : has both 00 and 11 as substrings} L 3 = {
Modeling Computation: Finite State Machines without Output
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
1.2 Three Basic Concepts Languages start variables Grammars Let us see a grammar for English. Typically, we are told “a sentence can Consist.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
1.Draw a parse tree for the following derivation: S  C A C  C A b b  b b A b b  b b B b b  b b a A a a b b  b b a b a a b b 2. Show on your parse.
1.Draw a parse tree for the following derivation: S  C A C  C A b b  b b A b b  b b B b b  b b a A a a b b  b b a b a a b b 2. Show on your parse.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
1 Lexical Analysis Uses formalism of Regular Languages Uses formalism of Regular Languages Regular Expressions Regular Expressions Deterministic Finite.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Theory of Languages and Automata By: Mojtaba Khezrian.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
L1= { w  {a,b}* : w consists of all strings that begin with an even number of a's followed by an odd number of b's. } L2= { w  {a,b}* : the number of.
Non Deterministic Automata
Deterministic Finite Automata
Finite Automata & Regular Languages
Chapter 2 FINITE AUTOMATA.
Non-Determinism 12CS45 Finite Automata.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Non Deterministic Automata
CSE322 Minimization of finite Automaton & REGULAR LANGUAGES
Instructor: Aaron Roth
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Design NDFA’s which accept:
CSC312 Automata Theory Transition Graphs Lecture # 9
NFAs and Transition Graphs
Non Deterministic Automata
Lexical Analysis Uses formalism of Regular Languages
Presentation transcript:

1 For each language, give a regular expression that generates the language and a DFA that accepts it. L 1 = { w  {0, 1}* : has both 00 and 11 as substrings} L 2 = { w  {a, b}* : w ends with abab} L 3 = { w  {a, b}* : w has 2 or more a’s} L 4 = { w  {a,b}* : w is a string consisting of an even number of a's followed by an odd number of b's. } L 5 = { w  {a,b}* : the number of a’s in w is congruent to 2 or 4 modulo 5 }

2 Announcements Assignment #2 is posted: Due Fri. Oct. 7. Tutorial #3: print and take to lab. Have you tried the regular expression/DFA tutorials? Did you put your name on your assignment and some boxes for the TA to record your marks in? Put 0 in the box for any questions you omitted.

3 What language does this DFA accept?

4 CSC 320: Lecture 8: Nondeterministic Finite Automata if IF [a-z][a-z0-9]* ID [0-9]+ NUM Picture from: Raymond Wisman, Notes from compiler design class

5 Outline: NDFA’s are like DFA’s but their operation is not deterministic. NDFA’s are defined and several examples are given. We prove that for every NDFA there is an equivalent DFA by giving an algorithm which constructs one. Context: By definition a language is regular if and only if there is a regular expression for it. We will soon prove that a language is regular if and only if there is a DFA which accepts it. Ultimate Consequences: You can prove that a language is regular by either 1.finding a regular expression which generates it, 2.finding a DFA which accepts it, or 3.finding a NDFA which accepts it.

6 A Nondeterministic Finite Automaton (NDFA) M is defined to be a quintuple (K, Σ, Δ, s, F) where K is a finite set of states, Σ is an alphabet, Δ, the transition relation, is a subset of K x (Σ ⋃ { ε} ) x K, s  K is the start state, and F  K is the set of final states.

7 M

8 M= (K, Σ, Δ, s, F): A configuration of a M is an element of K x Σ *. For σ  (Σ U {ε} ), configuration (q, σ w ) ├ (r, w) if (q, σ, r) is in Δ. The notation ├ * means yields in zero or more steps.

9 M= (K, Σ, Δ, s, F): NDFA M accepts input w if and only if there exists some computation such that (s, w) ├ * (f, ε) for some f  F. L(M), the language accepted by M is { w  Σ * : (s, w) ├ * (f, ε) for some f  F}.

10 Some non-accepting computations: (s, abb) ├ (p, bb) ├ (q, b) STUCK- no way to finish consuming the input. (s, abb) ├ (r, bb) ├ (t, b) ├ (p,e) Ends in a non-final state p. M

11 Some accepting computations: (s, abb) ├ (r, bb) ├ (t, b) ├ (u,e) (s, abb) ├ (p, bb) ├ (r, bb) ├ (t, b) ├ (u,e) abb is in L(M) since it has at least one accepting computation. M

12 Prove the following languages over Σ= {0, 1} are regular by constructing NDFA’s which accept them. 1. L 1 ={ w : w starts and ends with 0}. 2. L 2 = (000 ⋃ 11 ⋃ 01)* 3. L 1 ⋃ L 2 4. L 1 ۰ L 2