// Examples for lecture Alloy Tour (part d, first model)
// January 2007
module tour/addressBookd
abstract sig Target {}
sig Addr extends Target {}
abstract sig Name extends Target {}
sig Alias, Group extends Name {}
sig Book {addr: Name -> Target}
{no n: Name | n in n.^addr
all a: Alias | lone a.addr}
// show a non-empty address book
pred show (b: Book) {some b.addr}
run show for 3 but 1 Book
// show a book with a aliasing mapping to a group,
// but no addresses associated with a group
pred emptygroup (b: Book) {
some a: Alias | some g: Group | a.(b.addr) = g && no g.(b.addr)
}
run emptygroup for 3 but 1 Book