Mc 0082 Solve

Embed Size (px)

Citation preview

  • 7/30/2019 Mc 0082 Solve

    1/4

    Q1) Define the concept of equivalence relation. Give at least two examples of equivalence

    relation.

    Equivalence Relation

    Definition

    A relation is said to be an equivalence relation if it is reflexive, symmetric and transitive.

    If(a, b) is an element of the equivalence relation, then we write a ~ b and we say that a and b are equivalent.Let R be an equivalence relation on S and a is an element ofS. Then the set [a] = {s S / s ~ a} is called the

    equivalence class of a (or equivalence class containing a).

    Example 1:

    IfA = {a, b, c} and R = {(a, a), (b, b), (c, c), (a, b), (b, a)}, then R is an equivalence relation onA and [a] = {a, b},

    [b] = {a, b}, and [c] = {c}.

    Example 2:

    i) Let S be the set of all integers. Define for any a, b S, a ~ b a - b is an even number. Then relation ~is anequivalence relation.

    ii) Let R, the set of all real numbers,x ~ y xyis an integer. Then ~is an equivalence relation. The set of all

    equivalence classes are given by

    {[x]/ x (0, 1]}.

    Q2) Prove by Mathematical Induction that

    i) For n=1, left side = 13

    = 1

    right side =

    =

    = 1Hence it is true for n = 1

    ii) Assume the result to be true for n = m

    Then

    (induction hypothesis)

    Adding the (m+1)th

    term viz.,(m+3)3

    to both sides,

    + (m+1)

    3

    =

    + (m

    2+4m+4)

    =

    =

    Therefore the result is true for n = m+1.

    Hence by mathematical induction the given result is established for all positive integers.

    Q3) Prove that a graph G is connected if and only if it has a spanning tree.

    Proof: Let G be a connected graph.

    IfG has no circuit, then G is a spanning tree.

  • 7/30/2019 Mc 0082 Solve

    2/4

    IfG has a circuit, then delete an edge from this circuit. If till leaves the graph connected.

    If there are more circuits, repeat the operation till an edge from the last circuit is deleted, leaving the graph

    connected, circuitless, and contains all the vertices ofG.

    Thus the subgraph obtained is a spanning tree ofG.

    Hence every connected graph has at least one spanning tree.

    Q4) Prove that a b(modm) is an equivalence relation.

    To proof: The relation a b mod m is an equivalence relation on Z.

    Solution: Let a Z.Reflexive: Since n divides a - a = 0, we have a a mod m.

    Symmetric: Let a b mod m.

    m divides a - b

    m divides - (a - b)

    m divides b - a

    b a mod m.

    Transitivity: Let a, b, c Z such that a b mod m, b c mod m.

    m divides a - b, and m divides b - c

    m divides ( a - b ) + ( b - c)

    m divides a - ca c mod m.

    Hence the relation is an equivalence relation.

    Q5) Explain the concept of a Transition graph.

    A finite directed labeled graph in which each node or vertex of the graph represents a state and the directed

    edges from one node to another represent transition of a state. All the edges of the transition graph are

    labeled as input/output. For example, an edge labeled 1/0 specifies that for a certain initial state if the input is

    1, then the output is 0.

    Consider the following diagram:

    In the transition graph as shown in the figure,

    The initial state, q0, of the system is represented by a circle with an arrow pointing towards it. The final state, q1, is represented by two concentric circles. The directed edges from the initial state to the final state are labeled as input/output.

    Example

    The graph represents the DFA,

    M = (Q = {q0, q1, q2}, = {0, 1}, , q0 = initial state, F = {q1}), where is given by

    (q0, 0) = q0,

    (q0, 1) = q1,

    (q1, 0) = q0,

  • 7/30/2019 Mc 0082 Solve

    3/4

    (q1, 1) = q2,

    (q0, 0) = q2,

    (q2, 1) = q1.

    Representation of DFA using Transition table:

    In this method, the DFA is represented in the tabular form. This table is called transitional table. There is one

    row for each state, and one column for each input. Since, in the transition diagram shown in the fig., there are

    three states, there are three rows for each state. The input symbols are only 0 and 1 so, there are two

    columns for the input symbols. The transitional table for the diagram is given below.

    States 0 1

    q0q1

    q0 q1q1 q2

    q2 q1

    Q6) Explain the steps of conversion of Mealy machine into Moore machine

    Conversion of Mealy machine into Moore Machine

    Consider the following steps:

    Step 1: For a state qi determine the number of different outputs that are available in state table of the

    Mealy machine.

    Step 2: If the outputs corresponding to state qi in the next state columns are same, then retain state q i as it is.

    Else, break qi into different states with the number of new states being equal to the number of different

    outputs of qi.

    Step 3: Rearrange the states and outputs in the format of a Moore machine. The common output of the newstate table can be determined by examining the outputs under the next state columns of the original Mealy

    machine.

    Step 4: If the output in the constructed state table corresponding to the initial state is 1, then this specifies the

    acceptance of the null string by Mealy machine. Hence, to make both the Mealy and Moore machines

    equivalent, we either need to ignore the output corresponding to the null string or we need to insert a new

    initial state at the beginning whose output is 0; the other row elements in this case would remain the same.

    Consider the following example, to convert a given mealy machine into a Moore machine.

    Present State Next StateInput a = 0 Input a = 1

    State Output State Output

    q1 q1 1 q2 0

    q2 q4 1 q4 1

    q3 q2 1 q3 1

    q4 q3 0 q1 1

  • 7/30/2019 Mc 0082 Solve

    4/4

    After assessing the state table given above, we observe that the outputs for the states q1 and q4 are same

    while the outputs for the states q2 and q3, have two different values. Hence, after splitting states q2 and q3, we

    obtain the state table shown below.

    Present State

    Next State

    Input a = 0 Input a = 1

    State Output State Output

    q1 q1 1 q20 0q20 q4 1 q4 1

    q21 q4 1 q4 1

    q30 q21 1 q31 1

    q31 q21 1 q31 1

    q4 q30 0 q1 1

    Now, rearranging the state table as shown in table, into the Moore machine format, we obtain the state table

    as shown below.

    Moore Machine

    Present State

    Next State

    Input a = 0 Input a = 1 Output

    State State

    q1 q1 q20 1

    q20 q4 q4 0

    q21 q4 q4 1

    q30 q21 q31 0

    q31 q21 q31 1

    q4 q30 q1 1

    Now, from the state table as shown above, we observe that the output corresponding to the initial state q 1 is

    1. Hence, to ensure that the Mealy and Moore machines are equivalent, we need to insert a row at the

    beginning of the state table with present initial state q0.

    Moore Machine

    Present State

    Next State

    Input a = 0 Input a = 1 Output

    State State

    q0 q1 q20 1

    q1 q1 q20 1

    q20 q4 q4 0

    q21 q4 q4 1

    q30 q21 q31 0

    q31 q21 q31 1

    q4 q30 q1 1