Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
i7
peregrine
Commits
d491c666
Commit
d491c666
authored
Jul 15, 2014
by
Philipp Meyer
Browse files
Removed implicit properties no deadlock unless and workflow
parent
dcd33cf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Main.hs
View file @
d491c666
...
...
@@ -25,10 +25,8 @@ import Solver.SComponent
data
InputFormat
=
PNET
|
LOLA
|
TPN
deriving
(
Show
,
Read
)
data
ImplicitProperty
=
Termination
|
NoDeadlock
|
NoDeadlockUnless
String
|
NoDeadlockUnlessFinal
|
NoDeadlock
|
NoDeadlockUnlessFinal
|
ProperTermination
|
Workflow
|
Safe
|
Bounded
Integer
deriving
(
Show
,
Read
)
...
...
@@ -63,12 +61,6 @@ options =
(
NoArg
(
\
opt
->
Right
opt
{
inputFormat
=
TPN
}))
"Use the tpn input format"
,
Option
""
[
"workflow"
]
(
NoArg
(
\
opt
->
Right
opt
{
optProperties
=
Workflow
:
optProperties
opt
}))
"Check that the net is a workflow net"
,
Option
""
[
"termination"
]
(
NoArg
(
\
opt
->
Right
opt
{
optProperties
=
Termination
:
optProperties
opt
...
...
@@ -94,14 +86,6 @@ options =
(
"Prove that there is no deadlock unless
\n
"
++
"only final places are marked"
)
,
Option
""
[
"no-deadlock-unless"
]
(
ReqArg
(
\
arg
opt
->
Right
opt
{
optProperties
=
NoDeadlockUnless
arg
:
optProperties
opt
})
"FILE"
)
(
"Prove that there is no deadlock unless
\n
"
++
"the formula given in FILE is satisfied"
)
,
Option
""
[
"safe"
]
(
NoArg
(
\
opt
->
Right
opt
{
optProperties
=
Safe
:
optProperties
opt
...
...
@@ -159,7 +143,7 @@ checkFile parser verbosity refine implicitProperties file = do
verbosePut
verbosity
2
$
"Places: "
++
show
(
length
$
places
net
)
++
"
\n
"
++
"Transitions: "
++
show
(
length
$
transitions
net
)
addedProperties
<-
map
M
(
makeImplicitProperty
net
)
implicitProperties
let
addedProperties
=
map
(
makeImplicitProperty
net
)
implicitProperties
rs
<-
mapM
(
checkProperty
verbosity
net
refine
)
(
addedProperties
++
properties
)
verbosePut
verbosity
0
""
...
...
@@ -168,47 +152,33 @@ checkFile parser verbosity refine implicitProperties file = do
placeOp
::
Op
->
(
String
,
Integer
)
->
Formula
placeOp
op
(
p
,
w
)
=
Atom
$
LinIneq
(
Var
p
)
op
(
Const
w
)
makeImplicitProperty
::
PetriNet
->
ImplicitProperty
->
IO
Property
makeImplicitProperty
net
Workflow
=
do
let
sources
=
filter
(
null
.
lpre
net
)
(
places
net
)
let
sinks
=
filter
(
null
.
lpost
net
)
(
places
net
)
putStrLn
"Sources:"
print
sources
putStrLn
"Sinks:"
print
sinks
return
$
Property
"workflow"
Safety
$
if
length
sources
==
1
&&
length
sinks
==
1
then
FFalse
else
FTrue
makeImplicitProperty
::
PetriNet
->
ImplicitProperty
->
Property
makeImplicitProperty
_
Termination
=
return
$
Property
"termination"
Liveness
FTrue
makeImplicitProperty
net
ProperTermination
=
do
Property
"termination"
Liveness
FTrue
makeImplicitProperty
net
ProperTermination
=
let
(
finals
,
nonfinals
)
=
partition
(
null
.
lpost
net
)
(
places
net
)
retur
n
$
Property
"proper termination"
Safety
i
n
Property
"proper termination"
Safety
(
foldl
(
:|:
)
FFalse
(
map
(
\
p
->
placeOp
Gt
(
p
,
0
))
finals
)
:&:
foldl
(
:|:
)
FFalse
(
map
(
\
p
->
placeOp
Gt
(
p
,
0
))
nonfinals
))
makeImplicitProperty
net
NoDeadlock
=
return
$
Property
"no deadlock"
Safety
$
Property
"no deadlock"
Safety
$
foldl
(
:&:
)
FTrue
(
map
(
foldl
(
:|:
)
FFalse
.
map
(
placeOp
Lt
)
.
lpre
net
)
(
transitions
net
))
makeImplicitProperty
net
NoDeadlockUnlessFinal
=
do
nodeadlock
<-
makeImplicitProperty
net
NoDeadlock
let
(
finals
,
nonfinals
)
=
partition
(
null
.
lpost
net
)
(
places
net
)
retur
n
$
Property
"no deadlock unless final"
Safety
$
makeImplicitProperty
net
NoDeadlockUnlessFinal
=
let
nodeadlock
=
makeImplicitProperty
net
NoDeadlock
(
finals
,
nonfinals
)
=
partition
(
null
.
lpost
net
)
(
places
net
)
i
n
Property
"no deadlock unless final"
Safety
$
(
foldl
(
:&:
)
FTrue
(
map
(
\
p
->
placeOp
Eq
(
p
,
0
))
finals
)
:|:
foldl
(
:|:
)
FFalse
(
map
(
\
p
->
placeOp
Gt
(
p
,
0
))
nonfinals
))
:&:
pformula
nodeadlock
makeImplicitProperty
net
(
NoDeadlockUnless
file
)
=
do
nodeadlock
<-
makeImplicitProperty
net
NoDeadlock
property
<-
parseFile
LOLA
.
parseFormula
file
return
$
Property
"no deadlock unless"
Safety
$
Neg
property
:&:
pformula
nodeadlock
makeImplicitProperty
net
(
Bounded
k
)
=
return
$
Property
(
show
k
++
"-bounded"
)
Safety
$
Property
(
show
k
++
"-bounded"
)
Safety
$
foldl
(
:|:
)
FFalse
(
map
(
\
p
->
placeOp
Gt
(
p
,
k
))
(
places
net
))
makeImplicitProperty
net
Safe
=
do
bounded
<-
makeImplicitProperty
net
(
Bounded
1
)
retur
n
$
Property
"safe"
Safety
$
pformula
bounded
makeImplicitProperty
net
Safe
=
let
bounded
=
makeImplicitProperty
net
(
Bounded
1
)
i
n
Property
"safe"
Safety
$
pformula
bounded
checkProperty
::
Int
->
PetriNet
->
Bool
->
Property
->
IO
Bool
checkProperty
verbosity
net
refine
p
=
do
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment