FORMAL LANGUAGES, GRAMMARS, AND AUTOMATA

Size: px
Start display at page:

Download "FORMAL LANGUAGES, GRAMMARS, AND AUTOMATA"

Transcription

1 FORMAL LANGUAGES, GRAMMARS, AND AUTOMATA Outline of theory of computationm What is a language? May refer either to the (human) capacity for acquiring and using complex systems of communication, or to a specific c instance of such a system of complex communication. 1

2 WHAT IS AUTOMATA THEORY? Study of abstract computing devices, or machines Automaton = an abstract computing device Note: A device need not even be a physical hardware! A fundamental question in computer science: Find out what different models of machines can do and cannot do The theory of computation 3 (A pioneer of automata theory) ALAN TURING ( ) Father of Modern Computer Science English mathematician Studied abstract machines called Turing machines even before computers existed Heard of the Turing test? 4 2

3 THEORY OF COMPUTATION: A HISTORICAL PERSPECTIVE 1930s Alan Turing studies Turing machines Decidability Halting problem s Finite automata machines studied Noam Chomsky proposes the Chomsky Hierarchy for formal languages 1969 Cook introduces intractable problems or NP-Hard problems Modern computer science: compilers, computational & complexity theory evolve 5 LANGUAGES & GRAMMARS Or words Languages: A language is a collection of sentences of finite length all constructed from a finite alphabet of symbols Grammars: A grammar can be regarded as a device that enumerates the sentences of a language - nothing more, nothing less 6 Image source: Nowak et al. Nature, vol 417,

4 THE CHOMSKY HIERACHY A containment hierarchy of classes of formal languages Regular (DFA) Contextfree (PDA) Contextsensitive (LBA) Recursivelyenumerable (TM) 7 AUTOMATA Finite Automata Pushdown Automata Linear Bounded Automata Turing Machines 4

5 THE CENTRAL CONCEPTS OF AUTOMATA THEORY 9 ALPHABET An alphabet is a finite, non-empty set of symbols We use the symbol (sigma) to denote an alphabet Examples: Binary: = {0,1} All lower case letters: = {a,b,c,..z} Alphanumeric: = {a-z, A-Z, 0-9} DNA molecule letters: = {a,c,g,t} 10 5

6 STRINGS A string or word is a finite sequence of symbols chosen from Empty string is (or epsilon ) Length of a string w, denoted by w, is equal to the number of (non- ) characters in the string E.g., x = x = 6 x = x =? xy = concatentation of two strings x and y 11 STRINGS Operator Power Concatenate x = a y = bc x y = abc s = s s = s Substring x = bc Reflection x = ab y = ba Power sn = s s s.. s ( n times) s 0 = x = a x 4 = aaaa Let be an alphabet. k = the set of all strings of length k * = 0 U 1 U 2 U + = 1 U 2 U 3 U 12 6

7 LANGUAGES L is a said to be a language over alphabet, only if L * this is because * is the set of all strings (of all possible length including 0) over the given alphabet Examples: Let L be the language of all strings consisting of n 0 s followed by n 1 s: L = {,01,0011,000111, } Let L be the language of all strings of with equal number of 0 s and 1 s: L = {,01,10,0011,1100,0101,1010,1001, } 13 CARDINALITY Language cardinality: number of strings in the language Cardinality language L L Finite language -> Finite cardinality Definition: Ø denotes the Empty language Let L1 = { }; Is L2=Ø? No L1 = 1 L2 = 0 7

8 LANGUAGE OPERATION Concatenation L1 = {a, b} L2 = {c, d} L = L1 L2 = = {xy x L1, y L2} = = {ac, ad, bc, bd} Union L1 = {a, b} L2 = {c, d} L = L1 L2= = {x L1 L2} = = {a, b, c, d} KLEENE STAR Given a set (alphabet) define 0 = { } (the language consisting only of the empty word), 1 = (the language consisting only of string of length 1) and define recursively the set i+1 = * 1 If is a formal language, then i, the i-th power of the set, is a shorthand for the concatenation of set with itself i times. That is, - i can be understood to be the set of all strings that can be represented as the concatenation of i strings in. The definition of Kleene star on is n= 0 1 v2. n is Kleene plus n= 1 v2. n 8

9 THE MEMBERSHIP PROBLEM Given a string w *and a language L over, decide whether or not w L. Example: Let w = Is w the language of strings with equal number of 0s and 1s? 17 GRAMMARS A formal grammar G is any compact, precise mathematical definition of a language L. As opposed to just a raw listing of all of the language s legal sentences, or just examples of them. A grammar implies an algorithm that would generate all legal sentences of the language. Often, it takes the form of a set of recursive definitions. A popular way to specify a grammar recursively is to specify it as a phrase-structure grammar. 9

10 PHRASE-STRUCTURE GRAMMARS A phrase-structure grammar (abbr. PSG) G = (V,T,S,P) is a 4-tuple, in which: V is a set of special words called nonterminals. (Representing concepts like noun ). T is a set of words called terminals Actual words of the language. S V is a special nonterminal, the start symbol. P is a set of productions (to be defined). Rules for substituting one sentence fragment for another. A phrase-structure grammar is a special case of the more general concept of a string-rewriting system, due to Post. PRODUCTIONS A production p P is a pair p=(, ) of sentence fragments (not necessarily in L), which may generally contain a mix of both terminals and nonterminals that is,, (V T)* We often denote the production a. Read goes to (like a directed graph edge) Call the before string, the after string. It is a kind of recursive definition meaning that If l r LT, then l r LT. Language tamplate for the grammar G That is, if l r is a legal sentence template, then so is l r. That is, we can substitute in place of in any sentence template. A phrase-structure grammar imposes the constraint that each Language Template must contain a nonterminal symbol. 10

11 LANGUAGES FROM PSGS The recursive definition of the language G(L) (language generated by G), or simply L. defined by the PSG: G = (V, T, S, P): Rule 1: S LT (LT is L s template language) The start symbol is a sentence template (member of LT). Rule 2: ( ) P: l,r (V T)*: l r LT l r LT Any production, after substituting in any fragment of any sentence template, yields another sentence template. l r l r. (read, l r is derivable from l r ). Rule 3: ( σ LT: n V: n σ) σ L All sentence templates that contain no nonterminal symbols are sentences in L. Abbreviate this using lbr lar. (read, lar is directly derivable from lbr ). PSG EXAMPLE ENGLISH FRAGMENT We have G = (V, T, S, P), where: V = {(sentence), (noun phrase), (verb phrase), (article), (adjective), (noun), (verb), (adverb)} T = {a, the, large, hungry, rabbit, mathematician, eats, hops, quickly, wildly} S = (sentence) P = { (sentence) (noun phrase) (verb phrase), (noun phrase) (article) (adjective) (noun), (noun phrase) (article) (noun), (verb phrase) (verb) (adverb), (verb phrase) (verb), (article) a, (article) the, (adjective) large, (adjective) hungry, (noun) rabbit, (noun) mathematician, (verb) eats, (verb) hops, (adverb) quickly, (adverb) wildly } 11

12 BACKUS-NAUR FORM sentence ::= noun phrase verb phrase noun phrase ::= article [ adjective ] noun verb phrase ::= verb [ adverb ] article ::= a the adjective ::= large hungry noun ::= rabbit mathematician verb ::= eats hops adverb ::= quickly wildly Square brackets [] mean optional Vertical bars mean alternatives A SAMPLE SENTENCE DERIVATION (sentence) (noun phrase) (verb phrase) (article) (adj.) (noun) (verb phrase) the (adj.) (noun) (verb phrase) the (adj.) (noun) (verb) (adverb) the large (noun) (verb) (adverb) the large rabbit (verb) (adverb) the large rabbit hops (adverb) the large rabbit hops quickly 12

13 ANOTHER EXAMPLE Let G = (V,P,S,T} V= {A,B,S} T = {a,b } P = {S ABa, A BB, B ab, AB b}). One possible derivation in this grammar is: S ABa Aaba BBaba Bababa abababa. DERIVABILITY Recall that the notation w 0 w 1 means that ( ) P: l,r (V T)*: w 0 = l r w 1 = l r. The template w 1 is directly derivable from w 0. If w 2, w n-1 : w 0 w 1 w 2 w n, then we write w 0 * w n, and say that w n is derivable from w 0. The sequence of steps w i w i+1 is called a derivation of w n from w 0. Note that the relation * is just the transitive closure of the relation. 13

14 A SIMPLE DEFINITION OF L(G) The language L(G) (or just L) that is generated by a given phrase-structure grammar G=(V,T,S,P) can be defined by: L(G) = {w T* S * w} That is, L is simply the set of strings of terminals that are derivable from the start symbol. LANGUAGE GENERATED BY A GRAMMAR Example: Let G = ({S,A,a,b},{a,b}, S, {S aa, S b, A aa}). What is L(G)? Easy: We can just draw a tree of all possible derivations. We have: S aa aaa. and S b. Answer: L = {aaa, b}. aa aaa S b Example of a derivation tree or parse tree or sentence diagram. 14

15 GENERATING INFINITE LANGUAGES A simple PSG can easily generate an infinite language. Example: S 11S, S 0 (T = {0,1}). The derivations are: S 0 S 11S 110 S 11S 1111S and so on L = {(11)*0} the set of all strings consisting of some number of concatenations of 11 with itself, followed by 0. ANOTHER EXAMPLE Construct a PSG that generates the language L = {0 n 1 n n N}. 0 and 1 here represent symbols being concatenated n times, not integers being raised to the nth power. Solution strategy: Each step of the derivation should preserve the invariant that the number of 0 s = the number of 1 s in the template so far, and all 0 s come before all 1 s. Solution: S 0S1, S. 15

16 TYPES OF GRAMMARS - CHOMSKY HIERARCHY OF LANGUAGES Venn Diagram of Grammar Types: Type 0 Phrase-structure Grammars Type 1 Context-Sensitive Type 2 Context-Free Type 3 Regular DEFINING THE PSG TYPES Type 1: Context-Sensitive PSG: All after fragments are either longer than the corresponding before fragments, or empty: if, then < =. Type 2: Context-Free PSG: All before fragments have length 1: if, then = 1 ( V). Type 3: Regular PSGs: All after fragments are either single terminals, or a pair of a terminal followed by a nonterminal. if, then T TV. 16

17 CLASSIFYING GRAMMARS Given a grammar, we need to be able to find the smallest class in which it belongs. This can be determined by answering three questions: Are the left hand sides of all of the productions single non-terminals? If yes, does each of the productions create at most one non-terminal and is it on the right? Yes regular No context-free If not, can any of the rules reduce the length of a string of terminals and non-terminals? Yes unrestricted No context-sensitive Example The language { a n b n n 1} is context free. A grammar for this language is given by: S asb ab A derivation from this grammar is:- S asb aasbb (using S asb) aaabbb (using S ab) which derives a 3 b 3 17

18 Example The language { a n b n c n n 1} is contextsensitive but not context free. A grammar for this language is given by: S asbc abc CB BC ab ab bb bb bc bc cc cc A derivation from this grammar is:- S asbc aabcbc (using S abc) aabcbc (using ab ab) aabbcc (using CB BC) aabbcc (using bb bb) aabbcc (using bc bc) aabbcc (using cc cc) which derives a 2 b 2 c 2. 18

Introduction to Automata Theory. Reading: Chapter 1

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

More information

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 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

More information

Automata and Formal Languages

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,

More information

The Halting Problem is Undecidable

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

More information

Reading 13 : Finite State Automata and Regular Expressions

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

More information

Regular Languages and Finite State Machines

Regular Languages and Finite State Machines Regular Languages and Finite State Machines Plan for the Day: Mathematical preliminaries - some review One application formal definition of finite automata Examples 1 Sets A set is an unordered collection

More information

C H A P T E R Regular Expressions regular expression

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

More information

Automata and Computability. Solutions to Exercises

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

More information

Turing Machines: An Introduction

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,

More information

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

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.

More information

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

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

More information

2110711 THEORY of COMPUTATION

2110711 THEORY of COMPUTATION 2110711 THEORY of COMPUTATION ATHASIT SURARERKS ELITE Athasit Surarerks ELITE Engineering Laboratory in Theoretical Enumerable System Computer Engineering, Faculty of Engineering Chulalongkorn University

More information

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 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)

More information

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi Automata Theory Automata theory is the study of abstract computing devices. A. M. Turing studied an abstract machine that had all the capabilities of today s computers. Turing s goal was to describe the

More information

CS5236 Advanced Automata Theory

CS5236 Advanced Automata Theory 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

More information

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. 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

More 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 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

More information

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

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

More information

Overview of E0222: Automata and Computability

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

More information

Compiler Construction

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

More information

Formal Grammars and Languages

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,

More information

Scanner. tokens scanner parser IR. source code. errors

Scanner. tokens scanner parser IR. source code. errors Scanner source code tokens scanner parser IR errors maps characters into tokens the basic unit of syntax x = x + y; becomes = + ; character string value for a token is a lexeme

More information

Computability Theory

Computability Theory CSC 438F/2404F Notes (S. Cook and T. Pitassi) Fall, 2014 Computability Theory This section is partly inspired by the material in A Course in Mathematical Logic by Bell and Machover, Chap 6, sections 1-10.

More information

3515ICT Theory of Computation Turing Machines

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

More information

Fundamentele Informatica II

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

More information

Learning Analysis by Reduction from Positive Data

Learning Analysis by Reduction from Positive Data Learning Analysis by Reduction from Positive Data František Mráz 1, Friedrich Otto 1, and Martin Plátek 2 1 Fachbereich Mathematik/Informatik, Universität Kassel 34109 Kassel, Germany {mraz,otto}@theory.informatik.uni-kassel.de

More information

Genetic programming with regular expressions

Genetic programming with regular expressions Genetic programming with regular expressions Børge Svingen Chief Technology Officer, Open AdExchange bsvingen@openadex.com 2009-03-23 Pattern discovery Pattern discovery: Recognizing patterns that characterize

More information

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP International Journal of Information and Computation Technology. ISSN 0974-2239 Volume 4, Number 1 (2014), pp. 79-84 International Research Publications House http://www. irphouse.com /ijict.htm Implementation

More information

Properties of Stabilizing Computations

Properties of Stabilizing Computations Theory and Applications of Mathematics & Computer Science 5 (1) (2015) 71 93 Properties of Stabilizing Computations Mark Burgin a a University of California, Los Angeles 405 Hilgard Ave. Los Angeles, CA

More information

CAs and Turing Machines. The Basis for Universal Computation

CAs and Turing Machines. The Basis for Universal Computation CAs and Turing Machines The Basis for Universal Computation What We Mean By Universal When we claim universal computation we mean that the CA is capable of calculating anything that could possibly be calculated*.

More information

Regular Languages and Finite Automata

Regular Languages and Finite Automata Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

More information

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

(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

More information

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions CSC45 AUTOMATA 2. Finite Automata: Examples and Definitions Finite Automata: Examples and Definitions A finite automaton is a simple type of computer. Itsoutputislimitedto yes to or no. It has very primitive

More information

How To Compare A Markov Algorithm To A Turing Machine

How To Compare A Markov Algorithm To A Turing Machine Markov Algorithm CHEN Yuanmi December 18, 2007 1 Abstract Markov Algorithm can be understood as a priority string rewriting system. In this short paper we give the definition of Markov algorithm and also

More information

Pushdown Automata. International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain

Pushdown Automata. International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain Pushdown Automata transparencies made for a course at the International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain Hendrik Jan Hoogeboom, Leiden http://www.liacs.nl/

More information

Lecture 2: Regular Languages [Fa 14]

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.

More information

CS 3719 (Theory of Computation and Algorithms) Lecture 4

CS 3719 (Theory of Computation and Algorithms) Lecture 4 CS 3719 (Theory of Computation and Algorithms) Lecture 4 Antonina Kolokolova January 18, 2012 1 Undecidable languages 1.1 Church-Turing thesis Let s recap how it all started. In 1990, Hilbert stated a

More information

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. 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

More information

Introduction to Finite Automata

Introduction to Finite Automata Introduction to Finite Automata Our First Machine Model Captain Pedro Ortiz Department of Computer Science United States Naval Academy SI-340 Theory of Computing Fall 2012 Captain Pedro Ortiz (US Naval

More information

Introduction to Turing Machines

Introduction to Turing Machines Automata Theory, Languages and Computation - Mírian Halfeld-Ferrari p. 1/2 Introduction to Turing Machines SITE : http://www.sir.blois.univ-tours.fr/ mirian/ Automata Theory, Languages and Computation

More information

Model 2.4 Faculty member + student

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

More information

Learning Automata and Grammars

Learning Automata and Grammars WDS'11 Proceedings of Contributed Papers, Part I, 125 130, 2011. ISBN 978-80-7378-184-2 MATFYZPRESS Learning Automata and Grammars P. Černo Charles University, Faculty of Mathematics and Physics, Prague,

More information

Regular Expressions and Automata using Haskell

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

More information

5HFDOO &RPSLOHU 6WUXFWXUH

5HFDOO &RPSLOHU 6WUXFWXUH 6FDQQLQJ 2XWOLQH 2. Scanning The basics Ad-hoc scanning FSM based techniques A Lexical Analysis tool - Lex (a scanner generator) 5HFDOO &RPSLOHU 6WUXFWXUH 6RXUFH &RGH /H[LFDO $QDO\VLV6FDQQLQJ 6\QWD[ $QDO\VLV3DUVLQJ

More information

Theory of Computation Class Notes 1

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

More information

Compiler I: Syntax Analysis Human Thought

Compiler I: Syntax Analysis Human Thought Course map Compiler I: Syntax Analysis Human Thought Abstract design Chapters 9, 12 H.L. Language & Operating Sys. Compiler Chapters 10-11 Virtual Machine Software hierarchy Translator Chapters 7-8 Assembly

More information

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

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

More information

Lexical analysis FORMAL LANGUAGES AND COMPILERS. Floriano Scioscia. Formal Languages and Compilers A.Y. 2015/2016

Lexical analysis FORMAL LANGUAGES AND COMPILERS. Floriano Scioscia. Formal Languages and Compilers A.Y. 2015/2016 Master s Degree Course in Computer Engineering Formal Languages FORMAL LANGUAGES AND COMPILERS Lexical analysis Floriano Scioscia 1 Introductive terminological distinction Lexical string or lexeme = meaningful

More information

Basic Set Theory. 1. Motivation. Fido Sue. Fred Aristotle Bob. LX 502 - Semantics I September 11, 2008

Basic Set Theory. 1. Motivation. Fido Sue. Fred Aristotle Bob. LX 502 - Semantics I September 11, 2008 Basic Set Theory LX 502 - Semantics I September 11, 2008 1. Motivation When you start reading these notes, the first thing you should be asking yourselves is What is Set Theory and why is it relevant?

More information

Finite Automata. Reading: Chapter 2

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

More information

Lecture 2: Universality

Lecture 2: Universality CS 710: Complexity Theory 1/21/2010 Lecture 2: Universality Instructor: Dieter van Melkebeek Scribe: Tyson Williams In this lecture, we introduce the notion of a universal machine, develop efficient universal

More information

Lecture 18 Regular Expressions

Lecture 18 Regular Expressions Lecture 18 Regular Expressions Many of today s web applications require matching patterns in a text document to look for specific information. A good example is parsing a html file to extract tags

More information

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

CSE 135: Introduction to Theory of Computation Decidability and Recognizability CSE 135: Introduction to Theory of Computation Decidability and Recognizability Sungjin Im University of California, Merced 04-28, 30-2014 High-Level Descriptions of Computation Instead of giving a Turing

More information

Models of Sequential Computation

Models of Sequential Computation Models of Sequential Computation 13 C H A P T E R Programming is often considered as an art, but it raises mostly practical questions like which language should I choose, which algorithm is adequate, and

More information

Course Manual Automata & Complexity 2015

Course Manual Automata & Complexity 2015 Course Manual Automata & Complexity 2015 Course code: Course homepage: Coordinator: Teachers lectures: Teacher exercise classes: Credits: X_401049 http://www.cs.vu.nl/~tcs/ac prof. dr. W.J. Fokkink home:

More information

Computer Architecture Syllabus of Qualifying Examination

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

More information

24 Uses of Turing Machines

24 Uses of Turing Machines Formal Language and Automata Theory: CS2004 24 Uses of Turing Machines 24 Introduction We have previously covered the application of Turing Machine as a recognizer and decider In this lecture we will discuss

More information

Fast nondeterministic recognition of context-free languages using two queues

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

More information

Automata on Infinite Words and Trees

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:

More information

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement

More information

LZ77. Example 2.10: Let T = badadadabaab and assume d max and l max are large. phrase b a d adadab aa b

LZ77. Example 2.10: Let T = badadadabaab and assume d max and l max are large. phrase b a d adadab aa b LZ77 The original LZ77 algorithm works as follows: A phrase T j starting at a position i is encoded as a triple of the form distance, length, symbol. A triple d, l, s means that: T j = T [i...i + l] =

More information

Computational Models Lecture 8, Spring 2009

Computational Models Lecture 8, Spring 2009 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown Univ. p. 1 Computational Models Lecture 8, Spring 2009 Encoding of TMs Universal Turing Machines The Halting/Acceptance

More information

Lecture 1. Basic Concepts of Set Theory, Functions and Relations

Lecture 1. Basic Concepts of Set Theory, Functions and Relations September 7, 2005 p. 1 Lecture 1. Basic Concepts of Set Theory, Functions and Relations 0. Preliminaries...1 1. Basic Concepts of Set Theory...1 1.1. Sets and elements...1 1.2. Specification of sets...2

More information

Universality in the theory of algorithms and computer science

Universality in the theory of algorithms and computer science Universality in the theory of algorithms and computer science Alexander Shen Computational models The notion of computable function was introduced in 1930ies. Simplifying (a rather interesting and puzzling)

More information

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. 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

More information

Turing Machines, Part I

Turing Machines, Part I Turing Machines, Part I Languages The $64,000 Question What is a language? What is a class of languages? Computer Science Theory 2 1 Now our picture looks like Context Free Languages Deterministic Context

More information

Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

More information

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

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

More information

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

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

More information

Introduction to Theory of Computation

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

More information

Informatique Fondamentale IMA S8

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

More information

Chapter 7 Uncomputability

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

More information

Deterministic Finite Automata

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

More information

On String Languages Generated by Spiking Neural P Systems

On String Languages Generated by Spiking Neural P Systems On String Languages Generated by Spiking Neural P Systems Haiming Chen 1, Rudolf Freund 2, Mihai Ionescu 3, Gheorghe Păun 4,5, Mario J. Pérez-Jiménez 5 1 Computer Science Laboratory, Institute of Software

More information

Online EFFECTIVE AS OF JANUARY 2013

Online EFFECTIVE AS OF JANUARY 2013 2013 A and C Session Start Dates (A-B Quarter Sequence*) 2013 B and D Session Start Dates (B-A Quarter Sequence*) Quarter 5 2012 1205A&C Begins November 5, 2012 1205A Ends December 9, 2012 Session Break

More information

Omega Automata: Minimization and Learning 1

Omega Automata: Minimization and Learning 1 Omega Automata: Minimization and Learning 1 Oded Maler CNRS - VERIMAG Grenoble, France 2007 1 Joint work with A. Pnueli, late 80s Summary Machine learning in general and of formal languages in particular

More information

Approximating Context-Free Grammars for Parsing and Verification

Approximating Context-Free Grammars for Parsing and Verification Approximating Context-Free Grammars for Parsing and Verification Sylvain Schmitz LORIA, INRIA Nancy - Grand Est October 18, 2007 datatype a option = NONE SOME of a fun filter pred l = let fun filterp (x::r,

More information

. 0 1 10 2 100 11 1000 3 20 1 2 3 4 5 6 7 8 9

. 0 1 10 2 100 11 1000 3 20 1 2 3 4 5 6 7 8 9 Introduction The purpose of this note is to find and study a method for determining and counting all the positive integer divisors of a positive integer Let N be a given positive integer We say d is a

More information

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

Ö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

More information

How To Understand The Theory Of Computer Science

How To Understand The Theory Of Computer Science Theory of Computation Lecture Notes Abhijat Vichare August 2005 Contents 1 Introduction 2 What is Computation? 3 The λ Calculus 3.1 Conversions: 3.2 The calculus in use 3.3 Few Important Theorems 3.4 Worked

More information

Chapter 6: Episode discovery process

Chapter 6: Episode discovery process Chapter 6: Episode discovery process Algorithmic Methods of Data Mining, Fall 2005, Chapter 6: Episode discovery process 1 6. Episode discovery process The knowledge discovery process KDD process of analyzing

More information

Grammars with Regulated Rewriting

Grammars with Regulated Rewriting Grammars with Regulated Rewriting Jürgen Dassow Otto-von-Guericke-Universität Magdeburg Fakultät für Informatik Lecture in the 5 th PhD Program Formal Languages and Applications PhD Program Formal Languages

More information

Lempel-Ziv Coding Adaptive Dictionary Compression Algorithm

Lempel-Ziv Coding Adaptive Dictionary Compression Algorithm Lempel-Ziv Coding Adaptive Dictionary Compression Algorithm 1. LZ77:Sliding Window Lempel-Ziv Algorithm [gzip, pkzip] Encode a string by finding the longest match anywhere within a window of past symbols

More information

Just the Factors, Ma am

Just the Factors, Ma am 1 Introduction Just the Factors, Ma am The purpose of this note is to find and study a method for determining and counting all the positive integer divisors of a positive integer Let N be a given positive

More information

THE LANGUAGE OF SETS AND SET NOTATION

THE LANGUAGE OF SETS AND SET NOTATION THE LNGGE OF SETS ND SET NOTTION Mathematics is often referred to as a language with its own vocabulary and rules of grammar; one of the basic building blocks of the language of mathematics is the language

More information

Dynamic Cognitive Modeling IV

Dynamic Cognitive Modeling IV Dynamic Cognitive Modeling IV CLS2010 - Computational Linguistics Summer Events University of Zadar 23.08.2010 27.08.2010 Department of German Language and Linguistics Humboldt Universität zu Berlin Overview

More information

Two-dimensional Languages

Two-dimensional Languages Charles University Faculty of Mathematics and Physics Mgr. Daniel Průša Two-dimensional Languages Doctoral Thesis Supervisor: Martin Plátek, CSc. Prague, 2004 Acknowledgements The results presented in

More information

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions Marcel B. Finan Arkansas Tech University c All Rights Reserved First Draft February 8, 2006 1 Contents 25

More information

Vocabulary Words and Definitions for Algebra

Vocabulary Words and Definitions for Algebra Name: Period: Vocabulary Words and s for Algebra Absolute Value Additive Inverse Algebraic Expression Ascending Order Associative Property Axis of Symmetry Base Binomial Coefficient Combine Like Terms

More information

Regular Languages and Finite Automata

Regular Languages and Finite Automata Regular Languages and Finite Automata A C Norman, Lent Term 1996 Part IA 1 Introduction This course is short, but it is present in Part 1A because of the way it introduces links between many different

More information

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a

More information

a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2.

a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2. Chapter 1 LINEAR EQUATIONS 1.1 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,..., a n, b are given

More information

Set Theory Basic Concepts and Definitions

Set Theory Basic Concepts and Definitions Set Theory Basic Concepts and Definitions The Importance of Set Theory One striking feature of humans is their inherent need and ability to group objects according to specific criteria. Our prehistoric

More information

Theory of Computation Chapter 2: Turing Machines

Theory of Computation Chapter 2: Turing Machines Theory of Computation Chapter 2: Turing Machines Guan-Shieng Huang Feb. 24, 2003 Feb. 19, 2006 0-0 Turing Machine δ K 0111000a 01bb 1 Definition of TMs A Turing Machine is a quadruple M = (K, Σ, δ, s),

More information

NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS. William Stallings NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

More information

Finite Automata and Regular Languages

Finite Automata and Regular Languages CHAPTER 3 Finite Automata and Regular Languages 3. Introduction 3.. States and Automata A finite-state machine or finite automaton (the noun comes from the Greek; the singular is automaton, the Greek-derived

More information

T-79.186 Reactive Systems: Introduction and Finite State Automata

T-79.186 Reactive Systems: Introduction and Finite State Automata T-79.186 Reactive Systems: Introduction and Finite State Automata Timo Latvala 14.1.2004 Reactive Systems: Introduction and Finite State Automata 1-1 Reactive Systems Reactive systems are a class of software

More information

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER JASPER DEANTONIO Abstract. This paper is a study of the Turing Degrees, which are levels of incomputability naturally arising from sets of natural numbers.

More information

TU e. Advanced Algorithms: experimentation project. The problem: load balancing with bounded look-ahead. Input: integer m 2: number of machines

TU e. Advanced Algorithms: experimentation project. The problem: load balancing with bounded look-ahead. Input: integer m 2: number of machines The problem: load balancing with bounded look-ahead Input: integer m 2: number of machines integer k 0: the look-ahead numbers t 1,..., t n : the job sizes Problem: assign jobs to machines machine to which

More information

CS 301 Course Information

CS 301 Course Information CS 301: Languages and Automata January 9, 2009 CS 301 Course Information Prof. Robert H. Sloan Handout 1 Lecture: Tuesday Thursday, 2:00 3:15, LC A5 Weekly Problem Session: Wednesday, 4:00 4:50 p.m., LC

More information