These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.

Slides:



Advertisements
Similar presentations
Semantics Static semantics Dynamic semantics attribute grammars
Advertisements

ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 12b: User Interface Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall.
Introduction to Formal Methods
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Chapter 9 Describing Process Specifications and Structured Decisions
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Chapter 3 Describing Syntax and Semantics Sections 1-3.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Developed by Robert Olson Chapter 28 Formal Methods.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Chapter 3 Describing Syntax and Semantics Sections 1-3.
1 Introduction to Formal Methods Introduction to Formal Methods; Preconditions, Postconditions, and Invariants Revisited; Z language Example (Pressman)
Describing Syntax and Semantics
Chapter 18 Testing Conventional Applications
MCA –Software Engineering Kantipur City College. Topics include  Formal Methods Concept  Formal Specification Language Test plan creation Test-case.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
SEG4110 – Advanced Software Engineering and Reengineering TOPIC E Object Constraint Language (OCL)
1 These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright 2009 by Roger Pressman.
Chapter 28 Formal Methods
1 COSC 4406 Software Engineering COSC 4406 Software Engineering Haibin Zhu, Ph.D. Dept. of Computer Science and mathematics, Nipissing University, 100.
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.
Model-Based Specification CIS 376 Bruce R. Maxim UM-Dearborn.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
UNIT VI Advanced software Engineering 1. Software Quality Definition: Software Quality is conformance to 1. Explicitly stated functional and performance.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
1 OCL The Role of OCL in UML. 2 רשימת הנושאים  מבוא  מרכיבי השפה  דוגמאות  מקורות.
Copyright © 2014 Curt Hill Sets Introduction to Set Theory.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
ISBN Chapter 3 Describing Semantics.
Chapter 3 Part II Describing Syntax and Semantics.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Formal Methods in Software Engineering “And they made their lives bitter with hard bondage … all their service … was with rigour.” Ex 1:14.
Naïve Set Theory. Basic Definitions Naïve set theory is the non-axiomatic treatment of set theory. In the axiomatic treatment, which we will only allude.
CS6133 Software Specification and Verification
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
ISBN Chapter 3 Describing Syntax and Semantics.
Formal Methods in SE Software Verification Using Formal Methods By: Qaisar Javaid, Assistant Professor Formal Methods1.
Software Engineering 2 -Prakash Shrestha.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 9: Design Engineering Software Engineering: A Practitioner’s Approach, 6/e Chapter.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Requirements Engineering Methods for Requirements Engineering Lecture-31.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Interpreting the Object Constraint Presented by: Ed Kausmeyer.
Chapter 25 Formal Methods. BASIC CONCEPTS A method is formal if it has a sound mathematical basis, typically given by a formal specification language.
Copyright © 2011 Pearson Education Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall & Kendall Global Edition 9.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11b: Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Jan Pettersen Nytun, UIA, page 1. Jan Pettersen Nytun, UIA, page 2 HISTORY COLLECTION TYPES AND QUERING IN OCL FORMAL LANGUAGE - STATEMENT EXAMPLES CONSTRAINTS.
Describing Syntax and Semantics
Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
The Object Constraint Language
Software Engineering: A Practitioner’s Approach, 6/e Chapter 12 User Interface Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
Chapter 28 Formal Modeling and Verification
The Object Constraint Language
Chapter 11 Describing Process Specifications and Structured Decisions
Presentation transcript:

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Software Engineering: A Practitioner’s Approach, 6/e Chapter 28 Formal Methods Software Engineering: A Practitioner’s Approach, 6/e Chapter 28 Formal Methods copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc. For University Use Only May be reproduced ONLY for student use at the university level when used in conjunction with Software Engineering: A Practitioner's Approach. Any other reproduction or use is expressly prohibited.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Problems with Conventional Specification contradictions contradictions ambiguities ambiguities vagueness vagueness incompleteness incompleteness mixed levels of abstraction mixed levels of abstraction

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Formal Specification Desired properties—consistency, completeness, and lack of ambiguity—are the objectives of all specification methods Desired properties—consistency, completeness, and lack of ambiguity—are the objectives of all specification methods The formal syntax of a specification language (Section 28.4) enables requirements or design to be interpreted in only one way, eliminating ambiguity that often occurs when a natural language (e.g., English) or a graphical notation must be interpreted The formal syntax of a specification language (Section 28.4) enables requirements or design to be interpreted in only one way, eliminating ambiguity that often occurs when a natural language (e.g., English) or a graphical notation must be interpreted The descriptive facilities of set theory and logic notation (Section 28.2) enable clear statement of facts (requirements). The descriptive facilities of set theory and logic notation (Section 28.2) enable clear statement of facts (requirements). Consistency is ensured by mathematically proving that initial facts can be formally mapped (using inference rules) into later statements within the specification. Consistency is ensured by mathematically proving that initial facts can be formally mapped (using inference rules) into later statements within the specification.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Formal Methods Concepts data invariant—a condition that is true throughout the execution of the system that contains a collection of data data invariant—a condition that is true throughout the execution of the system that contains a collection of data state state Many formal languages, such as OCL (Section 28.5), use the notion of states as they were discussed in Chapters 7 and 8, that is, a system can be in one of several states, each representing an externally observable mode of behavior. Many formal languages, such as OCL (Section 28.5), use the notion of states as they were discussed in Chapters 7 and 8, that is, a system can be in one of several states, each representing an externally observable mode of behavior. The Z language (Section 28.6)defines a state as the stored data which a system accesses and alters The Z language (Section 28.6)defines a state as the stored data which a system accesses and alters operation—an action that takes place in a system and reads or writes data to a state operation—an action that takes place in a system and reads or writes data to a state precondition defines the circumstances in which a particular operation is valid precondition defines the circumstances in which a particular operation is valid postcondition defines what happens when an operation has completed its action postcondition defines what happens when an operation has completed its action

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, An Example—Print Spooler

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, States and Data Invariant The state of the spooler is represented by the four components Queues, OutputDevices, Limits, and Sizes. The data invariant has five components: Each output device is associated with an upper limit of print linesEach output device is associated with an upper limit of print lines Each output device is associated with a possibly nonempty queue of files awaiting printingEach output device is associated with a possibly nonempty queue of files awaiting printing Each file is associated with a sizeEach file is associated with a size Each queue associated with an output device contains files that have a size less than the upper limit of the output deviceEach queue associated with an output device contains files that have a size less than the upper limit of the output device There will be no more than MaxDevs output devices administered by the spoolerThere will be no more than MaxDevs output devices administered by the spooler

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Operations An operation which adds a new output device to the spooler together with its associated print limit An operation which adds a new output device to the spooler together with its associated print limit An operation which removes a file from the queue associated with a particular output device An operation which removes a file from the queue associated with a particular output device An operation which adds a file to the queue associated with a particular output device An operation which adds a file to the queue associated with a particular output device An operation which alters the upper limit of print lines for a particular output device An operation which alters the upper limit of print lines for a particular output device An operation which moves a file from a queue associated with an output device to another queue associated with a second output device An operation which moves a file from a queue associated with an output device to another queue associated with a second output device

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Pre- & Postconditions For the first operation (adds a new output device to the spooler together with its associated print limit): Precondition: the output device name does not already exist and that there are currently less than MaxDevs output devices known to the spooler Postcondition: the name of the new device is added to the collection of existing device names, a new entry is formed for the device with no files being associated with its queue, and the device is associated with its print limit.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Block Handler Example (Formal Specification in Natural Language) Data Invariant: Data Invariant: There will be no duplicate block numbers in the collection of used blocks. There will be no duplicate block numbers in the collection of used blocks. There will be no duplicate block numbers in the collection of unused blocks. There will be no duplicate block numbers in the collection of unused blocks. No block will be marked as both used and unused. No block will be marked as both used and unused. The collection of used and blocks that are unused will be the total collection of blocks that make up files. The collection of used and blocks that are unused will be the total collection of blocks that make up files. All the sets of blocks held in the queue will be subsets of the collection of currently used blocks. All the sets of blocks held in the queue will be subsets of the collection of currently used blocks. There will be no elements of the queue that will contain the same block numbers. There will be no elements of the queue that will contain the same block numbers.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Block Handler Example (Formal Specification in Natural Language) Example Operations: Example Operations: add() a collection of blocks to the end of the queue add() a collection of blocks to the end of the queue Precondition: the blocks to be added must be in the collection of used blocks. Precondition: the blocks to be added must be in the collection of used blocks. Postcondition: the collection of blocks is now found at the end of the queue. Postcondition: the collection of blocks is now found at the end of the queue. remove() a collection of used blocks form the front of the queue and place them in the collection of unused blocks remove() a collection of used blocks form the front of the queue and place them in the collection of unused blocks Precondition: the queue must have at least one item in it. Precondition: the queue must have at least one item in it. Postcondition: the blocks must be added to the collection of unused blocks. Postcondition: the blocks must be added to the collection of unused blocks. check() whether the queue of blocks is empty. check() whether the queue of blocks is empty. Precondition: none Precondition: none Postcondition: delivers the value true if the queue is empty and false otherwise. Postcondition: delivers the value true if the queue is empty and false otherwise.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Mathematical Concepts sets and constructive set specification sets and constructive set specification set operators set operators logic operators logic operators e.g., i, j: N i > j i 2 => j 2 e.g., i, j: N i > j i 2 => j 2 which states that, for every pair of values in the set of natural numbers, if i is greater than j, then i 2 is greater than j 2. which states that, for every pair of values in the set of natural numbers, if i is greater than j, then i 2 is greater than j 2. sequences sequences

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Sets and Constructive Specification A set is a collection of objects or elements and is used as a cornerstone of formal methods. A set is a collection of objects or elements and is used as a cornerstone of formal methods. Enumeration Enumeration {C++, Pascal, Ada, COBOL, Java} {C++, Pascal, Ada, COBOL, Java} #{C++, Pascal, Ada, COBOL, Java} implies cardinality = 5 #{C++, Pascal, Ada, COBOL, Java} implies cardinality = 5 Constructive set specification is preferable to enumeration because it enables a succinct definition of large sets. Constructive set specification is preferable to enumeration because it enables a succinct definition of large sets. {x, y : N > x + y = 10 (x, y 2 )} {x, y : N > x + y = 10 (x, y 2 )}

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Set Operators A specialized set of symbology is used to represent set and logic operations. A specialized set of symbology is used to represent set and logic operations. Examples Examples The є operator is used to indicate membership of a set. For example, the expression The є operator is used to indicate membership of a set. For example, the expression x є X x є X The operators C and C take sets as their operands. The predicate The operators C and C take sets as their operands. The predicate A C B A C B has the value true if the members of the set A are contained in the set B and has the value false otherwise. has the value true if the members of the set A are contained in the set B and has the value false otherwise. The union operator, U, takes two sets and forms a set that contains all the elements in the set with duplicates eliminated. The union operator, U, takes two sets and forms a set that contains all the elements in the set with duplicates eliminated. {File1, File2, Tax, Compiler} U {NewTax, D2, D3, File2} is the set {File1, File2, Tax, Compiler} U {NewTax, D2, D3, File2} is the set {Filel, File2, Tax, Compiler, NewTax, D2, D3} {Filel, File2, Tax, Compiler, NewTax, D2, D3}

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Logic Operators Another important component of a formal method is logic: the algebra of true and false expressions. Examples: Vor Vor ¬not ¬not =>implies Universal quantification is a way of making a statement about the elements of a set that is true for every member of the set. Universal quantification uses the symbol,. An example of its use is Universal quantification is a way of making a statement about the elements of a set that is true for every member of the set. Universal quantification uses the symbol,. An example of its use is i, j : N i > j => i 2 > j 2 i, j : N i > j => i 2 > j 2 which states that for every pair of values in the set of natural numbers, if i is greater than j, then i 2 is greater than j 2.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Sequences Sequences are designated using angle brackets. For example, the preceding sequence would normally be written as Sequences are designated using angle brackets. For example, the preceding sequence would normally be written as Catenation, n, is a binary operator that forms a sequence constructed by adding its second operand to the end of its first operand. For example, Catenation, n, is a binary operator that forms a sequence constructed by adding its second operand to the end of its first operand. For example, n = n = Other operators that can be applied to sequences are head, tail, front, and last. head = 2 head = 2 tail = tail = last = 101 last = 101 front = front =

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Formal Specification Languages A formal specification language is usually composed of three primary components: A formal specification language is usually composed of three primary components: a syntax that defines the specific notation with which the specification is represented a syntax that defines the specific notation with which the specification is represented semantics to help define a "universe of objects" [WIN90] that will be used to describe the system semantics to help define a "universe of objects" [WIN90] that will be used to describe the system a set of relations that define the rules that indicate which objects properly satisfy the specification a set of relations that define the rules that indicate which objects properly satisfy the specification The syntactic domain of a formal specification language is often based on a syntax that is derived from standard set theory notation and predicate calculus. The syntactic domain of a formal specification language is often based on a syntax that is derived from standard set theory notation and predicate calculus. The semantic domain of a specification language indicates how the language represents system requirements. The semantic domain of a specification language indicates how the language represents system requirements.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, Object Constraint Language (OCL) a formal notation developed so that users of UML can add more precision to their specifications a formal notation developed so that users of UML can add more precision to their specifications All of the power of logic and discrete mathematics is available in the language All of the power of logic and discrete mathematics is available in the language However the designers of OCL decided that only ASCII characters (rather than conventional mathematical notation) should be used in OCL statements. However the designers of OCL decided that only ASCII characters (rather than conventional mathematical notation) should be used in OCL statements.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, OCL Overview Like an object-oriented programming language, an OCL expression involves operators operating on objects. Like an object-oriented programming language, an OCL expression involves operators operating on objects. However, the result of a complete expression must always be a Boolean, i.e. true or false. However, the result of a complete expression must always be a Boolean, i.e. true or false. The objects can be instances of the OCL Collection class, of which Set and Sequence are two subclasses. The objects can be instances of the OCL Collection class, of which Set and Sequence are two subclasses. See Table 28.1 for summary of OCL notation See Table 28.1 for summary of OCL notation

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, BlockHandler using UML

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, BlockHandler in OCL No block will be marked as both unused and used. No block will be marked as both unused and used. context BlockHandler inv: context BlockHandler inv: (self.used->intersection(self.free)) ->isEmpty() (self.used->intersection(self.free)) ->isEmpty() All the sets of blocks held in the queue will be subsets of the collection of currently used blocks. All the sets of blocks held in the queue will be subsets of the collection of currently used blocks. context BlockHandler inv: context BlockHandler inv: blockQueue->forAll(aBlockSet > used->includesAll(aBlockSet )) blockQueue->forAll(aBlockSet > used->includesAll(aBlockSet )) No elements of the queue will contain the same block numbers. No elements of the queue will contain the same block numbers. context BlockHandler inv: context BlockHandler inv: blockQueue->forAll(blockSet1, blockSet2 > blockQueue->forAll(blockSet1, blockSet2 > blockSet1 <> blockSet2 implies blockSet1 <> blockSet2 implies blockSet1.elements.number->excludesAll(blockSet2.elements.number)) blockSet1.elements.number->excludesAll(blockSet2.elements.number)) The expression before implies is needed to ensure we ignore pairs where both elements are the same Block. The expression before implies is needed to ensure we ignore pairs where both elements are the same Block. The collection of used blocks and blocks that are unused will be the total collection of blocks that make up files. The collection of used blocks and blocks that are unused will be the total collection of blocks that make up files. context BlockHandler inv: context BlockHandler inv: allBlocks = used->union(free) allBlocks = used->union(free) The collection of unused blocks will have no duplicate block numbers. The collection of unused blocks will have no duplicate block numbers. context BlockHandler inv: context BlockHandler inv: free->isUnique(aBlock > aBlock.number) free->isUnique(aBlock > aBlock.number) The collection of used blocks will have no duplicate block numbers. The collection of used blocks will have no duplicate block numbers. context BlockHandler inv: context BlockHandler inv: used->isUnique(aBlock > aBlock.number)

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, The Z Language organized into schemas organized into schemas defines variables defines variables establishes relationships between variables establishes relationships between variables the analog for a “module” in conventional languages the analog for a “module” in conventional languages notation described in Table 28.2 notation described in Table 28.2