-
Notifications
You must be signed in to change notification settings - Fork 5
/
defutils.mli
73 lines (61 loc) · 1.85 KB
/
defutils.mli
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
(*
* Utilities for defining terms
*)
open Constr
open Names
open Evd
open Environ
open Constrexpr
(* --- Defining Coq terms --- *)
(*
* Define a new Coq term
* Refresh universes if the bool is true, otherwise don't
* (Refreshing universes is REALLY costly)
*)
val define_term :
?typ:types -> Id.t -> evar_map -> types -> bool -> global_reference
(*
* Like define_term, but for a canonical structure
*)
val define_canonical :
?typ:types -> Id.t -> evar_map -> types -> bool -> global_reference
(* --- Converting between representations --- *)
(*
* Coq has many ways of representing terms. These functions convert
* between different representations, using extra information (environments,
* evar maps, and so on) as necessary
*
* The internal representation is constr or types (types aliases to constr).
* The type constr stands for "construction," not constructor.
*
* The external representation is constr_expr.
*
* References to definitions are represented by the global_reference type.
* Note that this is what the define_term and define_canonical functions
* above return. The type global_reference Univ.puniverses additionally
* stores universes.
*)
(*
* Intern a term
*)
val intern : env -> evar_map -> constr_expr -> evar_map * types
(*
* Extern a term
*)
val extern : env -> evar_map -> types -> constr_expr
(*
* Construct the external expression for a definition.
*)
val expr_of_global : global_reference -> constr_expr
(*
* Convert a term into a global reference with universes (or raise Not_found)
*)
val pglobal_of_constr : constr -> global_reference Univ.puniverses
(*
* Convert a global reference with universes into a term
*)
val constr_of_pglobal : global_reference Univ.puniverses -> constr
(*
* Safely instantiate a global reference, updating the evar map
*)
val new_global : evar_map -> global_reference -> evar_map * constr