Theory of Computation

Theory of Computation

THEORY OF COMPUTATION There are four sorts of men: He who knows not and knows not he knows not: he is a fool - shun him; He who knows not and knows he knows not: he is simple { teach him; He who knows and knows not he knows: he is asleep { wake him; He who knows and knows he knows: he is wise { follows him Arabian proverb Chapter 1: Sets, Relations and Languages Recommended Readings: Textbook + A Basis for Theo- retical Computer Science by M. A. Arbib, A. J. Kfoury, R N. Moll. A set is a collection of objects. Examples of sets are: { the set of integers, denoted by Z, { the set of nonnegative integers, also called natu- ral numbers, denoted by N, { the set of truth values B = fT;F g { the set of students taking the theory of compu- tation course The elements or members of a set are the ob- jects comprising it. If b is an element of a set L, then we write b 2 L. There are two ways to display a set: either explicitly listing the elements belonging to it like in the case of the set of truth values B = fT;F g, or by specifying the properties that characterize the elements of this set like: the set of even integers fx j x 2 Z and x mod 2 = 0g Two sets are equal if they have the same ele- ments A set without any element is called the empty set A set with infinitely many elements is said to be infinite A set with finitely many elements is said to be fi- nite A set X is a subset of a set Y, written X ⊆ Y , if each element of X is also an element of Y. X is a proper subset of Y if X is a subset of Y and X and Y are not equal. For example, the set of nonnegative integers is a proper subset of the set of integers, N ⊂ Z. Basic facts: For any set A, the empty set ; is a subset of A, ; ⊆ A, and A is a subset of A, A ⊆ A. If A ⊆ B and B ⊆ A then A = B. Set operations: Union, Difference, In- tersection The union of two sets A,B is the set of elements which belongs to at least one of them. The intersection of two sets A,B is the set of ele- ments which belongs to both of them. We say two sets are disjoint if their intersection is empty. The set difference A n B of two sets A,B is the set of those elements in A that are not in B. Laws for set operations: Idempotency A [ A = A A \ A = A Commutativity A [ B = B [ A A \ B = B \ A Associativity (A[B)[C = A[(B [C) (A \ B) \ C = A \ (B \ C) Suppose now that there is a big set U such that both A, and B are subsets of U. Let B = U n B, B = U n B. Then A n B = A \ B A \ B = A [ B A [ B = A \ B Exercises Prove the above equalities. Distributivity A [ (B \ C) = (A [ B) \ (A [ C) A\(B [C) = (A\B)[(A\ C) Proof 1. To show A [ (B \ C) = (A [ B) \ (A [ C), we show A [ (B \ C) ⊆ (A [ B) \ (A [ C) and (A [ B) \ (A [ C) ⊆ A [ (B \ C). (a) Let x 2 A [ (B \ C). From x 2 A [ (B \ C), it follows: x 2 A or x 2 B \ C. If x 2 A then x 2 A [ B and x 2 A [ C. Hence x 2 (A [ B) \ (A [ C). If x 2 B \ C then x 2 B and x 2 C. If x 2 B then x 2 A [ B. If x 2 C then x 2 A [ C. Therefore if x 2 B \ C then x 2 (A [ B) \ (A [ C). Hence from x 2 A or x 2 B \ C we can conclude x 2 (A [ B) \ (A [ C). Therefore we have proved that if x 2 A [ (B \ C) then x 2 (A [ B) \ (A [ C). (b) Let x 2 (A [ B) \ (A [ C). To show x 2 A [ (B \ C). From x 2 (A [ B) \ (A [ C), it follows: x 2 A [ B and x 2 A [ C. Hence (x 2 A or x 2 B) and (x 2 A or x 2 C). Hence there are four cases: (x 2 A) or (x 2 A and x 2 B) or (x 2 A and x 2 C) or (x 2 B and x 2 C). It follows that x 2 A or (x 2 B and x 2 C). That means x 2 A [ (B \ C). 2. Exercise. Absorption A \ (A [ B) = A A [ (A \ B) = A Proof Exercise. DeMorgan's Laws An(B [C) = (AnB)\(AnC) An(B \C) = (AnB)[(AnC) Proof 1. Suppose there is a set U such that all sets A,B,C are subsets of U. Hence A n (B [ C) = A \ (B [ C) = A \ (B \ C) = (A \ B) \ (A \ C) = (A n B) \ (A n C) 2. Exercise. If S is a collection of sets then S S is the set whose elements are the elements of the sets in S. Example: S = ffa; bg; fcg; fa; dgg S S = fa; b; c; dg S = f fa; bg; fcg; fa; fd; ag g g S S = fa; b; c; fd; ag g The power set of a set S, denoted by 2S, is the set of all subsets of S. Example: S = fag , 2S = f;; fag g S = fa; bg , 2S = f;; fag; fbg; fa; bg g A partition of a set S is a set Π of subsets of S, i.e. Π ⊆ 2S, such that 1. Each element of Π is nonempty 2. Distinct members of Π are disjoint 3. S Π = S Example S = fa; b; cg Π = f fag; fb; cg g is a partition of S. A = f fag; fa; bg; fcg g is not a partition. B = f fag; fb; cg; ; g is not a partition. Functions or Maps Ordered pairs are written as (a,b) where a is the first component and b the second. The Cartesian product of two sets A,B, de- noted by A×B, is the set of all ordered pairs (a,b) with a 2 A, b 2 B. Example fa; bg × fag = f(a; a); (b; a)g The plane could be represented as a Cartesian product R × R where R is the set of all real numbers. A map or function from a set A to a set B, denoted f : A ! B, is an assignment to each element a in A a single element, denoted by f(a), in B. A is called the domain of f and B is the codomain of f. f(a) is called the image of a under f. The range of f is denoted by f(A) = fb j there is a in A such that b = f(a)g For A0 ⊆ A, f(A0) = ff(a): a 2 A0g is called the image of A0 under f. Example of functions: The integer addition +: N×N ! N is a func- tion from N×N to N Exercises 1) If A is empty, how many functions are there from A to B ? 2) If B is empty, how many functions are there from A to B ? 3) If A contains exactly one element, how many functions are there from A to B ? A function f : A −! B is one to one if for any two distinct elements a; a0 2 A, f(a) =6 f(a0). A function f : A −! B is onto B if B = f(A). A function f : A −! B is a bijection be- tween A and B if it is both one-to-one and onto B. Let A and B be two finite sets. A and B have the same number of elements iff there is a bijection be- tween A and B Given a function f : A ! B and g : B ! C, the composition f ◦ g : A ! C is defined by: f ◦ g(a) = g(f(a)) Relations A binary relation on two sets A,B is a subset of A × B. An example of binary relation is the greater or equal relation ≥ in the set of integers R = f(n; m) j n ≥ mg ⊆ Z× Z. An ordered n-tuple is written as (a1; : : : ; an) where ai is the ith component of (a1; : : : ; an). The n-fold Cartesian product of the sets A1;:::;An, denoted by A1 ×:::×An, is the set of all ordered n-tuples with ai 2 Ai for i = 1; : : : ; n. An n-ary relation on sets A1;:::;An is a subset of A1 × ::: × An. Property (A function is a special relation) A function from a set A to a set B is a binary relation R on A,B such that following property is satisfied: { For each a 2 A there is exactly one ordered pair in R with first component a. A binary relation R ⊆ A × B has an inverse R−1 ⊆ B × A defined by: (b; a) 2 R−1 iff (a; b) 2 R. For binary relations Q ⊆ A×B and R ⊆ B×C, the composition Q ◦ R is defined by Q◦R = f(a; c): 9 b 2 B s:t: (a; b) 2 Q and (b; c) 2 Rg Note that for two functions f : A −! B and g : B −! C, f ◦ g : A −! C.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    123 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us