Docsity

Understanding Finite State Automata: From Deterministic to Nondeterministic, Study notes of Computer Science

Partial preview of the text

Download Understanding Finite State Automata: From Deterministic to Nondeterministic and more Study notes Computer Science in PDF only on Docsity!

If you can keep your head when all about you are losing theirs,

If you can keep your head when all about you are losing theirs, its just possible you haven't grasped the situation. Rose Fitzgerald Kennedy

What is the situation

5 days ago you were given an assignment to write an 11-line program (+ tests)

It’s in a language that you’ve never used before

based on a concept (algebras) that you have forgotten about

You saw some example programs in class, but you didn’t take notes.

Deterministic Finite State Automata

A very simple form of “computer”

Used in real life for control circuits

Hardware control: door circuits

Software control: telephone and network communications

Example: Door Controller

  • As found at supermarket or airport
  • The state diagram is a universally- understood way of describing such a machine. Plan view State Diagram

FSA that “recognize” languages

  • FSA “accepts” a string if it ends up in a “final” state after reading that string from an “input tape”.
  • Start state indicated with
  • Final states indicated with
  • What language is accepted by the FSA in the figure?

Let’s try some examples

0

1

01

10

001

110

Why use a formal definition?

  1. It is precise, e.g., it says that
    1. There can be no accept states (F = )
    2. δ is total, so there is exactly one “next state” for each input symbols in the Alphabet
  2. We can easily turn it into a computer program

Example

Diagram:

Formal definition:

  1. Q = { }
  2. A = { }
  3. q 0 =
  4. δ =
  5. F = { }

FSMs for Regular Languages

What FSM recognizes the language?

What FSM recognizes the language

What FSM recognizes the language {a}?

Another Example

What language is recognized by this machine?

Formal Definition of FSM Computation

Let M = (Q, A, δ, q 0 , F) be a FSM and let w = w 1 w 2 …wn be a string, where each wi ∈ A.

M accepts w if there is a sequence of states r 0 ,r 1 ,r 2 ,…rn ∈ Q such that:

  1. r 0 = q 0
  2. δ (ri-1, wi) = ri for i = 1, 2, … n
  3. rn ∈ F