If I run Dafny on the following code:
module Math__div_def_i {
function my_div_pos(x:int, d:int) : int
requires d > 0;
decreases if x < 0 then (d - x) else x;
{
if x < 0 then
-1 + my_div_pos(x+d, d)
else if x < d then
0
else
1 + my_div_pos(x-d, d)
}
}
it generates the following, indicating an internal translation error:
Dafny program verifier version 1.9.6.21116, Copyright (c) 2003-2015, Microsoft.
src/Dafny/Libraries/Math/test.i.dfy(4,15): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
src/Dafny/Libraries/Math/test.i.dfy(7,9): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
src/Dafny/Libraries/Math/test.i.dfy(9,14): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
src/Dafny/Libraries/Math/test.i.dfy(4,15): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
src/Dafny/Libraries/Math/test.i.dfy(7,9): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
src/Dafny/Libraries/Math/test.i.dfy(9,14): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
10 type checking errors detected in C:\Programs\cygwin64\tmp\test.i.bpl
*** Encountered internal translation error - re-running Boogie to get better debug information
C:\Programs\cygwin64\tmp\test.i.bpl(2029,21): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2030,19): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2032,21): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2033,23): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2034,25): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2071,42): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2072,19): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2074,21): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2075,23): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2076,25): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
10 type checking errors detected in C:\Programs\cygwin64\tmp\test.i.bpl
This issue may be due to the fix to issue #120.
module Math__div_def_i {
function my_div_pos(x:int, d:int) : int
requires d > 0;
decreases if x < 0 then (d - x) else x;
{
if x < 0 then
-1 + my_div_pos(x+d, d)
else if x < d then
0
else
1 + my_div_pos(x-d, d)
}
}
it generates the following, indicating an internal translation error:
Dafny program verifier version 1.9.6.21116, Copyright (c) 2003-2015, Microsoft.
src/Dafny/Libraries/Math/test.i.dfy(4,15): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
src/Dafny/Libraries/Math/test.i.dfy(7,9): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
src/Dafny/Libraries/Math/test.i.dfy(9,14): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
src/Dafny/Libraries/Math/test.i.dfy(4,15): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
src/Dafny/Libraries/Math/test.i.dfy(7,9): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
src/Dafny/Libraries/Math/test.i.dfy(9,14): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
(0,-1): Error: invalid argument type (int) to unary operator !
10 type checking errors detected in C:\Programs\cygwin64\tmp\test.i.bpl
*** Encountered internal translation error - re-running Boogie to get better debug information
C:\Programs\cygwin64\tmp\test.i.bpl(2029,21): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2030,19): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2032,21): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2033,23): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2034,25): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2071,42): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2072,19): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2074,21): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2075,23): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
C:\Programs\cygwin64\tmp\test.i.bpl(2076,25): Error: invalid type for argument 0 in application of LitInt: bool (expected: int)
10 type checking errors detected in C:\Programs\cygwin64\tmp\test.i.bpl
This issue may be due to the fix to issue #120.