0% found this document useful (0 votes)
194 views3 pages

MIT6 042JS15 ps4

This document contains the problem set 4 for the course 6.042J/18.062J Mathematics for Computer Science at MIT for Spring 2015. It includes 3 problems related to state machines, recursive data types, infinite sets and the halting problem. Problem 1 asks to prove that a robot moving on a 2D grid according to certain rules can never reach a specific point. Problem 2 asks to prove an equation relating the number of distinct internal and leaf labels of labeled binary trees with unique labels. Problem 3 asks to prove that the half-open unit interval has the same size as the non-negative quadrant of the real plane by describing bijections between various sets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
194 views3 pages

MIT6 042JS15 ps4

This document contains the problem set 4 for the course 6.042J/18.062J Mathematics for Computer Science at MIT for Spring 2015. It includes 3 problems related to state machines, recursive data types, infinite sets and the halting problem. Problem 1 asks to prove that a robot moving on a 2D grid according to certain rules can never reach a specific point. Problem 2 asks to prove an equation relating the number of distinct internal and leaf labels of labeled binary trees with unique labels. Problem 3 asks to prove that the half-open unit interval has the same size as the non-negative quadrant of the real plane by describing bijections between various sets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Massachusetts Institute of Technology

6.042J/18.062J, Spring ’15: Mathematics for Computer Science February 25


Prof. Albert R Meyer & Prof. Adam Chlipala revised Sunday 8th March, 2015, 08:53

Problem Set 4
Due: March 6

Reading:

 Section 5.4. State Machines: Invariants in the course textbook.

 Chapter 6. Recursive Data Types in the course textbook.

 Chapter 7. Infinite Sets, The Halting Problem in the course textbook.

Problem 1.
A robot moves on the two-dimensional integer grid. It starts out at .0; 0/ and is allowed to move in any of
these four ways:

1. .C2; -1/: right 2, down 1

2. .-2; C1/: left 2, up 1

3. .C1; C3/

4. .-1; -3/

Prove that this robot can never reach .1; 1/.

Problem 2.
Let L be some convenient set whose elements will be called labels. The labeled binary trees, LBT’s, are
defined recursively as follows:

Definition. Base case: if l is a label, then hl; leafi is an LBT, and


Constructor case: if B and C are LBT’s, then hl; B; C i is an LBT.

The leaf-labels and internal-labels of an LBT are defined recursively in the obvious way:

Definition. Base case: The set of leaf-labels of the LBT hl; leafi is flg, and its set of internal-labels is the
empty set.
Constructor case: The set of leaf labels of the LBT hl; B; C i is the union of the leaf-labels of B and of C ;
the set of internal-labels is the union of flg and the sets of internal-labels of B and of C .

The set of labels of an LBT is the union of its leaf- and internal-labels.
The LBT’s with unique labels are also defined recursively:

2015, Eric Lehman, F Tom Leighton, Albert R Meyer. This work is available under the terms of the Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 license.
2 Problem Set 4

Definition. Base case: The LBT hl; leafi has unique labels.
Constructor case: If B and C are LBT’s with unique labels, no label of B is a label C and vice-versa, and
l is not a label of B or C , then hl; B; C i has unique labels.

If B is an LBT, let nB be the number of distinct internal-labels appearing in B and fB be the number of
distinct leaf labels of B. Prove by structural induction that

fB D nB C 1 (1)

for all LBT’s B with unique labels. This equation can obviously fail if labels are not unique, so your proof
had better use uniqueness of labels at some point; be sure to indicate where.

Problem 3.
In this problem you will prove a fact that may surprise you—or make you even more convinced that set
theory is nonsense: the half-open unit interval is actually the “same size” as the nonnegative quadrant of the
real plane!1 Namely, there is a bijection from .0; 1] to Œ0; 1/  Œ0; 1/.
(a) Describe a bijection from .0; 1] to Œ0; 1/.
Hint: 1=x almost works.

(b) An infinite sequence of the decimal digits f0; 1; : : : ; 9g will be called long if it does not end with all
0’s. An equivalent way to say this is that a long sequence is one that has infinitely many occurrences of
nonzero digits. Let L be the set of all such long sequences. Describe a bijection from L to the half-open
real interval .0; 1].
Hint: Put a decimal point at the beginning of the sequence.

(c) Describe a surjective function from L to L2 that involves alternating digits from two long sequences.
Hint: The surjection need not be total.

(d) Prove the following lemma and use it to conclude that there is a bijection from L2 to .0; 1]2 .
Lemma 3.1. Let A and B be nonempty sets. If there is a bijection from A to B, then there is also a bijection
from A  A to B  B.

(e) Conclude from the previous parts that there is a surjection from .0; 1] to .0; 1]2 . Then appeal to the
¨ -Bernstein Theorem to show that there is actually a bijection from .0; 1] to .0; 1]2 .
Schroder

(f) Complete the proof that there is a bijection from .0; 1] to Œ0; 1/2 .

1 The half-open unit interval, .0; 1], is fr 2 R j 0 < r  1g. Similarly, Œ0; 1/ WWD fr 2 R j r  0g.
MIT OpenCourseWare
https://ocw.mit.edu

6.042J / 18.062J Mathematics for Computer Science


Spring 2015

For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.

You might also like