LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.

Slides:



Advertisements
Similar presentations
Why empty strings? A bit like zero –you may think you can do without –but it makes definitions & calculations easier Definitions: –An alphabeth is a finite.
Advertisements

Finite-State Machines with No Output Ying Lu
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 13: 10/9.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong. Administrivia We'll postpone Homework 4 review until next week …
YES-NO machines Finite State Automata as language recognizers.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
CS 3240 – Chapter 3.  How would you delete all C++ files from a directory from the command line?  How about all PowerPoint files that start with the.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/4.
LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 11: 10/3.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/3.
Fall 2005 CSE 467/567 1 Formal languages regular expressions regular languages finite state machines.
Finite state automaton (FSA)
LING 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/5.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
1 Finite state automaton (FSA) LING 570 Fei Xia Week 2: 10/07/09 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
PZ02B Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ02B - Regular grammars Programming Language Design.
Finite-State Machines with No Output Longin Jan Latecki Temple University Based on Slides by Elsa L Gunter, NJIT, and by Costas Busch Costas Busch.
Finite-State Machines with No Output
PZ02B Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ02B - Regular grammars Programming Language Design.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided by author Slides edited for.
LING/C SC/PSYC 438/538 Lecture 7 9/15 Sandiway Fong.
COMP3190: Principle of Programming Languages DFA and its equivalent, scanner.
LING/C SC/PSYC 438/538 Lecture 12 10/4 Sandiway Fong.
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.
2. Regular Expressions and Automata 2007 년 3 월 31 일 인공지능 연구실 이경택 Text: Speech and Language Processing Page.33 ~ 56.
LING 388: Language and Computers Sandiway Fong 9/27 Lecture 10.
Copyright © Curt Hill Finite State Automata Again This Time No Output.
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong. Administrivia Reading Homework – Chapter 3 of JM: Words and Transducers.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
CS 203: Introduction to Formal Languages and Automata
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
LING/C SC/PSYC 438/538 Lecture 16 Sandiway Fong. SWI Prolog Grammar rules are translated when the program is loaded into Prolog rules. Solves the mystery.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
BİL711 Natural Language Processing1 Regular Expressions & FSAs Any regular expression can be realized as a finite state automaton (FSA) There are two kinds.
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.
1 Recap lecture 28 Examples of Myhill Nerode theorem, Quotient of a language, examples, Pseudo theorem: Quotient of a language is regular, prefixes of.
COMP3190: Principle of Programming Languages DFA and its equivalent, scanner.
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
1 Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Properties of Regular Languages
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
Complexity and Computability Theory I
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
Some slides by Elsa L Gunter, NJIT, and by Costas Busch
Intro to Data Structures
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
Deterministic PDAs - DPDAs
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
Properties of Context-Free languages
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong.
Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
Mealy and Moore Machines
CHAPTER 1 Regular Languages
Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
PZ02B - Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section PZ02B.
Intro to Theory of Computation
Presentation transcript:

LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong

Today's Topic Review of ungraded homework Closure properties of FSA Practice! Homework out on Thursday…

From last time Ungraded Homework 6 apply the set-of-states construction technique to the two machines on the ε- transition slide (repeated below) self-check your answer: verify in each case that the machine produced is deterministic and accurately simulates its ε-transition counterpart 1 a ε 2 3 b > 1 a ε 2 3 b >

Ungraded Homework 6 Review Converting a NDFSA into a DFSA a b Note: this machine with an ε-transition is non-deterministic > 1 2 3 ε {1,3} {2} {3} Note: this machine is deterministic > a b [Powerpoint animation]

Ungraded Homework 6 Review Converting a NDFSA into a DFSA a b Note: this machine with an ε-transition is non-deterministic > 1 2 3 ε {1,2} {2} {3} Note: this machine is deterministic > a b b [Powerpoint animation]

Regular Languages and FSA Formal (constructive) set-theoretic definition of a regular language Correspondence between REs and Regular Languages concatenation (juxtaposition) union (| also [ ]) Kleene closure (*) Note: x+ = xx*) Note: backreferences are memory devices and thus are too powerful e.g. L = {ww} and prime number testing (see earlier lectures)

Regular Languages and FSA Closure properties: i.e. do we still have a regular language afterward applying the operation? Properties not necessarily preserved higher up: e.g. context-free grammars as we’ll see later

Regular Languages and FSA Textbook gives one direction only case by case: Empty string Empty set Any character from the alphabet

Regular Languages and FSA Concatenation: Link final state of FSA1 to initial state of FSA2 using an empty transition Note: empty transition ε can be deleted using the set of states construction

Regular Languages and FSA Kleene closure: repetition operator: zero or more times use empty transitions for loopback and bypass

Regular Languages and FSA Union: aka disjunction Non-deterministically run both FSAs at the same time, accept if either one accepts

Regular Languages and FSA Other closure properties: Let’s consider building the FSA machinery for each of these guys in turn…

Regular Languages and FSA Other closure properties: Final state?

Regular Languages and FSA Other closure properties: Final state?

Regular Languages and FSA Other closure properties: Example: Σ* = {a,b} need arcs for each character in Σ

Regular Languages and FSA Other closure properties: reverse arrows and swap initial/final

Regular Expressions from FSA Recall textbook Exercise: find a RE for Examples (* denotes string not in the language): *ab *ba bab λ (empty string) bb *baba babab

Regular Expressions from FSA Draw a FSA and convert it to a RE: b b [Powerpoint Animation] > 1 2 3 4 b a b ε b* b ( )+ ab+ = b+(ab+)* | ε

Regular Expressions from FSA Example Perl implementation: $s = "ab ba bab bb baba babab"; while ($s =~ /\b(b+(ab+)*)\b/g) { print "<$1> match!\n"; } Output: perl test.perl <bab> match! <bb> match! <babab> match! Note: this doesn’t include the empty string case Note: recall /../g global flag for multiple matches

Converting FSA to REs Example: State by-pass method: Give a RE for the FSA: State by-pass method: Delete one state at a time Calculate the possible paths passing through the deleted state Add the regex calculated at each stage as an arc e.g. eliminate state 3 then 2… 1 2 3 >

Converting FSA to REs Answer: (0(1+0|1)*1+1 | 1)* eliminate state 3 2 3 > eliminate state 3 eliminate state 2 1 1 > 1 > 1 0(1+0|1)*1+1 2 1+1 1+0 1 > 0(1+0|1)*1+1 | 1 Answer: (0(1+0|1)*1+1 | 1)* [Powerpoint animation]