저는 Alloy에 익숙하지 않습니다.이 술어를 작동 시키려고 노력하고 있지만 어디에 문제가 있는지 알 수 없습니다. 사용자는 당선에 참여할 때 당에 가입하거나 만들 때 총재가 선거 및 입후보 기간을 알리는 사람이며 사용자는 한 사람에게 투표하고 그 사람의 후보자에 대해 세 가지 기본 설정을 지정할 수 있습니다. 왜 그것이 인스턴스를 찾을 수 없는지 나는 모른다. 나 좀 도와 줄 수있어?이유 술어에 인스턴스가 없습니다. (Alloy)
module Politics
abstract sig Document{ }
abstract sig Photo{ }
sig Party{
id:one Int,
name:one String,
program:one Document,
symbol :one Photo,
CreateDate: one Int
}{CreateDate>Election.startCandidacy
CreateDate<Election.EndCandidacy}
sig User{
id: one Int,
name: one String,
surname: one String,
email: one String,
password: one String,
dateBirth: one Int,
vote: lone Vote
}
sig Governor extends User{
election:one Election,
}{vote != none}
abstract sig Candidate extends User{
cv: one Document,
motLetter: one Document,
party: one Party,
dateCand : one Int
}{cv !=motLetter
vote != none
dateCand > Election.startCandidacy
dateCand < Election.EndCandidacy}
one sig Election{
startCandidacy:one Int,
EndCandidacy:one Int,
dateElection: one Int
}{startCandidacy < EndCandidacy
dateElection>EndCandidacy}
sig Vote{
dateVote: one Int,
preference1: one Candidate,
preference2: lone Candidate,
preference3: lone Candidate
}{preference1 != preference2
preference1 != preference3
preference2 != preference3
dateVote = Election.dateElection}
// Facts
// Every user has a unique ID and username
fact noTwoUsersWithSameID{
no disj u1, u2 : User | u1.id = u2.id || u1.email = u2.email
}
// Every party is unique, with unique name, program and symbol
fact noTwoSameParties{
no disj p1, p2 : Party | p1.name = p2.name || p1.program = p2.program || p1.symbol = p2.symbol
}
// Every candidate has a unique cv and motivation letter
fact noTwoSameCandidates{
no disj c1, c2 : Candidate | c1.cv = c2.cv || c1.motLetter = c2.motLetter
}
// All preferences in the vote are on the same party
fact AllPreferencesSameParty{
all v: Vote | v.preference1.party = v.preference2.party and v.preference1.party = v.preference3.party
}
fact noSameVotes{
no disj u1, u2:User | u1.vote = u2.vote
all v:Vote | one u:User | u.vote = v
}
assert NoSameUsers{
no disj u1, u2 : User | u1.id = u2.id || u1.email = u2.email
}
check NoSameUsers for 4
pred show()
{
#Election > 1
//#Party > 3
#Candidate > 8
#User > 10
}
run show for 12
고맙습니다. 다시 시도해 보았습니다. 이제 작동합니다. – user3648691