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
214e8a2d
Commit
214e8a2d
authored
12 years ago
by
Régis Blanc
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of laragit.epfl.ch:projects/leon-2.0
parents
8e3f3946
6ab2a679
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/scala/leon/test/solvers/z3/BugWithEmptySet.scala
+50
-0
50 additions, 0 deletions
src/test/scala/leon/test/solvers/z3/BugWithEmptySet.scala
testcases/synthesis/BinaryTree.scala
+18
-0
18 additions, 0 deletions
testcases/synthesis/BinaryTree.scala
with
68 additions
and
0 deletions
src/test/scala/leon/test/solvers/z3/BugWithEmptySet.scala
0 → 100644
+
50
−
0
View file @
214e8a2d
package
leon.test.solvers.z3
import
leon.purescala.Common._
import
leon.purescala.Definitions._
import
leon.purescala.Trees._
import
leon.purescala.TreeOps._
import
leon.purescala.TypeTrees._
import
leon.SilentReporter
import
leon.solvers.Solver
import
leon.solvers.z3.UninterpretedZ3Solver
import
org.scalatest.FunSuite
class
BugWithEmptySet
extends
FunSuite
{
private
val
emptyProgram
=
Program
(
FreshIdentifier
(
"empty"
),
ObjectDef
(
FreshIdentifier
(
"empty"
),
Nil
,
Nil
))
test
(
"No distinction between Set() and Set.empty"
)
{
val
tInt
=
Int32Type
val
tIntSet
=
SetType
(
Int32Type
)
val
e1
=
EmptySet
(
tInt
).
setType
(
tIntSet
)
assert
(
e1
.
getType
===
tIntSet
)
val
e2
=
FiniteSet
(
Nil
).
setType
(
tIntSet
)
assert
(
e2
.
getType
===
tIntSet
)
val
s0
=
FiniteSet
(
Seq
(
IntLiteral
(
0
))).
setType
(
tIntSet
)
val
f1
=
Equals
(
e1
,
e2
)
val
silentReporter
=
new
SilentReporter
val
solver
:
Solver
=
new
UninterpretedZ3Solver
(
silentReporter
)
solver
.
setProgram
(
emptyProgram
)
assert
(
solver
.
solve
(
f1
)
===
Some
(
true
),
"Z3 should prove the equivalence between Ø and {}."
)
val
f2
=
Equals
(
e1
,
SetDifference
(
e1
,
s0
))
assert
(
solver
.
solve
(
f2
)
===
Some
(
true
),
"""Z3 should prove Ø = Ø \ {0}"""
)
val
f3
=
Equals
(
e2
,
SetDifference
(
e2
,
s0
))
assert
(
solver
.
solve
(
f3
)
===
Some
(
true
),
"""Z3 should prove {} = {} \ {0}"""
)
}
}
This diff is collapsed.
Click to expand it.
testcases/synthesis/BinaryTree.scala
0 → 100644
+
18
−
0
View file @
214e8a2d
import
scala.collection.immutable.Set
import
leon.Annotations._
import
leon.Utils._
object
BinaryTree
{
sealed
abstract
class
Tree
case
class
Node
(
left
:
Tree
,
value
:
Int
,
right
:
Tree
)
extends
Tree
case
class
Leaf
()
extends
Tree
def
content
(
t
:
Tree
)
:
Set
[
Int
]
=
t
match
{
case
Leaf
()
=>
Set
.
empty
[
Int
]
case
Node
(
l
,
v
,
r
)
=>
content
(
l
)
++
Set
(
v
)
++
content
(
r
)
}
def
delete
(
in
:
Tree
,
v
:
Int
)
=
choose
{
(
out
:
Tree
)
=>
content
(
out
)
==
(
content
(
in
)
--
Set
(
v
))
}
}
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