cs60submit part1.FAwill copy your part1.FA file to the cs60grad account for grading.
Please make sure your files are named as described in the problems below (part1.FA, part2.FA, ..., part8.TM), so that the submission script will recognize them.
You will be using the JFLAP Automata Simulator developed by Dr. Susan
Rodger at Duke University. JFLAP allows you to create automata on the screen
and then simulate them with any input string you like.
You must be running
JFLAP from one the terminals in the CS lab or from a machine that supports
xwindows (or an xwindows emulator).
In any case, JFLAP works best with a 3-button mouse but is
usable with a 2-button mouse. (Mac users can emulate a three-button mouse
by using the shift and command keys.)
Invoke JFLAP by simply typing java JFLAP. If a "java.lang.NoClassDefFoundError: JFLAP" exception occurs, you need to put /cs/cs60/jflap in your CLASSPATH environment variable in your .cshrc file. If you had your account created this semester, however, everything should work OK.
JFLAP will draw a small rectangular menu on your screen. Select the top item Finite State Automaton by clicking on it. Now you'll get a large display in which you can create deterministic or nondeterministic finite automata. The Help menu is useful. Read through it for tips. It takes less than ten minutes. Here are some quick pointers:
{ w | w contains at least three 1's. }
For example, the string 011010 is
in the language but the empty string and
01100 are not.
Remember that DFAs must contain a transition from
every state for each symbol in the alphabet (in our
case the possible symbols are 0 and 1).
Save your DFA in a file called part1.FA.
{ w | w contains at least two 0's and at most one 1. }
For example, the string 01000 is in the language but
01 and 0110 are not.
Save your DFA in a file called part2.FA.
{ w | w is any string other than 11 and 111. }
For example 0111 is in the language. The only strings
not in the language are 11 and 111.
Save your DFA in a file called part3.FA.
{ w | w is the binary representation of a positive integer divisible by 6. }
For example, 0, 0110, and 10010 are in
the language, but the empty string, 10, and 0100 are not.
Leading zeros don't affect the value of a number, and all numbers are
represented with the most-significant bit first (on the left).
(Hint: you might want to try to construct a DFA which accepts
binary strings that represent integers divisible by 3 first.)
Save your FA in a file called part4.FA.
{ w | w contains the pattern 00 or 11 or both. }
For example, 1001 should be accepted as should 10110.
However, 0101 would not be accepted.
Note that JFLAP is just as happy to make
NFA's and DFA's. It simply permits you to have multiple outgoing
transitions with the same label. Recall that nondeterministic machines
do not need to have a transition for each possible input at each state.
Try to use as few transitions as possible! Save this NFA in a file
called part5.FA.
{ w | The number of 0's in w is a multiple of 3 or a multiple of 5 or both. }
For this problem, your finite automaton should not consider
0 a multiple of 3 or 5 -- that is, you should reject strings that
contain no 0's at all.
A straightforward approach to this problem
uses 15 states.
Try to use as few states as possible in your FA.
Save your FA in a file called part6.FA
{ w | w contains an equal number of 0's and 1's in any order. }
is not a regular language -- that is, there is no
finite-state automaton that accepts this language.
However, consider the following closely related language:
{ w | w contains an equal number of occurences of the pattern 01 and 10. }
This language contains 0110 (this contains the pattern 01 once
and the pattern 10 once) as well as 101 (this contains the pattern
10 once and the pattern 01 once - they overlap, but that's fine!).
Amazingly, this language is regular! Show that this is true by building
a DFA or NFA for this language using JFLAP. Save your solution in the
file part7.FA.
L = { w | w contains only 0's and the length of w is a power of 2 }.
That is, the language contains all strings of 0's whose length is
a power of 2. Extra credit will be given for solutions to the turing machine problem that use six or fewer states, up to 20% for a solution using only 3 states -- which can be done, even using one of those states as the accepting state! However, you will certtainly have to write symbols other than 0 and 1 to the tape... .
If you find a solution with 3 states, you must have a flair for optimizations -- so additional bonus credit (20%) is available for the 3-state turing machine that uses the fewest different symbols in its program. The record minimum number of symbols that CS 60 students (and instructors) have found for this TM so far is 6. (I do not know what the theoretical minimum is for this, but would like to!)
Finite state machines (and the languages they accept) are considered in Chapter 12 of the text. Additionally, Turing machines and generala state-transition models are covered in Chapter 6.