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

Sets. A set is a collection of (mathematical) objects, with the collection treated as a single mathematical object.

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

CmSc 175 Discrete Mathematics Lesson 10: SETS A B, A B

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

A set is a Many that allows itself to be thought of as a One. (Georg Cantor)

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

Theory of Computation

Theory of Computation Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

More information

Automata and Languages

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

We give a basic overview of the mathematical background required for this course.

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

Applications of Methods of Proof

Applications of Methods of Proof CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The set-theoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are

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

4.1. Definitions. A set may be viewed as any well defined collection of objects, called elements or members of the set.

4.1. Definitions. A set may be viewed as any well defined collection of objects, called elements or members of the set. Section 4. Set Theory 4.1. Definitions A set may be viewed as any well defined collection of objects, called elements or members of the set. Sets are usually denoted with upper case letters, A, B, X, Y,

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

(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

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

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

Sets and Subsets. Countable and Uncountable

Sets and Subsets. Countable and Uncountable Sets and Subsets Countable and Uncountable Reading Appendix A Section A.6.8 Pages 788-792 BIG IDEAS Themes 1. There exist functions that cannot be computed in Java or any other computer language. 2. There

More information

The Language of Mathematics

The Language of Mathematics CHPTER 2 The Language of Mathematics 2.1. Set Theory 2.1.1. Sets. set is a collection of objects, called elements of the set. set can be represented by listing its elements between braces: = {1, 2, 3,

More information

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

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

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. Languages. Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2

Regular Expressions. Languages. Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2 Regular Expressions Languages Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2 1 String Recognition Machine Given a string and a definition of

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

Sets and set operations

Sets and set operations CS 441 Discrete Mathematics for CS Lecture 7 Sets and set operations Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square asic discrete structures Discrete math = study of the discrete structures used

More information

Sets and Cardinality Notes for C. F. Miller

Sets and Cardinality Notes for C. F. Miller Sets and Cardinality Notes for 620-111 C. F. Miller Semester 1, 2000 Abstract These lecture notes were compiled in the Department of Mathematics and Statistics in the University of Melbourne for the use

More information

Logic & Discrete Math in Software Engineering (CAS 701) Dr. Borzoo Bonakdarpour

Logic & Discrete Math in Software Engineering (CAS 701) Dr. Borzoo Bonakdarpour Logic & Discrete Math in Software Engineering (CAS 701) Background Dr. Borzoo Bonakdarpour Department of Computing and Software McMaster University Dr. Borzoo Bonakdarpour Logic & Discrete Math in SE (CAS

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

Clicker Question. Theorems/Proofs and Computational Problems/Algorithms MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES

Clicker Question. Theorems/Proofs and Computational Problems/Algorithms MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES Tuesday, 1/21/14 General course Information Sets Reading: [J] 1.1 Optional: [H] 1.1-1.7 Exercises: Do before next class; not to hand in [J] pp. 12-14:

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

A set is an unordered collection of objects.

A set is an unordered collection of objects. Section 2.1 Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the elements, or members of the set. A set is said to contain

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

Computing Functions with Turing Machines

Computing Functions with Turing Machines CS 30 - Lecture 20 Combining Turing Machines and Turing s Thesis Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata

More information

Sections 2.1, 2.2 and 2.4

Sections 2.1, 2.2 and 2.4 SETS Sections 2.1, 2.2 and 2.4 Chapter Summary Sets The Language of Sets Set Operations Set Identities Introduction Sets are one of the basic building blocks for the types of objects considered in discrete

More information

Discrete Mathematics & Mathematical Reasoning Chapter 6: Counting

Discrete Mathematics & Mathematical Reasoning Chapter 6: Counting Discrete Mathematics & Mathematical Reasoning Chapter 6: Counting Colin Stirling Informatics Slides originally by Kousha Etessami Colin Stirling (Informatics) Discrete Mathematics (Chapter 6) Today 1 /

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

1.1 Logical Form and Logical Equivalence 1

1.1 Logical Form and Logical Equivalence 1 Contents Chapter I The Logic of Compound Statements 1.1 Logical Form and Logical Equivalence 1 Identifying logical form; Statements; Logical connectives: not, and, and or; Translation to and from symbolic

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

Sets, Relations and Functions

Sets, Relations and Functions Sets, Relations and Functions Eric Pacuit Department of Philosophy University of Maryland, College Park pacuit.org epacuit@umd.edu ugust 26, 2014 These notes provide a very brief background in discrete

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

2.1 Sets, power sets. Cartesian Products.

2.1 Sets, power sets. Cartesian Products. Lecture 8 2.1 Sets, power sets. Cartesian Products. Set is an unordered collection of objects. - used to group objects together, - often the objects with similar properties This description of a set (without

More information

vertex, 369 disjoint pairwise, 395 disjoint sets, 236 disjunction, 33, 36 distributive laws

vertex, 369 disjoint pairwise, 395 disjoint sets, 236 disjunction, 33, 36 distributive laws Index absolute value, 135 141 additive identity, 254 additive inverse, 254 aleph, 466 algebra of sets, 245, 278 antisymmetric relation, 387 arcsine function, 349 arithmetic sequence, 208 arrow diagram,

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

Notes on counting finite sets

Notes on counting finite sets Notes on counting finite sets Murray Eisenberg February 26, 2009 Contents 0 Introduction 2 1 What is a finite set? 2 2 Counting unions and cartesian products 4 2.1 Sum rules......................................

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

Notes. Sets. Notes. Introduction II. Notes. Definition. Definition. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

Notes. Sets. Notes. Introduction II. Notes. Definition. Definition. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Sets Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 1.6 1.7 of Rosen cse235@cse.unl.edu Introduction

More information

Announcements. CompSci 230 Discrete Math for Computer Science Sets. Introduction to Sets. Sets

Announcements. CompSci 230 Discrete Math for Computer Science Sets. Introduction to Sets. Sets CompSci 230 Discrete Math for Computer Science Sets September 12, 2013 Prof. Rodger Slides modified from Rosen 1 nnouncements Read for next time Chap. 2.3-2.6 Homework 2 due Tuesday Recitation 3 on Friday

More information

Finite Sets. Theorem 5.1. Two non-empty finite sets have the same cardinality if and only if they are equivalent.

Finite Sets. Theorem 5.1. Two non-empty finite sets have the same cardinality if and only if they are equivalent. MATH 337 Cardinality Dr. Neal, WKU We now shall prove that the rational numbers are a countable set while R is uncountable. This result shows that there are two different magnitudes of infinity. But we

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

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

Math 3000 Running Glossary

Math 3000 Running Glossary Math 3000 Running Glossary Last Updated on: July 15, 2014 The definition of items marked with a must be known precisely. Chapter 1: 1. A set: A collection of objects called elements. 2. The empty set (

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

MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction. MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

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

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

SETS, RELATIONS, AND FUNCTIONS

SETS, RELATIONS, AND FUNCTIONS September 27, 2009 and notations Common Universal Subset and Power Set Cardinality Operations A set is a collection or group of objects or elements or members (Cantor 1895). the collection of the four

More information

Equivalence Relations

Equivalence Relations Equivalence Relations Definition An equivalence relation on a set S, is a relation on S which is reflexive, symmetric and transitive. Examples: Let S = Z and define R = {(x,y) x and y have the same parity}

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

Carnot s Answer. Does Theory Matter? cs3102: Theory of Computation (aka cs302: Discrete Mathematics II)

Carnot s Answer. Does Theory Matter? cs3102: Theory of Computation (aka cs302: Discrete Mathematics II) cs3102: Theory of Computation (aka cs302: Discrete Mathematics II) Computation is what Computers do, who needs theory? Spring 2010 University of Virginia David Evans Charles Babbage s Difference Engine(1822,

More information

Lecture 1: Elementary Number Theory

Lecture 1: Elementary Number Theory Lecture 1: Elementary Number Theory The integers are the simplest and most fundamental objects in discrete mathematics. All calculations by computers are based on the arithmetical operations with integers

More information

Axiom A.1. Lines, planes and space are sets of points. Space contains all points.

Axiom A.1. Lines, planes and space are sets of points. Space contains all points. 73 Appendix A.1 Basic Notions We take the terms point, line, plane, and space as undefined. We also use the concept of a set and a subset, belongs to or is an element of a set. In a formal axiomatic approach

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

What is a set? Sets. Specifying a Set. Notes. The Universal Set. Specifying a Set 10/29/13

What is a set? Sets. Specifying a Set. Notes. The Universal Set. Specifying a Set 10/29/13 What is a set? Sets CS 231 Dianna Xu set is a group of objects People: {lice, ob, Clara} Colors of a rainbow: {red, orange, yellow, green, blue, purple} States in the S: {labama, laska, Virginia, } ll

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

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

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

1 Introduction to Counting

1 Introduction to Counting 1 Introduction to Counting 1.1 Introduction In this chapter you will learn the fundamentals of enumerative combinatorics, the branch of mathematics concerned with counting. While enumeration problems can

More information

Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

Elementary Number Theory We begin with a bit of elementary number theory, which is concerned CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

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

OPERATIONS AND PROPERTIES

OPERATIONS AND PROPERTIES CHAPTER OPERATIONS AND PROPERTIES Jesse is fascinated by number relationships and often tries to find special mathematical properties of the five-digit number displayed on the odometer of his car. Today

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

Basic Properties of Rings

Basic Properties of Rings Basic Properties of Rings A ring is an algebraic structure with an addition operation and a multiplication operation. These operations are required to satisfy many (but not all!) familiar properties. Some

More information

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

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 11 CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note Conditional Probability A pharmaceutical company is marketing a new test for a certain medical condition. According

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

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

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Name : FORMAL LANGUAGES AND AUTOMATA THEORY Code : A40509 Class : II B. Tech II

More information

Finite Automata and Formal Languages

Finite Automata and Formal Languages Finite Automata and Formal Languages TMV026/DIT321 LP4 2011 Lecture 14 May 19th 2011 Overview of today s lecture: Turing Machines Push-down Automata Overview of the Course Undecidable and Intractable Problems

More information

Announcements. CS243: Discrete Structures. More on Cryptography and Mathematical Induction. Agenda for Today. Cryptography

Announcements. CS243: Discrete Structures. More on Cryptography and Mathematical Induction. Agenda for Today. Cryptography Announcements CS43: Discrete Structures More on Cryptography and Mathematical Induction Işıl Dillig Class canceled next Thursday I am out of town Homework 4 due Oct instead of next Thursday (Oct 18) Işıl

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

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

In mathematics you don t understand things. You just get used to them. (Attributed to John von Neumann)

In mathematics you don t understand things. You just get used to them. (Attributed to John von Neumann) Chapter 1 Sets and Functions We understand a set to be any collection M of certain distinct objects of our thought or intuition (called the elements of M) into a whole. (Georg Cantor, 1895) In mathematics

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

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

GROUPS SUBGROUPS. Definition 1: An operation on a set G is a function : G G G.

GROUPS SUBGROUPS. Definition 1: An operation on a set G is a function : G G G. Definition 1: GROUPS 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 the identity, such that (i) the

More information

CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

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

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

Review for Final Exam

Review for Final Exam Review for Final Exam Note: Warning, this is probably not exhaustive and probably does contain typos (which I d like to hear about), but represents a review of most of the material covered in Chapters

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

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

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

Fundamentals of Mathematics Lecture 6: Propositional Logic

Fundamentals of Mathematics Lecture 6: Propositional Logic Fundamentals of Mathematics Lecture 6: Propositional Logic Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 39 Connectives Propositional Connectives I 1 Negation: (not A) A A T F

More information

Discrete Mathematics Lecture 5. Harper Langston New York University

Discrete Mathematics Lecture 5. Harper Langston New York University Discrete Mathematics Lecture 5 Harper Langston New York University Empty Set S = {x R, x 2 = -1} X = {1, 3}, Y = {2, 4}, C = X Y (X and Y are disjoint) Empty set has no elements Empty set is a subset of

More information