Created
October 28, 2015 17:34
-
-
Save hironow/af777a153660fe0abfe2 to your computer and use it in GitHub Desktop.
Alloy File System Lesson I
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sig FSObject { | |
parent: lone Dir | |
} | |
sig Dir extends FSObject { | |
contents: set FSObject | |
} | |
sig File extends FSObject {} | |
fact { | |
all d: Dir, o: d.contents | o.parent = d | |
} | |
fact { | |
File + Dir = FSObject | |
} | |
one sig Root extends Dir {} { no parent } | |
fact { | |
FSObject in Root.*contents | |
} | |
assert acyclic { | |
no d: Dir | d in d.^contents | |
} | |
check acyclic for 5 | |
assert oneRoot { | |
one d: Dir | no d.parent | |
} | |
check oneRoot for 5 | |
assert oneLocation { | |
all o: FSObject | lone d: Dir | o in d.contents | |
} | |
check oneLocation for 5 | |
assert Wrong { | |
all obj, p: (FSObject - Root) | obj.parent = p.parent | |
} | |
check Wrong for 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment