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
2caaa959
Commit
2caaa959
authored
9 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Refactor TypedFunDef
parent
2edb6f85
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
src/main/scala/leon/purescala/Definitions.scala
+9
-34
9 additions, 34 deletions
src/main/scala/leon/purescala/Definitions.scala
src/main/scala/leon/termination/StructuralSize.scala
+1
-1
1 addition, 1 deletion
src/main/scala/leon/termination/StructuralSize.scala
with
10 additions
and
35 deletions
src/main/scala/leon/purescala/Definitions.scala
+
9
−
34
View file @
2caaa959
...
@@ -59,8 +59,7 @@ object Definitions {
...
@@ -59,8 +59,7 @@ object Definitions {
def
toVariable
:
Variable
=
Variable
(
id
)
def
toVariable
:
Variable
=
Variable
(
id
)
}
}
/** A wrapper for a program. For now a program is simply a single object. The
/** A wrapper for a program. For now a program is simply a single object. */
* name is meaningless and we just use the package name as id. */
case
class
Program
(
units
:
List
[
UnitDef
])
extends
Definition
{
case
class
Program
(
units
:
List
[
UnitDef
])
extends
Definition
{
val
id
=
FreshIdentifier
(
"program"
)
val
id
=
FreshIdentifier
(
"program"
)
...
@@ -481,43 +480,19 @@ object Definitions {
...
@@ -481,43 +480,19 @@ object Definitions {
lazy
val
returnType
:
TypeTree
=
translated
(
fd
.
returnType
)
lazy
val
returnType
:
TypeTree
=
translated
(
fd
.
returnType
)
private
var
trCache
=
Map
[
Expr
,
Expr
]()
private
var
trCache
=
Map
[
Expr
,
Expr
]()
private
var
postCache
=
Map
[
Expr
,
Expr
]()
def
fullBody
=
{
private
def
cached
(
e
:
Expr
)
:
Expr
=
{
val
fb
=
fd
.
fullBody
trCache
.
getOrElse
(
e
,
{
trCache
.
getOrElse
(
fb
,
{
val
res
=
translated
(
e
)
val
res
=
translated
(
fb
)
trCache
+=
e
->
res
trCache
+=
fb
->
res
res
res
})
})
}
}
def
body
=
fd
.
body
.
map
{
b
=>
def
fullBody
=
cached
(
fd
.
fullBody
)
trCache
.
getOrElse
(
b
,
{
def
body
=
fd
.
body
map
cached
val
res
=
translated
(
b
)
def
precondition
=
fd
.
precondition
map
cached
trCache
+=
b
->
res
def
postcondition
=
fd
.
postcondition
map
cached
res
})
}
def
precondition
=
fd
.
precondition
.
map
{
pre
=>
trCache
.
getOrElse
(
pre
,
{
val
res
=
translated
(
pre
)
trCache
+=
pre
->
res
res
})
}
def
postcondition
=
fd
.
postcondition
.
map
{
case
post
if
typesMap
.
nonEmpty
=>
postCache
.
getOrElse
(
post
,
{
val
res
=
instantiateType
(
post
,
typesMap
,
paramsMap
)
postCache
+=
(
post
->
res
)
res
})
case
p
=>
p
}
def
hasImplementation
=
body
.
isDefined
def
hasImplementation
=
body
.
isDefined
def
hasBody
=
hasImplementation
def
hasBody
=
hasImplementation
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/termination/StructuralSize.scala
+
1
−
1
View file @
2caaa959
...
@@ -35,7 +35,7 @@ trait StructuralSize {
...
@@ -35,7 +35,7 @@ trait StructuralSize {
Variable
(
x
),
Variable
(
x
),
uminus
(
Variable
(
x
))
uminus
(
Variable
(
x
))
))
))
TypedFunDef
(
absFun
,
Seq
())
// Seq() because no generic type params
absFun
.
typed
}
}
def
size
(
expr
:
Expr
)
:
Expr
=
{
def
size
(
expr
:
Expr
)
:
Expr
=
{
...
...
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