如何在 Coq 中查找标识符的源文件

How to find the source file for an identifier in Coq

在我意识到在 Coq 的某处同时定义了 Rsqrtsqrt 之前,我盯着一个错误看了很长时间:

Unable to unify "0 < Rsqrt ?M2352 \/ 0 = Rsqrt ?M2352" with "0 < sqrt r12 \/ 0 = sqrt r12".

而不是具体询问如何找到这两个特定项目(Rsqrtsqrt)的定义位置,是否有从标准中找到 .v 文件的通用方法在其中定义了诸如 sqrt 之类的名称的库?

顺便说一句,我知道 CheckPrint。但我需要找到相关的源文件或文档,以查看有关该对象的可用引理。

我不知道有这样的功能,但我认为你可以使用 Locate(或有时 SearchAbout sqrt)来获取术语的完整路径,然后轻松猜出相应的 .v 文件.

使用 Emacs + ProofGeneral, after following the instructions in the Installation notes:

Install coqtags in a standard place or add /coq to your PATH. NB: You may need to change the path to perl at the top of the file.

Generate a TAGS file for the library by running

coqtags find . -name \*.v -print

in the root directory of the library, $COQTOP/theories.

您可以使用 M-. 转到定义光标下的标识符的 .v 文件,您可以使用 M-* 返回。

emacs 插件 company-coq 有这个非常方便的功能。

https://github.com/cpitclaudel/company-coq