| 1 |
(* File included to get some Coq facilities under the OCaml toplevel. *) |
| 2 |
|
| 3 |
(* parsing of terms *) |
| 4 |
|
| 5 |
let parse_constr = Procq.parse_string Procq.Constr.constr |
| 6 |
let parse_vernac = Procq.parse_string Pvernac.Vernac_.vernac_control |
| 7 |
let parse_tac = Procq.parse_string Ltac_plugin.Pltac.tactic |
| 8 |
|
| 9 |
(* build a term of type glob_constr without type-checking or resolution of |
| 10 |
implicit syntax *) |
| 11 |
|
| 12 |
let e s = |
| 13 |
let env = Global.env () in |
| 14 |
let sigma = Evd.from_env env in |
| 15 |
Constrintern.intern_constr env sigma (parse_constr s) |
| 16 |
|
| 17 |
(* build a term of type constr with type-checking and resolution of |
| 18 |
implicit syntax *) |
| 19 |
|
| 20 |
let constr_of_string s = |
| 21 |
let env = Global.env () in |
| 22 |
let sigma = Evd.from_env env in |
| 23 |
Constrintern.interp_constr env sigma (parse_constr s) |
| 24 |
|
| 25 |
(* get the body of a constant *) |
| 26 |
|
| 27 |
let constbody_of_string s = |
| 28 |
let b = Global.lookup_constant (Nametab.locate_constant (Libnames.qualid_of_string s)) in |
| 29 |
Option.get (Global.body_of_constant_body Library.indirect_accessor b) |
| 30 |
|
| 31 |
(* Get the current goal *) |
| 32 |
(* |
| 33 |
let getgoal x = top_goal_of_pftreestate (Pfedit.get_pftreestate x);; |
| 34 |
|
| 35 |
let get_nth_goal n = nth_goal_of_pftreestate n (Pfedit.get_pftreestate ());; |
| 36 |
let current_goal () = get_nth_goal 1;; |
| 37 |
*) |
| 38 |
|
| 39 |
let pf_e gl s = |
| 40 |
Constrintern.interp_constr (Proofview.Goal.env gl) (Proofview.Goal.sigma gl) (parse_constr s) |