aboutsummaryrefslogtreecommitdiffhomepage
path: root/library/declare.mli
blob: a8848660d7ff7014e3ebb8674e9713c0f4710d6d (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

(* $Id$ *)

(*i*)
open Names
open Term
open Sign
open Constant
open Inductive
(*i*)

(* This module provides the official functions to declare new variables, 
   parameters, constants and inductive types. Using the following functions
   will add the entries in the global environment (module [Global]), will
   register the declarations in the library (module [Lib]) --- so that the
   reset works properly --- and will fill some global tables such as 
   [Nametab] and [Impargs]. *)

type strength = 
  | DischargeAt of section_path 
  | NeverDischarge

type variable_declaration = constr * strength * bool
val declare_variable : identifier -> variable_declaration -> unit


type constant_declaration = constant_entry * strength * bool
val declare_constant : identifier -> constant_declaration -> unit

val declare_parameter : identifier -> constr -> unit

val declare_mind : mutual_inductive_entry -> unit

val declare_eliminations : section_path -> unit

val declare_syntax_constant : identifier -> constr -> unit

val make_strength : string list -> strength
val make_strength_0 : unit -> strength
val make_strength_1 : unit -> strength
val make_strength_2 : unit -> strength

(*s Corresponding test and access functions. *)

val is_constant : section_path -> bool
val constant_strength : section_path -> strength

val is_variable : identifier -> bool
val out_variable : section_path -> identifier * typed_type * strength * bool
val variable_strength : identifier -> strength

val out_syntax_constant : identifier -> constr

(*s It also provides a function [global_reference] to construct a global
  constr (a constant, an inductive or a constructor) from an identifier.
  To do so, it first looks for the section path using [Nametab.sp_of_id] and
  then constructs the corresponding term, associated to the current 
  environment of variables. *)

val global_operator : section_path -> identifier -> sorts oper * var_context
val global_reference : path_kind -> identifier -> constr
val global_reference_imps : path_kind -> identifier -> constr * int list

val is_global : identifier -> bool

val mind_path : constr -> section_path