Automata and Formal Languages


 Rose McGee
 1 years ago
 Views:
Transcription
1 Automata and Formal Languages Winter Yacov HelOr 1
2 What this course is all about This course is about mathematical models of computation We ll study different machine models (finite automata, pushdown automata, Turing machine) and characterize what they can compute 2
3 Why should I care? To understand the limits of computations Some problems require more resources to compute and others cannot be computed at all. To learn some programming tools Automata show up in many different settings: compilers, text editors, hardware design, communication protocols, program proofing, To learn to think in a formal way about computing 3
4 Computability and Complexity Are there any problems that can not be solved by a (very powerful) computer? What makes some problems computationally hard and other easy? Can we partition the problems into classes such that problems in one class share the same computational properties? Complete answers: next semester. Introduction, basic tools, models, intuition: this semester. 4
5 This Course: Formal computational models The basic computational model : Finite State Automata Additional models: Pushdown automaton Turing machine Formal languages Regular languages Context free languages 5
6 Administration Course Home page: Lecture notes will appear at the course webpage the day before the lecture (the latest). Proofs, examples, technical details will usually be presented on the board. No recitations, part of lecture time will be dedicated to solving problems. Grade calculation: Exam 70%, HW 30% Exam: Must pass the exam (60) in order to have the HW component. 6
7 Administration (cont.) HW: Will be given every week. Submission: Wednesdays before your lecture. Appeals: No more than two weeks after return. Grader + TA: Ilit Raz Newsgroup: news://news.idc.ac.il/automata Book: Sipser (see webpage for details). 7
8 Unit 1 Introduction Mathematical Background Reading: Sipser, chapter 1 8
9 Today Set theory (review?) Logic, proofs (review?) Words and their operations: Languages and their operations: w i * 1 w2, w, w, w L i * 1 L2, L, L, L 9
10 Set Theory A Set is a group of objects. The objects are called elements. קבוצה, איבר Notation: 1. By listing the elements. Examples: {3,5,7}, {Alice, Bob, {1,2} } (for finite sets only) 2. By providing a rule. Examples: {x x is an odd integer between 2 and 8} ; {x name of a student in the Automata class} A name of a set is usually a capital letter of the English alphabet (A, B, C) or a capital letter with an index (X 1, X 2, X 3 ) 10
11 The Empty Set A set with no elements is called an empty set. Notation or { } Example: S  a set of all odd numbers that can be divided by two without any remainder. S is an empty set. הקבוצה הריקה S = {x N x is odd and x mod 2=0}= 11
12 Membership in a set s S, means that an element s is a member of the set S איבר בקבוצה b S, means that an element b is not a member of the set S Examples: 7 {21,7,30} and 8 {21,7,30} Let N be the set of natural numbers. 2 N and 3.2 N 12
13 Subsets Given two sets A and B we say that A is a subset of B, if each element of A is also an element of B. The notation: A B תת קבוצה מוכל Formally: A B x A x B Example: A set of natural numbers N is a subset of a set of all real numbers R. N R 13
14 Proper Subset Given two sets A and B we say that A is a proper subset of B if each element of A is also an element of B and there exists at least one element in B that does not belong to A. תת קבוצה ממש The notation: A B Example: {1,3} {1, 2, 3, 8} מוכל ממש 14
15 Some Facts Each set is a subset of itself: A A The empty set is a subset of every set: A 15
16 More on Sets Two groups of elements that have the same elements but in different order form the same set. Example: If A = { 1,2,3,4}, B = { 2,1,4,3} then A = B Repetitions in a set are irrelevant Example: {1,2,3,4,2} = {1,2,3,4} 16
17 More on Sets The cardinality of a set is the number of elements in the set. Notation: A עצמת הקבוצה Example: Let A = { 1,2,4,8,16}, then A =5 A set can be: Finite A={Even integers smaller than 100} Infinite A={Even integers dividing 7 with no reminder} 17
18 union intersection complement difference Operations on sets A visual model, called Venn diagram can be used. A 18
19 Venn Diagram Startt Endz Startj terrific theory topaz jazz 19
20 A binary operation The notation : A B Formally: Union A B = { x x A or x B } אחוד A B 20
21 A binary operation The notation: A B Formally: Intersection חיתוך A B = { x x A and x B } A B 21
22 Complement An unary operation The notation : ~A Formally: ~A = { x x A} משלים A 22
23 Set Difference An binary operation The notation : AB חיסור Formally: AB = { x x A and x B} Example: A = { 1,2,3 }, B={3,4,5}, AB={1,2} A B 23
24 Power Set The power set is the set of all subsets of a given set. Notation: P(S) or 2 S is a power set of S Note, that sets may appear as elements of other sets. Example: S = { 1,2 } P(S) = 2 S = {,{1},{2},{1,2}} קבוצת החזקה The cardinality of a power set is: 2 S (why?) 24
25 Sequences and Tuples A sequence of objects is a list of objects in some order. The notation : (7,21,57, ) Unlike sets, the order and repetitions in the sequence do matter, thus (7,21,57) (7,57,21) and (7,21,57,57) (7,21,57) A sequence with k elements is a ktuple Example: (7,21,57) is a 3tuple. סדרית קאיה 25
26 Cartesian product A binary operation The Cartesian product (or cross product) is a set of all pairs (2tuple) where the first element of the pair is in A and the second element of the pair is in B. The notation: A B A Cartesian product of a set with itself: A A A (k times)=a k Example: מכפלה חיצונית A = {2,3}, B = {b,c}, A B ={ (2,b), (2,c), (3,b), (3,c) } 26
27 Summary: sets,{ } a A A A B A B A B ~A AB 2 A (a,b,..) empty set membership cardinality subset union intersection complement set difference power set a sequence (ktuple) AxB cartesian product 27
28 Letters and Alphabet Any finite set of letters (symbols) is called an alphabet. Notation: alphabet ; Letter (symbol) אותיות Examples: = { 0,1 }, 1 =0 ; 2 =1; = { a,b,c,d,e, }, 1 =a ; 2 =b ; 3 =c ; = { 0,1,x,y,z} אלפבית, 28
29 Strings (and words) A string (word) over some alphabet is a finite sequence of letters from the alphabet. Example: = {0, 1}, w = 101 מחרוזת, מילה, סדרית The length of a word, w, denoted w, is the number of letters in it. Example: w 1 = abracadabra; w 1 = 11 w 2 = ; w 2 = 6 29
30 More on Strings An empty word is a string without letters. The notation of an empty word is = 0 המילה הריקה The number of occurrences of some letter in word w is denoted by # (W) Example: Let w=aaba, then # a (w)=3, # b (w)=1, # c (w)=0 30
31 Operations on Strings reverse substring prefix suffix concatenation 31
32 Reversing strings A reverse string is a string in which all letters are written in the opposite order Notation: w R Examples: w = 10, w R = 01 s = abcb, s R = bcba היפוך A palindrome: a string w such that w=w R. Examples: aba, , 32
33 Substrings A substring is a subsequence of consecutive letters from a string תת מחרוזת Example: Let w = 101. All substrings of w are: B(w) = {, 1, 0, 10, 01, 101 }. Note: 11 B(w) 33
34 Prefixes A prefix is a substring which starts from the first letter of the word (or an empty word). A proper prefix of a string is a prefix that is not equal to the complete word. רישא, רישא ממש Example: Let w = acdb. The prefixes of w are {, a,ac,acd,acdb}. acdb is not a proper prefix. 34
35 Suffixes A suffix is a substring ending with the last letter of the word or an empty word. A proper suffix of the string is a suffix that is not the whole word. Example: Let w = acdb. The suffixes of w are {,b, db,cdb,acdb}. acdb is not a proper suffix Note: The prefixes of w are the reversed suffixes of w R. סיפא, סיפא ממש 35
36 Concatenation A binary operation (over two words) The concatenation of two words x and y places them one after the other such that the first word is a prefix and a second one is a suffix. Notation: concatenation of two words x and y: xy שרשור Example: Let x= 01, y=012, z=10 Then xy=01012, yx=01201, xyz=
37 Concatenation (Cont.) The result of concatenating a word with an empty word is the string itself. For example, let w=ab, then w = w = w = ab Concatenating an empty word to itself results in an empty word: = = 37
38 Languages A language is a set of words (strings). A language can be finite or infinite. Notation: L (or with an index: L i ) The language of all words over some alphabet Σ is denoted Σ * (sigma star). שפה An empty language A language with zero words. השפה הריקה 38
39 Examples Infinite languages: L 1 = The language of all natural numbers over the decimal alphabet. L 2 = The language of all even length words over the binary alphabet. L 3 = The language of all strings over the binary alphabet that ends with 0. Finite languages: L 4 = {abc, bc} L 5 = The Language of natural numbers smaller than 5. L 6 = {words over Σ={0,1} whose binary value is as an odd number smaller than 325} 39
40 Operations over languages reverse concatenation iteration positive closure Kleene closure 40
41 Reverse Languages The reverse language L R is the language with all reversed words in it. Formally: L R ={ w w R L} שפה הפוכה Examples: L = {abc, bc}; L R = {cba, cb} L={0,00,0010}; L R = {0,00,0100} L= all binary words ={0,1}* ; L R = L (why?) 41
42 Concatenation A concatenation of two languages is a language in which each word is a concatenation of two words  one from the first language and a second from the second language. Formally: A B={w=ab a A and b B} Examples: L 1 = {ab, cd }; L 2 = {00, 1} ; L 3 ={0,10,110} L 1 L 2 = { ab00, ab1, cd00, cd1 } L 3 L 2 = { 000, 01, 1000, 101, 11000, 1101} שרשור שפות Note: the order is important (A B is different from B A ) 42
43 Concatenation v.s Cartesian Product Do not confuse concatenation of languages with Cartesian Product of sets. For example, let A = {0,00} then A A = { 00, 000, 0000 } with A A =3, A A = { (0,0), (0,00), (00,0), (00,00) } with A A =4 What is the cardinality of AxA v.s. A A? 43
44 Concatenation with special languages Concatenation with an empty language the result is an empty language. L = L = Concatenation with a language that includes only an empty word the result is the language itself. L { } = { } L = L 44
45 Iterations Kth iteration concatenation of the language with itself k times : L L L L (k times) Notation: L K Definition: L 0 = { } (for each L!) Examples: Let L 1 ={,00, 1} ; L 2 ={01, 1} L 12 = {,00, 1, 0000, 001, 100, 11} L 2 2 = {0101, 011, 101, 11} L 2 3 = {010101, 01011, 01101, 0111, 10101, 1011, 1101, 111} 45
46 Kleene (star) closure A Kleene closure is the union of all possible iterations of L: L i 0 L i { L 0 L 1 L 2...} סגור של קלין Notation: L * Examples: 1. Let L={a}, then L * = {, a, aa, aaa, aaaa. } 2. Let L={0,1} then L * ={all binary words} Note: for all L, L * 46
47 Positive closures A positive closure is a union of all positive iterations of L, not including the zero iteration: Notation: L + Examples: L i 1 L { L...} 1. Let L={a}, then L + = { a, aa, aaa, aaaa. } i 2.Let L={0,1} then L + ={all binary words of length > 0} 1 L 2 סגור חיובי 47
48 Problems concerning formal languages Is a given word a member of the language? Is the language infinite? Does the sequence of operations (steps) create (derive) a given word? Given a word and a sequence of basic steps does the result belongs to a given language? Given a grammar (a set of rules) what language does it create? 48
49 Practice Problems 1. Prove that L + = L * if and only if L 2. Prove that for any three languages (L 1 L 2 ) L 3 = L 1 L 3 L 2 L 3 3. For a given word w, define L 1 = {prefixes of w}; L 2 ={suffixes of w R } Prove that L 1 =L R 2 Answers: In class. 49
50 Types of Proofs Four main types: direct proof (syllogism) proof by construction proof by contradiction proof by induction 50
51 Direct proof axioms + theorems + rules of deduction theorems All students at IDC are nice. Danny is a student at IDC. Danny is nice. modus ponens: a b, a b a b, ~b ~a 51
52 Proof by Construction prove by building a solution (algorithm, automaton) Example: Claim: There exists a set with 4 elements. Proof: Here is such a set: A = {01, 001, 1, 1100} 52
53 Proof by Contradiction The idea: assume the opposite of the theorem derive a contradiction Example: Claim: There is an infinite number of integers. Proof: Assume the opposite, therefore, there is some largest integer. Denote it N. But N+1 is also an integer, and it is bigger than N A contradiction. 53
54 Another Example If there are more girls than boys and every girl is dating a boy, there must be a boy that s cheating Proof: Assume no boy is cheating, that is, each boy dates at most one girl, therefore, the total number of dating girls is at most the number of boys. Since every girl is dating a boy, the total number of girls is less or equal the number of boys. Contradicting the fact that there are more girls than boys. Note: This is called THE PIGEONHOLE PRINCIPLE: If you put 6 pigeons in 5 holes then at least one hole will have more than one pigeon. 54
55 Proof by Induction Induction has many appearances: Formal Arguments Loop Invariants Recursion Algorithm Design 55
56 Review: Induction Suppose S(k) is true for fixed constant k (often k=0) S(n) S(n+1) for all n >= k Then S(n) is true for all n >= k 56
57 Proof By Induction Claim:S(n) is true for all n >= k Base: Show S(n) is true for n = k Inductive hypothesis: Assume S(n) is true for an arbitrary n Step: Show that S(n+1) is true 57
58 Induction Example: Geometric Closed Form S(n)=a 0 + a a n Prove S(n)= (a n+11)/(a1) for all a 1 Proof: Base: S(0)=a 0 = (a 0+11)/(a  1)=1 Inductive hypothesis: Assume S(n)= (a n+11)/(a  1) Step (show true for n+1): S(n+1)=a 0 + a a n+1 = S(n) + a n+1 = (a n+11)/(a  1) + a n+1 = (a n+1+11)/(a  1) 58
59 Induction Another variation: Basis: show S(0), S(1) Hypothesis: assume S(n) and S(n+1) are true Step: show S(n+2) follows Another variation: Basis: show S(k) Hypothesis: assume S(n) Step: show S(n1) follows 59
60 E N D 60
Regular Expressions. Set operations provide a convenient way of specifying (certain) formal languages.
Regular Expressions Set operations provide a convenient way of specifying (certain) formal languages. Let Σ be an alphabet not containing the symbols (, ),, +, and. Regular expressions are strings built
More information1 Alphabets and Languages
1 Alphabets and Languages Look at handout 1 (inference rules for sets) and use the rules on some examples like {a} {{a}} {a} {a, b}, {a} {{a}}, {a} {{a}}, {a} {a, b}, a {{a}}, a {a, b}, a {{a}}, a {a,
More informationAutomata and Languages Computability Theory Complexity Theory
Theory of Computation Chapter 0: Introduction 1 What is this course about? This course is about the fundamental capabilities and limitations of computers/computation This course covers 3 areas, which make
More informationCS 341 Homework 9 Languages That Are and Are Not Regular
CS 341 Homework 9 Languages That Are and Are Not Regular 1. Show that the following are not regular. (a) L = {ww R : w {a, b}*} (b) L = {ww : w {a, b}*} (c) L = {ww' : w {a, b}*}, where w' stands for w
More informationFORMAL LANGUAGES, GRAMMARS, AND AUTOMATA
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
More informationTheory of computation: initial remarks
Theory of computation: initial remarks For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such. Turing machines
More informationAutomata Theory and Languages
Automata Theory and Languages SITE : http://www.info.univtours.fr/ mirian/ Automata Theory, Languages and Computation  Mírian HalfeldFerrari p. 1/1 Introduction to Automata Theory Automata theory :
More informationC H A P T E R Regular Expressions regular expression
7 CHAPTER Regular Expressions Most programmers and other powerusers 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 informationCS103B 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 informationStrings, Languages, and Regular expressions. Lecture 2
Strings, Languages, and Regular expressions Lecture 2 1 Strings 2 Definitions for strings alphabet Σ = finite set of symbols string = finite sequence of symbols of Σ length of a string w is denoted w.
More informationFormal Language Definitions
Formal Language Definitions Symbol A symbol is a character, glyph, mark. It is an abstract entity that has no meaning by itself. Letters from various alphabets, digits and special characters are the most
More informationProperties of ContextFree Languages. Decision Properties Closure Properties
Properties of ContextFree Languages Decision Properties Closure Properties 1 Summary of Decision Properties As usual, when we talk about a CFL we really mean a representation for the CFL, e.g., a CFG
More informationRegular expressions and finite automata
Regular expressions and finite automata Bakhadyr Khoussainov Computer Science Department, The University of Auckland, New Zealand bmk@cs.auckland.ac.nz Regular expressions are used in many programming
More informationWhat did we talk about last time? Simplifying FSAs Quotient automata
Week 14  Friday What did we talk about last time? Simplifying FSAs Quotient automata His Royal Badness PRINCE 19582016 A sociologist named McSnurd gave a talk about a community that has clubs with the
More informationReading 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 informationTheory of Computation
UofToronto ECE 1762 Fall, U of Toronto 1 Theory of Computation Theory of Computation ECE 1762 Algorithms and Data Structures Fall Semester, U of Toronto Computations are designed for processing information.
More informationRegular Expressions. Seungjin Choi
Regular Expressions Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongamro, Namgu, Pohang 37673, Korea seungjin@postech.ac.kr 1 / 27 Outline
More information6.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,QWURGXFWL W 7KHRU RI &RPSXWDWLRQ
,QWURGXFWL W 7KHRU RI $XWRPDWD )RUPD /DQJXDJHV &RPSXWDWLRQ (Feodor F. Dragan) Department of Computer Science Kent State University Spring, 2004 Automata & Formal Languages, Feodor F. Dragan, Kent State
More informationWhat did we talk about last time? Exam 3 Before review:
Week 13  Wednesday What did we talk about last time? Exam 3 Before review: Graphing functions Rules for manipulating asymptotic bounds Computing bounds for running time functions Ten people are marooned
More informationREGULAR LANGUAGES AND FINITE AUTOMATA (1)
REGULAR LANGUAGES AND FINITE AUTOMATA (1) October 12, 2009 Finite representations Languages definition Σ denotes the set of all sequences of strings that are composed of zero or more symbols of Σ. A language
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Regular Expressions and Finite Automata CMSC 330  Fall 2013 1 Introduction That s it for the basics of Ruby If you need other material for your project,
More informationÖVNINGSUPPGIFTER I RESTRIKTIONFRIA SPRÅK
ÖVNINGSUPPGIFTER I RESTRIKTIONFRIA SPRÅK RECURSIVELY ENUMERABLE LANGUAGES & TURING MACHINES TURING MACHINES Problem. CH9 Problem 3c (Sudkamp) Construct a Turing Machine with input alphabet {a, b} to perform:
More informationFormal 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 informationDefinition: String concatenation. Definition: String. Definition: Language (cont.) Definition: Language
CMSC 330: Organization of Programming Languages Regular Expressions and Finite Automata Introduction That s it for the basics of Ruby If you need other material for your project, come to office hours or
More informationLANGUAGES, REGULAR EXPRESSIONS, BNF GRAMMARS, FINITE STATE MACHINES
Languages LANGUAGES, REGULAR EXPRESSIONS, BNF GRAMMARS, FINITE STATE MACHINES As computer scientists, we concern ourselves with the study of formal languages rather than natural languages. A formal language
More informationCSCE 222 Discrete Structures for Computing. Hyunyoung Lee
CSCE 222 Discrete Structures for Computing! Formal Languages Hyunyoung Lee!!!!!! Based on slides by Andreas Klappenecker 1 Motivation The syntax of programming languages (such as Algol, C, Java) are described
More informationChapter 0 Mathematical Background. CS 341: Foundations of CS II. Contents
CS 341: Foundations of CS II Marvin K. Nakayama Computer Science Department New Jersey Institute of Technology Newark, NJ 07102 CS 341: Chapter 0 02 Contents Chapter 0 Mathematical Background Overview
More informationThe Regular Operations. The Regular Operations p.1/19
The Regular Operations The Regular Operations p.1/19 Introduction Once automata computation have been defined, their properties need be studied The Regular Operations p.2/19 Introduction Once automata
More informationthe lemma. Keep in mind the following facts about regular languages:
CPS 2: Discrete Mathematics Instructor: Bruce Maggs Assignment Due: Wednesday September 2, 27 A Tool for Proving Irregularity (25 points) When proving that a language isn t regular, a tool that is often
More informationEndTerm Examination Second Semester [MCA] MAYJUNE 2006
(Please write your Roll No. immediately) Roll No. Paper Code: MCA104 Paper ID: 44104 EndTerm Examination Second Semester [MCA] MAYJUNE 2006 Subject: Theory of Computation Time: 3 Hours Maximum Marks:
More informationTHEORY OF COMPUTATION LECTURE NOTES
THEORY OF COMPUTATION LECTURE NOTES (Subject Code: BCS303) for Bachelor of Technology in Computer Science and Engineering & Information Technology Department of Computer Science and Engineering & Information
More informationCSci 311, Models of Computation Chapter 7 Pushdown Automata
CSci 311, Models of Computation Chapter 7 Pushdown Automata H. Conrad Cunningham 29 December 2015 Contents Introduction................................. 1 7.1 Nondeterministic Pushdown Automata...............
More information1 Showing Languages are NonRegular
1 Showing Languages are NonRegular Question: How can one show that a language is not regular? We have no way to do this so far; constructing a finite automaton or a regular expression can only show a
More informationSets. A set is a collection of (mathematical) objects, with the collection treated as a single mathematical object.
Sets 1 Sets Informally: A set is a collection of (mathematical) objects, with the collection treated as a single mathematical object. Examples: real numbers, complex numbers, C integers, All students in
More informationCS 154. Finite Automata vs Regular Expressions, NonRegular Languages
CS 154 Finite Automata vs Regular Expressions, NonRegular Languages Deterministic Finite Automata Computation with finite memory NonDeterministic Finite Automata Computation with finite memory and guessing
More informationFinite and Infinite Sets. Countability. Proof Techniques (Chapter 1, Sections 1.4, 1.5)
Finite and Infinite Sets. Countability. Proof Techniques (Chapter 1, Sections 1.4, 1.5) Finite sets  finite number of elements  can be counted Infinite sets  infinite number of elements Equinumerous
More informationSome Definitions about Sets
Some Definitions about Sets Definition: Two sets are equal if they contain the same elements. I.e., sets A and B are equal if x[x A x B]. Notation: A = B. Recall: Sets are unordered and we do not distinguish
More information6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 7 Nancy Lynch
6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 7 Nancy Lynch Today Basic computability theory Topics: Decidable and recognizable languages
More informationTheory of Computation
GATE 067 Postal Correspondence Theory of Computation Computer Science & Information Technology (CS) 0 ank under AI 00 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts, Analysis
More informationMIDTERM SPRING 2012 CS402 Theory of Automata. Q. Difference and common between NFA & DFA Answer:
Solved Subjective Midterm Papers For Preparation of Midterm Exam Q. Point of Kleen Theory. Answer: (Page 25) 1. If a language can be accepted by an FA then it can be accepted by a TG as well. 2. If a
More informationCSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi
Finite State Machines Vending machine: The machine accepts nickels (5 cents), dimes (10 cents), and quarters (25 cents). When a total of 30 cents or more has been deposited, the machine immediately returns
More informationPumping Lemma and Closure Properties of CFL s
Pumping Lemma and Closure Properties of CFL s Mridul Aanjaneya Stanford University August 2, 2012 Mridul Aanjaneya Automata Theory 1/ 41 Pumping Lemma for CFL s: Intuition Recall the pumping lemma for
More informationRegular Expressions. and. The Limits of Regular Languages
Regular Expressions and The Limits of Regular Languages Announcements Midterm tonight in Cubberly Auditorium, 7PM 10PM. Openbook, opennote, opencomputer, closednetwork. Covers material up to and including
More informationElective: Coregroup: Pushdown Automaton (PDA), Deterministic Pushdown Automaton (DPDA), Nonequivalence of PDA and DPDA.
Coregroup: Finite Automata, Pushdown Automata. Nondeterminism and NFA, PA, and PAs and languges accepted by these structures. Grammars, Languagestypes of grammerstype, type, type 2 and type 3. The relationship
More informationCmSc 175 Discrete Mathematics Lesson 10: SETS A B, A B
CmSc 175 Discrete Mathematics Lesson 10: SETS Sets: finite, infinite, : empty set, U : universal set Describing a set: Enumeration = {a, b, c} Predicates = {x P(x)} Recursive definition, e.g. sequences
More informationAutomata 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 informationWe give a basic overview of the mathematical background required for this course.
1 Background We give a basic overview of the mathematical background required for this course. 1.1 Set Theory We introduce some concepts from naive set theory (as opposed to axiomatic set theory). The
More informationAutomata and Languages
Automata and Languages Computational Models: An idealized mathematical model of a computer. A computational model may be accurate in some ways but not in others. We shall be defining increasingly powerful
More informationReview of formal languages and automata theory
1 Review of formal languages and automata theory In this chapter we review material from a first course in the theory of computing. Much of this material should be familiar to you, but if not, you may
More informationInformation Science 2
Information Science 2 Finite State Automata and Turing Machines Week 14 College of Information Science and Engineering Ritsumeikan University Agenda Terms and concepts from Week 13 Computation and (abstract)
More informationChapter Prove or disprove: A (B C) = (A B) (A C). Ans: True, since
Chapter 2 1. Prove or disprove: A (B C) = (A B) (A C)., since A ( B C) = A B C = A ( B C) = ( A B) ( A C) = ( A B) ( A C). 2. Prove that A B= A B by giving a containment proof (that is, prove that the
More informationCS504Theory of Computation
CS504Theory of Computation Lecture 1: Introduction Waheed Noor Computer Science and Information Technology, University of Balochistan, Quetta, Pakistan Waheed Noor (CS&IT, UoB, Quetta) CS504Theory of
More informationDiscrete Mathematics Lecture 2 Logic of Quantified Statements, Methods of Proof, Set Theory, Number Theory Introduction and General Good Times
Discrete Mathematics Lecture 2 Logic of Quantified Statements, Methods of Proof, Set Theory, Number Theory Introduction and General Good Times Harper Langston New York University Predicates A predicate
More informationDecidable and Undecidable Languages
Recursively Enumerable The Halting Problem and The Return of Diagonalization Friday, November 11 and Tuesday, November 15, 2011 Reading: Sipser 4; Kozen 31; Stoughton 5.2 & 5.3 CS235 and Automata Department
More informationUnit 10. Turing machine Decidability Decision problems in FA
Unit 10 Turing machine Decidability Decision problems in FA 1 Turing Machines Proposed by Alan Turing, 1936. Unlimited and unrestricted memory. A model of a general purpose computer. Can do anything that
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105abc/ Today's learning goals Sipser Ch 2 Define push down automata Trace the computation of a push down automaton Design
More informationSolutions to Problem Set 5
V22.0453001 Theory of Computation November 17, 2003 TA: Nelly Fazio Solutions to Problem Set 5 Problem 1 A simple programming exercise: Write the quintuples for a Turing Machine that transforms a unary
More informationRecursion. Recursion. Recursion example. 22c:19 Chapter 8 Hantao Zhang. Recursion means defining something, such as a function, in terms of itself
Recursion 22c:9 Chapter 8 Hantao Zhang Recursion Recursion means defining something, such as a function, in terms of itself For example, let f(x) =x! We can define f(x) as f(x) = x * f(x) Sequences are
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Theory of Regular Expressions CMSC 330  Spring 2013 1 Introduction! That s it for the basics of Ruby If you need other material for your project, come to
More informationNotations:, {...} a S means that a is an element of S. a S means that a is not an element of S
Set Theory 1 Notations:, {....} Let S be a set (a collection of elements, with no duplicates) a S means that a is an element of S Example: 1 {1,2,3}, 3 {1,2,3} a S means that a is not an element of S Example:
More informationOverview. Relations and Their Properties Equivalence Relations Partial Orderings
Chapter 9 Overview Relations and Their Properties Equivalence Relations Partial Orderings Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R A B. Example:
More informationBut it is often needed to recognize this language Example: Programming language syntax have matching brackets, not regular.
Big picture All languages Decidable Turing machines NP P Contextfree Contextfree grammars, pushdown automata Regular Automata, nondeterministic automata, regular expressions Recall: Theorem: L := {0
More informationLecture 4: Regular Expressions
Lecture 4: Regular Expressions September 2, 216 CS 11 Theory of Computation We first review the key points about regular languages. A language L is regular if L = L(M) for a DFA M. Because any NFA N can
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTATION
FORMAL LANGUAGES, AUTOMATA AND COMPUTATION REGULAR LANGUAGES NONDETERMINISTIC FINITE STATE AUTOMATA Carnegie Mellon University in Qatar (CARNEGIE MELLON UNIVERSITY IN QATAR) SLIDES FOR 15453 LECTURE 3
More informationLanguages That Are and Are Not Regular
Languages That Are and Are ot Regular Read L & S 2.5, 2.6 Read Supplementary Materials: Regular Languages and Finite State Machines: The Pumping Lemma for Regular Languages. Do Homework 9. Deciding Whether
More informationCS 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 ChurchTuring thesis Let s recap how it all started. In 1990, Hilbert stated a
More informationA set is a Many that allows itself to be thought of as a One. (Georg Cantor)
Chapter 4 Set Theory A set is a Many that allows itself to be thought of as a One. (Georg Cantor) In the previous chapters, we have often encountered sets, for example, prime numbers form a set, domains
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, ContextFree Grammar s
More informationSome tokens have simple patterns. For instance, punctuation symbols are typically tokens that are also lexemes. Lexical analyzer
Lexical analyzer token: a terminal symbol in the grammar for the source language pattern: rule for describing the set of strings that can represent a token lexeme: a string in the source file that represents
More information60354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor
60354, Theory of Computation Fall 2013 Asish Mukhopadhyay School of Computer Science University of Windsor Formal Definition of a DFA A DFA is a 5tuple : (Q,, δ, 0, F) Q is the set of states is the input
More informationTheory of Computation (CS 46)
Theory of Computation (CS 46) Sets and Functions We write 2 A 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
More information(Refer Slide Time: 1:41)
Discrete Mathematical Structures Dr. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture # 10 Sets Today we shall learn about sets. You must
More informationFinal Exam CIS 341: Introduction to Logic and Automata Spring 2002, day sections Prof. Marvin K. Nakayama
Final Exam CIS 341: Introduction to Logic and Automata Spring 2002, day sections Prof. Marvin K. Nakayama Print Name: Student Number: I have read and understand all of the instructions below, and I will
More informationEquivalence of Pushdown Automata with ContextFree Grammar. Equivalence of Pushdown Automata with ContextFree Grammar p.1/45
Equivalence of Pushdown Automata with ContextFree Grammar Equivalence of Pushdown Automata with ContextFree Grammar p.1/45 Motivation CFG and PDA are equivalent in power: a CFG generates a contextfree
More informationMACM 101 Discrete Mathematics I
MACM 101 Discrete Mathematics I Exercises on Combinatorics, Probability, Languages and Integers. Due: Tuesday, November 2th (at the beginning of the class) Reminder: the work you submit must be your own.
More informationNon Regular Languages
Pigeonhole Principle: Non Regular Languages The Pigeonhole Principle states that if n pigeons fly into m pigeonholes and n > m then at least one hole must contain two or more pigeons. Pigeonhole Principle:
More informationPart 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX
Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 4 out of 5 ETH Zürich (DITET) October, 13 2016 Last week, we showed the equivalence of DFA, NFA and REX
More informationCSCE 355 Foundations of Computation
CSCE 355 Foundations of Computation Stephen A. Fenner August 30, 2016 Abstract These notes are based on two lectures per week. Sections beginning test test with a star (*) are optional. The date above
More informationCSCI 3434: Theory of Computation
CSCI 3434: Theory of Computation Lecture 02: Regular Languages and Finite Automata Ashutosh Trivedi (ashutosh.trivedi@colorado.edu) Department of Computer Science, University of Colorado Boulder Alphabet,
More informationLecture 2: Counting, Pigeonhole Principle, Permutations, Combinations Lecturer: Lale Özkahya
BBM 205 Discrete Mathematics Hacettepe University http://web.cs.hacettepe.edu.tr/ bbm205 Lecture 2: Counting, Pigeonhole Principle, Permutations, Combinations Lecturer: Lale Özkahya Resources: Kenneth
More informationHomework 0. Due Wednesday, January 25, 2017 at 10am
CS/ECE 374 Spring 2017 Homework 0 Due Wednesday, January 25, 2017 at 10am Each student must submit individual solutions for this homework. For all future homeworks, groups of up to three students can submit
More information6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 5 Nancy Lynch
6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 5 Nancy Lynch Today Nonregular languages Today s topics: Existence of nonregular languages
More informationFinite State Machines and Regular Languages
Finite State Machines and Regular Languages Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at
More informationChapter 2. Finite Automata. 2.1 The Basic Model
Chapter 2 Finite Automata 2.1 The Basic Model Finite automata model very simple computational devices or processes. These devices have a constant amount of memory and process their input in an online manner.
More informationBackground Information for the Pumping Lemma for ContextFree Languages
Background Information for the Pumping Lemma for ContextFree Languages Definition: Let G = (V, T, P, S) be a CFL. If every production in P is of the form or > BC > a where, B and C are all in V and a
More informationApplications of Methods of Proof
CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The settheoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are
More informationSet and element. Cardinality of a set. Empty set (null set) Finite and infinite sets. Ordered pair / ntuple. Cartesian product. Proper subset.
Set and element Cardinality of a set Empty set (null set) Finite and infinite sets Ordered pair / ntuple Cartesian product Subset Proper subset Power set Partition The cardinality of a set is the number
More informationTheory 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 informationCOMP481 Review Problems Turing Machines and (Un)Decidability Luay K. Nakhleh
COMP481 Review Problems Turing Machines and (Un)Decidability Luay K. Nakhleh NOTES: 1. In this handout, I regularly make use of two problems, namely The Halting Problem, denoted by HP, and defined as HP
More informationExam1  Comments. UVa  cs302: Theory of Computation Spring Due: 11 March Corrected, 12 March 2008.
UVa  cs302: Theory of Computation Spring 2008 Exam1  Comments Due: 11 March 2008 Corrected, 12 March 2008. Score Distributions Question/Part Target 0 1, 2 3 4 5 6 7 8 912 1317 1819 20 1a 5 0 2 10
More informationChapter 4 Pushdown automata and contextfree languages
Chapter 4 Pushdown automata and contextfree languages 99 Introduction The language a n b n cannot be accepted by a finite automaton On the other hand, L k = {a n b n n k} is accepted for any given n.
More informationNonregular Languages
Nonregular Languages Theorem: The following are all equivalent: L is a regular language. There is a DFA D such that L( D) = L. There is an NFA N such that L( N) = L. There is a regular expression R such
More information3515ICT Theory of Computation ContextFree Languages
Griffith University 3515ICT Theory of Computation ContextFree Languages (Based loosely on slides by Harald Søndergaard of The University of Melbourne) 60 ContextFree Grammars...were invented in the
More informationHarvard CS121 and CSCI E207 Lecture 2: Strings, Languages, and Induction
Harvard CS121 and CSCI E207 Lecture 2: Strings, Languages, and Induction Salil Vadhan September 6, 2012 Reading: Sipser, Ch. 0 and 1.1 Strings and Languages Symbol a, b,... Alphabet A finite, nonempty
More informationAutomata 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 informationComputational Models Lecture 5
Computational Models Lecture 5 Chomsky Normal Form of CFGs Closure Properties of CFLs Pushdown Automata (PDAs) Equivalence of PDAs and CFLs Algorithmic Aspects of PDAs and CFLs DFAs and PDAs: Perspectives
More informationLanguages. Reading: Chapter 4
Properties of Regular Languages g Reading: Chapter 4 Topics ) How to prove whether a given language is regular or not? 2) Closure properties of regular languages 3) Minimization of DFAs 2 Some languages
More informationFinite Representation of Languages. Regular Expressions (Chapter 1, Section 1.8)
Finite Representation of Languages. Regular Expressions (Chapter 1, Section 1.8) Language: any set of strings over an alphabet, i.e. any subset of *. Grammars  finite sets of rules used to describe languages.
More information