Advances in artificial intelligence (AI) have accelerated in recent years, enabled by neural networks, big data and availability of GPU computing infrastructure. Early successes of deep learning in computer vision tasks led to applications such as traffic sign recognition and medical diagnosis. Later, the transformer model gave rise to Large Language Models (LLMs) trained on Internet-scale data, which can be used to write articles and generate code. More recently, AI assistants (AI models autonomously invoked and coordinated through software harness) have facilitated further progress towards automation of routine tasks. Enthusiasm for the new technology is naturally leading to AI being introduced into virtually every enterprise. However, this is not without issues: well publicised AI software failures, such as hallucinations or security breaches, not to mention the risks of online harm, make some question the readiness of this technology for deployment in safety-, security- or business-critical environments.
For AI technology to be trusted, particularly in high-stakes situations, where avoidable failure or wrong decision can lead to harm or high costs, it is essential to provide provable guarantees on the critical decisions taken autonomously by the system. For conventional software and hardware systems, this can be achieved with formal verification techniques, which aim to formally prove whether the system satisfies a given specification. Where the specification is not satisfied, these techniques provide a diagnostic counterexample (a trace to error), which can be used to repair the original system. Founded on formal logic, formal verification shares its history with the origins of AI, which in its early years was devoted to logical formalisation of mathematical reasoning.
Formal verification refers to a collection of methods for proving correctness of software systems against requirement specifications. At the foundational level, it is akin to mathematical reasoning that aims to derive proofs of theorems. However, instead of dealing with mathematical objects, grounded in formal axioms and supported by deduction rules, formal verification deals with software artefacts (programmes in some programming language or their abstract models) and their specifications. These typically express pre-conditions (assertions that must be true before the program is entered) and post-conditions (assertions guaranteed to hold upon exit). Formal verification aims to derive rigorous proofs that certain statements about the software systems are (provably) guaranteed to hold, or hold with some probability in cases where failures cannot be ruled out. This is distinct, and complementary, to testing, which can detect software errors, often quickly and with less effort, but cannot rule them out.
Automated (computer-assisted) verification comes in two main forms, model checking and theorem proving, supported by a host of associated methods incorporated within modern software development environments. Model checking is fully automatic and usually proceeds by encoding the problem and leveraging satisfiability (SAT/SMT) or mixed-integer programming (MIP) solvers, though it typically only pertains to finite (bounded) abstractions of software systems. Theorem proving, on the other hand, is able to verify correctness of statements over infinite sets by relying on logical foundations such as higher-order logic. Proof assistants are interactive software tools that facilitate the formalisation of theorems about software systems and rigorous proof development. They start with the main theorem as the goal and apply ‘tactics’ to unfold the proof tree until all subgoals are discharged.
Automated verification is now routinely employed in industrially relevant domains such as protocol and hardware engineering. Due to the relatively high cost of applying verification, its use tends to be limited to safety-critical applications, or cases where failure could be particularly costly because of product liability or the need for device recall, such as in embedded medical devices. Safety assurance is typically carried out by organisations independent of the developers with the help of certified tools. One prominent example is CompCert, a certified compiler for C proved using a proof assistant, which ensures correctness of the target machine code.
The advent of neural networks, which differ from conventional software in that they are complex, opaque real-valued functions, posed significant new challenges for formal verification. Nevertheless, beginning with1, concerted effort in the community has resulted in practical, algorithmic techniques leveraging SMT/MIP solvers to ensure provable guarantees on neural network decisions. These techniques focused on simpler neural network architectures. They aim to verify robustness to adversarial perturbations and data poisoning to guard against network instabilities. While potentially useful pre-deployment, one weakness of these approaches is that (without parallelisation) they do not scale to complex architectures, notably the transformers that underpin LLMs.
A recent development with the potential to significantly advance automated verification for AI software is the Lean system (and specifically Lean4)2, a functional programming language with dependent types and a proof assistant, supported by a substantial library of additional definitions and lemmas (MathLib). By relying on Curry-Howard isomorphism, Lean views theorem statements as types and proofs as expressions. These can then be checked in a similar way to type checking, both automatically and independently.
Similarly to other proof assistants, Lean was recently adapted to allow for AI users, as well as humans, suggesting tactics to aid proof search. A significant driving force for this development has been efforts in the AI community aimed at AI-based mathematical reasoning, which are enabled by autoformalisation (automatically translating mathematical texts into formal statements and proofs) and the development of Large Reasoning Models (LRMs). LRMs are internet-scale pre-trained base LLMs, which are then further trained on a large collection of mathematical texts and fine-tuned on step-by-step solutions to mathematical problems. When expressed in Lean, solutions output by an LRM yield proofs that are machine checkable. This has led to the emergence of AI theorem provers3, which combine neural networks that generate suggestions of tactics with symbolic reasoning in Lean that can ensure soundness.
These developments in AI for mathematics have created new opportunities for advancing automated verification for AI software, with Lean already poised to lead in this direction. This will nevertheless come with a number of research challenges. While formal verification shares logical foundations with mathematics, it is less standardised and not as well supported by teaching materials and solutions that can be used for training purposes. Rigorous software proofs have a different structure from mathematical proofs and may involve probabilistic or statistical arguments where it is necessary to consider decision uncertainty or to argue safety-critical cases. A major challenge will be tackling requirements engineering and how best to retain human involvement in the development and/or assurance process. While proofs can be machine-checked and guaranteed to be sound, to guarantee software correctness one also has to ensure the validity of the statements and that they accurately match the developer’s intent.
If these challenges can be resolved, future software development environments will routinely include tools to provide provable guarantees on the absence of semantic software errors, similarly to how compilers ensure the absence of syntax errors.
Footnotes
1 Huang X., Kwiatkowska M., Wang S. and Wu M. 2017 Safety Verification of Deep Neural Networks. CAV (1). 3–29.
2 Yang K., Poesia G., He J., Li W., Lauter K. E., Chaudhuri S. and Song D. 2026 Formal Reasoning Meets LLMs: Toward AI for Mathematics and Verification. Communications of the ACM. 69, 3, 66–73.
3 de Moura L. and Ullrich S. 2021 The Lean 4 Theorem Prover and Programming Language. CADE. 625–635.