Post on 13-Oct-2015
description
transcript
Chapter 6: Transition Graphs
a,b
b +a
a
a
bb a,b
1
An FA: {baa} The word a? The word baabb? The input fails, or the machine fails on the input. The input is rejected.
A More Powerful Machine
+
ba
ab,
a
a,b
b
bb
aa,
2
A transition graph that accepts the language {baa}
(A machine that seems to be more powerful)
a,b
Two others with fewer states
+baa
all else a,b +
baa
3
The word a? The word baabb? The input crashes. The machine crashes. The input is rejected.(2 ways for an input to be rejected)
a,b
baa? a choice, a decision2 possible paths b|aa - accepted
+aa,bb
a,b a,b
4
2 possible paths b|aa - accepted
b|a|a - rejected
1 way to crash ba|a rejected
The machine represents a language L. baa L? For all w, w L if there exists a path that arrives at a final state.
1
+
ba
baa 2
ab
b
5
baab? 2 possible paths, both end in a final state.
Transition Graphs
A transition graph (TG) is the following 3 things:1. a finite set of states, at least one of which is designated as the start state, and some (maybe none) of which are designated the final states (or accepting states)
2. an alphabet of input letters
3. a finite set of transitions that show how to go to a new state, for some pairs of state and substrings of letters (or
6
state, for some pairs of state and substrings of letters (or ). (One pair can have 0, 1, or more next-states.)
A successful path is a series of edges beginning at some start state and ending at a final state.
The concatenation of all the substrings that label the edges in the path is a word accepted by this machine.
The set of words accepted is the language of the transition graph.
abb | | aa | b = abbaab
31
2abb
4
+a
aab
Example
7
abb | | aa | b = abbaab
1 4132
abbab crashes.
Many start states
1
+b
3
a
aba
2
1
+b
3
a
aba
2
8
These two machines are clearly equivalent. Remark: Every finite automaton is a transition graph.
+
L = {}L =
9
L = {,abba,baa}
baa+
abba
L = {}
+
+
+
+
10
+ +bb
a+
All words ending in b: (a+b)*b
+b
a
ba
FA
11
transition graph
Some words can fail, crash, and
succeed: abab.
+b
a,b
+b
a,b
b
a
a
a,b
12
+a
b +bb
aa b
aa
EVEN-EVEN
FA:
1+ 2
b
b
a
b
a a a
even a
even b
even a
odd b
13
transition graph:
3 4b
balanced unbalanced+
ab,baaa,bbaa,bb
ab,ba
odd a
odd b
odd a
even b
+
a a
a a,b
b
b
a
bbb
ab
14
abbbabbbabba
b
bbbb
a
bbb
+aa
15
Infinitely many paths for aa
Is there an algorithm to determine if a word is accepted?
+
a a
16
+
a,
a a
b,
Generalized Transition Graphs
A generalized transition graph (GTG) is the following 3 things:
1. a finite set of states, at least one of which is designated as the start state, and some (maybe none) of which are designated the final states (or accepting states)
2. an alphabet of input letters
3. a finite set of edges connecting some pairs of states, each
17
3. a finite set of edges connecting some pairs of states, each labeled with a regular expression
Words without 2 bs in a row:
+ +b+(ba+a)*
a* a*
Kleene Star Closure and Loops
+aa,b
b a,b
18
+a(a+b)
(a+b)*
b*
Choosing Transitions
3
4
5
abb
abb
19
3
5
ab
abb
4b
7
8
10
a
b
9b Choices even with restrictionof 1 letter per edge (or 0)
20
7
8
a
10b
9b
Machine is nondeterministic