Swansea University CS-170J: Modelling Computing Systems Coursework 1

Verified

Added on  2022/12/23

|15
|2235
|100
Homework Assignment
AI Summary
This document presents a complete solution to the CS-170J Coursework 1 assignment on Modelling Computing Systems, completed at Swansea University. The assignment covers key concepts in theoretical computer science. Question 1 focuses on rewriting statements in "If..., then..." form, testing understanding of conditional statements. Question 2 delves into propositional logic, requiring translation of English statements, truth table construction, and analysis of logical consistency. Question 3 examines set theory, including Venn diagrams and set construction using set operations. Finally, Question 4 explores predicate logic, involving translation of English statements into predicate logic, negation of statements, and translation of predicate logic statements back into English, focusing on relationships between teams in a league. The solutions demonstrate a clear understanding of the concepts and provide detailed explanations.
Document Page
Modelling computer
systems
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Contents
Contents...........................................................................................................................................2
Question 1- Rewrite each of the following statements in English in the form “If . . . , then . . .”...1
(a) Swansea beach is full of people whenever the weather is sunny...........................................1
(b) I can go to a more beautiful beach, if I take the bus out of the city.......................................1
(c) Swansea’s cloudy weather implies that sunny days are precious..........................................1
(d) To practice kite-surfing, it is necessary to go to a beach.......................................................1
(e) To practice swimming, it is sufficient to go to a swimming pool..........................................1
(f) When I am rich, I will buy my own private beach.................................................................2
(g) I need to work hard if I want to become rich.........................................................................2
(h) I cannot enjoy the beach unless I take time off work.............................................................2
Question 2- Red, Green and Blue are players in a social deduction game in which you have to
identify the killer among them. Let Rsus, Gsus, Bdead and RB represent the following
statements:.......................................................................................................................................3
Rsus: Red is the killer..................................................................................................................3
Gsus: Green is the killer..............................................................................................................3
Bdead: Blue is dead.....................................................................................................................3
RB: Red and Blue are alone in a room........................................................................................3
a) Translate the following statements into propositional logic:...................................................3
P1: Either Red is the killer or Green is the killer.........................................................................3
P2: If Red is the killer, then Green is no killer............................................................................3
P3: If Red and Blue are alone in a room and Blue is dead, then Red is the killer.......................3
P4: If Green is the killer, then Red and Blue would not be alone in a room...............................3
P5: Red is no killer and Blue is dead...........................................................................................3
b) Construct a truth table with variables Rsus, Gsus and the statement P1P2.........................4
(c) CanP1, P2, P3, P4, P5be true at the same time? Justify your answer....................................5
Question 3-.......................................................................................................................................5
Document Page
(a) Let A, B, C be sets in a universe of discourse U. Draw Venn diagrams illustrating the
following sets:..................................................................................................................................5
i. (A\B)(B\(AC))....................................................................................................................5
ii. A\((BC)\(B∩C))...................................................................................................................6
iii. (ABC)(ABC)..........................................................................................................7
(b) Let..........................................................................................................................................9
A= {1,2,3,4,5},............................................................................................................................9
B= {4,5,6,7,8},.............................................................................................................................9
C= {1,3,4,5,7} and.......................................................................................................................9
U={1,2,3,4,5,6,7,8}.....................................................................................................................9
Use A, B, C and the operations ,∩,,(·) to construct the set {1,3,7}..........................................9
Question 4- Let T be a set of teams playing in a league. Three of the teams are Team Liquid, Evil
Geniuses and Mouses ports. The league is still ongoing, so not every team has finished their
matches yet. Let P(a, b) mean “a played against b” and W(a, b) mean “a won against b”...........10
(a) Translate the following English statements into predicate logic..........................................10
i. Team Liquid has played against every team..........................................................................10
ii. Evil Geniuses has won against every team it has played against..........................................10
iii. Mouses ports played and won against every team except Evil Geniuses............................10
iv. There is a team which has played no team yet.....................................................................11
v. A team cannot win against teams they haven’t played against yet........................................11
(b) Negate all statements in English..........................................................................................11
i. Team Liquid has played against every team..........................................................................11
ii. Evil Geniuses has won against every team it has played against..........................................11
iii. Mouses ports played and won against every team except Evil Geniuses............................11
iv. There is a team which has played no team yet.....................................................................12
v. A team cannot win against teams they haven’t played against yet........................................12
(c) Translate the following statement into English:...................................................................12
Document Page
Question 1- Rewrite each of the following statements in
English in the form “If . . . , then . . .”
(a) Swansea beach is full of people whenever the weather is sunny.
Solution: If the weather is sunny then Swansea beach will be full of
people.
(b) I can go to a more beautiful beach, if I take the bus out of the city.
Solution: If I will take the bus out of the city then I can surely go to a
more beautiful beach.
(c) Swansea’s cloudy weather implies that sunny days are precious.
Solution: If the weather near Swansea is cloudy then it implies that the
sunny days are precious.
(d) To practice kite-surfing, it is necessary to go to a beach.
Solution: If one wants to practise kite-surfing then it is necessary to go
to a beach.
(e) To practice swimming, it is sufficient to go to a swimming pool.
Solution: If someone wants to practice summing then it is sufficient to
go to a swimming pool.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
(f) When I am rich, I will buy my own private beach.
Solution: If I will become rich then I will buy my own private beach.
(g) I need to work hard if I want to become rich.
Solution: If I want to become rich then I need to work hard.
(h) I cannot enjoy the beach unless I take time off work.
Solution: If I want to enjoy on the beach then I have to take time off
from work.
Document Page
Question 2- Red, Green and Blue are players in a social
deduction game in which you have to identify the killer
among them. Let Rsus, Gsus, Bdead and RB represent the
following statements:
Rsus: Red is the killer
Gsus: Green is the killer
Bdead: Blue is dead
RB: Red and Blue are alone in a room
a) Translate the following statements into propositional logic:
P1: Either Red is the killer or Green is the killer.
P2: If Red is the killer, then Green is no killer.
P3: If Red and Blue are alone in a room and Blue is dead, then Red is
the killer.
P4: If Green is the killer, then Red and Blue would not be alone in a
room.
P5: Red is no killer and Blue is dead.
Solution: P1: The statement says that the killer is either red or green
P2: The statement says that if red is the killer then green would not be
the killer.
P3: This statement says that if both red and blue are in a same room and
blue is found dead then red is the killer.
Document Page
P4: This statement says that if green is the killer then both red and blue
would not be alone in a room.
P5: This statement finally concludes that blue is found dead but red is
not the killer.
b) Construct a truth table with variables Rsus, Gsus and the statement
P1P2.
Solution: Truth table with variable Rsus
P1 P2 P1P2
True True True
False False False
True False True
False True True
Truth table with variable Gsus
P1 P2 P1P2
True True True
False False False
True False True
False True False
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
(c) CanP1, P2, P3, P4, P5be true at the same time? Justify your answer.
Solution: No all the P’s cannot be same because the first P is saying that
either red or green is the killer, while the second one is saying that if red
is not the killer then green is definitely the killer. Whereas P3 says that if
red and blue are in a single and blue is dead then red is definitely the
killer, and fourth P says that if green is the killer then both red and blue
are not in the same room. The fifth P says that blue is dead but red is not
the killer. So from the above it can be seen that P1, P2, P4, and P5 are
correct or partially correct but P3 is wrong so it is not possible that all
the P’s are correct at the same time.
Question 3-
(a) Let A, B, C be sets in a universe of discourse U. Draw
Venn diagrams illustrating the following sets:
i. (A\B)(B\(AC))
Solution:
Document Page
Green colour part is A\B
Red colour part is AC
Grey colour part is B\(AC)
And the rest is (A\B)(B\(AC))
ii. A\((BC)\(B∩C))
Solution:
Document Page
Green colour part is BC
Orange colour part is B∩C
Grey colour part and the rest of the one is A\((BC)\(B∩C))
iii. (ABC)(ABC)
Solution:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Green colour part is ABC
Orange colour part is ABC
And the rest of the part is (ABC)(ABC)
Document Page
(b) Let
A= {1,2,3,4,5},
B= {4,5,6,7,8},
C= {1,3,4,5,7} and
U={1,2,3,4,5,6,7,8}.
Use A, B, C and the operations ,∩,\,(·) to construct the set {1,3,7}.
chevron_up_icon
1 out of 15
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]