Questions tagged [dafny]

Dafny is a programming language with built-in specification constructs.

Dafny is a compiled language used for functional testing of functional correctness of programs.

Home page: https://dafny.org/

485 questions
0
votes
1 answer

Dafny - Call methods inside if statements?

Like the title says I would like to call on a method that modifies some variables inside an if statement of another method, such as: method A ... { ... // Modifies some variables } method B ... { ... if(statement){ A(); } …
David S
  • 195
  • 5
  • 19
0
votes
2 answers

dafny implementation of insertionsort

i am new in Dafny and i have problems verifying my insertionSort-implementation. Dafny tells me the the multiset invariants are not holding, anything else is working fine. After Hours of searching the mistake i could need some help :) Would be nice…
jnk
  • 5
  • 4
0
votes
1 answer

How to formulate a connection between pre-execution and post-execution state of a method?

I have the following zaMap (see full code here: http://rise4fun.com/Dafny/LCaM): class zaMap { var busybits :array; var keys : array; var values : array; predicate wellformed () reads busybits, keys, values, this { …
Necto
  • 2,594
  • 1
  • 20
  • 45
-1
votes
2 answers

Error BP5005: This loop invariant might not be maintained by the loop

I am new to Dafny. I don´t understand why I get this message with the x == Sum(i); I am starting to loos my mind. And also why does it compile when if n==0 then 0 else n + Sum(n-1) is turned into if n==0 then 0 else n-1 + Sum(n-1) function Sum(n:…
-1
votes
1 answer

Dafny - Assertion violation after calling class method from Main

I'm writing up some simple code for a class which intializes baseball runs to 0. Its only method is supposed to take in the number of runs as its parameter, and return a bool based on whether the input was larger than the class variable and an int,…
Dafneloper
  • 19
  • 2
1 2 3
32
33