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
79178cb0
Commit
79178cb0
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Implement case-split
parent
28eaf0ed
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/Rules.scala
+20
-1
20 additions, 1 deletion
src/main/scala/leon/synthesis/Rules.scala
testcases/Choose.scala
+2
-0
2 additions, 0 deletions
testcases/Choose.scala
with
22 additions
and
1 deletion
src/main/scala/leon/synthesis/Rules.scala
+
20
−
1
View file @
79178cb0
...
...
@@ -8,7 +8,8 @@ import purescala.TypeTrees._
object
Rules
{
def
all
(
synth
:
Synthesizer
)
=
List
(
new
OnePoint
(
synth
),
new
Ground
(
synth
)
new
Ground
(
synth
),
new
CaseSplit
(
synth
)
)
}
...
...
@@ -90,3 +91,21 @@ class Ground(synth: Synthesizer) extends Rule("Ground", synth) {
}
}
}
class
CaseSplit
(
synth
:
Synthesizer
)
extends
Rule
(
"Case-Split"
,
synth
)
{
def
isApplicable
(
p
:
Problem
,
parent
:
Task
)
:
List
[
Task
]
=
{
p
.
phi
match
{
case
Or
(
Seq
(
o1
,
o2
))
=>
val
sub1
=
Problem
(
p
.
as
,
o1
,
p
.
xs
)
val
sub2
=
Problem
(
p
.
as
,
o2
,
p
.
xs
)
val
onSuccess
:
List
[
Solution
]
=>
Solution
=
{
case
List
(
s1
,
s2
)
=>
Solution
(
Or
(
s1
.
pre
,
s2
.
pre
),
IfExpr
(
s1
.
pre
,
s1
.
term
,
s2
.
term
))
}
List
(
new
Task
(
synth
,
parent
,
this
,
p
,
List
(
sub1
,
sub2
),
onSuccess
,
100
))
case
_
=>
Nil
}
}
}
This diff is collapsed.
Click to expand it.
testcases/Choose.scala
+
2
−
0
View file @
79178cb0
...
...
@@ -5,6 +5,8 @@ object ChooseTest {
def
c0
()
:
Int
=
choose
{
(
x1
:
Int
)
=>
x1
>
13
}
def
b0
()
:
Int
=
choose
{
(
x1
:
Int
)
=>
x1
>
13
&&
x1
<
2
}
def
t0
(
a
:
Int
)
:
Int
=
choose
{
(
x1
:
Int
)
=>
(
a
>
13
&&
x1
==
2
)
||
(
a
<
2
&&
x1
==
0
)
}
def
c1
(
a
:
Int
)
:
Int
=
choose
{
(
x1
:
Int
)
=>
x1
>
a
}
def
c2
(
a
:
Int
)
:
(
Int
,
Int
)
=
choose
{
(
x1
:
Int
,
x2
:
Int
)
=>
x1
>
a
&&
x2
>
a
}
def
c3
(
a
:
Int
)
:
(
Int
,
Int
,
Int
)
=
choose
{
(
x1
:
Int
,
x2
:
Int
,
x3
:
Int
)
=>
x1
>
a
&&
x2
>
a
}
...
...
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