【发布时间】:2021-04-09 07:38:54
【问题描述】:
我正在学习如何使用 Alloy,并且我已经编写了代码:
module test/SlotsAndFillers
sig Slot { content: one Filler}
sig Filler { slots: set Slot}
fact AllSlotsAreOwned {
all s:Slot | some x:Filler | s in x.slots
}
fact ImproperParthoodSlots {
all x:Filler | some y, z:Slot | y in x.slots implies z in x.slots and x in z.content
}
fact SlotInheritance {
all x, y : Filler, z, z' : Slot | x != y and z != z' and z in y.slots and x in z.content and z' in x.slots implies z' in y.slots
}
fact SingleOccupancy {
all x:Slot, y:Filler | x in y.slots implies one z:Filler | z in x.content
}
fact MutualOccupancyIsIdentity {
all x, y: Filler, z, z': Slot | x != y and z != z' and
z in y.slots and x in z.content and z' in x.slots and y in z'.content implies x = y
}
pred show() {}
run show
当我执行和显示模型时,除了关系 content 和 slots 之外,模型还有新的关系,名为 $show_x , $show_y 和 $show_z。通过测试,我了解到如果我在谓词中添加内容,就会存在这些关系。但是对于这段代码,show 是空的,仍然存在这些关系。所以我有两个问题:它们来自哪里以及如何删除它们?我知道我可以隐藏它们,但是模型看起来都(几乎)相同。所以我想探索只使用我的两个关系而不是新关系的不同模型。
不要犹豫,重新编写或重新命名这篇文章。
谢谢!
【问题讨论】:
标签: alloy