Formal methods are the use of mathematical modelling for the specification, development and verification of systems in both software and electronic hardware. The formal methods are used to ensure these systems are developed without error.
The mathematical foundation underlying formal methods is used to help ensure the adequacy of the design to result in real world functionality, consistency and dependability in the end product.
Much as in other fields of engineering, formal methods applies mathematics to software and hardware engineering in order to add certainty to designing and testing of these systems. Formal methods are used to describe a systems functions prior to design with descriptive languages ensuring the functionality of the system. Formal methods may be used in development depending on the rigor with which the system is described. Formal specifications can function as a guide to requirements. In analysis, formal methods provide the description of functions by which the program can be verified.
The extent to which formal methods are implemented can vary. Sometimes, the full implementation of formal methods is deemed too costly except in the case of critically important systems and complex designs where errors can result in costly redesigns or refabrication. Often, formal methods are only used to describe the desired function and to guide development. This is considered level 0 or formal methods lite. When formal methods are additionally used to verify functions, it is considered level 1. Level 2, the highest degree of formal methods, is when the full system is machine verified through all its functions.
Some examples of systems that might be fully specified under formal methods would be complex semi-conductors such as CPUs or GPUs or critical systems in software like that which is used in SCADA for control of power plants