Formal Definition of Computation. Formal Definition of Computation p.1/28
|
|
- Tamsin Charla Wright
- 5 years ago
- Views:
Transcription
1 Formal Definition of Computation Formal Definition of Computation p.1/28
2 Computation model The model of computation considered so far is the work performed by a finite automaton Formal Definition of Computation p.2/28
3 Computation model The model of computation considered so far is the work performed by a finite automaton Finite automata were described informally, using state diagrams, and formally, as a 5-tuple Formal Definition of Computation p.2/28
4 Computation model The model of computation considered so far is the work performed by a finite automaton Finite automata were described informally, using state diagrams, and formally, as a 5-tuple Informal description is easier to grasp first, but the formal definition is useful for making this notion precise, resolving any ambiguities that may occur in formal description Formal Definition of Computation p.2/28
5 Formal definition of computation Let be a finite automaton and be a string over Formal Definition of Computation p.3/28
6 Formal definition of computation Let Then exist in be a finite automaton and be a string over accepts if a sequence of states such that the following hold: Formal Definition of Computation p.3/28
7 Formal definition of computation Let Then exist in 1. be a finite automaton and be a string over accepts if a sequence of states such that the following hold: Formal Definition of Computation p.3/28
8 Formal definition of computation Let Then exist in 1. be a finite automaton and be a string over accepts if a sequence of states such that the following hold: 2. for Formal Definition of Computation p.3/28
9 Formal definition of computation Let Then exist in 1. be a finite automaton and be a string over accepts if a sequence of states such that the following hold: 2. for 3. Formal Definition of Computation p.3/28
10 Interpretation Condition (1) says that the machine starts its computation in the start state Formal Definition of Computation p.4/28
11 Interpretation Condition (1) says that the machine starts its computation in the start state Condition (2) says that as long as input is available the machine goes from state to state according to its transition function Formal Definition of Computation p.4/28
12 Interpretation Condition (1) says that the machine starts its computation in the start state Condition (2) says that as long as input is available the machine goes from state to state according to its transition function Condition (3) says that the machine accepts its input if it ends up in an accept state Formal Definition of Computation p.4/28
13 Interpretation Condition (1) says that the machine starts its computation in the start state Condition (2) says that as long as input is available the machine goes from state to state according to its transition function Condition (3) says that the machine accepts its input if it ends up in an accept state Can you translate this interpretation into the computation performed by a program? Formal Definition of Computation p.4/28
14 Translation A program behaves like a finite automaton: Formal Definition of Computation p.5/28
15 Translation A program behaves like a finite automaton: Its start state is a function mapping program variables to their initial values Formal Definition of Computation p.5/28
16 Translation A program behaves like a finite automaton: Its start state is a function mapping program variables to their initial values Program execution goes from state to state by transitions performed according to program control flow Formal Definition of Computation p.5/28
17 Translation A program behaves like a finite automaton: Its start state is a function mapping program variables to their initial values Program execution goes from state to state by transitions performed according to program control flow The language of this machine is the class of problems solved by program execution Formal Definition of Computation p.5/28
18 Difference A program computation differs from FA computation because: Formal Definition of Computation p.6/28
19 Difference A program computation differs from FA computation because: A program may have a potential infinite set of states and can run forever Formal Definition of Computation p.6/28
20 Difference A program computation differs from FA computation because: A program may have a potential infinite set of states and can run forever During execution a program may interact with its environment Formal Definition of Computation p.6/28
21 Difference A program computation differs from FA computation because: A program may have a potential infinite set of states and can run forever During execution a program may interact with its environment The accepting state of the program has a larger interpretation Formal Definition of Computation p.6/28
22 Note We say that a machine recognizes the language if How is this interpreted in terms of a program execution? Formal Definition of Computation p.7/28
23 Regular language Definition 1.7 A language is called a regular language if some finite automaton recognizes it Formal Definition of Computation p.8/28
24 Example computation from Example 1.5 and Formal Definition of Computation p.9/28 Take the machine Figure 1: Finite automaton
25 Running accepts according to the formal definition of computation because the sequence of states it enters when computing on is : Formal Definition of Computation p.10/28
26 Running accepts according to the formal definition of computation because the sequence of states it enters when computing on is : is the first state by definition Formal Definition of Computation p.10/28
27 Running accepts according to the formal definition of computation because the sequence of states it enters when computing on is : is the first state by definition,, Formal Definition of Computation p.10/28
28 Running accepts according to the formal definition of computation because the sequence of states it enters when computing on is : is the first state by definition,,,, Formal Definition of Computation p.10/28
29 Running accepts according to the formal definition of computation because the sequence of states it enters when computing on is : is the first state by definition,,,,,, Formal Definition of Computation p.10/28
30 The language except that the sum of the symbols in resets the count to 0 is 0 modulo 3, Since is a finite automaton is a regular language Formal Definition of Computation p.11/28
31 Designing finite automata Whether it be of automata or artwork, design is a creative process Formal Definition of Computation p.12/28
32 Designing finite automata Whether it be of automata or artwork, design is a creative process Consequently it cannot be reduced to a simple recipe or formula Formal Definition of Computation p.12/28
33 Designing finite automata Whether it be of automata or artwork, design is a creative process Consequently it cannot be reduced to a simple recipe or formula However, for a given design task one can find a particular approach useful; here we consider a useful approach for designing various types of automata Formal Definition of Computation p.12/28
34 The approach Be yourself the machine you are trying to design! Formal Definition of Computation p.13/28
35 The approach Be yourself the machine you are trying to design! As the machine you try to design, answer the question: how would you go about performing the machine s task? Formal Definition of Computation p.13/28
36 The approach Be yourself the machine you are trying to design! As the machine you try to design, answer the question: how would you go about performing the machine s task? Pretending that you are the machine is a psychological trick that helps engage your whole mind in the design process Formal Definition of Computation p.13/28
37 Using the approach Suppose that you are given some language and want to design a finite automaton that recognizes it Remember: a language is a set of strings over a given alphabet! Formal Definition of Computation p.14/28
38 Pretending to be the automaton Pretending that you are the automaton, you receive an input string and must determine whether it belongs to the language Formal Definition of Computation p.15/28
39 Pretending to be the automaton Pretending that you are the automaton, you receive an input string and must determine whether it belongs to the language You got to see the symbols in the string one by one. After each symbols you must decide whether the string seen so far is in the language. Formal Definition of Computation p.15/28
40 Pretending to be the automaton Pretending that you are the automaton, you receive an input string and must determine whether it belongs to the language You got to see the symbols in the string one by one. After each symbols you must decide whether the string seen so far is in the language. The reason is that you, like the machine, don t know when the end of the string is coming; so you must always be ready with the answer. Formal Definition of Computation p.15/28
41 Making decisions In order to make decisions, you have to figure out what you need to remember about the input string as you are reading it Formal Definition of Computation p.16/28
42 Making decisions In order to make decisions, you have to figure out what you need to remember about the input string as you are reading it Bear in mind that as you are pretending to be a finite automaton, you have a finite number of states and thus a finite memory, say a single sheet of paper Formal Definition of Computation p.16/28
43 Making decisions In order to make decisions, you have to figure out what you need to remember about the input string as you are reading it Bear in mind that as you are pretending to be a finite automaton, you have a finite number of states and thus a finite memory, say a single sheet of paper Fortunately, you don t need to remember entire input, you only need to remember certain crucial information Formal Definition of Computation p.16/28
44 Note Which information is crucial depends on the particular language considered Formal Definition of Computation p.17/28
45 Example design Suppose and the language consists of all strings with an odd number of 1s. You want to construct a finite automaton to recognize this language Formal Definition of Computation p.18/28
46 Constructing the states Start getting an input string of 0s and 1s symbol by symbol Formal Definition of Computation p.19/28
47 Constructing the states Start getting an input string of 0s and 1s symbol by symbol Remember whether the number of 1s seen so far is even or odd; Formal Definition of Computation p.19/28
48 Constructing the states Start getting an input string of 0s and 1s symbol by symbol Remember whether the number of 1s seen so far is even or odd; Represent the information you need as a finite list: (1) even so far, (2) odd so far Formal Definition of Computation p.19/28
49 Constructing the states Start getting an input string of 0s and 1s symbol by symbol Remember whether the number of 1s seen so far is even or odd; Represent the information you need as a finite list: (1) even so far, (2) odd so far Assign a state to each possibility, Figure 2 Formal Definition of Computation p.19/28
50 Constructing transitions To construct transitions you need to observe the way of going between possibilities while reading the input Example: the transition to flip state on a 1 and stay put on 0 is shown in Figure 3 Figure 3: Adding the start and accept state Formal Definition of Computation p.20/28
51 Start state and final states Set the start state to the state corresponding to the possibility associated with having seen far (i.e., the empty string ) symbols so Formal Definition of Computation p.21/28
52 Start state and final states Set the start state to the state corresponding to the possibility associated with having seen far (i.e., the empty string ) symbols so In our example this correspond to Formal Definition of Computation p.21/28
53 Start state and final states Set the start state to the state corresponding to the possibility associated with having seen far (i.e., the empty string ) symbols so In our example this correspond to Set the accept states to be those corresponding to possibilities where you want to accept the input Formal Definition of Computation p.21/28
54 Start state and final states Set the start state to the state corresponding to the possibility associated with having seen far (i.e., the empty string ) symbols so In our example this correspond to Set the accept states to be those corresponding to possibilities where you want to accept the input In our example this is the set Formal Definition of Computation p.21/28
55 The result The result of the example considered above is in Figure 4 Figure 4: Adding the start and accept state Formal Definition of Computation p.22/28
56 Example 1.9 This example shows how to design a finite automaton recognize the regular language of all strings over the alphabet substring Example: that contain the string as a strings 0010, 1001, 001, are in that language to Formal Definition of Computation p.23/28
57 Pretending to be As symbols come in, you would initially skip over all 1s Formal Definition of Computation p.24/28
58 Pretending to be As symbols come in, you would initially skip over all 1s If you come to a, you note that you may have just seen the first of the three symbols in the pattern Formal Definition of Computation p.24/28
59 Pretending to be As symbols come in, you would initially skip over all 1s If you come to a, you note that you may have just seen the first of the three symbols in the pattern If after the first 0 you see a 1, then there were too few 0s so you back to skipping over 1s Formal Definition of Computation p.24/28
60 Pretending to be As symbols come in, you would initially skip over all 1s If you come to a, you note that you may have just seen the first of the three symbols in the pattern If after the first 0 you see a 1, then there were too few 0s so you back to skipping over 1s If after the first 0 you see another 0 then you should remember that you have seen two symbols of the pattern Formal Definition of Computation p.24/28
61 Pretending to be As symbols come in, you would initially skip over all 1s If you come to a, you note that you may have just seen the first of the three symbols in the pattern If after the first 0 you see a 1, then there were too few 0s so you back to skipping over 1s If after the first 0 you see another 0 then you should remember that you have seen two symbols of the pattern Once you have seen two symbols of the pattern you need to scan the input until you see a 1; if you find it, remember that you succeeded to find the pattern Formal Definitionand of Computation p.24/28
62 The list of possibilities 1. Haven t see any symbol of the pattern 2. Have just seen a 0 3. Have just seen Have seen the entire pattern 001 Formal Definition of Computation p.25/28
63 Designing states and transitions Assign the states to the four possibilities Formal Definition of Computation p.26/28
64 Designing states and transitions Assign the states to the four possibilities In state you move to : while reading 1 remain in, but reading 0 Formal Definition of Computation p.26/28
65 Designing states and transitions Assign the states to the four possibilities In state you move to : while reading 1 remain in, but reading 0 In state you transit to : reading 0 you transit to but reading 1 Formal Definition of Computation p.26/28
66 Designing states and transitions Assign the states to the four possibilities In state you move to : while reading 1 remain in, but reading 0 In state you transit to In state : reading 0 you transit to you remain in state : reading 1 you move to but reading 1 while reading 0 Formal Definition of Computation p.26/28
67 Designing states and transitions Assign the states to the four possibilities In state you move to : while reading 1 remain in, but reading 0 In state you transit to In state : reading 0 you transit to you remain in state : reading 1 you move to but reading 1 while reading 0 In state : whatever you read remain in. Formal Definition of Computation p.26/28
68 0 Start and final states Start state is The result is in Figure 5 Figure 5: Accepting strings containing 001 Formal Definition of Computation p.27/28
69 Another example Design a DFA that recognizes the languages: begins with 1 and ends with 0 is any string except a and b Formal Definition of Computation p.28/28
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
More informationFinite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur
Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University
More informationCSE450. Translation of Programming Languages. Lecture 20: Automata and Regular Expressions
CSE45 Translation of Programming Languages Lecture 2: Automata and Regular Expressions Finite Automata Regular Expression = Specification Finite Automata = Implementation A finite automaton consists of:
More information1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:
P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string
More informationImplementation of Lexical Analysis
Implementation of Lexical Analysis Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs) Implementation
More informationImplementation of Lexical Analysis
Implementation of Lexical Analysis Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs) Implementation
More informationImplementation of Lexical Analysis
Implementation of Lexical Analysis Lecture 4 (Modified by Professor Vijay Ganesh) Tips on Building Large Systems KISS (Keep It Simple, Stupid!) Don t optimize prematurely Design systems that can be tested
More informationAutomata & languages. A primer on the Theory of Computation. The imitation game (2014) Benedict Cumberbatch Alan Turing ( ) Laurent Vanbever
Automata & languages A primer on the Theory of Computation The imitation game (24) Benedict Cumberbatch Alan Turing (92-954) Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 2 27 Brief CV
More informationCSE450. Translation of Programming Languages. Automata, Simple Language Design Principles
CSE45 Translation of Programming Languages Automata, Simple Language Design Principles Finite Automata State Graphs A state: The start state: An accepting state: A transition: a A Simple Example A finite
More informationTheory of Computation Prof. Raghunath Tewari Department of Computer Science and Engineering Indian Institute of Technology, Kanpur
Theory of Computation Prof. Raghunath Tewari Department of Computer Science and Engineering Indian Institute of Technology, Kanpur Lecture 01 Introduction to Finite Automata Welcome everybody. This is
More information1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}
CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in
More informationImplementation of Lexical Analysis. Lecture 4
Implementation of Lexical Analysis Lecture 4 1 Tips on Building Large Systems KISS (Keep It Simple, Stupid!) Don t optimize prematurely Design systems that can be tested It is easier to modify a working
More informationFinite automata. We have looked at using Lex to build a scanner on the basis of regular expressions.
Finite automata We have looked at using Lex to build a scanner on the basis of regular expressions. Now we begin to consider the results from automata theory that make Lex possible. Recall: An alphabet
More information6 NFA and Regular Expressions
Formal Language and Automata Theory: CS21004 6 NFA and Regular Expressions 6.1 Nondeterministic Finite Automata A nondeterministic finite automata (NFA) is a 5-tuple where 1. is a finite set of states
More informationCS2 Practical 2 CS2Ah
CS2 Practical 2 Finite automata This practical is based on material in the language processing thread. The practical is made up of two parts. Part A consists of four paper and pencil exercises, designed
More informationTheory 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
More informationLimitations 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
More information3.15: Applications of Finite Automata and Regular Expressions. Representing Character Sets and Files
3.15: Applications of Finite Automata and Regular Expressions In this section we consider three applications of the material from Chapter 3: searching for regular expressions in files; lexical analysis;
More informationLecture 2 Finite Automata
Lecture 2 Finite Automata August 31, 2007 This lecture is intended as a kind of road map to Chapter 1 of the text just the informal examples that I ll present to motivate the ideas. 1 Expressions without
More informationDr. D.M. Akbar Hussain
1 2 Compiler Construction F6S Lecture - 2 1 3 4 Compiler Construction F6S Lecture - 2 2 5 #include.. #include main() { char in; in = getch ( ); if ( isalpha (in) ) in = getch ( ); else error (); while
More informationMidterm I (Solutions) CS164, Spring 2002
Midterm I (Solutions) CS164, Spring 2002 February 28, 2002 Please read all instructions (including these) carefully. There are 9 pages in this exam and 5 questions, each with multiple parts. Some questions
More informationIntroduction to Lexical Analysis
Introduction to Lexical Analysis Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexical analyzers (lexers) Regular
More informationlec3:nondeterministic finite state automata
lec3:nondeterministic finite state automata 1 1.introduction Nondeterminism is a useful concept that has great impact on the theory of computation. When the machine is in a given state and reads the next
More informationLexical Analysis. Chapter 2
Lexical Analysis Chapter 2 1 Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexers Regular expressions Examples
More informationLexical Error Recovery
Lexical Error Recovery A character sequence that can t be scanned into any valid token is a lexical error. Lexical errors are uncommon, but they still must be handled by a scanner. We won t stop compilation
More informationLexical Analysis. Implementation: Finite Automata
Lexical Analysis Implementation: Finite Automata Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs)
More informationTheory 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
More informationComputer 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.
More informationTheory of Languages and Automata
Theory of Languages and Automata Chapter 3- The Church-Turing Thesis Sharif University of Technology Turing Machine O Several models of computing devices Finite automata Pushdown automata O Tasks that
More informationLexical Analysis. Finite Automata. (Part 2 of 2)
# Lexical Analysis Finite Automata (Part 2 of 2) PA0, PA Although we have included the tricky file ends without a newline testcases in previous years, students made good cases against them (e.g., they
More informationAlternation. Kleene Closure. Definition of Regular Expressions
Alternation Small finite sets are conveniently represented by listing their elements. Parentheses delimit expressions, and, the alternation operator, separates alternatives. For example, D, the set of
More informationIntroduction to Lexing and Parsing
Introduction to Lexing and Parsing ECE 351: Compilers Jon Eyolfson University of Waterloo June 18, 2012 1 Riddle Me This, Riddle Me That What is a compiler? 1 Riddle Me This, Riddle Me That What is a compiler?
More informationLexical Analysis. Lecture 2-4
Lexical Analysis Lecture 2-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 2 1 Administrivia Moving to 60 Evans on Wednesday HW1 available Pyth manual available on line.
More informationApplications of Finite State Machines
15-453 Formal Languages, Automata, and Computation Applications of Finite State Machines Mihai Budiu Lecture 3 January 24, 2000 Formal languages and automata are probably the biggest success story of theoretical
More informationImplementation of Lexical Analysis
Outline Implementation of Lexical nalysis Specifying lexical structure using regular expressions Finite automata Deterministic Finite utomata (DFs) Non-deterministic Finite utomata (NFs) Implementation
More informationR10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?
R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that
More informationEquivalence of NTMs and TMs
Equivalence of NTMs and TMs What is a Turing Machine? Similar to a finite automaton, but with unlimited and unrestricted memory. It uses an infinitely long tape as its memory which can be read from and
More informationCMPSCI 250: Introduction to Computation. Lecture 20: Deterministic and Nondeterministic Finite Automata David Mix Barrington 16 April 2013
CMPSCI 250: Introduction to Computation Lecture 20: Deterministic and Nondeterministic Finite Automata David Mix Barrington 16 April 2013 Deterministic and Nondeterministic Finite Automata Deterministic
More informationDefinition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,
CMPSCI 601: Recall From Last Time Lecture 5 Definition: A context-free grammar (CFG) is a 4- tuple, variables = nonterminals, terminals, rules = productions,,, are all finite. 1 ( ) $ Pumping Lemma for
More informationCT32 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
More informationCS21 Decidability and Tractability
CS21 Decidability and Tractability Lecture 9 January 26, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis decidable, RE, co-re languages Deciding and Recognizing
More informationFormal languages and computation models
Formal languages and computation models Guy Perrier Bibliography John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman - Introduction to Automata Theory, Languages, and Computation - Addison Wesley, 2006.
More informationRegular Expression Constrained Sequence Alignment
Regular Expression Constrained Sequence Alignment By Abdullah N. Arslan Department of Computer science University of Vermont Presented by Tomer Heber & Raz Nissim otivation When comparing two proteins,
More informationContext Free Grammars. CS154 Chris Pollett Mar 1, 2006.
Context Free Grammars CS154 Chris Pollett Mar 1, 2006. Outline Formal Definition Ambiguity Chomsky Normal Form Formal Definitions A context free grammar is a 4-tuple (V, Σ, R, S) where 1. V is a finite
More informationKinder, Gentler Nation
Lexical Analysis Finite Automata (Part 2 of 2) # Kinder, Gentler Nation In our post drop-deadline world things get easier. While we re here: reading quiz. #2 Summary Regular expressions provide a concise
More informationLexical Error Recovery
Lexical Error Recovery A character sequence that can t be scanned into any valid token is a lexical error. Lexical errors are uncommon, but they still must be handled by a scanner. We won t stop compilation
More informationIntroduction to Computers & Programming
16.070 Introduction to Computers & Programming Theory of computation 5: Reducibility, Turing machines Prof. Kristina Lundqvist Dept. of Aero/Astro, MIT States and transition function State control A finite
More informationModel checking pushdown systems
Model checking pushdown systems R. Ramanujam Institute of Mathematical Sciences, Chennai jam@imsc.res.in Update Meeting, IIT-Guwahati, 4 July 2006 p. 1 Sources of unboundedness Data manipulation: integers,
More informationCS2 Language Processing note 3
CS2 Language Processing note 3 CS2Ah 5..4 CS2 Language Processing note 3 Nondeterministic finite automata In this lecture we look at nondeterministic finite automata and prove the Conversion Theorem, which
More informationTheory 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,
More informationTuring Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.
Turing Machines Transducers: A transducer is a finite state machine (FST) whose output is a string and not just accept or reject. Each transition of an FST is labeled with two symbols, one designating
More informationImplementation of Lexical Analysis
Written ssignments W assigned today Implementation of Lexical nalysis Lecture 4 Due in one week y 5pm Turn in In class In box outside 4 Gates Electronically Prof. iken CS 43 Lecture 4 Prof. iken CS 43
More informationImplementation of Lexical Analysis
Written ssignments W assigned today Implementation of Lexical nalysis Lecture 4 Due in one week :59pm Electronic hand-in Prof. iken CS 43 Lecture 4 Prof. iken CS 43 Lecture 4 2 Tips on uilding Large Systems
More information6.080 / Great Ideas in Theoretical Computer Science Spring 2008
MIT OpenCourseWare http://ocw.mit.edu 6.8 / 6.89 Great Ideas in Theoretical Computer Science Spring 28 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
More informationDefinition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.
CS533 Class 02b: 1 c P. Heeman, 2017 CNF Pushdown Automata Definition Equivalence Overview CS533 Class 02b: 2 c P. Heeman, 2017 Chomsky Normal Form Definition 2.8: A CFG is in Chomsky normal form if every
More informationSolutions to Homework 10
CS/Math 240: Intro to Discrete Math 5/3/20 Instructor: Dieter van Melkebeek Solutions to Homework 0 Problem There were five different languages in Problem 4 of Homework 9. The Language D 0 Recall that
More informationOptimizing Finite Automata
Optimizing Finite Automata We can improve the DFA created by MakeDeterministic. Sometimes a DFA will have more states than necessary. For every DFA there is a unique smallest equivalent DFA (fewest states
More informationLexical Analysis. Lecture 3-4
Lexical Analysis Lecture 3-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 3-4 1 Administrivia I suggest you start looking at Python (see link on class home page). Please
More informationInformatics 1 - Computation & Logic: Tutorial 5
Informatics - Computation & Logic: Tutorial 5 Computation: Introduction to Finite State Machines Week 7: 3 October - 4 November 206 Please attempt the entire worksheet in advance of the tutorial, and bring
More informationTheory of Computations Spring 2016 Practice Final Exam Solutions
1 of 8 Theory of Computations Spring 2016 Practice Final Exam Solutions Name: Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try
More information1.7 Limit of a Function
1.7 Limit of a Function We will discuss the following in this section: 1. Limit Notation 2. Finding a it numerically 3. Right and Left Hand Limits 4. Infinite Limits Consider the following graph Notation:
More informationCS5371 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
More informationEnumerations and Turing Machines
Enumerations and Turing Machines Mridul Aanjaneya Stanford University August 07, 2012 Mridul Aanjaneya Automata Theory 1/ 35 Finite Sets Intuitively, a finite set is a set for which there is a particular
More information1 Parsing (25 pts, 5 each)
CSC173 FLAT 2014 ANSWERS AND FFQ 30 September 2014 Please write your name on the bluebook. You may use two sides of handwritten notes. Perfect score is 75 points out of 85 possible. Stay cool and please
More informationCS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 5
CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 5 CS 536 Spring 2015 1 Multi Character Lookahead We may allow finite automata to look beyond the next input character.
More informationRegular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.
Regular Languages (14 points) Problem 1 (6 points) inimize the following automaton Show that the resulting DFA is minimal. Solution: We apply the State Reduction by Set Partitioning algorithm (särskiljandealgoritmen)
More informationFormal Languages and Compilers Lecture VI: Lexical Analysis
Formal Languages and Compilers Lecture VI: Lexical Analysis Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/ Formal
More informationAutomating Construction of Lexers
Automating Construction of Lexers Regular Expression to Programs Not all regular expressions are simple. How can we write a lexer for (a*b aaa)? Tokenizing aaaab Vs aaaaaa Regular Expression Finite state
More information6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2
6.045J/18.400J: Automata, omputability and omplexity March 21, 2007 Practice Quiz 2 Prof. Nancy Lynch Elena Grigorescu Please write your name in the upper corner of each page. INFORMATION ABOUT QUIZ 2:
More informationFormal Languages and Automata
Mobile Computing and Software Engineering p. 1/3 Formal Languages and Automata Chapter 3 Regular languages and Regular Grammars Chuan-Ming Liu cmliu@csie.ntut.edu.tw Department of Computer Science and
More informationMaterial from Recitation 1
Material from Recitation 1 Darcey Riley Frank Ferraro January 18, 2011 1 Introduction In CSC 280 we will be formalizing computation, i.e. we will be creating precise mathematical models for describing
More informationModeling of Finite State Machines. Debdeep Mukhopadhyay
Modeling of Finite State Machines Debdeep Mukhopadhyay Definition 5 Tuple: (Q,Σ,δ,q 0,F) Q: Finite set of states Σ: Finite set of alphabets δ: Transition function QχΣ Q q 0 is the start state F is a set
More informationA Scanner should create a token stream from the source code. Here are 4 ways to do this:
Writing A Scanner A Scanner should create a token stream from the source code. Here are 4 ways to do this: A. Hack something together till it works. (Blech!) B. Use the language specs to produce a Deterministic
More informationLexical Analysis. COMP 524, Spring 2014 Bryan Ward
Lexical Analysis COMP 524, Spring 2014 Bryan Ward Based in part on slides and notes by J. Erickson, S. Krishnan, B. Brandenburg, S. Olivier, A. Block and others The Big Picture Character Stream Scanner
More informationECS 120 Lesson 16 Turing Machines, Pt. 2
ECS 120 Lesson 16 Turing Machines, Pt. 2 Oliver Kreylos Friday, May 4th, 2001 In the last lesson, we looked at Turing Machines, their differences to finite state machines and pushdown automata, and their
More informationConverting 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
More informationCS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata
Solved Subjective From Midterm Papers Dec 07,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM SPRING 2012 Q. Point of Kleen Theory. Answer:- (Page 25) 1. If a language can be accepted
More informationFinite Automata and Scanners
Finite Automata and Scanners A finite automaton (FA) can be used to recognize the tokens specified by a regular expression. FAs are simple, idealized computers that recognize strings belonging to regular
More informationRegular Languages. MACM 300 Formal Languages and Automata. Formal Languages: Recap. Regular Languages
Regular Languages MACM 3 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop The set of regular languages: each element is a regular language Each regular language is an example of a
More information(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar
Code No: R05310501 Set No. 1 III B.Tech I Semester Regular Examinations, November 2008 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE
More informationCISC 4090 Theory of Computation
CISC 4090 Theory of Computation Turing machines Professor Daniel Leeds dleeds@fordham.edu JMH 332 Alan Turing (1912-1954) Father of Theoretical Computer Science Key figure in Artificial Intelligence Codebreaker
More informationAdministrivia. Lexical Analysis. Lecture 2-4. Outline. The Structure of a Compiler. Informal sketch of lexical analysis. Issues in lexical analysis
dministrivia Lexical nalysis Lecture 2-4 Notes by G. Necula, with additions by P. Hilfinger Moving to 6 Evans on Wednesday HW available Pyth manual available on line. Please log into your account and electronically
More informationNFAs and Myhill-Nerode. CS154 Chris Pollett Feb. 22, 2006.
NFAs and Myhill-Nerode CS154 Chris Pollett Feb. 22, 2006. Outline Bonus Questions Equivalence with Finite Automata Myhill-Nerode Theorem. Bonus Questions These questions are open to anybody. I will only
More informationVariants of Turing Machines
November 4, 2013 Robustness Robustness Robustness of a mathematical object (such as proof, definition, algorithm, method, etc.) is measured by its invariance to certain changes Robustness Robustness of
More informationAbout the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design
i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target
More informationUNIT -2 LEXICAL ANALYSIS
OVER VIEW OF LEXICAL ANALYSIS UNIT -2 LEXICAL ANALYSIS o To identify the tokens we need some method of describing the possible tokens that can appear in the input stream. For this purpose we introduce
More informationCS52 - Assignment 10
CS52 - Assignment 10 Due Wednesday 12/9 at 7:00pm https://xkcd.com/205/ Important Notice Assignments 9 and 10 are due at the same time. This is to give you maximum flexibility in scheduling during the
More informationIntroduction to Parsing. Lecture 5
Introduction to Parsing Lecture 5 1 Outline Regular languages revisited Parser overview Context-free grammars (CFG s) Derivations Ambiguity 2 Languages and Automata Formal languages are very important
More informationThe Language for Specifying Lexical Analyzer
The Language for Specifying Lexical Analyzer We shall now study how to build a lexical analyzer from a specification of tokens in the form of a list of regular expressions The discussion centers around
More informationCompiler phases. Non-tokens
Compiler phases Compiler Construction Scanning Lexical Analysis source code scanner tokens regular expressions lexical analysis Lennart Andersson parser context free grammar Revision 2011 01 21 parse tree
More informationChapter 14: Pushdown Automata
Chapter 14: Pushdown Automata Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu The corresponding textbook chapter should
More informationCSc 453 Lexical Analysis (Scanning)
CSc 453 Lexical Analysis (Scanning) Saumya Debray The University of Arizona Tucson Overview source program lexical analyzer (scanner) tokens syntax analyzer (parser) symbol table manager Main task: to
More informationFront End: Lexical Analysis. The Structure of a Compiler
Front End: Lexical Analysis The Structure of a Compiler Constructing a Lexical Analyser By hand: Identify lexemes in input and return tokens Automatically: Lexical-Analyser generator We will learn about
More information14.1 Encoding for different models of computation
Lecture 14 Decidable languages In the previous lecture we discussed some examples of encoding schemes, through which various objects can be represented by strings over a given alphabet. We will begin this
More informationRational subsets in HNN-extensions
Rational subsets in HNN-extensions G. Sénizergues joint work with M. Lohrey ROUPE DE TRAVAIL-LGL-28/02/06 1 0- PLAN 0 INTRODUCTION 0.1 Problems 0.2 Motivations 0.3 Results 0.4 Tools 1- HNN EXTENSIONS 1.1
More informationRecursively Enumerable Languages, Turing Machines, and Decidability
Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm
More informationInterpreter. Scanner. Parser. Tree Walker. read. request token. send token. send AST I/O. Console
Scanning 1 read Interpreter Scanner request token Parser send token Console I/O send AST Tree Walker 2 Scanner This process is known as: Scanning, lexing (lexical analysis), and tokenizing This is the
More informationCS402 - 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
More informationMultiple Choice Questions
Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM
More informationError-Correcting Codes
Error-Correcting Codes Michael Mo 10770518 6 February 2016 Abstract An introduction to error-correcting codes will be given by discussing a class of error-correcting codes, called linear block codes. The
More information