Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
比方说,我必须对棋盘进行建模,并且我想说“A”垂直上的至少 5 个方格是空的。我如何在合金中做到这一点?任何其他数字不同于 0 或 1 的示例都会很好。换句话说,当“some”不够精确时,我该怎么办?谢谢!
您可以使用基数运算符 (#) 来断言关系中元组的数量,例如,
#r >= 5
表示关系r必须至少有 5 个元组。
r
您还可以将基数运算符与任意表达式一起使用,例如,
#board.cells >= 5
或者
#{c: Cell | c in board.cells and ...} >= 5