# Please note that there is more than one way to answer most of these questions. The following only represents a sample solution.

Save this PDF as:

Size: px
Start display at page:

Download "Please note that there is more than one way to answer most of these questions. The following only represents a sample solution."

## Transcription

1 HOMEWORK THREE SOLUTION CSE 355 DUE: 10 MARCH 2011 Please note that there is more than one way to answer most of these questions. The following only represents a sample solution. (1) 2.4 and 2.5 (b),(c),(e),(f): CFGs and PDAs (b) B = {w w starts and ends with the same symbol} 2.4: We will assume that to start and end with the same symbol, the string must have at least one symbol and that a single symbol starts and ends with the same symbol. S 0A0 1A1 0 1 A 0A 1A ɛ 2.5 Informal Description: We will nondeterministically guess if the string has only one symbol in which case we accept it without using the stack; otherwise, we push the first symbol read onto the stack. Then we will read every other symbol and nondeterministically guess if that is the last symbol read. If the last symbol read then matches the symbol on the stack and there is no more input we accept. Otherwise we reject. 0, 0 1, 1 0,0 1,1 (c) C = {w the length of w is odd} 2.4: S 0A 1A A 0S 1S ɛ 1

2 2.5 Informal Description: The stack is not needed here at all. Therefore we will read the input and only accept if the length is odd, that is after the first symbol read or every other symbol read thereafter if it is the final symbol read. (e) E = {w w = w R, that is, w is a palindrome} 2.4: S 0S0 1S1 0 1 ɛ 2.5 Informal Description: We begin by pushing the symbols read onto the stack. At each point we will nondeterministically guess if the middle of the string has been reached or if the next symbol read is the middle of the string and will not be put on the stack. Then we pop off the symbols from the stack if they match the input symbols read. If the symbols popped are exactly the same symbols that were pushed on earlier and the stack empties as the input is finished, then accept. Otherwise, reject. 0, 0 1, 1 0,0 1,1, \$,,\$ (f) F =, the emptyset 2.4: S S Note: Since, no derivations terminate, the CFG cannot accept any strings, including the empty. 2.5 Informal Description: The PDA consists of one state that does not accept. 2

4 (3) 2.16 and 2.17: CFGs and Regular Operations 2.16: For the following let A = (V A, Σ A, R A, S A ) and B = (V B, Σ B, R B, S B ) be CFGs with V A V B = Union: Let C = (V A V B {S}, Σ A Σ B, R A R B {S S A S B }, S). Then L(C) = L(A) L(B), since we, from the new start variable, we go to either the start variable of A, which derives a string in A, or to the start variable of B which derives a string in B. Concatenation: Let D = (V A V B {S}, Σ A Σ B, R A R B {S S A S B }, S). Then L(C) = L(A) L(B), since we from the new start variable we derive something in A followed by something in B. Star:Let E = (V A {S}, Σ A, R A {S S A S ɛ}, S). Then L(C) = (L(A)), since we from the new start variable we derive the concatenation of one or more strings in A, or ɛ. 2.17: We will show that every regular language is context free. Let A be a regular language, then there exists a regular epression R such that L(R) = A. We produce a CFG G such that L(G) = A as follows: G = grammar(r), where grammar := proc(r) If R = then return ({S},, {S S}, S), the grammar in 2.4 (f) Else if R = ɛ then return ({S},, {S ɛ}, S) Else if R = a then return ({S}, {a}, {S a}, S) Else if R = (R 1 R 2 ) then return the CFG for the union of grammar(r 1 ) and grammar(r 2 ) as specified in 2.16 Else if R = R 1 R 2 then return the CFG for the concatenation of grammar(r 1 ) and grammar(r 2 ) as specified in 2.16 Else if R = (R 1 ) then return the CFG for the star of grammar(r 1 ) as specified in 2.16 End Then L(G) = A since at each step of the procedure a grammar is produced that accepts the same language as R. The procedure is guaranteed to terminate since each regular expression R is finite and on each recursive call a smaller regular expression is passed to the procedure (since in the final three cases R 1 and R 2 are proper subcomponents of R). 4

5 (4) 2.35: Grammars in CNF whose languages have infinite length Let G = (V, Σ, R, S) be a CFG in Chomsky normal form that contains b variables and assume that G generates some string with a derivation having at least 2 b steps. We want to show that L(G) is infinite, or that there must exist a path along its parse tree that has a variable repeated. If there is a path that contains b + 1 variables, then by the pigeon-hole principle, one of the variables must be repeated. Thus, we want to show that if G generates some string with a derivation having at least 2 b steps then it must have a parse tree with a height of b + 1. For a given height, h, of a parse tree for a grammar in Chomsky normal form, that parse tree could have at most 2 h 1 steps in a derivation of a string. This is shown by induction on the height of the tree. The base case is h = 1 in which case the derivation is S a for some a Σ {ɛ}. Thus, there is 1 step to the derivation and 1 = Assume that a parse tree of height h has at most 2 h 1 steps to any derivation of a string. Then for a tree of height h + 1 it could have at most 2 h steps on the last level, corresponding to if all the elements on the previous level were variables. Then the maximum number of steps in the derivation are the maximum number of steps in the derivation on the last level plus the maximum number of steps for a derivation of the previous level which is given by the induction hypothesis. Thus, we get 2 h + 2 h 1 = 2(2 h ) 1 = 2 h+1 1, which completes the induction. Since G has a string with a derivation of 2 b steps, the parse tree for that string must have a height of at least b + 1 (since with height b it could have a derivation of at most 2 b 1 steps as shown above). Since the height of the tree is at least b + 1, then the longest path on that tree must have at least b + 2 nodes with only the last node a terminal. Thus, there must be at least b + 1 variables on that path. Let A be a variable that repeats on that longest path, then the derivation of that string looks like S uaz uvay z uvxyz where u, v, x, y, z Σ and y, z V. By applying the derivation A vay i times on that path for A followed by the derivation A x, we generate valid parse trees for the strings uv i xy i z for i 0. Thus, for each i 0, uv i xy i z L(G). Whence, there are an infinite number of strings in L(G). 5

6 (5) 1.54: F = {a i b j c k i, j, k 0 and if i = 1 then j = k}, a nonregular language that works in the pumping lemma a. Show F is not regular To see a solution that uses the reverse to show that F is not regular, see the solution given on the first midterm for 1c. We ll give another solution here. For a contradiction assume F is regular, the F {ab i c j i, j 0} = {ab i c i i 0} = G is regular since {ab i c j i, j 0} is the language of the regular expression ab c, it is regular, and regular languages are closed under intersection. We will now use the pumping lemma to show that G cannot be regular, which will contradict the fact the we assumemed F is regular. Let p be the pumping length of G and take s = ab p c p G with s > p. Then there exists x, y, z such that s = xyz and (1) xy i z G for all i 0, (2) y > 0 and (3) xy p. We will show that for any valid choice of xyz that xy 2 z / G. Case 1: y = a. Then xy 2 z = a 2 b p c p / G. Case 2: y = ab k for some k p 1 from (3). Then, xy 2 z = ab k ab p c p / G. Case 3: y = b k for some k p 1 from (2) and (3). Then xy 2 z = ab p+k c p / G. Thus, for every possibility of x, y, z, xy 2 z / G. Therefore, G cannot be regular, a contradiction. Thus, we conclude that F cannot be regular. b. Show that F acts like a regular language in the pumping lemma. First I must give a p. Take p = 2 although any p higher will work (but p = 1 will not, aabc 2 F but pumping down abc 2 / F ). Now we must show for any string s F, with s 2, can be written as xyz such that (1) xy i z G for all i 0, (2) y > 0 and (3) xy p. Again, we will proceed by cases on the number of as in s. Case 1: s = b j c k F for some i, k such that j + k 2 (so s 2). Then take x = ɛ, y equal to the first symbol in s, and z equal to the remaining symbols in s. Then (2) and (3) hold and xy i z = b j+(i 1) c k F if j 0, or xy i z = c k+(i 1) F if j = 0, so (1) also holds. Case 2: s = ab j c j F for some j 1 (so s 2). Then take x = ɛ, y = a, and z = b j c j. Then (2) and (3) hold and xy i z = a 1+(i 1) b j c j F, so (1) also holds. Case 3: s = a 2 b j c k F for some j, k 0 (so s 2). Then take x = ɛ, y = a 2 (a won t work here, because of pumping down), and z = b j c k. Then (2) and (3) hold and xy i z = a 2+2(i 1) b j c k F, so (1) also holds. Case 4: s = a j b k c m F for some j 3, k, m 0 (so s 2). Then take x = ɛ, y = a, and z = a j 1 b k c m. Then (2) and (3) hold and xy i z = a j+(i 1) b k c m F, so (1) also holds. Thus, in every case we see that the conditions of the pumping lemma hold. Therefore F satisfies the pumping lemma. c. Explain why parts (a) and (b) do not contradict the pumping lemma. The pumping lemma states that If a language is regular then in can be pumped. However, the converse of the statement, If a language can be pumped then it is regular, need not be true as shown in parts (a) and (b). This is because the converse of an implication is not equivalent to the implication (as can be shown with truth tables). Thus, the pumping lemma is not contradicted. 6

### Deterministic Push-Down Store Automata

Deterministic Push-Down tore Automata 1 Context-Free Languages A B C D... A w 0 w 1 D...E The languagea n b n : a b ab 2 Finite-tate Automata 3 Pushdown Automata Pushdown automata (pda s) is an fsa with

### Automata and Computability. Solutions to Exercises

Automata and Computability Solutions to Exercises Fall 25 Alexis Maciel Department of Computer Science Clarkson University Copyright c 25 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

### Finite Automata and Formal Languages

Finite Automata and Formal Languages TMV026/DIT321 LP4 2011 Lecture 14 May 19th 2011 Overview of today s lecture: Turing Machines Push-down Automata Overview of the Course Undecidable and Intractable Problems

### 6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010. Class 4 Nancy Lynch

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 4 Nancy Lynch Today Two more models of computation: Nondeterministic Finite Automata (NFAs)

### C H A P T E R Regular Expressions regular expression

7 CHAPTER Regular Expressions Most programmers and other power-users of computer systems have used tools that match text patterns. You may have used a Web search engine with a pattern like travel cancun

### Automata and Formal Languages

Automata and Formal Languages Winter 2009-2010 Yacov Hel-Or 1 What this course is all about This course is about mathematical models of computation We ll study different machine models (finite automata,

### Regular Expressions. Languages. Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2

Regular Expressions Languages Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2 1 String Recognition Machine Given a string and a definition of

### Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, 2014. School of Informatics University of Edinburgh als@inf.ed.ac.

Pushdown automata Informatics 2A: Lecture 9 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 3 October, 2014 1 / 17 Recap of lecture 8 Context-free languages are defined by context-free

### INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Name : FORMAL LANGUAGES AND AUTOMATA THEORY Code : A40509 Class : II B. Tech II

CPS 140 - Mathematical Foundations of CS Dr. S. Rodger Section: Properties of Context-Free Languages èhandoutè Section 3.5 Which of the following languages are CFL? æ L=fa n b n c j j 0 énçjg æ L=fa n

### Computing Functions with Turing Machines

CS 30 - Lecture 20 Combining Turing Machines and Turing s Thesis Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata

### Motivation. Automata = abstract computing devices. Turing studied Turing Machines (= computers) before there were any real computers

Motivation Automata = abstract computing devices Turing studied Turing Machines (= computers) before there were any real computers We will also look at simpler devices than Turing machines (Finite State

### Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Honors Class (Foundations of) Informatics Tom Verhoeff Department of Mathematics & Computer Science Software Engineering & Technology www.win.tue.nl/~wstomv/edu/hci c 2011, T. Verhoeff @ TUE.NL 1/20 Information

### CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

CMPSCI 250: Introduction to Computation Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013 Regular Expressions and Their Languages Alphabets, Strings and Languages

### ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK. 15 april 2003. Master Edition

ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK 5 april 23 Master Edition CONTEXT FREE LANGUAGES & PUSH-DOWN AUTOMATA CONTEXT-FREE GRAMMARS, CFG Problems Sudkamp Problem. (3.2.) Which language generates the grammar

### CS103B Handout 17 Winter 2007 February 26, 2007 Languages and Regular Expressions

CS103B Handout 17 Winter 2007 February 26, 2007 Languages and Regular Expressions Theory of Formal Languages In the English language, we distinguish between three different identities: letter, word, sentence.

### Model 2.4 Faculty member + student

Model 2.4 Faculty member + student Course syllabus for Formal languages and Automata Theory. Faculty member information: Name of faculty member responsible for the course Office Hours Office Number Email

### Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Kim S. Larsen Odense University Abstract For many years, regular expressions with back referencing have been used in a variety

### Lecture 2: Regular Languages [Fa 14]

Caveat lector: This is the first edition of this lecture note. Please send bug reports and suggestions to jeffe@illinois.edu. But the Lord came down to see the city and the tower the people were building.

### Increasing Interaction and Support in the Formal Languages and Automata Theory Course

Increasing Interaction and Support in the Formal Languages and Automata Theory Course [Extended Abstract] Susan H. Rodger rodger@cs.duke.edu Jinghui Lim Stephen Reading ABSTRACT The introduction of educational

### SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

Course Code : CS0355 SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN Course Title : THEORY OF COMPUTATION Semester : VI Course : June

### Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

### (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

3130CIT: Theory of Computation Turing machines and undecidability (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems. An undecidable problem

### Introduction to Automata Theory. Reading: Chapter 1

Introduction to Automata Theory Reading: Chapter 1 1 What is Automata Theory? Study of abstract computing devices, or machines Automaton = an abstract computing device Note: A device need not even be a

CS5236 Advanced Automata Theory Frank Stephan Semester I, Academic Year 2012-2013 Advanced Automata Theory is a lecture which will first review the basics of formal languages and automata theory and then

### CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

CS54 Turing Machines Turing Machine q 0 AI N P U T IN TAPE read write move read write move Language = {0} q This Turing machine recognizes the language {0} Turing Machines versus DFAs TM can both write

### Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Pushdown Automata In the last section we found that restricting the computational power of computing devices produced solvable decision problems for the class of sets accepted by finite automata. But along

### Chapter 7 Uncomputability

Chapter 7 Uncomputability 190 7.1 Introduction Undecidability of concrete problems. First undecidable problem obtained by diagonalisation. Other undecidable problems obtained by means of the reduction

### Lecture 5: Context Free Grammars

Lecture 5: Context Free Grammars Introduction to Natural Language Processing CS 585 Fall 2007 Andrew McCallum Also includes material from Chris Manning. Today s Main Points In-class hands-on exercise A

### Automata on Infinite Words and Trees

Automata on Infinite Words and Trees Course notes for the course Automata on Infinite Words and Trees given by Dr. Meghyn Bienvenu at Universität Bremen in the 2009-2010 winter semester Last modified:

### Bottom-Up Parsing. An Introductory Example

Bottom-Up Parsing Bottom-up parsing is more general than top-down parsing Just as efficient Builds on ideas in top-down parsing Bottom-up is the preferred method in practice Reading: Section 4.5 An Introductory

### Fundamentele Informatica II

Fundamentele Informatica II Answer to selected exercises 1 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 Let L be a language. It is clear

### INCIDENCE-BETWEENNESS GEOMETRY

INCIDENCE-BETWEENNESS GEOMETRY MATH 410, CSUSM. SPRING 2008. PROFESSOR AITKEN This document covers the geometry that can be developed with just the axioms related to incidence and betweenness. The full

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 Proofs Intuitively, the concept of proof should already be familiar We all like to assert things, and few of us

### CS 164 Programming Languages and Compilers Handout 8. Midterm I

Mterm I Please read all instructions (including these) carefully. There are six questions on the exam, each worth between 15 and 30 points. You have 3 hours to work on the exam. The exam is closed book,

### CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

CONTINUED FRACTIONS AND PELL S EQUATION SEUNG HYUN YANG Abstract. In this REU paper, I will use some important characteristics of continued fractions to give the complete set of solutions to Pell s equation.

### 10CS35: Data Structures Using C

CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a

### Reading 13 : Finite State Automata and Regular Expressions

CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

### OHJ-2306 Fall 2011 Introduction to Theoretical Computer Science

1 OHJ-2306 Fall 2011 Introduction to Theoretical Computer Science 2 3 Organization & timetable Lectures: prof. Tapio Elomaa, M.Sc. Timo Aho Tue and Thu 14 16 TB220 Aug. 30 Dec. 8, 2011 Exceptions: Thu

### Syntaktická analýza. Ján Šturc. Zima 208

Syntaktická analýza Ján Šturc Zima 208 Position of a Parser in the Compiler Model 2 The parser The task of the parser is to check syntax The syntax-directed translation stage in the compiler s front-end

### ASSIGNMENT ONE SOLUTIONS MATH 4805 / COMP 4805 / MATH 5605

ASSIGNMENT ONE SOLUTIONS MATH 4805 / COMP 4805 / MATH 5605 (1) (a) (0 + 1) 010 (finite automata below). (b) First observe that the following regular expression generates the binary strings with an even

### Graph Theory Problems and Solutions

raph Theory Problems and Solutions Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 005 Problems. Prove that the sum of the degrees of the vertices of any finite graph is

### 3515ICT Theory of Computation Turing Machines

Griffith University 3515ICT Theory of Computation Turing Machines (Based loosely on slides by Harald Søndergaard of The University of Melbourne) 9-0 Overview Turing machines: a general model of computation

### Turing Machines: An Introduction

CIT 596 Theory of Computation 1 We have seen several abstract models of computing devices: Deterministic Finite Automata, Nondeterministic Finite Automata, Nondeterministic Finite Automata with ɛ-transitions,

### Formal language and Automata Theory Course File

Formal language and Automata Theory Course File D.HIMAGIRI, Asst.Professor, CSE Department, JBIET. 2013-14 COURSE PLAN FACULTY DETAILS: Name of the Faculty:: Designation: Department:: D. HIMAGIRI Asst.Professor

### CS143 Handout 08 Summer 2008 July 02, 2007 Bottom-Up Parsing

CS143 Handout 08 Summer 2008 July 02, 2007 Bottom-Up Parsing Handout written by Maggie Johnson and revised by Julie Zelenski. Bottom-up parsing As the name suggests, bottom-up parsing works in the opposite

### Recursion. Definition: o A procedure or function that calls itself, directly or indirectly, is said to be recursive.

Recursion Definition: o A procedure or function that calls itself, directly or indirectly, is said to be recursive. Why recursion? o For many problems, the recursion solution is more natural than the alternative

### Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008.

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008 Course Syllabus Course Title: Theory of Computation Course Level: 3 Lecture Time: Course

### The Halting Problem is Undecidable

185 Corollary G = { M, w w L(M) } is not Turing-recognizable. Proof. = ERR, where ERR is the easy to decide language: ERR = { x { 0, 1 }* x does not have a prefix that is a valid code for a Turing machine

### Increasing Interaction and Support in the Formal Languages and Automata Theory Course

Increasing Interaction and Support in the Formal Languages and Automata Theory Course Susan H. Rodger Duke University ITiCSE 2007 June 25, 2007 Supported by NSF Grant DUE 0442513. Outline Overview of JFLAP

### Our recursive descent parser encodes state. information in its run-time stack, or call. Using recursive procedure calls to implement a

Non-recursive predictive parsing Observation: Our recursive descent parser encodes state information in its run-time stack, or call stack. Using recursive procedure calls to implement a stack abstraction

### SOLUTION Trial Test Grammar & Parsing Deficiency Course for the Master in Software Technology Programme Utrecht University

SOLUTION Trial Test Grammar & Parsing Deficiency Course for the Master in Software Technology Programme Utrecht University Year 2004/2005 1. (a) LM is a language that consists of sentences of L continued

### If-Then-Else Problem (a motivating example for LR grammars)

If-Then-Else Problem (a motivating example for LR grammars) If x then y else z If a then if b then c else d this is analogous to a bracket notation when left brackets >= right brackets: [ [ ] ([ i ] j,

### Baltic Way 1995. Västerås (Sweden), November 12, 1995. Problems and solutions

Baltic Way 995 Västerås (Sweden), November, 995 Problems and solutions. Find all triples (x, y, z) of positive integers satisfying the system of equations { x = (y + z) x 6 = y 6 + z 6 + 3(y + z ). Solution.

### Theory of Computation

Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

### CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

### COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing

COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing The scanner (or lexical analyzer) of a compiler processes the source program, recognizing

### Push-down Automata and Context-free Grammars

14 Push-down Automata and Context-free Grammars This chapter details the design of push-down automata (PDA) for various languages, the conversion of CFGs to PDAs, and vice versa. In particular, after formally

### Informatique Fondamentale IMA S8

Informatique Fondamentale IMA S8 Cours 1 - Intro + schedule + finite state machines Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université Lille 1 - Polytech Lille

### Regular Expressions and Automata using Haskell

Regular Expressions and Automata using Haskell Simon Thompson Computing Laboratory University of Kent at Canterbury January 2000 Contents 1 Introduction 2 2 Regular Expressions 2 3 Matching regular expressions

### Computer Architecture Syllabus of Qualifying Examination

Computer Architecture Syllabus of Qualifying Examination PhD in Engineering with a focus in Computer Science Reference course: CS 5200 Computer Architecture, College of EAS, UCCS Created by Prof. Xiaobo

### Fast nondeterministic recognition of context-free languages using two queues

Fast nondeterministic recognition of context-free languages using two queues Burton Rosenberg University of Miami Abstract We show how to accept a context-free language nondeterministically in O( n log

### Finite Automata. Reading: Chapter 2

Finite Automata Reading: Chapter 2 1 Finite Automaton (FA) Informally, a state diagram that comprehensively captures all possible states and transitions that a machine can take while responding to a stream

### We now explore a third method of proof: proof by contradiction.

CHAPTER 6 Proof by Contradiction We now explore a third method of proof: proof by contradiction. This method is not limited to proving just conditional statements it can be used to prove any kind of statement

### SOLUTIONS FOR PROBLEM SET 2

SOLUTIONS FOR PROBLEM SET 2 A: There exist primes p such that p+6k is also prime for k = 1,2 and 3. One such prime is p = 11. Another such prime is p = 41. Prove that there exists exactly one prime p such

### Mathematical Induction

Mathematical Induction (Handout March 8, 01) The Principle of Mathematical Induction provides a means to prove infinitely many statements all at once The principle is logical rather than strictly mathematical,

### Theory of Computation Class Notes 1

Theory of Computation Class Notes 1 1 based on the books by Sudkamp and by Hopcroft, Motwani and Ullman ii Contents 1 Introduction 1 1.1 Sets.............................................. 1 1.2 Functions

### Factorizations: Searching for Factor Strings

" 1 Factorizations: Searching for Factor Strings Some numbers can be written as the product of several different pairs of factors. For example, can be written as 1, 0,, 0, and. It is also possible to write

### Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4

Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4 I. Algorithm Design and Divide-and-Conquer There are various strategies we

### This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

3. Axioms of Set theory Before presenting the axioms of set theory, we first make a few basic comments about the relevant first order logic. We will give a somewhat more detailed discussion later, but

### Lesson 6: Proofs of Laws of Exponents

NYS COMMON CORE MATHEMATICS CURRICULUM Lesson 6 8 Student Outcomes Students extend the previous laws of exponents to include all integer exponents. Students base symbolic proofs on concrete examples to

### Formal Grammars and Languages

Formal Grammars and Languages Tao Jiang Department of Computer Science McMaster University Hamilton, Ontario L8S 4K1, Canada Bala Ravikumar Department of Computer Science University of Rhode Island Kingston,

### Mathematical Induction. Lecture 10-11

Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

### Overview of E0222: Automata and Computability

Overview of E0222: Automata and Computability Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. August 3, 2011 What this course is about What we study

### 1 Introduction to Counting

1 Introduction to Counting 1.1 Introduction In this chapter you will learn the fundamentals of enumerative combinatorics, the branch of mathematics concerned with counting. While enumeration problems can

### SYSTEMS OF PYTHAGOREAN TRIPLES. Acknowledgements. I would like to thank Professor Laura Schueller for advising and guiding me

SYSTEMS OF PYTHAGOREAN TRIPLES CHRISTOPHER TOBIN-CAMPBELL Abstract. This paper explores systems of Pythagorean triples. It describes the generating formulas for primitive Pythagorean triples, determines

### Computer Science Theory. From the course description:

Computer Science Theory Goals of Course From the course description: Introduction to the theory of computation covering regular, context-free and computable (recursive) languages with finite state machines,

### PES Institute of Technology-BSC QUESTION BANK

PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions

### Deterministic Finite Automata

1 Deterministic Finite Automata Definition: A deterministic finite automaton (DFA) consists of 1. a finite set of states (often denoted Q) 2. a finite set Σ of symbols (alphabet) 3. a transition function

### 13 Infinite Sets. 13.1 Injections, Surjections, and Bijections. mcs-ftl 2010/9/8 0:40 page 379 #385

mcs-ftl 2010/9/8 0:40 page 379 #385 13 Infinite Sets So you might be wondering how much is there to say about an infinite set other than, well, it has an infinite number of elements. Of course, an infinite

### Automata, languages, and grammars

Automata, languages, and grammars Cristopher Moore January 24, 2015 Abstract These lecture notes are intended as a supplement to Moore and Mertens The Nature of Computation, and are available to anyone

### Compiler Construction

Compiler Construction Regular expressions Scanning Görel Hedin Reviderad 2013 01 23.a 2013 Compiler Construction 2013 F02-1 Compiler overview source code lexical analysis tokens intermediate code generation

### We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b

In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

### COMMUTATIVE RINGS. Definition: A domain is a commutative ring R that satisfies the cancellation law for multiplication:

COMMUTATIVE RINGS Definition: A commutative ring R is a set with two operations, addition and multiplication, such that: (i) R is an abelian group under addition; (ii) ab = ba for all a, b R (commutative

### Induction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition

Induction Margaret M. Fleck 10 October 011 These notes cover mathematical induction and recursive definition 1 Introduction to induction At the start of the term, we saw the following formula for computing

### http://www.castlelearning.com/review/teacher/assignmentprinting.aspx 5. 2 6. 2 1. 10 3. 70 2. 55 4. 180 7. 2 8. 4

of 9 1/28/2013 8:32 PM Teacher: Mr. Sime Name: 2 What is the slope of the graph of the equation y = 2x? 5. 2 If the ratio of the measures of corresponding sides of two similar triangles is 4:9, then the

### MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

### Automata and Rational Numbers

Automata and Rational Numbers Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1 Canada shallit@cs.uwaterloo.ca http://www.cs.uwaterloo.ca/~shallit 1/40 Representations

### UNIVERSITY OF LONDON (University College London) M.Sc. DEGREE 1998 COMPUTER SCIENCE D16: FUNCTIONAL PROGRAMMING. Answer THREE Questions.

UNIVERSITY OF LONDON (University College London) M.Sc. DEGREE 1998 COMPUTER SCIENCE D16: FUNCTIONAL PROGRAMMING Answer THREE Questions. The Use of Electronic Calculators: is NOT Permitted. -1- Answer Question

### Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

### Mathematical induction. Niloufar Shafiei

Mathematical induction Niloufar Shafiei Mathematical induction Mathematical induction is an extremely important proof technique. Mathematical induction can be used to prove results about complexity of

### Basic Proof Techniques

Basic Proof Techniques David Ferry dsf43@truman.edu September 13, 010 1 Four Fundamental Proof Techniques When one wishes to prove the statement P Q there are four fundamental approaches. This document

### Discrete Mathematics Problems

Discrete Mathematics Problems William F. Klostermeyer School of Computing University of North Florida Jacksonville, FL 32224 E-mail: wkloster@unf.edu Contents 0 Preface 3 1 Logic 5 1.1 Basics...............................

### Introduction to Theory of Computation

Introduction to Theory of Computation Prof. (Dr.) K.R. Chowdhary Email: kr.chowdhary@iitj.ac.in Formerly at department of Computer Science and Engineering MBM Engineering College, Jodhpur Tuesday 28 th

### Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

### Homework 5 Solutions

Homework 5 Solutions 4.2: 2: a. 321 = 256 + 64 + 1 = (01000001) 2 b. 1023 = 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = (1111111111) 2. Note that this is 1 less than the next power of 2, 1024, which

### 1. Prove that the empty set is a subset of every set.

1. Prove that the empty set is a subset of every set. Basic Topology Written by Men-Gen Tsai email: b89902089@ntu.edu.tw Proof: For any element x of the empty set, x is also an element of every set since

### Page 331, 38.4 Suppose a is a positive integer and p is a prime. Prove that p a if and only if the prime factorization of a contains p.

Page 331, 38.2 Assignment #11 Solutions Factor the following positive integers into primes. a. 25 = 5 2. b. 4200 = 2 3 3 5 2 7. c. 10 10 = 2 10 5 10. d. 19 = 19. e. 1 = 1. Page 331, 38.4 Suppose a is a