HW05 due 02/16

advertisement
CmSc 365 Theory of Computation
Homework 05 due 02/16
Name_____________________
Please record the time it takes to solve each problem and write it down after the
problem. Save the file as your_first_nameHW05.doc and upload to Scholar.
Please write your name!
Thank you.
In the following problems you have to construct several FSAs – complete deterministic
and incomplete non-deterministic FSAs. You have to represent the FSAs as quintuples
M = (K, ∑, δ, s, F) and M = (K, ∑, , s, F), and write down
explicitly each component, e.g.
K = {q1, q2, q3}, s = q1, F = {q3}, etc.
The transition function can be given as a table with rows for each state and
columns for each symbol in ∑.
The transition relation has to be given as a set of triples. Each triple is an
element of K x ( ∑  {e}) x K.
1. Construct complete deterministic FSAs to recognize the following languages:
a. { w є {0,1}*: w start with 1 and has odd length or starts with 0 and has
even length}
(10 pts)
b. { w є {0,1}*: w does not contain the substring 110}
Hint: construct a complete deterministic FSA that accepts strings that contain
“110” as a substring. This will help solve the problem
(15 pts)
2. Write the regular expressions for the languages accepted by the FSAs in problem
1. (20 pts)
3. Consider the language of real numbers of type double in Java.
a. Construct a regular expression for the language of real numbers of type double
in Java. Use the alphabet  = {+, -, d, . } where d represents any digit.
(15 pts)
General rules:
 The sign can be omitted
 There may be no digits in front of the decimal point provided that
there is at least one digit after the decimal point
1


There may be no digits following the decimal point provided that
there is at least one digit in front of the decimal point
Any number of insignificant leading or trailing zeros is allowed
b. Construct a complete deterministic FSA that accepts valid real numbers of
type double in Java.
(15 pts)
c. Using the construction method described in Theorem 2.3.1, construct a
nondeterministic FSA that accepts the language of real numbers of type
double in Java, generated by the regular expression in 3a).The FSA need not
be complete.
(20 pts)
d. For the FSA in 3d) write down a sequence of configurations that will accept
the string d.dd
(5 pts)
2
Download