002 - Module 1 Introduction to Theory of Computations

Embed Size (px)

Citation preview

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    1/41

    INTRODUCTION

    ITEU133

    AUTOMATA AND THEORY OFCOMPUTATION

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    2/41

    SETS

    - as a collection well defined objects havingcertain common property

    - represented by a CAPITAL letter i.e. A, B, C,

    METHOD OF SET NOTATION:

    1. Roaster / Tabular Method

    -the set is represented by actually listing the

    elements which belong to it.- separated by comma (,) and enclosed between pair

    of curly brackets { }

    2

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    3/41

    SETS

    Roaster / Tabular Method

    A = { 1, 3, 5, 7}

    Note:

    1. The order of writing the elements of set isimmaterial

    2. An element of a set is not written more than

    once3. Roaster method is used only when the number

    of elements in the set is finite

    3

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    4/41

    SETS

    2. Set Builder / Rule Methodsometimes is a set is defined by stating property

    (P) which characteristics all the elements of the

    set.

    Example:

    A= { x | x satisfies the property P }

    A={x:P(x)}

    A={x | x = 2n, n N}

    Where P(x) means property P is satisfied byevery x of the set

    4

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    5/41

    RECITATION

    1. Apply Roaster method to represent the set of all

    negative integers greater than -4

    2. List the members of the following set:

    A= { x | x is a real number such as x2 =1 }

    3. Express in tabular form the set {b | b N, 3 b 8}

    4. Express the set of all days in a week by set builder

    method

    5. Write the set of the letters in the word book

    5

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    6/41

    TYPES OF SETS

    1. Finite Set If A contains exactly n distinct

    elements, where n is a non-negativeinteger, then A is a finite set and n is the

    cardinalityof A

    Ex:

    A = { a, e, i, o, u}A = { x|x is an odd positive number less than 10}

    6

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    7/41

    TYPES OF SETS

    2. Infinite Set a set which is not finite is said to be

    an infinite set

    Ex:The set of natural number N = {1, 2, 3, 4,5,...}

    3. Empty Set the set having no element / null setor void set. It is denoted by 0 or {}.

    4. Unit Set a set containing only one element is

    called a unit set or singleton set {0} , {a}

    5. Subset If each element of the set A is also an

    element of set B.

    A = {1, 2, 3, 4} B={1, 2, 3, 4, 5, 6}

    7

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    8/41

    TYPES OF SETS

    6. Subset the set A is called the proper subset of B is

    and only if each element of A is the element of B

    and there is at least one element of B which is not

    an element of the set A. (A B.)7. Family Set class of sets or the set of sets

    ex. A = {0 , {a}, {a, b}}

    8. Equal Set two sets A and B consisting of the same

    elements

    9. Equivalent set two sets are said to be equivalent,

    it they contain the same number of elements

    8

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    9/41

    TYPES OF SETS

    10. Power Set set A is the set of all subset of set A.

    it is denoted by P(A)

    11. Disjoint Set the two sets A and B are disjoint, if

    they have no element in common12. Universal Set

    13. Cartesian product

    9

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    10/41

    RECITATION

    6. True/False. C={0} is an empty set

    Categorize the following into finite or infinite set

    7. A= {1, 1, 1, }

    8. B= {x:x I and x is even}

    Consider the following sets:

    A = {a, b} B={a, b,c,d} C={a, e}

    D={c, d, e} E={d, e}

    Which of these sets are disjoint(2 points).

    10

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    11/41

    SET OPERATIONS

    Union The union of two sets is the set that has objects

    that are elements of at least one of the two given

    sets, and possibly both.

    That is, the union of setsA and B, written A B, is aset that contains everything inA, or in B, or inboth.

    Example: A = {1, 3, 9} B = {3, 5}

    Therefore, AB = { ? }

    11

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    12/41

    SET OPERATIONS

    IntersectionThe intersection of setsA and B, written AB, is

    a set that contains exactlythose elements thatare in bothA and B.

    A B = {x : x A and xB}Example: A = {1, 3, 9}, B = {3, 5}, C = {a, b, c}

    A B = { ? }

    A C = { ? }

    12

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    13/41

    SET OPERATIONS

    Set DifferenceThe set difference of setA and set B, written as

    AB, is the set that contains everything that is inA but not in B.

    Given: A = {1,3,9}, B = {3,5} A-B B - A

    Answer

    13

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    14/41

    SET OPERATIONS

    ComplementThe complement of setA, written as A is the setcontaining everything that is not inA.

    14

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    15/41

    PROPERTIES OF SET OPERATIONS

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    16/41

    Example

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    17/41

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    18/41

    Given sets A and B are the subsets o f

    a un iversal set U,prove that

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    19/41

    SEATWORK#1

    Proof the following: De Morgans Law

    1. ( A U B ) = A B

    2. (A B) = A U B

    Determine the set P, Q, AND R if the given that

    P U Q = { 1, 2, 3, 4} P U R = {2, 3, 4, 5}

    P Q = { 2, 3} P R = { 2, 4}

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    20/41

    VENN DIAGRAM

    Out of forty students, 14 are taking English Compositionand 29 are taking Chemistry. If five students are in both

    classes, how many students are in neither class? How

    many are in either class? What is the probability that a

    randomly-chosen student from this group is taking only

    the Chemistry class?

    Universal

    Eng

    Chem

    514 - 5 = 9 29 - 5 = 24

    40 - 9 - 5 - 24 = 2

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    21/41

    VENN DIAGRAM

    There were 60 students in a class.25 students attend Woodshop class

    and 20 students attended Word

    Processing class.If 7 students were in both the classes,

    how many students were not enrolled in

    both Woodshop and Word Processingclass?

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    22/41

    SEATWORK (CLASS ACTIVITY)Survey of faculty and graduate students at the FEA-EAC

    films school revealed the following information:

    51 admire Moe 49 admire Larry

    60 admire Curly 34 admire Moe and Larry

    32 admire Larry and Curly 36 admire Moe and Curly

    24 admire all three of the Stooges

    1 admire none of the three stooges

    a. How many people were surveyed?

    b. How many admire Curly but not Larry nor Moe?

    c. How many admire Larry or Curly?

    d. How many admire exactly one of the Stooges?

    e. How many admire exactly two of the Stooges?

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    23/41

    SEATWORK#3

    A nutritionist at a school is planning a schedule ofbreakfasts for 175 students.

    73 students say they want milk,

    97 want Juice, and 60 want fruit.19 say they want both milk and fruit;

    of these 11 want juice as well.

    34 want only milk and 36 want only fruit.How many students want juice only?

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    24/41

    RELATIONS

    A relation on sets S and Tis a set of orderedpairs (s, t), where

    (a) s S (s is a member ofS )

    (b) tT(c) S and Tneed not be different

    (d) The set of all first elements in the

    domain of the relation, and(e) The set of all second elements is the

    range of the relation.

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    25/41

    RELATIONS

    Then a relation on S and TisR= {(a, y), (c, w), (c, z), (d, y)}

    Types of Relat ion s

    1. Binary Relation2. Equality Relation ex. A={a, b, c}

    3. Universal Relation

    4. Void Relation

    5. Inverse Relation ( x > y y < x)

    ex. A = { 2, 3, 4, 5} B={2, 4, 6} A< B

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    26/41

    RELATIONS

    Then a relation on S and TisR= {(a, y), (c, w), (c, z), (d, y)}

    Equ ivalence Relat ion

    A subset RofA A is called an equivalence relation onAifRsatisfies the following conditions:

    (i) (a, a) Rfor all a A (Ris reflexive)

    (ii) If (a, b) R, then (b, a) R, then (a, b) R(Rissymmetric) ex. A={2, 3, 4, 5} is a double of

    (iii) If (a, b) Rand (b, c)R, then (a, c) R(Ristransitive)

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    27/41

    RECITATION

    Determine if antisymmetric or symmetricA = {a, b, c}

    1. R = { (a,b), (b, c), (a, c), (b, a), (c, a), (c, b)}

    2. R = {(a,b), (b, c), (a, c) }

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    28/41

    REPRESENTATION OF RELATIONS

    Relation as arrow diagram

    Relation as table

    Relation as a directed graph

    Relation as a matrix

    example for arrow diagram / table / matrix

    A = {1, 2, 3, 4} B={a, b, c}R={(1, b), (1, c), (3, b), (4, a), (4, c)}

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    29/41

    REPRESENTATION OF RELATIONS

    Example for directed graph

    A = {1, 2, 3, 4}

    R={(1, 1), (1, 2), (2, 1), (2, ,2), (3, 2), (3, 4),

    (4, 3), (4, 4)}

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    30/41

    FUNCTIONS AND RELATIONS

    Every function is a relation.

    Not all relations are functions.

    One-to-one correspondence function

    One-to-many function

    Many-to-one relation

    Many-to-many relation For graphs of equations Vertical Line

    Test

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    31/41

    GRAPHS AND TREES

    A Graph is a bunch of vertices (or Nodes)which are represented by circles and are

    connected by edges represented by lines.

    Trees are undirected graphs. Any twovertices are connected by exactly one

    simple path. A tree also doest not contain

    a cycle.

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    32/41

    GRAPHS

    A simple graph G = (V,E)

    V = {set of all vertices} not empty

    E = {set of all edges} not empty

    E = {subsets of V with cardinality 2}

    Digraph

    In-degree

    Out-degree

    Isomorphism

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    33/41

    PROOF TECHNIQUES

    The basic structure of a proof is easy: it isjust a series of statements, each one

    being either

    An assumption or

    A conclusion, clearly following from an

    assumption or previously proved result.

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    34/41

    PROOF TECHNIQUES

    Direct Proof

    Proof by Contradiction

    Proof by Contrapositive

    If and only if

    Proof by Mathematical Induction

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    35/41

    DIRECT PROOF

    Assume P then derive Q

    Example:

    Prove that Divisibility is Transitive

    a, b and c are natural numbers

    a is divisible by b and b is divisible by c

    Prove that a is divisible by c

    Try this: Prove that if a divides b and a dividesc then a divides b + c.

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    36/41

    PROOF BY CONTRADICTION

    Assume not P then derive thecontradiction

    Example:

    Prove the Converse of the Pythagorean

    Theorem

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    37/41

    ALPHABETS AND LANGUAGES

    pattern matching in the command-lineshells

    ls - in Unix

    ____ - in DOS

    Regular expressions particular language for patterns

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    38/41

    ALPHABET

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    39/41

    STRINGS OVER AN ALPHABET

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    40/41

    STRINGS

  • 7/27/2019 002 - Module 1 Introduction to Theory of Computations

    41/41

    EXAMPLES