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
c3faa517
Commit
c3faa517
authored
9 years ago
by
Viktor Kuncak
Browse files
Options
Downloads
Patches
Plain Diff
I tried to formalize an algorithm from my paper and made mistake,
which Leon repaired so I understood what the problem was.
parent
dc7b1b80
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
testcases/repair/bijections/FirstRepair.scala
+44
-0
44 additions, 0 deletions
testcases/repair/bijections/FirstRepair.scala
with
44 additions
and
0 deletions
testcases/repair/bijections/FirstRepair.scala
0 → 100644
+
44
−
0
View file @
c3faa517
/* Viktor Kuncak, 2015-08-27
I tried to formalize linear bijection function for nested lists,
based on the paper:
Ivan Kuraj, Viktor Kuncak, and Daniel Jackson.
Programming with enumerable sets of structures. In OOPSLA, 2015.
Leon found a counterexample (which I did not quite understand), but
then synthesized an untrusted solution that looked similar (a bit
more concise in a few places) and had the role of two elements of
the tuple reversed. This made me realize I confused the order of
elements in the tuple.
*/
import
leon.lang._
import
leon.annotation._
import
leon.collection._
import
leon.collection.ListOps._
import
leon.lang.synthesis._
object
DisperseBijection
{
def
totalSize
[
A
](
l
:
List
[
List
[
A
]])
:
BigInt
=
{
l
.
map
(
_
.
size
).
foldRight
(
BigInt
(
0
))(
_
+
_
)
}
ensuring
(
res
=>
res
>=
0
)
def
lin1
[
A
](
l
:
List
[
List
[
A
]],
i
:
BigInt
)
:
(
BigInt
,
BigInt
)
=
{
require
(
0
<=
i
&&
i
<
totalSize
(
l
))
l
match
{
case
Cons
(
h
,
t
)
=>
{
val
s
=
h
.
size
if
(
i
<
s
)
(
i
,
BigInt
(
0
))
else
{
val
(
x1
,
y1
)
=
lin1
[
A
](
t
,
i
-
s
)
(
x1
,
y1
+
1
)
}
}
}
}.
ensuring
((
res
:
(
BigInt
,
BigInt
))
=>
{
res
match
{
case
(
x
,
y
)
=>
{
BigInt
(
0
)
<=
x
&&
x
<
l
.
size
&&
l
(
x
)(
y
)
==
flatten
(
l
)(
i
)
}
}})
}
\ No newline at end of file
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