Sale!

SOEN 331-S: Assignment 1 Solution

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (4 votes)

SOEN 331-S

4.1 Predicate logic 1 (10 pts)

In the domain of all people in a room, consider the predicate received request(a, b) that is
interpreted as
“[person] a has received a request from [person] b to connect on some social platform.”
1. How are the following two expressions translated into plain English? Are the two
expressions logically equivalent?
ˆ ∀ a ∃ b received request(a, b).
ˆ ∃ b ∀ a received request(a, b).

2. Discuss in detail whether we can we claim the following:
∀ a ∃ b received request(a, b) → ∃ b ∀ a received request(a, b).

3. Discuss in detail whether we can claim the following:
∃ b ∀ a received request(a, b) → ∀ a ∃ b received request(a, b).

4. How are the following two expressions translated into plain English? Are the two
expressions logically equivalent?
ˆ ∀ b ∃ a received request(a, b).
ˆ ∃ a ∀ b received request(a, b).

4.2 Predicate logic 2 (10 pts)
Given the subject “being a person” and the predicate “being bad”, consider the list of
propositions below:

1. “There are some nice people.”
2. “There are no nice people.”
3. “Everybody is bad.”
4. “Some people are bad.”
5. “Everybody is nice.”
6. “Some people are not nice.”
Associate each of the propositions below to one of the standard forms of categorical propositions.

4.3 Unordered and ordered structures (15 pts)
Consider the following two sets:
ˆ OS = {MacOS, Linux ,BSD, Windows, Unix}, and
ˆ My OS = {BSD, Unix}.

Answer the following questions:
1. Is the following declaration acceptable: My OS : POS ? Explain.
2. Is POS a legitimate type? Explain.
3. What does the following statement signify? My OS : OS. Is the statement acceptable?
Explain.

4. Is MacOS ∈ POS? Explain.
5. Is OS a legitimate type?
6. Is {} ∈ POS? Explain.
7. Is {Linux ,BSD} ∈ POS? Explain.
8. Is {{}} ∈ POS?
9. Is {} ∈ OS? Explain.

10. If we define variable My computer : POS, is {} a legitimate value for variable My Computer?
Explain.

11. If we stated that My computer = {Windows}, would the statement make My Computer
an atomic variable?

12. Is {{BSD, MacOS}} ⊂ POS? Explain.
13. Is My OS ⊂ POS? Explain.
14. Is {{BSD, MacOS}} ∈ POS?
6

4.4 Relational calculus 1 (15 pts)
Consider a system that associates active flights to airlines. The requirements of the system
are as follows:
1. Flights are unique.
2. Each flight is associated to a single airline, e.g. AA333 is an American Airlines flight.
3. The system can support new flights to be associated to an existing airline, or existing
flights to be deleted.

4. Airlines can have several active flights at any point in time.
We introduce types Flight and Airline. The model of the system is captured by variable
map, as shown below:
map =
{

AA333 7→ American Airlines,
AY 29 7→ Finnair ,
TS261 7→ Air Transat,
TS765 7→ Air Transat
}

1. Is map a binary relation? Explain.
2. Is map a function? Explain and if Yes, determine the type of the function.
3. Define the precondition for operation add, that adds a new flight-airline pair.

For Questions 4 and 5 assume the presence of the above precondition:
4. Provide two alternative definitions for the core functionality of operation add.
5. What would be the result of calling operation add with flight? = TS765, and airline? =
American Airlines?

For Questions 6 and 7 assume that the above precondition is removed:

6. What would be the result of calling add with
flight? = AA333,
airline? = Air Canada

7. Under what conditions, if any, can set union serve as a mechanism to successfully add
a new record into the database table? What error could possibly occur?
8. Provide a definition for the core functionality of operation delete that erases a flight
from map, given the flight number.

4.5 Relational calculus 2 (25 pts)
Consider the following binary relation:
airplanes : Model ↔ Manufacturer
where
airplanes =
{
A320 7→ Airbus,
A330 7→ Airbus,
A350 7→ Airbus,

A380 7→ Airbus,
737 7→ Boeing,
747 7→ Boeing,
Superjet100 7→ Sukhoi,
C 919 7→ Comac,

Global7500 7→ Bombardier ,
Global8000 7→ Bombardier ,
E170 7→ Embraer ,
E175 7→ Embraer
}

1. What is the value of the following expression:
{A330, 747} ✁ airplanes
2. What is the value of the following expression:
airplanes ✄ {Comac, Embraer}

3. What is the value of the following expression:
{A320, A330, A350, E170} −◁ airplanes
4. What is the value of the following expression:
airplanes −▷ {Airbus,Boeing}

5. What is the value of the following expression:
airplanes ⊕ {Su 80 7→ Sukhoi}
Comment on the deployment of the expression in the context of a database table.

5 What to submit

You must prepare all your solutions in LATEX and and produce a single pdf file. You may
use the .tex template provided. Name both your .tex and .pdf assignment files after the
Concordia id of the person who will submit, e.g. 123456.pdf, and submit both .tex and .pdf
files at the Electronic Assignment Submission portal at
(https://fis.encs.concordia.ca/eas)
under Assignment 1.

No late submissions will be accepted.
END OF ASSIGNMENT.
10