Dafny没有触发谓词的术语

时间:2018-04-04 10:45:14

标签: 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 ==> (forall j :: 0 <= j < board.Length1 ==> board[i, j] == 1)
}

目前我在这个谓词的主体和我的程序中的所有其他谓词(对于winColumn,winDiag,等等)收到/!\ No terms found to trigger on.错误

如果有人可以帮我解决这个问题,我将不胜感激

1 个答案:

答案 0 :(得分:1)

这是一种方法:引入一个辅助函数来保存import org.apache.commons.modeler.Registry;量词。然后,Dafny将使用此辅助函数作为外部 org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.Error: Unresolved compilation problems: The import org.apache.commons.modeler cannot be resolved Registry cannot be resolved to a type Registry cannot be resolved to a type Registry cannot be resolved Registry cannot be resolved Registry cannot be resolved to a type Registry cannot be resolved to a type at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:561) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:462) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.gy.filters.AccessControlFilter.doFilter(AccessControlFilter.java:150) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: javax.servlet.ServletException: java.lang.Error: Unresolved compilation problems: The import org.apache.commons.modeler cannot be resolved Registry cannot be resolved to a type Registry cannot be resolved to a type Registry cannot be resolved Registry cannot be resolved Registry cannot be resolved to a type Registry cannot be resolved to a type at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845) at org.apache.jsp.contextlist_jsp._jspService(contextlist_jsp.java:148) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) ... 26 more Caused by: java.lang.Error: Unresolved compilation problems: The import org.apache.commons.modeler cannot be resolved Registry cannot be resolved to a type Registry cannot be resolved to a type Registry cannot be resolved Registry cannot be resolved Registry cannot be resolved to a type Registry cannot be resolved to a type at com.gy.admin.JmxTools.<init>(JmxTools.java:18) at org.apache.jsp.contextlist_jsp._jspService(contextlist_jsp.java:100) ... 29 more 量词的触发器,修复警告。

forall

有关触发器的详情,请参阅this answer