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
dff5eafb
Commit
dff5eafb
authored
9 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in EquivalentInputs where pc got simplified under itself
parent
a452cb20
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/leon/synthesis/rules/EquivalentInputs.scala
+6
-7
6 additions, 7 deletions
src/main/scala/leon/synthesis/rules/EquivalentInputs.scala
with
6 additions
and
7 deletions
src/main/scala/leon/synthesis/rules/EquivalentInputs.scala
+
6
−
7
View file @
dff5eafb
...
@@ -9,15 +9,12 @@ import purescala.Path
...
@@ -9,15 +9,12 @@ import purescala.Path
import
purescala.Common._
import
purescala.Common._
import
purescala.Expressions._
import
purescala.Expressions._
import
purescala.ExprOps._
import
purescala.ExprOps._
import
purescala.Extractors._
import
purescala.Constructors._
import
purescala.Constructors._
import
purescala.Types.CaseClassType
import
purescala.Types.CaseClassType
case
object
EquivalentInputs
extends
NormalizingRule
(
"EquivalentInputs"
)
{
case
object
EquivalentInputs
extends
NormalizingRule
(
"EquivalentInputs"
)
{
def
instantiateOn
(
implicit
hctx
:
SearchContext
,
p
:
Problem
)
:
Traversable
[
RuleInstantiation
]
=
{
def
instantiateOn
(
implicit
hctx
:
SearchContext
,
p
:
Problem
)
:
Traversable
[
RuleInstantiation
]
=
{
val
simplifier
=
Simplifiers
.
bestEffort
(
hctx
,
hctx
.
program
)(
_:
Expr
,
p
.
pc
)
var
subst
=
Map
.
empty
[
Identifier
,
Expr
]
var
subst
=
Map
.
empty
[
Identifier
,
Expr
]
var
reverseSubst
=
Map
.
empty
[
Identifier
,
Expr
]
var
reverseSubst
=
Map
.
empty
[
Identifier
,
Expr
]
...
@@ -57,12 +54,12 @@ case object EquivalentInputs extends NormalizingRule("EquivalentInputs") {
...
@@ -57,12 +54,12 @@ case object EquivalentInputs extends NormalizingRule("EquivalentInputs") {
obsolete
++=
equivalences
.
map
(
_
.
_1
)
obsolete
++=
equivalences
.
map
(
_
.
_1
)
free
++=
unbound
free
++=
unbound
def
replace
(
e
:
Expr
)
=
simplifier
(
replaceFromIDs
(
equivalences
.
toMap
,
e
)
)
def
replace
(
e
:
Expr
)
=
replaceFromIDs
(
equivalences
.
toMap
,
e
)
subst
=
subst
.
mapValues
(
replace
)
++
equivalences
subst
=
subst
.
mapValues
(
replace
)
++
equivalences
val
reverse
=
equivalences
.
toMap
.
flatMap
{
case
(
id
,
CaseClass
(
cct
,
fields
))
=>
val
reverse
=
equivalences
.
toMap
.
flatMap
{
case
(
id
,
CaseClass
(
cct
,
fields
))
=>
(
cct
.
classDef
.
fields
zip
fields
).
map
{
case
(
vid
,
Variable
(
fieldId
))
=>
(
cct
.
classDef
.
fields
zip
fields
).
map
{
case
(
vid
,
Variable
(
fieldId
))
=>
fieldId
->
C
aseClassSelector
(
cct
,
A
sInst
ance
Of
(
Variable
(
id
),
cct
),
vid
.
id
)
fieldId
->
c
aseClassSelector
(
cct
,
a
sInstOf
(
Variable
(
id
),
cct
),
vid
.
id
)
}
}
}
}
...
@@ -73,7 +70,7 @@ case object EquivalentInputs extends NormalizingRule("EquivalentInputs") {
...
@@ -73,7 +70,7 @@ case object EquivalentInputs extends NormalizingRule("EquivalentInputs") {
// We could discover one equivalence, which could allow us to discover
// We could discover one equivalence, which could allow us to discover
// other equivalences: We do a fixpoint with limit 5.
// other equivalences: We do a fixpoint with limit 5.
val
simplifiedPath
=
fixpoint
({
(
path
:
Path
)
=>
discoverEquivalences
(
path
)
},
5
)(
p
.
pc
)
val
newPC
=
fixpoint
({
(
path
:
Path
)
=>
discoverEquivalences
(
path
)
},
5
)(
p
.
pc
)
if
(
subst
.
nonEmpty
)
{
if
(
subst
.
nonEmpty
)
{
// XXX: must take place in this order!! obsolete & free is typically non-empty
// XXX: must take place in this order!! obsolete & free is typically non-empty
...
@@ -88,10 +85,12 @@ case object EquivalentInputs extends NormalizingRule("EquivalentInputs") {
...
@@ -88,10 +85,12 @@ case object EquivalentInputs extends NormalizingRule("EquivalentInputs") {
})
})
}
}
val
simplifier
=
Simplifiers
.
bestEffort
(
hctx
,
hctx
.
program
)(
_:
Expr
,
newPC
)
val
sub
=
p
.
copy
(
val
sub
=
p
.
copy
(
as
=
newAs
,
as
=
newAs
,
ws
=
replaceFromIDs
(
subst
,
p
.
ws
),
ws
=
replaceFromIDs
(
subst
,
p
.
ws
),
pc
=
simplifiedPath
,
pc
=
newPC
,
phi
=
simplifier
(
replaceFromIDs
(
subst
,
p
.
phi
)),
phi
=
simplifier
(
replaceFromIDs
(
subst
,
p
.
phi
)),
eb
=
newBank
eb
=
newBank
)
)
...
...
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