Recap: Transformation NFA  DFA  s s1s1... snsn p1p1 p2p2... pmpm >...  p1p1  p2p2  pipi s e s1s1 e s2s2 e sisi >

Slides:



Advertisements
Similar presentations
CSC 361NFA vs. DFA1. CSC 361NFA vs. DFA2 NFAs vs. DFAs NFAs can be constructed from DFAs using transitions: Called NFA- Suppose M 1 accepts L 1, M 2 accepts.
Advertisements

1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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 Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections:1.1 page 44 September 8, 2006.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Regular Expressions.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Lecture 3: Closure Properties & Regular Expressions Jim Hook Tim Sheard Portland State University.
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...
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
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.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Nondeterminism (Deterministic) FA required for every state q and every symbol  of the alphabet to have exactly one arrow out of q labeled . What happens.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Theory of Languages and Automata
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
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to DFA.
Solution Exercise 1.43 a A r r s q q > b b e b s’ q r q’ b r’ a A’
Prof. Busch - LSU1 NFAs accept the Regular Languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
Lecture 5 Sept 06, 2012 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
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
Finite Automata – Definition and Examples Lecture 6 Section 1.1 Mon, Sep 3, 2007.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Regular Expressions Costas Busch - LSU.
Chapter 3 Regular Expressions, Nondeterminism, and Kleene’s Theorem Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction.
Modeling Computation: Finite State Machines without Output
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Conversions Regular Expression to FA FA to Regular Expression.
 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.
1 Introduction to the Theory of Computation Regular Expressions.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
1 Section 11.2 Finite Automata Can a machine(i.e., algorithm) recognize a regular language? Yes! Deterministic Finite Automata A deterministic finite automaton.
Page 1. 1)Let B n = { a k | where k is a multiple of n}. I.e. B 1 = { a k | where k is a multiple of 1} = { a k | k Є {0,1,2,3,…}} = {‘’, a, aa, aaa, aaaa,
Theory of Languages and Automata By: Mojtaba Khezrian.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
Languages.
CSE 105 theory of computation
Formal Language & Automata Theory
Regular Expression We shall build expressions from the symbols using simple operations include concatenation, union and kleen closure. Several intuitive.
Closure Properties for Regular Languages
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
CSCI 2670 Introduction to Theory of Computing
Language Recognition (12.4)
CSE 105 theory of computation
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
Finite Automata Part Three
CSE 105 theory of computation
Presentation transcript:

Recap: Transformation NFA  DFA  s s1s1... snsn p1p1 p2p2... pmpm >...  p1p1  p2p2  pipi s e s1s1 e s2s2 e sisi >

Closure Under Set Operations Theorem. Let L and M two regular languages, then the following languages are also regular: L  M L C L  M L – M LM L*

Regular Expressions A regular expression is defined inductively over the alphabet   { (, ), e, , , *} as follows: , e, and each character in  are regular expressions (step 0) If  and  are regular expressions then: (    ) (  )  * are also regular expressions (inductive step) No other string over the alphabet   { (, ), e, , , *} is a regular expression  Exceptions: ,  *,  +,  k (for a fixed k > 0)

Language Representing Regular Expressions We define a mapping from a regular expression  to a language L(  ) as follows: Step 0: L(  ) = L(e) = L(  ) = for each    Inductive step: L((    )) = L((  )) = L(  *) = {} {e}{e} {}{} L(  )  L(  ) L(  )L(  ) L(  )*

Example (1) Example 1. Find L((ab*)a) L(ab*a) = Example 2. Find L((a(a  b)*)). L(a(a  b)*) = L(a)L(b)*L(a) = {w : w is of the form ab n a with n = 0, 1, 2,…} L(a)(L(a)  L(b))* = {aw : w is a word in  }

Example (2) Find the regular expression for the language L in the alphabet {a,b} such that the words in L contains the substring aaa Find the regular expression for the language L in the alphabet {a,b} such that the words in L contains the substring aaa or bbb

Main Theorem About Finite Automata (Kleene) (1) Given a finite automata A, there is a regular expression expr such that L(A) = L(expr) Regular languages regular expressions (2) Given a regular expression expr, there is a finite automata A such that L(A) = L(expr)

Theorem 1.54 Input: a regular expression expr Output: a finite automaton accepting L(expr) 1.Convert any step-0 element (any of the characters in ,  or e) occurring in expr to a finite automaton accepting this element 2.Apply the theorem about closure under set operations to every Union Concatenation Kleene star

Example Obtain a finite automaton accepting the regular expression: ((a  ab)*ba)*. The impact of this Algorithm is a dream (or a nightmare?) of programmers: given the specification of a language there is an algorithm that recognizes it automatically. Example: Yak and Lex tools in Unix.

Lemma 1.60 Input: a finite automaton A Output: a regular expression expr such that L(expr) = L(A) Assumptions about the automaton A: A has a single favorable state There are no transitions directed to the initial state There are no transitions starting at the favorable state Nodes will be labeled 1, 2, …, n, where 1 is the initial state and n is the favorable state Definition. An generalized NFA is am NFA in which the arrows are labeled by regular expressions. (Unlike regular NFAs in which transitions are only labeled by characters in  )

Construction (1) for every pair of nodes such that there is more than one transition from one to the other one: expr 1 expr 2 … expr n expr 1  expr 2  …  expr n

Construction (2) for every pair of nodes such that there is an intermediate node connecting them: expr 1 expr 3 expr 2 expr 1 (expr 2 )* expr 3

Example sq r q b r > b a b b a

Homework Friday Sep (a) 1.28 (c) 1.43 (either picture and an accompanying explanation or formal proof are fine) 1.60 (either state diagram or formal definition are fine)