Lesson 8
Lesson 8
3. Early Error Detection: Specifications can be analyzed and verified during the design
phase, helping detect errors early in the development process.
2. Mathematical Models: Formal specifications use models based on set theory, logic,
algebra, etc., to describe system behaviors.
3. Rigorous Syntax and Semantics: Formal specification languages have defined syntax
(rules for writing expressions) and semantics (rules for interpreting those expressions).
2. VDM (Vienna Development Method): Uses abstract models to define system states and
operations, focusing on data and functional correctness.
3. B-Method: Emphasizes state-based modeling and allows for refinement through
successive levels of detail.
1. State-Based Models: These define the system’s states and how operations transition the
system from one state to another.
3. Operation-Based Models: Describe system operations and their effects on states, often
used to specify functionalities.
2. Define System Model: Choose a suitable formal specification language and build an
abstract model of the system.
3. Specify Operations: Define the operations, including inputs, outputs, preconditions, and
postconditions.
4. Verify Specification: Use proof techniques or automated tools to ensure that the
specification is logically consistent and complete.
5. Refinement and Implementation: Gradually add implementation details, refining the
specification until it is executable code.
Formal Specification Techniques
1. Axiomatic Specification: Uses axioms or logical assertions to specify the properties that
operations must satisfy.
o Example: Specifying sorting with axioms that an output array must be ordered
and contain the same elements as the input.
2. Algebraic Specification: Defines operations in terms of algebraic equations that describe
relationships between operations.
3. Model-Based Specification: Focuses on specifying the system state and its changes over
time.
o Example: Z notation, where sets and relations model the state and predicate logic
describes operations.
1. State Schema:
o Define variables: books (set of books), members (set of members), loans (relation
mapping members to books).
2. Operation Schema:
o Specify the borrow operation:
3. Tool Support: Effective use of formal methods often requires specialized tools for
verification, which may have a steep learning curve.
• Critical Systems: Often used in safety-critical systems like avionics, medical devices,
and nuclear control systems where errors can have severe consequences.
• Security Applications: Used to define and verify access control and secure
communication protocols.
• Protocol Design: Useful in specifying and verifying network protocols to ensure they
work as intended in distributed environments.