No Slide Title

Download Report

Transcript No Slide Title

CCM 305
Lecture 04
Fall 98
Announcements See Web Page
Homework for official homework
assignments.
U of M wins!!! 59-20
Lions lose 29 -6
Mcguire hits 65 (66 sort of)
Chapter 5 Finite Automata
accept
string
reject
Definition
A finite automation is a collection of
three things;
1. A finite number of states, one of
which is the
start state, and some (or none) of
which are
designated as final(accept) states.
2. An alphabet  , of possible input
letters.
3. A finite set of rules or transitions
that tell for
each state and for each letter of
the input
alphabet which state to go to next.
Picture (called a transition diagram)
Start State
-
Any State
Final State
+
Transition from
state 1 to state 2 on
reading an a
1
a
2
My problem : Find a FA that accepts
all strings that contain abb.
a
b
a
b
a
b
+
a,b
Find a FA to accept all strings that end with abb
a
b
a
b
b +
a
b
a
Read abb
Read ab
nothing
Read a
Build a FA that accepts only the
language of all words with b as the
second letter.
-
a,b
b
a
+
a,b
a,b
3. Build an FA that accepts only the words baa, ab, and abb.
a
+
a
b
b
b
a,b
a,b
-
a,b
a
a
a
b
b
+
a
a
b
b
a,
b
a,
b
a
a
a
b
a,
b
b
+
4. Build a Finite
Automata with 3 states
that accepts all strings.
-+
a,b
+
a,b
a,b
+
7. Build a Finite Automata that accepts only
those words that begin or end with a double
letter.
First we will build a FA to accept words that
start with aa or bb. Then add words that
end with aa or bb.
b accepts
First we build
a,b only
b the FA that
those words
that do begin +
with ba.
a
a
a
a,b
b
Now we will build a FA to accept words that
start with aa or bb. Then add words that
end with aa or bb.
-
b
b
+
a
a
b
a
a
b
+
a
b
Now put them together
a
+
a
a
a
a
b
b
-
+
b
+
a
b
b
b
b
a
+
a,b
a,b
17. Describe in english the
languages accepted by the following
FAs:
b
a,b
a
+
a,b
Try listing some to get an
idea.
a, aaa, aba, baa, bba,
aaaaa, aaaba, aabaa,
aabba, abaaa, ababa,
abbaa, abbba, baaaa, …
The answer is odd length ends with a.
Chapter 6 Transition Graphs
Relaxing the inputs
Allow words on an edge or 
Allow 0 or 1 edges from a state
Allow duplicated edges
Allow more than 1 start state
We know have non-determinism
Now the machine can crash
We will accept a word if there
is some path that leads to +.
Examples:
-
abb

a
a
-
b
a
+
This accepts, ba, aa, abb,aba
More examples of TGs and what they accept
a
-
b
b
abba
Test
a
reject
b
reject
babbaa accept
a
a
b
+
b

a
babbaaba accept
ba
accept
aaa accept
Do pg 88, 2 TG1
Generalized TG allows regular expressions on the edges.
Pg 90 # 10
Proof that
TG are closed under concatenation.
Assume that L1 and L2 are 2 languages accepted by the
Transitions graphs TG1 and TG2 respectively. We are
going to build TG3 that accepts L1L2. We create TG3
by adding new  transitions from the + states of TG1
going to all the – states of TG2, and then removing the –
‘s from TG2. We then remove the +’s from the states
that were part of TG1.