
In this assignment you will have the opportunity to try out the very nifty 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 will also be proving that certain tasks are unsolvable by finite automata (read: computers!)
You can download a copy of JFLAP for your own computer (or on the Macs in the CS lab) for free. It is available at www.jflap.org. At that web site, follow the "Get JFLAP" link on the green left menu. From there, go to the bottom of the page and select "JFLAP software". After you have filled out the download form, choose the latest "JFLAP.jar" (September, 2006).
JFLAP is written in
java and when you download it you will get a file called
JFLAP.jar. You start JFLAP from a command prompt
(unix or windows)
by typing
java -jar JFLAP.jarFor this to work, java needs to be "in your path," which it most likely already is, because of the java assignments you wrote!
In this part, you will submit a different file for each of the problems on this assignment. Some of your files will be JFLAP files and others will be .txt files containing explanations or proofs. Include these files in your hw10.zip file.
When you start JFLAP, you will see a menu that looks something
like this:

with a Help menu at the top. Choose the "Help"
option from
the Help menu, and then hit the "back" button or "main index" button
to get to the main Help screen.
Take a couple of minutes to read the first "Editors" link, called "Automata" - this includes DFAs, NFAs, and Turing Machines, which you'll be building in this assignment. If you prefer online documentation, check out the tutorial available from this link.. The documentation is not only thorough, it even has a version entirely in haiku (scroll down to read that...)!
For each of the problems below, you should assume that the input will consist of zero or more 0's and 1's. Thus, keep in mind that every state in a DFA must have one outgoing transition labeled 0 and one outgoing transition labeled 1. Remember also that a DFA must accept every string in the desired language and reject every string not in the language. Finally, the empty string (λ, lambda) corresponds to no input at all. Note, for example, that if the language L is the set of all strings with an even number of 0's, then the empty string is in this language since it has zero 0's and zero is even! Thus, a DFA for this language must have the initial state be an accepting state, so that it accepts even if it gets no input! Be sure that your automata accept the empty string if it is in the specified language.
{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 and submit your DFA in a file called part1_1.jff.
{w | The number of 0's in w is a multiple of 2 or a multiple of 3 or both.}
For example, the empty string, 0101, and 01000100
are in the language but 01 is not. Your DFA
should have at most 6 states. The empty string, with zero 0s
should be accepted. Save and submit your DFA in
a file called part1_2.jff. {w | w is the BINARY representation of a number which is a multiple of 5.}
For example, the inputs 101, 1010,
and 1111 would all be accepted because they are
the binary representations of the numbers 5, 10, and 15, respectively.
Remember that the DFA reads input from left to right, so that the first
digit seen is the most significant digit and the last digit seen is the
least significant digit. The number may begin with leading zeroes (for
example, 000101 is OK). For this problem the empty string should be
interpreted as the number 0 and thus should be accepted. This problem
is somewhat more challenging than the ones above. You'll need to think
about this some before starting to construct your DFA. For full credit,
your solution may not use more than 7 states (it's possible, in fact,
to use fewer). {w | The number of 0's in w is a multiple of 3 or a multiple of 5 or both.}
Notice that this machine would require at least 15 states if you were
to build a DFA. (Make sure you see why -- though you need not prove
it.) However, for credit for this NFA, it may have at
most 9 states. Save your NFA in a file called part1_5.jff.
Again, since 0 is a multiple of 3 (or 5, for that matter), the empty
string should be accepted. {w | w is made of 0's and 1's and is the same forwards as backwards}
For example, 0, 11, 101,
and 00100 are all in the language but 01,
100 and 010111 are not
in the language. {w | w is a string of 0's whose length is a power of 2}
For example, the strings 0, 00,
0000, 00000000 are all
in the language since their lengths are 1, 2, 4, and 8, all of which
are powers of 2. On the other hand, 000, 00000,
any string containing a character other than 0,
and the empty string are all not in this language.
Prove that this language is not regular by using the Nonregular Language Theorem. Your proof must be clear and precise. Leave your proof in electronic form in a file called part1_7.txt.
For convenience, however, let's write each of these input symbols vertically and without parentheses. So, the eight symbols above will be represented as:
(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), (1, 0, 0), (1, 0, 1),
(1, 1, 0), (1, 1, 1)
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0, 1, 0, 1, 0, 1, 0, 1
Now, define the language of valid additions to be the collection of all strings made from this alphabet that correspond to correct binary additions when the input is interpreted as the number in the first row added to the number in the second row equals the number in the third row. Note that numbers are interpreted as having the most significant digit is at the far left. This corresponds to the usual interpretation of a string of 0s and 1s as a binary number. It also means that the DFA sees the most significant digits first!
For example, consider the string of 4 symbols below:1 0 1 0
0 0 1 0
1, 1, 0, 0
This 4-symbol string is in the language of valid additions since the sum of the binary numbers 1010 (first row) and 0010 (second row) is 1100 (third row).
However, the following string is not in the language of valid additions:
1 1This string is interpreted as the sum of 11 (first row) and 01 (second row) is 00 which is false!
0 1
0, 0
For this problem, construct a DFA for the language of valid additions and then prove (using the Distinguishability Theorem) that your DFA has the fewest possible number of states! JFLAP is happy to allow three characters along a single transition, which is what you will need in this case.
Save and submit your JFLAP DFA in a file named ecadd.jff and submit your proof that no fewer states are possible in a file named ecaddproof.txt.