Skip to content

Repository files navigation

Neuro-Formal Verification

nfv-micro-bench: latest completed full 206-entry run

Read the blog: Neuro-Formal Code Review: Can Proofs Help Enforce Intent at Scale?.

Neuro-Formal Verification (NFV) is a set of techniques to answer questions about code with high empirical accuracy and proof-based verdicts (verification as well as refutation) by combining neuro-symbolic agents that translate intent, code and environment into formal models with program verifiers that reason over those models. NFV's underlying principle is to use AI agents as translators rather than arbiters of correctness, leaving proof-based reasoning to formal verifiers.

This repository provides two artefacts:

  • Paper and artifact: NFV paper and paper artifact, including the nfv-micro-bench dataset, retained results and experiment instructions.
  • Neuro-formal code reviewer: a research prototype that investigates whether a code change implements its intended behavior through (a) intent formalization, turning informal intent into checkable properties, drawing on research that uses semantic quality metrics to assess formalizations, and (b) neuro-formal verification, seeking proofs or counterexamples in translated models. Built with GitHub Agentic Workflows. See the neuro-formal code reviewer guide and setup.

As described in the paper, the NFV framework spans a spectrum from purely neural translation of intent, code and environment to combinations with language-specific symbolic code translation (such as Verus for Rust) and can target verification backends such as Dafny or Lean. Intent-formalization agents can use tests and specification-quality metrics to ground informal-to-formal intent translation. In the limit, NFV reduces to formal verification: checking a formal assertion about a closed program with no external environment in a language with a trusted logical encoding.

The code and artifacts are intended for research reproduction, authorized experimentation, and feedback on neuro-formal reasoning. The prototype neuro-formal code reviewer is not a substitute for source review, testing, or a security assessment.

See the code and dataset transparency note for intended uses, dataset provenance, evaluation, and limitations.

A checked model refutation depends on its translation and assumptions; it is not automatically a confirmed source-code bug. Failure to refute is not a proof of correctness. Verification likewise applies to the translated model under its assumptions, not automatically to the source code.

Verification backends

The PR reviewer supports Dafny (default) and Lean. Choose either during setup or through the repository variable NFV_BACKEND; the installed workflow provisions the selected verifier automatically.

Backend Verifier Proof checking
dafny (default) Dafny 4.11.0 / Z3 4.12.1 SMT-based verification
lean Lean 4.19.0 / bundled Std Kernel-checked proofs with axiom inspection

Both verify the complete property first, then try witnessed refutation on the same frozen model if verification is inconclusive. Neither silently falls back to the other or treats proof failure as correctness. See the reviewer guide for capabilities and limitations. For research reproduction with the core runner, see the paper artifact.

Citation

If you use this work, please cite the NFV paper:

@misc{lahiri2026neuroformalverification,
  title         = {Neuro-Formal Verification: Agentic Language-Agnostic Formal Program Reasoning},
  author        = {Shuvendu K. Lahiri},
  year          = {2026},
  eprint        = {2608.21516},
  archivePrefix = {arXiv},
  primaryClass  = {cs.SE},
  doi           = {10.48550/arXiv.2608.21516},
  url           = {https://arxiv.org/abs/2608.21516}
}

Contributing and support

Contributions and research feedback are welcome. See CONTRIBUTING.md for the Microsoft Contributor License Agreement, development setup, tests, and pull request guidance, and SUPPORT.md for questions and issue reporting.

This project has adopted the Microsoft Open Source Code of Conduct. See CODE_OF_CONDUCT.md for resources and contact information. Report security vulnerabilities privately using SECURITY.md, not through public GitHub issues.

See PRIVACY for data handling and telemetry opt-out instructions.

License and third-party content

Project code, including dataset reconstruction tooling, is available under the MIT license. The nfv-micro-bench dataset in paper/data is released under the CDLA-Permissive-2.0 license. Include that license when sharing the dataset. Incorporated upstream material retains its applicable licenses and attribution; CDLA does not replace them. The paper benchmark includes programs and derived data from microsoft/intent-formalization, including HumanEval problems via EvalPlus. See NOTICE.txt, dataset attribution, and the retained upstream license notices for attribution and licensing information for that content.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Releases

Packages

Used by

Contributors

Languages