Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

Size: px
Start display at page:

Download "Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory"

Transcription

1 Proof Techniques Alphabets, Strings, and Languages Foundations of Computer Science Theory

2 Proof By Case Enumeration Sometimes the most straightforward way to prove that a property holds for all elements of a set is to divide the set into two or more subsets (i.e., partition the set) and then prove the property separately for each subset Example: Suppose that the postage required to mail a letter is always at least 6. Prove that it is possible to apply any required postage to a letter given only 2 and 7 stamps You can prove this general claim by dividing it into two cases (i.e., two equivalence classes), based on the value of n (the required postage): 1. If n is even, apply n/2 2 stamps 2. If n is odd, then n 7 and n-7 0 and is even. 7 can be applied with one 7 stamp. Apply one 7 stamp and (n-7)/2 2 stamps

3 Proof By Counter-Example Consider the set of numbers of the form 2 n -1, for some positive integer n Prove or disprove the following claim: If n is prime, then 2 n -1 is prime Hundreds of years ago this was believed to be true In 1536, Hudalricus Regius refuted it by giving a counter example: = 2047 is not prime (2047 = 23 x 89)

4 Proof By Counter-Example Consider any sets A, B, and C Prove or disprove the following claim: If A - C = A - B then B = C You can show that this claim is false with a counter-example: Let A =, B = {1}, and C = {2} A - C = A - B = But B C

5 Proof By Contradiction Prove that a statement P is true using proof by contradiction: Assume that the converse statement, P, is true Then show how that assumption will lead to an incorrect conclusion The statement P must therefore be true because the initial assumption of P turned out to be wrong

6 Proof By Contradiction Example: Prove that 2 is not rational Assume that 2 is rational If 2 is rational, it can be written as the ratio of two integers; i.e., 2 = n/m, where n and m have no common factors (if they do, then divide both by the common factor) Square both sides and rearrange to yield 2m 2 = n 2 Since n 2 must be even (since it is 2 times some other number), then n must also be even, so we could write n = 2k, or 2m 2 = 4k 2, or m 2 = 2k 2 (proof continued on the next slide)

7 Proof By Contradiction Since m 2 = 2k 2, m must also be even, so m and n must have a common factor (that is, 2) But recall that we assumed m and n do not have any common factors Contradiction! Therefore, since our assumption that 2 was rational led to a contradiction, 2 cannot be rational

8 Fallacies A fallacy of affirming the conclusion is a type of incorrect reasoning p q implies q p p q does not imply p q Example: Suppose it s true that if you do every homework assignment for this class, then you will know computer science theory Suppose you did not do every homework assignment for this class Does this mean that you do not know computer science theory?

9 Proof By Induction The principle of mathematical induction: If P(b) is true for some integer b, and if for all integers n b, P(n) P(n+1), then for all integers n b, P(n) is true An induction proof has three parts: 1. A clear statement of the proposition P 2. An example showing that P holds for some base case b (the smallest value with which we are concerned) 3. A proof that, for all integers n b, if P(n) is true, then it is also the case that P(n+1) is true We call the claim P(n) the inductive hypothesis

10 Proof By Induction Example: Prove that n 3 n is divisible by 3 whenever n is a positive integer Let P(n) be the proposition: n 3 n is divisible by 3 whenever n is a positive integer Basis: P(1) is true because = 0 is divisible by 3 Inductive hypothesis: Assume that P(n) is true (i.e., assume that n 3 n is divisible by 3 for an arbitrary positive integer n) (proof continued on the next slide)

11 Proof By Induction Inductive step: Show that (n + 1) 3 (n + 1) is divisible by 3 Note that (n + 1) 3 (n + 1) = (n 3 + 3n 2 + 3n + 1) (n + 1) = (n 3 n) + 3(n 2 + n) Using the inductive hypothesis, we conclude that the first term, n 3 n, is divisible by 3 The second term is divisible by 3 because it is 3 times an integer So, we know that (n + 1) 3 (n + 1) is also divisible by 3

12 The Pigeonhole Principle Consider any function f: A B The pigeonhole principle says: If A > B then f is not one-to-one If you drop n + 1 pigeons into n holes, then at least one hole will have more than one pigeon

13 The Pigeonhole Principle Question: How many students must be in a class to guarantee that at least two students receive the same score on the final exam, assuming the exam is graded on a scale from 0 to 100?

14 The Pigeonhole Principle Question: What is the minimum number of students required to be enrolled in FCT to be sure that at least six will receive the same grade? Assume there are five possible grades: A, B, C, D, and F.

15 The Pigeonhole Principle Question: Let (x i, y i, z i ), i = 1, 2, 3, 4, 5, 6, 7, 8, 9, be a set of nine distinct points with integer coordinates in xyz space. Prove that the midpoint of at least one pair of these points has integer coordinates. Recall from analytic geometry that the midpoint of a segment whose endpoints are (a, b, c) and (d, e, f) is ((a+d)/2, (b+e)/2, (c+f)/2).

16 Cardinality We will be concerned with three cases: finite sets countably infinite sets uncountably infinite sets A set A is finite and has a cardinality of 0, or some n N iff either: A =, or there is a bijection from {1, 2, n} to A, for some n A set is infinite iff it is not finite

17 Countably Infinite Sets To prove that a set A is countably infinite, it suffices to find a bijection from N to the set A. For example, the set E of even natural numbers is countably infinite. To prove this, we offer the bijection: Even : N E, Even(x) = 2x N E

18 Uncountably Infinite Sets The power set of the integers P(S) is not countable (it is uncountably infinite). Diagonalization proof: Elem 1 of S Elem 2 of S Elem 3 of S Elem 4 of S Elem 5 of S. Subset 1 of P(S) Subset 2 of P(S) Subset 3 of P(S) Subset 4 of P(S) Subset 5 of P(S) Below is a set that cannot be any of Subset 1 through Subset 5 of P(S) because it is the complement of the diagonal. The same thing applies to all other subsets of P(S)

19 Alphabets An alphabet Σ is any finite set of symbols Examples: ASCII, Unicode {0,1} (binary alphabet) {a,b,c}, {s,o} set of signals used by a protocol

20 Strings A string over an alphabet Σ is a list, each element of which is a member of Σ Strings are usually shown without commas or quotes, e.g., abc or Σ* = set of all strings over alphabet Σ The length of a string is its number of characters ε stands for the empty string (string of length 0)

21 Functions on Strings Cardinality: s is the number of characters in string s ε = = 7 # c (s) is the number of times that character c occurs in s # a (abbaaa) = 4 Concatenation: st is the concatenation of strings s and t If x = good and y = bye, then xy = goodbye Note that xy = x + y ε is the identity for concatenation of strings. So: x (xε = εx = x) Concatenation is associative. So: s, t, w ((st)w = s(tw))

22 Functions on Strings Replication: For each string w and each natural number i, the string w i can be found as: w 0 = ε, w i+1 = w i w. Examples: a 3 = aaa (bye) 2 = byebye a 0 b 3 = bbb Reverse: If w and x are strings, then (wx) R = x R w R Example: Let w = name and x = tag, then (nametag) R = (tag) R (name) R = gateman

23 Relations on Strings aaa is a substring of aaabbbaaa aaaaaa is not a substring of aaabbbaaa aaa is a proper substring of aaabbbaaa Every string is a substring of itself (but not a proper substring of itself). ε is a substring of every string.

24 The Prefix Relation s is a prefix of t iff: x Σ* : (t = sx) s is a proper prefix of t iff: s is a prefix of t and s t Examples: The prefixes of abba are: The proper prefixes of abba are: ε, a, ab, abb, abba ε, a, ab, abb Every string is a prefix of itself. ε is a prefix of every string.

25 The Suffix Relation s is a suffix of t iff: x Σ* : (t = xs) s is a proper suffix of t iff: s is a suffix of t and s t Examples: The suffixes of abba are: The proper suffixes of abba are: ε, a, ba, bba, abba ε, a, ba, bba Every string is a suffix of itself. ε is a suffix of every string.

26 Defining a Language A language is a (finite or infinite) set of strings over a finite alphabet Σ Examples: Let Σ = {a, b} Some languages over Σ:, {ε}, {a, b}, {ε, a, aa, aaa, aaaa, aaaaa} The language Σ* contains an infinite number of strings, including: ε, a, b, ab, ababaa

27 Example of a Language Definition L = {x {a, b}* : all a s precede all b s} ε, a, aa, aabbb, and bb are in L aba, ba, and abc are not in L

28 Example of a Language Definition L = {x : y {a, b}* and x = ya} Simple English description: L consists of all strings that can be formed by taking some string in {a, b}* and concatenating a single a onto the end of it (i.e., L consists of all strings from the alphabet {a, b} that end in a). The strings a, aa, aaa, bbaaa, and ba are in L. The strings ε, bab, and bca are not in L.

29 The Empty Language L = { } =, i.e., L is the empty language (the language that contains no strings) The empty language is different from the empty string L = {ε}, i.e., L is the language that contains a single string, ε

30 A Halting Language L = {w: w is a C program that halts on all inputs}. Can we decide what strings it contains?

31 The Perils of English L = {w: w is a grammatically correct sentence in English}. Examples: Kerry hit the ball. Colorless green ideas sleep furiously. The panda bear eats shoots and leaves. Ball the Stacy hit blue. /* In L /* In L /* In L /* Not in L

32 Languages are Sets To provide a computational definition of a language, we could specify either: A language generator, which enumerates (lists) all of the strings in the language, or A language recognizer, which decides whether or not a candidate string is in the language and returns true if it is, or false if it is not

33 Language Enumeration In some cases, when considering an enumerator for a language L, we may care about the order in which the elements of L are generated If there exists a total order D of the elements of the alphabet, then we can use D to define on L a useful total order called lexicographic order (written < L )

34 Lexicographic Order We will say that a program lexicographically enumerates the elements of L if and only if it enumerates them in lexicographic order: Shorter strings precede longer ones, and Of strings that are the same length, they are sorted in dictionary order using D Example: The lexicographic enumeration of L = {x {a, b}* : all a s precede all b s} is ε, a, b, aa, ab, bb, aaa, aab, abb, bbb, aaaa, aaab, aabb, abbb, bbbb, aaaaa,...

35 How Many Strings are in a Language? What is the cardinality of a language (the number of strings in the language)? The smallest language over any Σ is, with cardinality 0 The cardinality of a language L is written L The cardinality of Σ* is written Σ* What is Σ*? Suppose that Σ =, then Σ* = {ε} and Σ* = 1 What about when Σ is not empty?

36 How Many Strings are in a Language? Theorem: If Σ then Σ* (the set of all strings in a given language with alphabet Σ) is countably infinite. Proof: The elements of Σ* can be lexicographically enumerated by the following procedure: Enumerate all strings of length 0, then length 1, then length 2, and so forth Within the strings of a given length, enumerate them in dictionary order This enumeration is infinite since there is no longest string in Σ*. Since there exists an infinite enumeration of Σ*, it is countably infinite.

37 How Many Languages Are There? Theorem: If Σ then the set of languages over Σ is uncountably infinite. Proof: The set of languages defined on Σ is the power set of Σ*, denoted P(Σ*). Recall that we have already proven that Σ* is countably infinite. Recall also that if S is a countably infinite set, P(S) is uncountably infinite. So P(Σ*) is uncountably infinite.

38 Functions on Languages Set operations: Union Intersection Difference Complement Reversal Language operations: Concatenation Kleene star

39 Set Functions Applied to Languages Let Σ = {a, b}. Also, let L 1 = {strings with an even number of a s and any number of b s} and L 2 = {strings with no b s} L 1 L 2 = {strings with an even number of a s and any number of b s, plus all strings with no b s)} L 1 L 2 = {ε, aa, aaaa, aaaaaa, aaaaaaaa,... } L 2 L 1 = {a, aaa, aaaaa, aaaaaaa,...} (L 2 L 1 ) = {strings with at least one b} {strings with an even number of a s} (L 1 L 2 ) R = L 2 R L 1 R

40 Concatenation of Languages If L 1 and L 2 are languages over Σ: L 1 L 2 = {w Σ* : s L 1 t L 2 (w = st)} Examples: L 1 = {cat, dog} L 2 = {apple, pear} L 1 L 2 = {catapple, catpear, dogapple, dogpear}

41 Concatenation of Languages {ε} is the identity for concatenation: L{ε} = {ε}l = L is a zero for concatenation: L = L = Concatenation is associative, so for all languages L 1, L 2, and L 3 : ((L 1 L 2 )L 3 ) = (L 1 (L 2 L 3 ))

42 Concatenation of Languages The scope of any variable used in an expression that invokes replication will be assumed to be the entire expression. For example, let: L 1 = {a n : n 0} this is the same as {w : n 0 (w = a n )} L 2 = {b n : n 0} this is the same as {w : n 0 (w = b n )} Then: L 1 L 2 = {a n b m : n, m 0}, but notice L 1 L 2 {a n b n : n 0}

43 The Kleene Star, * Strings in L* are formed by concatenating together any number of strings from L Example 1: L = {dog, cat, fish} // L consists of 3 strings L* = {ε, dog, cat, fish, dogdog, dogcat, dogfish, fishcatfish, fishdogdogfishcat, } // L* is countably infinite

44 The Kleene Star, * L* = {ε} {w Σ* : k 1 ( w 1, w 2, w k L (w = w 1 w 2 w k ))} L* always contains an infinite number of strings as long as L is not equal to either or {ε} (i.e., as long as there is at least one nonempty string and any number of them can be concatenated together). If L =, then L* = {ε}, since there are no strings that could be concatenated to ε to make it longer. If L = {ε}, then L* is also {ε}.

45 The Kleene Star, * Example 2: Let L = {w {a, b}* : # a (w) is odd and # b (w) is even} Then L* = {w {a, b}* : # b (w) is even} The constraint on the number of a s disappears in the description of L* due to the fact that strings in L* are formed by concatenating together any number of strings from L. If an odd number of strings are concatenated together, the result will contain an odd number of a s. If an even number are concatenated together, the result will contain an even number of a s. Thus, the number of a s does not matter the resulting string will have either an odd number of a s or an even number of a s which means any number of a s.

46 The + Operator It is sometimes useful to require that at least one element of L be selected L + = LL* L + is called the closure of L under concatenation Example: {0, 1} + is the set of all binary strings (note: L + does not include ε)

47 Assigning Meaning to Strings Let L = A n B n = {a n b n : n 0} Do the strings in L mean anything? What exactly does a language define?

Languages and Strings. Chapter 2

Languages and Strings. Chapter 2 Languages and Strings Chapter 2 Let's Look at Some Problems int alpha, beta; alpha = 3; beta = (2 + 5) / 10; (1) Lexical analysis: Scan the program and break it up into variable names, numbers, etc. (2)

More information

MA/CSSE 474. Today's Agenda

MA/CSSE 474. Today's Agenda MA/CSSE 474 Theory of Computation Course Intro Today's Agenda Student questions Overview of yesterday's proof I placed online a "straight-line" writeup of the proof in detail, without the "here is how

More information

Why Study the Theory of Computation?

Why Study the Theory of Computation? Why Study the Theory of Computation? Implementations come and go. Chapter 1 IBM 7090 Programming in the 1950 s ENTRY SXA 4,RETURN LDQ X FMP A FAD B XCA FMP X FAD C STO RESULT RETURN TRA 0 A BSS 1 B BSS

More information

Glynda, the good witch of the North

Glynda, the good witch of the North Strings and Languages It is always best to start at the beginning -- Glynda, the good witch of the North What is a Language? A language is a set of strings made of of symbols from a given alphabet. An

More information

Notes for Comp 454 Week 2

Notes for Comp 454 Week 2 Notes for Comp 454 Week 2 This week we look at the material in chapters 3 and 4. Homework on Chapters 2, 3 and 4 is assigned (see end of notes). Answers to the homework problems are due by September 10th.

More information

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81%

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% 1. (2 pts) See text. You can t be sloppy defining terms like this. You must show a bijection between the natural numbers

More information

DVA337 HT17 - LECTURE 4. Languages and regular expressions

DVA337 HT17 - LECTURE 4. Languages and regular expressions DVA337 HT17 - LECTURE 4 Languages and regular expressions 1 SO FAR 2 TODAY Formal definition of languages in terms of strings Operations on strings and languages Definition of regular expressions Meaning

More information

Finite Automata Part Three

Finite Automata Part Three Finite Automata Part Three Friday Four Square! Today at 4:15PM, Outside Gates. Announcements Problem Set 4 due right now. Problem Set 5 out, due next Friday, November 2. Play around with finite automata

More information

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np Chapter 1: Introduction Introduction Purpose of the Theory of Computation: Develop formal mathematical models of computation that reflect real-world computers. Nowadays, the Theory of Computation can be

More information

CHAPTER TWO LANGUAGES. Dr Zalmiyah Zakaria

CHAPTER TWO LANGUAGES. Dr Zalmiyah Zakaria CHAPTER TWO LANGUAGES By Dr Zalmiyah Zakaria Languages Contents: 1. Strings and Languages 2. Finite Specification of Languages 3. Regular Sets and Expressions Sept2011 Theory of Computer Science 2 Strings

More information

Comparing sizes of sets

Comparing sizes of sets Comparing sizes of sets Sets A and B are the same size if there is a bijection from A to B. (That was a definition!) For finite sets A, B, it is not difficult to verify that there is a bijection from A

More information

Finite Automata Part Three

Finite Automata Part Three Finite Automata Part Three Recap from Last Time A language L is called a regular language if there exists a DFA D such that L( D) = L. NFAs An NFA is a Nondeterministic Finite Automaton Can have missing

More information

Lecture 6,

Lecture 6, Lecture 6, 4.16.2009 Today: Review: Basic Set Operation: Recall the basic set operator,!. From this operator come other set quantifiers and operations:!,!,!,! \ Set difference (sometimes denoted, a minus

More information

Infinity and Uncountability. Countable Countably infinite. Enumeration

Infinity and Uncountability. Countable Countably infinite. Enumeration Infinity and Uncountability. Countable Countably infinite. Enumeration How big is the set of reals or the set of integers? Infinite! Is one bigger or smaller? Same size? Same number? Make a function f

More information

Slides for Faculty Oxford University Press All rights reserved.

Slides for Faculty Oxford University Press All rights reserved. Oxford University Press 2013 Slides for Faculty Assistance Preliminaries Author: Vivek Kulkarni vivek_kulkarni@yahoo.com Outline Following topics are covered in the slides: Basic concepts, namely, symbols,

More information

Languages and Finite Automata

Languages and Finite Automata Languages and Finite Automata or how to talk to machines... Costas Busch - RPI 1 Languages A language is a set of strings String: A sequence of letters (a word) Examples: cat, dog, house, Defined over

More information

THEORY OF COMPUTATION

THEORY OF COMPUTATION THEORY OF COMPUTATION UNIT-1 INTRODUCTION Overview This chapter begins with an overview of those areas in the theory of computation that are basic foundation of learning TOC. This unit covers the introduction

More information

1.3 Functions and Equivalence Relations 1.4 Languages

1.3 Functions and Equivalence Relations 1.4 Languages CSC4510 AUTOMATA 1.3 Functions and Equivalence Relations 1.4 Languages Functions and Equivalence Relations f : A B means that f is a function from A to B To each element of A, one element of B is assigned

More information

Chapter Seven: Regular Expressions

Chapter Seven: Regular Expressions Chapter Seven: Regular Expressions Regular Expressions We have seen that DFAs and NFAs have equal definitional power. It turns out that regular expressions also have exactly that same definitional power:

More information

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata Solved Subjective From Midterm Papers Dec 07,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM SPRING 2012 Q. Point of Kleen Theory. Answer:- (Page 25) 1. If a language can be accepted

More information

Computer Science 236 Fall Nov. 11, 2010

Computer Science 236 Fall Nov. 11, 2010 Computer Science 26 Fall Nov 11, 2010 St George Campus University of Toronto Assignment Due Date: 2nd December, 2010 1 (10 marks) Assume that you are given a file of arbitrary length that contains student

More information

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia Gabriel Robins Please start solving these problems immediately, and work in study groups. Please prove

More information

Section 1.7 Sequences, Summations Cardinality of Infinite Sets

Section 1.7 Sequences, Summations Cardinality of Infinite Sets Section 1.7 Sequences, Summations Cardinality of Infinite Sets Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and

More information

Section 2.4 Sequences and Summations

Section 2.4 Sequences and Summations Section 2.4 Sequences and Summations Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and {0, 1, 2, 3,..., k} {1,

More information

CMPSCI 250: Introduction to Computation. Lecture #28: Regular Expressions and Languages David Mix Barrington 2 April 2014

CMPSCI 250: Introduction to Computation. Lecture #28: Regular Expressions and Languages David Mix Barrington 2 April 2014 CMPSCI 250: Introduction to Computation Lecture #28: Regular Expressions and Languages David Mix Barrington 2 April 2014 Regular Expressions and Languages Regular Expressions The Formal Inductive Definition

More information

Finite Automata Part Three

Finite Automata Part Three Finite Automata Part Three Recap from Last Time A language L is called a regular language if there exists a DFA D such that L( D) = L. NFAs An NFA is a Nondeterministic Finite Automaton Can have missing

More information

Welcome! CSC445 Models Of Computation Dr. Lutz Hamel Tyler 251

Welcome! CSC445 Models Of Computation Dr. Lutz Hamel Tyler 251 Welcome! CSC445 Models Of Computation Dr. Lutz Hamel Tyler 251 hamel@cs.uri.edu https://fbeedle.com/content/formal-language-practical-introduction-0 The Course Text: Formal Language, by Adam Book Webber,

More information

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont. Announcements CS43: Discrete Structures Strong Induction and Recursively Defined Structures Işıl Dillig Homework 4 is due today Homework 5 is out today Covers induction (last lecture, this lecture, and

More information

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 The entire examination is 925 points. The real final will be much shorter. Name: No books, notes, scratch paper, or calculators. Use pen

More information

Multiple Choice Questions

Multiple Choice Questions Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM

More information

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from Discrete Mathematics and It's Applications Kenneth H.

More information

To illustrate what is intended the following are three write ups by students. Diagonalization

To illustrate what is intended the following are three write ups by students. Diagonalization General guidelines: You may work with other people, as long as you write up your solution in your own words and understand everything you turn in. Make sure to justify your answers they should be clear

More information

CS 341 Homework 1 Basic Techniques

CS 341 Homework 1 Basic Techniques CS 341 Homework 1 Basic Techniques 1. What are these sets? Write them using braces, commas, numerals, (for infinite sets), and only. (a) ({1, 3, 5} {3, 1}) {3, 5, 7} (b) {{3}, {3, 5}, {{5, 7}, {7, 9}}}

More information

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Chapter Summary Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Section 5.1 Sec.on Summary Mathematical Induction Examples of Proof by Mathematical Induction Mistaken

More information

Let A(x) be x is an element of A, and B(x) be x is an element of B.

Let A(x) be x is an element of A, and B(x) be x is an element of B. Homework 6. CSE 240, Fall, 2014 Due, Tuesday October 28. Can turn in at the beginning of class, or earlier in the mailbox labelled Pless in Bryan Hall, room 509c. Practice Problems: 1. Given two arbitrary

More information

Strings, Languages, and Regular Expressions

Strings, Languages, and Regular Expressions Strings, Languages, and Regular Expressions Strings An alphabet sets is simply a nonempty set of things. We will call these things symbols. A finite string of lengthnover an alphabets is a total function

More information

1. [5 points each] True or False. If the question is currently open, write O or Open.

1. [5 points each] True or False. If the question is currently open, write O or Open. University of Nevada, Las Vegas Computer Science 456/656 Spring 2018 Practice for the Final on May 9, 2018 The entire examination is 775 points. The real final will be much shorter. Name: No books, notes,

More information

Chapter 4: Regular Expressions

Chapter 4: Regular Expressions CSI 3104 /Winter 2011: Introduction to Formal Languages What are the languages with a finite representation? We start with a simple and interesting class of such languages. Dr. Nejib Zaguia CSI3104-W11

More information

2.1 Sets 2.2 Set Operations

2.1 Sets 2.2 Set Operations CSC2510 Theoretical Foundations of Computer Science 2.1 Sets 2.2 Set Operations Introduction to Set Theory A set is a structure, representing an unordered collection (group, plurality) of zero or more

More information

Lecture 1. 1 Notation

Lecture 1. 1 Notation Lecture 1 (The material on mathematical logic is covered in the textbook starting with Chapter 5; however, for the first few lectures, I will be providing some required background topics and will not be

More information

Cardinality of Sets. Washington University Math Circle 10/30/2016

Cardinality of Sets. Washington University Math Circle 10/30/2016 Cardinality of Sets Washington University Math Circle 0/0/06 The cardinality of a finite set A is just the number of elements of A, denoted by A. For example, A = {a, b, c, d}, B = {n Z : n } = {,,, 0,,,

More information

Material from Recitation 1

Material from Recitation 1 Material from Recitation 1 Darcey Riley Frank Ferraro January 18, 2011 1 Introduction In CSC 280 we will be formalizing computation, i.e. we will be creating precise mathematical models for describing

More information

CS3102 Theory of Computation Problem Set 2, Spring 2011 Department of Computer Science, University of Virginia

CS3102 Theory of Computation Problem Set 2, Spring 2011 Department of Computer Science, University of Virginia CS3102 Theory of Computation Problem Set 2, Spring 2011 Department of Computer Science, University of Virginia Gabriel Robins Please start solving these problems immediately, and work in study groups.

More information

Phil 320 Chapter 1: Sets, Functions and Enumerability I. Sets Informally: a set is a collection of objects. The objects are called members or

Phil 320 Chapter 1: Sets, Functions and Enumerability I. Sets Informally: a set is a collection of objects. The objects are called members or Phil 320 Chapter 1: Sets, Functions and Enumerability I. Sets Informally: a set is a collection of objects. The objects are called members or elements of the set. a) Use capital letters to stand for sets

More information

COT 3100 Spring 2010 Midterm 2

COT 3100 Spring 2010 Midterm 2 COT 3100 Spring 2010 Midterm 2 For the first two questions #1 and #2, do ONLY ONE of them. If you do both, only question #1 will be graded. 1. (20 pts) Give iterative and recursive algorithms for finding

More information

Introduction to Sets and Logic (MATH 1190)

Introduction to Sets and Logic (MATH 1190) Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Dec 4, 2014 Outline 1 2 3 4 Definition A relation R from a set A to a set

More information

Solutions to Homework 10

Solutions to Homework 10 CS/Math 240: Intro to Discrete Math 5/3/20 Instructor: Dieter van Melkebeek Solutions to Homework 0 Problem There were five different languages in Problem 4 of Homework 9. The Language D 0 Recall that

More information

ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures ITEC2620 Introduction to Data Structures Lecture 9b Grammars I Overview How can a computer do Natural Language Processing? Grammar checking? Artificial Intelligence Represent knowledge so that brute force

More information

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15 Cardinality of Sets MAT Transition to Higher Mathematics Fall 0 MAT (Transition to Higher Math) Cardinality of Sets Fall 0 / Outline Sets with Equal Cardinality Countable and Uncountable Sets MAT (Transition

More information

Automata Theory CS S-FR Final Review

Automata Theory CS S-FR Final Review Automata Theory CS411-2015S-FR Final Review David Galles Department of Computer Science University of San Francisco FR-0: Sets & Functions Sets Membership: a?{a,b,c} a?{b,c} a?{b,{a,b,c},d} {a,b,c}?{b,{a,b,c},d}

More information

Indicate the option which most accurately completes the sentence.

Indicate the option which most accurately completes the sentence. Discrete Structures, CSCI 246, Fall 2015 Final, Dec. 10 Indicate the option which most accurately completes the sentence. 1. Say that Discrete(x) means that x is a discrete structures exam and Well(x)

More information

Compiler Construction

Compiler Construction Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =

More information

Turing Machine Languages

Turing Machine Languages Turing Machine Languages Based on Chapters 23-24-25 of (Cohen 1997) Introduction A language L over alphabet is called recursively enumerable (r.e.) if there is a Turing Machine T that accepts every word

More information

Discrete Mathematics. Kruskal, order, sorting, induction

Discrete Mathematics.   Kruskal, order, sorting, induction Discrete Mathematics wwwmifvult/~algis Kruskal, order, sorting, induction Kruskal algorithm Kruskal s Algorithm for Minimal Spanning Trees The algorithm constructs a minimal spanning tree as follows: Starting

More information

Power Set of a set and Relations

Power Set of a set and Relations Power Set of a set and Relations 1 Power Set (1) Definition: The power set of a set S, denoted P(S), is the set of all subsets of S. Examples Let A={a,b,c}, P(A)={,{a},{b},{c},{a,b},{b,c},{a,c},{a,b,c}}

More information

Integers and Mathematical Induction

Integers and Mathematical Induction IT Program, NTUT, Fall 07 Integers and Mathematical Induction Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology TAIWAN 1 Learning Objectives Learn about

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula Homework 1 MTH 4590 Spring 2018 1. Chapter 1, # 1: Prove that for all sets,, C, the formula ( C) = ( ) ( C) is true. Proof : It suffices to show that ( C) ( ) ( C) and ( ) ( C) ( C). ssume that x ( C),

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam

More information

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ). MATH 139 W12 Review 1 Checklist 1 Exam Checklist 1. Introduction to Predicates and Quantified Statements (chapters 3.1-3.4). universal and existential statements truth set negations of universal and existential

More information

Assignment No.4 solution. Pumping Lemma Version I and II. Where m = n! (n-factorial) and n = 1, 2, 3

Assignment No.4 solution. Pumping Lemma Version I and II. Where m = n! (n-factorial) and n = 1, 2, 3 Assignment No.4 solution Question No.1 a. Suppose we have a language defined below, Pumping Lemma Version I and II a n b m Where m = n! (n-factorial) and n = 1, 2, 3 Some strings belonging to this language

More information

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1 Chapter Seven: Regular Expressions Formal Language, chapter 7, slide The first time a young student sees the mathematical constant π, it looks like just one more school artifact: one more arbitrary symbol

More information

CS3102 Theory of Computation Solutions to Problem Set 1, Spring 2012 Department of Computer Science, University of Virginia

CS3102 Theory of Computation Solutions to Problem Set 1, Spring 2012 Department of Computer Science, University of Virginia CS3102 Theory of Computation Solutions to Problem Set 1, Spring 2012 Department of Computer Science, University of Virginia Gabriel Robins Please start solving these problems immediately, and work in study

More information

EDAA40 At home exercises 1

EDAA40 At home exercises 1 EDAA40 At home exercises 1 1. Given, with as always the natural numbers starting at 1, let us define the following sets (with iff ): Give the number of elements in these sets as follows: 1. 23 2. 6 3.

More information

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions. THREE LECTURES ON BASIC TOPOLOGY PHILIP FOTH 1. Basic notions. Let X be a set. To make a topological space out of X, one must specify a collection T of subsets of X, which are said to be open subsets of

More information

HW Graph Theory SOLUTIONS (hbovik) - Q

HW Graph Theory SOLUTIONS (hbovik) - Q 1, Diestel 9.3: An arithmetic progression is an increasing sequence of numbers of the form a, a+d, a+ d, a + 3d.... Van der Waerden s theorem says that no matter how we partition the natural numbers into

More information

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture

More information

Regular Expressions. Lecture 10 Sections Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2016

Regular Expressions. Lecture 10 Sections Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2016 Regular Expressions Lecture 10 Sections 3.1-3.2 Robb T. Koether Hampden-Sydney College Wed, Sep 14, 2016 Robb T. Koether (Hampden-Sydney College) Regular Expressions Wed, Sep 14, 2016 1 / 23 Outline 1

More information

MATHEMATICS 191, FALL 2004 MATHEMATICAL PROBABILITY Outline #1 (Countability and Uncountability)

MATHEMATICS 191, FALL 2004 MATHEMATICAL PROBABILITY Outline #1 (Countability and Uncountability) MATHEMATICS 191, FALL 2004 MATHEMATICAL PROBABILITY Outline #1 (Countability and Uncountability) Last modified: September 16, 2004 Reference: Apostol, Calculus, Vol. 2, section 13.19 (attached). The aim

More information

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Fall

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Fall c Dr Oksana Shatalov, Fall 2014 1 2. Sets 2.1&2.2: Sets and Subsets. Combining Sets. Set Terminology and Notation DEFINITIONS: Set is well-defined collection of objects. Elements are objects or members

More information

A B. bijection. injection. Section 2.4: Countability. a b c d e g

A B. bijection. injection. Section 2.4: Countability. a b c d e g Section 2.4: Countability We can compare the cardinality of two sets. A = B means there is a bijection between A and B. A B means there is an injection from A to B. A < B means A B and A B Example: Let

More information

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table. Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory

More information

JNTUWORLD. Code No: R

JNTUWORLD. Code No: R Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

More information

Learn Smart and Grow with world

Learn Smart and Grow with world Learn Smart and Grow with world All Department Smart Study Materials Available Smartkalvi.com TABLE OF CONTENTS S.No DATE TOPIC PAGE NO. UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation

More information

UNIT I PART A PART B

UNIT I PART A PART B OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

More information

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string

More information

Ambiguous Grammars and Compactification

Ambiguous Grammars and Compactification Ambiguous Grammars and Compactification Mridul Aanjaneya Stanford University July 17, 2012 Mridul Aanjaneya Automata Theory 1/ 44 Midterm Review Mathematical Induction and Pigeonhole Principle Finite Automata

More information

Regular Expressions. Chapter 6

Regular Expressions. Chapter 6 Regular Expressions Chapter 6 Regular Languages Generates Regular Language Regular Expression Recognizes or Accepts Finite State Machine Stephen Cole Kleene 1909 1994, mathematical logician One of many

More information

Lamé s Theorem. Strings. Recursively Defined Sets and Structures. Recursively Defined Sets and Structures

Lamé s Theorem. Strings. Recursively Defined Sets and Structures. Recursively Defined Sets and Structures Lamé s Theorem Gabriel Lamé (1795-1870) Recursively Defined Sets and Structures Lamé s Theorem: Let a and b be positive integers with a b Then the number of divisions used by the Euclidian algorithm to

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

9.5 Equivalence Relations

9.5 Equivalence Relations 9.5 Equivalence Relations You know from your early study of fractions that each fraction has many equivalent forms. For example, 2, 2 4, 3 6, 2, 3 6, 5 30,... are all different ways to represent the same

More information

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012 CMPSCI 250: Introduction to Computation Lecture #7: Quantifiers and Languages 6 February 2012 Quantifiers and Languages Quantifier Definitions Translating Quantifiers Types and the Universe of Discourse

More information

Recursively Defined Functions

Recursively Defined Functions Section 5.3 Recursively Defined Functions Definition: A recursive or inductive definition of a function consists of two steps. BASIS STEP: Specify the value of the function at zero. RECURSIVE STEP: Give

More information

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

More information

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1} CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in

More information

CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

More information

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say Sets 1 Where does mathematics start? What are the ideas which come first, in a logical sense, and form the foundation for everything else? Can we get a very small number of basic ideas? Can we reduce it

More information

2 Review of Set Theory

2 Review of Set Theory 2 Review of Set Theory Example 2.1. Let Ω = {1, 2, 3, 4, 5, 6} 2.2. Venn diagram is very useful in set theory. It is often used to portray relationships between sets. Many identities can be read out simply

More information

CSC Discrete Math I, Spring Sets

CSC Discrete Math I, Spring Sets CSC 125 - Discrete Math I, Spring 2017 Sets Sets A set is well-defined, unordered collection of objects The objects in a set are called the elements, or members, of the set A set is said to contain its

More information

Homework Set #2 Math 440 Topology Topology by J. Munkres

Homework Set #2 Math 440 Topology Topology by J. Munkres Homework Set #2 Math 440 Topology Topology by J. Munkres Clayton J. Lungstrum October 26, 2012 Exercise 1. Prove that a topological space X is Hausdorff if and only if the diagonal = {(x, x) : x X} is

More information

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA TABLE OF CONTENTS SNo DATE TOPIC PAGE NO UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation Techniques 3 3 Finite State systems 4 4 Basic Definitions 6 5 Finite Automaton 7 6 DFA NDFA

More information

Antisymmetric Relations. Definition A relation R on A is said to be antisymmetric

Antisymmetric Relations. Definition A relation R on A is said to be antisymmetric Antisymmetric Relations Definition A relation R on A is said to be antisymmetric if ( a, b A)(a R b b R a a = b). The picture for this is: Except For Example The relation on R: if a b and b a then a =

More information

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010 CS 3512, Spring 2011 Instructor: Doug Dunham Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010 Prerequisites: Calc I, CS2511 Rough course outline:

More information

4&5 Binary Operations and Relations. The Integers. (part I)

4&5 Binary Operations and Relations. The Integers. (part I) c Oksana Shatalov, Spring 2016 1 4&5 Binary Operations and Relations. The Integers. (part I) 4.1: Binary Operations DEFINITION 1. A binary operation on a nonempty set A is a function from A A to A. Addition,

More information

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman And Introduction to Languages and The by J. C. Martin Basic Mathematical

More information

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan MATH 22 Lecture M: 10/14/2003 MORE ABOUT FUNCTIONS Form follows function. Louis Henri Sullivan This frightful word, function, was born under other skies than those I have loved. Le Corbusier D ora innanzi

More information

Problem Set 2 Solutions

Problem Set 2 Solutions CS235 Languages and Automata Handout # 7 Prof. Lyn Turbak October 16, 2007 Wellesley College Problem Set 2 Solutions Problem 6 from PS1 [45 points] You were asked to determine the sizes of various sets

More information

Theory Bridge Exam Example Questions Version of June 6, 2008

Theory Bridge Exam Example Questions Version of June 6, 2008 Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of

More information

CS402 - Theory of Automata FAQs By

CS402 - Theory of Automata FAQs By CS402 - Theory of Automata FAQs By Define the main formula of Regular expressions? Define the back ground of regular expression? Regular expressions are a notation that you can think of similar to a programming

More information

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string?

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string? Multiple choice type questions. Which of the following regular expressions over {, } denotes the set of all strings not containing as a sub-string? 2. DFA has a) *(*)* b) ** c) ** d) *(+)* a) single final

More information