Giter Club home page Giter Club logo

dafny-training's Introduction

dafny-training

Some examples of Dafny code to support training sessions

Install Dafny/VSCode

The easiest way to get Dafny is to install the Dafny VS Code plugin.

You will also have to install dotnet-sdk 5.0 or 6.0 (brew install dotnet@6 on a Mac).

In the VS Code Dafny settings:

  • set the absolute path to dotnet (which is provided during the brew installation).
  • add the item --relax-definite-assignment to language server launch args.

Dafny CLI

You can install the Dafny 4.x latest release for your system which provides a dafny executable (the plugin installs an executuble in the .vscode/extensions folder).

Make sure you add the path to the Dafny executable to your paths.

Note

On MacOSX, if you have manually installed the Dafny 4.x release you may encounter some permission issues. Run the script provided with Dafny allow_on_mac.sh to fix this issue.

Checking your installation

Checking Plugin

  1. Fork this repository.
  2. Open the file training1.dfy in session1
  3. The Problems tab should display a couple of information (decreases and another related to triggers). If this is the case you should be all set.

Checking CLI

In a terminal, the command dafny /help should output something like:

% dafny -version
Dafny 4.xxx

You can cd to the sessions directory and try the following commands:

% dafny /dafnyVerify:1 /compile:0 /trace training1.dfy

On my computer this results in (path names may differ on your system):

Parsing training1.dfy
Coalescing blocks...
Inlining...

Running abstract interpretation...
  [0.060479 s]
[TRACE] Using prover: /Users/franck/local/dafny3.0.0/z3/bin/z3

Verifying Impl$$_module.__default.abs ...
  [0.465 s, 1 proof obligation]  verified

Verifying Impl$$_module.__default.max ...
  [0.068 s, 1 proof obligation]  verified

Verifying Impl$$_module.__default.ex1 ...
  [0.070 s, 3 proof obligations]  verified

Verifying Impl$$_module.__default.find ...
  [0.070 s, 6 proof obligations]  verified

Verifying CheckWellformed$$_module.__default.sorted ...
  [0.067 s, 2 proof obligations]  verified

Verifying Impl$$_module.__default.unique ...
  [0.064 s, 1 proof obligation]  verified

Verifying Impl$$_module.__default._default_Main ...
  [0.076 s, 6 proof obligations]  verified

Dafny program verifier finished with 7 verified, 0 errors

Dafny Reference Manual

The current versions of the Dafny Reference Manual should be available from the Dafny repo in docs.

dafny-training's People

Contributors

franck44 avatar apenzk avatar sandjohnson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.