Www.wileyeurope.com/college/van lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Fundamentals of RE Chapter 4 Requirements.

Slides:



Advertisements
Similar presentations
First-Order Logic Chapter 8.
Advertisements

Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Semantics Static semantics Dynamic semantics attribute grammars
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.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Propositional Logic Russell and Norvig: Chapter 6 Chapter 7, Sections 7.1—7.4 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Logic.
lamsweerde Part 1: Introduction © 2009 John Wiley and Sons 1 Requirements Engineering From System Goals to UML Models to.
lamsweerde Part 2: Building System Models for RE © 2009 John Wiley and Sons 1 Part 2: Building System Models for RE Introduction.
Knowledge Representation Methods
ISBN Chapter 3 Describing Syntax and Semantics.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Logic. Propositional Logic Logic as a Knowledge Representation Language A Logic is a formal language, with precisely defined syntax and semantics, which.
1 Problem Solving CS 331 Dr M M Awais Representational Methods Formal Methods Propositional Logic Predicate Logic.
Knowledge Representation using First-Order Logic (Part II) Reading: Chapter 8, First lecture slides read: Second lecture slides read:
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
System behaviors: state machine diagrams
Let remember from the previous lesson what is Knowledge representation
Predicate Calculus.
Describing Syntax and Semantics
Intro to Discrete Structures
A Brief Summary for Exam 1 Subject Topics Propositional Logic (sections 1.1, 1.2) –Propositions Statement, Truth value, Proposition, Propositional symbol,
1 Introduction to Logic Programming. 2 Human Logic Humans are information processors, We acquire information about the world and use this information.
A Z Approach in Validating ORA-SS Data Models Scott Uk-Jin Lee Jing Sun Gillian Dobbie Yuan Fang Li.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
Formal Methods in Software Engineering 1
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Key Concepts Representation Inference Semantics Discourse Pragmatics Computation.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Semantics In Text: Chapter 3.
Bertram Ludäscher Department of Computer Science & Engineering University of California, San Diego CSE-291: Ontologies in Data Integration.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
CS6133 Software Specification and Verification
1 / 48 Formal a Language Theory and Describing Semantics Principles of Programming Languages 4.
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Formal Specification: a Roadmap Axel van Lamsweerde published on ICSE (International Conference on Software Engineering) Jing Ai 10/28/2003.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
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.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
1 First Order Logic CS 171/271 (Chapter 8) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
1 CSC384: Intro to Artificial Intelligence Reasoning under Uncertainty ● Reading. Chapter 13.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Artificial Intelligence Logical Agents Chapter 7.
Model Checking Early Requirements Specifications in Tropos Presented by Chin-Yi Tsai.
CENG 424-Logic for CS Introduction Based on the Lecture Notes of Konstantin Korovin, Valentin Goranko, Russel and Norvig, and Michael Genesereth.
lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Fundamentals of RE Chapter 4 Requirements.
Chapter 3: Modeling Data in the Organization
Knowledge Representation Techniques
Introduction to Logic for Artificial Intelligence Lecture 2
Logical Agents Chapter 7.
Formal Methods in software development
Formal Methods in software development
MA/CSSE 474 More Math Review Theory of Computation
Logical Agents Chapter 7.
Logics for Data and Knowledge Representation
Knowledge Representation I (Propositional Logic)
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Fundamentals of RE Chapter 4 Requirements Specification & Documentation: Formal Specification

2 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons start Chap. 2: Elicitation techniques Chap. 3: Evaluation techniques alternative options agreed requirements documented requirements consolidated requirements Chap. 4: Specification & documentationtechniques Chap.1: RE products and processes Where are we?

3 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Requirements specification & documentation: formal specification techniques  Formal specification: what, why?  Logic  Logic as a basis for formalizing statements –Propositional logic –First-order predicate logic –First-order specification languages  History-based  History-based specification –Linear temporal logic –Branching temporal logic  State-based  State-based specification –Vienna development method  Formal spec: strengths & limitations

4 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Formal Specification  A semi formal specification declares some items of the requirements document (RD) formally, but leaves the prescriptive* and descriptive** statements about the informal items.  Formal specification formalizes descriptive and prescriptive statements  The benefits expected from the formalization are:  a higher degree of precision in the formalization of statements  much more validation and verification than can be automated by tools *Prescriptive statement: A train is moving if and only if its physical speed is not-null **descriptive statement: Train tracks are in good conditionc except the track segment X under maintainance

5 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Formal specification: what, why?  To complement NL & diagrammatic specs, especially for mission-critical aspects  Full formalization of RD items... –declaration part: item structure (like diagrams). Here the variables of the interests are declared –assertion partproperties –assertion part: item properties --prescriptive, descriptive.Here the intended properties of the declared variables are formalized structuring –mechanisms for structuring large specs into small units  Formal = in machine-processable language –often based on mathematical logic –syntax, semantics, rules for inference of new information  Benefits... –higher precision in statement formulation –more precise rules of interpretation –automation of more sophisticated checks & derivations

6 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Logic as a basis for formalizing statements Like any formal system, logic is made up of three components: A syntax A semantics A proof theory

7 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons  Propositional Logic  First order predicate logic  First order specification language

8 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Propositional Logic: Syntax andornotiftheniff  Recursive composition of non-decomposable statements through logical connectives and, or, not, if... then, iff –limited expressiveness: no variables, no quantification  The syntax of propositional logic can be recursively defined by two simple rules over a vocabulary of propositional symbols(non – decomposable statements like train moving, doors closed )  Syntax rules for grammatically well-formed staments: ::= true | false | ¬ ::= | ( ¬ )  | (  ) | (  )  | (  ) | (  ) Example trainStopped  Emergency  doorsOpen 

9 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Propositional Logic: semantics  Definition of meaning of statements in some interpretation –interpretation –interpretation I for statement S assigns truth values to all their specification symbols - val I is the interptration function that assigns truth values to each atomic proposition in S –meaning –meaning VAL I of S in I: truth value T, F of S under val I  Semantic rules: VAL I (true) = T ; VAL I (false) = F ; VAL I (atomProp) = val I (atomProp) ifotherwise VAL I (¬ S) = T if VAL I (S) = F; F otherwise ifandotherwise VAL I (S1  S2) = T if VAL I (S1) = T and VAL I (S2) = T; F otherwise iforotherwise VAL I (S1  S2) = T if VAL I (S1) = T or VAL I (S2) = T; F otherwise ifForotherwise VAL I (S1  S2) = T if VAL I (S1) = F or VAL I (S2) = T; F otherwise if=otherwise VAL I (S1  S2) = T if VAL I (S1) = VAL I (S2); F otherwise 

10 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Compound Propositions

11 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Semantics of propositional logic (2)  Example of semantic evaluation: under interpretation val I (trainMoving) = F, val I (doorsClosed) = F the semantics of trainMoving  doorsClosed is: VAL I (trainMoving  doorsClosed) = T (using implication rule) 

12 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Propositional Logic: proof theory  Rules for infering new statements from available ones –sound –sound rule if conclusion is true under any interpretation that makes premise true –enables automatic derivations without semantic evaluation  Sample of inference rules: P  Q, P P  Q, Q  R P  Q,  P  R    QP  R Q  R  Example of derivation using 3rd rule (resolution): from from  trainMoving  doorsClosed, trainStopped  trainMovi ng we get we get  doorsClosed  trainStopped  premise conclusion

13 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons First-order predicate logic: syntax  Extends expressiveness of propositional logic through variables, constants, quantifications, relations & functions  Terms are used to define specific objects in the domain of interest  Syntax rules: ::= | | ( * ) ::= true | false | ( * ) ¬ ::= | ( ¬ )  | (  ) | (  )  | (  ) | (  ) (  )()(  ) () | (  )( ) | (  ) ( ) xyxy

14 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons Example: The distance between two successive trains should be kept sufficient to avoid collisions if the first train stops suddenly  tr1, tr2 > Following (tr2, tr1)  Dist (tr2, tr1) > WCS-Dist (tr2) To evaluate the statement semantically, an interpretation is required for its building blocks  The domain of interpretation for the statement is the set of trains in the system  The atomic predicate Following (tr2, tr1) is true if and only if the pair (tr2, tr1) is a member of the binary relation Following over trains, defined as the set of pairs of trains in which the first train in the pair directly follows the second.  The function symbol Dist gives the real-value function, for two given trains  The function symbol WSC-Dist gives the real-valued function for a given train returns the worst-case distance needed for the train to stop in emergency  The predicate symbol > used in infix form, shows the > binary relation over real numbers

15 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons First-order predicate logic: semantics  Interpretation  Interpretation: definition of what unquantified variables, constants, functions, predicates designate in domain of interes t –predicate specs have meaning only within specific interpretation  Documenting  Documenting interpretations is essential for communication, non-ambiguity, adequacy checking... –Domain of interest –Domain of interest e.g. trains connecting airport terminals constantsunquantified variables –For constants a, unquantified variables x: val I (a), val I (x) = specific domain elements e.g. val I (MTP) = main terminal platform function –For function symbol f: val I (f) = specific function over domain e.g. val I (WCS-Dist) = function returning the worst-case distance for the given train to stop in emergency predicate –For n-ary predicate symbol P: val I (P) = n-ary relation over domain e.g. val I (Following) = set of train pairs with 1st directly behind 2nd xyxy

16 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons First-order predicate logic: semantic rules Within specific interpretation I, semantic value VAL I is... VAL I (a) = val I (a) for constants VAL I (x) = val I (x) for unquantified variable occurrences VAL I ( f (t 1,..., t n ) ) = (val I (f )) (VAL I (t 1 ),..., VAL I (t n )) for terms VAL I (true) = T, VAL I (false) = F VAL I ( P (t 1,..., t n )) = (val I (P )) (VAL I (t 1 ),..., VAL I (t n )) for atomic predic VAL I (¬ S), VAL I (S1  S2), VAL I (S1  S2), VAL I (S1  S2), VAL I (S1  S2): cf. propositional logic if d for each VAL I ((  x) S ) = T if VAL {x  d}oI (S ) = T for each domain element d if d for some F if VAL {x  d}oI (S ) = F for some domain element d if d for some VAL I ((  x) S ) = T if VAL {x  d}oI (S ) = T for some domain element d if d for each F if VAL {x  d}oI (S ) = F for each domain element d xyxy

17 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons First-order predicate logic: proof theory Inference rules from propositional logic + specific ones, e.g. (  x) S u 1 = v 1,..., u n = v n u 1 = v 1,..., u n = v n    S [x / t] f (u 1,..., u n ) = f (v 1,..., v n ) P (u 1,..., u n )  P (v 1,..., v n ) => automated derivation/checking of more expressive statements xyxy instantiation term/predicate rewriting under equality of args

18 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons First-order specification languages  Variables  Variables designate objects involved in reqs, dom props, assumptions ( e.g. entity instances in ER diagram) –with value generally changing over time  State  State of variable x: pair (x, v) v: value  System state  System state: pair (X, V) X: set of system variables, V: set of corresponding values following100m50m e.g. train tr2 following tr1 at distance of 100m, WCS-Dist = 50m  In many spec languages, specs are interpreted over states –spec satisfied by some states, falsified by others sorted  Many first-order spec languages are sorted –typed variable designates some instance in a set : Train –e.g.  tr1, tr2: Train Following (tr2, tr1)  Dist (tr2, tr1) > WCS-Dist (tr2) xyxy sort instance variables (e.g. entity instances)

19 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons  The logic underlying many first order specification languages is in general a sorted one; that is, the variables are “typed”.  A type variable gives an instance in a specific set (called sort)  A sort can be an entity from an entity-relationship diagram or a set of data values. : Train –  tr1, tr2: Train Following (tr2, tr1)  Dist (tr2, tr1) > WCS-Dist (tr2) Tr1 and tr2 gives arbitrary instances of the train entity, the atomic predicate Following corresponds to attributes of Following and train, respectively. A state of variable tr2 might be characterized by the fact that the related train is following another train, designated by tr1, at a distance of 100 metres and with a worst-case stopping distance of 50 meters in thar state.

20 lamsweerde Chap.4: Formal Requirements Specification © 2009 John Wiley and Sons First-order specification languages (2)  Formal specification = logical “theory” = set of formal statements (“axioms”) from which new statements can be derived (“theorems”) by inference rules For example stakeholders may be shown the derived thorems, after translation into natural language, and asked whether they really want the consequences of what was specified.  More precise characterization of specification errors/flaws... –Contradiction –Contradiction: no interpretation of interest that can make all statements true together –Ambiguity –Ambiguity: multiple interpretations of interest that can make all statements true together –Redundancy –Redundancy: some statements can be inferred from others  Automated derivation of theorems is useful for... –adequacy ckecking (“do you want this consequence?”) –consistency checking (false as derivable theorem) xyxy