
Dafny
Dafny is a verification-aware programming language that lets developers write specifications alongside code and uses a static verifier to check whether progr…
What Dafny is
Dafny is a verification-aware programming language that lets developers write specifications alongside code and uses a static verifier to check whether programs meet them. Its deductive proof tools include contracts such as preconditions and postconditions, along with lemmas, quantifiers, loop invariants, termination conditions, and read/write specifications. The language supports classes, iterators, arrays, tuples, generic and subset types, inductive datatypes, lambdas, and mutable or immutable data structures. Dafny can compile programs to C#, Java, JavaScript, Go, and Python, though compiling and running generated programs may require tools for the selected target. Verification uses Dafny and Z3, and the tool is a .NET 8.0 artifact. The ecosystem includes a Visual Studio Code extension with verification while typing, compilation and execution of .dfy files, syntax highlighting, verification traces, IntelliSense, navigation, and hover information. Installation guidance also covers Emacs. The project provides a formatter, language server, reference manual, tutorials, and examples. Dafny is free under the MIT License and is used in academic teaching and research as well as industry.
Good
- Free under the MIT License
- Static verifier checks programs against specifications
- Compiles to five listed languages
- Visual Studio Code extension verifies while typing
- Available for Windows, Linux, and macOS
Watch out
- Verification requires the Z3 tool
- Generated programs may need target-language tools
- Dafny is a .NET 8.0 artifact
Who it suits
Dafny may suit developers who want to verify code against explicit specifications, as well as people using it for teaching or research. It also supports industrial use and offers Visual Studio Code and Emacs guidance.
Verdict
Dafny combines a specification-oriented language with deductive verification and compiler targets for several languages. Users should account for Z3 for verification and any additional tools required to build or run generated programs.
The facts
Each one read from Dafny's own pages, with the date it was checked.
What it does
- Audience
- Dafny is used in academia for teaching and research and in industry, including by teams at Amazon.checked 5 Oct 2026
- Compilation targets
- Dafny compiles code to C#, Java, JavaScript, Go, and Python, with more targets in development.checked 5 Oct 2026
- Dependencies
- The Dafny tool is a .NET 8.0 artifact, and the Z3 tool is required to use Dafny for verification.checked 5 Oct 2026
- Desktop support
- The installation guide lists Windows, Linux, and macOS binary builds and tests Dafny on supported operating system versions.checked 5 Oct 2026
- IDE integrations
- The Dafny ecosystem includes a Visual Studio Code extension powered by a Language Server Protocol implementation, plus a code formatter.checked 5 Oct 2026
- Intended users
- The project describes Dafny as used in academia for teaching and research and in industry, including by teams at Amazon.checked 5 Oct 2026
- Known target limits
- The installation guide describes Rust support as partial and growing and C++ support as rudimentary and special-purpose.checked 5 Oct 2026
- Language features
- The language supports classes, iterators, arrays, tuples, generic and subset types, inductive datatypes, lambdas, and mutable and immutable data structures.checked 5 Oct 2026
- Learning resources
- The Dafny documentation links to a getting-started tutorial, reference manual, FAQs, error explanations, verification optimization guide, style guide, and examples.checked 5 Oct 2026
- License
- The Dafny software is licensed under the MIT License.checked 5 Oct 2026
- Other editor integration
- The installation guide describes using Dafny with Emacs as well as Visual Studio Code.checked 5 Oct 2026
- Product
- Dafny is a verification-aware programming language with native specification support and a static program verifier.checked 5 Oct 2026
- Proof features
- Its proof toolbox includes quantifiers, calculational proofs, lemmas, preconditions, postconditions, termination conditions, loop invariants, and read/write specifications.checked 5 Oct 2026
- Purpose
- It helps developers write code that can be verified against specifications to reduce the risk of late-stage bugs.checked 5 Oct 2026
- Requirements
- The Dafny tool is a .NET 8.0 artifact, and Dafny plus its bundled Z3 tool are sufficient for verification; compiling and running generated programs may require additional tools.checked 5 Oct 2026
- Security reporting
- The project asks people who discover a potential security issue to notify its security contact instead of creating a public GitHub issue.checked 5 Oct 2026
- Support
- The project directs users to its Zulip channel for questions and GitHub for issue reports.checked 5 Oct 2026
- Target requirements
- Compiling generated code requires tools for the selected target language, such as .NET for C#, Node.js for JavaScript, and Go tools for Go.checked 5 Oct 2026
- Tooling
- The Dafny ecosystem includes compilers, IDE plugins, a language server, a code formatter, a reference manual, and tutorials.checked 5 Oct 2026
- VS Code
- The VS Code extension supports compiling and running .dfy files, verification while typing, syntax highlighting, verification traces, IntelliSense, go to definition, and hover information.checked 5 Oct 2026
- VS Code features
- The VS Code extension supports verification while typing, compiling and running .dfy files, syntax highlighting, verification traces, IntelliSense, go to definition, and hover information.checked 5 Oct 2026
- What it does
- Dafny is a verification-aware programming language with native support for recording specifications and a static program verifier that checks code against them.checked 5 Oct 2026
Where it runs
- Platforms
- Installation instructions cover Windows, Linux, and macOS; the project repository also lists binary downloads for FreeBSD.checked 5 Oct 2026



