|
| 1 | +# SPARK submission |
| 2 | + |
| 3 | +## About SPARK |
| 4 | + |
| 5 | +SPARK is a subset of Ada which is amenable to formal verification. The |
| 6 | +`gnatprove` tool allows users to prove SPARK programs. |
| 7 | + |
| 8 | +## The implementation |
| 9 | + |
| 10 | +This implementation uses Ada protected types which provide synchronization for |
| 11 | +shared data. In particular, the two "entries" Enqueue and Dequeue can't be |
| 12 | +entered in a concurrent way. Those two entries also have guards, so that the |
| 13 | +entry can only be entered when the condition is true (otherwise it blocks). |
| 14 | + |
| 15 | +The Ada standard defines a so-called profile (set of restrictions) called |
| 16 | +Jorvik. One of these restrictions is that the program use a specific priority |
| 17 | +protocol. If this priority protocol is respected, [the program is |
| 18 | +deadlock-free](https://blog.adacore.com/spark-2014-rationale-support-for-ravenscar). |
| 19 | +SPARK checks that this is the case for the example program. |
| 20 | + |
| 21 | +The example program doesn't contain any tasks that would use the queue. If it |
| 22 | +did, SPARK would also verify that the tasks only communicate via the |
| 23 | +language-provided features such as protected types, and rendez-vous calls, and |
| 24 | +not via e.g. unprotected global variables. |
| 25 | + |
| 26 | +SPARK also checks that the program is free of runtime errors. This property |
| 27 | +requires a predicate on the data, mainly stating that the `Head` and `Tail` |
| 28 | +variables are always in the range of the buffer. One can't directly attach a |
| 29 | +predicate to a protected type, therefore the submission uses a separate record |
| 30 | +type which permits the definition of a predicate. |
| 31 | + |
| 32 | + |
| 33 | +## Pointers |
| 34 | + |
| 35 | +[SPARK repository](https://github.com/AdaCore/spark2014) |
| 36 | +[SPARK website](https://www.adacore.com/about-spark) |
| 37 | +[Learning SPARK](https://learn.adacore.com/courses/intro-to-spark/index.html) |
0 commit comments