theory of computation n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Theory of Computation PowerPoint Presentation
Download Presentation
Theory of Computation

Loading in 2 Seconds...

play fullscreen
1 / 88

Theory of Computation - PowerPoint PPT Presentation


  • 230 Views
  • Uploaded on

Theory of Computation. Lecture#03-08. Computer ???. What is a computer? A computer is a machine that manipulates data according to a list of instructions . What does the computer do? Any thing that can be expressed with that list of instructions.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Theory of Computation' - winka


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
theory of computation
Theory of Computation

Lecture#03-08

Unit-I

computer
Computer ???
  • What is a computer?
    • A computer is a machine that manipulates data according to a list of instructions.
  • What does the computer do?
    • Any thing that can be expressed with that list of instructions.

Unit-I

computer cont
Computer ??? (Cont.)
  • Is there anything that a computer cannot do?
    • The efforts to answer to this question are started even before the creation of the computer !!
    • The question leads us to the concept of Automata theory.

Unit-I

automata theory
Automata theory
  • The word “Automata“ is the plural of “automaton" which simply means any machine.
  • automata theory is the study of abstract machines and problems they are able to solve.
  • Automata theory is closely related to formal language theory as the automata are often classified by the class of formal languages they are able to recognize.

Unit-I

abstract machine
Abstract Machine
  • An abstract machine, also called an abstract computer, is a theoretical model of a computer hardware or software system used in Automata theory.
  • Abstraction of computing processes is used in both the computer science and computer engineering disciplines and usually assumes discrete timeparadigm.
  • abstract machines are often used in thought experiments regarding computability or to analyze the complexity of algorithms

Unit-I

finite automata or finite state machines
Finite Automata ( or Finite State Machines)
  • This is the simplest kind of machine.
  • We will study 3 types of Finite Automata:
    • Deterministic Finite Automata (DFA)
    • Non-deterministic Finite Automata (NFA)
    • Finite Automata with -transitions (-NFA)
deterministic finite automata dfa
Deterministic Finite Automata (DFA)
  • We have seen a simple example before:

1

on

start

off

1

There are some states and transitions (edges)

between the states. The edge labels tell when

we can move from one state to another.

definition of dfa
Definition of DFA
  • A DFA is a 5-tuple (Q, , , q0, F) where
    • Q is a finite set of states
    •  is a finite input alphabet
    •  is the transition function mapping Q   to Q
    • q0 in Q is the initial state (only one)
    • F  Q is a set of final states (zero or more)
definition of dfa1
Definition of DFA
  • For example:

1

on

start

off

1

Q is the set of states: {on, off}

 is the set of input symbols: {1}

 is the transitions: off  1  on; on  1  off

q0 is the initial state: off

F is the set of final states: {on}

definition of dfa2
Definition of DFA
  • Another Example:

1

0

0

q2

q1

q0

start

1

0

1

We use double circle to specify a final state.

What are Q, , , q0 and F in this DFA?

transition table
Transition Table

We can also use a table to specify the transitions.

  • For the previous example, the DFA is (Q,,,q0,F) whereQ = {q0,q1,q2},  = {0,1}, F = {q2} and  is such that

Inputs

States

0

1

q0

q1

q0

q1

q2

q0

q2

q1

q0

Note that there is one transition only for each input

symbol from each state.

dfa example
DFA Example
  • Consider the DFA M=(Q,,,q0,F) where Q = {q0,q1,q2,q3},  = {0,1}, F = {q0} and  is:

Inputs

1

q0

Start

q1

States

0

1

1

q0

q2

q1

0

0

0

0

q1

q3

q0

OR

1

q2

q0

q3

q3

q2

1

q3

q1

q2

We can use a transition table or a transition diagram to specify

the transitions. What input can take you to the final state in M?

language of a dfa
Language of a DFA
  • Given a DFA M, the language accepted (or recognized) by M is the set of all strings that, starting from the initial state, will reach one of the final states after the whole string is read.
  • For example, the language accepted by the previous example is the set of all 0 and 1 strings with even number of 0’s and 1’s.
class discussion
Class Discussion

0

0

1

q0

q1

Start

1

0

1

1

q0

q1

Start

0

0

1

0,1

1

0

q0

q1

q2

Start

What are the languages accepted by these DFA?

class discussion1
Class Discussion
  • Construct a DFA that accepts a language L over  = {0, 1} such that:
    • L is the set of all strings which starts with ‘0’

and ends with 1’s.

(b) L is the set of all strings ending with “101”.

(c) L is the set of all strings containing no consecutive “1”s nor consecutive “0”s.

yields relation
“Yields” relation
  • Indicates a transition from one configuration of a DFA to the next configuration, which is equivalent to one step in a computation
  • notation: (q0, abba) |= (q1,bba)
  • |=n denotes a transition from one configuration of a DFA to another after n steps
  • |=* denotes the reflexive, transitive closure of the relation |=, i.e., it denotes a transition from one configuration of a DFA to another after zero or more steps

Unit-I

extended transition function
Extended transition function
  • The extended transition function is represented by:

δ* : Q  * Q

  • The * denotes a string instead of a single character
  • Q will represent the state the automaton will be in after reading the entire string instead of a single character

Unit-I

extended transition function1
Extended transition function
  • Given:

a

b

c

q0

q1

q2

q3

What is δ* (q0, abc) ?

Unit-I

extended transition function2
Extended transition function

Let M = (Q, S, q0, d, A) be an FA. We can define the function d* : Q S * Q as follows:

  • For any q  Q, d* (q, ) = q
  • For any y  S * , a  S, and q  Q,

d* (q, ya) = d (d* (q, y) , a)

Unit-I

computation
Computation
  • Since a DFA is an abstract model of computation, we can now define mathematically what we mean by “computation”
  • A computation is a sequence of transitions from one configuration to another
  • A computation proceeds according to a finite set of rules or instructions -- the transition function (or program) of the DFA

Unit-I

finite state machines with output
Finite State Machines with output
  • Moore Machine: Output depends on only current state.
  • Mealy Machine : Output depends on current state as well as on input.

Unit-I

accepting
Accepting

Let M = (Q, S, q0, d, F) be an FA.

  • A string w  S*is accepted by M if

d*(q0, w)  F

  • The language accepted (or recognized) by M is the set of all strings on S that are accepted by M
  • Formally:

L(M) = {w  * : δ* (q0, w)  F}

Unit-I

l awa w a b
L = {awa : w  {a,b}*}

a

a

q0

q1

q2

b

a,b

q3

This finite accepter accepts all and only the strings of the language given above. But note that there are two arcs out of q1 labeled a. How does the FA know which path to take on an a? It doesn’t; it has to magically guess right. Also, there are no arcs out of q2. So this FA is nondeterministic.

Unit-I

l awa w a b1
L = {awa : w  {a,b}*}

a

b

a

a

q0

q1

q2

b

b

q3

This finite accepter accepts all and only the strings of the language given above. This FA is Deterministic.

Unit-I

slide25

1

0

q1

q0

1

0

  • The finite control can be described by a transition diagram:
  • Example #1:

1 0 0 1 1

q0 q0 q1 q0 q0 q0

  • One state is final/accepting, all others are rejecting.
  • The above DFA accepts those strings that contain an even number of 0’s

Unit-I

slide26

a

a/b/c

a

c

c

q0

q1

q2

b

b

  • Example #2:

a c c c b accepted

q0 q0 q1 q2 q2 q2

a a crejected

q0 q0 q0 q1

  • Accepts those strings that contain at least two c’s

Unit-I

slide27

1

0

q1

q0

1

0

  • For example #1:

Q = {q0, q1}

Σ = {0, 1}

Start state is q0

F = {q0}

δ:

0 1

q0 q1 q0

q1 q0 q1

Unit-I

slide28

a

a/b/c

a

c

c

q0

q1

q2

b

b

  • For example #2:

Q = {q0, q1, q2}

Σ = {a, b, c}

Start state is q0

F = {q2}

δ: a b c

q0 q0 q0 q1

q1 q1 q1 q2

q2 q2 q2 q2

  • Since δ is a function, at each step M has exactly one option.
  • It follows that for a given string, there is exactly one computation.

Unit-I

extension of to strings
Extension of δ to Strings

δ^ : (Q x Σ*) –> Q

δ^(q,w) – The state entered after reading string w having started in state q.

Formally:

1) δ^(q, ε) = q, and

2) For all w in Σ* and a in Σ

δ^(q,wa) = δ (δ^(q,w), a)

Unit-I

slide30

1

0

q1

q0

1

0

  • Recall Example #1:
  • What is δ^(q0, 011)? Informally, it is the state entered by M after processing 011 having started in state q0.
  • Formally:

δ^(q0, 011) = δ (δ^(q0,01), 1)

= δ (δ ( δ(q0,0), 1), 1)

= δ (δ (q1, 1), 1)

= δ (q1, 1)

= q1

  • Is 011 accepted? No, since δ^(q0, 011) = q1 is not a final state.

Unit-I

definitions for dfas
Definitions for DFAs
  • Let M = (Q, Σ, δ,q0,F) be a DFA and let w be in Σ*. Then w is accepted by M iff δ^(q0,w) = p for some state p in F.
  • Let M = (Q, Σ, δ,q0,F) be a DFA. Then the language accepted by M is the set:

L(M) = {w | w is in Σ* and δ^(q0,w) is in F}

  • Another equivalent definition:

L(M) = {w | w is in Σ* and w is accepted by M}

  • Let L be a language. Then L is a regular language iff there exists a DFA M such that L = L(M).
  • Let M1 = (Q1, Σ1, δ1, q0, F1) and M2 = (Q2, Σ2, δ2, p0, F2) be DFAs. Then M1 and M2 are equivalent iff L(M1) = L(M2).

Unit-I

slide32
Notes:
    • A DFA M = (Q, Σ, δ,q0,F) partitions the set Σ* into two sets: L(M) and

Σ* - L(M).

    • If L = L(M) then L is a subset of L(M) and L(M) is a subset of L.
    • Similarly, if L(M1) = L(M2) then L(M1) is a subset of L(M2) and L(M2) is a subset of L(M1).
    • Some languages are regular, others are not. For example, if

L1 = {x | x is a string of 0's and 1's containing an even number of 1's} and

L2 = {x | x = 0n1n for some n >= 0}

then L1 is regular but L2 is not.

  • Questions:
    • How do we determine whether or not a given language is regular?
    • How could a program “simulate” a DFA?

Unit-I

slide33

0/1

q2

0/1

0/1

q0

q1

  • Give a DFA M such that:

L(M) = {x | x is a string of 0’s and 1’s and |x| >= 2}

Unit-I

slide34

b/c

a/b/c

q0

q1

a

a

q2

b/c

  • Give a DFA M such that:

L(M) = {x | x is a string of (zero or more) a’s, b’s and c’s such

that x does not contain the substring aa}

Unit-I

slide35

b/c

a

a/b/c

q3

a

a

b

q0

q1

q2

c

b/c

  • Give a DFA M such that:

L(M) = {x | x is a string of a’s, b’s and c’s such that x

contains the substring aba}

Unit-I

slide36

b

a

b

b

a

q4

q1

q5

q2

q6

q3

q7

b

a

b

a/b

a

q0

a

b

a

b

a

  • Give a DFA M such that:

L(M) = {x | x is a string of a’s and b’s such that x

contains both aa and bb}

Unit-I

slide37

0/1

0/1

0/1

q1

q0

q0

q0

q1

0/1

0/1

q0

  • Let Σ = {0, 1}. Give DFAs for {}, {ε}, Σ*, and Σ+.

For {}: For {ε}:

For Σ*: For Σ+:

0/1

Unit-I

non deterministic fa nfa
Non-deterministic FA (NFA)
  • For each state, zero, one or more transitions are allowed on the same input symbol.
  • An input is accepted if there is a path leading to a final state.
nondeterministic finite state automata nfa
Nondeterministic Finite StateAutomata (NFA)
  • An NFA is a five-tuple:

M = (Q, Σ, δ, q0, F)

Q A finite set of states

Σ A finite input alphabet

q0 The initial/starting state, q0 is in Q

F A set of final/accepting states, which is a subset of Q

δ A transition function, which is a total function from Q x Σ to 2Q

δ: (Q x Σ) –>2Q -2Q is the power set of Q, the set of all subsets of Q δ(q,s) -The set of all states p such that there is a transition

labeled s from q to p

δ(q,s) is a function from Q x S to 2Q (but not to Q)

Unit-I

slide40

q2

0/1

0

1

0

  • Example #1: some 0’s followed by some 1’s

Q = {q0, q1, q2}

Σ = {0, 1}

Start state is q0

F = {q2}

δ: 0 1

q0

q1

q2

1

q0

q1

Unit-I

slide41

0/1

0/1

0

0

q0

q3

1

0/1

q4

q2

q1

  • Example #2: pair of 0’s or pair of 1’s

Q = {q0, q1, q2 , q3 , q4}

Σ = {0, 1}

Start state is q0

F = {q2, q4}

δ: 0 1

q0

q1

q2

q3

q4

1

Unit-I

slide42

0

1

0

  • Determining if a given NFA (example #2) accepts a given string (001) can be done algorithmically:

q0 q0 q0 q0

q3 q3 q1

q4q4accepted

  • Each level will have at most n states

Unit-I

slide43

1

0

0

  • Another example (010):

q0 q0 q0 q0

q3 q1 q3

not accepted

  • All paths have been explored, and none lead to an accepting state.

Unit-I

an example of nfa
An Example of NFA

In this NFA (Q,,,q0,F), Q = {q0,q1,q2},  = {0,1},

F = {q2} and  is:

Start

q1

0

Inputs

1

States

0

1

q0

q0

1

OR

{q1,q2}

q1

{q1 }

{q2 }

0

q2

1

{q0 }

q2

Note that each transition can lead to a set of states,

which can be empty.

language of an nfa
Language of an NFA
  • Given an NFA M, the language recognized by M is the set of all strings that, starting from the initial state, has at least one path reaching a final state after the whole string is read.
  • Consider the previous example:
    • For input “101”, one path is q0q1q1q2 and the other one is q0q2q0q1. Since q2 is a final state, so “101” is accepted. For input “1010”, none of its paths can reach a final state, so it is rejected.
more examples of nfa
More Examples of NFA

a

b

Start

q0

q1

q2

b

b

0-9

0-9

0-9

q1

q4

q6

0-9

.

E

0-9

0-9

0-9

q0

q3

q5

Start

0-9

0-9

+,-

+,-

q2

q7

0-9

0-9

class discussion2
Class Discussion
  • Consider the language L that consists of all the strings over  = {0, 1} such that the third last symbol is a “1”.

(a) Construct a DFA for L.

(b) Construct an NFA for L.

Is NFA more powerful than DFA?

slide48

a/b/c

a/b/c

q2

a

b

q0

q1

  • Let Σ = {a, b, c}. Give an NFA M that accepts:

L = {x | x is in Σ* and x contains ab}

Is L a subset of L(M)?

Is L(M) a subset of L?

  • Is an NFA necessary? Could a DFA accept L? Try and give an equivalent DFA as an exercise.
  • Designing NFAs is not a typical task.

Unit-I

nondeterminism
Nondeterminism

A finite automaton is deterministic if:

from every node there is exactly one arc labeled for each character in the alphabet of the language. But in case of Non – deterministic from every node more that one transition can take place.

Unit-I

l a m b n m n 0
L = {ambn : m, n  0}

a

b

a

q0

q1

q2

b

a,b

Does this automaton correspond to (represent, accept) the above language? Is it deterministic?

Unit-I

slide51

a

b

a,b

b

a

Some exercises

q0

q1

q2

Use set notation to describe the language accepted by the above DFA

Unit-I

slide52

a

b

a,b

b

a

Some exercises

q0

q1

q2

L(M) = {anbm}, where n  0 and m  1

Unit-I

slide53

Some exercises

A DFA that accepts the formal language {ab}.

a

b

q0

q1

q2

b

a

a,b

q3

a,b

Unit-I

slide54

Some exercises

Use set notation to describe the language

accepted by the following DFA.

b

a

b

c

c

a

a,b,c

b,c

a

Can you give a DFA that accepts the

complement of this language?

Unit-I

slide55
NDFA

Differences between a DFA and an NDFA:

(1) in an NDFA, the range of  is in the powerset of Q (instead of just Q), so that from the current state, upon reading a symbol:

(a) more than one state might be the next state of the NDFA, or

(b) no state may be defined as the next state of the NDFA, and

(2) -moves are possible; that is, a transition from one state to another may occur without reading a symbol from the input string.

Unit-I

ndfa dfa
NDFA = DFA

One kind of automaton is more powerful than another if it can accept and reject some kinds of languages that the other cannot.

Two finite accepters are equivalent if both accept the same language, that is,

L(M1) = L(M2)

As mentioned previously, we can always find an equivalent DFA for any given NDFA.

Therefore, NDFA’s are no more powerful than DFA’s.

Unit-I

dfa and nfa
DFA and NFA
  • Is NFA more powerful than DFA?
  • NO! NFA is equivalent to DFA.

Trivial

DFA

NFA

Constructive

Proof

constructing dfa from nfa
Constructing DFA from NFA
  • Given any NFA M=(Q,,,q0,F)recognizing a language L over , we can construct a DFA N=(Q’, ,’,q0’,F’) which also recognizes L:
    • Q’ = set of all subsets of Q
    • e.g., if Q = {q0, q1}, Q’ = {{}, {q0}, {q1}, {q0, q1}}
    • q0’ = {q0}
    • F’ = set of all states in Q’ containing a final state of M
    • ’({q1,q2, … qi}, a) = (q1,a)  (q2,a) ...  (qi,a)

a state in N

a state in M

ndfa dfa1
NDFA  DFA

Example: Convert the following NDFA into an equivalent DFA (Figure 2.12 in Linz.).

Unit-I

ndfa dfa2
NDFA  DFA
  • Create a graph GD with vertex {q0}. Identify this vertex as the initial vertex.
  • OK; here it is:

{q0}

Unit-I

ndfa dfa3
NDFA  DFA
  • Repeat the following steps until no more edges are missing:
    • Take any vertex {qi, qj, …, qk} of GD that has no outgoing edge for some a  .
    • OK. Vertex q0 in our new DFA has no outgoing edge for a yet.
    • Compute δ* (qi, a), δ* (qj, a), …, δ* (qk, a).
    • OK. From q0 in our NDFA, upon reading an a the extended transition function leaves us in state q1, or q2 via a “free” lambda-move.

Unit-I

ndfa dfa4
NDFA  DFA
  • Then form the union of all these δ*, yielding the set {ql, qm, …, qn}.
  • So our new DFA will have a state labeled {q1, q2}.
  • Create a vertex for GD labeled {ql, qm, …, qn} if it does not already exist.
  • So create a vertex for our new DFA and label it {q1, q2}.
  • Add to GD an edge from {qi, qj, …, qk} to {ql, qm, …, qn} and label it with a.
  • So add a transition labeled a to {q1, q2} from q0.

Unit-I

ndfa dfa5
NDFA  DFA

So now we have:

{q0}

{q1, q2}

a

Unit-I

ndfa dfa6
NDFA  DFA
  • Repeat the following steps until no more edges are missing:
    • Take any vertex {qi, qj, …, qk} of GD that has no outgoing edge for some a  .
    • OK. Vertex q0 in our new DFA has no outgoing edge for b yet.
    • Compute δ* (qi, b), δ* (qj, b), …, δ* (qk, b).
    • Well, there is no transition specified in our NDFA from state q0 upon reading a b.Therefore, δ* ({q0}, b) = .

Unit-I

ndfa dfa7
NDFA  DFA
  • Then form the union of all these δ*, yielding the set {ql, qm, …, qn}.
  • So our new DFA will have a state labeled .
  • Create a vertex for GD labeled {ql, qm, …, qn} if it does not already exist.
  • So create a vertex for our new DFA and label it .
  • Add to GD an edge from {qi, qj, …, qk} to {ql, qm, …, qn} and label it with a.
  • So add a transition labeled b to  from q0.

Unit-I

ndfa dfa8
NDFA  DFA

So now we have:

{q0}

{q1, q2}

b

a

Any state labeled  represents an impossible move and thus is a non-final trap state.

a, b

Unit-I

ndfa dfa9
NDFA  DFA
  • Repeat the following steps until no more edges are missing:
    • Take any vertex {qi, qj, …, qk} of GD that has no outgoing edge for some a  .
    • OK. Vertex {q1, q2} in our new DFA has no outgoing edge for a yet.
    • Compute δ* (qi, b), δ* (qj, b), …, δ* (qk, b).
    • OK. From q1 in our NDFA, upon reading an a the extended transition function leaves us in state q1, or q2 via a “free” lambda-move.From q2 in our NDFA, upon reading an a there is no specified transition.

Unit-I

ndfa dfa10
NDFA  DFA
  • Then form the union of all these δ*, yielding the set {ql, qm, …, qn}.
  • The union is {q1, q2} .
  • Create a vertex for GD labeled {ql, qm, …, qn} if it does not already exist.
  • It does.
  • Add to GD an edge from {qi, qj, …, qk} to {ql, qm, …, qn} and label it with a.
  • So add a transition labeled a to {q1, q2} from {q1, q2} .

Unit-I

ndfa dfa11
NDFA  DFA

So now we have:

a

{q0}

{q1, q2}

b

a

a, b

Unit-I

ndfa dfa12
NDFA  DFA
  • Repeat the following steps until no more edges are missing:
    • Take any vertex {qi, qj, …, qk} of GD that has no outgoing edge for some a  .
    • OK. Vertex {q1, q2} in our new DFA has no outgoing edge for b yet.
    • Compute δ* (qi, b), δ* (qj, b), …, δ* (qk, b).
    • OK. From q2 in our NDFA, upon reading a b the extended transition function leaves us in state q0. From q1 in our NDFA, upon reading a b there is no specified transition. However, we can make a free lambda-move to q2, and thence to q0.

Unit-I

ndfa dfa13
NDFA  DFA
  • Then form the union of all these δ*, yielding the set {ql, qm, …, qn}.
  • The union is {q1, q2} .
  • Create a vertex for GD labeled {ql, qm, …, qn} if it does not already exist.
  • It does.
  • Add to GD an edge from {qi, qj, …, qk} to {ql, qm, …, qn} and label it with a.
  • So add a transition labeled b to q0 from {q1, q2} .

Unit-I

ndfa dfa14
NDFA  DFA
  • Exit from loop.
  • Every state of GD whose label contains and qf  FN is identified as a final vertex.
  • OK. State q1 in the NDFA is a final state, so state {q1, q2} in the DFA will be a final state.
  • If MN accepts , the vertex q0 in GD is also made a final vertex.

Unit-I

ndfa dfa15
NDFA  DFA

Here is the finished DFA (Figure 2.13 in Linz):

Unit-I

an example of nfa dfa
An Example of NFA  DFA
  • Consider a simple NFA:
  • Construct a corresponding DFA:

0

1

0

q0

q1

1

Start

1

1

Start

{q1}

{q0}

1

0

0

{q0, q1}

{}

1,0

1,0

ndfa dfa16
NDFA  DFA

Example: Convert this NDFA to a DFA.

Unit-I

ndfa dfa17
NDFA  DFA

Example:

Unit-I

ndfa dfa18
NDFA  DFA

Example:

Unit-I

minimal dfa s
Minimal DFA’s

Two states p and q of a DFA are called indistinguishable if

* (p, w)  F implies * (q, w)  F ,

and

* (p, w)  F implies * (q, w)  F ,

for all w  *.

If there exists some string w  * such that

* (p, w)  F

and

* (q, w)  F

or vice versa, then the states p and q are said to be distinguishable by string w.

Unit-I

the mark procedure
The “Mark” procedure

This procedure marks all pairs of distinguishable states.

1. Remove all inaccessible states.

2. Consider all pairs of states (p, q). If p  F and q  F or vice versa, mark the pair (p, q) as distinguishable.

3. Repeat the following step until no previously unmarked pairs are marked:

For all pairs (p, q) and all a , compute  (p, a) = pa and  (q, a) = qa. If the pair (pa, qa) is marked as distinguishable, mark (p, q) as distinguishable.

Unit-I

the reduce procedure
The “Reduce” procedure

Given a DFA M = (Q, , , q0, F), we construct a reduced DFA M’ = (Q’, , ’, q0’, F’) as follows:

1. Use procedure Mark to find all pairs of distinguishable states. Then from this find the sets of indistinguishable states by partitioning the state set Q of the DFA into disjoint subsets {qi, qj, …, qk}, {ql, qm, …, qn}, …, such that any q  Q occurs in exactly one of these subsets, that elements in each subset are indistinguishable, and that any two elements from different subsets are distinguishable.

Unit-I

the reduce procedure cont
The “Reduce” procedure, cont.

2. For each set {qi, qj, …, qk} of such indistinguishable states, create a state labeled ij…k for M.

3. For each transition rule of the form  (qr, a) = qp, find the sets to which qr and qp belong. If qr  {qi, qj, …, qk} and qp  {ql, qm, …, qn}, add to ’ a rule ’ (ij…k, a) = lm…n.

4. The initial state q0’ is that state of M’ whose label includes the 0.

5. F’ is the set of all the states whose label contains i such that qi  F.

Unit-I

theorem 2 4
Theorem 2.4

Given any DFA M, application of the procedure Reduce yields another DFA M’ such that

L(M) = L(M’)

Furthermore, M’ is minimal in the sense that there is no other DFA with a smaller number of states which also accepts L(M).

Unit-I

minimal dfa s1
Minimal DFA’s

Example: This DFA can be reduced to the DFA on the next slide.

Unit-I

minimal dfa s2
Minimal DFA’s

What are the distinguishable pairs?

Mark step 2 gives (q0, q4), (q1, q4), (q2, q4) and (q3, q4).

Step 3 computes (q1, 1) = q4 and (q0, 1) = q3. Since (q3, q4) is a distinguishable pair, (q0, q1) is also marked as a distinguishable pair. Eventually the pairs (q0, q1), (q0, q2), (q0, q3), (q0, q4), (q1, q4), (q2, q4) and (q3, q4) are marked as distinguishable.

The remaining pairs, (q1, q2), (q1, q3), and (q2, q3) are undistinguishable.

The states are partitioned into the sets {q0}, {q1, q2, q3}, and {q4}.

Unit-I

minimal dfa s3
Minimal DFA’s

This is the reduced DFA resulting from the procedure.

Unit-I

minimum number of states in an fa
Minimum number of states in an FA

If there are n distinguishable strings in a language, then there must be at least n states in the finite automata that accepts it.

The FA has no memory, other than the current state.

This puts a lower bound on the number of states in a FA recognizing a language.

Unit-I

slide87
For

Equivalence of DFA and NFA, refer page no 33

FA’s with ε-transitions, refer page no. 43

Equivalence and minimization of DFA, refer page no. 118

All from Lecture Notes#01

Unit-I