0% found this document useful (0 votes)
30 views22 pages

Finite Automata: A Finite Automaton Has A Finite Set of States With Which It Accepts or Rejects Strings

A finite automaton has a finite set of states and accepts or rejects strings based on its state after reading the input string. It has three components: an input tape containing a string, a head that reads the string symbol by symbol, and a memory that is in one of a finite number of states. The automaton operates by setting its initial state, reading symbols, updating its state based on the current symbol and state, and either accepting or rejecting the string based on its final state.

Uploaded by

Sammy Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views22 pages

Finite Automata: A Finite Automaton Has A Finite Set of States With Which It Accepts or Rejects Strings

A finite automaton has a finite set of states and accepts or rejects strings based on its state after reading the input string. It has three components: an input tape containing a string, a head that reads the string symbol by symbol, and a memory that is in one of a finite number of states. The automaton operates by setting its initial state, reading symbols, updating its state based on the current symbol and state, and either accepting or rejecting the string based on its final state.

Uploaded by

Sammy Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Finite Automata

A finite automaton has a finite set of states with


which it accepts or rejects strings.
A Finite Automaton

An FA has three components:

1. input tape contains single string;


2. head reads input string one symbol at a time;
and
3. Memory is in one of a finite number of states.

Goddard 1: 2
Operating an FA

Operating an FA.
1) Set the machine to start state.
2) If End-of-String then halt.
3) Read a symbol.
4) Update state according to current state and
symbol read.
5) Goto Step 2.

Goddard 1: 3
An FA Accepts Strings

“Program” prescribes how symbols read affect


current state.

Final state is state FA is in when finished read-


ing the input string.

There are accept states (double circle) and re-


ject states.

An FA accepts input string if final state is ac-


cept state; otherwise it rejects.

Goddard 1: 4
An Example FA

1
0 0
0
A B C
1
1

Final state for 101001 is C, final state for 11101


is A.

Goddard 1: 5
Example FA

1
A B 0
1
0

Accepts all strings of 0’s and 1’s with odd num-


ber of 1’s.

Goddard 1: 6
Terminology

alphabet is a set of symbols (often denoted Σ)

language is a set of strings (unary language


means |Σ| = 1)

language of FA is the set of strings it accepts

length of a string is the number of symbols

empty string is denoted ε.

Goddard 1: 7
Building FAs: Do the Obvious

Starts with 00:

Goddard 1: 8
Building FAs: Do the Obvious

Starts with 00:


0 0
A B C 0, 1
1
1

0, 1

Goddard 1: 9
Building FAs: Recent Memory

Ends with 00:

Goddard 1: 10
Building FAs: Recent Memory

Ends with 00:


0 0
0
A B C
1
1
1

Goddard 1: 11
Building FAs: Traps

A trap is state that, once entered, one can never


leave. Used to reject partly read strings that
will never be accepted, or to accept partly read
strings that will definitely be accepted.

Goddard 1: 12
Example with a Trap

Alternating 0’s and 1’s:

Goddard 1: 13
Example with a Trap

Alternating 0’s and 1’s:

A
0 1

B D
0 1
1 0
0 1
F
C 1 0 E
0, 1

Goddard 1: 14
Alternating 0’s and 1’s again

A
0 1

1
B D
0
0 1

0, 1

Goddard 1: 15
Building FAs: Permanent Memory

An FA remembers permanently by splitting into


pieces. Here is one for first and last bit the
same:

Goddard 1: 16
Building FAs: Permanent Memory

An FA remembers permanently by splitting into


pieces. Here is one for first and last bit the
same:
0
1
A B 1
0 0

S
1
0
C D 0
1
1

Goddard 1: 17
Practice

Give FAs for each of the following three lan-


guages:

1. All binary strings with at least one 0


2. All binary strings with at most one 0
3. All binary strings starting and ending with 0
(and single-0 string counts)

Goddard 1: 18
Solutions to Practice

1) A
0
B 0, 1

2) 1 1

0 0
A B C 0, 1

1
3) A
0
B C 1
1 0
0

D 0, 1

Goddard 1: 19
Transition Table

A transition table is matrix that lists new state


given current state and symbol read.
Here’s transition table for FA for all binary strings
that begin and end with same symbol.

Input
0 1
S A C
State

A A B
B A B
C D C
D D C
Goddard 1: 20
Formal Definition

A (deterministic) FA is 5-tuple
(Q, Σ, q0, T, δ) where:

• Q is finite set of states;


• Σ is alphabet of input symbols;
• q0 is start state;
• T is subset of Q giving the accept states; and
• δ is transition function that maps state and
symbol to state. (Mathematically, δ: Q × Σ 7→
Q.)

Goddard 1: 21
Summary

A finite automaton (FA) is a device that recog-


nizes a language (set of strings). It has finite
memory and an input tape; each input symbol
that is read causes the machine to update its
state based on its current state and the symbol
read. The machine accepts the input if it is in
an accept state at the end of the string; other-
wise, the input is rejected.

Goddard 1: 22

You might also like