I have two Alloy facts:
我有两个合金事实:
fact A5 {
all a, b : Filler, s, t : Slot |
(b in s.slot_of and s in a.fills and a in t.slot_of) implies b in t.slot_of
}
fact A6 {
all a, b : Filler, s, t : Slot | ((b in s.slot_of and s in a.fills) and
(a in t.slot_of and t in b.fills)) implies a = b
}
As I noticed that relation calculus style seems more efficient than predicate calculus style (less variables and clauses generated), I wanted to rewrite them using relation calculus style.
因为我注意到关系演算风格似乎比谓词演算风格更有效(生成的变量和子句更少),所以我想用关系演算风格重写它们。
For A5, I have this:
对于A5,我有这样的想法:
fact A5 { slot_of.fills.slot_of in slot_of }
which works well and is, if I correctly understand the styles, in relation calculus style.
它工作得很好,如果我正确理解了风格的话,那就是关系微积分风格。
But for A6, I didn’t achieve to rewrite it. For now, I got this:
但对于A6,我没有实现重写。目前,我得到了这样的结论:
fact A6 {
all a, b : Filler | (a->b in fills.slot_of and b->a in fills.slot_of) implies a = b
}
which is more efficient, but I think it is still in predicate calculus style. So I have some questions: is my current A6 in predicate calculus style? is it possible to rewrite it in relation calculus style? if so, how?
哪个更高效,但我认为它仍然是谓词演算的风格。所以我有一些问题:我现在的A6是不是采用了谓词演算的风格?有没有可能用关系微积分的方式重写?如果是这样的话,是如何做到的?
更多回答
优秀答案推荐
It's still in predicate calculus style because you're using the all
quantifier. To be relational, it can't use any quantifiers.
它仍然是谓词演算风格,因为您使用的是ALL量词。要成为关系型,它不能使用任何量词。
I think your intended fact is "the only symmetric relations are reflexive ones". The set of all reflexive relations is iden
and the set of all symmetric relations in r
is r & ~r
. So if you want to make A6
fully relational, you'd write fills.slot_of & ~(fills.slot_of) in iden
.
我认为你想要的事实是“唯一的对称关系是反身性的”。所有自反关系的集合是iden,r中所有对称关系的集合是r&~r。因此,如果您想使A6完全关系,您可以在iden中写成fils.lot_of&~(fuls.lot_of)。
更多回答
我是一名优秀的程序员,十分优秀!