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
f4d5a236
Commit
f4d5a236
authored
9 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Move handling of Require to TransformerWithPC
parent
c49e2d77
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/leon/purescala/ExprOps.scala
+2
-7
2 additions, 7 deletions
src/main/scala/leon/purescala/ExprOps.scala
src/main/scala/leon/purescala/TransformerWithPC.scala
+20
-1
20 additions, 1 deletion
src/main/scala/leon/purescala/TransformerWithPC.scala
with
22 additions
and
8 deletions
src/main/scala/leon/purescala/ExprOps.scala
+
2
−
7
View file @
f4d5a236
...
...
@@ -1228,7 +1228,7 @@ object ExprOps {
trait
CollectorWithPaths
[
T
]
extends
TransformerWithPC
with
Traverser
[
Seq
[
T
]]
{
type
C
=
Seq
[
Expr
]
val
initC
:
C
=
Nil
protected
val
initC
:
C
=
Nil
def
register
(
e
:
Expr
,
path
:
C
)
=
path
:+
e
private
var
results
:
Seq
[
T
]
=
Nil
...
...
@@ -1245,12 +1245,7 @@ object ExprOps {
}
}
def
traverse
(
funDef
:
FunDef
)
:
Seq
[
T
]
=
{
val
precTs
=
funDef
.
precondition
.
toSeq
.
flatMap
(
traverse
)
val
bodyTs
=
funDef
.
body
.
toSeq
.
flatMap
(
traverse
(
_
,
funDef
.
precondition
.
toSeq
))
val
postTs
=
funDef
.
postcondition
.
toSeq
.
flatMap
(
traverse
)
precTs
++
bodyTs
++
postTs
}
def
traverse
(
funDef
:
FunDef
)
:
Seq
[
T
]
=
traverse
(
funDef
.
fullBody
)
def
traverse
(
e
:
Expr
)
:
Seq
[
T
]
=
traverse
(
e
,
initC
)
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/purescala/TransformerWithPC.scala
+
20
−
1
View file @
f4d5a236
...
...
@@ -8,11 +8,19 @@ import ExprOps._
import
Extractors._
import
Constructors._
/** Traverses/ transforms expressions with path condition awareness.
*
* Path condition representation is left generic (type [[C]])
*/
abstract
class
TransformerWithPC
extends
Transformer
{
/** The type of the path condition */
type
C
/** The initial path condition */
protected
val
initC
:
C
/** Register a new expression to a path condition */
protected
def
register
(
cond
:
Expr
,
path
:
C
)
:
C
protected
def
rec
(
e
:
Expr
,
path
:
C
)
:
Expr
=
e
match
{
...
...
@@ -20,7 +28,18 @@ abstract class TransformerWithPC extends Transformer {
val
se
=
rec
(
v
,
path
)
val
sb
=
rec
(
b
,
register
(
Equals
(
Variable
(
i
),
se
),
path
))
Let
(
i
,
se
,
sb
).
copiedFrom
(
e
)
case
Require
(
pred
,
body
)
=>
val
sp
=
rec
(
pred
,
path
)
val
sb
=
rec
(
body
,
register
(
sp
,
path
))
Require
(
sp
,
sb
).
copiedFrom
(
e
)
//@mk: Discuss if we should include asserted predicates in the pc
//case Assert(pred, err, body) =>
// val sp = rec(pred, path)
// val sb = rec(body, register(sp, path))
// Assert(sp, err, sb).copiedFrom(e)
case
p
:
Passes
=>
applyAsMatches
(
p
,
rec
(
_
,
path
))
...
...
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