Inf2A: Review of FSMs and Regular Languages

Similar documents
Language properties and Grammar of Parallel and Series Parallel Languages

Informatics 2A: Language Complexity and the. Inf2A: Chomsky Hierarchy

Erkki Mäkinen State change languages as homomorphic images of Szilard languages

A General Class of Noncontext Free Grammars Generating Context Free Languages

A R "! I,,, !~ii ii! A ow ' r.-ii ' i ' JA' V5, 9. MiN, ;

CS 598 Natural Language Processing

On the Polynomial Degree of Minterm-Cyclic Functions

Classify: by elimination Road signs

Refining the Design of a Contracting Finite-State Dependency Parser

Proof Theory for Syntacticians

Lecture 10: Reinforcement Learning

IT Students Workshop within Strategic Partnership of Leibniz University and Peter the Great St. Petersburg Polytechnic University

RANKING AND UNRANKING LEFT SZILARD LANGUAGES. Erkki Mäkinen DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF TAMPERE REPORT A ER E P S I M S

Objectives. Chapter 2: The Representation of Knowledge. Expert Systems: Principles and Programming, Fourth Edition

Grammars & Parsing, Part 1:

School Competition and Efficiency with Publicly Funded Catholic Schools David Card, Martin D. Dooley, and A. Abigail Payne

A Version Space Approach to Learning Context-free Grammars

Syntax Parsing 1. Grammars and parsing 2. Top-down and bottom-up parsing 3. Chart parsers 4. Bottom-up chart parsing 5. The Earley Algorithm

COMPUTATIONAL COMPLEXITY OF LEFT-ASSOCIATIVE GRAMMAR

Cal s Dinner Card Deals

Discriminative Learning of Beam-Search Heuristics for Planning

Backwards Numbers: A Study of Place Value. Catherine Perez

CS Machine Learning

CS 101 Computer Science I Fall Instructor Muller. Syllabus

Lecture 1: Machine Learning Basics

University of Groningen. Systemen, planning, netwerken Bosman, Aart

Self Study Report Computer Science

Statewide Framework Document for:

CS 1103 Computer Science I Honors. Fall Instructor Muller. Syllabus

LING 329 : MORPHOLOGY

Grade 6: Correlated to AGS Basic Math Skills

Detecting English-French Cognates Using Orthographic Edit Distance

Rule Learning With Negation: Issues Regarding Effectiveness

ARNE - A tool for Namend Entity Recognition from Arabic Text

AP Calculus AB. Nevada Academic Standards that are assessable at the local level only.

Morphotactics as Tier-Based Strictly Local Dependencies

Natural Language Processing. George Konidaris

Context Free Grammars. Many slides from Michael Collins

Enumeration of Context-Free Languages and Related Structures

B.S/M.A in Mathematics

OCR for Arabic using SIFT Descriptors With Online Failure Prediction

PRODUCT PLATFORM DESIGN: A GRAPH GRAMMAR APPROACH

Edexcel GCSE. Statistics 1389 Paper 1H. June Mark Scheme. Statistics Edexcel GCSE

Bluetooth mlearning Applications for the Classroom of the Future

Page 1 of 11. Curriculum Map: Grade 4 Math Course: Math 4 Sub-topic: General. Grade(s): None specified

"f TOPIC =T COMP COMP... OBJ

The Strong Minimalist Thesis and Bounded Optimality

AQUA: An Ontology-Driven Question Answering System

Bluetooth mlearning Applications for the Classroom of the Future

(Sub)Gradient Descent

Learning to Think Mathematically With the Rekenrek

A Neural Network GUI Tested on Text-To-Phoneme Mapping

OFFICE SUPPORT SPECIALIST Technical Diploma

Remainder Rules. 3. Ask students: How many carnations can you order and what size bunches do you make to take five carnations home?

Physics 270: Experimental Physics

Rule Learning with Negation: Issues Regarding Effectiveness

Evolutive Neural Net Fuzzy Filtering: Basic Description

Developing Grammar in Context

arxiv: v1 [math.at] 10 Jan 2016

A Grammar for Battle Management Language

Math-U-See Correlation with the Common Core State Standards for Mathematical Content for Third Grade

DMA CLUSTER CALCULATIONS POLICY

Dublin City Schools Mathematics Graded Course of Study GRADE 4

Computer Science 141: Computing Hardware Course Information Fall 2012

Evolution of Collective Commitment during Teamwork

Speech Segmentation Using Probabilistic Phonetic Feature Hierarchy and Support Vector Machines

MTH 141 Calculus 1 Syllabus Spring 2017

B. How to write a research paper

CS 446: Machine Learning

Probability and Game Theory Course Syllabus

Abstractions and the Brain

This scope and sequence assumes 160 days for instruction, divided among 15 units.

Using dialogue context to improve parsing performance in dialogue systems

Improving Fairness in Memory Scheduling

Introduction to HPSG. Introduction. Historical Overview. The HPSG architecture. Signature. Linguistic Objects. Descriptions.

Liquid Narrative Group Technical Report Number

Lecture 1: Basic Concepts of Machine Learning

Language Evolution, Metasyntactically. First International Workshop on Bidirectional Transformations (BX 2012)

Learning goal-oriented strategies in problem solving

Probability and Statistics Curriculum Pacing Guide

GACE Computer Science Assessment Test at a Glance

Listening and Speaking Skills of English Language of Adolescents of Government and Private Schools

Anglia Ruskin University Assessment Offences

Primary National Curriculum Alignment for Wales

School of Innovative Technologies and Engineering

Unit 3: Lesson 1 Decimals as Equal Divisions

The Odd-Parity Parsing Problem 1 Brett Hyde Washington University May 2008

South Carolina English Language Arts

Field Experience Management 2011 Training Guides

Software Maintenance

Math 098 Intermediate Algebra Spring 2018

Developing a TT-MCTAG for German with an RCG-based Parser

WSU Five-Year Program Review Self-Study Cover Page

Introducing the New Iowa Assessments Mathematics Levels 12 14

Parallel Evaluation in Stratal OT * Adam Baker University of Arizona

Mining Student Evolution Using Associative Classification and Clustering

arxiv: v1 [cs.se] 20 Mar 2014

Module 12. Machine Learning. Version 2 CSE IIT, Kharagpur

Montana Content Standards for Mathematics Grade 3. Montana Content Standards for Mathematical Practices and Mathematics Content Adopted November 2011

Diagnostic Test. Middle School Mathematics

Transcription:

Review of Inf2A: Review of FSMs and Regular Languages Stuart Anderson School of Informatics University of Edinburgh October 6, 2009

Outline Review of Review of and Regular Grammars 2 Looping Behaviour

Review of Road map for the Formal Aspects of the Course The four classes of language and their corresponding grammars and machines: Type 3 languages: Finite Automata, Regular Grammars, Regular Expressions Type 2 languages: Pushdown automata, Context-Free Grammars Type languages: Linear-bounded automata, Context Sensitive Grammars Type 0 languages: Turing machines, Unrestricted Grammars

Review of Questions about languages For each of these four classes we study: Methods for deciding if a string is a member of a language. Designing particular grammars or machines to describe a particular language. Exploring the difference between deterministic and non-deterministic machines for each class. Seeing if we can decide if two machines or grammar recognize/describe the same language. Seeing if we can calculate the effects of operations on languages e.g. intersection, complement,... Looking at how to characterize the power of language defining mechanisms. Looking at probabilistic versions of languages.

Review of Acceptors and Transducers and Regular Grammars In Inf we saw FSMs as descriptions of reactive systems. We describe them as a set of states together with transitions between states on receipt of an input. Can be either transducers providing output for each input, or acceptors accepting some sequences, rejecting others.

Review of Examples of Transducers and Regular Grammars A parking ticket machine: insert money request ticket/print request refund/deliver 2 insert money request ticket request refund fast/dec slow/inc correct ready set/store set brake resume wait on on on on A cruise control system: off

Review of Example of an Acceptor and Regular Grammars A combination lock: 0,2 9 none 0 2 0 open 0,2 9 2 9 0,3 9 0,2 9 In Inf2 we mostly focus on the role of FSMs as acceptors. You can look on the language accepted as the collection of all possible behaviours. Is the sentence 002 accepted by the lock?

Review of Formal Languages and Regular Grammars Finite alphabet Σ. Σ is the set of all strings with symbols drawn from Σ. Σ contains empty string ε. ε is the identity for concatenation of strings, i.e. εs = sε = s for all s Σ A language over Σ is a subset of Σ.

Review of Example: Binary Strings and Regular Grammars Alphabet: Σ = {0, } Strings: Σ = {ε, 0,, 00, 0, 0,, 000, 00, 00,...} Languages: L = { ε, 00, 0, 0 } L 2 = { 0x x Σ } (strings starting with 0) L 3 = (the empty language) L 4 = {ε}

Review of Example: ASCII Strings and Regular Grammars Alphabet: Σ = set of all ASCII symbols Strings: all ASCII strings, for example, x = ε x 2 = soa@inf.ed.ac.uk x 3 = fac = foldr (*). enumfromto Languages: L = {x, x 2, x 3 } L 2 = all syntactically correct JAVA programs L 3 = all correct English sentences L 4 =

Review of and Regular Grammars Finite Automata as Language Acceptors Σ alphabet M finite automaton (acceptor) whose inputs are symbols from the alphabet Σ M accepts a string a a 2... a n Σ if after reading inputs a, a 2,..., a n it is in an accepting state. M recognises (or accepts) a language L Σ if for all strings x Σ : x L M accepts x.

Review of and Regular Grammars Example: Binary Strings with an Even Number of Zeroes The following automaton recognises the language { x {0, } x contains an even number of 0s } over the alphabet {0, }. 0 even odd 0

Review of and Regular Grammars Example: The Combination Lock Revisited 0,2 9 none 0 2 0 open 0,2 9 2 9 0,3 9 0,2 9 This automaton accepts the language { x02 x {0,,..., 9} } over the alphabet {0,,..., 9}.

Review of Deterministic finite automata and Regular Grammars A finite automaton is deterministic if: it has a unique start state, and from every state there is exactly one transition for each possible input symbol. Example 0, 0 2 0 2 0 deterministic non deterministic Can you draw a DFA that recognises the same language as the NDFA?

Review of and Regular Grammars Deterministic finite automata (formally) Definition: A deterministic finite automaton (or DFA) is a tuple consisting of: a finite set Q of states, 2 a finite alphabet, Σ, M = (Q, Σ, q 0, F, δ) 3 a distinguished starting state q 0 Q, 4 a set F Q of final states (the ones that indicate acceptance), 5 a description δ of all the possible transitions, given by a table that answers the question: Given a state q and an input symbol a, what is the next state? There must be an answer to this no matter what q and a are. δ is called the transition function of M.

Review of and Regular Grammars Example: Binary strings with an even number of zeros, revisited 0 even odd This is a DFA formally specified by: ( ) {even, odd}, {0, }, even, {even}, δ, 0 where the transition function δ is given by the following table: δ 0 even odd even odd even odd

Review of and Regular Grammars Example: Combination lock, re-revisited 0,2 9 none 0 2 0 open 0,2 9 2 9 0,3 9 0,2 9 This is a DFA formally specified by: ( ) {none,,, 0, open}, {0,..., 9}, none, {open}, δ where the transition function δ is given by the following table: δ 0 2 3 4 5 6 7 8 9 none none none none... none none none... 0 none none... 0 none open none... open none none none...

Review of Regular Expressions and Regular Grammars Recall from Inf that we developed a notation for regular languages, we called these regular expressions. If our alphabet is Σ, then the following are the basic expressions we build into more complex expressions: ϕ stands for the empty language {} ε stands for the language just consisting of the empty string {ε} a where a Σ stands for the language consisting of just one string {a} If r and r 2, are regular expressions standing for the languages L r and L r2, then: union: r + r 2 is a regular expression standing for the language L r L r2 concatenation: r r 2 is a regular expression standing for the language {s s 2 s L r, s 2 L r2 } asterate: r is a regular expression standing for {ε} {s... s n s L r,... s n L r, for all n }

Other Operations Review of and Regular Grammars Recall we were also able to define machines that recognised some more complex operations on regular sets. In particular, recall the construction of FSAs that found the intersection and interleaving of two regular sets. Recall also that these constructions resulted in significant increases in the size of the statespace because they form the product of the statespaces of two FSMs. Our constructions show that we can extend regular expression with the and operations and hence have the means to give concise descriptions of regular sets. Recall also the system of equations of regular algebra that allowed us to reason about equality of regular sets.

Review of and Regular Grammars FSMs to Regular Grammars and Back Again Recall that in regular grammars, all productions are of the form A ab, A ε or A Ba, A ε (note that if you mix productions of the form A ab and A Ba then the grammar is no longer regular (why?). Given a FSM M = (Q, Σ, δ, s, F) we can construct a corresponding regular grammar G = ( {S q q Q}, Σ, {S f ε f F} {S q as q q δ(q, a)}, S s )

Example Review of and Regular Grammars Consider the parking machine: insert money request ticket/print request refund/deliver 2 insert money request ticket request refund Assuming state is final and abbreviating the inputs as i m, r t, r r, the corresponding regular grammar is: ( {S, S 2 }, {i m, r t, r r }, {S ε, S r t S, S r r S, S i m S 2, S 2 i m S 2, S 2 r t S, S 2 r r S }, S )

Pigeon Holes Review of Looping Behaviour In the next lecture we will consider the result that characterises the looping character of any regular language. Here we consider a preparatory result. The pigeon hole principle is a simple result on classification of data. It says that if we classify n things into m categories where n > m then at least two things have the same classification. For example, if everyone in the UK only bought Ford, Nissan or Rolls Royce cars then as soon as we have seen 4 or more cars we know at least two have the same maker. We use this simple observation to demonstrate a useful fact about regular languages

Review of Looping Behaviour Regular Languages that include long sentences are infinite: We ll show: for any regular language L there is a constant n L such that if s L and s n L then the language L is infinite. If L is regular then there is a DFSM M L (having no ε-transitions) that recognises L, let n L be the number of states in M L. If s L and s = a... a m and m n L and q 0 is the initial state of M L and the machine is in state q j after having read a... a j, then we can see...

Review of Looping Behaviour Regular Languages that include long sentences are infinite: 2 We have a sequence of at least n L + states: q 0,..., q m so we classify the m + indices by the states, i.e. j belongs to classification q j Since there are only n L states and the list of states is longer than n L, at least two are classified by the same state (pigeon hole principle). If those indices are k < l then a... a k a l+... a m L and a... a l a k+... a l a l+... a m L and a... a l a k+... a l a k+... a l+... a m L for as many repetitions as we like. As a consequence L is infinite.

Review of What help is the result? Looping Behaviour It helps us show that some languages are not regular. For example we know the language L par = {( n ) n n 0} is context-free, (the grammar ({S}, {(, )}, {S ε, S (S)}) does it) but it is not regular. We prove by contradiction so we assume L par is a regular language. If it is regular then there is some n Lpar that fits the conditions of our result, So if we consider the sentence ( m ) m where m > n Lpar then our result tells us there is some p > 0 such that ( m+ip ) m is in the language for every i 0.

Review of We have reviewed some of the material of Inf and considered the link between FSMs and regular grammars. We have begun to characterise what languages can and cannot be defined by FSMs. In the next few lectures, we will: Consider the relationship between FSAs and regular expressions. Sharpen the results on the power of FSAs