How to use 'exists' quantifier?

拈花ヽ惹草 提交于 2021-01-27 20:54:36

问题


The Dafny documentation doesn't go through using 'exists' quantifiers.

method Main() {
    assert (exists n: int :: n > 1);
}

This comes up with an AssertionError


回答1:


The following works:

predicate dummy(n: int) {true}

method Main() {
    assert dummy(2);
    assert (exists n : int {:trigger dummy(n)} :: n > 1);
}

You can replace dummy(2) with dummy(m) for any integer m > 1.

This answer isn't great, since I can't tell you exactly why the above works. However, for more information on triggers you can read this.



来源:https://stackoverflow.com/questions/58315561/how-to-use-exists-quantifier

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!