dafny-lang/dafny

C#dafny.org
macOSWindows

Dafny is a verification-aware programming language

programming-languageverification
Star Growth
Stars
3.5k
Forks
326
Weekly Growth
+5
Issues
1.2k
1k2k3k
Apr 2016Sep 2019Mar 2023Sep 2026
README

Dafny

Build and Test Gitter

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.

vs-code-dafny-2 0 0-demo

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.

Dafny

This GitHub site contains these materials:

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:

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

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.

Related repositories
golang/go

The Go programming language

GoGo ModulesBSD 3-Clause "New" or "Revised" Licenseprogramming-languagelanguage
go.dev
138k19.3k
JetBrains/kotlin

The Kotlin Programming Language.

Kotlinkotlinprogramming-language
kotlinlang.org
53.4k6.4k
charlax/professional-programming

A collection of learning resources for curious software engineers

PythonPyPItutorialMIT Licenseread-articlesprogrammer
51.5k4k
JuliaLang/julia

The Julia Programming Language

JuliaMIT Licensejulia-languagejulia
julialang.org
49.1k6k
LeCoupa/awesome-cheatsheets

👩‍💻👨‍💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.

JavaScriptnpmawesomeMIT Licensecheatsheetsjavascript
lecoupa.github.io/awesome-cheatsheets/
46.4k6.7k
vlang/v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io

VMIT Licenseprogramming-languagelanguage
37.8k2.3k
carbon-language/carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)

C++Otherprogramming-languagecarbon-lang
docs.carbon-lang.dev
33.9k1.7k
modular/modular

The Modular Platform (includes MAX & Mojo)

MojoOtherailanguage
docs.modular.com
29.7k3.2k
argotorg/solidity

Solidity, the Smart Contract Programming Language

C++GNU General Public License v3.0cppethereum
soliditylang.org
25.7k6.2k
ruby/ruby

The Ruby Programming Language

RubyRubyGemsOtherrubyc
ruby-lang.org
23.7k5.6k
AlDanial/cloc

cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.

PerlGNU General Public License v2.0cloccount-lines
23.5k1.1k
gleam-lang/gleam

⭐️ A friendly language for building type-safe, scalable systems!

Rustcrates.ioApache License 2.0gleamprogramming-language
gleam.run
21.9k1k