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
64d0ac90
Commit
64d0ac90
authored
9 years ago
by
Nicolas Voirol
Browse files
Options
Downloads
Patches
Plain Diff
Fix non-bijective sorts in AbstractZ3Solver
parent
eb93ed8a
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
src/main/scala/leon/solvers/z3/AbstractZ3Solver.scala
+9
-8
9 additions, 8 deletions
src/main/scala/leon/solvers/z3/AbstractZ3Solver.scala
with
9 additions
and
8 deletions
src/main/scala/leon/solvers/z3/AbstractZ3Solver.scala
+
9
−
8
View file @
64d0ac90
...
@@ -92,13 +92,14 @@ trait AbstractZ3Solver extends Solver {
...
@@ -92,13 +92,14 @@ trait AbstractZ3Solver extends Solver {
// Bijections between Leon Types/Functions/Ids to Z3 Sorts/Decls/ASTs
// Bijections between Leon Types/Functions/Ids to Z3 Sorts/Decls/ASTs
protected
val
functions
=
new
IncrementalBijection
[
TypedFunDef
,
Z3FuncDecl
]()
protected
val
functions
=
new
IncrementalBijection
[
TypedFunDef
,
Z3FuncDecl
]()
protected
val
lambdas
=
new
IncrementalBijection
[
FunctionType
,
Z3FuncDecl
]()
protected
val
lambdas
=
new
IncrementalBijection
[
FunctionType
,
Z3FuncDecl
]()
protected
val
sorts
=
new
IncrementalBijection
[
TypeTree
,
Z3Sort
]()
protected
val
variables
=
new
IncrementalBijection
[
Expr
,
Z3AST
]()
protected
val
variables
=
new
IncrementalBijection
[
Expr
,
Z3AST
]()
protected
val
constructors
=
new
IncrementalBijection
[
TypeTree
,
Z3FuncDecl
]()
protected
val
constructors
=
new
IncrementalBijection
[
TypeTree
,
Z3FuncDecl
]()
protected
val
selectors
=
new
IncrementalBijection
[(
TypeTree
,
Int
)
,
Z3FuncDecl
]()
protected
val
selectors
=
new
IncrementalBijection
[(
TypeTree
,
Int
)
,
Z3FuncDecl
]()
protected
val
testers
=
new
IncrementalBijection
[
TypeTree
,
Z3FuncDecl
]()
protected
val
testers
=
new
IncrementalBijection
[
TypeTree
,
Z3FuncDecl
]()
protected
val
sorts
=
new
IncrementalMap
[
TypeTree
,
Z3Sort
]()
var
isInitialized
=
false
var
isInitialized
=
false
protected
[
leon
]
def
initZ3
()
:
Unit
=
{
protected
[
leon
]
def
initZ3
()
:
Unit
=
{
if
(!
isInitialized
)
{
if
(!
isInitialized
)
{
...
@@ -108,11 +109,11 @@ trait AbstractZ3Solver extends Solver {
...
@@ -108,11 +109,11 @@ trait AbstractZ3Solver extends Solver {
functions
.
clear
()
functions
.
clear
()
lambdas
.
clear
()
lambdas
.
clear
()
sorts
.
clear
()
variables
.
clear
()
variables
.
clear
()
constructors
.
clear
()
constructors
.
clear
()
selectors
.
clear
()
selectors
.
clear
()
testers
.
clear
()
testers
.
clear
()
sorts
.
reset
()
prepareSorts
()
prepareSorts
()
...
@@ -136,7 +137,7 @@ trait AbstractZ3Solver extends Solver {
...
@@ -136,7 +137,7 @@ trait AbstractZ3Solver extends Solver {
adtManager
.
defineADT
(
t
)
match
{
adtManager
.
defineADT
(
t
)
match
{
case
Left
(
adts
)
=>
case
Left
(
adts
)
=>
declareDatatypes
(
adts
.
toSeq
)
declareDatatypes
(
adts
.
toSeq
)
sorts
.
toB
(
normalizeType
(
t
))
sorts
(
normalizeType
(
t
))
case
Right
(
conflicts
)
=>
case
Right
(
conflicts
)
=>
conflicts
.
foreach
{
declareStructuralSort
}
conflicts
.
foreach
{
declareStructuralSort
}
...
@@ -217,15 +218,15 @@ trait AbstractZ3Solver extends Solver {
...
@@ -217,15 +218,15 @@ trait AbstractZ3Solver extends Solver {
// assumes prepareSorts has been called....
// assumes prepareSorts has been called....
protected
[
leon
]
def
typeToSort
(
oldtt
:
TypeTree
)
:
Z3Sort
=
normalizeType
(
oldtt
)
match
{
protected
[
leon
]
def
typeToSort
(
oldtt
:
TypeTree
)
:
Z3Sort
=
normalizeType
(
oldtt
)
match
{
case
Int32Type
|
BooleanType
|
IntegerType
|
RealType
|
CharType
=>
case
Int32Type
|
BooleanType
|
IntegerType
|
RealType
|
CharType
=>
sorts
.
toB
(
oldtt
)
sorts
(
oldtt
)
case
tpe
@
(
_:
ClassType
|
_
:
ArrayType
|
_
:
TupleType
|
_
:
TypeParameter
|
UnitType
)
=>
case
tpe
@
(
_:
ClassType
|
_
:
ArrayType
|
_
:
TupleType
|
_
:
TypeParameter
|
UnitType
)
=>
sorts
.
cached
B
(
tpe
)
{
sorts
.
cached
(
tpe
)
{
declareStructuralSort
(
tpe
)
declareStructuralSort
(
tpe
)
}
}
case
tt
@
SetType
(
base
)
=>
case
tt
@
SetType
(
base
)
=>
sorts
.
cached
B
(
tt
)
{
sorts
.
cached
(
tt
)
{
z3
.
mkSetSort
(
typeToSort
(
base
))
z3
.
mkSetSort
(
typeToSort
(
base
))
}
}
...
@@ -233,7 +234,7 @@ trait AbstractZ3Solver extends Solver {
...
@@ -233,7 +234,7 @@ trait AbstractZ3Solver extends Solver {
typeToSort
(
RawArrayType
(
fromType
,
library
.
optionType
(
toType
)))
typeToSort
(
RawArrayType
(
fromType
,
library
.
optionType
(
toType
)))
case
rat
@
RawArrayType
(
from
,
to
)
=>
case
rat
@
RawArrayType
(
from
,
to
)
=>
sorts
.
cached
B
(
rat
)
{
sorts
.
cached
(
rat
)
{
val
fromSort
=
typeToSort
(
from
)
val
fromSort
=
typeToSort
(
from
)
val
toSort
=
typeToSort
(
to
)
val
toSort
=
typeToSort
(
to
)
...
@@ -241,7 +242,7 @@ trait AbstractZ3Solver extends Solver {
...
@@ -241,7 +242,7 @@ trait AbstractZ3Solver extends Solver {
}
}
case
ft
@
FunctionType
(
from
,
to
)
=>
case
ft
@
FunctionType
(
from
,
to
)
=>
sorts
.
cached
B
(
ft
)
{
sorts
.
cached
(
ft
)
{
val
symbol
=
z3
.
mkFreshStringSymbol
(
ft
.
toString
)
val
symbol
=
z3
.
mkFreshStringSymbol
(
ft
.
toString
)
z3
.
mkUninterpretedSort
(
symbol
)
z3
.
mkUninterpretedSort
(
symbol
)
}
}
...
...
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