diff options
author | rustanleino <unknown> | 2010-10-26 01:10:24 +0000 |
---|---|---|
committer | rustanleino <unknown> | 2010-10-26 01:10:24 +0000 |
commit | 4e1353e4aa3ca7d98ccd8da25769af93e09f3cab (patch) | |
tree | 650ddcd3683761e284204d2d7a8c9636e2b83b72 /Test/dafny1/Cubes.dfy | |
parent | 60c6971cba380d8b6360e830253b49d9aa830db6 (diff) |
Boogie:
* Updated Parser.cs/Scanner.cs to use new .frame files from boogiepartners.
* It changes, for example, "syntax error:" to just "error:", so adjusted expected Test outputs.
Dafny:
* Ditto for its Parser.cs/Scanner.cs.
* Added ability to provide a custom Errors handler for scanner/parser.
* Added Test/dafny1/Cubes.dfy
Diffstat (limited to 'Test/dafny1/Cubes.dfy')
-rw-r--r-- | Test/dafny1/Cubes.dfy | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Test/dafny1/Cubes.dfy b/Test/dafny1/Cubes.dfy new file mode 100644 index 00000000..1ada79fa --- /dev/null +++ b/Test/dafny1/Cubes.dfy @@ -0,0 +1,23 @@ +method Cubes(a: array<int>)
+ requires a != null;
+ modifies a;
+ ensures (forall i :: 0 <= i && i < a.Length ==> a[i] == i*i*i);
+{
+ var n := 0;
+ var c := 0;
+ var k := 1;
+ var m := 6;
+ while (n < a.Length)
+ invariant n <= a.Length;
+ invariant (forall i :: 0 <= i && i < n ==> a[i] == i*i*i);
+ invariant c == n*n*n;
+ invariant k == 3*n*n + 3*n + 1;
+ invariant m == 6*n + 6;
+ {
+ a[n] := c;
+ c := c + k;
+ k := k + m;
+ m := m + 6;
+ n := n + 1;
+ }
+}
|