summaryrefslogtreecommitdiff
path: root/Test/dafny1
diff options
context:
space:
mode:
authorGravatar Rustan Leino <leino@microsoft.com>2011-05-30 22:01:35 -0700
committerGravatar Rustan Leino <leino@microsoft.com>2011-05-30 22:01:35 -0700
commit2730584ec8f127d950e5ee8884e8bc2a6e2d3db2 (patch)
tree0ad5c08d420cb71238542b7dc1aa218b4229aa63 /Test/dafny1
parent7b8adafdc184fd812fbb26d4d4ca4aaf5f0d134a (diff)
Dafny: Translate general LHSs for var and := (not yet for call, no compilation yet)
Diffstat (limited to 'Test/dafny1')
-rw-r--r--Test/dafny1/MatrixFun.dfy6
-rw-r--r--Test/dafny1/PriorityQueue.dfy8
2 files changed, 6 insertions, 8 deletions
diff --git a/Test/dafny1/MatrixFun.dfy b/Test/dafny1/MatrixFun.dfy
index 81b3f4c9..5c69ac50 100644
--- a/Test/dafny1/MatrixFun.dfy
+++ b/Test/dafny1/MatrixFun.dfy
@@ -24,9 +24,7 @@ method MirrorImage<T>(m: array2<T>)
invariant (forall i,j :: a+1 <= i && i < m.Length0 && 0 <= j && j < m.Length1 ==>
m[i,j] == old(m[i,j]));
{
- var tmp := m[a, m.Length1-1-b];
- m[a, m.Length1-1-b] := m[a, b];
- m[a, b] := tmp;
+ m[a, m.Length1-1-b], m[a, b] := m[a, b], m[a, m.Length1-1-b];
b := b + 1;
}
a := a + 1;
@@ -50,7 +48,7 @@ method Flip<T>(m: array2<T>)
decreases N-a, N-b;
{
if (b < N) {
- var tmp := m[a,b]; m[a,b] := m[b,a]; m[b,a] := tmp;
+ m[a,b], m[b,a] := m[b,a], m[a,b];
b := b + 1;
} else {
a := a + 1; b := a;
diff --git a/Test/dafny1/PriorityQueue.dfy b/Test/dafny1/PriorityQueue.dfy
index 6e19ab8f..49f6b909 100644
--- a/Test/dafny1/PriorityQueue.dfy
+++ b/Test/dafny1/PriorityQueue.dfy
@@ -62,7 +62,7 @@ class PriorityQueue {
if (a[i/2] <= a[i]) {
return;
}
- var tmp := a[i]; a[i] := a[i/2]; a[i/2] := tmp;
+ a[i/2], a[i] := a[i], a[i/2];
i := i / 2;
}
}
@@ -104,7 +104,7 @@ class PriorityQueue {
if (a[i] <= a[smallestChild]) {
return;
}
- var tmp := a[i]; a[i] := a[smallestChild]; a[smallestChild] := tmp;
+ a[smallestChild], a[i] := a[i], a[smallestChild];
i := smallestChild;
assert 1 <= i/2/2 ==> a[i/2/2] <= a[i];
}
@@ -175,7 +175,7 @@ class PriorityQueue_Alternative {
if (a[i/2] <= a[i]) {
return;
}
- var tmp := a[i]; a[i] := a[i/2]; a[i/2] := tmp;
+ a[i/2], a[i] := a[i], a[i/2];
i := i / 2;
}
}
@@ -213,7 +213,7 @@ class PriorityQueue_Alternative {
if (a[i] <= a[smallestChild]) {
return;
}
- var tmp := a[i]; a[i] := a[smallestChild]; a[smallestChild] := tmp;
+ a[smallestChild], a[i] := a[i], a[smallestChild];
i := smallestChild;
assert 1 <= i/2/2 ==> a[i/2/2] <= a[i];
}