Automata and Formal Languages

Size: px
Start display at page:

Download "Automata and Formal Languages"

Transcription

1 Automata and Formal Languages Winter Yacov Hel-Or 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 web-page 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 (raz.ilit@post.idc.ac.il) Newsgroup: news://news.idc.ac.il/automata Book: Sipser (see web-page 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 Start-t End-z Start-j 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 : A-B חיסור Formally: A-B = { x x A and x B} Example: A = { 1,2,3 }, B={3,4,5}, A-B={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 k-tuple Example: (7,21,57) is a 3-tuple. סדרית ק-איה 25

26 Cartesian product A binary operation The Cartesian product (or cross product) is a set of all pairs (2-tuple) 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 A-B 2 A (a,b,..) empty set membership cardinality subset union intersection complement set difference power set a sequence (k-tuple) 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 sub-string 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 Sub-strings A sub-string is a subsequence of consecutive letters from a string תת מחרוזת Example: Let w = 101. All sub-strings of w are: B(w) = {, 1, 0, 10, 01, 101 }. Note: 11 B(w) 33

34 Prefixes A prefix is a sub-string 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 K-th 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+1-1)/(a-1) for all a 1 Proof: Base: S(0)=a 0 = (a 0+1-1)/(a - 1)=1 Inductive hypothesis: Assume S(n)= (a n+1-1)/(a - 1) Step (show true for n+1): S(n+1)=a 0 + a a n+1 = S(n) + a n+1 = (a n+1-1)/(a - 1) + a n+1 = (a n+1+1-1)/(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(n-1) follows 59

60 E N D 60

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

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

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

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

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

MACM 101 Discrete Mathematics I

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook. Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole

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

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

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

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

INCIDENCE-BETWEENNESS GEOMETRY

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

More information

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

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

More information

Mathematical Induction. Lecture 10-11

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

More information

6.080/6.089 GITCS Feb 12, 2008. Lecture 3

6.080/6.089 GITCS Feb 12, 2008. Lecture 3 6.8/6.89 GITCS Feb 2, 28 Lecturer: Scott Aaronson Lecture 3 Scribe: Adam Rogal Administrivia. Scribe notes The purpose of scribe notes is to transcribe our lectures. Although I have formal notes of my

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

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

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

More information

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology First Name: Family Name: Student Number: Class/Tutorial: WOLLONGONG COLLEGE AUSTRALIA A College of the University of Wollongong Diploma in Information Technology Final Examination Spring Session 2008 WUCT121

More information

Finite Automata. Reading: Chapter 2

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

More information

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing

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

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

Lecture Note 1 Set and Probability Theory. MIT 14.30 Spring 2006 Herman Bennett

Lecture Note 1 Set and Probability Theory. MIT 14.30 Spring 2006 Herman Bennett Lecture Note 1 Set and Probability Theory MIT 14.30 Spring 2006 Herman Bennett 1 Set Theory 1.1 Definitions and Theorems 1. Experiment: any action or process whose outcome is subject to uncertainty. 2.

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

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

ASSIGNMENT ONE SOLUTIONS MATH 4805 / COMP 4805 / MATH 5605

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

More information

Notes on Complexity Theory Last updated: August, 2011. Lecture 1

Notes on Complexity Theory Last updated: August, 2011. Lecture 1 Notes on Complexity Theory Last updated: August, 2011 Jonathan Katz Lecture 1 1 Turing Machines I assume that most students have encountered Turing machines before. (Students who have not may want to look

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

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

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

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

Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

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

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

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

Lecture 17 : Equivalence and Order Relations DRAFT

Lecture 17 : Equivalence and Order Relations DRAFT CS/Math 240: Introduction to Discrete Mathematics 3/31/2011 Lecture 17 : Equivalence and Order Relations Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last lecture we introduced the notion

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

INTRODUCTORY SET THEORY

INTRODUCTORY SET THEORY M.Sc. program in mathematics INTRODUCTORY SET THEORY Katalin Károlyi Department of Applied Analysis, Eötvös Loránd University H-1088 Budapest, Múzeum krt. 6-8. CONTENTS 1. SETS Set, equal sets, subset,

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Chih-Wei Yi Dept. of Computer Science National Chiao Tung University March 16, 2009 2.1 Sets 2.1 Sets 2.1 Sets Basic Notations for Sets For sets, we ll use variables S, T, U,. We can

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

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

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

3. Mathematical Induction

3. Mathematical Induction 3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

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

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

God created the integers and the rest is the work of man. (Leopold Kronecker, in an after-dinner speech at a conference, Berlin, 1886)

God created the integers and the rest is the work of man. (Leopold Kronecker, in an after-dinner speech at a conference, Berlin, 1886) Chapter 2 Numbers God created the integers and the rest is the work of man. (Leopold Kronecker, in an after-dinner speech at a conference, Berlin, 1886) God created the integers and the rest is the work

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

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

Math Workshop October 2010 Fractions and Repeating Decimals

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

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

6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008

6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

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

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

k, then n = p2α 1 1 pα k

k, then n = p2α 1 1 pα k Powers of Integers An integer n is a perfect square if n = m for some integer m. Taking into account the prime factorization, if m = p α 1 1 pα k k, then n = pα 1 1 p α k k. That is, n is a perfect square

More information

Basic Concepts of Set Theory, Functions and Relations

Basic Concepts of Set Theory, Functions and Relations March 1, 2006 p. 1 Basic Concepts of Set Theory, Functions and Relations 1. Basic Concepts of Set Theory...1 1.1. Sets and elements...1 1.2. Specification of sets...2 1.3. Identity and cardinality...3

More information

CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015

CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015 CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015 Course Info Instructor: Prof. Marvin K. Nakayama Office: GITC 4312 Phone: 973-596-3398 E-mail: marvin@njit.edu (Be sure

More information

Lecture 16 : Relations and Functions DRAFT

Lecture 16 : Relations and Functions DRAFT CS/Math 240: Introduction to Discrete Mathematics 3/29/2011 Lecture 16 : Relations and Functions Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT In Lecture 3, we described a correspondence

More information

Cartesian Products and Relations

Cartesian Products and Relations Cartesian Products and Relations Definition (Cartesian product) If A and B are sets, the Cartesian product of A and B is the set A B = {(a, b) :(a A) and (b B)}. The following points are worth special

More information

8 Divisibility and prime numbers

8 Divisibility and prime numbers 8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

More information

Basic Probability Concepts

Basic Probability Concepts page 1 Chapter 1 Basic Probability Concepts 1.1 Sample and Event Spaces 1.1.1 Sample Space A probabilistic (or statistical) experiment has the following characteristics: (a) the set of all possible outcomes

More information

Handout #1: Mathematical Reasoning

Handout #1: Mathematical Reasoning Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or

More information

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called

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

Course Syllabus. MATH 1350-Mathematics for Teachers I. Revision Date: 8/15/2016

Course Syllabus. MATH 1350-Mathematics for Teachers I. Revision Date: 8/15/2016 Course Syllabus MATH 1350-Mathematics for Teachers I Revision Date: 8/15/2016 Catalog Description: This course is intended to build or reinforce a foundation in fundamental mathematics concepts and skills.

More information

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10 Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

E3: PROBABILITY AND STATISTICS lecture notes

E3: PROBABILITY AND STATISTICS lecture notes E3: PROBABILITY AND STATISTICS lecture notes 2 Contents 1 PROBABILITY THEORY 7 1.1 Experiments and random events............................ 7 1.2 Certain event. Impossible event............................

More information

This chapter is all about cardinality of sets. At first this looks like a

This chapter is all about cardinality of sets. At first this looks like a CHAPTER Cardinality of Sets This chapter is all about cardinality of sets At first this looks like a very simple concept To find the cardinality of a set, just count its elements If A = { a, b, c, d },

More information

Lecture I FINITE AUTOMATA

Lecture I FINITE AUTOMATA 1. Regular Sets and DFA Lecture I Page 1 Lecture I FINITE AUTOMATA Lecture 1: Honors Theory, Spring 02, Yap We introduce finite automata (deterministic and nondeterministic) and regular languages. Some

More information

3 0 + 4 + 3 1 + 1 + 3 9 + 6 + 3 0 + 1 + 3 0 + 1 + 3 2 mod 10 = 4 + 3 + 1 + 27 + 6 + 1 + 1 + 6 mod 10 = 49 mod 10 = 9.

3 0 + 4 + 3 1 + 1 + 3 9 + 6 + 3 0 + 1 + 3 0 + 1 + 3 2 mod 10 = 4 + 3 + 1 + 27 + 6 + 1 + 1 + 6 mod 10 = 49 mod 10 = 9. SOLUTIONS TO HOMEWORK 2 - MATH 170, SUMMER SESSION I (2012) (1) (Exercise 11, Page 107) Which of the following is the correct UPC for Progresso minestrone soup? Show why the other numbers are not valid

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

Math/Stats 425 Introduction to Probability. 1. Uncertainty and the axioms of probability

Math/Stats 425 Introduction to Probability. 1. Uncertainty and the axioms of probability Math/Stats 425 Introduction to Probability 1. Uncertainty and the axioms of probability Processes in the real world are random if outcomes cannot be predicted with certainty. Example: coin tossing, stock

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

Math 55: Discrete Mathematics

Math 55: Discrete Mathematics Math 55: Discrete Mathematics UC Berkeley, Fall 2011 Homework # 5, due Wednesday, February 22 5.1.4 Let P (n) be the statement that 1 3 + 2 3 + + n 3 = (n(n + 1)/2) 2 for the positive integer n. a) What

More information

Answer Key for California State Standards: Algebra I

Answer Key for California State Standards: Algebra I Algebra I: Symbolic reasoning and calculations with symbols are central in algebra. Through the study of algebra, a student develops an understanding of the symbolic language of mathematics and the sciences.

More information

Lecture 13 - Basic Number Theory.

Lecture 13 - Basic Number Theory. Lecture 13 - Basic Number Theory. Boaz Barak March 22, 2010 Divisibility and primes Unless mentioned otherwise throughout this lecture all numbers are non-negative integers. We say that A divides B, denoted

More information

6.2 Permutations continued

6.2 Permutations continued 6.2 Permutations continued Theorem A permutation on a finite set A is either a cycle or can be expressed as a product (composition of disjoint cycles. Proof is by (strong induction on the number, r, of

More information

So let us begin our quest to find the holy grail of real analysis.

So let us begin our quest to find the holy grail of real analysis. 1 Section 5.2 The Complete Ordered Field: Purpose of Section We present an axiomatic description of the real numbers as a complete ordered field. The axioms which describe the arithmetic of the real numbers

More information

A Little Set Theory (Never Hurt Anybody)

A Little Set Theory (Never Hurt Anybody) A Little Set Theory (Never Hurt Anybody) Matthew Saltzman Department of Mathematical Sciences Clemson University Draft: August 21, 2013 1 Introduction The fundamental ideas of set theory and the algebra

More information

CS 103X: Discrete Structures Homework Assignment 3 Solutions

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

More information

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set.

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set. Section 2.5 Cardinality (another) Definition: The cardinality of a set A is equal to the cardinality of a set B, denoted A = B, if and only if there is a bijection from A to B. If there is an injection

More information

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

WRITING PROOFS. Christopher Heil Georgia Institute of Technology WRITING PROOFS Christopher Heil Georgia Institute of Technology A theorem is just a statement of fact A proof of the theorem is a logical explanation of why the theorem is true Many theorems have this

More information