SlideShare a Scribd company logo
1 of 7
Finite State Machines
 Information processing machine
   It is a device that receives a set of input signals and produces a
   corresponding set of output signals.

 machines with memory and without memory.
   machine without memory: its output at any instance depends
     only on the input at that instant.
   machine with memory (it can remember ″what has happened
     in the past″): its output at any instant depends on the input at
     that instant as well as on inputs at previous instant.
   state: A state represents a summary of the past history of the
    machine.
   finite state machine: A machine with a finite number of
    states.
   infinite state machine: A machine with an infinite number of
    states.

 A finite state machine is specified by
  1. A finite set of states S = { s0 , s1 , s2 , …}.
  2. A special element of the set S, s0 , referred to as the initial
     state.
  3. A finite set of input letters I = { i0 , i1 , i2 , …}.
  4. A finite set of output letters O = { o0 , o1 , o2 , …}.
  5. fs: A function f from S×T to S, referred to as the transition
     function.
  6. fo: A function g from S to O, referred to as the output
     function.
 machine equivalent
   Two finite state machine are said to be equivalent if, starting
   from their respective initial states, they will produce the same
   output sequence when they are given the same input sequence.

 equivalent state
   In a finite state machine, two states s1 and s2 are said to be
   equivalent if for any input sequence the machine will produce
   the same output sequence whether it starts in s1 or s2.
                        state minimization

 How to determine whether two states are equivalent?
     0-equivalent :Two states are said to be 0-equivalent if they
      have the same output.
     1-equivalent :Two states are said to be 1-equivalent if they
      have the same output and if, for every input letter, their
      successors are 0-equivalent.
     k-equivalent :Two states are said to be k-equivalent if they
      have the same output and if, for every input letter, their
      successors are (k-1)-equivalent.
     Two states are equivalent if they are k-equivalent for all k.
     k-equivalent is a equivalent relation, and forms a partition
      of the set of states.
 M simulates M′
   ∃ h: s′ → s   ∋       ∀α ∈ I*, s′∈ S′
                         g′(α) = g(h(s′), α).
 Theorem 7.1 Two states are in the same block in Πk if and
  only if they are in the same block in πk-1 and, for any input
  letter, their successors are in the same block in πk-1 .
  Proof :
    Let si and sj denote two states that are k-equivalent.
       According to the definition, they have the same output and,
       for any input letter, their successors are (k-1)-equivalent.
       Note that according to the definition, si and sj are also (k-
       1)-equivalent.
    Thus, we conclude that two states are k-equivalent if and
       only if they are (k-1)-equivalent and, for any input letter,
       their successors are also (k-1)-equivalent. Thus, the
       theorem follows immediately.                            Q.E.D.

 Two observations
     1. If πk is equal to πk-1, then πm is equal to πk-1 for all m ≥ k.
     2. πk is a refinement of πk-1.
Finite State Machines as Language
                          Recognizers
 O = {0,1}
     accepting state :A state is said to be an accepting state if
      its output is 1.
     rejecting state :A state is said to be an rejecting state if
      its output is 0.
     An input sequence is said to be accepted by the finite state
      machine if it leads the machine from the initial state to an
      accepting state. On the other hand, an input sequence is
      said to be rejected by the finite state machine if it leads
      the machine from the initial state to an rejecting state.

 finite state language
    A language is said to be a finite state language if there is a
    finite state machine that accepts exactly all sentences in the
    language.

 Theorem 7.2 Let L be a finite state language accepted by a
  finite state machine with N states. For any sequence α whose
  length is N or larger in the language, α can be written as uvw
  such that v is nonempty and uv iw is also in the language for
  i≧ 0, where vi denotes the concatenation of i copies of the
  sequence v. (In other words, uw, uvw, uvvw, uvvvw, … are all
  in the language.)
Proof :
 Letα= a1a2a3…aN, without loss of generality.
 Let sj0, sj1, sj2, …, sjN denote the states the machine visits,
 where sj0 is the initial state and sjN is an accepting state.
 Among the N+1 states sj0, sj1, sj2, …, sjN there are two of them
 that are the same. Suppose that is state sk, we realize that the
 sequences uw, uvw, uvvw, uvvvw, …, uvIw, … will all lead the
 machine from the initial state sj0 to the accepting state sjN.




                                                        Q.E.D.
                                
Finite State Language and Type-3 Languages
 A nondeterministic finite state machine is specified by
    1. A finite set of states S = {s0, s1, s2 , …}.
    2. A special element of the set S, s0 , referred to as the initial
       state.
    3. A finite set of input letters I = {i1, i2, …}.
    4. A finite set of output letters O = {o1, o2, …}.
    5. A function F from S× T to ℘(S), referred to as the
       transition function.
    6. A function g from S to O, referred to as to output function.

It is a very useful abstract model as a language recognizer.

 Whether a nondeterministic finite state machine is more
  powerful than a deterministic finite state machine?
                                   NO!
 For any given nondeterministic finite state machine,
  there is a deterministic finite state machine that accepts
  exactly the same language.
      Let M be a nondeterministic finite state machine with
          1. {s0, s1, s2, …} being the set of states
          2. s0 be the initial state
          3. {i1, i2, …} being the set of input letters
          4. {0,1} being the set of output letters
          5. F from S× I to ℘(S) being the transition function
          6. g from S to {0,1} being the output function.
 Construct a corresponding deterministic finite state
                ′
   machine M as follows. Let
     1. P(S) be the set of states
     2. s0 be the initial state
     3. {i1, i2, …} being the set of input letters
     4. {0,1} being the set of output letters
     5. F′ : P(S)×I →℘(S)
            F′ ({ },iq) = {} for any input letter iq,
                             
            F (Sp, iq) = sr ∈s p F(sr, iq) for any Sp
              ’

     6. g′: P(S) → {0,1} output function, for any Sp ⊆ S
             g′(Sp) = 1 if there exists sr in Sp ∋ g(sr) = 1
                    = 0 otherwise.
 An example
                              M
       State          0             1      output
         A            B            B,C       0
         B           A,C            _        0
         C            A            B,C       1
                              M′
       State           0             1     output
        {A}           {B}          {B,C}     0
        {B}          {A,C}           {}      0
        {C}           {A}          {B,C}     1
       {A,B}        {A,B,C}        {B,C}     0
       {A,C}         {A,B}         {B,C}     1
       {B,C}         {A,C}         {B,C}     1
      {A,B,C}       {A,B,C}        {B,C}     1
         {}            {}            {}      0
  Machine M and M′ accept exactly the same language, since
                                                    ′
  an input sequence accepted by M will bring M to a state,
  which is a subset of M, in which there is at least one that is
  an accepting state in M.

More Related Content

What's hot

POST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMPOST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMRajendran
 
ω Automaton
ω Automatonω Automaton
ω AutomatonAzfar Ali
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introductionNAMRATA BORKAR
 
NFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushikNFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushikMudsaraliKhushik
 
Calculus 45S Slides March 28, 2008
Calculus 45S Slides March 28, 2008Calculus 45S Slides March 28, 2008
Calculus 45S Slides March 28, 2008Darren Kuropatwa
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Animesh Chaturvedi
 
Automata
AutomataAutomata
AutomataGaditek
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computationBipul Roy Bpl
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automatadeepinderbedi
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite AutomataAdel Al-Ofairi
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysisDattatray Gandhmal
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computationprasadmvreddy
 
Introduction to fa and dfa
Introduction to fa  and dfaIntroduction to fa  and dfa
Introduction to fa and dfadeepinderbedi
 
Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Srimatre K
 

What's hot (20)

POST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMPOST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEM
 
ω Automaton
ω Automatonω Automaton
ω Automaton
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introduction
 
NFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushikNFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushik
 
Calculus 45S Slides March 28, 2008
Calculus 45S Slides March 28, 2008Calculus 45S Slides March 28, 2008
Calculus 45S Slides March 28, 2008
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
 
Automata
AutomataAutomata
Automata
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Dfa h11
Dfa h11Dfa h11
Dfa h11
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
 
Nfa to-dfa
Nfa to-dfaNfa to-dfa
Nfa to-dfa
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
 
Theory of computation / Post’s Correspondence Problems (PCP)
Theory of computation / Post’s Correspondence Problems (PCP)Theory of computation / Post’s Correspondence Problems (PCP)
Theory of computation / Post’s Correspondence Problems (PCP)
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
 
L3 cfg
L3 cfgL3 cfg
L3 cfg
 
Introduction to fa and dfa
Introduction to fa  and dfaIntroduction to fa  and dfa
Introduction to fa and dfa
 
flat unit1
flat unit1flat unit1
flat unit1
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4
 

Viewers also liked

The Magic Kingdom
The Magic KingdomThe Magic Kingdom
The Magic Kingdomcmueller720
 
Decision making class
Decision making classDecision making class
Decision making classJyoti Gautam
 
Silabus hukum ekonomi internasional fh uk satya wacana salatiga
Silabus hukum ekonomi internasional fh uk satya wacana salatigaSilabus hukum ekonomi internasional fh uk satya wacana salatiga
Silabus hukum ekonomi internasional fh uk satya wacana salatigaTheo Litaay
 
Stock market
Stock marketStock market
Stock marketgupta24
 

Viewers also liked (6)

The Magic Kingdom
The Magic KingdomThe Magic Kingdom
The Magic Kingdom
 
Google earth
Google earthGoogle earth
Google earth
 
FamiliaCorda
FamiliaCordaFamiliaCorda
FamiliaCorda
 
Decision making class
Decision making classDecision making class
Decision making class
 
Silabus hukum ekonomi internasional fh uk satya wacana salatiga
Silabus hukum ekonomi internasional fh uk satya wacana salatigaSilabus hukum ekonomi internasional fh uk satya wacana salatiga
Silabus hukum ekonomi internasional fh uk satya wacana salatiga
 
Stock market
Stock marketStock market
Stock market
 

Similar to Finite State Machines Explained

Finite State Machines with Output
Finite State Machines with OutputFinite State Machines with Output
Finite State Machines with OutputMustafa Saeed
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfSergioUlisesRojasAla
 
String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,8neutron8
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Dr. Maamoun Ahmed
 
Automata
AutomataAutomata
AutomataGaditek
 
In the automata theory, a nondeterministic finite.pdf
                     In the automata theory, a nondeterministic finite.pdf                     In the automata theory, a nondeterministic finite.pdf
In the automata theory, a nondeterministic finite.pdfannesmkt
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdfFariyaTasneem1
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! EdholeEdhole.com
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! EdholeEdhole.com
 
Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1bolovv
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automataElakkiyaS11
 

Similar to Finite State Machines Explained (20)

Finite State Machines with Output
Finite State Machines with OutputFinite State Machines with Output
Finite State Machines with Output
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdf
 
String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
Automata
AutomataAutomata
Automata
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
In the automata theory, a nondeterministic finite.pdf
                     In the automata theory, a nondeterministic finite.pdf                     In the automata theory, a nondeterministic finite.pdf
In the automata theory, a nondeterministic finite.pdf
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! Edhole
 
Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1
 
Automaton
AutomatonAutomaton
Automaton
 
QB104541.pdf
QB104541.pdfQB104541.pdf
QB104541.pdf
 
Automata Theory
Automata TheoryAutomata Theory
Automata Theory
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
Flat
FlatFlat
Flat
 
Finite automata
Finite automataFinite automata
Finite automata
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
 

Finite State Machines Explained

  • 1. Finite State Machines  Information processing machine It is a device that receives a set of input signals and produces a corresponding set of output signals.  machines with memory and without memory.  machine without memory: its output at any instance depends only on the input at that instant.  machine with memory (it can remember ″what has happened in the past″): its output at any instant depends on the input at that instant as well as on inputs at previous instant.  state: A state represents a summary of the past history of the machine.  finite state machine: A machine with a finite number of states.  infinite state machine: A machine with an infinite number of states.  A finite state machine is specified by 1. A finite set of states S = { s0 , s1 , s2 , …}. 2. A special element of the set S, s0 , referred to as the initial state. 3. A finite set of input letters I = { i0 , i1 , i2 , …}. 4. A finite set of output letters O = { o0 , o1 , o2 , …}. 5. fs: A function f from S×T to S, referred to as the transition function. 6. fo: A function g from S to O, referred to as the output function.
  • 2.  machine equivalent Two finite state machine are said to be equivalent if, starting from their respective initial states, they will produce the same output sequence when they are given the same input sequence.  equivalent state In a finite state machine, two states s1 and s2 are said to be equivalent if for any input sequence the machine will produce the same output sequence whether it starts in s1 or s2. state minimization  How to determine whether two states are equivalent?  0-equivalent :Two states are said to be 0-equivalent if they have the same output.  1-equivalent :Two states are said to be 1-equivalent if they have the same output and if, for every input letter, their successors are 0-equivalent.  k-equivalent :Two states are said to be k-equivalent if they have the same output and if, for every input letter, their successors are (k-1)-equivalent.  Two states are equivalent if they are k-equivalent for all k.  k-equivalent is a equivalent relation, and forms a partition of the set of states.  M simulates M′ ∃ h: s′ → s ∋ ∀α ∈ I*, s′∈ S′ g′(α) = g(h(s′), α).
  • 3.  Theorem 7.1 Two states are in the same block in Πk if and only if they are in the same block in πk-1 and, for any input letter, their successors are in the same block in πk-1 . Proof :  Let si and sj denote two states that are k-equivalent. According to the definition, they have the same output and, for any input letter, their successors are (k-1)-equivalent. Note that according to the definition, si and sj are also (k- 1)-equivalent.  Thus, we conclude that two states are k-equivalent if and only if they are (k-1)-equivalent and, for any input letter, their successors are also (k-1)-equivalent. Thus, the theorem follows immediately. Q.E.D.  Two observations 1. If πk is equal to πk-1, then πm is equal to πk-1 for all m ≥ k. 2. πk is a refinement of πk-1.
  • 4. Finite State Machines as Language Recognizers  O = {0,1}  accepting state :A state is said to be an accepting state if its output is 1.  rejecting state :A state is said to be an rejecting state if its output is 0.  An input sequence is said to be accepted by the finite state machine if it leads the machine from the initial state to an accepting state. On the other hand, an input sequence is said to be rejected by the finite state machine if it leads the machine from the initial state to an rejecting state.  finite state language A language is said to be a finite state language if there is a finite state machine that accepts exactly all sentences in the language.  Theorem 7.2 Let L be a finite state language accepted by a finite state machine with N states. For any sequence α whose length is N or larger in the language, α can be written as uvw such that v is nonempty and uv iw is also in the language for i≧ 0, where vi denotes the concatenation of i copies of the sequence v. (In other words, uw, uvw, uvvw, uvvvw, … are all in the language.)
  • 5. Proof : Letα= a1a2a3…aN, without loss of generality. Let sj0, sj1, sj2, …, sjN denote the states the machine visits, where sj0 is the initial state and sjN is an accepting state. Among the N+1 states sj0, sj1, sj2, …, sjN there are two of them that are the same. Suppose that is state sk, we realize that the sequences uw, uvw, uvvw, uvvvw, …, uvIw, … will all lead the machine from the initial state sj0 to the accepting state sjN. Q.E.D. 
  • 6. Finite State Language and Type-3 Languages  A nondeterministic finite state machine is specified by 1. A finite set of states S = {s0, s1, s2 , …}. 2. A special element of the set S, s0 , referred to as the initial state. 3. A finite set of input letters I = {i1, i2, …}. 4. A finite set of output letters O = {o1, o2, …}. 5. A function F from S× T to ℘(S), referred to as the transition function. 6. A function g from S to O, referred to as to output function. It is a very useful abstract model as a language recognizer.  Whether a nondeterministic finite state machine is more powerful than a deterministic finite state machine? NO!  For any given nondeterministic finite state machine, there is a deterministic finite state machine that accepts exactly the same language.  Let M be a nondeterministic finite state machine with 1. {s0, s1, s2, …} being the set of states 2. s0 be the initial state 3. {i1, i2, …} being the set of input letters 4. {0,1} being the set of output letters 5. F from S× I to ℘(S) being the transition function 6. g from S to {0,1} being the output function.
  • 7.  Construct a corresponding deterministic finite state ′ machine M as follows. Let 1. P(S) be the set of states 2. s0 be the initial state 3. {i1, i2, …} being the set of input letters 4. {0,1} being the set of output letters 5. F′ : P(S)×I →℘(S) F′ ({ },iq) = {} for any input letter iq,  F (Sp, iq) = sr ∈s p F(sr, iq) for any Sp ’ 6. g′: P(S) → {0,1} output function, for any Sp ⊆ S g′(Sp) = 1 if there exists sr in Sp ∋ g(sr) = 1 = 0 otherwise.  An example M State 0 1 output A B B,C 0 B A,C _ 0 C A B,C 1 M′ State 0 1 output {A} {B} {B,C} 0 {B} {A,C} {} 0 {C} {A} {B,C} 1 {A,B} {A,B,C} {B,C} 0 {A,C} {A,B} {B,C} 1 {B,C} {A,C} {B,C} 1 {A,B,C} {A,B,C} {B,C} 1 {} {} {} 0 Machine M and M′ accept exactly the same language, since ′ an input sequence accepted by M will bring M to a state, which is a subset of M, in which there is at least one that is an accepting state in M.