summaryrefslogtreecommitdiff
path: root/Test/dafny0/Answer
blob: 0c152d6ed06a9fabd3639679b699b3dffe40b0c3 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397

-------------------- Simple.dfy --------------------
// Simple.dfy

class MyClass<T, U> {
  var x: int;

  method M(s: bool, lotsaObjects: set<object>)
      returns (t: object, u: set<int>, v: seq<MyClass<bool,U>>)
    requires s;
    modifies this, lotsaObjects;
    ensures t == t;
    ensures old(null) != this;
  {
    x := 12;
    while (x < 100)
      invariant x <= 100;
    {
      x := x + 17;
      if (x % 20 == 3) {
        x := this.x + 1;
      } else {
        this.x := x + 0;
      }
      call t, u, v := M(true, lotsaObjects);
      var to: MyClass<T,U>;
      call to, u, v := M(true, lotsaObjects);
      call to, u, v := to.M(true, lotsaObjects);
      assert v[x] != null ==> null !in v[2 .. x][1..][5 := v[this.x]][..10];
    }
  }

  function F(x: int, y: int, h: WildData, k: WildData): WildData
  {
    if x < 0 then
      h
    else if x == 0 then
      if if h == k then true else false then
        h
      else if y == 0 then
        k
      else
        h
    else
      k
  }
}

datatype List<T> {
  Nil;
  Cons(T, List<T>);
}

datatype WildData {
  Something;
  JustAboutAnything<G, H>(G, myName: set<H>, int, WildData);
  More(List<int>);
}

class C {
  var w: WildData;
  var list: List<bool>;
}

Dafny program verifier finished with 0 verified, 0 errors

-------------------- TypeTests.dfy --------------------
TypeTests.dfy(4,13): Error: incorrect type of function argument 0 (expected C, got D)
TypeTests.dfy(4,13): Error: incorrect type of function argument 1 (expected D, got C)
TypeTests.dfy(5,13): Error: incorrect type of function argument 0 (expected C, got int)
TypeTests.dfy(5,13): Error: incorrect type of function argument 1 (expected D, got int)
TypeTests.dfy(11,4): Error: incorrect type of method in-parameter 0 (expected int, got bool)
TypeTests.dfy(12,4): Error: incorrect type of method out-parameter 0 (expected int, got C)
TypeTests.dfy(12,4): Error: incorrect type of method out-parameter 1 (expected C, got int)
TypeTests.dfy(20,9): Error: because of cyclic dependencies among constructor argument types, no instances of datatype 'Nothing' can be constructed
TypeTests.dfy(23,9): Error: because of cyclic dependencies among constructor argument types, no instances of datatype 'NeverendingList' can be constructed
TypeTests.dfy(55,9): Error: Assignment to array element is not allowed in this context (because this is a ghost method or because the statement is guarded by a specification-only expression)
10 resolution/type errors detected in TypeTests.dfy

-------------------- SmallTests.dfy --------------------
SmallTests.dfy(30,7): Error: RHS expression must be well defined
Execution trace:
    (0,0): anon0
SmallTests.dfy(61,36): Error: possible division by zero
Execution trace:
    (0,0): anon10_Then
SmallTests.dfy(62,51): Error: possible division by zero
Execution trace:
    (0,0): anon10_Else
    (0,0): anon3
    (0,0): anon11_Else
SmallTests.dfy(63,22): Error: target object may be null
Execution trace:
    (0,0): anon10_Then
    (0,0): anon3
    (0,0): anon11_Then
    (0,0): anon6
SmallTests.dfy(82,20): Error: decreases expression must be well defined at top of each loop iteration
Execution trace:
    (0,0): anon0
    SmallTests.dfy(81,5): anon7_LoopHead
    (0,0): anon7_LoopBody
    (0,0): anon8_Then
SmallTests.dfy(95,5): Error: call may violate caller's modifies clause
Execution trace:
    (0,0): anon0
    (0,0): anon4_Else
    (0,0): anon3
SmallTests.dfy(108,7): Error: call may violate caller's modifies clause
Execution trace:
    (0,0): anon0
    (0,0): anon3_Then
SmallTests.dfy(110,7): Error: call may violate caller's modifies clause
Execution trace:
    (0,0): anon0
    (0,0): anon3_Else
SmallTests.dfy(150,11): Error: foreach assignment may update an object not in the enclosing method's modifies clause
Execution trace:
    (0,0): anon0
    (0,0): anon4_Else
    (0,0): anon3

Dafny program verifier finished with 24 verified, 9 errors

-------------------- Definedness.dfy --------------------
Definedness.dfy(8,7): Error: possible division by zero
Execution trace:
    (0,0): anon0
Definedness.dfy(15,16): Error: possible division by zero
Execution trace:
    (0,0): anon0
Definedness.dfy(24,16): Error: target object may be null
Execution trace:
    (0,0): anon0
Definedness.dfy(25,21): Error: target object may be null
Execution trace:
    (0,0): anon0
    (0,0): anon3_Then
Definedness.dfy(26,17): Error: possible division by zero
Execution trace:
    (0,0): anon0
Definedness.dfy(33,16): Error: target object may be null
Execution trace:
    (0,0): anon0
Definedness.dfy(50,18): Error: target object may be null
Execution trace:
    (0,0): anon0
Definedness.dfy(55,18): Error: target object may be null
Execution trace:
    (0,0): anon0
Definedness.dfy(77,9): Error: LHS expression must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(78,12): Error: LHS expression must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(79,7): Error: RHS expression must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(84,18): Error: assert condition must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(85,5): Error: assume condition must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(90,16): Error: if guard must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(97,19): Error: loop guard must be well defined
Execution trace:
    (0,0): anon0
    Definedness.dfy(97,5): anon8_LoopHead
    (0,0): anon8_LoopBody
    Definedness.dfy(97,5): anon9_Else
    (0,0): anon3
Definedness.dfy(106,23): Error: decreases expression must be well defined at top of each loop iteration
Execution trace:
    (0,0): anon0
    Definedness.dfy(105,5): anon13_LoopHead
    (0,0): anon13_LoopBody
    (0,0): anon14_Then
Definedness.dfy(112,17): Error: decreases expression must be well defined at top of each loop iteration
Execution trace:
    (0,0): anon0
    Definedness.dfy(105,5): anon13_LoopHead
    (0,0): anon13_LoopBody
    Definedness.dfy(105,5): anon14_Else
    (0,0): anon3
    (0,0): anon15_Then
    (0,0): anon6
    Definedness.dfy(111,5): anon16_LoopHead
    (0,0): anon16_LoopBody
    (0,0): anon17_Then
Definedness.dfy(122,22): Error: loop invariant must be well defined
Execution trace:
    (0,0): anon0
    Definedness.dfy(121,5): anon7_LoopHead
    (0,0): anon7_LoopBody
    (0,0): anon8_Then
Definedness.dfy(122,22): Error BP5004: This loop invariant might not hold on entry.
Execution trace:
    (0,0): anon0
Definedness.dfy(123,17): Error: decreases expression must be well defined at top of each loop iteration
Execution trace:
    (0,0): anon0
    Definedness.dfy(121,5): anon7_LoopHead
    (0,0): anon7_LoopBody
    (0,0): anon8_Then
Definedness.dfy(132,24): Error: loop guard must be well defined
Execution trace:
    (0,0): anon0
    Definedness.dfy(132,5): anon7_LoopHead
    (0,0): anon7_LoopBody
    Definedness.dfy(132,5): anon8_Else
    (0,0): anon3
Definedness.dfy(151,24): Error: loop guard must be well defined
Execution trace:
    (0,0): anon0
    Definedness.dfy(145,5): anon13_LoopHead
    (0,0): anon13_LoopBody
    Definedness.dfy(145,5): anon14_Else
    (0,0): anon3
    (0,0): anon15_Then
    (0,0): anon6
    Definedness.dfy(151,5): anon16_LoopHead
    (0,0): anon16_LoopBody
    Definedness.dfy(151,5): anon17_Else
    (0,0): anon9
Definedness.dfy(172,44): Error: loop invariant must be well defined
Execution trace:
    (0,0): anon0
    Definedness.dfy(162,5): anon16_LoopHead
    (0,0): anon16_LoopBody
    Definedness.dfy(162,5): anon17_Else
    (0,0): anon3
    (0,0): anon18_Then
    (0,0): anon6
    Definedness.dfy(170,5): anon19_LoopHead
    (0,0): anon19_LoopBody
    (0,0): anon20_Then
Definedness.dfy(193,21): Error: collection expression must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(195,11): Error: foreach assignment may update an object not in the enclosing method's modifies clause
Execution trace:
    (0,0): anon0
Definedness.dfy(197,33): Error: range expression must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(203,18): Error: RHS of assignment must be well defined
Execution trace:
    (0,0): anon0
Definedness.dfy(212,23): Error: loop invariant must be well defined
Execution trace:
    (0,0): anon0
    Definedness.dfy(210,5): anon7_LoopHead
    (0,0): anon7_LoopBody
    (0,0): anon8_Then
Definedness.dfy(212,23): Error BP5004: This loop invariant might not hold on entry.
Execution trace:
    (0,0): anon0

Dafny program verifier finished with 21 verified, 29 errors

-------------------- Array.dfy --------------------
Array.dfy(10,12): Error: assignment may update an array not in the enclosing method's modifies clause
Execution trace:
    (0,0): anon0
    (0,0): anon3_Then
Array.dfy(17,9): Error: RHS expression must be well defined
Execution trace:
    (0,0): anon0
Array.dfy(24,10): Error: LHS expression must be well defined
Execution trace:
    (0,0): anon0
Array.dfy(48,20): Error: assertion violation
Execution trace:
    (0,0): anon0
Array.dfy(56,12): Error: assignment may update an array not in the enclosing method's modifies clause
Execution trace:
    (0,0): anon0
    (0,0): anon3_Then
Array.dfy(63,12): Error: assignment may update an array not in the enclosing method's modifies clause
Execution trace:
    (0,0): anon0
    (0,0): anon3_Then
Array.dfy(95,18): Error: assertion violation
Execution trace:
    (0,0): anon0
Array.dfy(107,6): Error: insufficient reads clause to read array element
Execution trace:
    (0,0): anon0
    (0,0): anon4_Then
    (0,0): anon5_Then
Array.dfy(115,6): Error: insufficient reads clause to read array element
Execution trace:
    (0,0): anon0
    (0,0): anon4_Then
    (0,0): anon5_Then
Array.dfy(131,10): Error: assignment may update an array not in the enclosing method's modifies clause
Execution trace:
    (0,0): anon0
Array.dfy(138,10): Error: assignment may update an array not in the enclosing method's modifies clause
Execution trace:
    (0,0): anon0

Dafny program verifier finished with 22 verified, 11 errors

-------------------- Modules0.dfy --------------------
Modules0.dfy(7,8): Error: Duplicate name of top-level declaration: T
Modules0.dfy(13,7): Error: module T named among imports does not exist
Modules0.dfy(24,7): Error: import graph contains a cycle: H -> I -> J -> G
Modules0.dfy(51,6): Error: inter-module calls must follow the module import relation (so module X2 must transitively import YY)
Modules0.dfy(62,6): Error: inter-module calls must follow the module import relation (so module X1 must transitively import X2)
Modules0.dfy(72,6): Error: inter-module calls must follow the module import relation (so module X0 must transitively import X1)
Modules0.dfy(91,4): Error: inter-module calls must follow the module import relation (so module _default must transitively import YY)
Modules0.dfy(116,16): Error: ghost variables are allowed only in specification contexts
8 resolution/type errors detected in Modules0.dfy

-------------------- Modules1.dfy --------------------
Modules1.dfy(55,3): Error: decreases expression must be bounded below by 0
Execution trace:
    (0,0): anon0
Modules1.dfy(61,3): Error: failure to decrease termination measure
Execution trace:
    (0,0): anon0

Dafny program verifier finished with 16 verified, 2 errors

-------------------- BadFunction.dfy --------------------
BadFunction.dfy(6,3): Error: failure to decrease termination measure
Execution trace:
    (0,0): anon0

Dafny program verifier finished with 2 verified, 1 error

-------------------- Termination.dfy --------------------

Dafny program verifier finished with 13 verified, 0 errors

-------------------- Use.dfy --------------------
Use.dfy(16,18): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(26,18): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(35,18): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(54,12): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(84,17): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(126,23): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(138,5): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(138,5): Error: assertion violation
Execution trace:
    (0,0): anon0
Use.dfy(209,19): Error: assertion violation
Execution trace:
    (0,0): anon0

Dafny program verifier finished with 39 verified, 9 errors

-------------------- DTypes.dfy --------------------
DTypes.dfy(15,14): Error: assertion violation
Execution trace:
    (0,0): anon0
DTypes.dfy(28,13): Error: assertion violation
Execution trace:
    (0,0): anon0
DTypes.dfy(54,18): Error: assertion violation
Execution trace:
    (0,0): anon0

Dafny program verifier finished with 13 verified, 3 errors

-------------------- TypeParameters.dfy --------------------
TypeParameters.dfy(41,22): Error: assertion violation
Execution trace:
    (0,0): anon0
TypeParameters.dfy(63,27): Error: assertion violation
Execution trace:
    (0,0): anon0

Dafny program verifier finished with 24 verified, 2 errors

-------------------- Datatypes.dfy --------------------

Dafny program verifier finished with 10 verified, 0 errors