Show all axioms Coq - 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

Related

interactive theorem proving with no specified goal

What's the best approach to do interactive theorem proving in Coq without specifying a Theorem definition first? I'd like to state some initial assumptions and definitions, and then interactively explore transformations to see if I can prove any interesting theorems without knowing them ahead of time. I'd like Coq to help me keep track of the transformed assumptions and check that my rewrites are valid, like when proving explicit theorems in interactive mode. Does Coq have support for this use case?
One convenient method is to use the Variable/Hypothesis commands (they do the same thing) to add assumptions and introduce example objects (eg, Variable n:nat. introduces a nat you can now work with). Then to get into theorem proving mode what I do occasionally is Goal False. to start proving False, just to make sure I don't accidentally prove the theorem. You can also assert and admit things to get additional assumptions without restarting the proof.

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.

How to save the current goal / subgoal as an `assert` lemma

During a proof, I come to a situation where the current goal/subgoal turned out to be useful in a later stage of the same theorem.
Is there a tactic to "save" the current goal as a lemma as if the current goal is asserted?
Of course, I can copy&paste to assert the goal explicitly, or write a separate Lemma before the current theorem. But I am just curious if shortcuts exist.
Thanks.
To my knowledge, there is no such feature in Coq, and neither CoqIDE nor ProofGeneral seems to provide one.
Leaving this answer for future reference.
I don't know since when it exists, but maybe the abstract tactic could help.
It allows you to name a part of the proof and re-use it later, even if you are in a different sub-goal.
If you are using Proof General, you can install a company-coq extension which provides this functionality. It is bound the C-c C-a C-x key sequence.

"Verbose" auto in Coq

I'm learning Coq and the book I'm learning from, (CPDT) makes heavy use of auto in proofs.
Since I'm learning I think it might be helpful for me to see exactly what auto is doing under the hood (the less magic early on the better). Is there any way to force it to display exactly what tactics or techniques it's using to compute the proof?
If not, is there a place which details exactly what auto does?
There are multiple ways to get a glance at what is going on under the hood.
TLDR: Put info before your tactic, or use Show Proof. before and after calling the tactic and spot the differences.
To see what a particular tactic invocation has been doing, you can prefix is with info, so as to show the particular proof steps it has taken.
(This might be broken with Coq 8.4, I see that they provide info_ versions of some tactics, read the error message if you need to.)
This is probably what you want at a beginner level, it can already be quite terse.
Another way to see what is currently going on within a proof is to use the command Show Proof.. It will show you the currently built term with holes, and show you which hole each of your current goals is supposed to fill.
This is probably more advanced, especially if you use tactic such as induction or inversion, as the term being built is going to be fairly involved, and will require you to understand the underlying nature of induction schemes or dependent pattern-matching (which CPDT should teach you soon enough).
Once you have finished a proof with Qed. (or Defined.), you can also ask to look at the term that was built by using Print term. where term is the name of the theorem/term.
This will often be a big and ugly term, and it needs some training to be able to read these for involved terms. In particular, if the term has been built via the use of powerful tactics (such as omega, crush, etc.), it is probably going to be unreadable. You'd basically only use that to scan at some particular place of the term you're interested in. If it's more than 10 lines long, don't even bother reading it in such a crude format! :)
With all of the previous, you can use Set Printing All. beforehand, so that Coq prints the unfolded, explicit versions of everything. It is additionally verbose but can help when you wonder what the values of implicit parameters are.
These are all the ones I can think of on the top of my head, there might be more though.
As for what a tactic does, the usual best answer is found in the documentation:
http://coq.inria.fr/distrib/V8.4/refman/Reference-Manual011.html##tactic155
Basically, auto tries to use all the hints provided (depending on the database you use), and to solve your goal combining them up to some depth (that you can specify). By default, the database is core and the depth is 5.
More info on that can be found here:
http://coq.inria.fr/distrib/V8.4/refman/Reference-Manual011.html#Hints-databases

Locating definition of a tactic in Coq proofs

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.