summaryrefslogtreecommitdiff
path: root/Test/dafny0/Termination.dfy
diff options
context:
space:
mode:
authorGravatar rustanleino <unknown>2009-11-20 23:04:27 +0000
committerGravatar rustanleino <unknown>2009-11-20 23:04:27 +0000
commit8c5fb20c77e73481e0ef9f5d9a5fb4b01d77aacd (patch)
tree2a209b8823071ac5dceae03c044b607616b98bf8 /Test/dafny0/Termination.dfy
parent2dfa38c856adff66a90a07a58171092af7f9186f (diff)
Added resolution and translation of algebraic datatypes and (in function bodies) match expressions.
Addressed a couple of todos, including checking the well-formedness of quantifiers and if-then-else expressions in function bodies.
Diffstat (limited to 'Test/dafny0/Termination.dfy')
-rw-r--r--Test/dafny0/Termination.dfy18
1 files changed, 18 insertions, 0 deletions
diff --git a/Test/dafny0/Termination.dfy b/Test/dafny0/Termination.dfy
index ee9d9613..39361b7b 100644
--- a/Test/dafny0/Termination.dfy
+++ b/Test/dafny0/Termination.dfy
@@ -76,4 +76,22 @@ class Termination {
}
}
}
+
+ method Q<T>(list: List<T>) {
+ var l := list;
+ while (l != #List.Nil)
+ decreases l;
+ {
+ call x, l := Traverse(l);
+ }
+ }
+
+ method Traverse<T>(a: List<T>) returns (val: T, b: List<T>);
+ requires a != #List.Nil;
+ ensures a == #List.Cons(val, b);
+}
+
+datatype List<T> {
+ Nil;
+ Cons(T, List<T>);
}