summaryrefslogtreecommitdiff
path: root/Test/dafny0/RankNeg.dfy
diff options
context:
space:
mode:
authorGravatar Unknown <namin@idea>2013-06-26 17:48:12 -0700
committerGravatar Unknown <namin@idea>2013-06-26 17:48:12 -0700
commit927a76b4b1461ac549bc12f24c7bf73f610bd4e4 (patch)
treef92d6c14e6d0ad1e17401a8dd1a822530d37eab2 /Test/dafny0/RankNeg.dfy
parent23ad17c104cc8814c2b94a608386c0535f6d0f2f (diff)
Changed ranking function for Seq, so that it's compatible with data types.
Diffstat (limited to 'Test/dafny0/RankNeg.dfy')
-rw-r--r--Test/dafny0/RankNeg.dfy31
1 files changed, 31 insertions, 0 deletions
diff --git a/Test/dafny0/RankNeg.dfy b/Test/dafny0/RankNeg.dfy
new file mode 100644
index 00000000..39e7630d
--- /dev/null
+++ b/Test/dafny0/RankNeg.dfy
@@ -0,0 +1,31 @@
+// Negative tests
+
+// Not well-founded mutual recursions.
+
+function seq_loop_i(xs: seq<int>): int
+{
+ if (xs == [1, 2]) then seq_loop_s([[1,2]])
+ else 0
+}
+function seq_loop_s(xs: seq<seq<int>>): int
+{
+ if (xs == [[1, 2]]) then seq_loop_i([1,2])
+ else 0
+}
+
+datatype wrap = X | WS(ds: seq<wrap>);
+function wrap_loop_1(xs: seq<wrap>): int
+{
+ if (xs == [WS([X,X])]) then wrap_loop_2(WS([X,X]))
+ else 0
+}
+function wrap_loop_2(xs: wrap): int
+{
+ if (xs == WS([X,X])) then wrap_loop_3([X,X])
+ else 0
+}
+function wrap_loop_3(xs: seq<wrap>): int
+{
+ if (xs == [X,X]) then wrap_loop_1([WS([X,X])])
+ else 0
+}