Skip to content
ContentLora

    Tip: press / anywhere to search.

    Explainer

    Formal verification explained: proving software is correct

    Formal verification uses software tools to analyse every possible behaviour of a program and prove mathematically that it meets its specification. Unlike testing, it can show that whole classes of errors are absent.[1] It is used for security-critical code: verified cryptography from the HACL* library has shipped in Firefox, and the seL4 microkernel's developers say it has machine-checked proofs down to binary code.[2][3] Proofs are only as good as their specifications and assumptions, which projects such as seL4 list explicitly.[4]

    Editor reviewedUpdated Explainer16 claims · 100% primaryPost-quantum cryptography and security, Computing
    Reading level: 3 passages differ; the rest is the same for everyone.

    This explainer is a methods page in the cryptography and security course. It describes how verification works and where projects say it is used; it does not rate products. Choose a reading level in each section.

    What formal verification is

    Most software is written, reviewed and tested, and then its authors hope it is correct. Mozilla’s security team described it in those terms in 2017. It noted that popular cryptographic libraries had issued dozens of security advisories in a single year for bugs in their core code.[5]

    Formal verification takes a different approach. Developers write a precise, machine-readable description of what the program should do (the specification). Software tools then prove mathematically that the program meets it in every possible case, not just the ones that were tested.[1] NIST’s glossary defines a formal method as one that uses rigorous mathematical notation to specify, develop and verify software.[6]

    The HACL* project defines formal verification as tool-supported analysis of all possible program behaviours, with a mathematical proof that they comply with a machine-readable specification. Unlike testing, it gives guarantees that entire classes of errors are absent.[1] NIST (from CNSSI 4009) defines formal methods as specifying, developing and verifying software with a rigorous mathematically based notation and language.[6] DARPA lists the core tools as theorem provers, model checkers and specification languages. It cites advances in SAT and SMT solvers among the developments suggesting the approach is feasible.[7]

    Verified cryptography

    Cryptographic code is a natural target: Mozilla pointed to the steady stream of bugs found in widely used cryptographic libraries.[5] HACL* is a cryptographic library whose code is proved correct. It is developed by Inria Paris, Microsoft Research and Carnegie Mellon University.[8] In 2017 Mozilla said HACL*‘s verified Curve25519 code had landed in Firefox. Mozilla said it believed Firefox was the first major browser with formally verified cryptographic primitives.[2]

    HACL* is written in F* and compiled to C.[8] The project says its specifications cover memory safety, type safety, functional correctness against the NIST or IETF standard, and secret independence. Secret independence means timing and memory-access patterns do not depend on secret data.[9] The project lists production users including Firefox’s NSS, the Linux kernel, mbedTLS and WireGuard, while calling the code an ongoing research project.[10] Mozilla’s 2017 integration started with Curve25519 for Firefox 57.[2]

    Verified kernels and compilers

    seL4 is a small, open-source operating-system core (a microkernel). The seL4 Foundation says it has a mathematical proof that it behaves exactly as specified and keeps applications safely separated.[3] According to the foundation, the proof also rules out common C bugs such as buffer overflows and memory leaks.[11] Its fact sheet lists 1.3 million lines of proofs and no violations of the verified properties since the proof was finished in 2009.[12]

    Compilers, which turn source code into machine code, can introduce bugs of their own. CompCert is a C compiler whose project says it has a proof that its output does exactly what the source program says.[13]

    The seL4 Foundation describes machine-checked proofs from high-level specifications down to binary code. It says they cover properties from functional correctness to the absence of information leakage.[3] It argues that functional correctness implies the absence of whole classes of C errors.[11] The CompCert project says its compiler’s machine-checked proof shows the generated code behaves exactly as the C source prescribes, ruling out compiler-introduced bugs.[13] In March 2026 the CompCert project reported qualification for a new-generation flight computer on ATR 42/72 aircraft. It said this was the first time certification credit under DO-178C, DO-333 and DO-330 could be claimed from compiler use for critical avionics software.[14]

    Military and embedded systems

    DARPA’s HACMS programme targeted networked embedded systems, from industrial control to medical devices and vehicles, which it notes have been shown to be vulnerable to remote attack.[15] It aimed to build systems that are functionally correct and meet safety and security properties, using code generated with machine-checkable proofs. The programme is now complete.[16]

    Limits: what a proof does and does not cover

    A proof shows that code matches its specification under stated assumptions. seL4 lists its assumptions: assembly code, boot code, the machine interface, hardware and DMA. The foundation says manual scrutiny should focus there.[4] Even the HACL* developers describe their code as ongoing research.[10] Many of the strongest claims, such as seL4’s proof record and HACL*‘s deployment list, come from the projects themselves.[12][10]

    Next in the crash course

    More in Post-quantum crypto

    Developing in AI & Computing

    Questions readers ask

    What is formal verification in simple terms?

    Using mathematical proof, checked by software tools, to show that a program does what its specification says in every possible case, rather than testing a sample of cases.[1][6]

    How is formal verification different from testing?

    Testing checks the cases someone thought to try. Formal verification analyses all possible behaviours of a program and gives strong guarantees that it is free from entire classes of errors.[1][5]

    Where is formally verified software used?

    Examples include the HACL* cryptographic library, whose project lists Firefox's NSS, the Linux kernel and WireGuard among its users; the seL4 microkernel; and the CompCert C compiler, which its project says was qualified for an aircraft flight computer in 2026.[10][3][14]

    Does a proof mean the software can never fail?

    No. A proof covers the stated specification under stated assumptions. seL4's proofs, for example, assume things about assembly code, boot code, the machine interface, hardware and DMA, which need separate scrutiny.[4]

    Sources

    · 16 claims from 6 publishers

    Each numbered claim is a statement we checked against the sources listed with it. Tap a number in the text to see its sources in place.

    1. [1]

      The HACL* project describes formal verification as using software tools to analyse all possible behaviours of a program and prove mathematically that they meet its specification; unlike testing, it gives strong guarantees that whole classes of errors are absent. confirmedas of 2026-11-22

    2. [2]

      In September 2017 Mozilla said a formally verified Curve25519 implementation from HACL* had landed in Firefox Nightly for the Firefox 57 release, and said it believed Firefox was the first major browser with formally verified cryptographic primitives. reportedas of 2026-11-22

    3. [3]

      The seL4 Foundation says seL4, an open-source operating-system microkernel, has a formal mathematical proof that it behaves exactly as specified and enforces strong security boundaries, with machine-checked proofs running from high-level specifications down to binary code for properties ranging from functional correctness to the absence of information leakage. reportedas of 2026-11-22

    4. [4]

      The seL4 proofs rest on stated assumptions about assembly code, boot code, the machine interface, hardware and DMA, which the foundation says is where manual scrutiny can focus. reportedas of 2026-11-22

    5. [5]

      Mozilla's security team wrote in 2017 that software is traditionally written, reviewed and unit-tested and then hoped to be correct, and that popular cryptographic libraries had issued dozens of CVEs in a year for bugs in core primitives. confirmedas of 2026-11-22

    6. [6]

      NIST's glossary defines a formal method as a software engineering method that specifies, develops and verifies software using a rigorous mathematically based notation and language. confirmedas of 2026-11-22

    7. [7]

      DARPA lists the key HACMS technologies as interactive software synthesis, verification tools such as theorem provers and model checkers, and specification languages, citing advances in SAT and SMT solvers. confirmedas of 2026-11-22

    8. [8]

      HACL* is a formally verified cryptographic library written in the F* language and compiled to C, developed by Inria Paris, Microsoft Research and Carnegie Mellon University. confirmedas of 2026-11-22

    9. [9]

      HACL*'s specifications cover memory safety, type safety, functional correctness against the official standards, and secret independence, meaning timing and memory-access patterns do not depend on secrets. reportedas of 2026-11-22

    10. [10]

      The HACL* project says its verified code is deployed in production systems including Firefox's NSS, the Linux kernel, mbedTLS and the WireGuard VPN, while noting it remains an ongoing research project. reportedas of 2026-11-22

    11. [11]

      According to the seL4 Foundation, proving functional correctness also rules out whole classes of common C programming errors, such as buffer overflows and memory leaks. reportedas of 2026-11-22

    12. [12]

      The seL4 fact sheet lists 1.3 million lines of proofs and no violations of verified properties since the proof was completed in 2009. reportedas of 2026-11-22

      • seL4 Fact Sheet · seL4 Foundation · Primary source · Verification (retrieved 2026-11-22)
      • seL4 Fact Sheet · seL4 Foundation · Primary source · Verification (retrieved 2026-11-22)
    13. [13]

      The CompCert project describes CompCert as a C compiler with a machine-checked proof that the code it generates behaves exactly as the source program's semantics prescribe, ruling out compiler-introduced bugs. reportedas of 2026-11-22

    14. [14]

      The CompCert project reported in March 2026 that the compiler had been qualified for a new-generation flight computer on ATR 42/72 aircraft, the first time certification credit under DO-178C, DO-333 and DO-330 could be claimed from compiler use for critical avionics software. reportedas of 2026-11-22

    15. [15]

      DARPA notes that networked embedded systems, from SCADA systems to medical devices and vehicles, have been shown to be vulnerable to remote attack. confirmedas of 2026-11-22

    16. [16]

      DARPA's HACMS programme aimed to build high-assurance cyber-physical systems, defined as functionally correct and meeting safety and security properties, using formal methods and machine-checkable proofs; the programme is now complete. confirmedas of 2026-11-22

    Revision history (1)
    1. Page created.

    Created Nov 22, 2026. Last reviewed by an editor on Nov 22, 2026. Next scheduled review: Jun 21, 2027.

    Cite this page

    "Formal verification explained: proving software is correct." ContentLora, updated Nov 22, 2026. https://contentlora.com/explain/formal-verification-explained

    Spotted an error? Suggest a correction or emailcorrections@contentlora.com.