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
3dc2bb81
Commit
3dc2bb81
authored
14 years ago
by
Philippe Suter
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
16e19131
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/funcheck/FunCheckPlugin.scala
+3
-1
3 additions, 1 deletion
src/funcheck/FunCheckPlugin.scala
src/purescala/FairZ3Solver.scala
+47
-11
47 additions, 11 deletions
src/purescala/FairZ3Solver.scala
src/purescala/Settings.scala
+1
-0
1 addition, 0 deletions
src/purescala/Settings.scala
with
51 additions
and
12 deletions
src/funcheck/FunCheckPlugin.scala
+
3
−
1
View file @
3dc2bb81
...
@@ -33,7 +33,8 @@ class FunCheckPlugin(val global: Global) extends Plugin {
...
@@ -33,7 +33,8 @@ class FunCheckPlugin(val global: Global) extends Plugin {
" -P:funcheck:quiet No info and warning messages from the extensions"
+
"\n"
+
" -P:funcheck:quiet No info and warning messages from the extensions"
+
"\n"
+
" -P:funcheck:XP Enable weird transformations and other bug-producing features"
+
"\n"
+
" -P:funcheck:XP Enable weird transformations and other bug-producing features"
+
"\n"
+
" -P:funcheck:PLDI PLDI 2011 settings. Now frozen. Not completely functional. See CAV."
+
"\n"
+
" -P:funcheck:PLDI PLDI 2011 settings. Now frozen. Not completely functional. See CAV."
+
"\n"
+
" -P:funcheck:CAV CAV 2011 settings. In progress."
" -P:funcheck:CAV CAV 2011 settings. In progress."
+
"\n"
+
" -P:funcheck:prune (with CAV) Use additional SMT queries to rule out some unrollings."
)
)
/** Processes the command-line options. */
/** Processes the command-line options. */
...
@@ -54,6 +55,7 @@ class FunCheckPlugin(val global: Global) extends Plugin {
...
@@ -54,6 +55,7 @@ class FunCheckPlugin(val global: Global) extends Plugin {
case
"XP"
=>
purescala
.
Settings
.
experimental
=
true
case
"XP"
=>
purescala
.
Settings
.
experimental
=
true
case
"PLDI"
=>
{
purescala
.
Settings
.
experimental
=
true
;
purescala
.
Settings
.
useInstantiator
=
true
;
purescala
.
Settings
.
useFairInstantiator
=
false
;
purescala
.
Settings
.
useBAPA
=
false
;
purescala
.
Settings
.
zeroInlining
=
true
}
case
"PLDI"
=>
{
purescala
.
Settings
.
experimental
=
true
;
purescala
.
Settings
.
useInstantiator
=
true
;
purescala
.
Settings
.
useFairInstantiator
=
false
;
purescala
.
Settings
.
useBAPA
=
false
;
purescala
.
Settings
.
zeroInlining
=
true
}
case
"CAV"
=>
{
purescala
.
Settings
.
experimental
=
true
;
purescala
.
Settings
.
useInstantiator
=
false
;
purescala
.
Settings
.
useFairInstantiator
=
true
;
purescala
.
Settings
.
useBAPA
=
false
;
purescala
.
Settings
.
zeroInlining
=
true
}
case
"CAV"
=>
{
purescala
.
Settings
.
experimental
=
true
;
purescala
.
Settings
.
useInstantiator
=
false
;
purescala
.
Settings
.
useFairInstantiator
=
true
;
purescala
.
Settings
.
useBAPA
=
false
;
purescala
.
Settings
.
zeroInlining
=
true
}
case
"prune"
=>
purescala
.
Settings
.
pruneBranches
=
true
case
s
if
s
.
startsWith
(
"unrolling="
)
=>
purescala
.
Settings
.
unrollingLevel
=
try
{
s
.
substring
(
"unrolling="
.
length
,
s
.
length
).
toInt
}
catch
{
case
_
=>
0
}
case
s
if
s
.
startsWith
(
"unrolling="
)
=>
purescala
.
Settings
.
unrollingLevel
=
try
{
s
.
substring
(
"unrolling="
.
length
,
s
.
length
).
toInt
}
catch
{
case
_
=>
0
}
case
s
if
s
.
startsWith
(
"functions="
)
=>
purescala
.
Settings
.
functionsToAnalyse
=
Set
(
splitList
(
s
.
substring
(
"functions="
.
length
,
s
.
length
))
:
_
*
)
case
s
if
s
.
startsWith
(
"functions="
)
=>
purescala
.
Settings
.
functionsToAnalyse
=
Set
(
splitList
(
s
.
substring
(
"functions="
.
length
,
s
.
length
))
:
_
*
)
case
s
if
s
.
startsWith
(
"extensions="
)
=>
purescala
.
Settings
.
extensionNames
=
splitList
(
s
.
substring
(
"extensions="
.
length
,
s
.
length
))
case
s
if
s
.
startsWith
(
"extensions="
)
=>
purescala
.
Settings
.
extensionNames
=
splitList
(
s
.
substring
(
"extensions="
.
length
,
s
.
length
))
...
...
This diff is collapsed.
Click to expand it.
src/purescala/FairZ3Solver.scala
+
47
−
11
View file @
3dc2bb81
...
@@ -327,19 +327,52 @@ class FairZ3Solver(val reporter: Reporter) extends Solver(reporter) with Abstrac
...
@@ -327,19 +327,52 @@ class FairZ3Solver(val reporter: Reporter) extends Solver(reporter) with Abstrac
definitiveAnswer
=
Some
(
false
)
definitiveAnswer
=
Some
(
false
)
definitiveModel
=
cleanModel
definitiveModel
=
cleanModel
}
else
{
}
else
{
reporter
.
info
(
"We need to keep going."
)
reporter
.
info
(
"- We need to keep going."
)
val
toRelease
:
Set
[
Expr
]
=
if
(
USEUNSATCORE
)
{
val
toRelease
:
Set
[
Expr
]
=
blockingSet
blockingSet
//core.map(fromZ3Formula(_)).toSet
}
else
{
var
fixedForEver
:
Set
[
Expr
]
=
Set
.
empty
blockingSet
if
(
Settings
.
pruneBranches
)
{
for
(
ex
<-
blockingSet
)
ex
match
{
case
Not
(
Variable
(
b
))
=>
{
z3
.
push
z3
.
assertCnstr
(
toZ3Formula
(
z3
,
Variable
(
b
)).
get
)
z3
.
check
match
{
case
Some
(
false
)
=>
{
//println("We had ~" + b + " in the blocking set. We now know it should stay there forever.")
z3
.
pop
(
1
)
z3
.
assertCnstr
(
toZ3Formula
(
z3
,
Not
(
Variable
(
b
))).
get
)
fixedForEver
=
fixedForEver
+
ex
}
case
_
=>
z3
.
pop
(
1
)
}
}
case
Variable
(
b
)
=>
{
z3
.
push
z3
.
assertCnstr
(
toZ3Formula
(
z3
,
Not
(
Variable
(
b
))).
get
)
z3
.
check
match
{
case
Some
(
false
)
=>
{
//println("We had " + b + " in the blocking set. We now know it should stay there forever.")
z3
.
pop
(
1
)
z3
.
assertCnstr
(
toZ3Formula
(
z3
,
Variable
(
b
)).
get
)
fixedForEver
=
fixedForEver
+
ex
}
case
_
=>
z3
.
pop
(
1
)
}
}
case
_
=>
scala
.
Predef
.
error
(
"Should not have happened."
)
}
if
(
fixedForEver
.
size
>
0
)
{
reporter
.
info
(
"- Pruned out "
+
fixedForEver
.
size
+
" branches."
)
}
}
}
// println("Release set : " + toRelease)
// println("Release set : " + toRelease)
blockingSet
=
blockingSet
--
toRelease
blockingSet
=
blockingSet
--
toRelease
val
toReleaseAsPairs
:
Set
[(
Identifier
,
Boolean
)]
=
toRelease
.
map
(
b
=>
b
match
{
val
toReleaseAsPairs
:
Set
[(
Identifier
,
Boolean
)]
=
(
toRelease
--
fixedForEver
)
.
map
(
b
=>
b
match
{
case
Variable
(
id
)
=>
(
id
,
true
)
case
Variable
(
id
)
=>
(
id
,
true
)
case
Not
(
Variable
(
id
))
=>
(
id
,
false
)
case
Not
(
Variable
(
id
))
=>
(
id
,
false
)
case
_
=>
scala
.
Predef
.
error
(
"Impossible value in release set: "
+
b
)
case
_
=>
scala
.
Predef
.
error
(
"Impossible value in release set: "
+
b
)
...
@@ -353,7 +386,10 @@ class FairZ3Solver(val reporter: Reporter) extends Solver(reporter) with Abstrac
...
@@ -353,7 +386,10 @@ class FairZ3Solver(val reporter: Reporter) extends Solver(reporter) with Abstrac
// z3.assertCnstr(toZ3Formula(z3, clause).get)
// z3.assertCnstr(toZ3Formula(z3, clause).get)
// }
// }
z3
.
assertCnstr
(
toZ3Formula
(
z3
,
And
(
newClauses
)).
get
)
for
(
ncl
<-
newClauses
)
{
z3
.
assertCnstr
(
toZ3Formula
(
z3
,
ncl
).
get
)
}
//z3.assertCnstr(toZ3Formula(z3, And(newClauses)).get)
blockingSet
=
blockingSet
++
Set
(
newBlockers
.
map
(
p
=>
if
(
p
.
_2
)
Not
(
Variable
(
p
.
_1
))
else
Variable
(
p
.
_1
))
:
_
*
)
blockingSet
=
blockingSet
++
Set
(
newBlockers
.
map
(
p
=>
if
(
p
.
_2
)
Not
(
Variable
(
p
.
_1
))
else
Variable
(
p
.
_1
))
:
_
*
)
}
}
}
}
...
@@ -377,17 +413,17 @@ class FairZ3Solver(val reporter: Reporter) extends Solver(reporter) with Abstrac
...
@@ -377,17 +413,17 @@ class FairZ3Solver(val reporter: Reporter) extends Solver(reporter) with Abstrac
evalResult
match
{
evalResult
match
{
case
OK
(
BooleanLiteral
(
true
))
=>
{
case
OK
(
BooleanLiteral
(
true
))
=>
{
reporter
.
info
(
"Model validated:"
)
reporter
.
info
(
"
-
Model validated:"
)
reporter
.
info
(
modelAsString
)
reporter
.
info
(
modelAsString
)
(
true
,
asMap
)
(
true
,
asMap
)
}
}
case
RuntimeError
(
msg
)
=>
{
case
RuntimeError
(
msg
)
=>
{
reporter
.
info
(
"Model leads to runtime error: "
+
msg
)
reporter
.
info
(
"
-
Model leads to runtime error: "
+
msg
)
reporter
.
error
(
modelAsString
)
reporter
.
error
(
modelAsString
)
(
true
,
asMap
)
(
true
,
asMap
)
}
}
case
OK
(
BooleanLiteral
(
false
))
=>
{
case
OK
(
BooleanLiteral
(
false
))
=>
{
reporter
.
info
(
"Invalid model."
)
reporter
.
info
(
"
-
Invalid model."
)
(
false
,
Map
.
empty
)
(
false
,
Map
.
empty
)
}
}
case
other
=>
{
case
other
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/purescala/Settings.scala
+
1
−
0
View file @
3dc2bb81
...
@@ -19,5 +19,6 @@ object Settings {
...
@@ -19,5 +19,6 @@ object Settings {
var
testBounds
:
(
Int
,
Int
)
=
(
0
,
3
)
var
testBounds
:
(
Int
,
Int
)
=
(
0
,
3
)
var
useInstantiator
:
Boolean
=
false
var
useInstantiator
:
Boolean
=
false
var
useFairInstantiator
:
Boolean
=
false
var
useFairInstantiator
:
Boolean
=
false
var
pruneBranches
:
Boolean
=
false
def
useAnyInstantiator
:
Boolean
=
useInstantiator
||
useFairInstantiator
def
useAnyInstantiator
:
Boolean
=
useInstantiator
||
useFairInstantiator
}
}
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