sig Factor {}
sig Rule { rule : some Factor }
sig RuleSet { rules : some Rule }
sig EventRuleProperty {}
sig Event {
rulesets : some RuleSet,
rule_properties : rulesets -> Rule -> EventRuleProperty
}
How do I write a fact to restrict the rules in Event.rule_properties have to belong to Event.ruleset?
i tried to declare as
this doesn’t quite do it. see below, RuleSet_1 has only 1 rule, but Event_0.rule_properties maps it to two rules. but your tip is helpful, i will play with it for a bit to fix the model. thanks!
sig Factor {}
sig Rule { rule : some Factor }
sig RuleSet { rules : some Rule }
sig EventRuleProperty {}
sig Event {
rulesets : some RuleSet,
rule_properties : rulesets -> Rule -> one EventRuleProperty
}
fact {
all e: Event |
e.rule_properties in e.rulesets -> e.rulesets.rules -> one EventRuleProperty
}
fact {
all e : Event, rs : RuleSet, r : Rule {
e.rule_properties in e.rulesets -> e.rulesets.rules -> one EventRuleProperty
r !in rs.rules implies r !in e.rule_properties[rs].EventRuleProperty
}
}