Models of Computation: Automata and Formal Languages Sam M. Kim.

Slides:



Advertisements
Similar presentations
PROOF BY CONTRADICTION
Advertisements

February 26, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1 Addition of Integers Example: Add a = (1110) 2 and b = (1011) 2. a 0 + b.
Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Elementary Number Theory and Methods of Proof
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
127 The Chomsky Hierarchy(review) Recursively Enumerable Sets Turing Machines Post System Markov Algorithms,  -recursive Functions Regular Expression.
CS 454 Theory of Computation Sonoma State University, Fall 2011 Instructor: B. (Ravi) Ravikumar Office: 116 I Darwin Hall Original slides by Vahid and.
CS5371 Theory of Computation
1 1. Show the result of each of the following set operations in terms of set property. Write your sets as simple as possible. (a) L 0  L 4 (b) L 0  L.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
Logic: Connectives AND OR NOT P Q (P ^ Q) T F P Q (P v Q) T F P ~P T F
Sets 1.
Sets 1.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
Context Free Pumping Lemma Zeph Grunschlag. Agenda Context Free Pumping Motivation Theorem Proof Proving non-Context Freeness Examples on slides Examples.
4. There once lived a king, named Hagar, who had thousands of sons and daughters, still giving more births to his wives. One of his serious problems was.
Mathematical Induction
Lecture 8 Introduction to Logic CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Methods of Proof & Proof Strategies
Intro to Discrete Structures
Induction and recursion
CISC 2315 Discrete Structures Professor William G. Tanner, Jr. Fall 2010 Slides created by James L. Hein, author of Discrete Structures, Logic, and Computability,
Discrete Mathematics, Part II CSE 2353 Fall 2007 Margaret H. Dunham Department of Computer Science and Engineering Southern Methodist University Some slides.
MATH 224 – Discrete Mathematics
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Mathematical Preliminaries Strings and Languages Preliminaries 1.
Review I Rosen , 3.1 Know your definitions!
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Methods of Proofs PREDICATE LOGIC The “Quantifiers” and are known as predicate quantifiers. " means for all and means there exists. Example 1: If we.
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
Discrete Structures (DS)
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
2.3Logical Implication: Rules of Inference From the notion of a valid argument, we begin a formal study of what we shall mean by an argument and when such.
Mathematical Induction I Lecture 4: Sep 16. This Lecture Last time we have discussed different proof techniques. This time we will focus on probably the.
Copyright © Curt Hill Quantifiers. Copyright © Curt Hill Introduction What we have seen is called propositional logic It includes.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
CS201: Data Structures and Discrete Mathematics I
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
Theory of Computation, Feodor F. Dragan, Kent State University 1 TheoryofComputation Spring, 2015 (Feodor F. Dragan) Department of Computer Science Kent.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Mathematical Preliminaries
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
Chapter 1: The Foundations: Logic and Proofs
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication.
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
CS 203: Introduction to Formal Languages and Automata
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
CS104:Discrete Structures Chapter 2: Proof Techniques.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Mathematical Induction What it is? Why is it a legitimate proof method? How to use it?
Chapter 0 Discrete Mathematics 1. A collection of objects called elements; no repetition or order. A = {a 1, …, a n } or {a 1, a 2, …} N = {0, 1, 2, …}{1,
Lecture 2: Proofs and Recursion. Lecture 2-1: Proof Techniques Proof methods : –Inductive reasoning Lecture 2-2 –Deductive reasoning Using counterexample.
Chapter 1 Logic and Proof.
The Foundations: Logic and Proofs
Chapter 5 Induction and Recursion
Chapter 1 The Foundations: Logic and Proof, Sets, and Functions
Introduction to Finite Automata
Mathematical Preliminaries Strings and Languages
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Foundations of Discrete Mathematics
Presentation transcript:

Models of Computation: Automata and Formal Languages Sam M. Kim

G M aaba acba aaba.. What is it about? Models of Language Generation Models of Language Recognition

Where do we use it? Everywhere! almost

Preliminaries Notational Convention Leading lower case English letters a, b, c, … denote symbols. Trailing lower case English letters ….., u, v, w, x, y, z denote strings of symbols. Upper case English letters,  and  denote sets. For a string x, |x| denotes the length of x.  (or ) denotes the null string.  *, which is called Kleene star (or closure) of , denotes the set of all strings over the alphabet  including the null string, , and  + =  * - {  }. x i denotes the repeating string of x i times, and x R denotes the reverse of string x. For example, (ab) 3 = ababab, (ab) 0 = , (abcd) R = dcba.

Preliminaries (cont’ed) Set Specification Explicit: A = {2, 8},  = {a, b, c} By set properties: A = { x | property list of x} Examples: A = {x | x  {a, b}* and x has no consecutive a’s} B = {n | n is an even number} C = {xx R | x  {0, 1} + } = {00, 11, 0110, 1001, 1111, ,...} D = {a n b n c n | n  0} = { , abc, aabbcc, aaabbbccc,... }

Proof Techniques A proposition is a declarative statement that is either true or false. We are interested in proof techniques for propositions of he form P  Q, or P  Q (i.e., P  Q and Q  P ). The truth table for implication “if P then Q” (denoted by P  Q ) is defined as follows: PQ P  Q TT TF FT FF T F T T

Proof Techniques (cont’ed) 1. Trivial proof: Prove, if possible, that Q is true (i.e., tautology). Notice that if Q is true, then P  Q is true independent of P. Example: Suppose that the premise “Graduates of the Computer Science Department get a good job” is true. Then the statement “If the weather is good then the graduates of the Computer Science Department get a good job.” is true. 2. Vacuous proof: Prove P is false. Notice that if P is false, then P  Q is true independent of Q. Example: “If elephants fly, then they will lay eggs.”

Proof Techniques (cont’d) 3. Indirect proof: Prove that Q  P is true. Notice that ( P  Q )  (Q  P). Example: The proof for “If it rained, then the lawn will be wet.” is equivalent to the proof for “If the lawn is not wet, then it did not rain.” 4. Proof by cases: Let P 1, P 2, and P 3 be propositions. Then the proposition (P 1  P 2  P 3 )  Q can be proved by three cases P 1  Q, P 2  Q, or P 3  Q, because (P 1  P 2  P 3 )  Q  (P 1  Q)  (P 2  Q)  (P 3  Q) 5. Proof by contradiction: We want to prove that a proposition P is false. With the assumption that P is true, we show that P  Q is incorrectly false, contradicting a proven fact. So we must lay the blame on the assumption that P is true.

Proof Techniques (cont’ed) Dealing with universal/existential quantifications Let P(x 1, x 2, …., x n ), n  1, be a predicate with Boolean variables x 1, x 2, …, x n. For example: GT(x, y) = true if x > y, false otherwise Prime(n) = true if n is a prime number, false otherwise. We will use  and  to denote “for all (or for every)” and “there exists”, respectively. Symbol  is called the universal quantifier, and  the existential quantifier.

Proof Technique (cont’ed) 6. Proof by example: To prove that a proposition of the form  x [P(x)] (i.e., there exists an x which satisfies P(x)), it is enough to show an example x which satisfies P(x). However, to disprove the proposition we should present a generalized proof that P(x) is false for arbitrary x, which is not easy. 7. Proof by counter example: To disprove that a proposition of the form  x [P(x)] (i.e., for all x, P(x) is true), it is enough to show an x which does not satisfy P(x). 8. Proof by generalization: To prove a proposition of the form  x [P(x)], we need to show that P(x) holds for arbitrary x.

Proof Techniques (cont’ed) 8. Proof by induction: Proof by induction is performed in three steps; (1) base, (2) hypothesis (or assumption), and (3) induction. Example: Prove that  n  0 [  n i=0 i = n(n+1) /2 ] (1) Base: when n = 0,  0 i=0 i = 0, and n(n+1)/ 2 = 0. Thus the equality holds. (2) Hypothesis: Suppose that  m < n it satisfies  m i=0 i = m(m+1) /2. (3) Induction step: We prove that for n = m+1,  n i=0 i = n(n+1) /2. Clearly,  n i=0 i =  m i=0 i + n, and  m i=0 i = m (m+1)/2 by the hypothesis. It follows that  m i=0 i + n = m(m+1)/2 + n = m(m+1)/2 + (m+1) = (m+1)(m+2)/2 = n(n+1)/2.

Proof Techniques (cont’ed) Constructive proof vs non-constructive proof: Constructive proof actually shows the information that the problem requires, while non-constructive proof shows the existence of such information indirectly. Example: We want to prove the statement “There is a prime number p > 2. Constructive proof: 5 is a prime, which is greater than 2. Non-constructive proof: Every natural number can be represented as a product of prime numbers. This fact implies that, if there is no prime number greater than 2, any natural number n should be equal to 2 i for some integer i. However, we know that there exist natural numbers that are not power of 2, which contradicts to a know fact. It follows that there exists a prime number greater than 2.

Proof Technique (cont’ed) Other useful Proof techniques Pigeonhole Principle: Suppose that we have n pigeonholes and n+1 items to be placed in the pigeonholes. Then however the items placed, at least one pigeonhole will contain at least two items. (This can be easily proved by the proof by induction technique.) 9. Proof by the pigeonhole principle (example): Show that in a graph G with n vertices, every path of length greater than or equal to n has a cycle. Proof: Let the nodes of G be the pigeonholes and the nodes appearing on the path be the items. We put an item in a mail box (i.e., a node) if that item appears on the path. If a path length is greater than or equal to n, then it has more than n items. By the pigeonhole principle at least one box will contain at least two items (i.e., nodes on the path), which implies a cycle on the path.

Proof Techniques (cont’ed) 10. Proof by counting: This technique is used to demonstrate that particular set is larger than others. Example: Prove that, for all n  1, the rows and columns of n  n bit matrix do not exhaust all possible binary numbers of length n. Proof. Obviously, there are 2 n different binary numbers of length n, but only 2n rows and columns in n  n bit matrix. Since 2n 2, the statement is true for all n > 2. For n = 2 or 1, we can prove by exhaustive argument (this part of the proof is left for the reader).

Proof Techniques (cont’ed) 11. Diagonalization technique: This is a technique that, given a set of n lists, each of length m, construct a list of length m which is not contained in the set. Example: Find a binary number of length n which does not appear on any column or row of an n  n bit matrix (recall the preceding example). Solution: Let m ii be the complement of the bit at i-th column and i-th row. The matrix does not contain the binary number v = m 11 m 22 …m nn. Clearly, i-th row or column has bit m ii at its i-th position, while v has m ii, the complement at the same position. Hence, there is no n bits number in the matrix that is equal to v.

Using the proof by induction technique, prove that the pigeonhole principle is true. (2) Induction hypothesis: Suppose that the pigeonhole principle is true for any number of pigeonholes n’ < n. (3) Induction step: We show that when the number of pigeonholes is n’+1 and the number of items m > n’+1, the principle also holds. Consider the array of n’+1 pigeonholes as shown below. Case (a): When the last pigeonhole contains no more than one item (i.e., either zero or one item). The first n’ pigeonholes together contain more than n’ items. By the above induction hypothesis, among the first n’ pigeonholes there exists at least one pigeonhole which contains more than one item. The principle holds. Case (b): When the last pigeonhole contains more than one item. This last pigeonhole witnesses that the principle is true. Answer: (1) Base: when the number of pigeonholes n = 1, and the number of items m >n. Obviously, the principle is true, because all the items should be in that one pigeonhole. A Rumination on the Proof by Induction 1 2 n’ n’ m

A remark on the proof by induction technique The proof by induction technique is a good approach to show a statement of the form “[something] happens for all integers n  k,” where [something] can be the pigeon principle, the Sperner’s lemma (see the homework), or a mathematical equation. If it is understood, the lower bound k does not appear in the statement, like in the pigeonhole principle(k =1) and the Sperner’s lemma(k = 2). The logic involved in the proof is like going up the stairway. Imagine that we stand at the bottom of a stairway, and know how to move one step up from any i-th stair to (i+1)-th stair. Then we know how to move up to n-th stair, which is our destination. So the proof by induction proceeds as follows: 1. Induction base: we prove that [something] can happen for n = k, i.e., we show we can go to the bottom of the stairway. Now, if we can show that [if it happens for any n’, k  n’ < n, it can also happen for n’+ 1], we are all done! We know that it happens for k by the induction base. Since it happens for k, by the above proven fact it should also happen for k + 1. Since It happens for k + 1, it should also happen for k + 2, and so on. Finally, since it happens for n – 1, it should also happen for n, the final destination. So they usually set up this logical ground with the following so called induction hypothesis; 2. Induction hypothesis: suppose that [something] happens for all n’< n (to be specific, it is k  n’ < n). Then the proof shows in the final induction step that if it happens for n’ < n, it also happens for n’+ 1, which includes n. 3. Induction step: Supposing that [something] happens for any n’< n, we show that it also happens for n’+ 1. k k+1 k+3 n

A Rumination on the Proof by Induction n’ n Prove that  n  0 [  n i=0 i = n(n+1) /2 ] (1)Base: when n = 0,  0 i=0 i = 0, and n(n+1)/ 2 = 0. Thus the equality holds. (2) Hypothesis: Suppose that  n’ < n it satisfies  m i=0 i = n’(n’+1) /2. (3) Induction step: We prove that for n = n’+1,  n i=0 i = n(n+1) / n’ + (n’+1) n’(n’+1)/2+ (n’+1) = (n’+1)(n’+2)/2 = n(n+1)/2

Rumination (cont’ed) n’ n Prove the pigeonhole principle for n  1 pigeonholes m > n items. (1)Base: one hole and more than one item. Obviously the principle holds. (2) Hypothesis: suppose that the principle Holds for all n’ n’ items. (3) Induction: we prove The principle holds for n = n’+1 holes and m > n items. 1 2 n’ n’ m (3) Induction: m > n’+1