Consider a system that handles railway connections as it associates (source) cities to all their corresponding destinations. The requirements of the system are as follows:       1. A source city may have connections to possibly multiple destination cities.       2. Multiple source cities may share the same group of destination cities. We introduce type CITY . A possible state of the system is shown below as it is captured by variable connections: connections = { Montreal → {Ottawa, Kingston, Quebec, Halifax}, Ottawa → {Montreal, Toronto}, Toronto → {Montreal, Ottawa}, Halifax → {Montreal, Quebec}, Quebec → {Montreal, Halifax}, Kingston → {Montreal} } 1. Is connections a binary relation? Explain why, and if so express this formally. 2. In the expression connections ∈ (...), what would the RHS be? 3.  Is connections a function? If so, define the function formally, and reason about the properties of injectivity, surjectivity and bijectivity. 4.  Describe the meaning and evaluate the following expression: {Montreal, Halifax} ◁ connections 5.  Describe the meaning and evaluate the following expression: connections ▷ {{Montreal, Halifax}}  6. Describe the meaning and evaluate the following expression: {Montreal, Quebec, Halifax} −◁ connection 7. Describe the meaning and evaluate the following expression: connections −▷ {{Ottawa, Kingston, Quebec, Halifax}, {Montreal, Ottawa}, {Montreal}} (I mean 'domain subtraction' by this −◁ and 'range subtraction' by this −▷, don't know how to include the symbols) 8. Describe the meaning and evaluate the following expression that forms a post-condition to some operation: connections′ = connections⊕{ Halifax → {Montreal, Charlottetown, Quebec}, Charlottetown → {Halifax} } 9. Assume that we need to add a new entry into the database table represented by connections. We have decided NOT to deploy a precondition. What could be the consequences to the system if we deployed a) set union and b) relational overriding? 10. Consider operation AddConnection to add a new entry to the table, defined by the following pair of assertions: city? ̸∈ dom connections connections′ = connections ∪ {city? → destinations?} What would be result of the call AddConnection(Montreal, (Boston, NYC)), and in the case of failure, whom should we blame and why? (I mean "not a member" by this  ̸∈) 11. Consider the following modification to the postcondition of AddConnection: connections′ = connections ⊕ {city? → destinations?} What would be result of the call AddConnection(Kingston, (Boston, NYC))? In the absence of a precondition, can relational overriding unconditionally capture the intent of the operation?  12. Consider the following state schema in the Z specification language: _RailwayManagement____________________________________________________________ |cities : PCITY |connections : CITY ↛ PCITY |______________ |cities = dom connections ____________________________________________________________________________ Define the schema for operation GetDestinations which returns all destinations for a given city.  (I mean "partial function" by this ↛ ) 13. (PROGRAMMING) Define global variable connections in Common LISP and populate it with some sample data. Demonstrate that the variable indeed contains the ordered pairs as shown above. 14. Describe how you would validate variable connections, i.e. how to show that it holds a function. 15. (PROGRAMMING) Define a predicate function, isfunctionp, in Common LISP that reads a variable like connections and indicates if the variable corresponds to a function or not. 16. (PROGRAMMING) Define function GetDestinations in Common LISP.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Consider a system that handles railway connections as it associates (source) cities to all their corresponding destinations. The requirements of the system are as follows:

      1. A source city may have connections to possibly multiple destination cities.

      2. Multiple source cities may share the same group of destination cities.

We introduce type CITY . A possible state of the system is shown below as it is captured by variable connections:
connections =
{
Montreal → {Ottawa, Kingston, Quebec, Halifax},
Ottawa → {Montreal, Toronto},
Toronto → {Montreal, Ottawa},
Halifax → {Montreal, Quebec},
Quebec → {Montreal, Halifax},
Kingston → {Montreal}
}

1. Is connections a binary relation? Explain why, and if so express this formally.


2. In the expression connections ∈ (...), what would the RHS be?


3.  Is connections a function? If so, define the function formally, and reason about the properties of injectivity, surjectivity and bijectivity.


4.  Describe the meaning and evaluate the following expression:

{Montreal, Halifax} ◁ connections


5.  Describe the meaning and evaluate the following expression:

connections ▷ {{Montreal, Halifax}} 

6. Describe the meaning and evaluate the following expression:
{Montreal, Quebec, Halifax} −◁ connection

7. Describe the meaning and evaluate the following expression:
connections −▷ {{Ottawa, Kingston, Quebec, Halifax}, {Montreal, Ottawa}, {Montreal}}

(I mean 'domain subtraction' by this −◁ and 'range subtraction' by this −▷, don't know how to include the symbols)

8. Describe the meaning and evaluate the following expression that forms a post-condition to some operation:
connections′ = connections⊕{
Halifax → {Montreal, Charlottetown, Quebec},
Charlottetown → {Halifax}
}

9. Assume that we need to add a new entry into the database table represented by connections. We have decided NOT to deploy a precondition. What could be the consequences to the system if we deployed a) set union and b) relational overriding?

10. Consider operation AddConnection to add a new entry to the table, defined by the following pair of assertions:
city? ̸∈ dom connections
connections′ = connections ∪ {city? → destinations?}
What would be result of the call AddConnection(Montreal, (Boston, NYC)), and in the case of failure, whom should we blame and why?

(I mean "not a member" by this  ̸∈)

11. Consider the following modification to the postcondition of AddConnection:
connections′ = connections ⊕ {city? → destinations?}

What would be result of the call AddConnection(Kingston, (Boston, NYC))? In the absence of a precondition, can relational overriding unconditionally capture the intent of the operation? 

12. Consider the following state schema in the Z specification language:

_RailwayManagement____________________________________________________________
|cities : PCITY
|connections : CITY ↛ PCITY

|______________
|cities = dom connections
____________________________________________________________________________

Define the schema for operation GetDestinations which returns all destinations for a given city. 

(I mean "partial function" by this ↛ )

13. (PROGRAMMING) Define global variable connections in Common LISP and populate it with some sample data. Demonstrate that the variable indeed contains the ordered pairs as shown above.
14. Describe how you would validate variable connections, i.e. how to show that it holds a function.
15. (PROGRAMMING) Define a predicate function, isfunctionp, in Common LISP that reads a variable like connections and indicates if the variable corresponds to a function or not.
16. (PROGRAMMING) Define function GetDestinations in Common LISP.

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Heuristic System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education