Quantcast
Channel: Dafny: An Automatic Program Verifier for Functional Correctness
Viewing all articles
Browse latest Browse all 1106

Closed Unassigned: Crash with cached version of :fuel [143]

$
0
0
The following produces a crash in Dafny: Put the following program into a file:

```
function pred(i:int):int { i - 1 }

predicate f(a:int, s:int) { a <= 0 || exists s0 :: f(pred(a), s0) }

lemma Fuel2(a:int, s:int)
{
assert{:fuel f, 2, 2} f(a, s) <==> (a <= 0 || (exists s0 :: f(pred(a), s0)));
}
```

and open this file in Visual Studio. Then select the entire lemma and delete it. This causes a "Verification process error".

Here is a way to reproduce this error without using Visual Studio: Using the two attached files (it seems Codeplex only allows me to attach one file, so I'll post a follow-up to this message with the second file), invoke Dafny from the command line as follows:

```
$ dafny /compile:0 /verifySnapshots:2 Test.dfy
Dafny program verifier version 1.9.6.21116, Copyright (c) 2003-2015, Microsoft.

Dafny program verifier finished with 4 verified, 0 errors
Test.v0.dfy(3,10): Error: invalid type for argument 0 in application of $LS: LayerType (expected: LayerType)
Test.v0.dfy(3,10): Error: invalid type for argument 0 in application of $LS: LayerType (expected: LayerType)
Test.v0.dfy(3,10): Error: invalid type for argument 0 in application of $LS: LayerType (expected: LayerType)
Test.v0.dfy(3,10): Error: invalid type for argument 0 in application of $LS: LayerType (expected: LayerType)
4 type checking errors detected in C:\cygwin\tmp\Test.v1.bpl

*** Encountered internal translation error - re-running Boogie to get better debug information

C:\cygwin\tmp\Test.v1.bpl(2219,11): Error: undeclared identifier: StartFuel__module._default.f
C:\cygwin\tmp\Test.v1.bpl(2219,47): Error: undeclared identifier: BaseFuel__module._default.f
C:\cygwin\tmp\Test.v1.bpl(2220,11): Error: undeclared identifier: StartFuelAssert__module._default.f
C:\cygwin\tmp\Test.v1.bpl(2220,57): Error: undeclared identifier: BaseFuel__module._default.f
C:\cygwin\tmp\Test.v1.bpl(2369,11): Error: undeclared identifier: StartFuel__module._default.f
C:\cygwin\tmp\Test.v1.bpl(2369,47): Error: undeclared identifier: BaseFuel__module._default.f
C:\cygwin\tmp\Test.v1.bpl(2370,11): Error: undeclared identifier: StartFuelAssert__module._default.f
C:\cygwin\tmp\Test.v1.bpl(2370,57): Error: undeclared identifier: BaseFuel__module._default.f
8 name resolution errors detected in C:\cygwin\tmp\Test.v1.bpl
```

The problem seems to be that when Boogie is invoked the second time, it uses a different declaration for `LayerType`. I didn't look at the Dafny sources, but my hunch is this: The program passed to Boogie is expected to NOT already be resolved, and Boogie then resolves it before verifying it. It's possible that the new code for the enhanced `fuel` annotation in Dafny creates some Boogie expression where the type `LayerType` is not just the name `LayerType` but points to a particular type declaration of `LayerType`. In any case, when Boogie is involved the second time, it ends up with two different definitions of `LayerType` and it complains that these are two incompatible types.

Rustan

Viewing all articles
Browse latest Browse all 1106

Trending Articles