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
25b5159f
Commit
25b5159f
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
OptimisticGround can take time, so we do the work on application rather than instantiation.
parent
4fad2012
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/leon/synthesis/rules/OptimisticGround.scala
+41
-36
41 additions, 36 deletions
src/main/scala/leon/synthesis/rules/OptimisticGround.scala
with
41 additions
and
36 deletions
src/main/scala/leon/synthesis/rules/OptimisticGround.scala
+
41
−
36
View file @
25b5159f
...
@@ -10,57 +10,62 @@ import purescala.Extractors._
...
@@ -10,57 +10,62 @@ import purescala.Extractors._
case
object
OptimisticGround
extends
Rule
(
"Optimistic Ground"
)
{
case
object
OptimisticGround
extends
Rule
(
"Optimistic Ground"
)
{
def
instantiateOn
(
sctx
:
SynthesisContext
,
p
:
Problem
)
:
Traversable
[
RuleInstantiation
]
=
{
def
instantiateOn
(
sctx
:
SynthesisContext
,
p
:
Problem
)
:
Traversable
[
RuleInstantiation
]
=
{
if
(!
p
.
as
.
isEmpty
&&
!
p
.
xs
.
isEmpty
)
{
if
(!
p
.
as
.
isEmpty
&&
!
p
.
xs
.
isEmpty
)
{
val
xss
=
p
.
xs
.
toSet
val
res
=
new
RuleInstantiation
(
p
,
this
,
SolutionBuilder
.
none
)
{
val
ass
=
p
.
as
.
toSet
def
apply
(
sctx
:
SynthesisContext
)
=
{
val
xss
=
p
.
xs
.
toSet
val
ass
=
p
.
as
.
toSet
val
tpe
=
TupleType
(
p
.
xs
.
map
(
_
.
getType
))
val
tpe
=
TupleType
(
p
.
xs
.
map
(
_
.
getType
))
var
i
=
0
;
var
i
=
0
;
var
maxTries
=
3
;
var
maxTries
=
3
;
var
result
:
Option
[
Rule
Instantiation
]
=
None
var
result
:
Option
[
Rule
ApplicationResult
]
=
None
var
continue
=
true
var
continue
=
true
var
predicates
:
Seq
[
Expr
]
=
Seq
()
var
predicates
:
Seq
[
Expr
]
=
Seq
()
while
(
result
.
isEmpty
&&
i
<
maxTries
&&
continue
)
{
while
(
result
.
isEmpty
&&
i
<
maxTries
&&
continue
)
{
val
phi
=
And
(
p
.
pc
+:
p
.
phi
+:
predicates
)
val
phi
=
And
(
p
.
pc
+:
p
.
phi
+:
predicates
)
//println("SOLVING " + phi + " ...")
//println("SOLVING " + phi + " ...")
sctx
.
solver
.
solveSAT
(
phi
)
match
{
sctx
.
solver
.
solveSAT
(
phi
)
match
{
case
(
Some
(
true
),
satModel
)
=>
case
(
Some
(
true
),
satModel
)
=>
val
satXsModel
=
satModel
.
filterKeys
(
xss
)
val
satXsModel
=
satModel
.
filterKeys
(
xss
)
val
newPhi
=
valuateWithModelIn
(
phi
,
xss
,
satModel
)
val
newPhi
=
valuateWithModelIn
(
phi
,
xss
,
satModel
)
//println("REFUTING " + Not(newPhi) + "...")
//println("REFUTING " + Not(newPhi) + "...")
sctx
.
solver
.
solveSAT
(
Not
(
newPhi
))
match
{
sctx
.
solver
.
solveSAT
(
Not
(
newPhi
))
match
{
case
(
Some
(
true
),
invalidModel
)
=>
case
(
Some
(
true
),
invalidModel
)
=>
// Found as such as the xs break, refine predicates
// Found as such as the xs break, refine predicates
predicates
=
valuateWithModelIn
(
phi
,
ass
,
invalidModel
)
+:
predicates
predicates
=
valuateWithModelIn
(
phi
,
ass
,
invalidModel
)
+:
predicates
case
(
Some
(
false
),
_
)
=>
case
(
Some
(
false
),
_
)
=>
result
=
Some
(
RuleInstantiation
.
immediateSuccess
(
p
,
this
,
Solution
(
BooleanLiteral
(
true
),
Set
(),
Tuple
(
p
.
xs
.
map
(
valuateWithModel
(
satModel
))).
setType
(
tpe
))))
result
=
Some
(
RuleSuccess
(
Solution
(
BooleanLiteral
(
true
),
Set
(),
Tuple
(
p
.
xs
.
map
(
valuateWithModel
(
satModel
))).
setType
(
tpe
))))
case
_
=>
continue
=
false
result
=
None
}
case
(
Some
(
false
),
_
)
=>
if
(
predicates
.
isEmpty
)
{
result
=
Some
(
RuleSuccess
(
Solution
(
BooleanLiteral
(
false
),
Set
(),
Error
(
p
.
phi
+
" is UNSAT!"
).
setType
(
tpe
))))
}
else
{
continue
=
false
result
=
None
}
case
_
=>
case
_
=>
continue
=
false
continue
=
false
result
=
None
result
=
None
}
}
case
(
Some
(
false
),
_
)
=>
i
+=
1
if
(
predicates
.
isEmpty
)
{
}
result
=
Some
(
RuleInstantiation
.
immediateSuccess
(
p
,
this
,
Solution
(
BooleanLiteral
(
false
),
Set
(),
Error
(
p
.
phi
+
" is UNSAT!"
).
setType
(
tpe
))))
}
else
{
continue
=
false
result
=
None
}
case
_
=>
continue
=
false
result
=
None
}
i
+=
1
result
.
getOrElse
(
RuleApplicationImpossible
)
}
}
}
List
(
res
)
result
}
else
{
}
else
{
Nil
Nil
}
}
...
...
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