Are Coq tacticals right associative or left associative?

你离开我真会死。 提交于 2019-12-11 07:21:14

问题


I was going through software foundations and got the example:

repeat (try (left; reflexivity); right).

and was confused what this meant. For example do we get:

try [ (left; reflexivity); right ]

or

[try (left; reflexivity);] right

second or first?


in particular I was trying to understand:

Theorem In10 : In 10 [1;2;3;4;5;6;7;8;9;10].
Proof.
  repeat (try (left; reflexivity); right).
Qed.

回答1:


A good way of solving those problems on your own is to use tactics like idtac (always succeeds) and fail (always fails) to disambiguate:

try (idtac; idtac); fail.     (* FAILS *)
try ((idtac; idtac); fail).   (* SUCCEEDS *)
(try (idtac; idtac)); fail.   (* FAILS *)

So indeed, the application of try binds tighter than the semicolon:

try (idtac; idtac); fail.   is the same as   (try (idtac; idtac)); fail.


来源:https://stackoverflow.com/questions/53750496/are-coq-tacticals-right-associative-or-left-associative

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