Finite Automata A finite automaton has a finite set of states with - - PowerPoint PPT Presentation

finite automata
SMART_READER_LITE
LIVE PREVIEW

Finite Automata A finite automaton has a finite set of states with - - PowerPoint PPT Presentation

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.


slide-1
SLIDE 1

Finite Automata

A finite automaton has a finite set of states with which it accepts or rejects strings.

slide-2
SLIDE 2

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

slide-3
SLIDE 3

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

slide-4
SLIDE 4

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

slide-5
SLIDE 5

An Example FA

A B C 1 1 1

Final state for 101001 is C, final state for 11101 is A.

Goddard 1: 5

slide-6
SLIDE 6

Example FA

A B 1 1

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

Goddard 1: 6

slide-7
SLIDE 7

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

slide-8
SLIDE 8

Building FAs: Do the Obvious

Starts with 00:

Goddard 1: 8

slide-9
SLIDE 9

Building FAs: Do the Obvious

Starts with 00:

A B C D 0, 1 1 1 0, 1

Goddard 1: 9

slide-10
SLIDE 10

Building FAs: Recent Memory

Ends with 00:

Goddard 1: 10

slide-11
SLIDE 11

Building FAs: Recent Memory

Ends with 00:

A B C 1 1 1

Goddard 1: 11

slide-12
SLIDE 12

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

slide-13
SLIDE 13

Example with a Trap

Alternating 0’s and 1’s:

Goddard 1: 13

slide-14
SLIDE 14

Example with a Trap

Alternating 0’s and 1’s:

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

Goddard 1: 14

slide-15
SLIDE 15

Alternating 0’s and 1’s again

A B D F 1 1 1 0, 1

Goddard 1: 15

slide-16
SLIDE 16

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

slide-17
SLIDE 17

Building FAs: Permanent Memory

An FA remembers permanently by splitting into pieces. Here is one for first and last bit the same:

S A B C D 1 1 1 1 1

Goddard 1: 17

slide-18
SLIDE 18

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

slide-19
SLIDE 19

Solutions to Practice

1)

A B 0, 1 1

2)

A B C 1 1 0, 1

3)

A B C D 1 0, 1 1 1

Goddard 1: 19

slide-20
SLIDE 20

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. State Input 1 S A C A A B B A B C D C D D C

Goddard 1: 20

slide-21
SLIDE 21

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 × Σ → Q.)

Goddard 1: 21

slide-22
SLIDE 22

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