2way & with output automata

Upload: pramod198965

Post on 08-Aug-2018

245 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/22/2019 2way & With Output Automata

    1/25

    TWO-WAYDETERMINISTIC

    FINITE AUTOMATA

    Presented By: Raushan kumar

    (2DFA)

  • 8/22/2019 2way & With Output Automata

    2/25

    DFA

    Input is processed once from left to right. After an

    input has been read, the DFA decides whether the

    input is accepted or rejected.

    2DFA

    Can read the input back and forth with no limit on how

    many times an input symbol can be read.

    As in the case of DFA, the 2DFA decides whether a given

    input is accepted or rejected.

  • 8/22/2019 2way & With Output Automata

    3/25

    The concept of 2DFA was originated by Rabin and Scott

    in 1997

    2DFA is a generalized version of the DFA which can

    revisit characters already processed.

    WHATIS 2DFA?

  • 8/22/2019 2way & With Output Automata

    4/25

    HOW 2DFA WORKS?

    Two-way Finite Automata have a read head, whichcan move left or right over the input string.

    Consists of the symbols of the input string asoccupying cells of a finite tape, one symbol per cell.

    The input string is enclosed in left and rightendmarkers and , which are not elements of theinput alphabet .

    The read head may not move outside of theendmarkers.

  • 8/22/2019 2way & With Output Automata

    5/25

    STRUCTUREOF 2DFA

  • 8/22/2019 2way & With Output Automata

    6/25

    FORMAL DEFINITIONOF 2DFA

    Is a quintuple

    M = ( Q, , , q0 , F)

    Function takes a state and a symbol asarguments and returns a new state and a direction

    to move the head.

    If (p, b) = (q, L/R), then whenever the machine is

    in state p and scanning a tape cell containingsymbol b, it moves its head one cell in the direction

    d and enters state q.

  • 8/22/2019 2way & With Output Automata

    7/25

    TURINGMACHINE

    Move back and forth in the working tape while

    reading and/or writing.

    Has no limit to the amount of memory that it can

    use.

    2DFAs can be seen as read-only Turing machines with

    no work tape, only a read-only input tape

    EXAMPLE:

  • 8/22/2019 2way & With Output Automata

    8/25

    HOWDOES DFA COMPARETO 2DFA?

    2DFA can solve any problems that are solvable by DFA.

    Next, are there problems that can be solved by 2DFA but

    cannot be solved by DFA

  • 8/22/2019 2way & With Output Automata

    9/25

    WHYNOT 2DFA?

    Consumes less memory and time than DFA.

    Problems that can be solved by DFA can be solved by

    2DFA

    Easy to implement/ much more powerful than DFA.

  • 8/22/2019 2way & With Output Automata

    10/25

    FINITEAUTOMATAWITHOUTPUT

  • 8/22/2019 2way & With Output Automata

    11/25

    MOOREAND MEALY MACHINES

    Both these machine types follow the basic

    characteristics of state machines, but differ in the

    way that outputs are produced.

    Moore Machine:

    Outputs are independent of the inputs, ie outputs

    are effectively produced from within the state of

    the state machine.

    Mealy Machine:

    Outputs can be determined by the present state

    and the present inputs, ie outputs are produced

    as the machine makes a transition from one

    state to another.

  • 8/22/2019 2way & With Output Automata

    12/25

    MATHEMATICAL

    REPRESENTATION

    M = (Q , , , , qo , )

    Q = A nonempty finite set of state in M.

    = A nonempty finite set of input symbols.

    (delta.upp) = A nonempty finite set of outputs. (delta.low) = It is a transition function which

    takes two arguments input state and inputsymbol.

    qo

    = Initial state of M belongs to Q. (lambda) = It is a mapping function which

    maps Q to giving output associated with eachstate.

  • 8/22/2019 2way & With Output Automata

    13/25

    MOORE MACHINE DIAGRAMS

    State 2

    x,y

    State 1

    q,ra,b

    i,j

    Input condition that

    must exist in order

    to execute these

    transitions from

    State 1

    Output condition that

    results from being in

    a particular present

    state

    The Moore State Machine

    output is shown inside the

    state bubble, because the

    output remains the same as

    long as the state machine

    remains in that state.The output can be arbitrarily

    complex but must be the

    same every time the

    machine enters that

    state.

  • 8/22/2019 2way & With Output Automata

    14/25

    MOORE MACHINE

    Describe Outputs as Concurrent Statements

    Depending on State Only

    state 1 /

    output 1

    state 2 /

    output 2

    transitioncondition 1

    transition

    condition 2

  • 8/22/2019 2way & With Output Automata

    15/25

    EXAMPLE OF

    MOORE MACHINE

    q0 q3 q1 0

    q1 q1 q2 1

    q2 q2 q3 0

    q3 q3 q0 0

    Present

    state

    input

    a=0 a=1

    output

    TRANSITION TABLE

  • 8/22/2019 2way & With Output Automata

    16/25

    TRANSITION DIAGRAM

    q0

    q2 q3

    q1

    0

    0

    1

    1

    1

    0

    0 0

    1

    0

    1

    0

    0

  • 8/22/2019 2way & With Output Automata

    17/25

    MEALY MACHINE DIAGRAMS

    State 2

    State 1

    a,b

    q,r

    i,jx,y

    Input condition that

    must exist in order

    to execute these

    transitions from

    State 1

    Output condition that

    results from being in

    a particular present

    state

    The Mealy State Machinegenerates outputs based on:

    The Present State, and

    The Inputs to the M/c.

    So, it is capable of generating

    many different patterns of output

    signals for the same state,

    depending on the inputs present

    on the clock cycle.

    Outputs are shown on transitions

    since they are determined in the

    same way as is the next state.

  • 8/22/2019 2way & With Output Automata

    18/25

    MEALY MACHINE

    Describe Outputs as Concurrent Statements

    Depending on State and Inputs

    state 1state 2

    transition condition 1 /

    output 1

    transition condition 2 /

    output 2

  • 8/22/2019 2way & With Output Automata

    19/25

    EXAMPLE OF

    MEALY MACHINE

    q1 q3 0 q2 0

    q2 q1 1 q4 1

    q3 q2 1 q1 0

    q4 q4 1 q3 0

    Present

    state

    Input a = 0

    State output

    Input a = 1

    Stateoutput

    TRANSITION TABLE

  • 8/22/2019 2way & With Output Automata

    20/25

    q1

    q3 q4

    q2

    TRANSITION DIAGRAM

    1/1

    0/1

    0/1

    1/0

    1/0 0/0

    1/0

    0/1

  • 8/22/2019 2way & With Output Automata

    21/25

    TRANSFORMING A MOORE MACHINE INTO

    A MEALY MACHINE

    q1

    q1MOOREMACHINE

    MEALY

    MACHINE

    d

    c/P

    b/P

    a/P

    d

    P

    c

    b

    a

  • 8/22/2019 2way & With Output Automata

    22/25

    EXAMPLE

    q0 q3

    q2

    q1

    0 1

    0

    1

    MOORE MACHINE

    aa

    a

    a/b

    b

    b

    b

  • 8/22/2019 2way & With Output Automata

    23/25

    CONVERT INTO MEALY MACHINE

    q0 q3

    q2

    q1

    MEALY MACHINE

    a/1 , b/1

    a/1a/1

    b/0

    b/0b/1

    a/0

  • 8/22/2019 2way & With Output Automata

    24/25

    TRANSFORMING A MEALY MACHINE INTO

    A MOORE MACHINE

    q1

    q11 q12

    10

    ba

    a/1

    a/1

    b/1 b/1

    MOORE MACHINE

    MEALY MACHINE

    b/0

    a/0

    a/1

    b/1 b/1

    b

  • 8/22/2019 2way & With Output Automata

    25/25

    THANK YOU