Modeling Computation - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Modeling Computation

Description:

I, O: input/output alphabets. f: transition function, f: S I S. g: output function ... a DFA M, with a binary alphabet, which determines if the input contains ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 21
Provided by: Michael1807
Category:

less

Transcript and Presenter's Notes

Title: Modeling Computation


1
Modeling Computation
  • Rosen 5th ed., ch. 11
  • Ref Wikipedia

2
Finite State Machines (FSM)
  • Model machines (or components in a computer)
    using a particular structure
  • Classification
  • FSM with no output determine whether the input
    is accepted (recognized) or not
  • FSM with output generate output from the given
    input
  • Representations (p.752)
  • State diagram
  • State transition table

3
FSM with Output
  • Definition M (S, I, O, f, g, s0)
  • S finite set of states
  • I, O input/output alphabets
  • f transition function, f S ? I ? S
  • g output function
  • s0 initial state

Mealy machine g S?I? O Moore machineg S? O
4
Simple Example (p.753)

5
Generating Output
  • Input string x x1x2xk
  • s1 f(s0, x1), s2 f(s1, x2), , sk f(sk-1,
    xk)
  • These state transition produces output y
    y1y2yk
  • y1 g(s0, x1), y2 g(s1, x2), , yk g(sk-1,
    xk)

6
Another Example

start
Input 101011 Output 001000
7
Ex vending machines
  • description
  • State table

8
Vending Machine state diagram
9
Ex Unit Delay Machine
  • Input x1x2xk Output 0x1x2xk-1

state f f g g
state 0 1 0 1
s0 s2 s1 0 0
s1 s2 s1 1 1
s2 s2 s1 0 0
Example how the machine is designed (p.755)
10
Ex FSM for Addition
  • Design
  • s0 to remember that the previous carry is 0
  • s1 to remember that the previous carry is 1
  • example

11
FSM with No Output
  • Language recognition design and implementation
    of compilers
  • A string is recognized IFF it takes the starting
    state to one of the final states
  • Def Finite-state Automata do not produce
    output, but have a set of final states

12
Ex automaton to recognize nice
13
Finite-State Automata
  • M (S, I, f, s0, F)
  • S finite set of states
  • I input alphabets
  • f transition function, f S ? I ? S
  • s0 initial state
  • F final states, subset of S (indicated by double
    circles)

14
Example construct the state diagram

15
Recognizing Language
  • A string x is said to be recognized by the
    machine M (S, I, f, s0, F) if f(s0, x) is a
    state in F
  • The language recognized (accepted) by the machine
    M, denoted by L(M), is the set of all strings
    accepted by M.


16
Example
Deterministic finite automaton
  • The following example is of a DFA M, with a
    binary alphabet, which determines if the input
    contains an even number of 0s

17
Transformations from/to State Diagram
  • It is possible to draw a state diagram from the
    table.
  • Draw the circles to represent the states given.
  • For each of the states, scan across the
    corresponding row and draw an arrow to the
    destination state(s). There can be multiple
    arrows for an input character if the automaton is
    an NFA.
  • Designate a state as the start state. The start
    state is given in the formal definition of the
    automaton.
  • Designate one or more states as accept state.
    This is also given in the formal definition.

18
Example
  • L(M1) 1n n 0,1,2,

19
Example (cont)
  • L(M2) 1, 01

20
Example (cont)
  • L(M3) 0n,0n10x n 0,1,2,, x is any string
Write a Comment
User Comments (0)
About PowerShow.com