Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Triggers Dafny谓词上没有要触发的术语_Triggers_Verification_Dafny - Fatal编程技术网

Triggers Dafny谓词上没有要触发的术语

Triggers Dafny谓词上没有要触发的术语,triggers,verification,dafny,Triggers,Verification,Dafny,我有一个tic tac toe游戏的Dafny代码片段,用于检查玩家1在棋盘上是否有获胜的一行: predicate isWinRowForPlayer1(board: array2<int>) reads board requires board.Length0 == board.Length1 == 3 && isValidBoard(board) { exists i :: 0 <= i < board.Length0 ==> (f

我有一个tic tac toe游戏的Dafny代码片段,用于检查玩家1在棋盘上是否有获胜的一行:

predicate isWinRowForPlayer1(board: array2<int>)
  reads board
  requires board.Length0 == board.Length1 == 3 && isValidBoard(board)
{
  exists i :: 0 <= i < board.Length0 ==> (forall j :: 0 <= j < board.Length1 ==> board[i, j] == 1)
}
谓词为WinRowForPlayer1(板:array2)
阅读板
需要board.Length0==board.Length1==3&&isValidBoard(board)
{
存在i::0(对于所有j::0板[i,j]==1)
}
目前我得到了一个
/!\找不到可触发的术语。
此谓词体和我程序中的所有其他谓词(用于winColumn、winDiag等)出错


如果有人能帮我解决这个问题,我将不胜感激。这里有一种方法:引入一个helper函数来保存所有量词的
。然后,Dafny将使用此辅助函数作为外部
存在
量词的触发器,修复警告

predicate RowIsWinRowForPlayer1(board: array2<int>, row: int)
    reads board
    requires 0 <= row < board.Length0
{
    forall j :: 0 <= j < board.Length1 ==> board[row, j] == 1
}

predicate isWinRowForPlayer1(board: array2<int>)
  reads board
  requires board.Length0 == board.Length1 == 3 && isValidBoard(board)
{
  exists i :: 0 <= i < board.Length0 ==> RowIsWinRowForPlayer1(board, i)
}
谓词行为WinRowForPlayer1(板:array2,行:int)
阅读板
需要0