1 INFO 2950 Prof. Carla Gomes Module Modeling Computation: Language Recognition Rosen, Chapter 12.4.

Slides:



Advertisements
Similar presentations
Natural Language Processing - Formal Language - (formal) Language (formal) Grammar.
Advertisements

Deterministic Finite Automata (DFA)
COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou.
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
YES-NO machines Finite State Automata as language recognizers.
Chapter Chapter Summary Languages and Grammars Finite-State Machines with Output Finite-State Machines with No Output Language Recognition Turing.
CS21 Decidability and Tractability
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
Theory of Computation What types of things are computable? How can we demonstrate what things are computable?
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 4 Updated by Marek Perkowski.
CS 310 – Fall 2006 Pacific University CS310 Strings, String Operators, and Languages Sections: August 30, 2006.
Linear Bounded Automata LBAs
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.1: DFA’s) David Martin With some modifications.
Normal forms for Context-Free Grammars
CS 3240 – Chuck Allison.  A model of computation  A very simple, manual computer (we draw pictures!)  Our machines: automata  1) Finite automata (“finite-state.
CSC 361Finite Automata1. CSC 361Finite Automata2 Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers.
Grammars, Languages and Finite-state automata Languages are described by grammars We need an algorithm that takes as input grammar sentence And gives a.
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
Great Theoretical Ideas in Computer Science.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Chapter 2 Languages.
Language Recognizer Connecting Type 3 languages and Finite State Automata Copyright © – Curt Hill.
Finite-State Machines with No Output
1 Syntax Specification Regular Expressions. 2 Phases of Compilation.
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
CS/IT 138 THEORY OF COMPUTATION Chapter 1 Introduction to the Theory of Computation.
Pushdown Automata (PDAs)
Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided by author Slides edited for.
1 Chapter 1 Introduction to the Theory of Computation.
Languages, Grammars, and Regular Expressions Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth.
Grammars CPSC 5135.
1 Introduction to Regular Expressions EELS Meeting, Dec Tom Horton Dept. of Computer Science Univ. of Virginia
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
Copyright © Curt Hill Finite State Automata Again This Time No Output.
CS 203: Introduction to Formal Languages and Automata
Recursive Definations Regular Expressions Ch # 4 by Cohen
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
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
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
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.
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
Week 14 - Friday.  What did we talk about last time?  Simplifying FSAs  Quotient automata.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Theory of Computation. Introduction to The Course Lectures: Room ( Sun. & Tue.: 8 am – 9:30 am) Instructor: Dr. Ayman Srour (Ph.D. in Computer Science).
Finite-State Machines (FSM) Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth Rosen.
Theory of Languages and Automata By: Mojtaba Khezrian.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesAlgebraic.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
Language Recognition MSU CSE 260.
CIS Automata and Formal Languages – Pei Wang
Theory of Languages and Automata
Linear Bounded Automata LBAs
Natural Language Processing - Formal Language -
Course 2 Introduction to Formal Languages and Automata Theory (part 2)
CSE322 Chomsky classification
Language Recognition (12.4)
REGULAR LANGUAGES AND REGULAR GRAMMARS
Language Recognition (12.4)
Chapter 1 Introduction to the Theory of Computation
Chapter 1 Regular Language
Presentation transcript:

1 INFO 2950 Prof. Carla Gomes Module Modeling Computation: Language Recognition Rosen, Chapter 12.4

What sets can be recognized by a Finite State Automata? 2 Regular Sets

Definition: A regular set is a set that can be generated starting from the empty set, empty string, and single elements from the alphabet, using concatenations, unions, and Kleene closures in arbitrary order. We will give a more precise definition after we define a regular expression.

Regular Expressions Definition: The regular expressions over a set I are defined recursively by: –  (the empty set) is a regular expression, –  (the set containing the empty string) is a regular expression, –x is a regular expression for all x  I, –(AB), (A  B), and A * are regular expressions if A and B are regular expressions Definition: A regular set is a set represented by a regular expression.

Regular Expression Example Examples: 001 *, 1(0  (0  1) * 11, and AB * C are regular expressions The regular set defined by the regular expression 01 * is the set of strings starting with a 0 followed by 0 or more 1s. The regular set defined by (10) * is the set of strings containing 0 or more copies of 10. The regular set defined by 0(0  1) * 1 is the set of all binary strings beginning with 0 and ending with 1. The regular set defined by (0  1)1(0  1) is the set of strings {010, 011, 110, 111}.

What are the strings represented by 10* A 1 followed by any mnumber of 0s (including no zeros) (10)* Any number of copies of 10 (including null string) 6

0  01 the string 0 or the string 01 0 (0  1)* Any string beginning with 0 (0*1)* Any string not ending with a 0 (including null string) 7

Find a regular expression The set of bit strings with even length (00  01  10  11)* Set of bit strings ending with a 0 not containing 11 Concatenations of 0 or 10 ; not the null string (0  10)*(0  10) 8

The set of bit strings containing and odd number of 0s At least one 0 Zero or more 1s, followed by a 0, followed by zero or more 1 1*01*(01*01*)* 9

Regular Expression Applications Regular expressions are actually used quite often in computer science. For instance, if you are editing a file with vi, and want to see if it contains the string blah followed by a number followed by any character followed by the letter Q, you can use the regular expression blah[0-9][0-9]*.Q This works because vi uses regular expressions for searching.

Regular ExpressionRegular Grammar a* S   | aS (a+b)* S   | aS | bS a* + b* S   | A | B A  a | aA B  b | bB a*b S  b | aS ba* S  bA A   | aA (ab)* S   | abS

EXAMPLE 1 Consider the language { a m b n | m, n  N}, which is represented by the regular expression a*b*. A regular grammar for this language can be written as follows: S   | aS | B B  b | bB.

Grammars, Expressions, and Automata Consider the set A={binary strings which start with 0 and end with 1} We saw that A is recognized by a finite-state automata. A is generated by the grammar with V={S,A,0,1}, T={0,1}, and P={S  0A, A  0A, A  1A, A  1} We also saw that A is defined by the regular expression 0(0  1) * 1 This is no coincidence, as we will see next.

Three Equivalent Representations Finite automata Regular expressions Regular languages Each can describe the others Kleene’s Theorem: For every regular expression, there is a deterministic finite-state automaton that defines the same language, and vice versa.

Grammars, Expressions, and Automata Theorem: Let L be a language. The following three statements are equivalent L is regular set (that is, L generated by a regular expression) L is a regular language (that is, L generated by a regular grammar) L is recognized by a finite-state automaton Put another way, L is a regular set if and only if L is a regular language if and only if L is recognized by a finite- state automaton. In other words, regular sets, regular languages, and languages recognized by finite-state automata are all the same thing.

Example Example: What language does the following finite-state automaton recognize?

Complex Example Continued If start by going to state S 1 can recognize 000, 0110, , , , 00100, , , , … It is not easy to see the pattern right away, but notice that they Start with 0 Can have any number of instances of 111 or 01 interleaved Can then have either 00 or 110 Can end with any number of 1s. These are all of the form 0(111  01)*(00  110)1* But we can also start by going to S 6

Complex Example Continued If we start by going to S 6 we notice that the strings Start with 1 Have any number of occurrences of 01 Have a 1 End with as many 0s as we want These are of the form 1(01)*10* Thus, we can recognize (0(111  01)*(00  110)1*)  1(01)*10*)

Limitations Problem: Find a finite-state automaton that recognizes the following language L={0 n 1 n | n=0,1,2,…} Solution: It cannot be done. Proof: Take an advanced course. Can you describe L with a regular expression? Can you give a regular grammar that generates L? Can you give any grammar that generates L?

20 DFA-regular languages Push down automata -Context-free Bounded Turing M’s-Context sensitive Turing machines -Phrase-structure Models of computing

Summary Hopefully it is clear that although finite-state machines and finite-state automata are useful models of computation, they have serious limitations. Are there more powerful ways to model computation? The answer is: Yes. Some more powerful models include Pushdown automaton Linear bounded automaton Turing machines Quantum computation models