-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor fixes and suggestions for Intro to SPARK course #581
Changes from all commits
c989353
74e0884
09f5114
ab4838a
4ec2dbf
57544df
d9bcc7f
3415f79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -542,6 +542,11 @@ the proof or strip it down to a small number of easily-reviewable | |
assumptions. For this purpose, you can add assertions to break complex | ||
proofs into smaller steps. | ||
|
||
.. todo:: | ||
|
||
This might confuse people, what is the difference between the | ||
first two assertions provided here? | ||
|
||
.. code-block:: ada | ||
|
||
pragma Assert (Assertion_Checked_By_The_Tool); | ||
|
@@ -644,10 +649,19 @@ property. | |
Ghost Procedures | ||
~~~~~~~~~~~~~~~~ | ||
|
||
.. todo:: | ||
|
||
This section still seems very abstract. Can a more concrete example be developed? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an example below of ghost procedures, can you explain why it's not sufficient? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing that is missing here for me, is the connection between the Ghost procedure and the production code. In the example presented I don't understand when I would want to use the Ghost variable I think some of the later examples (like example 3) make this link. However, as a first time reader, I found myself re-reading this particular section several times. In my opinion, the organization could be improved, by moving something like example 3 into this section. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed, this section only presents the technique of ghost procedures, not their usage. Feel free to suggest reorganisation, although we want to keep exercises at the end of each section. |
||
|
||
Ghost procedures can't affect the value of normal variables, so they're | ||
mostly used to perform operations on ghost variables or to group together a | ||
set of intermediate assertions. | ||
|
||
.. todo:: | ||
|
||
Hard to understand what this first sentence is trying to express; | ||
filip-gajowniczek-adacore marked this conversation as resolved.
Show resolved
Hide resolved
|
||
specifically the word "treatment". | ||
|
||
Abstracting away the treatment of assertions and ghost variables inside a | ||
ghost procedure has several advantages. First, you're allowed to use these | ||
variables in any way you choose in code inside ghost procedures. This | ||
|
@@ -687,6 +701,10 @@ isn't part of the functional behavior of the subprogram. Finally, it can | |
help GNATprove by abstracting away assertions that would otherwise make its | ||
job more complex. | ||
|
||
.. todo:: | ||
|
||
What is a Proof Context? I don't think this is defined anywhere. | ||
|
||
In the example below, calling :ada:`Prove_P` with :ada:`X` as an operand only | ||
adds :ada:`P (X)` to the proof context instead of the larger set of assertions | ||
required to verify it. In addition, the proof of :ada:`P` need only be done | ||
|
@@ -707,7 +725,7 @@ Handling of Loops | |
|
||
When the program involves a loop, you're almost always required to provide | ||
additional annotations to allow GNATprove to complete a proof because the | ||
verification techniques used by GNATprove doesn't handle cycles in a | ||
verification techniques used by GNATprove don't handle cycles in a | ||
subprogram's control flow. Instead, loops are flattened by dividing them | ||
into several acyclic parts. | ||
|
||
|
@@ -1036,6 +1054,10 @@ index :ada:`K` is stored at index :ada:`K-1`: | |
|
||
end Show_Map; | ||
|
||
.. todo:: | ||
|
||
Uncommenting the code did not result in successful analysis. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is proven with the same options and SPARK Community 2021 on my laptop. Probably a difference of running time, I suggest to run this example with --level=2 instead of --level=0 to avoid this issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Unfortunately, at the moment, we don't support changing the level for individual code examples — we could only change the level from 0 to 2 for all examples. |
||
|
||
You need to uncomment the second loop invariant containing the frame condition | ||
in order to prove the assertion after the loop. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is that the first assertion is proved, the second is not, see the comments in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What confuses me here is what
Assertion_Checked_By_The_Tool
and whatAssumption_Validated_By_Other_Means
are.I think these are placeholders for some sort of boolean assertion expressions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the above are just placeholders for arbitrary boolean expressions :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think examples could be useful here.
What I didn't really understand after reading this section was what kinds of expressions can be used for
Assertion_Checked_By_The_Tool
andAssumption_Validated_By_Other_Means
.I definitely acknowledge this is a complex topic which I may not have devoted enough time to, thus the reader could be the issue here as well :-P