-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwitness.schema.json
624 lines (624 loc) · 21.7 KB
/
witness.schema.json
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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"format-version": {
"description": "Version of the format.",
"const": "0.1"
},
"producer": {
"description": "Producer. Could be a tool, a human or something else.",
"type": "object",
"required": [
"name",
"version"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the producer."
},
"version": {
"type": "string",
"description": "Version of the producer."
},
"configuration": {
"type": "string",
"description": "Configuration of the producer. Should be used to distinguish different configurations of the same version of the producer."
},
"description": {
"type": "string",
"description": "Additional description about the producer. Could be used for any information that does not fit into any of the other producer properties."
},
"command_line": {
"type": "string",
"description": "Bash-compliant command line used to produce the entry. Should be used to improve reproducibility."
}
}
},
"hash": {
"type": "string",
"description": "SHA-256 hash.",
"pattern": "[0-9a-fA-F]{64}"
},
"entry-uuid": {
"type": "string",
"description": "Unique identifier of the entry ([RFC4122](https://www.ietf.org/rfc/rfc4122.txt) defines the UUID format).",
"format": "uuid"
},
"task": {
"description": "Verification task.",
"type": "object",
"required": [
"input_files",
"input_file_hashes",
"specification",
"data_model",
"language"
],
"properties": {
"input_files": {
"description": "Files belonging to the verification task that were given as input to the producer.",
"type": "array",
"items": {
"type": "string",
"description": "Bash-compliant file name pattern, which must represent _exactly one_ file."
}
},
"input_file_hashes": {
"type": "object",
"description": "SHA-256 hashes of each file in `input_files`. Every file name pattern listed in `input_files` must appear as a key.",
"additionalProperties": {
"$ref": "#/$defs/hash"
}
},
"specification": {
"type": "string",
"description": "Specification in [SV-COMP format](https://sv-comp.sosy-lab.org/2022/rules.php) against which the verification is done."
},
"data_model": {
"description": "Data model to be assumed for the task.",
"enum": [
"ILP32",
"LP64"
]
},
"language": {
"description": "Source language of the input files.",
"type": "string",
"examples": [
"C",
"Java"
]
}
}
},
"metadata": {
"description": "Information that identifies the entry and describes the context of its production.",
"type": "object",
"required": [
"format_version",
"uuid",
"creation_time",
"producer",
"task"
],
"properties": {
"format_version": {
"$ref": "#/$defs/format-version",
"description": "Version of the format of the entry."
},
"uuid": {
"$ref": "#/$defs/entry-uuid"
},
"creation_time": {
"type": "string",
"description": "Date and time in ISO8601 format when the entry (not the file) was created.",
"format": "date-time"
},
"producer": {
"$ref": "#/$defs/producer",
"description": "Producer of the entry."
},
"task": {
"$ref": "#/$defs/task",
"description": "Verification task for which the entry was produced."
}
}
},
"metadata-certificate": {
"description": "Information that identifies the certificate entry and describes the context of its production.",
"type": "object",
"required": [
"format_version",
"uuid",
"creation_time",
"producer"
],
"properties": {
"format_version": {
"$ref": "#/$defs/format-version",
"description": "Version of the format of the certificate entry."
},
"uuid": {
"$ref": "#/$defs/entry-uuid"
},
"creation_time": {
"type": "string",
"description": "Date and time in ISO8601 format when the certificate entry (not the file or target entry) was created.",
"format": "date-time"
},
"producer": {
"$ref": "#/$defs/producer",
"description": "Producer of the certificate entry."
}
}
},
"location": {
"description": "Location in the source code.",
"type": "object",
"required": [
"file_name",
"file_hash",
"line",
"column",
"function"
],
"properties": {
"file_name": {
"type": "string",
"description": "Name of the file. Must be present in `task.input_files`."
},
"file_hash": {
"$ref": "#/$defs/hash",
"description": "SHA-256 hash of the file."
},
"line": {
"type": "integer",
"description": "Line in the file (starting with 1).",
"minimum": 1
},
"column": {
"type": "integer",
"description": "Column in the file (starting with 0). Column 0 refers to the very beginning of the line (before any characters).",
"minimum": 0
},
"function": {
"type": "string",
"description": "Name of the surrounding function."
}
}
},
"variable-identifier": {
"type": "string",
"pattern": "[_a-zA-Z][_a-zA-Z0-9]*",
"description": "A valid C identifier used as name of a variable."
},
"branching-constraint": {
"description": "Branching constraint analogous to branching waypoints in violation witnesses.",
"type": "object",
"required": [
"constraint"
],
"properties": {
"constraint": {
"type": "object",
"required": [
"value"
],
"properties": {
"value": {
"type": "boolean"
}
}
}
}
},
"invariant": {
"description": "Invariant.",
"type": "object",
"required": [
"string",
"type",
"format"
],
"properties": {
"string": {
"type": "string",
"description": "The invariant itself."
},
"type": {
"description": "Interpretation of `string`. The following values are supported:\n\n* `assertion`: Assertion, e.g. `assert(<string>)` in C, inserted at the specified location. The insertion is hypothetical and doesn't affect other locations.",
"enum": [
"assertion"
]
},
"format": {
"description": "Format of `string`. The following values are supported:\n\n* `C`: Expression in C language.",
"enum": [
"C"
]
}
}
},
"target": {
"description": "Target entry of certification.",
"type": "object",
"required": [
"uuid",
"type",
"file_hash"
],
"properties": {
"uuid": {
"$ref": "#/$defs/entry-uuid",
"description": "Unique identifier of the target entry."
},
"type": {
"type": "string",
"description": "`entry_type` of the target entry."
},
"file_hash": {
"$ref": "#/$defs/hash",
"description": "SHA-256 hash of the target file."
}
}
},
"certification": {
"description": "Certification result.",
"type": "object",
"required": [
"string",
"type",
"format"
],
"properties": {
"string": {
"type": "string",
"description": "The certification result itself."
},
"type": {
"description": "Interpretation of `string`. The following values are supported:\n\n* `verdict`: Verdict about the targeted entry.",
"enum": [
"verdict"
]
},
"format": {
"description": "Format of `string`. The following values are supported:\n\n* `confirmed | rejected`: Either \"confirmed\" or \"rejected\".",
"enum": [
"confirmed | rejected"
]
}
}
}
},
"type": "array",
"items": {
"oneOf": [
{
"title": "Loop invariant",
"description": "Loop invariants are important building blocks in software verification. Many verification approaches use loop invariants as lemmata to construct proofs of correctness.\n\nA _loop_ invariant should hold at various locations:\n1. before the loop,\n2. in the beginning of the loop body,\n3. at the end of the loop body,\n4. after the loop.",
"type": "object",
"required": [
"entry_type",
"metadata",
"location",
"loop_invariant"
],
"properties": {
"entry_type": {
"const": "loop_invariant"
},
"metadata": {
"$ref": "#/$defs/metadata"
},
"location": {
"$ref": "#/$defs/location",
"description": "Location in the source code where the loop invariant holds.\n\nAs the loop invariant has stronger semantics than a single location invariant, it does not correspond to an assertion at a single location. Therefore, this location should be such that a validator is able to associate it with a particular loop, for example, by placing the loop invariant immediately before the loop."
},
"loop_invariant": {
"$ref": "#/$defs/invariant",
"description": "The loop invariant description."
}
},
"examples": [
{
"entry_type": "loop_invariant",
"metadata": {
"format_version": 0.1,
"uuid": "91023a0f-9f45-4385-88c4-1152ade45537",
"creation_time": "2021-05-05T13:18:43.000Z",
"producer": {
"name": "CPAchecker",
"version": "2.0.1-svn",
"configuration": "svcomp21--04-kInduction"
},
"task": {
"input_files": [
"multivar_1-1.c"
],
"input_file_hashes": {
"multivar_1-1.c": "511f45a8d763ef520f6d92e4135c8572805994a66531c6216b17157d0dde2f9c"
},
"specification": "CHECK( init(main()), LTL(G ! call(reach_error())) )",
"data_model": "ILP32",
"language": "C"
}
},
"location": {
"file_name": "multivar_1-1.c",
"file_hash": "511f45a8d763ef520f6d92e4135c8572805994a66531c6216b17157d0dde2f9c",
"line": 22,
"column": 0,
"function": "main"
},
"loop_invariant": {
"string": "(x >= 1024U) && (x <= 4294967295U) && (y == x)",
"type": "assertion",
"format": "C"
}
}
]
},
{
"title": "Location invariant",
"description": "Invariant at a program location, which does not necessarily correspond to a loop.",
"type": "object",
"required": [
"entry_type",
"metadata",
"location",
"location_invariant"
],
"properties": {
"entry_type": {
"const": "location_invariant"
},
"metadata": {
"$ref": "#/$defs/metadata"
},
"location": {
"$ref": "#/$defs/location",
"description": "Location in the source code where the invariant holds."
},
"location_invariant": {
"$ref": "#/$defs/invariant",
"description": "The invariant description."
}
},
"examples": [
{
"entry_type": "location_invariant",
"metadata": {
"format_version": 0.1,
"uuid": "92c380d6-00a1-4e97-8c63-0f246206c6ab",
"creation_time": "2022-05-16T11:56:13.480Z",
"producer": {
"name": "A2Y",
"version": "1"
},
"task": {
"input_files": [
"c/loops/trex04.c"
],
"input_file_hashes": {
"c/loops/trex04.c": "f70ffe9cd45c37f44e9e780e31340fab45b6a2fb7f7ef23a2d90faf4241229d6"
},
"specification": "CHECK( init(main()), LTL(G ! call(reach_error())) )",
"data_model": "ILP32",
"language": "C"
}
},
"location": {
"file_name": "c/loops/trex04.c",
"file_hash": "f70ffe9cd45c37f44e9e780e31340fab45b6a2fb7f7ef23a2d90faf4241229d6",
"line": 47,
"column": 0,
"function": "main"
},
"location_invariant": {
"string": "x <= 0",
"type": "assertion",
"format": "C"
}
}
]
},
{
"title": "Invariant certificate",
"description": "Invariant certificates document validation attempts of various invariants, for example by trying to use the target loop invariant in a proof of correctness.\n\nCertificates document correctness and trustworthiness of invariants.",
"type": "object",
"required": [
"entry_type",
"metadata",
"target",
"certification"
],
"properties": {
"entry_type": {
"const": "invariant_certificate"
},
"metadata": {
"$ref": "#/$defs/metadata-certificate"
},
"target": {
"$ref": "#/$defs/target",
"description": "Target entry of some invariant type which is being certified."
},
"certification": {
"$ref": "#/$defs/certification",
"description": "The invariant certification result description."
}
},
"examples": [
{
"entry_type": "invariant_certificate",
"metadata": {
"format_version": 0.1,
"uuid": "954affa9-32e4-4b35-85ae-888da3a6a53b",
"creation_time": "2021-05-05T13:18:43.000Z",
"producer": {
"name": "CPAchecker",
"version": "2.0.1-svn",
"configuration": "svcomp21--04-kInduction"
}
},
"target": {
"uuid": "91023a0f-9f45-4385-88c4-1152ade45537",
"type": "loop-invariant",
"file_hash": "511f45a8d763ef520f6d92e4135c8572805994a66531c6216b17157d0dde2f9c"
},
"certification": {
"string": "confirmed",
"type": "verdict",
"format": "confirmed | rejected"
}
}
]
},
{
"title": "Ghost variable declaration",
"description": "Declares and initializes a ghost variable used in this witness. Ghost variables can be updated at specific points during the execution of the program, and may be referred to in location invariants and other witness entries, unless otherwise specified.",
"type": "object",
"required": [
"entry_type",
"metadata",
"variable",
"scope",
"type",
"initial"
],
"properties": {
"entry_type": {
"const": "ghost_variable"
},
"metadata": {
"$ref": "#/$defs/metadata"
},
"variable": {
"$ref": "#/$defs/variable-identifier",
"description": "A valid identifier used as name of the ghost variable. This identifier must be unique across the witness, and must not be used in the program."
},
"scope": {
"enum": [
"global"
],
"description": "The scope of the ghost variable. For now, only global ghost variables are supported."
},
"type": {
"type": "string",
"description": "A C type, either built-in or declared in the program."
},
"initial": {
"type": "string",
"description": "A syntactically well-formed C expression without side-effects, and without calls to functions defined in the program. The only variables allowed in this expression are the global variables of the program. The expression is evaluated after global variables declared in the program are initialized; this evaluation must not lead to undefined behaviour."
}
},
"examples": [
{
"entry_type": "ghost_variable",
"metadata": {
"format_version": 0.1,
"uuid": "ee9cc5a7-2f8d-43c2-bcac-cde6f5b6d048",
"creation_time": "2023-07-07T17:17:17.000Z",
"producer": {
"name": "Ultimate GemCutter",
"version": "0.2.3-dev"
},
"task": {
"input_files": [
"ghosts.c"
],
"input_file_hashes": {
"ghosts.c": "2b56726d10d5a52c002223c251596e534cc0842633245a85ece0f2a6f854bd14"
},
"specification": "CHECK( init(main()), LTL(G ! call(reach_error())) )",
"data_model": "ILP32",
"language": "C"
}
},
"variable": "g",
"scope": "global",
"type": "int",
"initial": "0"
}
]
},
{
"title": "Ghost variable update",
"description": "Updates the value of a ghost variable used in this witness. Ghost variables can be updated at specific points during the execution of the program, and may be referred to in location invariants and other witness entries, unless otherwise specified.",
"type": "object",
"required": [
"entry_type",
"metadata",
"variable",
"expression",
"location"
],
"properties": {
"entry_type": {
"const": "ghost_update"
},
"metadata": {
"$ref": "#/$defs/metadata"
},
"variable": {
"$ref": "#/$defs/variable-identifier",
"description": "The identifier for the updated ghost variable. This variable must be declared in an entry of type ghost_variable in the witness."
},
"expression": {
"type": "string",
"description": "A syntactically well-formed C expression without side-effects, and without calls to functions defined in the program. The expression may use any program variables that are in scope at the specified location (see below), as well as any ghost variables declared in the witness (if they are in scope). Evaluation of the expression upon reaching the location must not lead to undefined behaviour. We assume however that the evaluation is performed atomically, i.e., by assumption the evaluation does not cause a data race.",
"TODO": "Isn't a data race on a global program variable between an atomic read (in this expression) and a non-atomic write (in another thread in the program) possible?"
},
"location": {
"$ref": "#/$defs/location",
"description": "The location at which the ghost variable is updated. Specifically, the ghost update is executed when control exits the specified location. The ghost update is performed atomically together with the action exiting the location."
},
"branching": {
"$ref": "#/$defs/branching-constraint",
"description": "Optionally, the ghost update may be performed only for certain actions leaving a location rather than for all actions; for instance, only if a branch evaluates to true. The specification of the selected actions should be analogous to branching waypoints in violation witnesses."
}
},
"examples": [
{
"entry_type": "ghost_update",
"metadata": {
"format_version": 0.1,
"uuid": "dc7c0b90-d998-4920-b9a0-af8a9f058875",
"creation_time": "2023-07-07T17:17:17.000Z",
"producer": {
"name": "Ultimate GemCutter",
"version": "0.2.3-dev"
},
"task": {
"input_files": [
"ghosts.c"
],
"input_file_hashes": {
"ghosts.c": "2b56726d10d5a52c002223c251596e534cc0842633245a85ece0f2a6f854bd14"
},
"specification": "CHECK( init(main()), LTL(G ! call(reach_error())) )",
"data_model": "ILP32",
"language": "C"
}
},
"variable": "g",
"expression": "5",
"location": {
"file_name": "ghosts.c",
"file_hash": "511f45a8d763ef520f6d92e4135c8572805994a66531c6216b17157d0dde2f9c",
"line": 22,
"column": 0,
"function": "main"
},
"branching": {
"constraint": {
"value": true
}
}
}
]
}
]
}
}