Schema Operators. State We can use the language of schemas to describe the state of a system, and operations upon it. Different aspects of the state --

Slides:



Advertisements
Similar presentations
© Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn 2.4 The Z Notation [Reference: M. Spivey: The Z Notation, Prentice Hall]
Advertisements

Formal Methods in Software Engineering
Relational Database Design Via ER Modelling
RDF Tutorial.
Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
OR Simplex method (algebraic interpretation) Add slack variables( 여유변수 ) to each constraint to convert them to equations. (We may refer it as.
CS 501: Software Engineering Fall 2000 Lecture 10 Formal Specification.
The Z Specification Language
Jan Ron McFadyen1 Use Cases in the UML Functionality under consideration is represented by use cases (named ellipses) enclosed in a box Actors.
1 CS 501 Spring 2003 CS 501: Software Engineering Lecture 12 Requirements IV.
Software Testing and Quality Assurance
1 Z Schemas Chapter 7 Formal Specification using Z Example of Z specification Document.
1 CS 501 Spring 2005 CS 501: Software Engineering Lecture 10 Requirements 4.
Encapsulation by Subprograms and Type Definitions
Promotion. Promotion is a structuring technique that may be used whenever the state of a system contains multiple, indexed instances of the same component.
The Schema Calculus. Schemas A notation specifying both system states and operations One way: S = [ declarations | predicate ] Means: The state components.
Schema Operators. State We can use the language of schemas to describe the state of a system, and operations upon it. Different aspects of the state --
September 17, 2009Theory of Computation Lecture 4: Programs and Computable Functions III 1 Macros Now we want to use macros of the form: W  f(V 1, …,
School of Technology 1 Z: Operations on Schemas David Lightfoot based on work of Andrew Simpson.
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
Chapter 12 Pointers and linked structures. 2 Introduction  The data structures that expand or contract as required during the program execution is called.
Sept Ron McFadyen1 Extend Relationship.
1 Z Schemas Chapter 6 Formal Specification using Z.
13 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
10 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Relation Decomposition A, A, … A 12n Given a relation R with attributes Create two relations R1 and R2 with attributes B, B, … B 12m C, C, … C 12l Such.
Web Database Design Session 6 and 7 Matakuliah: Web Database Tahun: 2008.
22 March 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Entity Relationship Modeling
1 Features and Unification Chapter 15 October 2012 Lecture #10.
1 Introduction to Abstract Mathematics Applications : Digital Logic Circuits 2.4 and Number Systems 2.5 Instructor: Hayk Melikya
Logic Specification and Z Schema 3K04 McMaster. Basic Logic Operators Logical negation ( ¬ ) Logical conjunction ( Λ or & ) Logical disjunction ( V or.
Analyzing the Requirements with Formal Specifications Vienna Development Method Specification Language (VDM-SL) Book: Formal Software Development From.
1 CS 501 Spring 2002 CS 501: Software Engineering Lecture 10 Techniques for Requirements Definition and Specification II.
Model-Based Specification CIS 376 Bruce R. Maxim UM-Dearborn.
Copyrighted material John Tullis 10/17/2015 page 1 04/15/00 XML Part 3 John Tullis DePaul Instructor
Computer Programming 2 Lab(1) I.Fatimah Alzahrani.
CS 320 Assignment 1 Rewriting the MISC Osystem class to support loading machine language programs at addresses other than 0 1.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
ECSE Software Engineering 1I HO 5 © HY 2012 Lecture 5 Formal Methods Isn’t this really getting old?
17 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Course: Software Engineering ©Alessandra RussoUnit 2: States and Operations, slide number 1 States and Operations This unit aims to:  Define: State schemas.
Requirements Engineering Methods for Requirements Engineering Lecture-30.
ECSE Software Engineering 1I HO 4 © HY 2012 Lecture 4 Formal Methods A Library System Specification (Continued) From Specification to Design.
Chair of Software Engineering Exercise Session 6: V & V Software Engineering Prof. Dr. Bertrand Meyer March–June 2007.
Notes on: Is Proof More Cost- Effective Than Testing? by Steve King, Jonathan Hammond, Rob Chapman, Andy Pryor Prepared by Stephen M. Thebaut, Ph.D. University.
OR Simplex method (algebraic interpretation) Add slack variables( 여유변수 ) to each constraint to convert them to equations. (We may refer it as.
Now, let’s examine the page data. We’ve already seen the page name and the directory where the page is saved.
Pointers. Variable Declarations Declarations served dual purpose –Specification of range of values and operations –Specification of Storage requirement.
1 Abstract Model Specification. 2 Explicitly describes behavior in terms of a model using well-defined types (viz. set, sequences, relations, functions)
1 Logic Our ability to state invariants, record preconditions and post- conditions, and the ability to reason about a formal model depend on the logic.
Chapter 11: Sequential File Merging, Matching, and Updating Programming Logic and Design, Third Edition Comprehensive.
Programming Languages Meeting 3 September 9/10, 2014.
1 Requirements Specification and Verification Using Z A. Rasoolzadegan July, 2009 AUT CEIT.
November 2005J. B. Wordsworth: J5DAMSDI1 Design and Method Specification, Design, Implementation.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
The Z Specification Language Based on J. M. Spivey. An Introduction to Z and formal specifications, Software Engineering Journal, 4(1):40-50, January,
Operational Semantics of Scheme
Truth Table to Statement Form
Domain Testing Functional testing which tests the application by giving inputs and evaluating its appropriate outputs. system does not accept invalid and.
Testing Tutorial 7.
Chapter 7: Entity-Relationship Model
A Survey of Object Orientation in Z
(State) Model-Based Approaches II Software Specification Lecture 36
Introduction to Database Programs
ITEC 3220A Using and Designing Database Systems
Introduction to Database Programs
SECTION 4: OO METHODOLOGIES
Chapter 6b: Database Design Using the E-R Model
CS 501: Software Engineering Fall 1999
Presentation transcript:

Schema Operators

State We can use the language of schemas to describe the state of a system, and operations upon it. Different aspects of the state -- and different aspects of a given operation -- can be described as separate schemas; these schemas may be combined in various ways using schema operators. In this way, we may factorise the description, identifying common aspects for re-use, and providing structure.

Schema operators

Same variable declared in both schemas must match the its type Otherwise the conjunction will be undefined

Schema conjunction allows specifying different aspects of a specification separately Combine them to form a complete description Adv: simple, well-structured, can be easily understood

Example From previous lecture : the schema for BoxOffice let say the theatre has premiere and standard performances. Let declared new variable of type Status to differentiate the kind of performances

Example let say we have a set friends who are currently registered as friends of the theatre. Only those customers who are friends may buy seats for the premieres If the current performance is a premiere, then seats may be sold only to friends

Example We use conjunction to describe an enhance box office It is equivalent to

Schema Inclusion Reuse the name of one schema in the declaration part of another When a schema name appears in a declaration part of a schema, the result is a merging of declarations and a conjunction of constraints.

Schema decoration

Suppose the state of a system is modelled by a schema State with two components a and b, and these are introduced under a constraint P State a : A b : B P Each object of schema type State represents a valid state : a binding of a and b in which predicate P is satisfied P forms part of state invariant for the system

Schema decoration to describe an operation upon the state; use two copies of State: one represents the state before the operation; the other represents the state afterwards. We use decoration to distinguish them State’ a’ : A b’ : B P[a’/a,b’/b]

Schema decoration We may describe an operation by including both State and State’ in the declaration part

Example The set of all valid states of box office system Each state is a binding of variable seating and sold; the state invariant insists that only allocated seats are sold, and the relationship between seats and customers remains functional

Example To describe the state of box office system after some operation Introduces seating’ and sold’ to correspond to the seat seating and the sales record after the operation has been performed.

Example Encapsulate all of the information in a single schema; schema representing the successful purchasing of seat s? by customer c?

Exercise You were given a schema named Library during the last week lecture. The schema shows state before operation. You are required to write another schema to show the state after operation. Then write another schema named LibraryState to show the merging of the schemas before and after operation

Input and Output An operation may involve inputs and outputs. These are declared in the normal way, although there is a convention regarding their names: - the name of an input should end in a question mark - the name of an output should end in an exclamation mark

Input and Output: example

s? is an input seat (name of seat); c? is the input customer (name of customer) buying s? the predicate s?  seating \ dom sold is to make sure that input seat is available for sale beforehand The predicate sold’ = sold  {s? ↦ c?}

We may add an output to our description of operation We use response from a free type of responses Response = ok | sorry And may be declared in a separate schema Success The effect of a successful purchase is Purchase 0  Success r! : Response r! = ok

exercise Use schema inclusion for schema Add_book_to_library_ok

Delta and Xi

exercise What should be in Add_book_to_library_ok now? write a schema to check if a book is already in the library by using  Library

Initialisation When using an abstract data type for a system, we should include a description of the initial state. An initialisation is a special operation for which the before state is unimportant. (does not refer to before state) Such an operation can be modelled by an operation schema that contains only a decorated copy of the state:

example Init_library Library’ books’ =  borrowers = 

Schema Disjunction If S and T are two schemas, then their disjunction S  T is a schema - whose declaration is a merge of the two declarations - whose constraint is a disjunction of the two constraints

example Schema to describe unavailable seat Schema to indicate a seat could not be sold Failure r! : Response r! = sorry

Can combine to the schemas to describe complete operation for purchase: Purchase ≙ (Purchase 0  Success)  (NotAvailable  Failure)

example For a complete schema to add a book to library is as below: Add_book_to_library ≙ Add_book_to_library_ok  Book_already_in_library

Exercise Write a complete schema to add a borrower to the library system. Please refer to the handout given to the class.