Language Recognition MSU CSE 260.

Slides:



Advertisements
Similar presentations
Language and Automata Theory
Advertisements

Chapter 5 Pushdown Automata
Natural Language Processing - Formal Language - (formal) Language (formal) Grammar.
Finite Automata and Non Determinism
Finite Automata Finite-state machine with no output. FA consists of States, Transitions between states FA is a 5-tuple Example! A string x is recognized.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
Fall 2005 CSE 467/567 1 Formal languages regular expressions regular languages finite state machines.
CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
Grammars, Languages and Finite-state automata Languages are described by grammars We need an algorithm that takes as input grammar sentence And gives a.
CS 3240: Languages and Computation Pushdown Automata & CF Grammars NOTE: THESE ARE ONLY PARTIAL SLIDES RELATED TO WEEKS 9 AND 10. PLEASE REFER TO THE TEXTBOOK.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
CSCI 2670 Introduction to Theory of Computing September 21, 2005.
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
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
1 INFO 2950 Prof. Carla Gomes Module Modeling Computation: Language Recognition Rosen, Chapter 12.4.
CHAPTER 1 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.
9.7: Chomsky Hierarchy.
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
Chapter 3 Regular Expressions, Nondeterminism, and Kleene’s Theorem Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
Lecture 8 Context-Free Grammar- Cont.
September1999 CMSC 203 / 0201 Fall 2002 Week #15 – 2/4/6 December 2002 Prof. Marie desJardins.
Finite State Machines 1.Finite state machines with output 2.Finite state machines with no output 3.DFA 4.NDFA.
Modeling Computation: Finite State Machines without Output
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
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.
1 Introduction to the Theory of Computation Regular Expressions.
Copyright © Curt Hill Other Automata Pushdown through Turing machines.
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
Theory of Languages and Automata By: Mojtaba Khezrian.
Week 14 - Friday.  What did we talk about last time?  Simplifying FSAs  Quotient automata.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Theory of Languages and Automata By: Mojtaba Khezrian.
Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called.
CSE 105 theory of computation
Theory of Languages and Automata
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz
Linear Bounded Automata LBAs
Complexity and Computability Theory I
Natural Language Processing - Formal Language -
CSE 105 theory of computation
Formal Language & Automata Theory
CS314 – Section 5 Recitation 3
Chapter 7 PUSHDOWN AUTOMATA.
Lecture 9 Theory of AUTOMATA
Course 2 Introduction to Formal Languages and Automata Theory (part 2)
CSE322 Chomsky classification
Language Recognition (12.4)
LECTURE NOTES On FINITE AUTOMATA.
REGULAR LANGUAGES AND REGULAR GRAMMARS
CSE322 The Chomsky Hierarchy
Some slides by Elsa L Gunter, NJIT, and by Costas Busch
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
Context-Free Languages
CSE 105 theory of computation
Language Recognition (12.4)
Principles of Computing – UFCFA3-30-1
CSE 105 theory of computation
Chapter 1 Regular Language
Recap Lecture 15 Examples of Kleene’s theorem part III (method 3), NFA, examples, avoiding loop using NFA, example, converting FA to NFA, examples, applying.
Finite-State Machines with No Output
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
The Chomsky Hierarchy Costas Busch - LSU.
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Language Recognition MSU CSE 260

Outline Introduction Regular Expressions & Regular Sets Kleene’s Theorem Regular Sets and Regular Grammars Examples More powerful Types of Machines Exercise 10.4

Introduction The sets (languages) recognized by FAs are those formed from: null (empty) set , empty string (), and singleton strings by taking (in arbitrary order): concatenations, unions, Kleene Closures. Regular languages

Regular Expressions Definition. The regular expressions over a set I are defined recursively by: the symbol  is a regular expression; the symbol  is a regular expression; the symbol x is a regular expression whenever x  I. the symbols (AB), (AB), and A* are regular expressions whenever A and B are regular expressions. Examples. The following are regular expressions over I={0,1}: 10*, (10)*, 001, 0(01)*, (0*1)* Note. AB is sometimes represented as A+B. Precedence rules: Kleene closure(*), concatenation, union

Regular Sets Each regular expression represents a (regular) set. Reg. Exp. Set represented  the empty set   the set {} x the set {x} (AB) the concatenation of the sets represented by A and by B (AB) the union of the sets represented by A and by B A* the Kleene closure of the set represented by A Examples. 10*: strings consisting of a 1 followed by any number of 0s (10)*: any arbitrary combinations of string 10 (including ) 0  01: the set consisting of the two strings 0 and 01 0(0  1)*: the set of strings which begin with 0

Kleene’s Theorem Kleene’s Theorem. A set is regular if and only if it is recognized by a finite-state automaton. Proof. The proof is done by construction of NFAs for sets represented by regular expressions.

NFAs for Basic Regular Sets recognizes  Start s0 recognizes {} Start s0 The NFA is easier to build and understand than the equivalent FA. a recognizes {a} Start s0 s1

NFA for Concatenation Let A be recognized by MA=(SA, I, fA, sA, FA), and B recognized by MB=(SB, I, fB, sB, FB) MAB f MA MB Start f i sA sB i The NFA is easier to build and understand than the equivalent FA. A transition to final state in MA produces a transition to sB. A transition from sB in MB produces a transition from sAB=sA if sA is a final state. Start state of MAB is sAB=sA, which is final if both sA and sB are final. Final states of MAB include all final states of MB.

NFA for Union Let A be recognized by MA=(SA, I, fA, sA, FA), and B recognized by MB=(SB, I, fB, sB, FB) i MA i sA MAB Start sAB MB The NFA is easier to build and understand than the equivalent FA. i sB i Start state of MAB is sAB, which is final if sA or sB is final. Final states of MAB are the final states of MA and MB.

NFA for Kleene Closure Let A be recognized by MA=(SA, I, fA, sA, FA). Start i MA* sA* sA i The NFA is easier to build and understand than the equivalent FA. Transitions from sA produce transitions from sA* and all final states of MA. Start state of MA* is sA*, which is a final state. Final states of MA* include all final states of MA.

NFA for a Set Generated by a Regular Grammar Theorem. A set generated by a regular grammar is regular. Let G = (V, T, S, P) be a regular grammar. Then the corresponding NFA is M = (S, I, f, s0, F): S contains a state sA for each nonterminal symbol A of G, and an additional (final) state sF. Start state is s0 = sS. Transitions are formed from the productions: A  aB produces a transition from sA to sB on input a A  a produces a transition from sA to sF on input a F also includes s0 if P includes production S  .

Example Let G=(V,T,S,P) where V={0,1,A,S}, T={0,1}, and the productions in P are: S1A, S0, S, A0A, A1A, A1 The corresponding NFA is M=(S, I, f, s0, F): S={sS, sA, sF}, s0=sS, F={sF}, I={0,1}, and state diagram 0,1 1 sA Start sS 1 sF

Regular Grammar Generating a Regular Set Theorem. If a set is regular, then there is a regular grammar that generates it. Let M = (S, I, f, s0, F) be the NFA recognizing this set. Then the regular grammar generating it is G = (V, T, S, P): Assign a nonterminal symbol As to each state s of S; Assign a terminal symbol to each input symbol in I; Start symbol S corresponds to start state s0. Productions are formed from the transitions: A transition from s to t on input a produces As  aAt A transition from s to a final state on input a produces As  a P also includes production S   if L(M).

Example Let NFA M=(S, I, f, s0, F), where: S={s0, s1, s2}, I={0,1}, F={s0, s2}, and state diagram: s1 Start s0 1 1 1 s2 The corresponding regular grammar G=(V,T,S,P) V={S=A0, A1, A2, 0, 1}, T={0, 1}, and productions in P: S0A1, S1A2, A10A1, A11A2, A20A1, A21A2, A11, A21, S1, S

More powerful Types of Machines The set {0n1n | n = 0, 1, 2, …} is not regular; has no FA. The limitation of FAs is their finite memory. More powerful models of computation: Pushdown automata Include all FA’s features, plus a stack for unlimited memory. Recognize languages generated by context-free grammars. Example: {0n1n | n=0, 1, 2, …} Linear bounded automata Context-sensitive languages. Example: {0n1n2n | n = 0, 1, 2,…} Turing machines Include FA’s features and a tape (infinite in both directions) for read and write. ►All languages generated by grammars.

Exercise 10.4