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?
143 Views Asked by TamaMcGlinn At
1
There are 1 best solutions below
Related Questions in ADA
- How to properly handle byte buffers from C to Ada?
- ADA problem with value by reference or post conditions
- Order of evaluation in assignment statements
- Why Ada attribute 'value in this snippet doesn't raise Data_Error but Constraint_Error instead?
- How to write Recursive GCD program in Ada?
- Ada Calendar Arithmetic Difference 0 day between March 27 and March 28 2011
- Access constant as subtype of general access type
- How to conveniently parse a very specific chunk of a plaintext file in Ada?
- STORAGE_ERROR on assignment to array element
- Howto Re-Index an String in Ada?
- How to add < and > check in case ... when?
- How can I have more information in a Predicate_Failure?
- Tasking support in CortexM4-based board
- Receiving a `r' Fatal Error when trying to build basic Ada code
- MSYS2 - mingw64 Installing a package
Related Questions in FORMAL-VERIFICATION
- Formal verification of state machine with SymbiYosys not giving expected results
- Quintic Number Number Counting Hash Function
- (SV DPI-C/C)How to manipulate an svOpenArrayHandle in C?
- How can I write this SystemVerilog property without the use of a local variable?
- Termination for Wrapped `Fin n` in Lean4
- LinkedIn Posting API verification
- Dafny issue modifying array member of class
- How to make Spoq generate high-level specifications in Coq (not just AST) for the functions in LLVM IR
- Visualize the verification conditions in Dafny
- FileNotFoundError: [Errno 2] No such file or directory: 'output/...txt
- How to verify C functions with array parameters using Isabelle
- how to model and verify model
- Use NuXMV to calculate exponentiation
- `agda`: how to specify that a step in equational reasoning is by definition of a function?
- Do I need to install Zchaff before using NuXMV to do verification by BMC
Related Questions in SPARK-FORMAL-VERIFICATION
- How to mark unreachable code in Ada/SPARK
- Can you cheat contracts / asserts in SPARK?
- Do pre and post conditions take the place of in function validation?
- Can SPARK be used to prove that Quicksort actually sorts?
- Potential aliasing violation in swap array indexes SPARK-Ada
- Find factor of a number
- How to use Assert and loop_invariants
- Proving Floor_Log2 in Spark
- GNATprove: "postcondition might fail" in simple function
- 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 # Hahtags
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.