【发布时间】:2026-02-11 21:30:01
【问题描述】:
我刚开始学习合金模型语言,并试图在合金中编写自己的数组模型。但是,我无法从关系中提取索引。这是我的信号和事实:
sig Element {}
one sig Array {
// Map index to element
IdxEle: Int -> Element,
// Length of the array.
length: Int
}
fact Index {
all r : IdxEle | r.Int >= 0 and r.Int < length
}
我得到的错误是
This must be an integer expression.
Instead, it has the following possible type(s):
{none->none}
我查看了参考指南,但找不到提取关系的 idx 字段的方法。有人可以帮帮我吗? 谢谢
【问题讨论】: