Suppose I have a subprogram written using the SPARK Ada subset with postconditions verifying some property - for example, that the returned array is sorted, whose body just calls out to a function external to SPARK - for example, a C/C++ function that sorts arrays. Is there any way to force SPARK to assume, after this call, that the array will be sorted?
Can you cheat contracts / asserts in SPARK?
139 Views Asked by TamaMcGlinn At
1
There are 1 best solutions below
Related Questions in ADA
- How do you get files with extension from folder in Ada95?
- Ada Encapsulated Library Project GNAT
- Technical explanation for discrepancy in uninitialized variable in Ada?
- Ada Function Parameter as Access Type or Not
- GTK: Using an Offscreen Window to investigate the rendered dimensions of widgets
- Ada83 Constraint Error not Present in Watch Window
- Can't find GNAT GPS Dependencies Form
- Ada dynamic array allocation index range
- Ada toolchain for Windows CE
- How can I migrate an application written in DEC Ada to Windows?
- How to check if task is terminated in Ada
- Ada : String legal value?
- How to print first n lines of a variable with GDB?
- Is the Ada programming language still relevant in the military?
- Out parameter undefined
Related Questions in FORMAL-VERIFICATION
- Primitive operations in proofs
- Agda: proving that, when values are equal, their constructor arguments are equal
- Promela system with unranged values
- how to apply separation logic "lookup" rule
- C# static array bound check
- Code Contracts failing example Graph.Remove(Edge e)
- Should I use computer-aided verification tools?
- is there any tactic in Coq that can transform a bool expression to a Prop one?
- Coq error: Unable to unify "true" with "is_true (0 < a - b - 3)"
- In Yosys I am getting a Warning saying Literal has a width of 8 bit, can anyone elaborate on it
- If two constructor expressions of an inductive type are equal in Coq, can I do rewriting based on their corresponding arguments?
- Can I use destruct here given the constraint I have for index range of a list?
- How can I build a list of bytes from its specification in Coq
- How to pass Induction in SymbiYosys?
- Why this dafny post-condition is not inferred?
Related Questions in SPARK-FORMAL-VERIFICATION
- Potential aliasing violation in swap array indexes SPARK-Ada
- Do pre and post conditions take the place of in function validation?
- Proving Floor_Log2 in Spark
- Find factor of a number
- Can SPARK be used to prove that Quicksort actually sorts?
- How to use Assert and loop_invariants
- GNATprove: "postcondition might fail" in simple function
- Can you cheat contracts / asserts in SPARK?
- How to mark unreachable code in Ada/SPARK
- Spark Proof annotation
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
In short, GNATprove takes a divide-and-conquer approach when analyzing code. The following explanation is incomplete and in practice things are slightly more complicated, but for the sake of understanding, it gives a useful perspective on how things work.
For each assertion, loop invariant and pre-/post-condition GNATprove creates verification conditions (VCs) that must be proven. Verification conditions are to be proven by assumptions and the semantics of the code.
When a code section is being analyzed, and this code section starts just after a call to a subprogram, then any post-condition of that subprogram is assumed to hold.
If that particular subprogram is implemented in SPARK, then GNATprove will try to proof that the post-conditions indeed hold by analyzing the subprogram. However, if the particular subprogram is not in SPARK (e.g., the subprogram is imported), then the post-conditions will remain assumptions and it is left to the developer to prove them by other means.
A nice example that illustrates the first point can be found in sections 1 and 2 of the recently published article The Work of Proof in SPARK (available here). Note in particular how a repeated call to the
Incrementfunction is being analyzed by GNATprove.So, if you want SPARK to assume particular post-conditions to hold for a subprogram that is not in SPARK (an imported function, for example), just provide the post-conditions.