aboutsummaryrefslogtreecommitdiffhomepage
path: root/dev/base_include
blob: a5ccf24aad0f62452a2d980a6e669bf0dcb729fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

(* File to include to get some Coq facilities under the ocaml toplevel.
   This file is loaded by include *)

#cd".";;
#directory "parsing";;
#directory "interp";;
#directory "toplevel";;
#directory "library";;
#directory "kernel";;
#directory "pretyping";;
#directory "lib";;
#directory "proofs";;
#directory "tactics";;
#directory "printing";;
#directory "grammar";;
#directory "intf";;
#directory "stm";;

#directory "+camlp4";; (* lazy solution: add both of camlp4/5 so that *)
#directory "+camlp5";; (* Gramext is found in top_printers.ml *)

#use "top_printers.ml";;
#use "vm_printers.ml";;

#install_printer  (* identifier *) ppid;;
#install_printer  (* identifier *) ppidset;;
#install_printer  (* Intset.t *) ppintset;;
#install_printer  (* label *) pplab;;
#install_printer  (* mod_bound_id *) ppmbid;;
#install_printer  (* dir_path *) ppdir;;
#install_printer  (* module_path *) ppmp;;
#install_printer  (* section_path *)  ppsp;;
#install_printer  (* qualid *)  ppqualid;;
#install_printer  (* kernel_name *) ppkn;;
#install_printer  (* constant *) ppcon;;
#install_printer  (* cl_index *) ppclindex;;
#install_printer  (* recarg Rtree.t *)  ppwf_paths;;
#install_printer  (* constr *)  print_pure_constr;;
#install_printer  (* patch *) ppripos;;
#install_printer  (* values *) ppvalues;;
#install_printer  (* Idpred.t *) pp_idpred;;
#install_printer  (* Cpred.t *) pp_cpred;;
#install_printer ppzipper;;
#install_printer ppstack;;
#install_printer (* Reductionops.Stack.t *) pp_stack_t;;
#install_printer ppatom;;
#install_printer ppwhd;;
#install_printer ppvblock;;
#install_printer  (* bigint *) ppbigint;;
#install_printer  (* loc *) pploc;;
#install_printer  (* substitution *) prsubst;;

(* Open main files *)

open Names
open Term
open Vars
open Context
open Typeops
open Term_typing
open Univ
open Inductive
open Indtypes
open Cooking
open Closure
open Reduction
open Safe_typing
open Declare
open Declaremods
open Impargs
open Libnames
open Globnames
open Nametab
open Library

open Cases
open Pattern
open Patternops
open Cbv
open Classops
open Pretyping
open Cbv
open Classops
open Clenv
open Clenvtac
open Glob_term
open Glob_ops
open Coercion
open Recordops
open Detyping
open Reductionops
open Evarconv
open Retyping
open Evarutil
open Evarsolve
open Tacred
open Evd
open Universes
open Termops
open Namegen
open Indrec
open Typing
open Inductiveops
open Unification

open Constrextern
open Constrintern
open Coqlib
open Genarg
open Modintern
open Notation
open Ppextend
open Reserve
open Syntax_def
open Constrexpr
open Constrexpr_ops
open Topconstr
open Notation_term
open Notation_ops
open Prettyp
open Search

open Evar_refiner
open Logic
open Pfedit
open Proof_type
open Redexpr
open Refiner
open Tacmach
open Decl_proof_instr
open Tactic_debug
open Decl_mode

open Auto
open Autorewrite
open Contradiction
open Eauto
open Elim
open Equality
open Evar_tactics
open Extraargs
open Extratactics
open Hipattern
open Inv
open Leminv
open Tacsubst
open Tacintern
open Tacinterp
open Tacticals
open Tactics
open Eqschemes

open Cerrors
open Class
open Command
open Indschemes
open Ind_tables
open Auto_ind_decl
open Coqinit
open Coqtop
open Discharge
open Himsg
open Metasyntax
open Mltop
open Record
open Coqloop
open Vernacentries
open Vernacinterp
open Vernac

(* Various utilities *)

let qid = Libnames.qualid_of_string;;

(* parsing of terms *)

let parse_constr = Pcoq.parse_string Pcoq.Constr.constr;;
let parse_tac    = Pcoq.parse_string Pcoq.Tactic.tactic;;
let parse_vernac = Pcoq.parse_string Pcoq.Vernac_.vernac;;

(* build a term of type glob_constr without type-checking or resolution of 
   implicit syntax *)

let e s = Constrintern.intern_constr (Global.env()) (parse_constr s);;

(* build a term of type constr with type-checking and resolution of 
   implicit syntax *)

let constr_of_string s = 
  Constrintern.interp_constr Evd.empty (Global.env()) (parse_constr s);;

(* get the body of a constant *)

open Declarations;;
open Declareops;;

let constbody_of_string s =
  let b = Global.lookup_constant (Nametab.locate_constant (qualid_of_string s)) in
  Option.get (Declareops.body_of_constant b);;

(* Get the current goal *)
(*
let getgoal x = top_goal_of_pftreestate (Pfedit.get_pftreestate x);;

let get_nth_goal n = nth_goal_of_pftreestate n (Pfedit.get_pftreestate ());;
let current_goal () = get_nth_goal 1;;
*)
let pf_e gl s = 
  Constrintern.interp_constr (project gl) (pf_env gl) (parse_constr s);;

(* Set usual printing since the global env is available from the tracer *)
let _ = Constrextern.in_debugger := false
let _ = Constrextern.set_extern_reference
  (fun loc _ r -> Libnames.Qualid (loc,Nametab.shortest_qualid_of_global Idset.empty r));;

open Coqloop
let go = loop

let _ =
 print_string
   ("\n\tOcaml toplevel with Coq printers and utilities (use go();; to exit)\n\n");
 flush_all()