Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
b a a +
–
a b b a,b
a,b
● An FA: {baa}
● The word a? The word baabb?
● The input fails, or the machine fails on the input. The input is
rejected.
1
A More Powerful Machine
ba a
– b +
aa,
ab, a,b
bb
a,b
● A transition graph that accepts the language {baa}
2
Two others with fewer states
baa
– +
baa
– +
all else a,b
a, b,
aa, ab,
ba, bb,
aaa…
a,b
● baa?
● a choice, a decision
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.
4
1
ba ab
– +
baa 2 b
5
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 S 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
L). (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.
6
Example
1 abb 2 L 3 a +
–
aa
b
abb | L | aa | b = abbaab
1 2 3 1 4
abbab crashes.
7
Many start states
1
L 1
a – a
L b 2 b +
– 2 + –
aba 3 aba
L 3 –
8
– +
L= L = {L}
– L
+
abba –
baa
–
L = {L,abba,baa}
9
L = {L}
L
+ +
L
L L
– + – +
bb
+ + +
a
10
All words ending in b: (a+b)*b
a b
b FA
– +
a
a,b
b transition graph
– +
Some words can fail, crash, and
succeed: abab.
11
Words that
begin and
a,b end with
different
b letters
+
a
– a,b
b All words
a with all a’s in
+ even groups,
and ending
in 3 or more
aa b b’s
b b b +
–
aa
12
EVEN-EVEN
b
even: a even: a
even: b 1+ 2 odd: b
b
FA: a a a a
b
3 4 odd: a
odd: a
even: b
b odd: b
aa,bb aa,bb
transition graph: ab,ba
balanced + unbalanced
(even: a, even: b) ab,ba (odd: a, odd: b)
13
b
a a,b
b
– +
bbb
a ab
a a
bbb
b
bb bb
a
abbbabbbabba
14
L L
a a +
–
15
L
– a a +
16
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 S of input letters
3. a finite set of edges connecting some pairs of states, each
labeled with a regular expression
a* a*
(ba+a)* b+L +
+
17
Kleene Star Closure and Loops
b a,b
a,b a +
–
(a+b)*
(a+b) b* a +
–
18
Choosing Transitions
4 …
abb
… 3
…
abb
5
b 4 …
ab
… 3
…
abb
5
19
8 …
a
8 …
a
…
Machine is nondeterministic
… 7
b 9
L b 10 …
20