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
Artificial Intelligence
Advertisements

© Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn 2.4 The Z Notation [Reference: M. Spivey: The Z Notation, Prentice Hall]
Formal Methods in Software Engineering
Relational Database Design Via ER Modelling
Linear Programming. Introduction: Linear Programming deals with the optimization (max. or min.) of a function of variables, known as ‘objective function’,
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
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.
CS 501: Software Engineering Fall 2000 Lecture 10 Formal Specification.
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
The Z Specification Language
1 CS 501 Spring 2003 CS 501: Software Engineering Lecture 12 Requirements IV.
Discrete Structures Chapter 1 Part B Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1.
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 --
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.
The Schema Calculus. Schemas A notation specifying both system states and operations One way: S = [ declarations | predicate ] Means: The state components.
Thirteen conditional expressions: letting programs make “decisions”
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.
Lesson 6. Refinement of the Operator Model This page describes formally how we refine Figure 2.5 into a more detailed model so that we can connect it.
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.
1 Z Schemas Chapter 6 Formal Specification using Z.
Propositional Calculus Math Foundations of Computer Science.
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.
22 March 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
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
Lecture 3 [Self Study] Relational Calculus
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.
Formal Methods in SE Lecture 20. Agenda 2  Relations in Z Specification Formal Methods in SE.
Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
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.
Duminda WijesekeraSWE 623: Fall Schemas in Z Chapter 6 in Potter Sinclair and Till.
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.
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
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.
Discrete Mathematics CS 2610 August 22, Agenda Last class Propositional logic Logical equivalences This week Predicate logic & rules of inference.
Formal Methods in SE Lecture 16 Formal Methods in SE Qaisar Javaid Assistant Professor.
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.
Albert Gatt LIN3021 Formal Semantics Lecture 3. Aims This lecture is divided into two parts: 1. We make our first attempts at formalising the notion of.
CO5023 Building Circuits from Truth Tables. Build the following… Let’s say we want a circuit which acts as described by the following truth table: We.
Of 29 lecture 15: description logic - introduction.
A Test Case Suite for Hornlog+ RuleML 1.01 A Test Case Suite for Hornlog+ RuleML 1.01 CS6795 Semantic Web Techniques Team 3: Zhenzhi Cui Radhika Yadav.
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.
Lecture 2 Compiler Design Lexical Analysis By lecturer Noor Dhia
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
ece 720 intelligent web: ontology and beyond
A Survey of Object Orientation in Z
(State) Model-Based Approaches II Software Specification Lecture 36
Department of Computer Science
Copyright © Cengage Learning. All rights reserved.
SECTION 4: OO METHODOLOGIES
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.

Constructing operations Although disjunction is the obvious operator for constructing operation schemas, conjunction can also be useful. Example Response ::= Okay | sorry

Constructing operation of purchase a seat by combining disjunction and conjunction

Schema Negation If S is a schema then negation of schema S, denoted by  S, is the schema that declares the same identifiers as S but imposes the negation of the constraint. S x :  y :  x = y 2 then  S is [ x, y :  | y 2  x ]

Schema Quantification The universal and existential can be used to build new schemas from old

Example XY a :  a, b :  a > 10a > b the expression  X  Y denotes a schema b :   a :  | a > 10  a > b

Hiding

Schema Composition If two schemas describe operations upon the same state, then we can construct an operation schema that describes the effect of one followed by the other. In a schema composition, the after state of the first operation is identified with the before state of the second. The symbol for schema composition is fat semicolon ;