2

How does one print and expand everything in a Coq term (e.g. implicits, notations, definition, everything)? I want to print absolutely everything (including the contents of the identifiers).

For example with a term, I tried a modest example with Set Printing All. but it didn't work as I expect. My script is:

Module print_everything.
  Definition id {A:Type} (x:A) := x.
  Print id.

  Definition id2 := @id.
  Print id2.

  Set Printing All.

  Print id2.
  Print All.
End.

but when I sent it to coq I got:

id2 = @id
     : forall (A : Type) (_ : A), A

but I expect the body of the function, something like this:

id2 = fun (A : Type) (x : A) => x
     : forall (A : Type) (_ : A), A

or

id = fun (A : Type) (x : A) => x
     : forall (A : Type) (_ : A), A

How does one remove all "abstractions", including notation, implicit and even identifiers so that I can see the entire lambda term (ideally when passing a Gallina term to Print_everything)?

If possible I'd like to control the scopes of which definitions are unpacked for me too. e.g. global variables qualid . qualid.

How does one print and expand everything in a Coq term (e.g. implicits, notations, definition, everything)?

It would also be nice to be able to expand and simplify as much as possible.


Related:

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
  • 1
    You can try using `cbv [...]` to selectively perform δ-reductions, at least for non-Qed terminated proofs. Something like `Set Printing All. Eval cbv in myterm.` can probably get you quite far, actually at the risk of crashing Coq. Why do you want to do this in the first place? – perthmad Jun 25 '21 at 00:14
  • You can also do `Eval cbv delta in myterm.`, which will unfold constants without beta-reducing. – Jason Gross Nov 10 '21 at 03:09
  • related: https://coq.discourse.group/t/print-the-curried-version-of-a-function-i-e-explicitly-printing-the-functions-as-an-explicit-chain/1735 – Charlie Parker Jul 22 '22 at 16:08

0 Answers0