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
a679d54b
Commit
a679d54b
authored
8 years ago
by
Nicolas Voirol
Browse files
Options
Downloads
Patches
Plain Diff
Fixed funDef ordering in Strengthener
parent
9566dcff
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/leon/termination/Strengthener.scala
+12
-2
12 additions, 2 deletions
src/main/scala/leon/termination/Strengthener.scala
with
12 additions
and
2 deletions
src/main/scala/leon/termination/Strengthener.scala
+
12
−
2
View file @
a679d54b
...
...
@@ -17,12 +17,22 @@ trait Strengthener { self : RelationComparator =>
val
checker
:
TerminationChecker
implicit
object
CallGraphOrdering
extends
Ordering
[
FunDef
]
{
def
compare
(
a
:
FunDef
,
b
:
FunDef
)
:
Int
=
{
val
aCallsB
=
checker
.
program
.
callGraph
.
transitivelyCalls
(
a
,
b
)
val
bCallsA
=
checker
.
program
.
callGraph
.
transitivelyCalls
(
b
,
a
)
if
(
aCallsB
&&
!
bCallsA
)
-
1
else
if
(
bCallsA
&&
!
aCallsB
)
1
else
0
}
}
private
val
strengthenedPost
:
MutableSet
[
FunDef
]
=
MutableSet
.
empty
def
strengthenPostconditions
(
funDefs
:
Set
[
FunDef
])(
implicit
solver
:
Processor
with
Solvable
)
{
// Strengthen postconditions on all accessible functions by adding size constraints
val
callees
:
Set
[
FunDef
]
=
funDefs
.
flatMap
(
fd
=>
checker
.
program
.
callGraph
.
transitiveCallees
(
fd
))
val
sortedCallees
:
Seq
[
FunDef
]
=
callees
.
toSeq
.
sort
With
((
fd1
,
fd2
)
=>
checker
.
program
.
callGraph
.
transitivelyCalls
(
fd2
,
fd1
))
val
sortedCallees
:
Seq
[
FunDef
]
=
callees
.
toSeq
.
sort
ed
for
(
funDef
<-
sortedCallees
if
!
strengthenedPost
(
funDef
)
&&
funDef
.
hasBody
&&
checker
.
terminates
(
funDef
).
isGuaranteed
)
{
def
strengthen
(
cmp
:
(
Seq
[
Expr
],
Seq
[
Expr
])
=>
Expr
)
:
Boolean
=
{
...
...
@@ -85,7 +95,7 @@ trait Strengthener { self : RelationComparator =>
def
strengthenApplications
(
funDefs
:
Set
[
FunDef
])(
implicit
solver
:
Processor
with
Solvable
)
{
val
transitiveFunDefs
=
funDefs
++
funDefs
.
flatMap
(
checker
.
program
.
callGraph
.
transitiveCallees
)
val
sortedFunDefs
=
transitiveFunDefs
.
toSeq
.
sort
With
((
fd1
,
fd2
)
=>
checker
.
program
.
callGraph
.
transitivelyCalls
(
fd2
,
fd1
))
val
sortedFunDefs
=
transitiveFunDefs
.
toSeq
.
sort
ed
for
(
funDef
<-
sortedFunDefs
if
!
strengthenedApp
(
funDef
)
&&
funDef
.
hasBody
&&
checker
.
terminates
(
funDef
).
isGuaranteed
)
{
...
...
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