В «самом деле F4_All_wanted_books_are_had_by_someone» я пытаюсь сделать так, чтобы все разыскиваемые книги были сданы в аренду какому-то покровителю.То есть, если патрону нужна книга, он должен быть загружен (в противном случае он может быть отдан в аренду патрону, который этого хочет).На самом деле «F7_Cannot_want_what_you_have», патрон не может хотеть книгу, которую он или она уже имеет.Но когда я пытался выполнить код.он показывает, что экземпляр не найден, однако, он должен был найти экземпляр.
До того, как я добавлю "факт F4", экземпляр все еще может быть найден, но после того, как я добавил F4, экземпляр больше не может быть найден.Что-то не так в «деле F4»?и как я могу это исправить.спасибо за вашу помощь.
/**
* The books in a library.
*/
some sig Book{}
/**
* Patrons of the library, in general, have some books (on loan)
* and want some other books.
*/
some sig Patron {
has : set Book,
wants : set Book
}
/**
* The library has some books on reserve, some on the shelves,
* and some on hold because patrons want them (are waiting for
* them).
*
* Note: The books on loan are exactly those all the Patrons as
* a group "have".
*/
one sig Library {
onReserve : set Book,
onShelves : set Book
}
/**
* All wanted books are on loan to some patron (that is,
* some patron has the wanted book). Note that a patron
* *MAY* have a book out that nobody else wants.
*/
fact F4_All_wanted_books_are_had_by_someone {
all b : Patron | b.wants in b.has
}
/**
* Two different patrons cannot have the same book.
*/
fact F5_No_loan_conflicts {
all disj b1, b2 : Patron | no (b1.has & b2.has)
}
/**
* A patron cannot want a book he or she already has.
*/
fact F7_Cannot_want_what_you_have {
all b : Patron | no (b.wants & b.has)
}
run{
some onReserve
some onShelves - onReserve
some wants
some has
some Patron.has - Patron.wants
some Patron.has & Patron.wants
some has.Book & wants.Book
} for exactly 3 Patron, exactly 8 Book