CMPUT 272 — Winter 2005
Formal Systems and Logic in Computing Science
Section B1 (Stewart)
Final Exam
April 25, 2005
Last name:
First name:
Student number:
Instructions
• Write your last name, first name, and student number in the box above.
• Time allowed: 120 minutes.
• Place all answers in the spaces provided on the question pages. JUSTIFY each answer appropriately.
• This exam counts 46% toward your final grade in this course. This exam is worth 70 points. The
weight of each question is indicated in square brackets by the question number.
• There should be 8 questions and 8 pages in this exam booklet. You are responsible for checking that
your exam booklet is complete.
Question Mark Out Of
1 10
2 10
This is an OPEN BOOK exam 3 10
– you may refer to your text- 4 10
book plus one 8 12 ×11 inch sheet
5 5
of notes during the exam.
6 5
No other aids allowed.
7 10
8 10
TOTAL 70
Question 1 [10 marks]: In how many ways can we distribute r balls into n ≥ 1 distinct bins under each
of the following conditions:
a) the balls are identical and some bin(s) may be left empty?
b) the balls are identical and no bin is left empty?
c) the balls are identical, some bin(s) may be left empty, and the first bin has at most 2 balls in it?
d) the balls are distinct and some bin(s) may be left empty?
2
Question 2 [10 marks]: Fill in the missing statements and reasons to complete the proof of the follow-
ing argument (from Symbolic Logic by Lewis Carroll). Each reason must be one rule from the textbook,
specifically, one rule of inference, one law of logic, or one rule for quantifier negation.
∀x [H(x) → C(x)] All hummingbirds are richly coloured.
¬∃x [L(x) ∧ E(x)] No large birds live on honey.
∀x [¬E(x) → ¬C(x)] Birds that do not live on honey are dull in colour.
∴∀x [H(x) → ¬L(x)] ∴Hummingbirds are small.
Steps Reasons
1) ∀x [H(x) → C(x)] Premise
2) ¬∃x [L(x) ∧ E(x)] Premise
3) ∀x [¬E(x) → ¬C(x)] Premise
4) H(a) Assumption
¬L(a)
H(a) → ¬L(a)
∴ ∀x [H(x) → ¬L(x)]
3
Question 3 [10 marks]: Let A, B, C, D, E, F ⊆ Z be defined as follows:
A = {2n | n ∈ Z} B = {2n + 1 | n ∈ Z} C = {3n | n ∈ Z}
D = {4n | n ∈ Z} E = {6n | n ∈ Z} F = {8n | n ∈ Z}
a) [4 marks] Draw the Hasse diagram for the partial order ({A, B, C, D, E, F }, ⊆).
b) [6 marks] Express each of the following sets as one of A, B, C, D, E, or F .
D∩F =
C ∪E =
A∩C =
C ∩E =
A=
A∩F =
4
Question 4 [10 marks]: Prove by induction that, for every positive integer n,
7 | (n7 − n)
a) [3 marks] State and prove the basis step.
b) [2 marks] State the inductive step, that is, state precisely what remains to be proved.
c) [5 marks] Prove the inductive step. Clearly state and label the inductive hypothesis.
5
Question 5 [5 marks]: In the proof of Euclid’s algorithm, presented in class, we used Theorem 4.3 to prove
the following, where rk−2 , qk−1 , rk−1 , rk , c ∈ Z+ :
rk−2 = qk−1 rk−1 + rk ∧ c | rk−2 ∧ c | rk−1 ⇒ c | rk .
Prove this fact without reference to Theorem 4.3, that is, using the definition of divides.
Question 6 [5 marks]: Let S = {3, 7, 11, 15, 19, . . . , 95, 99, 103}. Find the smallest integer k such that every
subset of S of size k or greater is guaranteed to contain at least one pair of numbers whose sum is exactly
110. Justify your answer.
6
Question 7 [10 marks]: State whether each of the following statements about functions is true or false.
For each false statement, give a counterexample .
a) If f : A 7→ B and (a, b), (a, c) ∈ f , then b = c.
b) If f : A 7→ B is a one-to-one correspondence and A, B are finite, then |A| = |B|.
c) If f : A 7→ B is one-to-one, then f is invertible.
d) If f : A 7→ B is invertible, then f is one-to-one.
e) If f : A 7→ B is one-to-one and g, h : B 7→ C with g ◦ f = h ◦ f , then g = h.
f) If f : A 7→ B and A1 , A2 ⊆ A, then f (A1 ∩ A2 ) = f (A1 ) ∩ f (A2 ).
g) If f : A 7→ B is invertible and B1 , B2 ⊆ B, then f −1 (B1 ∩ B2 ) = f −1 (B1 ) ∩ f −1 (B2 ).
7
Question 8 [10 marks]: A relation R on a set A is called irreflexive if for all a ∈ A, (a, a) ∈
/ R.
a) [3 marks] Give an example of a relation R on Z where R is irreflexive and transitive but not symmetric.
Justify that your example does indeed have the required properties.
b) [5 marks] Let R be a nonempty relation on a set A. Prove that if R satisfies any two of the following
properties—irreflexive, symmetric, transitive—then it cannot satisfy the third.
c) [2 marks] If A is a finite set with |A| = n > 1,
i) how many different relations on A are irreflexive?
ii) how many are neither reflexive nor irreflexive?