67% found this document useful (3 votes)
691 views4 pages

FORMAL METHODS FINAL EXAM - New

This document provides instructions and questions for a formal methods exam being administered at Makerere University. The exam contains 6 questions with sub-questions testing knowledge of formal logic, set theory, functions, relations, and Z notation. Students are instructed to attempt all questions in Section A and 3 questions from Section B in the allotted time.

Uploaded by

Robert Chitsuro
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
67% found this document useful (3 votes)
691 views4 pages

FORMAL METHODS FINAL EXAM - New

This document provides instructions and questions for a formal methods exam being administered at Makerere University. The exam contains 6 questions with sub-questions testing knowledge of formal logic, set theory, functions, relations, and Z notation. Students are instructed to attempt all questions in Section A and 3 questions from Section B in the allotted time.

Uploaded by

Robert Chitsuro
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/ 4

MAKERERE UNIVERSITY

COLLEGE OF COMPUTING AND INFORMATION SCIENCES


END OF SEMESTER 1 EXAMINATIONS 2013-2014

PROGRAMME: CS , SE

YEAR OF STUDY: II

COURSE NAME: FORMAL METHODS

COURSE CODE: BSE 2105

DATE:14th/Jan/2014 TIME: 12-3 pm

EXAMINATION INSTRUCTIONS

1. ATTEMPT ALL QUESTIONS IN SECTION A (40 MARKS) .

2. ATTEMPT THREE (03) QUESTIONS IN SECTION B (60 MARKS).

3. DO NOT OPEN THIS EXAM UNTIL YOU ARE TOLD TO DO SO.

4. ALL ROUGH WORK SHOULD BE IN YOUR ANSWER BOOKLET NOT ON QUES-


TION PAPER
SECTION A: 40 Marks

1. (a) Using truth tables, prove whether the following are tautologies, contradications or a
contingent.Give reason for your answer.
i. ∼ (P ∨ (P ∧ Q)) ∨ P (5 marks)
ii. ((P → Q) → P ) → P (5 marks)
(b) Let f:A → B and g : B → C be functions. Prove that if (g ◦ f ) is injective, then f is
injective. (5 marks).
(c) For each of the following, state whether its true or false giving reason for your answer.
A, B and C are sets.
i. If |A| = 3 and |B | = 4, then |AUB | = 7. (5 marks)
ii. if |A| = 3,|B | = |C | = 5,|A ∩ B | = 2, |B ∩ C | = 3 and |A ∩ C | = |A ∩ B ∩ C | = 1,
then |A ∪ B ∪ C | = 8. (5 marks)
(d) Let f : Z → Z by f (x ) = x 2 + 1 and g : Z → Z by g(x ) = 2x − 3. What is:-
i. (g ◦ f )(4)? (5 marks)
ii. (f ◦ g)(2)? (5 marks)
(e) Translate each of the following statements into the language of sentential logic. Use
the first letter of the capitalised word(s).
i. It is RAINING or OVERCAST, but in any case it is not SUNNY. (1 mark)
ii. I will SUCCEED only if I WORK hard and take RISKS. (1 marks)
iii. It is not RAINING, but it is still too WET to play (1 marks)
iv. If neither JAY nor KAY is home this weekend, we will go to the BEACH;otherwise,
we will STAY home. (1 marks)
v. Either Jones is a FOOL or he is DISHONEST (1 marks)

1
SECTION B:(60 Marks)

2. (a) Prove whether the following sequents are valid or not without using truth tables
(P ∨ Q) ∧ R
i. (P ∧ R) ∨ (Q ∧ R) (5 marks)

(P ∧ Q) → R
ii. [(P → Q) → R] → [(P → Q) → R] (5 marks)
(b) Construct a formal derivation of the conclusion for each of the following arguments.
i. ∀ x [(Fx ∨ Gx ) → Hx ]; ∀ x [Hx → (Jx ∧ Hx )] / Fa → Ka (5 marks)
ii. ∀ x (Fx → Gx ); ∼ ∃ x (Gx ∧ Hx )/ ∀(Fx →∼ Hx ) (5 marks)

3. (a) Using the suggested abbreviations (the capitalized words), translate each of the fol-
lowing into the language of predicate logic.

i. Some SENATORS are not HONEST (2 marks).


ii. Everyone who isn’t VACATIONING is WORKING (2 marks).
iii. The only FRESHMEN who PASS intro logic are the ones who WORK (2
marks).
iv. CATS and DOGS that have RABIES are not SUITABLE pets. (2 marks).
v. If anyone PASSES the exam, then everyone will be HAPPY. (2 marks).
(b) Translate each of the following sentences into first-order logic. The statements describe
situations involving Toddlers, Nannies, and Blocks. Billy is a constant referring to a
particular toddler. You may only use the following predicates:
IsSuper(x, y) – x is supervising y
Toddler(x) – x is a toddler
Sleeping(x) – x is sleeping
Nanny(x) – x is a nanny
Block(x) – x is a block
FightsWith(x, y, z)– x fights with y over z
i. Nobody who is supervising can be sleeping or fighting. (2 marks).
ii. Some nanny is supervising (at least) two toddlers. (2 marks).
iii. Billy fights with another toddler over a block. (2 marks).
iv. Every toddler who is sleeping is being supervised by some nannyor it is the case
that all nannies are sleeping. (2 marks).
v. The only sleeping nanny is the one supervising Billy. (2 marks).

2
4. (a) Use diagrams to state whether each of the following functions is injective or surjective.
i. f (x ) = |x − 2| (5 marks).
ii. g(x ) = x 2 − 2 (5 marks).
(b) Let f : A → B be a function where A and B are finite sets and |A|=|B |. Prove that f
is injective if and only if it is surjective. (5 marks).
(c) Find the inverse of f(x)= - 31 x + 1 (5 marks)

5. (a) Given a queue which is a sequence of 10 integers. In a z schema we declare the queue
as q=seq Z. Define a predicate in the same schema to represent the fact that the
queue can only hold 10 integers. Note: Don’t draw the schema. (5 marks).
(b) Given a system which records peoples birthdays, and is able to issue a reminder when
the day comes round. Define a state space schema for this system. (5 marks).
(c) In a Z specification of a system which will keep track of students who have handed in
Assignments, there are clearly four sets involved...
i. STUDENT (all students)
ii. Class (all the students in the class)
iii. HandedIn (all the students in the class who have handed in their assignment)
iv. NotHandedIn (all the students in the class who have not handed in their assign-
ment)
Write a z schema to model handing in of a student assignment. (10 marks).

6. (a) Given that set A={1,2,3,4,5} and set B ={4,5,6,7}. Compute the following.
i. |P(A ∪ B )| (4 marks)
ii. A∆B (3 marks)
iii. A x B (2 marks)
iv. |(A − B ) ∪ (B − A)| (3 marks)
v. (B x A)∪A (3 marks)
(b) Using Sets A and B in a) above, prove (or disprove) that |A∆B )|= |A|+|B |- |A ∩ B |
(5 marks).

Good Luck and Happy New Year!!

You might also like