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
4d62a422
Commit
4d62a422
authored
10 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Repair intro
parent
6f71aaec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/intro.rst
+48
-1
48 additions, 1 deletion
doc/intro.rst
doc/repair.rst
+2
-0
2 additions, 0 deletions
doc/repair.rst
with
50 additions
and
1 deletion
doc/intro.rst
+
48
−
1
View file @
4d62a422
...
...
@@ -68,4 +68,51 @@ Program Synthesis
Program Repair
--------------
-------------
Leon can repair buggy :ref:`Pure Scala <purescala>` programs.
Given a specification and an erroneous implementation, Leon will
localize the cause of the bug and provide an alternative solution.
An example:
.. code-block:: scala
def moddiv(a: Int, b: Int): (Int, Int) = {
require(a >= 0 && b > 0);
if (b > a) {
(1, 0) // fixme: should be (a, 0)
} else {
val (r1, r2) = moddiv(a-b, b)
(r1, r2+1)
}
} ensuring {
res => b*res._2 + res._1 == a
}
Invoking ``leon --repair --functions=moddiv`` will yield: ::
...
[ Info ] Found trusted solution!
[ Info ] ============================== Repair successful: ==============================
[ Info ] --------------------------------- Solution 1: ---------------------------------
[ Info ] (a, 0)
[ Info ] ================================= In context: =================================
[ Info ] --------------------------------- Solution 1: ---------------------------------
[ Info ] def moddiv(a : Int, b : Int): (Int, Int) = {
require(a >= 0 && b > 0)
if (b > a) {
(a, 0)
} else {
val (r1, r2) = moddiv(a - b, b)
(r1, (r2 + 1))
}
} ensuring {
(res : (Int, Int)) => (b * res._2 + res._1 == a)
}
Repair assumes a small number of localized errors.
It first invokes a test-based fault localization algorithm,
and then a special synthesis procedure, which is partially guided
by the original erroneous implementation. For more information,
see the section on :ref:`Repair <repair>`.
This diff is collapsed.
Click to expand it.
doc/repair.rst
+
2
−
0
View file @
4d62a422
.. _repair:
Repair
======
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