Software Engineering basics - Formal Requirement
In Software Engineering, a formal requirement is a type of requirement that is expressed in a precise, mathematical, or formally defined language rather than natural language. These requirements are unambiguous, rigorously defined, and can be analyzed or verified using formal methods.
1. Definition
Formal Requirement:
A requirement that is specified using a formal notation or mathematical logic to remove ambiguity and allow precise verification.
2. Characteristics
-
Precise: Leaves no room for interpretation.
-
Unambiguous: Clear meaning for both humans and machines.
-
Verifiable: Can be checked or proven mathematically or through formal analysis.
-
Suitable for critical systems: Often used in safety-critical domains like aviation, medical, or nuclear software.
3. Examples
-
Mathematical Expression:
-
“For all input values x, where 0 ≤ x ≤ 100, the output y = 2x + 5.”*
-
-
Temporal Logic:
-
“Whenever the emergency button is pressed, the alarm must sound within 1 second.”
-
-
Set-based Specification:
-
“The system shall allow only registered users u ∈ Users to access the dashboard.”
-
4. Advantages
-
Eliminates ambiguity found in natural language requirements.
-
Allows formal verification and proof of correctness.
-
Reduces errors in critical systems.
5. Disadvantages
-
Requires specialized knowledge in formal methods.
-
Can be time-consuming and complex to create.
-
Not always practical for small or non-critical projects.
Summary
Formal requirements are rigorously defined requirements written in mathematical or formal notation, ensuring precision, verifiability, and lack of ambiguity, commonly used in safety-critical and high-reliability systems.