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
e16ab22c
Commit
e16ab22c
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Optimistic Ground Rule with CE guided refinement
parent
d5815659
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/TreeOps.scala
+5
-0
5 additions, 0 deletions
src/main/scala/leon/purescala/TreeOps.scala
src/main/scala/leon/synthesis/Rules.scala
+57
-0
57 additions, 0 deletions
src/main/scala/leon/synthesis/Rules.scala
with
62 additions
and
0 deletions
src/main/scala/leon/purescala/TreeOps.scala
+
5
−
0
View file @
e16ab22c
...
@@ -1302,4 +1302,9 @@ object TreeOps {
...
@@ -1302,4 +1302,9 @@ object TreeOps {
rec
(
expr
,
Nil
)
rec
(
expr
,
Nil
)
}
}
def
valuateWithModel
(
expr
:
Expr
,
vars
:
Set
[
Identifier
],
model
:
Map
[
Identifier
,
Expr
])
=
{
replace
(
vars
.
map
(
id
=>
Variable
(
id
)
->
model
.
getOrElse
(
id
,
simplestValue
(
id
.
getType
))).
toMap
,
expr
)
}
}
}
This diff is collapsed.
Click to expand it.
src/main/scala/leon/synthesis/Rules.scala
+
57
−
0
View file @
e16ab22c
...
@@ -14,6 +14,7 @@ object Rules {
...
@@ -14,6 +14,7 @@ object Rules {
new
ADTDual
(
synth
),
new
ADTDual
(
synth
),
new
OnePoint
(
synth
),
new
OnePoint
(
synth
),
new
Ground
(
synth
),
new
Ground
(
synth
),
new
OptimisticGround
(
synth
),
new
CaseSplit
(
synth
),
new
CaseSplit
(
synth
),
new
UnusedInput
(
synth
),
new
UnusedInput
(
synth
),
new
UnconstrainedOutput
(
synth
),
new
UnconstrainedOutput
(
synth
),
...
@@ -101,6 +102,62 @@ class Ground(synth: Synthesizer) extends Rule("Ground", synth, 500) {
...
@@ -101,6 +102,62 @@ class Ground(synth: Synthesizer) extends Rule("Ground", synth, 500) {
}
}
}
}
class
OptimisticGround
(
synth
:
Synthesizer
)
extends
Rule
(
"Optimistic Ground"
,
synth
,
90
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
if
(!
p
.
as
.
isEmpty
&&
!
p
.
xs
.
isEmpty
)
{
val
xss
=
p
.
xs
.
toSet
val
ass
=
p
.
as
.
toSet
val
tpe
=
TupleType
(
p
.
xs
.
map
(
_
.
getType
))
var
i
=
0
;
var
maxTries
=
5
;
var
result
:
Option
[
RuleResult
]
=
None
var
predicates
:
Seq
[
Expr
]
=
Seq
()
while
(
result
.
isEmpty
&&
i
<
maxTries
)
{
val
phi
=
And
(
p
.
phi
+:
predicates
)
synth
.
solveSAT
(
phi
)
match
{
case
(
Some
(
true
),
satModel
)
=>
val
satXsModel
=
satModel
.
filterKeys
(
xss
)
val
newPhi
=
valuateWithModel
(
phi
,
xss
,
satModel
)
synth
.
solveSAT
(
Not
(
newPhi
))
match
{
case
(
Some
(
true
),
invalidModel
)
=>
// Found as such as the xs break, refine predicates
predicates
=
valuateWithModel
(
phi
,
ass
,
invalidModel
)
+:
predicates
case
(
Some
(
false
),
_
)
=>
result
=
Some
(
RuleSuccess
(
Solution
(
BooleanLiteral
(
true
),
newPhi
)))
case
_
=>
result
=
Some
(
RuleInapplicable
)
}
case
(
Some
(
false
),
_
)
=>
if
(
predicates
.
isEmpty
)
{
result
=
Some
(
RuleSuccess
(
Solution
(
BooleanLiteral
(
false
),
Error
(
p
.
phi
+
" is UNSAT!"
).
setType
(
tpe
))))
}
else
{
result
=
Some
(
RuleInapplicable
)
}
case
_
=>
result
=
Some
(
RuleInapplicable
)
}
i
+=
1
}
result
.
getOrElse
(
RuleInapplicable
)
}
else
{
RuleInapplicable
}
}
}
class
CaseSplit
(
synth
:
Synthesizer
)
extends
Rule
(
"Case-Split"
,
synth
,
200
)
{
class
CaseSplit
(
synth
:
Synthesizer
)
extends
Rule
(
"Case-Split"
,
synth
,
200
)
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
def
applyOn
(
task
:
Task
)
:
RuleResult
=
{
val
p
=
task
.
problem
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