Alloy
enum { , }
enum { , }
abstract sig { : one }
abstract sig {
: lone ,
:
} {
some => ( = <=> . = )
}
•
•
2011 9 23
Alloy (2)
one sig extends {} {
in
}
one sig extends {} { no }
one sig extends {} {
= <=> ( . = => . = )
}
pred show {}
run show
•
• run : pred
2011 9 23
module tour/filesystem
abstract sig Object {}
sig Directory extends Object {
contents: set Object
}
one sig Root extends Directory {}
sig File extends Object {}
sig Alias extends File {to: Object}
pred show {}
run show
2011 9 23
fact FileBelongsSomewhere {
all f : File | one d : Directory |
f in d.contents
}
fact NoRecursiveDirs {
! no d : Directory | d in d.contents
}
fact RootHasNoSuperDir {
no d: Directory | Root in d.contents
}
• fact :
•
• ( )
2011 9 23
• Directory
• FileBelongsSomewhere
fact ObjBelongsSomewhere {
all o : Object | one d : Directory | o in d.contents
}
2011 9 23
……
•
• RootHasNoSuperDir
ObjBelongsSomewhere
• all o : Object all o : Object - Root
2011 9 23