Formal Methods in SE Lecture 16 Formal Methods in SE Qaisar Javaid Assistant Professor.

Slides:



Advertisements
Similar presentations
Functions Reading: Epp Chp 7.1, 7.2, 7.4
Advertisements

1.6 Functions. Chapter 1, section 6 Functions notation: f: A B x in A, y in B, f(x) = y. concepts: –domain of f, –codomain of f, –range of f, –f maps.
Lecture 15 Functions CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
The Relational Calculus
IS698: Database Management Min Song IS NJIT. The Relational Data Model.
12 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
The Engineering Design of Systems: Models and Methods
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
Discrete Mathematics Lecture 7 Alexander Bukharovich New York University.
1 Functions Chapter 10 Formal Specification using Z.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
22 March 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
CS355 - Theory of Computation Lecture 2: Mathematical Preliminaries.
Relation, function 1 Mathematical logic Lesson 5 Relations, mappings, countable and uncountable sets.
1 Relational Algebra and Calculus Chapter 4. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.
12 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
A Brief Summary for Exam 1 Subject Topics Propositional Logic (sections 1.1, 1.2) –Propositions Statement, Truth value, Proposition, Propositional symbol,
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.
Math 3121 Abstract Algebra I Section 0: Sets. The axiomatic approach to Mathematics The notion of definition - from the text: "It is impossible to define.
April 10, 2002Applied Discrete Mathematics Week 10: Relations 1 Counting Relations Example: How many different reflexive relations can be defined on a.
Functions. Copyright © Peter Cappello2 Definition Let D and C be nonempty sets. A function f from D to C, for each element d  D, assigns exactly 1 element.
Formal Methods in SE Lecture 20. Agenda 2  Relations in Z Specification Formal Methods in SE.
INM175 Topic 7 1 Module INM175 Discrete Mathematics Topic 7 Set Theoretic Models.
CSE314 Database Systems The Relational Algebra and Relational Calculus Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
1 Annoucement n Skills you need: (1) (In Thinking) You think and move by Logic Definitions Mathematical properties (Basic algebra etc.) (2) (In Exploration)
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
1 Discrete Structures – CNS 2300 Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 1 The Foundations: Logic, Sets,
Chapter 1 SETS, FUNCTIONs, ELEMENTARY LOGIC & BOOLEAN ALGEBRAs BY: MISS FARAH ADIBAH ADNAN IMK.
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Chapter 5 – Relations and Functions. 5.1Cartesian Products and Relations Definition 5.1: For sets A, B  U, the Cartesian product, or cross product, of.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 17 A First Course in Database Systems.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Mathematical Preliminaries
Formal Methods in SE Software Verification Using Formal Methods By: Qaisar Javaid, Assistant Professor Formal Methods1.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
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.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Discrete Mathematics 3. MATRICES, RELATIONS, AND FUNCTIONS Lecture 6 Dr.-Ing. Erwin Sitompul
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Functions Goals Introduce the concept of function
CSE202 Database Management Systems
Relations, Functions, and Matrices
CSE15 Discrete Mathematics 01/23/17
Cartesian product Given two sets A, B we define their Cartesian product is the set of all the pairs whose first element is in A and second in B. Note that.
Chapter 2 Sets and Functions.
Relation and function.
The Relational Algebra and Relational Calculus
Chapter 2: Intro to Relational Model
A Brief Summary for Exam 1
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Ch 5 Functions Chapter 5: Functions
Discrete Mathematics Lecture 3: Predicate and Quantifier
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Presentation transcript:

Formal Methods in SE Lecture 16 Formal Methods in SE Qaisar Javaid Assistant Professor

Formal Methods in SE Lecture 16 Specification team. Responsible for developing and maintaining the system specification. Development team. Responsible for developing and verifying the software. The software is NOT executed or even compiled during this process. Certification team. Responsible for developing a set of statistical tests to exercise the software after development. Reliability growth models used to determine when reliability is acceptable. Cleanroom process teams

Formal Methods in SE Lecture 16 The results of using the Cleanroom process have been very impressive with few discovered faults in delivered systems. Independent assessment shows that the process is no more expensive than other approaches. There were fewer errors than in a 'traditional' development process. However, the process is not widely used. It is not clear how this approach can be transferred to an environment with less skilled or less motivated software engineers. Cleanroom process evaluation

Formal Methods in SE Lecture 16 Free and Bound Variables 4 In the expression Q x : A/B p we say that variable x is bound by the quantifier. The scope of x extends from the vertical bar (or the spot if there is no constraint) to the next closing bracket. If the variable x appears in a predicate q but is not bound by any quantifier, we say that x is free in q.

Formal Methods in SE Lecture 16 Substitution 5 We write p[t/x ] to denote the predicate that results from substituting t for each free occurrence of x in predicate p. The substitute expression t need not be another variable; it can be any expression whose possible values match those of x.

Formal Methods in SE Lecture 16 Universal Quantification 6 The universal quantifier ∀ is a generalized form of ∧.

Formal Methods in SE Lecture 16 Existential Quantification 7 The existential quantifier ∃ is a generalized form of ∨.

Formal Methods in SE Lecture 16 Universal Quantification 8

Formal Methods in SE Lecture 16 Existential Quantification 9

Formal Methods in SE Lecture 16 Equality 10 The = (equality) symbol is used to show that expressions are identical Equalities are one form of atomic propositions in our logical language (the other form is set membership).

Formal Methods in SE Lecture 16 Equality 11

Formal Methods in SE Lecture 16 If the identity of a bound variable is revealed within the quantified expression, then we may replace all instances of that variable, and remove the existential quantier. Consider following predicate. This states that there is a value of x in a for which p ^ x = t is true. If t is in the set a and p holds then we can replace x by t. One Point Rule 12

Formal Methods in SE Lecture 16 Data Structures Objects from discrete mathematics can model data structures. –Tuples (records) –Relations (tables, linked data structures) –Functions (lookup tables, trees and lists) –Sequences (lists, arrays) 13

Formal Methods in SE Lecture 16 TUPLES Tuples can resemble C structures or Pascal records. Tuples are instances of Cartesian product types. First declare types for each component. [NAME] ID == N DEPT ::= admin | manufacturing | research Define the Cartesian product type EMPLOYEE. EMPLOYEE == ID X NAME X DEPT Declare tuples which are instances of the type. 14

Formal Methods in SE Lecture 16 RELATIONS Relations are sets of tuples. They can resemble tables or databases. In Z this can be expressed 15

Formal Methods in SE Lecture 16 PAIRS The projection operators first and second extract the components of a pair. first(aki,4117) = aki second(aki, 4117) = 4117 Pairs are tuples with just two components. (aki, 4117) The maplet arrow provides alternate syntax without parentheses. 16

Formal Methods in SE Lecture 16 BINARY RELATIONS Binary relations are sets of pairs. P (NAME X PHONE) OR NAME  PHONE Binary relations can model lookup tables Binary relations are many-to- many relations NAMEPHONE Aki4019 Philip4107 Doug4107 Doug4136 Philip0113 Frank0110 Frank6190 …… 17

Formal Methods in SE Lecture 16 BINARY RELATIONS 18

Formal Methods in SE Lecture 16 RELATIONAL CALCULUS Restriction operators can model database queries. Domain restriction selects pairs based on their first component. 19

Formal Methods in SE Lecture 16 RELATIONAL CALCULUS Overriding can model database updates. 20

Formal Methods in SE Lecture 16 RELATIONAL CALCULUS Inverse reverses domain and range by exchanging the components of each pair. 21

Formal Methods in SE Lecture 16 RELATIONAL CALCULUS contd.. Composition merges two relations by combining pairs that share a matching component. 22

Formal Methods in SE Lecture 16 OPERATOR SYMBOLS Domain & Range restriction operators can also be combined 23

Formal Methods in SE Lecture 16 FUNCTIONS Functions are binary relations where each element in the domain appears just once. Each domain element is a unique key. A function cannot be a many-to-many or even one-to-many relation Function application is a special case of relational image. It associates a domain element with its unique range element. 24

Formal Methods in SE Lecture 16 Types of Functions Surjective Function A function is surjective (onto) if every element of the domain is mapped to some element of the range. some domain elements may be mapped to more than one range elements. (Total Injections) Injective Function Injections are the functions that associate each element in their domain with a different element in their range. It’s a one-to-one relation. (Partial injections) Bijective Function A function is bijective (one-to-one and onto) iff it is both injective and surjective. (Equivalently, every element of the domain is mapped to exactly one element of the range.) A bijective function is a bijection (one-to-one correspondence), and is reversible. 25

Formal Methods in SE Lecture 16 Examples 26

Formal Methods in SE Lecture 16 BINARY RELATIONS AND FUNCTIONS 27