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
fa25dd45
Commit
fa25dd45
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
By convention, we reserve priorities 1-99 to heuristics
parent
7d4dc715
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/synthesis/Heuristics.scala
+36
-3
36 additions, 3 deletions
src/main/scala/leon/synthesis/Heuristics.scala
src/main/scala/leon/synthesis/Rules.scala
+9
-9
9 additions, 9 deletions
src/main/scala/leon/synthesis/Rules.scala
with
45 additions
and
12 deletions
src/main/scala/leon/synthesis/Heuristics.scala
+
36
−
3
View file @
fa25dd45
...
...
@@ -22,7 +22,7 @@ trait Heuristic {
override
def
toString
=
"H: "
+
name
}
class
OptimisticGround
(
synth
:
Synthesizer
)
extends
Rule
(
"Optimistic Ground"
,
synth
,
9
)
with
Heuristic
{
class
OptimisticGround
(
synth
:
Synthesizer
)
extends
Rule
(
"Optimistic Ground"
,
synth
,
9
0
)
with
Heuristic
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -79,7 +79,7 @@ class OptimisticGround(synth: Synthesizer) extends Rule("Optimistic Ground", syn
}
class
IntInduction
(
synth
:
Synthesizer
)
extends
Rule
(
"Int Induction"
,
synth
,
8
)
with
Heuristic
{
class
IntInduction
(
synth
:
Synthesizer
)
extends
Rule
(
"Int Induction"
,
synth
,
8
0
)
with
Heuristic
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -124,7 +124,7 @@ class IntInduction(synth: Synthesizer) extends Rule("Int Induction", synth, 8) w
}
}
class
OptimisticInjection
(
synth
:
Synthesizer
)
extends
Rule
(
"Opt. Injection"
,
synth
,
5
)
with
Heuristic
{
class
OptimisticInjection
(
synth
:
Synthesizer
)
extends
Rule
(
"Opt. Injection"
,
synth
,
5
0
)
with
Heuristic
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -148,9 +148,42 @@ class OptimisticInjection(synth: Synthesizer) extends Rule("Opt. Injection", syn
val
args
=
argss
(
0
)
zip
argss
(
1
)
newExprs
++=
args
.
map
{
case
(
l
,
r
)
=>
Equals
(
l
,
r
)
}
newExprs
=
newExprs
.
filterNot
(
toRemove
)
}
val
sub
=
p
.
copy
(
phi
=
And
(
newExprs
))
RuleDecomposed
(
List
(
sub
),
forward
)
}
else
{
RuleInapplicable
}
}
}
class
SelectiveInlining
(
synth
:
Synthesizer
)
extends
Rule
(
"Sel. Inlining"
,
synth
,
20
)
with
Heuristic
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
val
TopLevelAnds
(
exprs
)
=
p
.
phi
val
eqfuncalls
=
exprs
.
collect
{
case
eq
@
Equals
(
FunctionInvocation
(
fd
,
args
),
e
)
=>
((
fd
,
e
),
args
,
eq
:
Expr
)
case
eq
@
Equals
(
e
,
FunctionInvocation
(
fd
,
args
))
=>
((
fd
,
e
),
args
,
eq
:
Expr
)
}
val
candidates
=
eqfuncalls
.
groupBy
(
_
.
_1
).
filter
(
_
.
_2
.
size
>
1
)
if
(!
candidates
.
isEmpty
)
{
var
newExprs
=
exprs
for
(
cands
<-
candidates
.
values
)
{
val
cand
=
cands
.
take
(
2
)
val
toRemove
=
cand
.
map
(
_
.
_3
).
toSet
val
argss
=
cand
.
map
(
_
.
_2
)
val
args
=
argss
(
0
)
zip
argss
(
1
)
newExprs
++=
args
.
map
{
case
(
l
,
r
)
=>
Equals
(
l
,
r
)
}
newExprs
=
newExprs
.
filterNot
(
toRemove
)
}
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/synthesis/Rules.scala
+
9
−
9
View file @
fa25dd45
...
...
@@ -42,7 +42,7 @@ abstract class Rule(val name: String, val synth: Synthesizer, val priority: Prio
override
def
toString
=
"R: "
+
name
}
class
OnePoint
(
synth
:
Synthesizer
)
extends
Rule
(
"One-point"
,
synth
,
30
)
{
class
OnePoint
(
synth
:
Synthesizer
)
extends
Rule
(
"One-point"
,
synth
,
30
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -81,7 +81,7 @@ class OnePoint(synth: Synthesizer) extends Rule("One-point", synth, 30) {
}
}
class
Ground
(
synth
:
Synthesizer
)
extends
Rule
(
"Ground"
,
synth
,
50
)
{
class
Ground
(
synth
:
Synthesizer
)
extends
Rule
(
"Ground"
,
synth
,
50
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -103,7 +103,7 @@ class Ground(synth: Synthesizer) extends Rule("Ground", synth, 50) {
}
}
class
CaseSplit
(
synth
:
Synthesizer
)
extends
Rule
(
"Case-Split"
,
synth
,
20
)
{
class
CaseSplit
(
synth
:
Synthesizer
)
extends
Rule
(
"Case-Split"
,
synth
,
20
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
p
.
phi
match
{
...
...
@@ -123,7 +123,7 @@ class CaseSplit(synth: Synthesizer) extends Rule("Case-Split", synth, 20) {
}
}
class
Assert
(
synth
:
Synthesizer
)
extends
Rule
(
"Assert"
,
synth
,
20
)
{
class
Assert
(
synth
:
Synthesizer
)
extends
Rule
(
"Assert"
,
synth
,
20
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -159,7 +159,7 @@ class Assert(synth: Synthesizer) extends Rule("Assert", synth, 20) {
}
}
class
UnusedInput
(
synth
:
Synthesizer
)
extends
Rule
(
"UnusedInput"
,
synth
,
10
)
{
class
UnusedInput
(
synth
:
Synthesizer
)
extends
Rule
(
"UnusedInput"
,
synth
,
10
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
val
unused
=
p
.
as
.
toSet
--
variablesOf
(
p
.
phi
)
...
...
@@ -174,7 +174,7 @@ class UnusedInput(synth: Synthesizer) extends Rule("UnusedInput", synth, 10) {
}
}
class
UnconstrainedOutput
(
synth
:
Synthesizer
)
extends
Rule
(
"Unconstr.Output"
,
synth
,
10
)
{
class
UnconstrainedOutput
(
synth
:
Synthesizer
)
extends
Rule
(
"Unconstr.Output"
,
synth
,
10
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
val
unconstr
=
p
.
xs
.
toSet
--
variablesOf
(
p
.
phi
)
...
...
@@ -198,7 +198,7 @@ class UnconstrainedOutput(synth: Synthesizer) extends Rule("Unconstr.Output", sy
}
object
Unification
{
class
DecompTrivialClash
(
synth
:
Synthesizer
)
extends
Rule
(
"Unif Dec./Clash/Triv."
,
synth
,
20
)
{
class
DecompTrivialClash
(
synth
:
Synthesizer
)
extends
Rule
(
"Unif Dec./Clash/Triv."
,
synth
,
20
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -226,7 +226,7 @@ object Unification {
}
}
class
OccursCheck
(
synth
:
Synthesizer
)
extends
Rule
(
"Unif OccursCheck"
,
synth
,
20
)
{
class
OccursCheck
(
synth
:
Synthesizer
)
extends
Rule
(
"Unif OccursCheck"
,
synth
,
20
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
@@ -253,7 +253,7 @@ object Unification {
}
class
ADTDual
(
synth
:
Synthesizer
)
extends
Rule
(
"ADTDual"
,
synth
,
20
)
{
class
ADTDual
(
synth
:
Synthesizer
)
extends
Rule
(
"ADTDual"
,
synth
,
20
0
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
...
...
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