ITECH7410-Software Engineering | Formal Specification for a Library Sy
•Add a book
•Add a borrower
•Delete a book
•Delete a borrower
•Lend a book to a borrower
•Return a book from a borrower
•Enquire about a book
•Reserve a book
•Enquire about a reservation
•Cancel a reservation
2.The schema must be consistent and be shown to work using examples
3.Schema need to be annotated so that the Z statements are clearly expressed in plain language
4.Write three (3) non-trivial predicate statements about your system; explain them and show that they are true
Answer:
Introduction
Formal specifications are used to describe systems in a clear and precise manner using mathematical notations borrowed from formal logic and the set theory (Somerville, 2013). They provide an abstraction of the system from a high level point of view (Partsch, 2012). This means that the users and developers know what the system is going to do before they go into the specific details of how that will be achieved. The specification acts as a kind of central repository because analysts, developers, testers and users all refer to it at one point or another in the system development lifecycle.
In general formal specifications reduce the overall cost of system development and reduces ambiguity and therefore errors as the system keeps getting developed (Sommerville et al., 2012).
The Z notation
The Z notation is a formal specification method which models the behavio
r of the proposed system in decomposed, small units known as schemas. Schemas are depicted using mathematical notations from the set theory and predicate logic (Klein, Sawicki, Roos-Frantz & Frantz, 2014).
Schemas represent the dynamic and static aspects of the system. The dynamic aspects include the operations that can be carried out, relationships between inputs and outputs and changes of state. The static aspects include the possible states the system can be in (state space) and the relationships between them.
The structure of a schema consists of the title of the schema, the declaration part, where variables are declared, and the predicate section, where conditions and relationship between variables and functions are specified. The figure below illustrates.
Figure 1: Structure of a schema
The predicate part can be optional and is assumed to be true when absent.
Variables are declared in the form x:T, where x is the variable and T is the data type. Predicates use mathematical symbols from the set theory and logic to represent an expression. Z notation particularly employs the Zermelo-Fraenkel set theory and the typed first order predicate logic for these expressions. An example of a predicate could be x∈S, where x is an element which exists in the set S.
Advantages of Z notation
- It produces human readable system specification and therefore can be used as a basis for documentation
- The Z notation makes a large specification manageable by decomposing it using schemas into small units
- Z notation has been widely accepted as the industry standard for formal specification and can be comfortably used in whichever context, be it software engineering or the manufacturing industry.
Disadvantages of Z notation
- As a formal specification technique, it requires a considerable amount of effort and experience to use it in a practical and beneficial way
- The Z toolset is still not very advanced. Typechecking and proof reading tools are still being developed and have not really been standardized.
The library system schemas
The Z notations used for the library system schema include:-
? - Declares a variable x to be a subset of Y. Its syntax is x: ?Y
? - Indicates partial dependence of a variable y on a variable x. The syntax is of the form x?y
Δ – It is known as a delta and shows that the current function causes a change in system state, for example when a new item is added.
Ξ – It is known as Xi and indicates that the current function does not alter system state
∪- Indicates a union between set A and B. Technically it represents an addition of an element to a set X in a schema
∈- Indicates that an element x is a member of a set Y. Its syntax is x∈Y
∉ - Indicates that an element x is not a member of a set Y. Its syntax is x∉ Y
? -Indicates a difference between two sets A and B, with A being the larger set which contains all the elements present in set B. The syntax is A?B
? –Is used to indicate input variable x. Syntax is of the form x?:TYPE
! – Is used to indicate output variable x. Syntax is of the form x!:TYPE
Library state space schema
This is the main schema for the entire system on which changes will be effected as depicted in the function schemas.
Library
known: ?BOOK
name: ?NAME
lending: NAME?BOOK
reservation: NAME?BOOK
Add book schema
AddBook
ΔLibrary
bookID?:BOOK
ISBN?:BOOK
title?: BOOK
bookID? ∉ known
ISBN? ∉ known
title? ∉ known
known′ = known ∪{bookID?ISBN? ?title?}
Delete book schema
DeleteBook
ΔLibrary
bookID? : BOOK
ISBN?:BOOK
bookID? ∈ known
ISBN?: ∈ known
known′ = known ?{bookID??ISBN? ?title}
Add borrower schema
AddBorrower
ΔLibrary
name? : NAME
name? ∉ name
name′ = name∪ {name?}
Delete borrower schema
DeleteBorrower
ΔLibrary
name? : NAME
name? ∈ name
name′ = name ? {name?}
Lend book schema
LendBook
ΔLibrary
name? : NAME
title?: BOOK
bookID:BOOK
ISBN:BOOK
name? ∈ name
title? ∈ known
lending′ = lending ∪ {name? ?bookID?ISBN?title?}
Return book schema
ReturnBook
ΔLibrary
name?: NAME
title: BOOK
bookID?:BOOK
ISBN:BOOK
name? ∈ lending
lending′ = lending? {name??bookID??title?ISBN
Enquire book schema
EnquireBook
Ξ Library
title?: BOOK
book!: BOOK
bookID:BOOK
ISBN:BOOK
book! = known(title? ?bookID?ISBN)
Reserve book schema
ReserveBook
ΔLibrary
title?: BOOK
name?: NAME
bookID:BOOK
ISBN:BOO
name? ∉ reservation
reservation′ = reservation ∪ {name??title? ?bookID?ISBN}
Enquire reservation schema
EnquireReservation
ΞLibrary
name?: NAME ISBN:BOOK
title: BOOK result!:reservation
bookID:BOOK
result!= reservation(name??title?bookID?ISBN)
Cancel reservation schema
CancelReservation
ΔLibrary
name?: NAME
title:BOOK
bookID:BOOK
ISBN:BOOK
name? ∈ reservation
reservation′ = reservation? {name??title?bookID?ISBN}
Examples of scenarios
- A new book arrives in the library. The system administrator then invokes the add book procedure. He keys in the title and clicks the save button and the book’s title is added to the Books (BOOKS) database. If the title already exists, the system informs the user that the book is already in the database.
- A student goes to the library and enquires about a book. The librarian, keys in the title, whereby the system searches for it in the Books database (BOOKS). The system then displays a set of titles (known) related to the key words. If there are no matching results, the system alerts the user.
Non trivial predicate statements in the library system
- The EnquireReservation schema has the non-trivial predicate title!=known(name??title)
In this predicate, the title of a book is output automatically when a borrower’s name is keyed into the system. Hence there is no direct relation between the known function and the title.
- The EnquireBook schema has the non-trivial predicatebook! = known(title?) whereby the output variable book does not directly access the title but does so through the known function
- The CancelReservation schema has the non-trivial predicate reservation′ = reservation?{name??title} whereby when a reservation is accessed by the variable name the system automatically deletes the associated So there is no direct relationship between the variable and the function
Current trends in Z formal method
Object Z is a new object oriented formal specification technique based on the earlier developed Z notation. It is therefore, in essence, an extension of Z (Smith, 2012). The view of the system is that of objects communicating with one another. It is necessary, therefore, that all the object oriented principles are followed including encapsulation, polymorphism, inheritance and persistence.
Singh, Sharma, and Saxena (2016) have proposed a new approach of integrating UML and Z notation. This comes about as a result of rigorous use of mathematics in formal methods. Therefore, they suggested that a bridge is required between UML and formal methods to overcome the insufficiencies. Research and development continues.
Conclusion
Formal specification techniques have been seen to be useful in large scale system development as they reduce ambiguity and therefore errors in the final deliverable. This makes them invaluable tools both in the software and industrial engineering fields. As can be seen in the previous sections, these techniques keep being improved through research and development
References
Klein, M. J., Sawicki, S., Roos-Frantz, F., & Frantz, R. Z. (2014). On the Formalisation of an
Application Integration Language Using Z Notation. In ICEIS (1) (pp. 314-319).
Partsch, H. A. (2012). Specification and transformation of programs: a formal approach to
software development. Springer Science & Business Media.
Singh, M., Sharma, A. K., & Saxena, R. (2016). Formal Transformation of UML Diagram: Use
Case, Class, Sequence Diagram with Z Notation for Representing the Static and Dynamic Perspectives of System. In Proceedings of International Conference on ICT for Sustainable Development(pp. 25-38). Springer, Singapore.
Smith, G. (2012). The Object-Z specification language (Vol. 1). Springer Science & Business
Media.
Sommerville, I. (2013). Software Engineering: Pearson New International Edition. Pearson
Education Limited.
Sommerville, I., Cliff, D., Calinescu, R., Keen, J., Kelly, T., Kwiatkowska, M., ... & Paige, R.
(2012). Large-scale complex IT systems. Communications of the ACM, 55(7), 71-77.
Buy ITECH7410-Software Engineering | Formal Specification for a Library Sy Answers Online
Talk to our expert to get the help with ITECH7410-Software Engineering | Formal Specification for a Library Sy Answers to complete your assessment on time and boost your grades now
The main aim/motive of the management assignment help services is to get connect with a greater number of students, and effectively help, and support them in getting completing their assignments the students also get find this a wonderful opportunity where they could effectively learn more about their topics, as the experts also have the best team members with them in which all the members effectively support each other to get complete their diploma assignments. They complete the assessments of the students in an appropriate manner and deliver them back to the students before the due date of the assignment so that the students could timely submit this, and can score higher marks. The experts of the assignment help services at urgenthomework.com are so much skilled, capable, talented, and experienced in their field of programming homework help writing assignments, so, for this, they can effectively write the best economics assignment help services.