Formal Language & Automata Theory

Slides:



Advertisements
Similar presentations
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)*
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.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Regular operations Sipser 1.2 (pages 47-63). First… a sample proof
1 Regular Expressions Highlights: –A regular expression is used to specify a language, and it does so precisely. –Regular expressions are very intuitive.
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
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.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
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.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Lecture 5UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 5.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
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.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
THEORY OF COMPUTATION 08 KLEENE’S THEOREM.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
CSCI 2670 Introduction to Theory of Computing August 26, 2004.
CSCI 2670 Introduction to Theory of Computing August 25, 2005.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
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.
Lesson No.6 Naveen Z Quazilbash. Overview Attendance and lesson plan sharing Assignments Quiz (10 mins.). Some basic ideas about this course Regular Expressions.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
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.
Recap: Transformation NFA  DFA  s s1s1... snsn p1p1 p2p2... pmpm >...  p1p1  p2p2  pipi s e s1s1 e s2s2 e sisi >
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.
 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.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Formal Language & Automata Theory
Cpt S 317: Spring 2009 Reading: Chapter 3
Language Recognition MSU CSE 260.
Foundations of Computing Science
Languages.
Formal Language & Automata Theory
Non Deterministic Automata
PROPERTIES OF REGULAR LANGUAGES
Formal Language & Automata Theory
CSE 105 theory of computation
Formal Language & Automata Theory
Single Final State for NFA
Language Recognition (12.4)
Closure Properties for Regular Languages
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
Non Deterministic Automata
Closure Properties of Regular Languages
Language Recognition (12.4)
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
CSE 105 theory of computation
Chapter 1 Regular Language
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
NFAs accept the Regular Languages
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Formal Language & Automata Theory Shyamanta M Hazarika Computer Sc. & Engineering Tezpur University http://www.tezu.ernet.in/~smh

Regular Expressions A regular expression defines a language. Regular expressions are defined through union, concatenation, and closure. Union: L1  L2  {x | x in L1 or x in L2}. Concatenation: L1L2  {xy | x in L1 and y in L2}. (Kleene) Closure: L*  i=0.. Li, where L0 = {}, Li =LLi-1. Example: {01, 10}* = {, 01, 10, 0110, 0101, 1010, …}.

Formal Definition Definition: Regular expressions (over ). 1)  is a regular expression denoting  (empty set). 2)  is a regular expression denoting {}. 3) For each a  , a is a regular expression denoting {a}. 4) If E (F) is a reg. exp. denoting language L(E) (L(F)), then (E + F) is a reg. exp. denoting L(E)  L(F), (EF) ………………………….L(E)L(F), (E*) ………………………….L(E)*. We will omit parenthesis if no confusion.

Example 00(0 + 1)*01 +  = {x | x =  or x, |x|  4, begins with 00 and ends with 01} (An alphabet of {0,1} is assumed here, and in many other examples as well.)

Finite Automata and Reg. Exps. Regular expressions define the same class of languages as Finite Automaton. NFA DFA -NFA Reg. Exp.

Theorem Theorem: If R is a regular expression, then L(R) = L(E) for some NFA E with -moves. Proof: We construct E so that it has one final state and no transitions out of that state. We do this by induction on the number of operators in R.

Basis Only three cases: Case 1: R = . Case 2: R = . Case 3: R = a. q0 Start q0 qf Start q0 qf Start a

Inductive Step Case 1: R = R1 + R2. By the induction hypothesis, machines E1 and E2 exist for R1 and R2, respectively. Construct E as follows: q1 f1 E1  q0 Start f0 q2 f2 E2

Inductive Step (Continued) Case 2: R = R1R2. Start q1 f1 E1 q2 E2 f2  Case 3: R = R1*.  q1 f1 E1   q0 f0 Start 

Example 0(0 + 1)* 0: 1: 0 + 1: Start 1 Start    1  Start

Example (Continued) 1  0 + 1: (0 + 1)*: Start 1  Start

Example (Continued)      (0 + 1)*:   0(0 + 1)*:             (0 + 1)*: 0(0 + 1)*:  1  Start         1  Start

Example (Continued)  0(0 + 1)*:              1  Start Note: A much simpler machine exists.