Chapter 11 a Hierarchy of Formal Languages and Automata

Total Page:16

File Type:pdf, Size:1020Kb

Chapter 11 a Hierarchy of Formal Languages and Automata ✐ ✐ “15529˙CH11˙Linz” — 2011/1/12 — 10:03 — page 277 — #1 ✐ ✐ © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALEChapter OR DISTRIBUTION 11NOT FOR SALE OR DISTRIBUTION A Hierarchy of © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTIONFormal LanguagesNOT FOR SALE OR DISTRIBUTION and Automata © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTIONe now return our attention to ourNOT main FOR interest, SALE the studyOR DISTRIBUTION of formal languages. Our immediate goal will be to examine the languages W associated with Turing machines and some of their restrictions. Be- cause Turing machines can perform any kind of algorithmic com- putation, we expect to find that the family of languages associated with © Jones & Bartlett Learning, LLC them isquite broad.© It Jones includesnot & Bartlett only regular Learning, and context-free LLC lan- guages, but also the various examples we have encountered that lie outside NOT FOR SALE OR DISTRIBUTIONthese families. The nontrivialNOT FOR question SALE is whether OR DISTRIBUTION there are any languages that are not accepted by some Turing machine. We will answer this ques- tion first by showing that there are more languages than Turing machines, so that there must be some languages for which there are no Turing ma- © Joneschines. & Bartlett The proof Learning, is short and LLC elegant, but nonconstructive,© Jones and gives & Bartlett little Learning, LLC insight into the problem. For this reason, we will establish the existence NOT FORof SALE languagesnot OR DISTRIBUTION recognizable by Turing machinesthroughNOT more FOR explicit SALE OR DISTRIBUTION examplesthat actually allow usto identify one such language. Another avenue of investigation will be to look at the relation between Turing ma- chinesand certain typesof grammarsand to establisha connection between © Jones & Bartlett Learning,these grammars LLC and regular and context-free© Jones grammars. & Bartlett This Learning, leads to a LLC hierarchy of grammars and through it to a method for classifying language NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION 277 © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC ✐ © Jones & Bartlett Learning, LLC. NOT FOR SALE OR DISTRIBUTION. ✐ NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION ✐ ✐ ✐ ✐ “15529˙CH11˙Linz” — 2011/1/12 — 10:03 — page 278 — #2 ✐ ✐ © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION 278 Chapter 11 A Hierarchy of Formal Languages and Automata © Jonesfamilies. & Bartlett Some set-theoreticLearning, LLC diagrams illustrate the relationships© Jones between & Bartlett Learning, LLC variouslanguage familiesclearly. NOT FOR StrictlySALE speaking,OR DISTRIBUTION many of the arguments in this chapterNOT are FOR valid SALE only OR DISTRIBUTION for languages that do not include the empty string. This restriction arises from the fact that Turing machines, as we have defined them, cannot accept the empty string. To avoid having to rephrase the definition or having to © Jones & Bartlett Learning,add a repeated LLC disclaimer, we make the tacit© Jones assumption & Bartlett that the languagesLearning, LLC discussed in this chapter, unless otherwise stated, do not contain λ.Itisa NOT FOR SALE ORtrivial DISTRIBUTION matter to restate everything so thatNOTλ isincluded, FOR SALE but weOR will DISTRIBUTION leave thisto the reader. © Jones & Bartlett Learning, LLC11.1 Recursive© and Jones Recursively & Bartlett Learning, Enumerable LLC NOT FOR SALE OR DISTRIBUTION LanguagesNOT FOR SALE OR DISTRIBUTION We start with some terminology for the languages associated with Turing machines. In doing so, we must make the important distinction between languagesfor which there existsanaccepting Turing machine and languages © Jonesfor & which Bartlett there existsLearning, a membership LLC algorithm. Because a© Turing Jones machine & Bartlett Learning, LLC NOT FORdoes SALE not necessarily OR DISTRIBUTION halt on input that it does not accept,NOT the first FOR does SALE not OR DISTRIBUTION imply the second. Definition 11.1 © Jones & Bartlett Learning,A language L LLCissaidto be recursively enumerable© Jones &if thereBartlett exists Learning, a Turing LLC NOT FOR SALE ORmachine DISTRIBUTION that acceptsit. NOT FOR SALE OR DISTRIBUTION Thisdefinition impliesonly that there existsaTuring machine M, such that, for every w ∈ L, ∗ © Jones & Bartlett Learning, LLC © Jonesq0w M &x Bartlett1qf x2, Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION with qf a final state. The definition says nothing about what happens for w not in L; it may be that the machine haltsin a nonfinal stateor that it never haltsand goesinto an infinite loop. We can be more demanding and ask that the machine tell us whether or not any given input is in its © Joneslanguage. & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION Definition 11.2 A language L on Σ issaidto be recursive if there exists a Turing machine M that accepts L and that haltson every w in Σ+. In other words, a © Jones & Bartlett Learning,language is recursiveLLC if and only if there© exists Jones a membership & Bartlett algorithm Learning, for LLC NOT FOR SALE OR it.DISTRIBUTION NOT FOR SALE OR DISTRIBUTION © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC ✐ © Jones & Bartlett Learning, LLC. NOT FOR SALE OR DISTRIBUTION. ✐ NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION ✐ ✐ ✐ ✐ “15529˙CH11˙Linz” — 2011/1/12 — 10:03 — page 279 — #3 ✐ ✐ © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION 11.1 Recursive and Recursively Enumerable Languages 279 © Jones & BartlettIf a language Learning, is recursive, LLC then there exists an easily© Jones constructed & Bartlett enu- Learning, LLC meration procedure. Suppose that M isa Turing machine that determines NOT FORmembership SALE OR in DISTRIBUTION a recursive language L. We first constructNOT another FOR TuringSALE OR DISTRIBUTION machine, say M, that generatesall stringsinΣ + in proper order, let us say w1,w2, .... As these strings are generated, they become the input to M, which is modified so that it writes strings on its tape only if they are in L. © Jones & Bartlett Learning,That thereLLC is also an enumeration© procedure Jones for& everyBartlett recursively Learning, enu- LLC merable language is not as easy to see. We cannot use the previous argument NOT FOR SALE OR DISTRIBUTION NOT FOR SALE OR DISTRIBUTION as it stands, because if some wj isnot in L, the machine M, when started with wj on itstape, may never halt and therefore never get to the strings in L that follow wj in the enumeration. To make surethat thisdoesnot happen, the computation isperformed in a different way. We firstget M © Jones & Bartlett Learning, LLC to generate w1 and let©M Jonesexecute & one Bartlett move on Learning, it. Then we letLLCM generate NOT FOR SALE OR DISTRIBUTIONw2 and let M executeNOT one move FOR on wSALE2, followed OR byDISTRIBUTION the second move on w1. After this, we generate w3 and do one step on w3, the second step on w2, the third step on w1, and so on. The order of performance is depicted in Figure 11.1. From this, it is clear that M will never get into an infinite loop. Since any w ∈ L isgenerated by M and accepted by M in a finite © Jonesnumber & Bartlett of steps, Learning, every string LLC in L iseventually produced© byJonesM. & Bartlett Learning, LLC NOT FOR SALEIt is easy OR to DISTRIBUTION see that every language for which an enumerationNOT FOR procedure SALE OR DISTRIBUTION exists is recursively enumerable. We simply compare the given input string against successive strings generated by the enumeration procedure. If w ∈ L, we will eventually get a match, and the process can be terminated. Definitions11.1 and 11.2 give usvery little insight into the nature of © Jones & Bartlett Learning,either recursive LLC or recursively enumerable© Jones languages. & Bartlett These definitions Learning, at- LLC tach names to language families associated with Turing machines, but shed NOT FOR SALE OR DISTRIBUTIONno light on the nature of representativeNOT languages FOR in SALE these families. OR DISTRIBUTION Nor do they tell us much about the relationships between these languages or their connection to the language familieswe have encountered before. We are therefore immediately faced with questions such as “Are there languages that are recursively enumerable but not recursive?” and “Are there lan- © Jones & Bartlett Learning, LLC guages, describable somehow,© Jones that & are Bartlett not recursively Learning, enumerable?” LLC While NOT FOR SALE OR DISTRIBUTIONwe will be able to supplyNOT some FOR answers, SALE we willOR not DISTRIBUTION be able to produce very explicit examples to illustrate these questions, especially the second one. © Jones & Bartlett Learning, LLC © Jones & Bartlett Learning, LLC w w w w . Figure 11.1NOT FOR SALE OR1 DISTRIBUTION2 3 4 NOT FOR SALE OR DISTRIBUTION First move ... Second
Recommended publications
  • Nooj Computational Devices Max Silberztein
    NooJ Computational Devices Max Silberztein To cite this version: Max Silberztein. NooJ Computational Devices. Formalising Natural Languages With NooJ, Jun 2012, Paris, France. hal-02435921 HAL Id: hal-02435921 https://hal.archives-ouvertes.fr/hal-02435921 Submitted on 11 Jan 2020 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. NOOJ COMPUTATIONAL DEVICES MAX SILBERZTEIN Introduction NooJ’s linguistic development environment provides tools for linguists to construct linguistic resources that formalize 7 types of linguistic phenomena: typography, orthography, inflectional and derivational morphology, local and structural syntax, and semantics. NooJ also provides a set of parsers that can process any linguistic resource for these 7 types, and apply it to any corpus of texts in order to extract examples, annotate matching sequences, perform statistical analyses, etc.1 NooJ’s approach to Linguistics is peculiar in the world of Computational Linguistics: instead of constructing a large single grammar to describe a particular natural language (e.g. “a grammar of English”), NooJ users typically construct, edit, test and maintain a large number of local (small) grammars; for instance, there is a grammar that describes how to conjugate the verb to be, another grammar that describes how to state a date in English, another grammar that describes the heads of Noun Phrases, etc.
    [Show full text]
  • Computability and Complexity
    Computability and Complexity Lecture Notes Winter Semester 2016/2017 Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria [email protected] July 18, 2016 Contents List of Definitions5 List of Theorems7 List of Theses9 List of Figures9 Notions, Notations, Translations 12 1. Introduction 18 I. Computability 23 2. Finite State Machines and Regular Languages 24 2.1. Deterministic Finite State Machines...................... 25 2.2. Nondeterministic Finite State Machines.................... 30 2.3. Minimization of Finite State Machines..................... 38 2.4. Regular Languages and Finite State Machines................. 43 2.5. The Expressiveness of Regular Languages................... 58 3. Turing Complete Computational Models 63 3.1. Turing Machines................................ 63 3.1.1. Basics.................................. 63 3.1.2. Recognizing Languages........................ 68 3.1.3. Generating Languages......................... 72 3.1.4. Computing Functions.......................... 74 3.1.5. The Church-Turing Thesis....................... 79 Contents 3 3.2. Turing Complete Computational Models.................... 80 3.2.1. Random Access Machines....................... 80 3.2.2. Loop and While Programs....................... 84 3.2.3. Primitive Recursive and µ-recursive Functions............ 95 3.2.4. Further Models............................. 106 3.3. The Chomsky Hierarchy............................ 111 3.4. Real Computers................................
    [Show full text]
  • Recursively Enumerable and Recursive Languages
    Review • Languages and Grammars – Alphabets, strings, languages • Regular Languages – Deterministic Finite and Nondeterministic Automata – Equivalence of NFA and DFA Regular Expressions CS 301 - Lecture 23 – Regular Grammars – Properties of Regular Languages – Languages that are not regular and the pumping lemma Recursive and Recursively • Context Free Languages – Context Free Grammars – Derivations: leftmost, rightmost and derivation trees Enumerable Languages – Parsing and ambiguity – Simplifications and Normal Forms – Nondeterministic Pushdown Automata – Pushdown Automata and Context Free Grammars Fall 2008 – Deterministic Pushdown Automata – Pumping Lemma for context free grammars – Properties of Context Free Grammars • Turing Machines – Definition, Accepting Languages, and Computing Functions – Combining Turing Machines and Turing’s Thesis – Turing Machine Variations – Universal Turing Machine and Linear Bounded Automata – Today: Recursive and Recursively Enumerable Languages Definition: A language is recursively enumerable Recursively Enumerable if some Turing machine accepts it and Recursive Languages 1 Let L be a recursively enumerable language Definition: A language is recursive and M the Turing Machine that accepts it if some Turing machine accepts it and halts on any input string For string w : if w∈ L then M halts in a final state In other words: if w∉ L then M halts in a non-final state A language is recursive if there is or loops forever a membership algorithm for it Let L be a recursive language and M the Turing Machine
    [Show full text]
  • Computability
    Computability Tao Jiang Ming Li Department of Computer Science Department of Computer Science McMaster University University of Waterloo Hamilton, Ontario L8S 4K1, Canada Waterloo, Ontario N2L 3G1, Canada Bala Ravikumar Kenneth W. Regan Department of Computer Science Department of Computer Science University of Rhode Island State University of New York at Bu®alo Kingston, RI 02881, USA Bu®alo, NY 14260, USA 1 Introduction In the last two chapters, we have introduced several important computational models, including Turing machines, and Chomsky's hierarchy of formal grammars. In this chapter, we will explore the limits of mechanical computation as de¯ned by these models. We begin with a list of fundamental problems for which automatic computational solution would be very useful. One of these is the universal simulation problem: can one design a single algorithm that is capable of simulating any algorithm? Turing's demonstration that the answer is yes [Turing, 1936] supplied the proof for Babbage's dream of a single machine that could be programmed to carry out any computational task. We introduce a simple Turing machine programming language called \GOTO" in order to facilitate our own design of a universal machine. Next, we describe the schemes of primitive recur- sion and ¹-recursion, which enable a concise, mathematical description of computable functions that is independent of any machine model. We show that the ¹-recursive functions are the same as those computable on a Turing machine, and describe some computable functions including one that solves a second problem on our list. The success in solving ends there, however. We show in the last section of this chapter that 1 all of the remaining problems on our list are unsolvable by Turing machines, and subject to the Church-Turing thesis, have no mechanical or human solver at all.
    [Show full text]
  • Turing Machines: an Introduction
    CIT 596 – Theory of Computation 1 Turing Machines: An Introduction We have seen several abstract models of computing devices: Deterministic Finite Automata, Nondeterministic Finite Automata, Non- deterministic Finite Automata with ²-Transitions, Pushdown Automata, and Deterministic Pushdown Automata. However, none of the above “seem to be” as powerful as a real com- puter, right? We now turn our attention to a much more powerful abstract model of a computing device: a Turing machine. This model is believed to do everything that a real computer can do. °c Marcelo Siqueira — Spring 2005 CIT 596 – Theory of Computation 2 Turing Machines: An Introduction A Turing machine is somewhat similar to a finite automaton, but there are important differences: 1. A Turing machine can both write on the tape and read from it. 2. The read-write head can move both to the left and to the right. 3. The tape is infinite. 4. The special states for rejecting and accepting take immediate effect. °c Marcelo Siqueira — Spring 2005 CIT 596 – Theory of Computation 3 Turing Machines: An Introduction Formally, a Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q is the (finite) set of states, Σ is the input alphabet such that Σ does not contain the special blank symbol t, Γ is the tape alphabet such that t∈ Γ and Σ ⊆ Γ, δ : Q × Γ → Q × Γ ×{L, R} is the transition function, q0 ∈ Q is the start state, qaccept ∈ Q is the accept state, and qreject ∈ Q is the reject state, where qaccept 6= qreject.
    [Show full text]
  • Implementation of Unrestricted Grammar in to the Recursively Enumerable Language Using Turing Machine
    The International Journal Of Engineering And Science (IJES) ||Volume||2 ||Issue|| 3 ||Pages|| 56-59 ||2013|| ISSN: 2319 – 1813 ISBN: 2319 – 1805 Implementation of Unrestricted Grammar in To the Recursively Enumerable Language Using Turing Machine 1,Jainendra Singh, 2, Dr. S.K. Saxena 1,Department of Computer Science, Maharaja Surajmal Institute 2,Department of Computer Engineering, Delhi Technological University -------------------------------------------------------Abstract------------------------------------------------------- This paper presents the implementation of the unrestricted grammar in to recursively enumerable language for JFLAP platform. Automata play a major role in compiler design and parsing. The class of formal languages that work for the most complex problems belongs to the set of Recursively Enumerable Language (REL).RELs are accepted by the type of automata as Turing Machine. Turing Machines are the most powerful computational machines and are the theoretical basis for modern computers. Turing Machine works for all classes of languages including regular language, CFL as well as Recursive Enumerable Languages. Unrestricted grammar are much more powerful than restricted forms like the regular and context free grammars. In facts, unrestricted grammars corresponds to the largest family of languages so we can hope to recognize by mechanical means; that is unrestricted grammars generates exactly the family of recursively enumerable languages. Turing Machine is used to implementation of unrestricted grammar & RELs for JFLAP
    [Show full text]
  • Theory of Computation
    Theory of Computation Todd Gaugler December 14, 2011 2 Contents 1 Mathematical Background 5 1.1 Overview . .5 1.2 Number System . .5 1.3 Functions . .6 1.4 Relations . .6 1.5 Recursive Definitions . .8 1.6 Mathematical Induction . .9 2 Languages and Context-Free Grammars 11 2.1 Languages . 11 2.2 Counting the Rational Numbers . 13 2.3 Grammars . 14 2.4 Regular Grammar . 15 3 Normal Forms and Finite Automata 17 3.1 Review of Grammars . 17 3.2 Normal Forms . 18 3.3 Machines . 20 3.3.1 An NFA λ ..................................... 22 4 Regular Languages 23 4.1 Computation . 24 4.2 The Extended Transition Function . 24 4.3 Algorithms . 26 4.3.1 Removing Non-Determinism . 26 4.3.2 State Minimization . 26 4.3.3 Expression Graph . 26 4.4 The Relationship between a Regular Grammar and the Finite Automaton . 26 4.4.1 Building an NFA corresponding to a Regular Grammar . 27 4.4.2 Closure . 27 4.5 Review for the First Exam . 28 4.6 The Pumping Lemma . 28 5 Pushdown Automata and Context-Free Languages 31 5.1 Pushdown Automata . 31 5.2 Variations on the PDA Theme . 34 5.3 Acceptance of Context-Free Languages . 36 3 CONTENTS CONTENTS 5.4 The Pumping Lemma for Context-Free Languages . 36 5.5 Closure Properties of Context- Free Languages . 37 6 Turing Machines 39 6.1 The Standard Turing Machine . 39 6.2 Turing Machines as Language Acceptors . 40 6.3 Alternative Acceptance Criteria . 41 6.4 Multitrack Machines . 42 6.5 Two-Way Tape Machines .
    [Show full text]
  • Theory of Computation Summary
    Theory of Computation (CS 46) Sets and Functions We write 2A for the set of subsets of A. Definition. A set, A, is countably infinite if there exists a bijection from A to the natural numbers. Note. This allows us to enumerate A, using the order from the bijection. Definition. A set is countable if it is finite or countably infinite. It is uncountable otherwise. Theorem. If A is a subset of a countable set, then A is countable. Theorem. N ´ N is countable. Corollary. A countable union of countable sets is countable. Programs Definition. A program is a finite string (ordered set of symbols) over a finite alphabet. Note. This is distinct from the process associated with the program, which may be infinite. Theorem. The number of programs is countable. Proof. The number of strings of length k is finite, and the set of all programs is the union of this countable number of countable sets. Theorem. The number of functions from the natural numbers to {0,1} is uncountably infinite. Corollary. There are more functions than possible programs. Thus, some functions are not computable. Languages Definition. An alphabet (S) is a finite set of symbols. A string is a finite sequence from an alphabet. The set of all strings over an alphabet is denoted S*. · |w| is the length of the string w. · ak = aa … a (k times) Definition. A language is a subset of S*. The following operations are defined on languages: · L1 + L2 is the union of the two languages · L1 · L2 = {l1l2 | l1 ÎL1 and l2 Î L2} is the concatenation of two languages.
    [Show full text]
  • QUESTION BANK SOLUTION Unit 1 Introduction to Finite Automata
    FLAT 10CS56 QUESTION BANK SOLUTION 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 number of a’s and b’s.( 5m )(Jun-Jul 10) L = {Œ,aabb,abab,baba,baab,bbaa,aabbaa,---------} 3. Give Applications of Finite Automata. (5m )(Jun-Jul 10) String Processing Consider finding all occurrences of a short string (pattern string) within a long string (text string). This can be done by processing the text through a DFA: the DFA for all strings that end with the pattern string. Each time the accept state is reached, the current position in the text is output. Finite-State Machines A finite-state machine is an FA together with actions on the arcs. Statecharts Statecharts model tasks as a set of states and actions. They extend FA diagrams. Lexical Analysis Dept of CSE, SJBIT 1 FLAT 10CS56 In compiling a program, the first step is lexical analysis. This isolates keywords, identifiers etc., while eliminating irrelevant symbols. A token is a category, for example “identifier”, “relation operator” or specific keyword. 4. Define DFA, NFA & Language? (5m)( Jun-Jul 10) Deterministic finite automaton (DFA)—also known as deterministic finite state machine—is a finite state machine that accepts/rejects finite strings of symbols and only produces a unique computation (or run) of the automaton for each input string. 'Deterministic' refers to the uniqueness of the computation. Nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite state machine where from each state and a given input symbol the automaton may jump into several possible next states.
    [Show full text]
  • Languages and Finite Automata
    class19.pdf • Page 2. RE and Recursive. Linz 6th, §11.1 • Def RE. Linz 6th Definition 11.1 • Def Recursive. Linz 6th Definition 11.2 • Page 28. ∃ lang not RE. Linz 6th, §11.1 • [Thm 11.2 by counting argument] • Thm 11.3 by diagonalization • Page 50. Recursive is 푝푟표푝푒푟 푠푢푏푠푒푡 of RE Linz 6th, §11.1 • [Thm 11.4 If L and L complement both re, then both recursive. L recursive, then L complement recursive.] • Thm 11.5 ∃ a non-recursive, but re language 1 Recursively Enumerable and Recursive Languages 2 Recall Definition (class 18.pdf) Definition 10.4, Linz, 6th, page 279 Let S be a set of strings. An enumeration procedure for S is a Turing Machine that generates all strings of one by one and each string is generated in finite time. 3 Definition: A language is recursively enumerable if some Turing machine accepts it 4 Let L be a recursively enumerable language and M the Turing Machine that accepts it For string w : if w L then halts in a final state if w L then halts in a non-final state or loops forever 5 Definition (11.2, page 287): A language is recursive if some Turing machine accepts it and halts on any input string In other words: A recursive language has a membership algorithm. 6 Let L be a recursive language and M the Turing Machine that accepts it L is a recursive language if there is a Turing Machine M such that For any string w : if w L then halts in a final state if w L then halts in a non-final state 7 We will prove: 1.
    [Show full text]
  • Theory of Computation Final Exam
    Theory of Computation Final Exam. 2007 NAME: .................................................. Student ID.: .................................................. 1 1 (72 pts)) True or false? (Score = Right - 2 Wrong.) Mark ‘O’ for true; ‘×’ for false. i 1. .....O..... {a |i is prime} is not context free. n n 2. .....X..... {(a b) |n ≥ 1} is context free. n m 3. .....X..... {(a b) |m, n ≥ 1} is context free. 4. .....O..... If L1 is context free and L2 is regular, then L1/L2 is context free. (Note that L1/L2 = {x | ∃y ∈ L2, xy ∈ L1}) 5. .....X..... If L1/L2 and L1 are context free, then L2 must be recursive. 6. .....X..... If L1 and L1 ∪ L2 are context free, then L2 must be context free. 7. .....O..... If L1 is context free and L2 is regular, then L1 − L2 is context free. 8. .....X..... If L1 is regular and L2 is context free, then L1 − L2 is context free. 9. .....O..... If L1 is regular and L2 is context-free, then L1 ∩ L2 must be a CFL. 10. .....O..... If L1 and L2 are CFLs, then L1 ∪ L2 must be a CFL. R R 11. .....O..... If L is context free, then L (={x |x ∈ L}) is also context free. 12. .....X..... Nondeterministic and deterministic versions of PDAs are equivalent. 13. .....O..... If a language L does not satisfy the conditions stated in the pumping lemma for CFLs, then L is not context-free. 14. .....X..... Every infinite set of strings over a single letter alphabet Σ (={a}) contains an infinite context free subset. 15. .....X..... Every infinite context-free set contains an infinite regular subset.
    [Show full text]
  • Public Sector Exams
    Theory & Practice Book Computer Science & IT for Public Sector Exams ISRO, DRDO, BARC, BEL, HAL, NTPC, ONGC, BHEL, SAIL, GAIL, MTNL, FCI, ECL, ATC, DMRC, HLL, UPRVNL, CSPEB, OPTCL.... Corporate Office: 44-A/1, Kalu Sarai, New Delhi-16 | Regd. Office: 25-A, Ber Sarai, New Delhi-16 Website: www.madeeasypublications.org | Phone: 011-26560862, 011-32059862 MADE EASY Publications Corporate Office: 44-A/1, Kalu Sarai, New Delhi-16; Regd. Office: 25-A, Ber Sarai, New Delhi-16 Website: www.madeeasypublications.org; Phone: 011-26560862, 011-9958995830 E-mail: [email protected]; [email protected] Theory & Practice Book for Computer Science & IT Copyright © 2013, by MADE EASY Publications. All rights are reserved. No part of this publication may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photo-copying, recording or otherwise), without the prior written permission of the above mentioned publisher of this book. First Edition: 2010 Second Edition: 2012 Third Edition: 2013 IBSN: 978-93-81069-32-5 Typesetat: MADE EASY Publications, New Delhi-110016 PREFACE “Theory & Practice Book on Computer Science” contains theory including basic concepts and formulae and nearly 3000 questions with answers and explanations. The authors (MADE EASY Team) are very well aware of the requirements of the Public Sector Examinations like ISRO, DRDO, BARC, BEL, HAL, NTPC, ONGC, BHEL, SAIL, GAIL, MTNL, ECL, ATC, DMRC, HLL, UPRVNL, CSPEB, OPTCL....etc. Therefore content of this book includes such questions similar to which questions are normally asked in the Public Sector Examinations.
    [Show full text]