- Question 1 deals with a function f(i, j), which takes two natural
numbers as arguments and returns a natural number. If j < i,
then f(i, j) is defined to be 0. Otherwise f(i, j) is the sum
2i + ... + 2j. We can define this inductively
by the rules f(i, i) = 2i and, if j > i, f(i, j) =
f(i, j-1) + 2j.
- Question 1 (25): Two induction proofs concerning this
function:
- (a, 10): Prove that for all natural numbers j, f(0, j) =
2j+1 - 1. (Hint: Use the rules above and ordinary
induction on j.)
- (b, 15) Prove that for any natural i and for any natural j
with j ≥ i, f(i, j) = 2j+1 - 2i. (Hint:
Let i be arbitrary and use induction starting with j = i to prove
the statement for all j with j ≥ i.)
Question 2 deals with the inductive definition of addition of
natural numbers, and with an inductively define predicate LE(x, y)
that takes two natural numbers as arguments.
Recall that x + 0 is defined to be x, and that x + succ(y) is
defined to be succ(x + y), where "succ" is the successor function
on naturals.
We define LE(x, y) by three rules. LE(0, y) is defined to be
true for any y. LE(succ(x), 0) is defined to be false for any x.
Finally, LE(succ(x), succ(y)) is defined to be equal to LE(x, y)
for any naturals x and y.
- Question 2 (15): Prove that for any three natural
numbers x, y, and z, if LE(x, y) is true, then LE(x + z, y + z) is
true. (Hint: Let x and y be arbitrary, assume LE(x, y), and use
ordinary induction on z.)
Question 3 deals with a particular directed graph with nine
vertices s, a1, a2, a3,
a4, b1, b2, b3, and
b4. There are arcs from s to a1 and
b1. For i = 1, 2, or 3, the nodes ai and
bi each have arcs to nodes ai+1 and
bi+1. Those are the only arcs -- there are 14 in all.
We will consider depth-first and breadth-first searches of this
directed graph starting at s, both with and without a closed list.
(With a closed list, we can recognize visited nodes, including
nodes on the stack or in the queue -- without one we cannot.) When
we use DFS, the children ai and bi of a
node are placed on the stack with bi placed first, so
that ai is taken off the stack first. When we use BFS,
ai is placed on the queue first, so that it comes off first.
- Question 3 (35+10): Here are several questions about
these searches:
- (a, 5): Explain why each of the four searches will
eventually terminate, even if there is no goal node.
- (b, 10): Give the DFS tree for the depth-first search with
no goal node and with a closed list.
- (c, 10): Give thet BFS tree for the breadth-first search
with no goal node and with a closed list.
- (d, 5): Find a choice for a goal node t such that the DFS
will find t after exploring fewer nodes that the BFS needs to find
t, both with or without a closed list. (Here a node is said to
have been "explored" when it comes off the open list.) Justify
your answer.
- (e, 5): Find a choice for a goal node t such that the BFS
will find t after exploring fewer nodes than the DFS needs to find
t, both with or without a closed list. Justify your answer.
- (f, 5XC): Determine how many total visits the DFS, with
no closed list and with no goal node, will make to the two
childless nodes a4 and b4. Justify your answer.
- (g, 5XC): Determine how many total visits the BFS, with
no closed list and with no goal node, will make to the two
childless nodes a4 and b4. Justify your answer.
Question 4 deals with a two-player game called Stones. In Stones,
there is a single pile with some natural number of stones in it. On
her turn, a player must remove either one or two stones from the
pile. The first player who cannot move loses. (That is, the player
who takes the last stone wins.) The game is somewhat similar to
another game called Nim that you may have seen, but Stones is easier
to analyze.
- Question 4 (25): Four questions concerning this game:
- (a, 5) Give a winning strategy for the second player if the
game starts with three stones.
- (b, 5) Give a winning strategy for the first player if the
game starts with four stones.
- (c, 10) Prove by (ordinary) induction, for all natural
numbers k, that the second player has a winning strategy for the
game that starts with 3k stones.
- (d, 5) Using the result of part (c), prove that if the
starting number of stones is not divisible by 3, then the
first player has a winning strategy.