COSC 341 Lecture 8 Automata - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

COSC 341 Lecture 8 Automata

Description:

COSC341 Lecture 8. 1. COSC 341. Lecture 8 Automata. Our interest: effectively computable processes. ... Deterministic finite automaton (DFA) ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 11
Provided by: MOL52
Category:

less

Transcript and Presenter's Notes

Title: COSC 341 Lecture 8 Automata


1
COSC 341Lecture 8 Automata
  • Our interest effectively computable processes.
  • Intuitively, processes machines can carry out.
  • Will build increasingly powerful machines
  • finite automaton (e.g. binary adder)
  • pushdown automaton (has a stack for memory)
  • Turing machine (can do all a computer can
    hope to do with unlimited memory and processor
    speed).
  • string is accepted as input to a machine
  • means
  • string is in some language.

2
Deterministic finite automaton (DFA)
The following DFA accepts the language over a,
b consisting of all strings ending in a M Q
q0, q1 ? a b ? a, b q0 q1
q0 F q1 q1 q1 q0 a b a
q0, aba q0 a b a q1, ba
q1 a b a q0, a
q0 a b a q1, ? q1
3
State diagrams
DFA (Q, ?, ?, q0, F) to accept language L1
defined by regular expression (a?b)bb(a?b) Q
q0, q1, q2 set of states ? a,
b alphabet ? a b transition
function q0 q0 q1 q1 q0 q2 q2
q2 q2 q0 start state F q2
final/accepting state
a
a, b
b
b
q1
q2
q0
a
4
More diagrams of DFAs
L2 strings not containing aa (b?ab)(a??)
b
a, b
a
a
q1
q2
q0
b
What about a DFA for L1?L2 ?
a
a
b
q1
q2
q3
a
a
b
a
b
b
b
q4
q5
q0
Diagram is not obvious.
a, b
5
Incompletely specified DFA
An incompletely specified DFA for accepting L
anbn 0 n 113 has a simpler diagram
a
a
a0
a1
a2
a113
b
b
b
b1
b0
b112
b
The transition function d is not total! No matter
what state the machine is in, if it halts before
processing the entire input string, it has
crashed, which counts as rejecting the string,
not as accepting the string. For example, given
the string abb the machine crashes in state b0,
which is an accepting state, but crash
rejection!
6
Non-deterministic DFA
Instead of ?(q, a) ? Q, let ?(q, a) ? Q. Example
We build an NFA for (a?b)bb(a?b) Q q0, q1,
q2) ? a b ? a, b q0 q0
q0,q1 F q2 q1 ? q2 q2
q2 q2 q0, abb q0, abb q0, bb
q0, bb q0, b q1, b q0, ?
q2, ? A string is accepted if some
computation processes the entire string and halts
in a final state.
7
Diagrams of NFAs
Old DFA for (a?b)bb(a?b)
a
a, b
b
b
q1
q2
q0
a
New NFA for (a?b)bb(a?b)
a, b
a, b
b
b
q1
q2
q0
Now ?(q0, b) q0, q1.
8
NFA-? (NFA plus ?-transitions)
It is convenient, from a design point of view, to
allow l-transitions ? Q?(???) ??(Q). L1
(a?b)bb(a?b)
a, b
a, b
b
b
q1
q2
q0
L2 (b?ab)(a??)
b
a
q1
q0
b
L1?L2
a, b
a, b
b
b
q10
q11
?
q12
q0
b
a
?
q20
q21
b
9
Concatenating languages
To build an NFA-? to accept L1L2 just join their
machines with a ?-arc
a, b
a, b
b
b
q11
q12
q10
?
a
q21
q20
b
b
Something similar to have L accepted.
10
Removing non-determinism
Good news We dont need non-determinism, dont
need ?-transitions either, they are just handy
tricks. Fact For every NFA-?, there is a DFA that
accepts exactly the same language. Says
who? Simple trick converts NFA-? to DFA take
sets of states as the new states, i.e. change
from Q to a new Q? ? ?(Q). See example.
Write a Comment
User Comments (0)
About PowerShow.com