Week 2 Tutorial Non-Deterministic Finite State Automata and Grammars

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

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

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

Grammars & Parsing, Part 1:

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

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

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

CS 598 Natural Language Processing

A Version Space Approach to Learning Context-free Grammars

A General Class of Noncontext Free Grammars Generating Context Free Languages

Basic Parsing with Context-Free Grammars. Some slides adapted from Julia Hirschberg and Dan Jurafsky 1

Enumeration of Context-Free Languages and Related Structures

COMPUTATIONAL COMPLEXITY OF LEFT-ASSOCIATIVE GRAMMAR

Proof Theory for Syntacticians

CS Machine Learning

Context Free Grammars. Many slides from Michael Collins

Detecting English-French Cognates Using Orthographic Edit Distance

11/29/2010. Statistical Parsing. Statistical Parsing. Simple PCFG for ATIS English. Syntactic Disambiguation

Refining the Design of a Contracting Finite-State Dependency Parser

BANGLA TO ENGLISH TEXT CONVERSION USING OPENNLP TOOLS

"f TOPIC =T COMP COMP... OBJ

Getting Started with Deliberate Practice

GACE Computer Science Assessment Test at a Glance

Pre-Processing MRSes

Chinese Language Parsing with Maximum-Entropy-Inspired Parser

Lecture 1: Machine Learning Basics

On the Polynomial Degree of Minterm-Cyclic Functions

An Introduction to the Minimalist Program

Quantitative analysis with statistics (and ponies) (Some slides, pony-based examples from Blase Ur)

Natural Language Processing. George Konidaris

BMBF Project ROBUKOM: Robust Communication Networks

Pretest Integers and Expressions

HISTORY COURSE WORK GUIDE 1. LECTURES, TUTORIALS AND ASSESSMENT 2. GRADES/MARKS SCHEDULE

GRAMMAR IN CONTEXT 2 PDF

AGS THE GREAT REVIEW GAME FOR PRE-ALGEBRA (CD) CORRELATED TO CALIFORNIA CONTENT STANDARDS

Version Space. Term 2012/2013 LSI - FIB. Javier Béjar cbea (LSI - FIB) Version Space Term 2012/ / 18

Towards a MWE-driven A* parsing with LTAGs [WG2,WG3]

The New York City Department of Education. Grade 5 Mathematics Benchmark Assessment. Teacher Guide Spring 2013

ABSTRACT. A major goal of human genetics is the discovery and validation of genetic polymorphisms

Designing a Computer to Play Nim: A Mini-Capstone Project in Digital Design I

Grade 6: Correlated to AGS Basic Math Skills

Cognitive Modeling. Tower of Hanoi: Description. Tower of Hanoi: The Task. Lecture 5: Models of Problem Solving. Frank Keller.

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

have to be modeled) or isolated words. Output of the system is a grapheme-tophoneme conversion system which takes as its input the spelling of words,

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

Parsing of part-of-speech tagged Assamese Texts

Assignment 1: Predicting Amazon Review Ratings

Preferences...3 Basic Calculator...5 Math/Graphing Tools...5 Help...6 Run System Check...6 Sign Out...8

ARNE - A tool for Namend Entity Recognition from Arabic Text

Learning Optimal Dialogue Strategies: A Case Study of a Spoken Dialogue Agent for

B.S/M.A in Mathematics

Inleiding Taalkunde. Docent: Paola Monachesi. Blok 4, 2001/ Syntax 2. 2 Phrases and constituent structure 2. 3 A minigrammar of Italian 3

CHANCERY SMS 5.0 STUDENT SCHEDULING

PowerTeacher Gradebook User Guide PowerSchool Student Information System

Action Models and their Induction

CS 446: Machine Learning

Diagnostic Test. Middle School Mathematics

Parsing with Treebank Grammars: Empirical Bounds, Theoretical Models, and the Structure of the Penn Treebank

Emergency Management Games and Test Case Utility:

Grade 5 + DIGITAL. EL Strategies. DOK 1-4 RTI Tiers 1-3. Flexible Supplemental K-8 ELA & Math Online & Print

WSU Five-Year Program Review Self-Study Cover Page

The Strong Minimalist Thesis and Bounded Optimality

Math 96: Intermediate Algebra in Context

Machine Learning from Garden Path Sentences: The Application of Computational Linguistics

Extending Place Value with Whole Numbers to 1,000,000

Transfer Learning Action Models by Measuring the Similarity of Different Domains

Planning with External Events

TOPICS LEARNING OUTCOMES ACTIVITES ASSESSMENT Numbers and the number system

PeopleSoft Class Scheduling. The Mechanics of Schedule Build

Take a Loupe at That! : The Private Eye Jeweler s Loupes in Afterschool Programming

BENCHMARK MA.8.A.6.1. Reporting Category

10 Tips For Using Your Ipad as An AAC Device. A practical guide for parents and professionals

Ensemble Technique Utilization for Indonesian Dependency Parser

CS 101 Computer Science I Fall Instructor Muller. Syllabus

Signs, Signals, and Codes Merit Badge Workbook

Introduction to Simulation

ONLINE COURSES. Flexibility to Meet Middle and High School Students at Their Point of Need

IMGD Technical Game Development I: Iterative Development Techniques. by Robert W. Lindeman

Adjectives tell you more about a noun (for example: the red dress ).

How to analyze visual narratives: A tutorial in Visual Narrative Grammar

COVER SHEET. This is the author version of article published as:

2/15/13. POS Tagging Problem. Part-of-Speech Tagging. Example English Part-of-Speech Tagsets. More Details of the Problem. Typical Problem Cases

AN EXAMPLE OF THE GOMORY CUTTING PLANE ALGORITHM. max z = 3x 1 + 4x 2. 3x 1 x x x x N 2

Unit 14 Dangerous animals

systems have been developed that are well-suited to phenomena in but is properly contained in the indexed languages. We give a

Spring 2014 SYLLABUS Michigan State University STT 430: Probability and Statistics for Engineering

Abstractions and the Brain

Houghton Mifflin Online Assessment System Walkthrough Guide

Compositional Semantics

School of Innovative Technologies and Engineering

Parallel Evaluation in Stratal OT * Adam Baker University of Arizona

Chapter 4 - Fractions

Machine Learning and Data Mining. Ensembles of Learners. Prof. Alexander Ihler

Piaget s Cognitive Development

AQUA: An Ontology-Driven Question Answering System

Language Acquisition Fall 2010/Winter Lexical Categories. Afra Alishahi, Heiner Drenhaus

CAAP. Content Analysis Report. Sample College. Institution Code: 9011 Institution Type: 4-Year Subgroup: none Test Date: Spring 2011

Grades. From Your Friends at The MAILBOX

ME 4495 Computational Heat Transfer and Fluid Flow M,W 4:00 5:15 (Eng 177)

(Sub)Gradient Descent

Transcription:

Department of Computer cience, Australian National University COMP2600 Formal Methods in oftware Engineering emester 2, 206 Week 2 utorial Non-Deterministic Finite tate Automata and Grammars You should hand in attempts to the questions indicated by *) to your tutor at the start of each tutorial. howing effort at answering the indicated questions will contribute to the 4% utorial Preparation component of the course; your attempts will not be marked for correctness. You may collaborate with your fellow students or others, so long as you hand in your work individually and indicate who you have worked with. Objectives: convert a NFA to a DFA Q.2); convert a NFA to a right linear grammar Q 2.2); convert a right linear grammar to a NFA Q.); draw parse trees Q 3.). Question. he following right linear grammar describes a language of binary strings that begin and end with the same bit: 0 0 2 0 3 3 0 0 3 2 0 2 2 3 3 ɛ where 0 is the start symbol. Use the algorithm presented in lectures, convert this right linear grammar to a NFA. Note that the final state f in the algorithm does not play any role in this case, so you can safely delete it. Non-Deterministic Finite Automata and Grammars

0, 0 0 0, 0 3 2 0, 2. Use the subset construction algorithm to construct an equivalent deterministic FA from your previous answer. 0 3 0 0 0 0 23 2 0 Non-Deterministic Finite Automata and Grammars 2

Question 2 Consider the non-deterministic finite automaton A: 0 0 U 0,. Describe the language that this automaton accepts. he language LA) is the set of all binary integers that are even or, equivalently, end in 0). Words that start with leading 0s are not in LA), except the word 0. 2. Following the algorithm presented in lectures, give a right-linear grammar accepting the same language. 0 U ɛ U 0 0U U 3. Can you see a simpler right-linear grammar that would accept the same language? here are no transitions out of the final state, so we could eliminate it and use the smaller grammar: 0 U U 0 0U U Question 3 Consider the context-free grammar G: a b ; generating non-empty lists of a s and b s separated by semicolons. Non-Deterministic Finite Automata and Grammars 3

. Give two different parse trees generating the string a; b; b with this grammar. Note that the semi-colon ;, like a and b, is a terminal symbol but isn t!). ; ; ; b a ; a b b b 2. Give a right-linear grammar that generates the same language. a b ɛ ; 3. Convert that grammar into a non-deterministic finite automaton using the algorithm given in lectures. a, b ; Note: we did not need to introduce a new final state f here, as was done in lectures, because our right-linear grammar contains no productions of the form U a that would bring f into play. Question 4 Given any word w over the alphabet {a, b}, let n b w) be the number of b s appearing in w. Consider the language L = {a i w w {a, b} i = n b w)}. Give a context-free grammar that generates L. here may be several correct CFGs that generate L, but here s my answer: ab a a ɛ Non-Deterministic Finite Automata and Grammars 4

Here expands by either i) adding b to the end and incrementing the counter a at the start, ii) adding a string of a s to the end, via the non-terminal, or iii) transitioning to the empty string ɛ to end the expansion. 2. Give a parse tree that shows that this grammar generates the string aabaa. a b a ɛ a a Question 5 he epic Pac-Man game basically runs as follows: the player i.e., Pac-Man) navigates through a maze, eating pellets and avoiding the ghosts who chase the player in the maze. After eating a power pellet, the player is granted a temporary super power to eat the ghosts, during this period, the ghosts do not chase the player, but avoid him. he behaviours states) of ghosts in Pac-Mac can be simplified as below: randomly wander the maze; chase Pac-Man the player) when within line of sight; flee Pac-Man after he has consumed a power pellet; return to the central base to regenerate after eaten by Pac-Man; game over after eats Pac-Man. Design a NFA to model the above game AI for the ghosts. Non-Deterministic Finite Automata and Grammars 5

l W C s p p r n B d F e O tates: W for wander the maze ; C for chase Pac-Man ; F for Flee Pac-Man ; B for return to base ; O for game over. ransitions: s for spots Pac-Man ; p for Pam-Man eats power pellet; l for loses Pac- Man ; e for eats Pac-Man ; n for power pellet expires, Pac-Man returns to normal ; d for eaten by Pac-Man and dies ; r for regenerate from the central base. Non-Deterministic Finite Automata and Grammars 6