Skip to content

Instantly share code, notes, and snippets.

@parlarjb
Created August 27, 2019 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parlarjb/6fab325a3758fec86740077c193dd397 to your computer and use it in GitHub Desktop.
Save parlarjb/6fab325a3758fec86740077c193dd397 to your computer and use it in GitHub Desktop.
one sig Person {
}
sig Resource {
, access: set Person
, parent: lone Resource
}
fact "No cycles" {
no r: Resource |
r in r.^parent
}
pred can_access[p: Person, r: Resource] {
p in (r.access + r.parent.access)
}
//if you can access the parent, you can access all its children
assert parent_implies_child {
all p: Person, r: Resource |
can_access[p, r] => all child: parent.r | can_access[p, child]
}
check parent_implies_child
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment