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
182106ab
Commit
182106ab
authored
10 years ago
by
Emmanouil (Manos) Koukoutos
Committed by
Etienne Kneuss
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Two more benchmarks
parent
914e24f9
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
testcases/synthesis/repair/Naturals/Naturals.scala
+83
-0
83 additions, 0 deletions
testcases/synthesis/repair/Naturals/Naturals.scala
testcases/synthesis/repair/Parser/Parser.scala
+59
-0
59 additions, 0 deletions
testcases/synthesis/repair/Parser/Parser.scala
with
142 additions
and
0 deletions
testcases/synthesis/repair/Naturals/Naturals.scala
0 → 100644
+
83
−
0
View file @
182106ab
import
leon.lang.synthesis._
object
Naturals
{
abstract
class
Nat
{
def
intValue
:
Int
=
{
this
match
{
case
Zero
=>
0
case
Succ
(
n
)
=>
n
.
intValue
+
1
}}
ensuring
{
_
>=
0
}
def
+
(
that
:
Nat
)
:
Nat
=
{
this
match
{
case
Zero
=>
that
case
Succ
(
n
)
=>
n
+
Succ
(
that
)
}}
ensuring
{
_
.
intValue
==
this
.
intValue
+
that
.
intValue
}
def
<=
(
that
:
Nat
)
:
Boolean
=
{
(
this
,
that
)
match
{
case
(
Zero
,
_
)
=>
true
case
(
_
,
Zero
)
=>
false
case
(
Succ
(
n1
),
Succ
(
n2
))
=>
n1
<=
n2
}}
ensuring
{
_
==
this
.
intValue
<=
that
.
intValue
}
def
>
(
that
:
Nat
)
=
!(
this
<=
that
)
def
-
(
that
:
Nat
)
:
Nat
=
{
require
(
that
<=
this
)
(
this
,
that
)
match
{
case
(
_
,
Zero
)
=>
this
case
(
Succ
(
n1
),
Succ
(
n2
))
=>
n1
-
n2
}
}
ensuring
{
_
.
intValue
==
this
.
intValue
-
that
.
intValue
}
def
*
(
that
:
Nat
)
:
Nat
=
{
this
match
{
case
Zero
=>
Zero
case
Succ
(
n
)
=>
that
+
n
*
that
}}
ensuring
{
_
.
intValue
==
this
.
intValue
*
that
.
intValue
}
/*
def /(that : Nat) : Nat = {
require(that > Zero)
if (that <= this) (this - that)/ that + one
else Zero
} ensuring { _.intValue == this.intValue / that.intValue }
def %(that : Nat) : Nat = {
require(that > Zero)
this - (this / that) * that
} ensuring { _.intValue == this.intValue % that.intValue }
// Convension : least s. digit first
def isDecimalRepr(l : List[Nat]) : Boolean = l match {
case Nil() => false
case Cons(h, t) => h <= ten && isDecimalRepr(t)
}
def decimalToNat(l : List[Nat]) : Nat = {
require(isDecimalRepr(l))
l match {
case Cons(h, Nil()) => h
case Cons(h, t) => 10 * decimalToNat(t) + h
}
}
*/
}
case
object
Zero
extends
Nat
case
class
Succ
(
n
:
Nat
)
extends
Nat
def
ten
=
{
val
two
=
Succ
(
Succ
(
Zero
))
val
five
=
Succ
(
two
+
two
)
two
*
five
}
def
fortyTwo
=
{
val
one
=
Succ
(
Zero
)
val
two
=
one
+
one
val
three
=
two
+
one
val
seven
=
(
two
*
three
)
+
one
two
*
three
*
seven
}
ensuring
{
_
.
intValue
==
42
}
}
This diff is collapsed.
Click to expand it.
testcases/synthesis/repair/Parser/Parser.scala
0 → 100644
+
59
−
0
View file @
182106ab
import
leon._
import
leon.lang.string._
import
leon.collection._
object
Parser
{
abstract
class
Token
case
object
LParen
extends
Token
case
object
RParen
extends
Token
case
class
Id
(
id
:
Int
)
extends
Token
abstract
class
Tree
case
class
App
(
args
:
List
[
Tree
])
extends
Tree
case
class
Leaf
(
id
:
Int
)
extends
Tree
def
parse
(
in
:
List
[
Token
])
:
(
Option
[
Tree
],
List
[
Token
])
=
{
in
match
{
case
Cons
(
Id
(
s
),
tl
)
=>
(
Some
[
Tree
](
Leaf
(
s
)),
tl
)
case
Cons
(
LParen
,
tl
)
=>
parseMany
(
tl
)
match
{
case
(
Some
(
trees
:
Cons
[
Tree
]),
Cons
(
RParen
,
rest
))
=>
(
Some
[
Tree
](
App
(
trees
)),
rest
)
case
(
_
,
rest
)
=>
(
None
[
Tree
](),
rest
)
}
case
_
=>
(
None
[
Tree
](),
in
)
}}
ensuring
{
_
match
{
case
(
Some
(
tree
),
rest
@Cons
(
h
,
_
))
=>
print
(
tree
,
rest
)
==
in
// case ( None(), Cons(h,_)) => !h.isInstanceOf[Id]
// case ( None(), Nil) =>
case
_
=>
true
}}
def
parseMany
(
in
:
List
[
Token
])
:
(
Option
[
List
[
Tree
]],
List
[
Token
])
=
{
parse
(
in
)
match
{
case
(
None
(),
rest
)
if
rest
==
in
=>
(
Some
[
List
[
Tree
]](
Nil
()),
in
)
case
(
None
(),
rest
)
=>
(
None
[
List
[
Tree
]](),
rest
)
case
(
Some
(
tree
),
rest
)
=>
parseMany
(
rest
)
match
{
case
(
None
(),
rest2
)
=>
(
None
[
List
[
Tree
]](),
rest2
)
case
(
Some
(
trees
),
rest2
)
=>
(
Some
[
List
[
Tree
]](
tree
::
trees
),
rest2
)
}
}}
ensuring
{
_
match
{
case
(
Some
(
t
),
rest
@Cons
(
h
,
_
)
)
=>
h
==
RParen
&&
printL
(
t
,
rest
)
==
in
case
(
None
(),
Cons
(
h
,
_
))
=>
h
==
RParen
case
_
=>
true
}}
def
printL
(
args
:
List
[
Tree
],
rest
:
List
[
Token
])
:
List
[
Token
]
=
args
match
{
case
Nil
()
=>
rest
case
Cons
(
h
,
t
)
=>
print
(
h
,
printL
(
t
,
rest
))
}
def
print
(
t
:
Tree
,
rest
:
List
[
Token
])
:
List
[
Token
]
=
t
match
{
case
Leaf
(
s
)
=>
Id
(
s
)
::
rest
case
App
(
args
)
=>
LParen
::
printL
(
args
,
RParen
::
rest
)
}
}
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