| 1 |
When you start byte-compiled Rocq toplevel: |
| 2 |
|
| 3 |
rlwrap bin/coqtop.byte |
| 4 |
|
| 5 |
then if you type: |
| 6 |
|
| 7 |
Drop. |
| 8 |
|
| 9 |
you will decend from Rocq toplevel down to Ocaml toplevel. |
| 10 |
So if you want to learn: |
| 11 |
- the current values of some global variables you are interested in |
| 12 |
- or see what happens when you invoke certain functions |
| 13 |
this is the place where you can do that. |
| 14 |
|
| 15 |
When you try to print values belonging to abstract data types: |
| 16 |
|
| 17 |
# let sigma, env = Lemmas.get_current_context ();; |
| 18 |
|
| 19 |
val sigma : Evd.evar_map = <abstr> |
| 20 |
val env : Environ.env = <abstr> |
| 21 |
|
| 22 |
# Typeops.infer env (snd (Pretyping.understand_tcc env sigma (Constrintern.intern_constr env (Procq.parse_string Procq.Constr.lconstr "plus"))));; |
| 23 |
|
| 24 |
- : Environ.unsafe_judgment = {Environ.uj_val = <abstr>; uj_type = <abstr>} |
| 25 |
|
| 26 |
the printed values are not very helpful. |
| 27 |
|
| 28 |
One way how to deal with that is to load the corresponding printers: |
| 29 |
|
| 30 |
# #use "dev/include";; |
| 31 |
|
| 32 |
Consequently, the result of: |
| 33 |
|
| 34 |
# Typeops.infer env (snd (Pretyping.understand_tcc env sigma (Constrintern.intern_constr env (Procq.parse_string Procq.Constr.lconstr "plus"))));; |
| 35 |
|
| 36 |
will be printed as: |
| 37 |
|
| 38 |
- : Environ.unsafe_judgment = Nat.add : nat -> nat -> nat |
| 39 |
|
| 40 |
which makes more sense. |
| 41 |
|
| 42 |
To be able to understand the meaning of the data types, |
| 43 |
sometimes the best option is to turn those data types from abstract to concrete |
| 44 |
and look at them without any kind of pretty printing. |