Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMP11120

Mathematical Techniques for Computer Science

Section A

1.  a)  Show that for all natural numbers n it is the case that n is divisible by 4 if and only if the number given by the last two digits of n is divisible by 4.                 (4 marks)

b)  Consider the following binary operation * on the set of binary strings of length 1024. For 0   ≤ i1023, the ith symbol in s * s is

. si if iis even and

. s else,

where si denotes the ith symbols in sands denotes the ith symbols in s.  This means, for example, if the string s consists exclusively of 0s and the string s( consists exclusively of 1s then the strings * s( consists of 512 repetitions of 01.

i)  Is the given operation commutative? Give a reason for your answer. (2 marks)

ii)  Is this operation associative? Justify your answer.                               (4 marks)

c)  Consider the following function.

f : Z Z

x x + (x mod 3)

Calculate the values off for inputs from —4 to 3. Is this function injective? Is it surjective? Justify your answers.     (10 marks)

2.  Your friend has three different tetrahedra (i.e., four-sided dice). You have the following information:

. Each tetrahedron has each of its four surfaces labelled with 0 or 1.

. Each tetrahedron has at least one of its sides labelled with 0, and one labelled with 1.

A random experiment can be conducted with such a tetrahedron by throwing it and reading the label on the surface on which it comes to rest.

a)  For the tetrahedron that has the greatest number of surfaces labelled with 0 give a probability space that describes the corresponding random process.          (2 marks)

b)  You create a binary number by rolling the same tetrahedron three times and writing down the number from left to right.   For each possible tetrahedron what is the probability that the number obtained in this way is at least 2 when translated to base 10?                                (3 marks)

c)  For the situation from part b) create random variables by turning the binary numbers into the corresponding numbers in base 10.  Calculate the expected value for the random variable X you obtain for the tetrahedron from part a).                 (2 marks)

d)  Given the situation from part c) calculate the conditional probability distribution given that the rst throw shows 0.          (3 marks)

e)  Your friend picks one of the three tetrahedra, and you are trying to work out which one it is. You do so by Bayesian updating.

Your friend throws the tetrahedron for you and shows you the number labelling the bottom face, keeping the rest of the tetrahedron hidden from you.

They do this three times, obtaining the numbers 0, 0 and 1 in that order.

Carry out the corresponding calculation. Which tetrahedron do you think it is? (10 marks)

Section B

3.  a)  Consider the following propositional formula.

(P ! Q) ! ((Q! R) ! (:S ! :P))

i)  Use our DNF algorithm to transform the formula into disjunctive normal form. (3 marks)

ii)  Give a conjunctive normal form for the formula.                 (1 mark)

iii)  Simplify your answer in ii) as much as possible using our fundamental semantic equivalences.       (2 marks)

iv)  Is the formula a tautology? Explain your answer.                                (2 marks)

v)  Is the formula satisable? Explain your answer.                                  (2 marks)

Justify all your steps in your derivations.

b)  Consider this judgement in propositional logic.

P ^ Q- (P ! Q) ^ (Q! P)

Your friend has given the following incorrect natural deduction proof of this judgement.

1: P ^ Q-P

2: P ^ Q-Q

3: P ^ Q; P -Q

2, Weakening

4: P ^ Q-Q! P

3, ! Intro

5: P ^ Q; Q-P

1, Weakening

6: P ^ Q-P ! Q

5, ! Intro

7: P ^ Q- (P ! Q) ^ (Q! P)

6,4, ^ Intro

Say what is (are) the mistake(s) and fix the proof so that it is a correct proof using our natural deduction system in which every step is correctly justified.

The inference rules of our natural deduction system are given on the last pages of this exam paper.        (4 marks)

c)  Consider the rst-order language with the three binary predicate symbols C; <; =, four unary predicate symbols D;ID; E ; O, the constants a; 0; 1; 2; : : : ; 9, and a supply of variables x;y; z; : : :.

Suppose the domain of interpretation is the set of all natural numbers.   Further

assume the given predicate and constant symbols have the following interpretations:

C(x;y)

means that the number x contains digit y,  e.g., C(122759; 2) is interpreted as 1, but C(122759; 3) is interpreted as 0

x < y

means that x is less than y (ordinary less thanon numbers)

x = y

means that x is equal to y (equality on numbers)

D(x)

means that x is a digit,i.e., a number between 0 and 9

ID(x)

means that the number x is a student identification number

E(x)

means that x is an even number

O(x)

means that x is an odd number

a

is interpreted as the student identification number of Ann

0; 1; 2; : : : ; 9

are constants interpreted as themselves,

e.g., 0 is interpreted as 0, and so on

State for each of the following formulas what is their truth value in the interpration defined above. Briefly explain you answers.      (4 marks)

i)  (1 < 0) ! 9x(x < 0)

ii)  Ax (D(x) ! 9y(D(y) ^ (x < y),,

iii)  Ax (ID(x) !(9y(D(y) ^ C(x;y) ^ E(y)) ^ 9z (D(z) ^ C(x; z) ^ O(z)),,

Using the language and interpretation given above, express the following sentence as a rst-order formula.       (2 marks)

iv)  Every odd digit other than 7 occurs in Anns student identication number.