Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
692c1524
Commit
692c1524
authored
10 years ago
by
Regis Blanc
Browse files
Options
Downloads
Patches
Plain Diff
loop invariants
parent
4b59b034
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/verification.rst
+37
-0
37 additions, 0 deletions
doc/verification.rst
with
37 additions
and
0 deletions
doc/verification.rst
+
37
−
0
View file @
692c1524
.. _verification:
Verification
Verification
============
============
...
@@ -139,10 +141,45 @@ to prove the following theorem:
...
@@ -139,10 +141,45 @@ to prove the following theorem:
\forall x. \mbox{pc}(x) \implies \mbox{prec}(\mbox{e}(x))
\forall x. \mbox{pc}(x) \implies \mbox{prec}(\mbox{e}(x))
Leon will generates one such theorem for each static call site of a function with
a precondition.
.. note::
Leon only assumes an open program model, where any function could be called from
outside of the given program. In particular, Leon will not derive a precondition
to a function based on known information in the context of the calls, such as
knowing that the function is always given positive parameters. Any information needed
to prove the postcondition will have to be provide as part of the precondition
of a function.
Loop invariants
Loop invariants
***************
***************
Leon supports annotations for loop invariants in :ref:`XLang <xlang>`. To
simplify the presentation we will assume a single variable :math:`x` is in
scope, but the definitions generalize to any number of variables. Given the
following program:
.. code-block:: scala
(while(cond) {
body
}) invariant(inv)
where the boolean expression :math:`\mbox{cond}(x)` is over the free variable
:math:`x` and the expression :math:`\mbox{body}(x, x')` relates the value of
:math:`x` when entering the loop to its updated value :math:`x'` on loop exit.
The expression :math:`\mbox{inv}(x)` is a boolean formula over the free
variable :math:`x`.
A loop invariant must hold:
(1) when the program enters the loop initially
(2) after each completion of the body
(3) right after exiting the loop (when the condition turns false)
Leon will prove point (1) and (2) above. Together, and by induction, they imply
that point (3) holds as well.
Array access safety
Array access safety
*******************
*******************
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment