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
cfcdbc75
Commit
cfcdbc75
authored
9 years ago
by
Mikaël Mayer
Browse files
Options
Downloads
Patches
Plain Diff
Better typed functions and direct mapping to smt-lib
parent
1e27a99e
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/smtlib/SMTLIBZ3Target.scala
+10
-11
10 additions, 11 deletions
src/main/scala/leon/solvers/smtlib/SMTLIBZ3Target.scala
with
10 additions
and
11 deletions
src/main/scala/leon/solvers/smtlib/SMTLIBZ3Target.scala
+
10
−
11
View file @
cfcdbc75
...
...
@@ -9,13 +9,11 @@ import purescala.Expressions._
import
purescala.Constructors._
import
purescala.Types._
import
purescala.Definitions._
import
_root_.smtlib.parser.Terms.
{
Identifier
=>
SMTIdentifier
,
_
}
import
_root_.smtlib.parser.Commands.
{
FunDef
=>
SMTFunDef
,
_
}
import
_root_.smtlib.interpreters.Z3Interpreter
import
_root_.smtlib.theories.Core.
{
Equals
=>
SMTEquals
,
_
}
import
_root_.smtlib.theories.ArraysEx
import
utils.Bijection
trait
SMTLIBZ3Target
extends
SMTLIBTarget
{
...
...
@@ -90,11 +88,11 @@ trait SMTLIBZ3Target extends SMTLIBTarget {
case
Some
(
fd
)
=>
fd
case
_
=>
throw
new
Exception
(
"Could not find function "
+
s
+
" in program"
)
}
lazy
val
list_size
=
lookupFunDef
(
"leon.collection.List.size"
)
lazy
val
list_++
=
lookupFunDef
(
"leon.collection.List.++"
)
lazy
val
list_take
=
lookupFunDef
(
"leon.collection.List.take"
)
lazy
val
list_drop
=
lookupFunDef
(
"leon.collection.List.drop"
)
lazy
val
list_slice
=
lookupFunDef
(
"leon.collection.List.slice"
)
lazy
val
list_size
=
lookupFunDef
(
"leon.collection.List.size"
)
.
typed
(
Seq
(
CharType
))
lazy
val
list_++
=
lookupFunDef
(
"leon.collection.List.++"
)
.
typed
(
Seq
(
CharType
))
lazy
val
list_take
=
lookupFunDef
(
"leon.collection.List.take"
)
.
typed
(
Seq
(
CharType
))
lazy
val
list_drop
=
lookupFunDef
(
"leon.collection.List.drop"
)
.
typed
(
Seq
(
CharType
))
lazy
val
list_slice
=
lookupFunDef
(
"leon.collection.List.slice"
)
.
typed
(
Seq
(
CharType
))
override
protected
def
fromSMT
(
t
:
Term
,
otpe
:
Option
[
TypeTree
]
=
None
)
...
...
@@ -188,13 +186,14 @@ trait SMTLIBZ3Target extends SMTLIBTarget {
}
toSMT
(
stringEncoding
)
case
StringLength
(
a
)
=>
toSMT
(
functionInvoca
tion
(
list_size
,
Seq
(
a
)))
FunctionApplication
(
declareFunc
tion
(
list_size
)
,
Seq
(
toSMT
(
a
)))
case
StringConcat
(
a
,
b
)
=>
toSMT
(
functionInvoca
tion
(
list_++
,
Seq
(
a
,
b
)))
FunctionApplication
(
declareFunc
tion
(
list_++
)
,
Seq
(
toSMT
(
a
),
toSMT
(
b
)))
case
SubString
(
a
,
start
,
Plus
(
start2
,
length
))
if
start
==
start2
=>
toSMT
(
functionInvocation
(
list_take
,
Seq
(
functionInvocation
(
list_drop
,
Seq
(
a
,
start
)),
length
)))
FunctionApplication
(
declareFunction
(
list_take
),
Seq
(
FunctionApplication
(
declareFunction
(
list_drop
),
Seq
(
toSMT
(
a
),
toSMT
(
start
))),
toSMT
(
length
)))
case
SubString
(
a
,
start
,
end
)
=>
toSMT
(
functionInvoca
tion
(
list_slice
,
Seq
(
a
,
start
,
end
)))
FunctionApplication
(
declareFunc
tion
(
list_slice
)
,
Seq
(
toSMT
(
a
),
toSMT
(
start
)
,
toSMT
(
end
)))
case
_
=>
super
.
toSMT
(
e
)
}
...
...
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