Here is my alloy code:
one sig Library {
books: set Book, // set of the library's books
patrons: set Patron, // set of the library's patrons
circulation: Patron lone -> some Book // books in circulation
}
// set of books in the Library
sig Book {
}
// set of patrons
sig Patron {
curbooks: set Book // books currently checked out by a patron
}
So I want to add an assert that two Patron cannot currently have the same book. Here is the assertion I came with:
assert sameBook2Patrons {
all disj p, p': Patron | all b: p.curbooks | b not in p'.curbooks
}
So when check the assertion with:
check sameBook2Patrons{} for exactly 2 Book, exactly 2 Patron
Alloy does not find any counter-example. But when I use the run command, Alloy gives me plenty of counter example:
run{} for exactly 2 Book, exactly 2 Patron
Also, I read that adding a fact with the negation of a valid assertion is supposed to give no instance. I added that:
fact sameBook2Patrons {
not (all disj p, p': Patron | all b: p.curbooks | b not in p'.curbooks)
}
When I run the model, Alloy finds valid instance.
What am I doing wrong? Thank you.