LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5.

Slides:



Advertisements
Similar presentations
4b Lexical analysis Finite Automata
Advertisements

CMPS 3223 Theory of Computation
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/5.
Theory Of Automata By Dr. MM Alam
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/8.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 13: 10/9.
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/27.
LING 388: Language and Computers Sandiway Fong 9/29 Lecture 11.
1 Module 20 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA (extra credit) and therefore.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 16: 10/19.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/29.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
CS5371 Theory of Computation
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/27.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/4.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/21.
LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7.
LING 388 Language and Computers Lecture 8 9/25/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/6.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/26.
LING 388 Language and Computers Lecture 4 9/11/03 Sandiway FONG.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 11: 10/3.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/13.
Lecture 18 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA and therefore a subset.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/3.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/7.
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 Module 25 Decision problems about regular languages –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems.
LING 388: Language and Computers Sandiway Fong Lecture 10: 9/26.
LING 388 Language and Computers Lecture 7 9/23/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 11: 10/2.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
Finite State Machines Data Structures and Algorithms for Information Processing 1.
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
Regular Expressions (RE) Empty set Φ A RE denotes the empty set Empty string λ A RE denotes the set {λ} Symbol a A RE denotes the set {a} Alternation M.
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
LING/C SC/PSYC 438/538 Lecture 7 9/15 Sandiway Fong.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/15.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture of a compiler PART II:
LING/C SC/PSYC 438/538 Lecture 12 10/4 Sandiway Fong.
Computability Construct TMs. Decidability. Preview: next class: diagonalization and Halting theorem.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
LING 388: Language and Computers Sandiway Fong 9/27 Lecture 10.
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong. Administrivia Reading Homework – Chapter 3 of JM: Words and Transducers.
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
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.
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
Theory of Computation Automata Theory Dr. Ayman Srour.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Non Deterministic Automata
Non-Deterministic Finite Automata
Intro to Data Structures
Non Deterministic Automata
4b Lexical analysis Finite Automata
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
Presentation transcript:

LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5

Today’s Topics Tasks –Practice how to write a FSA in Prolog –Dealing with string transitions Homework #4 –Due next Thursday –Only two questions Derivational morphology and FSA Converting NDFSA to (deterministic) FSA

Prolog FSA: One predicate per state from previous lectures Prolog FSA implementation –regular expression: ba + ! –query ?- s([b,a,a,’!’]). –code –s([b|L]) :- x(L). sx z b ! y a a > –y([a|L]) :- y(L). –y([‘!’|L]) :- z(L). –z([]). –x([a|L]) :- y(L).

Exercise 1 Derivational Morphology Write a Prolog FSA that accepts all words ending in the verbal suffix -ize use: –atom_chars(Word,List) –from the previous homework examples: –formalize –summarize –*formalizes

Exercise 1 Given code: ends_ize(Word) :- atom_chars(Word,List), s(List). s = start state Write s/1 such that ?- ends_ize(formalize). Yes ?- ends_ize(summarize). Yes ?- ends_ize(formalizes). No

Exercise 1 Step 1: Draw the FSA:Notes: –machine is non- deterministic see an i we don’t know if it’s the “i” in rise or formalize –we can name the states anything we want here: states are named after the portion of the suffix recognized so far s i iz ize z i e a-z

Exercise 1 Step 1: Draw the FSA:Step 2: Write the Prolog Hint: use the underscore variable to simulate the range a-z s i iz ize z i e a-z

Exercise 1 Step 1: Draw the FSA:Step 2: Write the Prolog s([_|L]) :- s(L). s([i|L]) :- i(L). i([z|L]) :- iz(L). i([e|L]) :- ize(L). ize([]). s i iz ize z i e a-z

String Transitions [last lecture] all machines have had just a single character label on the arc so if we allow strings to label arcs –do they endow the FSA with any more power? b Answer: No –because we can always convert a machine with string-transitions into one without abb abb

Exercise 2 Let’s simplify the FSA for Exercise 1 using string transitions Give the modified Prolog form s i iz ize z i e a-z s ize a-z

Exercise 2 Give the modified Prolog form s([_|L]) :- s(L). s([i,z,e|L]) :- ize(L). ize([]). s([_|L]) :- s(L). s([i,z,e]). s i iz ize z i e a-z s ize a-z

Homework Question 1 Part 1: (8pts) Modify your machine so that it accepts –formalize –modernize –summarize –concretize –sterilize but rejects –*summaryize –*concreteize –*sterileize Part 2: (2pts) –explain what rule of English are we trying to encode here?

Empty Transitions [last lecture] how about allowing the empty character? –i.e. go from x to y without seeing a input character –does this endow the FSA with any more power? Answer: No –because we can always convert a machine with empty transitions into one without xy a b a b b a b > ab

NDFSA Deterministic FSA –deterministic it’s clear which state we’re always in deterministic = no choice NDFSA –ND = non-deterministic i.e. we could be in more than one state non-deterministic  choice point –example: see an “a”, either in state 2 or 3 next sx y a a b b > > 12 a a 3 b >

NDFSA NDFSA are generally not more powerful than regular (deterministic) FSA because we can transform any NDFSA into an equivalent FSA trick: –(set of states construction) –construct new machine with states = set of possible states of the old machine 12 a a 3 b > {1} > a > {2,3} {3}{3} ba {1} > {2,3} {3} ba {1} > {2,3} 1 2,3 a 3 b 2 >

Homework Question 2 (10pts) Part 1: (8pts) Transform the NDFSA shown on the right into a deterministic FSA Give the Prolog implementation of the machine Part 2: (2pts) –what does this machine do? –i.e. what is the language it accepts? q4q4 >

Summary Total: 20 pts Question 1: 10pts Question 2: 10pts