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
cac2626a
Commit
cac2626a
authored
9 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Put Model in different file
parent
2666d873
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/main/scala/leon/solvers/Model.scala
+80
-0
80 additions, 0 deletions
src/main/scala/leon/solvers/Model.scala
src/main/scala/leon/solvers/Solver.scala
+2
-75
2 additions, 75 deletions
src/main/scala/leon/solvers/Solver.scala
with
82 additions
and
75 deletions
src/main/scala/leon/solvers/Model.scala
0 → 100644
+
80
−
0
View file @
cac2626a
/* Copyright 2009-2015 EPFL, Lausanne */
package
leon
package
solvers
import
purescala.Expressions._
import
purescala.Common.Identifier
import
purescala.ExprOps._
trait
AbstractModel
[
+This
<:
Model
with
AbstractModel
[
This
]]
extends
scala
.
collection
.
IterableLike
[(
Identifier
,
Expr
)
,
This
]
{
protected
val
mapping
:
Map
[
Identifier
,
Expr
]
def
fill
(
allVars
:
Iterable
[
Identifier
])
:
This
=
{
val
builder
=
newBuilder
builder
++=
mapping
++
(
allVars
.
toSet
--
mapping
.
keys
).
map
(
id
=>
id
->
simplestValue
(
id
.
getType
))
builder
.
result
}
def
++
(
mapping
:
Map
[
Identifier
,
Expr
])
:
This
=
{
val
builder
=
newBuilder
builder
++=
this
.
mapping
++
mapping
builder
.
result
}
def
filter
(
allVars
:
Iterable
[
Identifier
])
:
This
=
{
val
builder
=
newBuilder
for
(
p
<-
mapping
.
filterKeys
(
allVars
.
toSet
))
{
builder
+=
p
}
builder
.
result
}
def
iterator
=
mapping
.
iterator
def
seq
=
mapping
.
seq
def
asString
(
implicit
ctx
:
LeonContext
)
=
{
if
(
mapping
.
isEmpty
)
{
"Model()"
}
else
{
(
for
((
k
,
v
)
<-
mapping
.
toSeq
.
sortBy
(
_
.
_1
))
yield
{
f
" ${k.asString}%-20s -> ${v.asString}"
}).
mkString
(
"Model(\n"
,
",\n"
,
")"
)
}
}
}
trait
AbstractModelBuilder
[
+This
<:
Model
with
AbstractModel
[
This
]]
extends
scala
.
collection
.
mutable
.
Builder
[(
Identifier
,
Expr
)
,
This
]
{
import
scala.collection.mutable.MapBuilder
protected
val
mapBuilder
=
new
MapBuilder
[
Identifier
,
Expr
,
Map
[
Identifier
,
Expr
]](
Map
.
empty
)
def
+=
(
elem
:
(
Identifier
,
Expr
))
:
this.
type
=
{
mapBuilder
+=
elem
this
}
def
clear
()
:
Unit
=
mapBuilder
.
clear
}
class
Model
(
protected
val
mapping
:
Map
[
Identifier
,
Expr
])
extends
AbstractModel
[
Model
]
with
(
Identifier
=>
Expr
)
{
def
newBuilder
=
new
ModelBuilder
def
isDefinedAt
(
id
:
Identifier
)
:
Boolean
=
mapping
.
isDefinedAt
(
id
)
def
get
(
id
:
Identifier
)
:
Option
[
Expr
]
=
mapping
.
get
(
id
)
def
getOrElse
[
E
>:
Expr
](
id
:
Identifier
,
e
:
E
)
:
E
=
get
(
id
).
getOrElse
(
e
)
def
apply
(
id
:
Identifier
)
:
Expr
=
get
(
id
).
getOrElse
{
throw
new
IllegalArgumentException
}
}
object
Model
{
def
empty
=
new
Model
(
Map
.
empty
)
}
class
ModelBuilder
extends
AbstractModelBuilder
[
Model
]
{
def
result
=
new
Model
(
mapBuilder
.
result
)
}
This diff is collapsed.
Click to expand it.
src/main/scala/leon/solvers/Solver.scala
+
2
−
75
View file @
cac2626a
...
...
@@ -3,84 +3,11 @@
package
leon
package
solvers
import
leon.utils.
{
Position
,
DebugSectionSolver
,
Interruptible
}
import
leon.utils.
{
DebugSectionSolver
,
Interruptible
}
import
purescala.Expressions._
import
purescala.Common.
{
Tree
,
Identifier
}
import
purescala.ExprOps._
import
purescala.Common.Tree
import
verification.VC
trait
AbstractModel
[
+This
<:
Model
with
AbstractModel
[
This
]]
extends
scala
.
collection
.
IterableLike
[(
Identifier
,
Expr
)
,
This
]
{
protected
val
mapping
:
Map
[
Identifier
,
Expr
]
def
fill
(
allVars
:
Iterable
[
Identifier
])
:
This
=
{
val
builder
=
newBuilder
builder
++=
mapping
++
(
allVars
.
toSet
--
mapping
.
keys
).
map
(
id
=>
id
->
simplestValue
(
id
.
getType
))
builder
.
result
}
def
++
(
mapping
:
Map
[
Identifier
,
Expr
])
:
This
=
{
val
builder
=
newBuilder
builder
++=
this
.
mapping
++
mapping
builder
.
result
}
def
filter
(
allVars
:
Iterable
[
Identifier
])
:
This
=
{
val
builder
=
newBuilder
for
(
p
<-
mapping
.
filterKeys
(
allVars
.
toSet
))
{
builder
+=
p
}
builder
.
result
}
def
iterator
=
mapping
.
iterator
def
seq
=
mapping
.
seq
def
asString
(
implicit
ctx
:
LeonContext
)
=
{
if
(
mapping
.
isEmpty
)
{
"Model()"
}
else
{
(
for
((
k
,
v
)
<-
mapping
.
toSeq
.
sortBy
(
_
.
_1
))
yield
{
f
" ${k.asString}%-20s -> ${v.asString}"
}).
mkString
(
"Model(\n"
,
",\n"
,
")"
)
}
}
}
trait
AbstractModelBuilder
[
+This
<:
Model
with
AbstractModel
[
This
]]
extends
scala
.
collection
.
mutable
.
Builder
[(
Identifier
,
Expr
)
,
This
]
{
import
scala.collection.mutable.MapBuilder
protected
val
mapBuilder
=
new
MapBuilder
[
Identifier
,
Expr
,
Map
[
Identifier
,
Expr
]](
Map
.
empty
)
def
+=
(
elem
:
(
Identifier
,
Expr
))
:
this.
type
=
{
mapBuilder
+=
elem
this
}
def
clear
()
:
Unit
=
mapBuilder
.
clear
}
class
Model
(
protected
val
mapping
:
Map
[
Identifier
,
Expr
])
extends
AbstractModel
[
Model
]
with
(
Identifier
=>
Expr
)
{
def
newBuilder
=
new
ModelBuilder
def
isDefinedAt
(
id
:
Identifier
)
:
Boolean
=
mapping
.
isDefinedAt
(
id
)
def
get
(
id
:
Identifier
)
:
Option
[
Expr
]
=
mapping
.
get
(
id
)
def
getOrElse
[
E
>:
Expr
](
id
:
Identifier
,
e
:
E
)
:
E
=
get
(
id
).
getOrElse
(
e
)
def
apply
(
id
:
Identifier
)
:
Expr
=
get
(
id
).
getOrElse
{
throw
new
IllegalArgumentException
}
}
object
Model
{
def
empty
=
new
Model
(
Map
.
empty
)
}
class
ModelBuilder
extends
AbstractModelBuilder
[
Model
]
{
def
result
=
new
Model
(
mapBuilder
.
result
)
}
trait
Solver
extends
Interruptible
{
def
name
:
String
val
context
:
LeonContext
...
...
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