Nepedia
Back to Discover
Advanced Reader
💻

Formal verification

technology Maturity 5-7 Next article →

Formal verification is a rigorous mathematical process used to prove or disprove a system's correctness. It is applied to both hardware and software systems to ensure they meet a formal specification. A specification is a precise set of properties or rules that a system must follow. Unlike standard testing, which only checks specific scenarios, formal verification uses mathematical methods to analyze the entire system. This process is a core part of formal methods and is vital in electronic design automation. By using these methods, engineers can reach the highest Evaluation Assurance Level (EAL7) for computer security certification.

To perform this work, engineers create a mathematical model of the system. They use various mathematical objects to represent how the system behaves. These objects include finite-state machines, which track different stages of a process, and Petri nets. They might also use timed automata or hybrid automata to model systems that involve time. Other methods include using process algebra or the formal semantics of programming languages. By checking a mathematical model, engineers can ensure a formal proof exists for the system's design. This allows them to verify complex things like cryptographic protocols and digital circuits with internal memory.

There are two primary approaches to this verification: model checking and deductive verification. Model checking involves a systematic and exhaustive exploration of the mathematical model. This method explores all possible states and transitions to ensure no errors exist. It can be fully automatic, which is a major advantage for engineers. However, model checking often struggles to scale to very large systems. Symbolic models are typically limited to a few hundred bits of state. Properties in model checking are often described using temporal logics, such as linear temporal logic (LTL) or computational tree logic (CTL).

Deductive verification is a different, more manual approach. This method generates mathematical proof obligations from the system and its specifications. These obligations must be "discharged," or proven true, to show the system conforms to its rules. Engineers use proof assistants, also known as interactive theorem provers, to do this. Examples of these tools include HOL, ACL2, Isabelle, PVS, and Rocq, which was previously known as Coq. They may also use automatic theorem provers, specifically satisfiability modulo theories (SMT) solvers. This approach is harder because the user must deeply understand the system to convey its logic to the computer.

In the world of software, formal verification takes several specific forms. One subarea is abstract interpretation, which helps analyze code behavior. Another is dependently typed programming, where the types of functions include their own specifications. In this method, checking the code's types also establishes its correctness. There is also program derivation, where code is produced from functional specifications through correctness-preserving steps. This is a form of program synthesis. Some techniques are considered "sound," meaning they provide a logical guarantee by covering the entire space of possibilities. Others are "unsound," meaning they only cover a subset of possibilities to provide a "good-enough" result.

History shows that the importance of these techniques grows as designs become more complex. A paper from June 27, 1983, discussed the formal verification of real-time hardware design. Today, most leading hardware companies use formal verification because hardware errors have high commercial significance. While hardware adoption is high, software industry use has been slower. However, several high-assurance operating systems have been successfully verified. These include the seL4 microkernel and the CompCert C compiler. CompCert is a verified C compiler that implements most of the ISO C standard. Other examples include the Integrity operating system and the PikeOS system.

Significant breakthroughs continue to happen in this field. In 2016, a team led by Zhong Shao at Yale University developed CertiKOS, a formally verified operating system kernel. By 2017, formal verification began to be applied to large computer networks through mathematical models. This is part of a new category called intent-based networking. Companies like Cisco use tools from vendors like Forward Networks and Veriflow Systems to manage these networks. Even automated program repair uses these ideas. It combines formal verification with program synthesis to find and fix bugs. This field remains a critical way to ensure the digital systems we rely on are truly correct.

701 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.