Debian Codegraph @

pretyping/glob_term.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (** Untyped intermediate terms *)
12
13 (** [glob_constr] comes after [constr_expr] and before [constr].
14
15 Resolution of names, insertion of implicit arguments placeholder,
16 and notations are done, but coercions, inference of implicit
17 arguments and pattern-matching compilation are not. *)
18
19 open Names
20
21 type existential_name = Id.t
22
23 (** Sorts *)
24
25 type glob_qvar =
26 | GLocalQVar of lname
27 | GQVar of Sorts.QVar.t
28 | GRawQVar of Sorts.QVar.t (* hack for funind *)
29
30 type glob_relevance =
31 | GRelevant | GIrrelevant
32 | GRelevanceVar of glob_qvar
33
34 type glob_quality =
35 | GQConstant of Sorts.Quality.constant
36 | GQualVar of glob_qvar
37
38 type glob_sort_name =
39 | GSProp (** representation of [SProp] literal *)
40 | GProp (** representation of [Prop] level *)
41 | GSet (** representation of [Set] level *)
42 | GUniv of Univ.Level.t
43 | GLocalUniv of lident (** Locally bound universes (may also be nonstrict declaration) *)
44 | GRawUniv of Univ.Level.t
45 (** Hack for funind, DO NOT USE
46
47 Note that producing the similar Constrexpr.CRawType for printing
48 is OK, just don't try to reinterp it. *)
49
50 type 'a glob_sort_gen =
51 | UAnonymous of { rigid : UState.rigid } (** not rigid = unifiable by minimization *)
52 | UNamed of 'a
53
54 (** levels, occurring in universe instances *)
55 type glob_level = glob_sort_name glob_sort_gen
56
57 type glob_instance = glob_quality list * glob_level list
58
59 (** sort expressions *)
60 type glob_sort = (glob_qvar option * (glob_sort_name * int) list glob_sort_gen)
61
62 type glob_constraint = glob_sort_name * Univ.UnivConstraint.kind * glob_sort_name
63
64 type glob_recarg = int option
65
66 and glob_fix_kind =
67 | GFix of (glob_recarg array * int)
68 | GCoFix of int
69
70 (** The kind of patterns that occurs in "match ... with ... end"
71
72 locs here refers to the ident's location, not whole pat *)
73 type 'a cases_pattern_r =
74 | PatVar of Name.t
75 | PatCstr of constructor * 'a cases_pattern_g list * Name.t
76 (** [PatCstr(p,C,l,x)] = "|'C' 'l' as 'x'" *)
77 and 'a cases_pattern_g = ('a cases_pattern_r, 'a) DAst.t
78
79 type cases_pattern = [ `any ] cases_pattern_g
80
81 type binding_kind = Explicit | MaxImplicit | NonMaxImplicit
82
83 type relevance_info = glob_relevance option
84
85 type glob_evar_kind = Evar_kinds.glob_evar_kind =
86 | GImplicitArg of GlobRef.t * (int * Id.t) * bool (** Force inference *)
87 | GBinderType of Name.t
88 | GNamedHole of bool (* fresh? *) * Id.t (* coming from some ?[id] syntax *)
89 | GQuestionMark of Evar_kinds.question_mark
90 | GCasesType
91 | GInternalHole
92 | GImpossibleCase
93
94 (** Representation of an internalized (or in other words globalized) term. *)
95 type 'a glob_constr_r =
96 | GRef of GlobRef.t * glob_instance option
97 (** An identifier that represents a reference to an object defined
98 either in the (global) environment or in the (local) context. *)
99 | GVar of Id.t
100 (** An identifier that cannot be regarded as "GRef".
101 Bound variables are typically represented this way. *)
102 | GEvar of existential_name CAst.t * (lident * 'a glob_constr_g) list
103 | GPatVar of Evar_kinds.matching_var_kind (** Used for patterns only *)
104 | GApp of 'a glob_constr_g * 'a glob_constr_g list
105 | GLambda of Name.t * relevance_info * binding_kind * 'a glob_constr_g * 'a glob_constr_g
106 | GProd of Name.t * relevance_info * binding_kind * 'a glob_constr_g * 'a glob_constr_g
107 | GLetIn of Name.t * relevance_info * 'a glob_constr_g * 'a glob_constr_g option * 'a glob_constr_g
108 | GCases of Constr.case_style * 'a glob_constr_g option * 'a tomatch_tuples_g * 'a cases_clauses_g
109 (** [GCases(style,r,tur,cc)] = "match 'tur' return 'r' with 'cc'" (in [MatchStyle]) *)
110 | GLetTuple of Name.t list * (Name.t * 'a glob_constr_g option) * 'a glob_constr_g * 'a glob_constr_g
111 | GIf of 'a glob_constr_g * (Name.t * 'a glob_constr_g option) * 'a glob_constr_g * 'a glob_constr_g
112 | GRec of glob_fix_kind * Id.t array * 'a glob_decl_g list array *
113 'a glob_constr_g array * 'a glob_constr_g array
114 | GSort of glob_sort
115 | GHole of glob_evar_kind
116 | GGenarg of Genarg.glob_generic_argument
117 | GCast of 'a glob_constr_g * Constr.cast_kind option * 'a glob_constr_g
118 | GProj of (Constant.t * glob_instance option) * 'a glob_constr_g list * 'a glob_constr_g
119 | GInt of Uint63.t
120 | GFloat of Float64.t
121 | GString of Pstring.t
122 | GArray of glob_instance option * 'a glob_constr_g array * 'a glob_constr_g * 'a glob_constr_g
123 and 'a glob_constr_g = ('a glob_constr_r, 'a) DAst.t
124
125 and 'a glob_decl_g = Name.t * relevance_info * binding_kind * 'a glob_constr_g option * 'a glob_constr_g
126
127 and 'a predicate_pattern_g =
128 Name.t * (inductive * Name.t list) CAst.t option
129 (** [(na,id)] = "as 'na' in 'id'" where if [id] is [Some(l,I,k,args)]. *)
130
131 and 'a tomatch_tuple_g = ('a glob_constr_g * 'a predicate_pattern_g)
132
133 and 'a tomatch_tuples_g = 'a tomatch_tuple_g list
134
135 and 'a cases_clause_g = (Id.t list * 'a cases_pattern_g list * 'a glob_constr_g) CAst.t
136 (** [(il,cl,t)] = "|'cl' => 't'". Precondition: the free variables
137 of [t] are members of [il]. *)
138
139 and 'a cases_clauses_g = 'a cases_clause_g list
140
141 type glob_constr = [ `any ] glob_constr_g
142 type tomatch_tuple = [ `any ] tomatch_tuple_g
143 type tomatch_tuples = [ `any ] tomatch_tuples_g
144 type cases_clause = [ `any ] cases_clause_g
145 type cases_clauses = [ `any ] cases_clauses_g
146 type glob_decl = [ `any ] glob_decl_g
147 type predicate_pattern = [ `any ] predicate_pattern_g
148
149 type any_glob_constr = AnyGlobConstr : 'r glob_constr_g -> any_glob_constr
150
151 type 'a disjunctive_cases_clause_g = (Id.t list * 'a cases_pattern_g list list * 'a glob_constr_g) CAst.t
152 type 'a disjunctive_cases_clauses_g = 'a disjunctive_cases_clause_g list
153 type 'a cases_pattern_disjunction_g = 'a cases_pattern_g list
154
155 type disjunctive_cases_clause = [ `any ] disjunctive_cases_clause_g
156 type disjunctive_cases_clauses = [ `any ] disjunctive_cases_clauses_g
157 type cases_pattern_disjunction = [ `any ] cases_pattern_disjunction_g
158
159 type 'a extended_glob_local_binder_r =
160 | GLocalAssum of Name.t * relevance_info * binding_kind * 'a glob_constr_g
161 | GLocalDef of Name.t * relevance_info * 'a glob_constr_g * 'a glob_constr_g option
162 | GLocalPattern of ('a cases_pattern_disjunction_g * Id.t list) * Id.t * binding_kind * 'a glob_constr_g
163 and 'a extended_glob_local_binder_g = ('a extended_glob_local_binder_r, 'a) DAst.t
164
165 type extended_glob_local_binder = [ `any ] extended_glob_local_binder_g