Locating definition of a tactic in Coq proofs - coq

In studying Coq proofs of other authors, I often encounter a tactic, lets say "inv eq Heq" or "intro_b". I want to understand such tactics.
How can I find if it is a Coq tactic or a Tactic Notation defined somewhere in my current project?
Second, is there a way to find its definition?
I used SearchAbout, Search, Locate and Print but could not find answers to the above questions.

You should be able to use
Print Ltac <tacticname>.
to print the code of a user-defined tactic (according to the documentation).
To find where it is defined... I guess you're going to need grep unfortunately, Locate does not work for tactics names it seems.

As mentioned before, Print Ltac ... prints the code of a user-defined tactic.
To locate a user-defined tactic (i.e. to know where its defined), use Locate Ltac .... It gives you the fully qualified name. Then use Locate Library to find the corresponding file.

Related

Locating Tactic Notation

Is it possible to Locate where a Tactic Notation is defined in Coq?
I know it is possible to locate base tactics using Locate Ltac basetac, non-tactic notation with queries such as Locate "++".
For the notation I'm looking for, I can see it in the tactic grammar with Print Grammar tactic, but is there a way to locate where it's defined?

How can I find what file a value is defined in?

When I work on a Coq proof I often want to find which file a definition comes from.
E.g. I had a goal which contains list_norepet (map fst (PTree.elements ta)), and I wanted to find the file that defined list_norepet. Doing Print list_norepet. shows lots of helpful information, but not the file name. Is there any way to get Coq to print that?
You can use Locate to get the full module name. Usually this is enough to find the file, but then you can use Locate File to try to find it:
Locate eq_rect.
(* Constant Coq.Init.Logic.eq_rect *)
Locate File "Init/Logic.v".
(* /Users/tchajed/code/sw/coq-master/theories/Init/Logic.v *)
I say "try to find it" because you do need to know the remappings (with -R) to be able to translate module paths to file paths - for example, Coq's standard library is in theories but is mapped to Coq.

What does the Coq command Require Import Ltac do?

When I am looking at the QuickChick project, I encountered the sentence Require Import Ltac. I don't know what this does and where the Ltac module is. I found a file plugins/ltac/Ltac.v, but this couldn't be the one since this file is empty (by the way, what is the purpose of including an empty file anyway?). I tried Locate Ltac. but I got Error: Syntax error: [constr:global] expected after 'Ltac' (in [locatable])., which is more confusing.
What does the Ltac module do, where is the Ltac.v file, and why doesn't the Loacte command work in this case? Thanks!
Require Import Ltac. is indeed Coq.ltac.Ltac, the empty file you found! I am not sure why there's an empty file there, but it was introduced when Ltac was moved to a plugin. Perhaps it serves as a placeholder for if some of the Ltac implementation were moved into Coq rather than being an OCaml plugin. In any case I think there's little reason for QuickChick to import it, unless they're anticipating some change to Coq I don't know about.
Because of a conflict with the vernacular command Locate Ltac (which is giving you a syntax error), you need to instead use Locate Module explicitly. The same goes for Print Module.
Locate Module Ltac reports Module Coq.ltac.Ltac, which tells you that you're indeed looking at theories/ltac/Ltac.v, and Print Module Ltac shows an empty module. However, that second bit is misleading, since what look like empty modules can still have notations (that's not the case here, but just FYI).

Refine and # (at) symbol in Coq 8.5pl1

In the previous version of Coq using symbol # in refine command allows me to create a prove step-by-step. (Each argument was a separate goal.)
I want to avoid implicit arguments like "?Goal0 ?Goal1". And now I can not.
What should I do obtain such possibility?
(It is very uncomfortable to me especially when I trying to deal with recursive functions.)
You are looking for simple refine.
In 8.5, goals that can be solved by unification (what you call implicit) are put in the "shelve" a hidden area, as they are considered trivial. You can unshelve them with Unshelve but it is a bit incovenient as it is a vernacular command.
simple refine behaves as 8.4 and doesn't put anything in the shelve.

Show all axioms Coq

I want to see all axioms which were used by my proof.
What are the easiest ways to obtain such information?
Which commands or scripts or tools I shall use?
I am interested in either all axioms or all used axioms.
You should use the
Print Assumptions foobar.
vernacular command, described here