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
857317fc
Commit
857317fc
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Make sure model is complete, simplify rule
parent
9568eccc
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.scala
+25
-30
25 additions, 30 deletions
src/main/scala/leon/synthesis/Rules.scala
with
25 additions
and
30 deletions
src/main/scala/leon/synthesis/Rules.scala
+
25
−
30
View file @
857317fc
...
@@ -38,41 +38,36 @@ class OnePoint(synth: Synthesizer) extends Rule("One-point", synth) {
...
@@ -38,41 +38,36 @@ class OnePoint(synth: Synthesizer) extends Rule("One-point", synth) {
val
p
=
task
.
problem
val
p
=
task
.
problem
p
.
phi
match
{
val
TopLevelAnds
(
exprs
)
=
p
.
phi
case
TopLevelAnds
(
exprs
)
=>
val
candidates
=
exprs
.
collect
{
case
eq
@
Equals
(
Variable
(
x
),
e
)
if
(
p
.
xs
contains
x
)
&&
!(
variablesOf
(
e
)
contains
x
)
=>
(
x
,
e
,
eq
)
case
eq
@
Equals
(
e
,
Variable
(
x
))
if
(
p
.
xs
contains
x
)
&&
!(
variablesOf
(
e
)
contains
x
)
=>
(
x
,
e
,
eq
)
}
if
(!
candidates
.
isEmpty
)
{
val
(
x
,
e
,
eq
)
=
candidates
.
head
val
others
=
exprs
.
filter
(
_
!=
eq
)
val
candidates
=
exprs
.
collect
{
val
oxs
=
p
.
xs
.
filter
(
_
!=
x
)
case
eq
@
Equals
(
Variable
(
x
),
e
)
if
(
p
.
xs
contains
x
)
&&
!(
variablesOf
(
e
)
contains
x
)
=>
(
x
,
e
,
eq
)
case
eq
@
Equals
(
e
,
Variable
(
x
))
if
(
p
.
xs
contains
x
)
&&
!(
variablesOf
(
e
)
contains
x
)
=>
(
x
,
e
,
eq
)
}
val
newProblem
=
Problem
(
p
.
as
,
subst
(
x
->
e
,
And
(
others
)),
oxs
)
if
(!
candidates
.
isEmpty
)
{
val
(
x
,
e
,
eq
)
=
candidates
.
head
val
onSuccess
:
List
[
Solution
]
=>
Solution
=
{
val
others
=
exprs
.
filter
(
_
!=
eq
)
case
List
(
Solution
(
pre
,
term
,
sc
))
=>
val
oxs
=
p
.
xs
.
filter
(
_
!=
x
)
if
(
oxs
.
isEmpty
)
{
Solution
(
pre
,
Tuple
(
e
::
Nil
),
sc
)
}
else
{
Solution
(
pre
,
LetTuple
(
oxs
,
term
,
subst
(
x
->
e
,
Tuple
(
p
.
xs
.
map
(
Variable
(
_
))))),
sc
)
}
case
_
=>
Solution
.
none
}
List
(
task
.
decompose
(
this
,
List
(
newProblem
),
onSuccess
,
100
))
val
newProblem
=
Problem
(
p
.
as
,
subst
(
x
->
e
,
And
(
others
)),
oxs
)
}
else
{
Nil
}
val
onSuccess
:
List
[
Solution
]
=>
Solution
=
{
case
List
(
Solution
(
pre
,
term
,
sc
))
=>
if
(
oxs
.
isEmpty
)
{
Solution
(
pre
,
Tuple
(
e
::
Nil
),
sc
)
}
else
{
Solution
(
pre
,
LetTuple
(
oxs
,
term
,
subst
(
x
->
e
,
Tuple
(
p
.
xs
.
map
(
Variable
(
_
))))),
sc
)
}
case
_
=>
Solution
.
none
}
case
_
=>
List
(
task
.
decompose
(
this
,
List
(
newProblem
),
onSuccess
,
100
))
Nil
}
else
{
Nil
}
}
}
}
}
}
...
@@ -87,7 +82,7 @@ class Ground(synth: Synthesizer) extends Rule("Ground", synth) {
...
@@ -87,7 +82,7 @@ class Ground(synth: Synthesizer) extends Rule("Ground", synth) {
synth
.
solveSAT
(
p
.
phi
)
match
{
synth
.
solveSAT
(
p
.
phi
)
match
{
case
(
Some
(
true
),
model
)
=>
case
(
Some
(
true
),
model
)
=>
List
(
task
.
solveUsing
(
this
,
Solution
(
BooleanLiteral
(
true
),
Tuple
(
p
.
xs
.
map
(
model
)).
setType
(
tpe
),
200
),
200
))
List
(
task
.
solveUsing
(
this
,
Solution
(
BooleanLiteral
(
true
),
Tuple
(
p
.
xs
.
map
(
id
=>
model
.
getOrElse
(
id
,
simplestValue
(
Variable
(
id
)))
)).
setType
(
tpe
),
200
),
200
))
case
(
Some
(
false
),
model
)
=>
case
(
Some
(
false
),
model
)
=>
List
(
task
.
solveUsing
(
this
,
Solution
(
BooleanLiteral
(
false
),
Error
(
p
.
phi
+
" is UNSAT!"
).
setType
(
tpe
),
200
),
200
))
List
(
task
.
solveUsing
(
this
,
Solution
(
BooleanLiteral
(
false
),
Error
(
p
.
phi
+
" is UNSAT!"
).
setType
(
tpe
),
200
),
200
))
case
_
=>
case
_
=>
...
...
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