Sie sind auf Seite 1von 5

CSC 240 Winter 2014

Midterm Name:
Student Number:
For this exam, your proofs do not need line numbers. However your proofs should be well justied.
Very obvious steps are OK to leave unjustied. But if you are wondering whether you need to
justify a step in your proof, it is safer to assume that you do.
1. (5 points)
Recall that we say a natural number n is prime if n 2 and the only natural numbers that divide
n are 1 and n. Also, recall that for any set S, the power set P(S) is the set of all subsets of S.
Let Q : P(N) \ {} {T, F} be the predicate such that for any A P(N) \ {}, Q(A) = T if and
only if the smallest element of A is prime.
(Note that the domain of Q is all nonempty sets of natural numbers. By the well ordering principle
every such set has a unique smallest element, so Q is well dened.)
Express Q(A) using basic logic symbols. Your answer can contain symbols for variables and con-
stants (like x, y, 3, 5) as well as the symbols <, , >, , , =, =, , , , , , , , , N, Z, R, A, +, ,
(the last symbol is multiplication). Give a short explanation why your answer is correct.
Solution: Q(A) is equivalent to the predicate that says if a is the smallest element of A, then a
is prime. To say a is prime is equivalent to for any natural number d, either d does not divide
a, or d is equal to 1, or d is equal to a. Thus, one way to write Q(A) is
a A.
_
(b A.a b) [d N.(d = 1) (d = a) (k Z.a = dk)]

Since we are guaranteed that a smallest element of A always exists, we can also write Q(A) as
a A.
_
(b A.a b) [d N.(d = 1) (d = a) (k Z.a = dk)]

Of course we could also replace (k Z.a = dk) with (k Z.a = dk).


2. (15 points)
a) (5 points)
Let n N, and suppose that for each integer i such that 0 i n, there is a set A
i
.
We recursively dene the set
n
_
i=0
A
i
as follows: if n = 0 then
n
_
i=0
A
i
= A
0
. If n > 0, then
n
_
i=0
A
i
=
_
n1
_
i=0
A
i
_
A
n
.
Using the denition above, prove that j N.
_
(0 j n)
_
A
j

n
_
i=0
A
i
__
.
Solution: We proceed by induction on n. The base case is n = 0, so we need to prove that
0 j 0 implies A
j

0
_
i=0
A
i
. But

0
i=0
A
i
= A
0
by denition. Now a A
0
.a A
0
is a
tautology, so A
0
A
0
holds and the base case is done.
For the induction step we assume that j N.
_
(0 j n 1)
_
A
j

n1
_
i=0
A
i
__
. Let
0 j n be arbitrary, and let a A
j
be arbitrary. We consider two cases: Case (i) will be
when 0 j n 1, and case (ii) will be when j = n (one of these cases must hold since j is
a natural number from 0 to n). In case (i), we know that A
j

n1
_
i=0
A
i
. Since a A
j
we know
a
n1
_
i=0
A
i
, and therefore a
_
n1
_
i=0
A
i
_
A
n
by the denition of union. We have proved
that an arbitrary element of A
j
is in

n
i=0
A
i
, so we have proved A
j

n
i=0
A
i
and case (i)
is nished. Case (ii) is easier: since a A
n
, we know a
_
n1
_
i=0
A
i
_
A
n
by the denition of
union, so similarly to case (i) we are nished. This completes the induction step and entire
proof.
b) (2 points)
Suppose that for each value i such that 0 i n, A
i
is a nite set. Is
n
_
i=0
A
i
necessarily
nite? Give a short explanation for your answer.
Solution: Yes. In fact,
n
_
i=0
A
i
has at most
n

i=0
|A
i
| many elements (and that is a nite number
since it is a sum of n + 1 nite numbers)
c) (8 points)
Let X be an innite set, and let
Y = {S P(X) : S is nite }.
Suppose F : N N Y . Prove that there exists a function G : N Y such that
m N. N.n N.(n ) [F(m, n) G(n)].
Solution:We will prove the existence of the function G by construction: Let
G(n) =
n
_
i=0
F(i, n).
First of all, G is indeed a function whose domain is N (since our denition makes sense for
any natural number n) and whose range is Y (since our formula for G(n) is a union of n + 1
many nite sets so by the fact from part b, the union is a nite set so G(n) Y ).
Now lets verify that
m N. N.n N.(n ) [F(m, n) G(n)].
Let m N be arbitrary. Let = m. Now suppose n N is arbitrary, and n ( so n m).
Since 0 m n, we know from part a that
F(m, n) G(n) =
n
_
i=0
F(i, n).
To summarize, we have shown that for an abitrary m, we can construct an such that for an
arbitrary n, the formula (n ) [F(m, n) G(n)] holds. This completes the proof that
the function G we constructed has the desired properties.
3. (10 points) For this problem we recursively dene a function C : NN N. You may assume
that C is well dened. Let
C(m, n) =
_

_
0 if n > m
1 if n = 0 or n = m
C(m1, n) +C(m1, n 1) otherwise
Prove that for all m N,
m

n=0
n C(m, n) = m 2
m1
.
Hint 1: you may also want to nd and prove a formula for
m

n=0
C(m, n). You will get some partial
marks just for doing this.
Hint 2: you may use the following facts without proof. If a, b, s are integers such that a b, and
i.(a i b) x
i
R, then
b

i=a
x
i
=
b+s

i=a+s
x
is
.
If we also have a < b then
b

i=a
x
i
= x
a
+
b

i=a+1
x
i
= x
b
+
b1

i=a
x
i
.
Solution: We claim that
m

n=0
C(m, n) = 2
m
. To prove this claim, we proceed by induction. The
base cases are m = 0, m = 1, and it is true that
0

n=0
C(0, n) = C(0, 0) = 1 = 2
0
, and
1

n=0
C(1, n) = C(1, 0) +C(1, 1) = 1 + 1 = 2
1
. For the induction step, assume that m 2 and
m1

n=0
C(m1, n) = 2
m1
.
m

n=0
C(m, n) = C(m, 0) +C(m, m) +
m1

n=1
C(m, n) [using property from hint]
= 1 + 1 +
m1

n=1
[C(m1, n) +C(m1, n 1)] [denition of C]
=
_
m1

n=0
C(m1, n)
_
+
_
m

n=1
C(m1, n 1)
_
[using hint, splitting the sum]
=
_
m1

n=0
C(m1, n)
_
+
_
m1

n=0
C(m1, n)
_
[using hint]
= 2
m1
+ 2
m1
= 2
m
[by induction hypothesis]
We are done with the proof that
m

n=0
C(m, n) = 2
m
. We now attack the main problem by induction.
The base cases are m = 0, m = 1, and it is true that
0

n=0
n C(0, n) = 0 = 0 2
01
and
1

n=0
n C(1, n) = 0 C(1, 0) + 1 C(1, 1) = 1 2
11
. For the induction step, assume that m 2 and
m1

n=0
nC(m1, n) = (m1)2
m2
.
Now
m

n=0
n C(m, n) = 0 C(m, 0) +m C(m, m) +
m1

n=1
nC(m, n) [ using property from hint]
= 0 +m+
m1

n=1
n[C(m1, n) +C(m1, n 1)] [ denition of C]
=
_
m1

n=0
n C(m1, n)
_
+
_
m

n=1
n C(m1, n)
_
[ using hint, splitting the sum]
= (m1)2
m2
+
_
m1

n=0
(n + 1) C(m1, n)
_
[using induction hypothesis and hint]
= (m1)2
m2
+
_
m1

n=0
n C(m1, n)
_
+
_
m1

n=0
C(m1, n)
_
[multiplication, splitting the sum]
= (m1)2
m2
+ (m1)2
m2
+ 2
m1
= m 2
m1
[induction hypothesis and previous result]
So by induction the main proof is complete.

Das könnte Ihnen auch gefallen