Problem of the Month Problem 2: Manuals for Robots
November 2024
A course for a robot is a finite set of places (denoted by
circles or squares) with arrows labelled and between places, satisfying the
following conditions:
For every place , there is
exactly one arrow labelled and
one arrow labelled which starts
at .
There is exactly one place called the starting place,
denoted by a square.
Some positive number of places are called finishing
places, and they are denoted by being shaded. The starting place can be
a finishing place.
The course is connected. That is, there is a way to get
from the starting place to any other place by following (possibly
several) arrows.
While there is exactly one arrow labelled and one arrow labelled starting at every place, there may be
multiple arrows labelled ending
at a particular place, or none at all! Take a moment to check that the
following three examples are indeed courses.
Course 1
Course 2
Course 3
Course 1:
There are two places: a unshaded square and a shaded
circle.
There are four arrows:
Starting at the unshaded square, the arrow labelled loops around and ends at the square,
and the arrow labelled ends at
the circle.
Starting at the shaded circle, the arrow labelled loops around and ends at the circle,
and the arrow labelled ends at
the square.
Course 2:
There are four places: a shaded square, a shaded circle, and two
unshaded circles.
There are eight arrows:
Starting at the shaded square, the arrow labelled ends at the first unshaded circle, and
the arrow labelled ends at the
shaded circle.
Starting at the shaded circle, the arrow labelled loops around and ends at the shaded
circle, and the arrow labelled
ends at the second unshaded circle.
Starting at the first unshaded circle, the arrow labelled ends at the second unshaded circle, and
the arrow labelled loops around
and ends at the first unshaded circle.
Starting at the second unshaded circle, the arrow labelled ends at the first unshaded circle, and
the arrow labelled ends at the
shaded square.
Course 3:
There is one place: a shaded square.
There are two arrows: The arrow labelled starts and ends at the shaded square
and so does the arrow labelled .
For a particular course, we can give a robot instructions as to how
to move from place to place in the form of a string. A string
is a finite sequence of 's and
's (for example, ).
For each string, the robot begins at the starting place, and follows
the arrows in the order they appear in the string (reading from left to
right), moving from place to place.
If the robot ends at a finishing place, then the string is
accepted. Otherwise, the string is rejected. Notice
that by Condition in the
definition of a course, the string completely determines which places
the robot visits.
The set of accepted strings is the manual for that course.
For example, the manual for Course 3 above is the set of all strings.
Convince yourself that the manual for Course 1 is the set of strings with an odd
number of 's.
Decide which of the following strings belong to the manual for
Course 2 from the first page: ,,,.
Describe the manuals for the following courses:
There are three places, arranged in a row. From left to right,
there is an unshaded square, a shaded circle, and an unshaded
circle.
There are six arrows:
Starting at the unshaded square, the arrow labelled ends at the shaded circle, and the
arrow labelled loops around and
ends at the unshaded square.
Starting at the shaded circle, the arrow labelled ends at the unshaded circle, and the
arrow labelled loops around and
ends at the shaded circle.
Starting at the unshaded circle, the arrow labelled loops around and ends at the unshaded
circle, and the arrow labelled
loops around and ends at the unshaded circle.
There are four places arranged into a 2 by 2 grid. An unshaded
square is top left, a shaded circle is top right, and two unshaded
circles are bottom left and right.
There are eight arrows:
Starting at the unshaded square, the arrow labelled ends at the shaded circle, and the
arrow labelled ends at the
bottom-left unshaded circle.
Starting at the shaded circle, the arrow labelled loops around and ends at the shaded
circle, and the arrow labelled
ends at the bottom-right unshaded circle.
Starting at the bottom-left unshaded circle, the arrow labelled
ends at the bottom-right unshaded
circle, and the arrow labelled
ends at the unshaded square.
Starting at the bottom-right unshaded circle, the arrow labelled
loops around and ends at the
bottom-right unshaded circle, and the arrow labelled ends at the shaded circle.
Construct a course whose manual is the set of three strings .
Construct a course whose manual is the set of all strings where
the number of 's in the string is
a multiple of .
For this problem we need to introduce some language and
notation.
The length of a string is the number of
characters in the string. For example, has length . The string of length is called the empty
string and we denote it by .
If and are strings, then is the concatenation of the
two strings. The string is
concatonated with itself times. For example, if ,, and , then
. Define to be the empty string .
A substring of a string is a string consisting of consecutive
letters from . For example, ,,, and are all substrings of . The string is not a substring of .
Suppose a course has
places, and let be a string in
its manual of length at least .
Show that there is a substring of
with length at least and at most so that when it is deleted from , the remaining word is also in the
manual.
Suppose a course has
places, and let be a string in
its manual of length at least .
Show that you can write
with the property that ,
the length of is at most , and for all natural numbers , is also in the manual.
Prove that the manual for a course cannot be the set of all
strings with length equal to a perfect square.
Prove that the manual for a course cannot be the set of all
strings that are palindromes. (A palindrome is a string that is
the same when written backwards. The strings and are palindromes, but is not.)