百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dafny

> 编程语言
开源

Dafny 是一种具有验证意识的编程语言

3.5K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Dafny 是一种具有验证意识的编程语言

Dafny

Dafny is a verification-ready programming language. As you type in your program, Dafny's verifier constantly looks over your shoulder, flags any errors, shows you counterexamples, and congratulates you when your code matches your specifications. When you're done, Dafny can compile your code to C#, Go, Python, Java, or JavaScript (more to come!), so it can integrate with your existing workflow.

Dafny will give you assurance that your code meets the specifications you write, while letting you write both code and specifications in the Dafny programming language itself. Since verification is an integral part of development, it will thus reduce the risk of costly late-stage bugs that are typically missed by testing.

Dafny has support for common programming concepts such as classes and trait inheritance, inductive datatypes that can have methods and are suitable for pattern matching, lazily unbounded datatypes, subset types e.g. for bounded integers, lambdas, and immutable and mutable data structures.

Dafny also offers an extensive toolbox for mathematical proofs, such as unbounded and bounded quantifiers, calculational proofs, pre- and post-conditions, termination conditions, loop invariants, and read/write specifications.

This GitHub site contains these materials:

  • sources
  • binary downloads for Windows, macOS, GNU/Linux, and FreeBSD
  • the issue tracker
  • the wiki, including frequently asked questions

Documentation about the Dafny language and tools is located here. A reference manual is available both online and as pdf. (A LaTeX version can be produced if needed.)

Community

Feel free to report issues here on GitHub or to ask questions on our :speech_balloon: Zulip channel.

Try Dafny

The easiest way to try out Dafny is to install Dafny on your own machine in Visual Studio Code and follow along with the Dafny tutorial. You can also download and install the Dafny CLI if you prefer to work from the command line.

Read more

Here are some ways to get started with Dafny:

  • 4-part course on the Basics of specification and verification of code:
    • Lecture 0: Pre- and postconditions (19:08)
    • Lecture 1: Invariants (20:56)
    • Lecture 2: Binary search (21:14)
    • Lecture 3: Dutch National Flag algorithm (20:33)
  • New overview article: Accessible Software Verification with Dafny, IEEE Software, Nov/Dec 2017
  • Online tutorial, focusing mostly on simple imperative programs
  • 3-page tutorial notes with examples (ICSE 2013)
  • Dafny Quick Reference
  • Language reference for the Dafny type system, which also describes available expressions for each type
  • Cheatsheet: basic Dafny syntax on two pages
  • Dafny Reference Manual [html] [pdf]
  • Dafny libraries, a standard library of useful Dafny functions and lemmas
  • Dafny Power User
  • Videos at Verification Corner
  • Blog

The language itself draws pieces of influence from:

  • Euclid (from the mindset of designing a language whose programs are to be verified),
  • Eiffel (like the built-in contract features),
  • CLU (like its iterators, and inspiration for the out-parameter syntax),
  • Java, C#, and Scala (like the classes and traits, and syntax for functions),
  • ML (like the module system, and its functions and inductive datatypes), and
  • Coq and VeriFast (like the ability to include co-inductive datatypes and being able to write inductive and co-inductive proofs).

External contributions

  • Haskell-to-Dafny translator, by Duncan White
  • Vim-loves-Dafny mode for vim, by Michael Lowell Roberts
  • Boogie-Friends Emacs mode

Contributors

Information and instructions for potential contributors are provided here.

License

Dafny itself is licensed under the MIT license. (See LICENSE.txt in the root directory for details.) The subdirectory Source/DafnyCore/Coco contains third party material; see Source/DafnyCore/Coco/LICENSE.txt for more details.

GitHub Issues· 1389 开放

在 GitHub 查看全部
  • #5640

    [PRERELEASE REGRESSION] Dafny prerelease regression from aws/aws-database-encryption-sdk-dynamodb

    更新于 2026年9月16日
  • #5486

    [PRERELEASE REGRESSION] Dafny prerelease regression from aws/aws-encryption-sdk-dafny

    breaking-change更新于 2026年9月16日
  • #6345

    Crash when named class constructor is used inside match case

    kind: bugpart: resolver更新于 2026年9月14日
  • #6523

    soundness bug 2

    kind: bug更新于 2026年9月6日
  • #6522

    soundness bug 1

    kind: bug更新于 2026年9月6日

核心特点

  • •binary downloads for Windows, macOS, GNU/Linux, and FreeBSD
  • •the issue tracker
  • •the wiki, including frequently asked questions
  • •4-part course on the _Basics of specification and verification of code_:
  • •Lecture 0: Pre- and postconditions (19:08)
  • •Lecture 1: Invariants (20:56)
  • •Lecture 2: Binary search (21:14)
  • •Lecture 3: Dutch National Flag algorithm (20:33)
  • •New overview article: Accessible Software Verification with Dafny, IEEE Software, Nov/Dec 2017
  • •Online tutorial, focusing mostly on simple imperative programs

> 标签

C#programming-languageverification

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言