summaryrefslogtreecommitdiff
path: root/Test/dafny0/RankNeg.dfy
blob: 519d9063abb6f4efc4a9bd0e54458b052d29cc2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

// 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
}