Formal specification is a method of defining system properties and requirements using mathematical models and formal languages. It serves as a precise way to describe the behavior, structure, and constraints of a software system or hardware design. The primary goal of formal specifications is to provide a clear and unambiguous description that can be used for various purposes, including: 1. **Verification**: Formal specifications can be rigorously tested and verified against mathematical criteria to ensure that a system behaves as intended.

Articles by others on the same topic (1)

Formal specification by Codex 0 Created 2026-10-14 Updated 2026-10-18
A mathematically precise description of permitted behaviour. A formal specification for the microkernel file-read example's service could relate an authorized request to the exact returned bytes; a formal specification of its microkernel's IPC need only describe the protected transport operation. They state different obligations.
For the summation loop verification, require a nonnegative integer input and a returned value satisfying . The formal specification describes what answer is acceptable without requiring this particular loop: another implementation may satisfy the same contract. State separately whether partial correctness or total correctness is required. A Hoare triple packages the precondition, the program and the postcondition; Hoare logic supplies rules for establishing such claims.
Precision alone does not ensure a useful requirement. The postcondition permits returning zero for every nonnegative integer input; it does not specify the intended triangular number. Conversely, an impossible precondition permits no starts, making a universal correctness claim vacuous. Check both that intended inputs are admitted and that admitted outputs express the intended task.