LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.

Slides:



Advertisements
Similar presentations
Finite-State Machines with No Output Ying Lu
Advertisements

Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
Regular Expressions and DFAs COP 3402 (Summer 2014)
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.
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/27.
LING 388: Language and Computers Sandiway Fong 9/29 Lecture 11.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/29.
1 Regular Expressions and Automata September Lecture #2-2.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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 6: 9/13.
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)
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.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
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.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
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.
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 …
LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong. Administrivia Homework 6 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.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
BİL711 Natural Language Processing1 Regular Expressions & FSAs Any regular expression can be realized as a finite state automaton (FSA) There are two kinds.
COMP3190: Principle of Programming Languages DFA and its equivalent, scanner.
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
Lecture 15: Theory of Automata:2014 Finite Automata with Output.
1 Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Formal Language & Automata Theory
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
PDAs Accept Context-Free Languages
Lecture 9 Theory of AUTOMATA
CSE 105 theory of computation
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
Some slides by Elsa L Gunter, NJIT, and by Costas Busch
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
Kleene’s Theorem Muhammad Arif 12/6/2018.
Deterministic PDAs - DPDAs
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 17 Sandiway Fong.
Regular grammars Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Chapter 1 Regular Language
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.
Presentation transcript:

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

Administrivia Homework 3 graded

Last Time 1.Introduced Regular Languages – can be generated by regular expressions – or Finite State Automata (FSA) – or regular grammars --- not yet introduced 2.Deterministic and non-deterministic FSA 3.DFSA can be easily encoded in Perl: – hash table for the transition function – foreach loop over a string (character by character) – conditional to check for end state 4.NDFSA can be converted into DFSA – example of the set of states construction – Practice: ungraded homework exercise

Ungraded Homework Exercise do not submit, do the following exercise to check your understanding – 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 a ε b > a ε b >

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

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

Last Time Regular Languages Three formalisms – All formally equivalent (no difference in expressive power) – i.e. if you can encode it using a RE, you can do it using a FSA or regular grammar, and so on … Regular Grammars FSA Regular Expressions Regular Languages talk more about formal equivalence later today… Perl regular expressions stuff out here

Perl Regular Expressions Perl regex can include backreferences to groupings (i.e. \1, etc.) – backreferences give Perl regexs expressive power beyond regular languages: the set of prime numbers is not a regular language L prime = {2, 3, 5, 7, 11, 13, 17, 19, 23,.. } can be proved using the Pumping Lemma for regular languages (later) can have regular Perl code inside a regex

Backreferences and FSA Deep question: – why are backreferences impossible in FSA? sx y a a b b > Example: Suppose you wanted a machine that accepted /(a+b+)\1/ One idea: link two copies of the machine together x2 y2 a a b b y Doesn’t work! Why? Perl implementation: – how to modify it get the backreference effect?

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( * )= (x + = xx*) Note: backreferences are memory devices and thus are too powerful e.g. L = {ww} and prime number testing (earlier slides)

Regular Languages and FSA Other closure properties: Not true higher up: e.g. context-free grammars as we’ll see later

Equivalence: FSA and Regexs Textbook gives one direction only Case by case: a)Empty string b)Empty set c)Any character from the alphabet

Equivalence: FSA and Regexs Concatenation: – Link final state of FSA 1 to initial state of FSA 2 using an empty transition Note: empty transition can be eliminated using the set of states construction (see earlier slides in this lecture)

Equivalence: FSA and Regexs Kleene closure: – repetition operator: zero or more times – use empty transitions for loopback and bypass

Equivalence: FSA and Regexs 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:

Regular Languages and FSA Other closure properties:

Regular Languages and FSA Other closure properties:

Regular Languages and FSA Other closure properties:

Regular Expressions from FSA Textbook Exercise: find a RE for Examples (* denotes string not in the language): *ab *ba babbab λ (empty string) bb *baba*baba bababbabab

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

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