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
4202c64e
Commit
4202c64e
authored
10 years ago
by
Regis Blanc
Committed by
Etienne Kneuss
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
more xlang descriptions
parent
9d0f8a3f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/xlang.rst
+29
-1
29 additions, 1 deletion
doc/xlang.rst
with
29 additions
and
1 deletion
doc/xlang.rst
+
29
−
1
View file @
4202c64e
...
@@ -37,7 +37,7 @@ The above example illustrates three new features introduced by XLang:
...
@@ -37,7 +37,7 @@ The above example illustrates three new features introduced by XLang:
2. Blocks of expressions
2. Blocks of expressions
3. Assignment
3. Assignment
s
You can use Scala variables with a few restrictions. The variables can only be
You can use Scala variables with a few restrictions. The variables can only be
declared and used locally in the same function, and inner functions cannot
declared and used locally in the same function, and inner functions cannot
...
@@ -70,9 +70,37 @@ declarations.
...
@@ -70,9 +70,37 @@ declarations.
While loops
While loops
***********
***********
You can use the ``while`` keyword. While loops usually combine the ability to
declare variables and make a sequence of assignments in order to compute
something useful:
.. code-block:: scala
def foo(x: Int): Int = {
var res = 0
var i = 0
while(i < 10) {
res = res + i
i = i + 1
}
res
}
Leon will automatically generate a postcondition to the ``while`` loop, using
the negation of the loop condition. It will automatically prove that
verification condition and you should see an ``invariant postcondition`` marked
as ``valid``.
Leon internally handle loops as a function with a postcondition. For the end-user it
means that Leon is only going to rely on the postcondition of the loop to prove properties
of code relying on loops.
Arrays
Arrays
******
******
PureScala supports functional arrays, that is, the operations ``apply`` and ``updated`` which do
not modify an array but only returns some result. In particular, ``updated`` returns a new copy
of the array.
.. note::
.. note::
some note comes here
some note comes here
...
...
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