# Assignment No.4 solution. Pumping Lemma Version I and II. Where m = n! (n-factorial) and n = 1, 2, 3

Save this PDF as:

Size: px
Start display at page:

Download "Assignment No.4 solution. Pumping Lemma Version I and II. Where m = n! (n-factorial) and n = 1, 2, 3"

## Transcription

1 Assignment No.4 solution Question No.1 a. Suppose we have a language defined below, Pumping Lemma Version I and II a n b m Where m = n! (n-factorial) and n = 1, 2, 3 Some strings belonging to this language are, ab, aabb, aaabbbbbb, aaaabbbbbbbbbbbbbbbbbbbbbbbb, [a 1 b 1,a 2 b 2,a 3 b 6,a 4 b 24, ] Try to prove that this language is non-regular by Applying Pumping Lemma Version I and II on this language separately [by taking some example strings] Solution: Version I: For any Infinite Regular Language there exists three strings x, y and z ( y not null) such that all the strings of the form xy n z for n=1,2,3, are the words in L. So to prove a language as regular we need to take its one string and try to divide it in all possible ways to generate new words as shown below, Taking string, aabb x y z xy n z, n = 1,2,3 ^ aabb ^ aabb,aabbaabb, a abb ^ aabb,aabbabb, ^ aab b aabb,aabaabb, ^ aa bb aabb,aaaabb, aa bb ^ aabb,aabbbb, aab b ^ aabb,aabbb, ^ a abb aabb,aabbabb, You can see in all cases we are not able to prove that this language is regular Version II: Version II imposes one more restriction that for a language to be regular length of xy will be less than or equal to no. of states in FA recognizing that language. As our language is not able to generate words using Version I so no need to apply version II on it

2 b. Can we say using PUMPING LEMMA I AND II for sure that a given language is regular or NOT. In Pumping Lemma we are proving a language is non-regular by taking a single string from a language and applying pumping lemma both versions on it. [A single string is enough to prove that the language is non regular and hence can NOT be regular]. So we are proving language NON REGULAR instead of proving it regular. Question No.2 Defining Context Free Grammars a. Consider the languages EVEN and ODD defined as language having strings of even and odd lengths respectively, their RE s are Even Length Language: ((a+b)(a+b))* = (aa + ab + ba + bb)* Odd Length Language: ((a+b)(a+b))* (a+b) = (aa + ab + ba + bb)* (a+b) Give Context Free Grammars for these two languages separately. Solution: EVEN LANGUAGE CFG S ---- > aas bbs abs bas Є OR S ---- > aa ba Є A ---- > as bs ODD LANGUAGE CFG S ---- > aas bbs abs bas a b OR S ---- > aa ba a b A ---- > as bs b. Let us define a Language MULTIPLE OF THREE PALINDROME having all those strings of PALINDROME which have length multiple of three, some words belonging to this language are, ^, aaa, aba, bab, bbb, aaaaaa, aabbaa, abaaba, abbbba, baaaaab, babbab, bbaabb bbbbbb,. [Null string is included considering zero is also multiple of three as 0 x 3 = 0] i. Give CFG for this language. Solution: S ---- > aaasaaa abasaba babsbab bbbsbbb aaa aba bab bbb Є

3 ii. Modify your CFG for MULTIPLE OF THREE PALINDROME for two languages below, EVEN MULTIPLE OF THREE PALINDROME S ---- > aaasaaa abasaba babsbab bbbsbbb Є ODD MULTIPLE OF THREE PALINDROME S ---- > aaasaaa abasaba babsbab bbbsbbb aaa aba bab bbb Question No.3 Consider the two CFG s given below, Null and Nullable Transitions, Regular Context Free Grammars A --- > bb Є A --- > bb Z Z--- > Є [Here Є means null string, In CFG s we generally use Є for indicating null string instead of ^ sign] a. Find null and null-able transitions (if any) separately in these two CFG s Null Transitions: S ---- > Є A --- > Є B --- > Є S ---- > Є B --- > Є Z --- > Є Null-able Transitions: No one [all are already null] A --- > Z [as z--- > Є] b. Remove null transitions from these CFG s and give new CFG s for both cases without null transitions CFG1

4 A --- > bb Є Removing A ---- > Є, B ---- > Є S ---- > aaa aa a bbb bb b Є A --- > bb b [Due to B ---- > Є] B --- > aa a [Due to A ---- > Є] Removing S ---- > Є S ---- > aaa bbb aa bb a b Є [Null production in start state can not be removed as it is implying that our language contains null string] Complete CFG: S ---- > aaa bbb aa bb a b Є A --- > bb b [Due to B ---- > Є] B --- > aa a [Due to A ---- > Є] CFG2 A --- > bb Z Z--- > Є Removing Z ---- > Є, A ---- > Є, B ---- > Є Complete CFG: S ---- > aaa bbb aa a bb b Є [Due to A ---- > Є, B ---- > Є ] A --- > bb b [Due to B ---- > Є] B --- > aa a [Due to A ---- > Z ---- > Є ] [Null production in start state can not be removed as it is implying that our language contains null string]

5 Further Reading: Finite Languages and Infinite Languages: Finite languages Finite languages are those which contain finite (countable) strings Example: Languages of all strings having length less than 3 Languages of all odd length strings having length greater than 3 and less than 10 Infinite languages Infinite languages are those which contain infinite (uncountable) strings Example: Language of all strings having even length 0,2,4,6, [infinite] Language of all strings having length multiple of three 0,3,6,9,12 [infinite] Pumping Lemma I and II: Finite Languages: All Finite Languages are Regular Proof: Simple argument to prove it is that finite languages have finite strings according to definition and we can write their RE simply by adding + operator between all these strings. Infinite Languages: Infinite Languages CAN BE regular or not. Description: If there is some repeated pattern in infinite language that can be checked using finite state machine (FA) than that infinite language is regular but if that infinite language doesn t contain any such repeated pattern then we can NOT make finite state machine for it. Example: Consider language represented by RE (ab)*a This language has repeated pattern of ab (two states need to recognize it irrespective of how many times it appear) next is single a one state can be used to recognize it and one dumping state will be used for all incorrect paths. Now take any language in which there is NO SAME repeated pattern like language having a s count always ONE LESS than b s count We can built FA for a certain length strings of this language like FA for this language for strings of length less than or equal to 9 is shown below,

6 b a a a a - + a b b b b But we can not build general FA for this as we don t know what length string we are going to expect and our FA CAN NOT contain infinite states. Suppose we make FA to accommodate max no. of string length say But what will happen if our string is having length, Our FA will not be able to recognize it and will produce incorrect result. Note: There is no repeating loop in this FA that is the reason for it to have infinite states. These concepts have been used in Pumping Lemma to find out what kind of INFINITE LANGUAGES are regular. Pumping Lemma I and II: In both these versions we try to find if our language FA can have any loop if so then we can simply say that our language is regular otherwise we will be in doubt and can not say anything for sure. Since every FA has finite number of states then the language L (being infinite) accepted by F must have words of length more than the number of states, which shows that, F must contain a circuit.

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% 1. (2 pts) See text. You can t be sloppy defining terms like this. You must show a bijection between the natural numbers

### Glynda, the good witch of the North

Strings and Languages It is always best to start at the beginning -- Glynda, the good witch of the North What is a Language? A language is a set of strings made of of symbols from a given alphabet. An

### QUESTION BANK. Unit 1. Introduction to Finite Automata

QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )(Jun-Jul 10) 2. Obtain a DFA to accept strings of a s and b s having even

### JNTUWORLD. Code No: R

Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

### 1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string?

Multiple choice type questions. Which of the following regular expressions over {, } denotes the set of all strings not containing as a sub-string? 2. DFA has a) *(*)* b) ** c) ** d) *(+)* a) single final

### CS402 - Theory of Automata FAQs By

CS402 - Theory of Automata FAQs By Define the main formula of Regular expressions? Define the back ground of regular expression? Regular expressions are a notation that you can think of similar to a programming

### CHAPTER TWO LANGUAGES. Dr Zalmiyah Zakaria

CHAPTER TWO LANGUAGES By Dr Zalmiyah Zakaria Languages Contents: 1. Strings and Languages 2. Finite Specification of Languages 3. Regular Sets and Expressions Sept2011 Theory of Computer Science 2 Strings

### UNIT I PART A PART B

OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

### ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures Lecture 9b Grammars I Overview How can a computer do Natural Language Processing? Grammar checking? Artificial Intelligence Represent knowledge so that brute force

### KHALID PERVEZ (MBA+MCS) CHICHAWATNI

FAQ's about Lectures 1 to 5 QNo1.What is the difference between the strings and the words of a language? A string is any combination of the letters of an alphabet where as the words of a language are the

### Chapter 18: Decidability

Chapter 18: Decidability Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter before

### Chapter 4: Regular Expressions

CSI 3104 /Winter 2011: Introduction to Formal Languages What are the languages with a finite representation? We start with a simple and interesting class of such languages. Dr. Nejib Zaguia CSI3104-W11

### Section 1.7 Sequences, Summations Cardinality of Infinite Sets

Section 1.7 Sequences, Summations Cardinality of Infinite Sets Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and

### Section 2.4 Sequences and Summations

Section 2.4 Sequences and Summations Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and {0, 1, 2, 3,..., k} {1,

### Compiler Construction

Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =

### CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2]

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] 1 What is Lexical Analysis? First step of a compiler. Reads/scans/identify the characters in the program and groups

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III Year, V Semester Section : CSE - 1 & 2 Subject Code : CS6503 Subject

### Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Name: of 7 Theory of Computation Dr. Weiss Extra Practice Exam Solutions Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try to be

### Data Compression Fundamentals

1 Data Compression Fundamentals Touradj Ebrahimi Touradj.Ebrahimi@epfl.ch 2 Several classifications of compression methods are possible Based on data type :» Generic data compression» Audio compression»

### Lec-5-HW-1, TM basics

Lec-5-HW-1, TM basics (Problem 0)-------------------- Design a Turing Machine (TM), T_sub, that does unary decrement by one. Assume a legal, initial tape consists of a contiguous set of cells, each containing

Join Us on Come & Join Us at VUSTUDENTS.net For Assignment Solution, GDB, Online Quizzes, Helping Study material, Past Solved Papers, Solved MCQs, Current Papers, E-Books & more. Go to http://www.vustudents.net

### Regular Languages. Regular Language. Regular Expression. Finite State Machine. Accepts

Regular Languages L Regular Language Regular Expression Accepts Finite State Machine Regular Expressions The regular expressions over an alphabet are all and only the strings that can be obtained as follows:

### CT32 COMPUTER NETWORKS DEC 2015

Q.2 a. Using the principle of mathematical induction, prove that (10 (2n-1) +1) is divisible by 11 for all n N (8) Let P(n): (10 (2n-1) +1) is divisible by 11 For n = 1, the given expression becomes (10

### Automata Theory CS S-FR Final Review

Automata Theory CS411-2015S-FR Final Review David Galles Department of Computer Science University of San Francisco FR-0: Sets & Functions Sets Membership: a?{a,b,c} a?{b,c} a?{b,{a,b,c},d} {a,b,c}?{b,{a,b,c},d}

### CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing Fuhua (Frank) Cheng Department of Computer Science University of Kentucky 1 Table of Contents: Week 1: Preliminaries (set algebra, relations, functions) (read Chapters

### Computer Sciences Department

1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 D E C I D A B I L I T Y 4 Objectives 5 Objectives investigate the power of algorithms to solve problems.

### CMSC 330 Practice Problem 4 Solutions

CMC 330 Practice Problem 4 olutions 1. Context Free Grammars a. List the 4 components of a context free grammar. Terminals, non-terminals, productions, start symbol b. Describe the relationship between

### Finite Automata Part Three

Finite Automata Part Three Recap from Last Time A language L is called a regular language if there exists a DFA D such that L( D) = L. NFAs An NFA is a Nondeterministic Finite Automaton Can have missing

### CMSC 330, Fall 2009, Practice Problem 3 Solutions

CMC 330, Fall 2009, Practice Problem 3 olutions 1. Context Free Grammars a. List the 4 components of a context free grammar. Terminals, non-terminals, productions, start symbol b. Describe the relationship

### Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Chapter 1: Introduction Introduction Purpose of the Theory of Computation: Develop formal mathematical models of computation that reflect real-world computers. Nowadays, the Theory of Computation can be

### Introduction to Computer Architecture

Boolean Operators The Boolean operators AND and OR are binary infix operators (that is, they take two arguments, and the operator appears between them.) A AND B D OR E We will form Boolean Functions of

### CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

### Context-Free Languages and Pushdown Automata

Context-Free Languages and Pushdown utomata 1 Context-Free Grammars uppose we want to generate a set of strings (a language) L over an alphabet Σ. How shall we specify our language? One very useful way

### Learn Smart and Grow with world

Learn Smart and Grow with world All Department Smart Study Materials Available Smartkalvi.com TABLE OF CONTENTS S.No DATE TOPIC PAGE NO. UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation

### Context-Free Grammars

Context-Free Grammars 1 Informal Comments A context-free grammar is a notation for describing languages. It is more powerful than finite automata or RE s, but still cannot define all possible languages.

### TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

TABLE OF CONTENTS SNo DATE TOPIC PAGE NO UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation Techniques 3 3 Finite State systems 4 4 Basic Definitions 6 5 Finite Automaton 7 6 DFA NDFA

### CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I 1) Is it true that the language accepted by any NDFA is different from the regular language? Justify your answer. 2) Describe the following sets

### Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

Cardinality of Sets MAT Transition to Higher Mathematics Fall 0 MAT (Transition to Higher Math) Cardinality of Sets Fall 0 / Outline Sets with Equal Cardinality Countable and Uncountable Sets MAT (Transition

### Theory of Computation, Homework 3 Sample Solution

Theory of Computation, Homework 3 Sample Solution 3.8 b.) The following machine M will do: M = "On input string : 1. Scan the tape and mark the first 1 which has not been marked. If no unmarked 1 is found,

### Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

Announcements CS43: Discrete Structures Strong Induction and Recursively Defined Structures Işıl Dillig Homework 4 is due today Homework 5 is out today Covers induction (last lecture, this lecture, and

### CMPSCI 250: Introduction to Computation. Lecture #36: State Elimination David Mix Barrington 23 April 2014

CMPSCI 250: Introduction to Computation Lecture #36: State Elimination David Mix Barrington 23 April 2014 State Elimination Kleene s Theorem Overview Another New Model: The r.e.-nfa Overview of the Construction

### Introduction to Automata Theory

Introduction to Automata Theory Automata theory is basically about the study of different mechanisms for generation and recognition of languages. Automata theory is basically for the study of different

### Chapter Seven: Regular Expressions

Chapter Seven: Regular Expressions Regular Expressions We have seen that DFAs and NFAs have equal definitional power. It turns out that regular expressions also have exactly that same definitional power:

### I BSc(Computer Science)[ ] Semester - II Allied:DISCRETE MATHEMATICS - 207D Multiple Choice Questions.

1 of 23 1/20/2018, 2:35 PM Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008

### Bayesian Networks and Decision Graphs

ayesian Networks and ecision raphs hapter 7 hapter 7 p. 1/27 Learning the structure of a ayesian network We have: complete database of cases over a set of variables. We want: ayesian network structure

### Limits of Computation p.1/?? Limits of Computation p.2/??

Context-Free Grammars (CFG) There are languages, such as {0 n 1 n n 0} that cannot be described (specified) by finite automata or regular expressions. Context-free grammars provide a more powerful mechanism

### Problem Set 3 Due: 11:59 pm on Thursday, September 25

CS235 Languages and Automata Handout # 6 Prof. Lyn Turbak September 18, 2008 Wellesley College Problem Set 3 Due: 11:59 pm on Thursday, September 25 Reading: Handout #4: Standard ML of New Jersey (SML/NJ)

### Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman And Introduction to Languages and The by J. C. Martin Basic Mathematical

### A B. bijection. injection. Section 2.4: Countability. a b c d e g

Section 2.4: Countability We can compare the cardinality of two sets. A = B means there is a bijection between A and B. A B means there is an injection from A to B. A < B means A B and A B Example: Let

### Name: Finite Automata

Unit No: I Name: Finite Automata What is TOC? In theoretical computer science, the theory of computation is the branch that deals with whether and how efficiently problems can be solved on a model of computation,

### CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

### Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

### Section 13. Basis for a Topology

13. Basis for a Topology 1 Section 13. Basis for a Topology Note. In this section, we consider a basis for a topology on a set which is, in a sense, analogous to the basis for a vector space. Whereas a

### UNIT 1 SNS COLLEGE OF ENGINEERING

1 SNS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING THEORY OF COMPUTATION TWO MARKS WITH ANSWERS UNIT 1 1. Define set. A set is a collection of objects. E.g.: The collection of

### Finite-State Transducers in Language and Speech Processing

Finite-State Transducers in Language and Speech Processing Mehryar Mohri AT&T Labs-Research Finite-state machines have been used in various domains of natural language processing. We consider here the

### Structure of Programming Languages Lecture 3

Structure of Programming Languages Lecture 3 CSCI 6636 4536 Spring 2017 CSCI 6636 4536 Lecture 3... 1/25 Spring 2017 1 / 25 Outline 1 Finite Languages Deterministic Finite State Machines Lexical Analysis

### Part 3. Syntax analysis. Syntax analysis 96

Part 3 Syntax analysis Syntax analysis 96 Outline 1. Introduction 2. Context-free grammar 3. Top-down parsing 4. Bottom-up parsing 5. Conclusion and some practical considerations Syntax analysis 97 Structure

### Regular Expressions & Automata

Regular Expressions & Automata CMSC 132 Department of Computer Science University of Maryland, College Park Regular expressions Notation Patterns Java support Automata Languages Finite State Machines Turing

### Theory of Computation - Module 1

Theory of Computation - Module 1 Syllabus Proving techniques- Mathematical induction - Diagonalization principle - Pigeonhole principle - Functions - Primitive recursive and partial recursive functions

### CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly

### Cardinality of Sets. Washington University Math Circle 10/30/2016

Cardinality of Sets Washington University Math Circle 0/0/06 The cardinality of a finite set A is just the number of elements of A, denoted by A. For example, A = {a, b, c, d}, B = {n Z : n } = {,,, 0,,,

### CS 314 Principles of Programming Languages. Lecture 3

CS 314 Principles of Programming Languages Lecture 3 Zheng Zhang Department of Computer Science Rutgers University Wednesday 14 th September, 2016 Zheng Zhang 1 CS@Rutgers University Class Information

### LECTURE 2 An Introduction to Boolean Algebra

IST 210: Boot Camp Ritendra Datta LECTURE 2 An Introduction to Boolean Algebra 2.1. Outline of Lecture Fundamentals Negation, Conjunction, and Disjunction Laws of Boolean Algebra Constructing Truth Tables

### Introduction to Syntax Analysis. The Second Phase of Front-End

Compiler Design IIIT Kalyani, WB 1 Introduction to Syntax Analysis The Second Phase of Front-End Compiler Design IIIT Kalyani, WB 2 Syntax Analysis The syntactic or the structural correctness of a program

enu cs302: heory of Computation Class 9: Contextually P2 Recap: Computability Classes, CFL Pumping Closure Properties of CFLs pring 200 University of Virginia David Evans Problem 5: PRIE Use the pumping

### CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II Regular Expressions & Automata Department of Computer Science University of Maryland, College Park 1 Regular expressions Notation Patterns Java support Automata

### Mathematical Induction

Mathematical Induction Victor Adamchik Fall of 2005 Lecture 3 (out of three) Plan 1. Recursive Definitions 2. Recursively Defined Sets 3. Program Correctness Recursive Definitions Sometimes it is easier

### DVA337 HT17 - LECTURE 4. Languages and regular expressions

DVA337 HT17 - LECTURE 4 Languages and regular expressions 1 SO FAR 2 TODAY Formal definition of languages in terms of strings Operations on strings and languages Definition of regular expressions Meaning

### DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR-621113 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Third Year CSE( Sem:V) CS2303- THEORY OF COMPUTATION PART B-16

### Lexical Analyzer Scanner

Lexical Analyzer Scanner ASU Textbook Chapter 3.1, 3.3, 3.4, 3.6, 3.7, 3.5 Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Main tasks Read the input characters and produce

### Group A Assignment 3(2)

Group A Assignment 3(2) Att (2) Perm(3) Oral(5) Total(10) Sign Title of Assignment: Lexical analyzer using LEX. 3.1.1 Problem Definition: Lexical analyzer for sample language using LEX. 3.1.2 Perquisite:

### Computer Science 236 Fall Nov. 11, 2010

Computer Science 26 Fall Nov 11, 2010 St George Campus University of Toronto Assignment Due Date: 2nd December, 2010 1 (10 marks) Assume that you are given a file of arbitrary length that contains student

### Pushdown Automata. A PDA is an FA together with a stack.

Pushdown Automata A PDA is an FA together with a stack. Stacks A stack stores information on the last-in firstout principle. Items are added on top by pushing; items are removed from the top by popping.

### Computer Science. Unit-4: Introduction to Boolean Algebra

Unit-4: Introduction to Boolean Algebra Learning Objective At the end of the chapter students will: Learn Fundamental concepts and basic laws of Boolean algebra. Learn about Boolean expression and will

### CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

CS 3512, Spring 2011 Instructor: Doug Dunham Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010 Prerequisites: Calc I, CS2511 Rough course outline:

### Quiz 1: Solutions J/18.400J: Automata, Computability and Complexity. Nati Srebro, Susan Hohenberger

6.45J/8.4J: utomata, Computability and Complexity Quiz : Solutions Prof. Nancy Lynch Nati Srebro, Susan Hohenberger Please write your name in the upper corner of each page. (2 Points) Q- Problem : True

### Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture

### Suffix Trees and Arrays

Suffix Trees and Arrays Yufei Tao KAIST May 1, 2013 We will discuss the following substring matching problem: Problem (Substring Matching) Let σ be a single string of n characters. Given a query string

### General Overview of Compiler

General Overview of Compiler Compiler: - It is a complex program by which we convert any high level programming language (source code) into machine readable code. Interpreter: - It performs the same task

### Theory and Compiling COMP360

Theory and Compiling COMP360 It has been said that man is a rational animal. All my life I have been searching for evidence which could support this. Bertrand Russell Reading Read sections 2.1 3.2 in the

### Fall 08, Sherri Goings, Exam #1 (10/2), form 1 B

Fall 08, Sherri Goings, Exam #1 (10/2), form 1 B Last name (printed): First name (printed): Directions: a) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b) You have 80 minutes to complete

### CS143 Notes: Parsing

CS143 Notes: Parsing David L. Dill 1 Errata Lots of typos fixed 7:35 PM 4/19/2015. Thanks, Rui Ueyama. Please email additional reports of errors or suggested improvements to dill@cs.stanford.edu. 2 Syntactic

### A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial.

2301-670 Graph theory 1.1 What is a graph? 1 st semester 2550 1 1.1. What is a graph? 1.1.2. Definition. A graph G is a triple (V(G), E(G), ψ G ) consisting of V(G) of vertices, a set E(G), disjoint from

### Context Free Languages and Pushdown Automata

Context Free Languages and Pushdown Automata COMP2600 Formal Methods for Software Engineering Ranald Clouston Australian National University Semester 2, 2013 COMP 2600 Context Free Languages and Pushdown

### 1.7 The Heine-Borel Covering Theorem; open sets, compact sets

1.7 The Heine-Borel Covering Theorem; open sets, compact sets This section gives another application of the interval halving method, this time to a particularly famous theorem of analysis, the Heine Borel

### CS308 Compiler Principles Syntax Analyzer Li Jiang

CS308 Syntax Analyzer Li Jiang Department of Computer Science and Engineering Shanghai Jiao Tong University Syntax Analyzer Syntax Analyzer creates the syntactic structure of the given source program.

### Normal Forms and Parsing. CS154 Chris Pollett Mar 14, 2007.

Normal Forms and Parsing CS154 Chris Pollett Mar 14, 2007. Outline Chomsky Normal Form The CYK Algorithm Greibach Normal Form Chomsky Normal Form To get an efficient parsing algorithm for general CFGs

### Comparing sizes of sets

Comparing sizes of sets Sets A and B are the same size if there is a bijection from A to B. (That was a definition!) For finite sets A, B, it is not difficult to verify that there is a bijection from A

### Topology Between Two Sets

Journal of Mathematical Sciences & Computer Applications 1 (3): 95 107, 2011 doi: 10.5147/jmsca.2011.0071 Topology Between Two Sets S. Nithyanantha Jothi 1 and P. Thangavelu 2* 1 Department of Mathematics,

### The Boolean Formula Value Problem as Formal Language

The Boolean Formula Value Problem as Formal Language Klaus-Jörn Lange WSI, Universität Tübingen, Sand 13, D72076 Tübingen, Germany lange@informatik.uni-tuebingen.de Abstract. The Boolean formula value

### Words, Words, I Am So Sick of Words! Joseph Malkevitch Mathematics (York College)

Words, Words, I Am So Sick of Words! Joseph Malkevitch Mathematics (York College) What is mathematics about? The study of numbers. The study of shapes. But it should be viewed as: The study of patterns.

### Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Lecture 15 Ana Bove May 23rd 2016 More on Turing machines; Summary of the course. Overview of today s lecture: Recap: PDA, TM Push-down

### 1.0 Languages, Expressions, Automata

.0 Languages, Expressions, Automata Alphaet: Language: a finite set, typically a set of symols. a particular suset of the strings that can e made from the alphaet. ex: an alphaet of digits = {-,0,,2,3,4,5,6,7,8,9}

### CMSC330 Spring 2017 Midterm 2

CMSC330 Spring 2017 Midterm 2 Name (PRINT YOUR NAME as it appears on gradescope ): Discussion Time (circle one) 10am 11am 12pm 1pm 2pm 3pm Discussion TA (circle one) Aaron Alex Austin Ayman Daniel Eric

### Converting a DFA to a Regular Expression JP

Converting a DFA to a Regular Expression JP Prerequisite knowledge: Regular Languages Deterministic Finite Automata Nondeterministic Finite Automata Regular Expressions Conversion of Regular Expression

### 9.5 Equivalence Relations

9.5 Equivalence Relations You know from your early study of fractions that each fraction has many equivalent forms. For example, 2, 2 4, 3 6, 2, 3 6, 5 30,... are all different ways to represent the same

### GC03 Boolean Algebra

Why study? GC3 Boolean Algebra Computers transfer and process binary representations of data. Binary operations are easily represented and manipulated in Boolean algebra! Digital electronics is binary/boolean

### CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages Context Free Grammars and Parsing 1 Recall: Architecture of Compilers, Interpreters Source Parser Static Analyzer Intermediate Representation Front End Back