Debian Codegraph @

interp/constrexpr_ops.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 open Names
12 open Libnames
13 open Constrexpr
14
15 (** Constrexpr_ops: utilities on [constr_expr] *)
16
17 val expr_Type_sort : sort_expr
18 val expr_SProp_sort : sort_expr
19 val expr_Prop_sort : sort_expr
20 val expr_Set_sort : sort_expr
21
22 (** {6 Equalities on [constr_expr] related types} *)
23
24 val sort_name_expr_eq : sort_name_expr -> sort_name_expr -> bool
25 val univ_level_expr_eq : univ_level_expr -> univ_level_expr -> bool
26 val sort_expr_eq : sort_expr -> sort_expr -> bool
27 val relevance_info_expr_eq : relevance_info_expr -> relevance_info_expr -> bool
28
29 val explicitation_eq : explicitation -> explicitation -> bool
30 (** Equality on [explicitation]. *)
31
32 val constr_expr_eq_gen : (constr_expr -> constr_expr -> bool) -> constr_expr -> constr_expr -> bool
33
34 val constr_expr_eq : constr_expr -> constr_expr -> bool
35 (** Equality on [constr_expr]. This is a syntactical one, which is oblivious to
36 some parsing details, including locations. *)
37
38 val local_binder_eq : local_binder_expr -> local_binder_expr -> bool
39 (** Equality on [local_binder_expr]. Same properties as [constr_expr_eq]. *)
40
41 val binder_kind_eq : binder_kind -> binder_kind -> bool
42 (** Equality on [binder_kind] *)
43
44 (** {6 Retrieving locations} *)
45
46 val constr_loc : constr_expr -> Loc.t option
47 val cases_pattern_expr_loc : cases_pattern_expr -> Loc.t option
48 val local_binders_loc : local_binder_expr list -> Loc.t option
49
50 (** {6 Constructors} *)
51
52 (** {7 Term constructors} *)
53
54 (** Basic form of the corresponding constructors *)
55
56 val mkIdentC : Id.t -> constr_expr
57 val mkRefC : qualid -> constr_expr
58 val mkCastC : constr_expr * Constr.cast_kind option * constr_expr -> constr_expr
59 val mkLambdaC : lname list * binder_kind * constr_expr * constr_expr -> constr_expr
60 val mkLetInC : lname * constr_expr * constr_expr option * constr_expr -> constr_expr
61 val mkProdC : lname list * binder_kind * constr_expr * constr_expr -> constr_expr
62
63 val mkAppC : constr_expr * constr_expr list -> constr_expr
64 (** Basic form of application, collapsing nested applications *)
65
66 (** Optimized constructors: does not add a constructor for an empty binder list *)
67
68 val mkLambdaCN : ?loc:Loc.t -> local_binder_expr list -> constr_expr -> constr_expr
69 val mkProdCN : ?loc:Loc.t -> local_binder_expr list -> constr_expr -> constr_expr
70
71 (** Aliases for the corresponding constructors; generally [mkLambdaCN] and
72 [mkProdCN] should be preferred *)
73
74 val mkCLambdaN : ?loc:Loc.t -> local_binder_expr list -> constr_expr -> constr_expr
75 val mkCProdN : ?loc:Loc.t -> local_binder_expr list -> constr_expr -> constr_expr
76
77 (** {7 Pattern constructors} *)
78
79 (** Interpretation of a list of patterns as a disjunctive pattern (optimized) *)
80 val mkCPatOr : ?loc:Loc.t -> cases_pattern_expr list -> cases_pattern_expr
81
82 val mkAppPattern : ?loc:Loc.t -> cases_pattern_expr -> cases_pattern_expr list -> cases_pattern_expr
83 (** Apply a list of pattern arguments to a pattern *)
84
85 (** {6 Destructors}*)
86
87 val coerce_reference_to_id : qualid -> Id.t
88 (** FIXME: nothing to do here *)
89
90 val coerce_to_id : constr_expr -> lident
91 (** Destruct terms of the form [CRef (Ident _)]. *)
92
93 val coerce_to_name : constr_expr -> lname
94 (** Destruct terms of the form [CRef (Ident _)] or [CHole _]. *)
95
96 val coerce_to_cases_pattern_expr : constr_expr -> cases_pattern_expr
97
98 (** {6 Binder manipulation} *)
99
100 val default_binder_kind : binder_kind
101
102 val names_of_local_binders : local_binder_expr list -> lname list
103 (** Retrieve a list of binding names from a list of binders. *)
104
105 val names_of_local_assums : local_binder_expr list -> lname list
106 (** Same as [names_of_local_binder_exprs], but does not take the [let] bindings into
107 account. *)
108
109 (** {6 Folds and maps} *)
110
111 (** Used in typeclasses *)
112 val fold_constr_expr_with_binders : (Id.t -> 'a -> 'a) ->
113 ('a -> 'b -> constr_expr -> 'b) -> 'a -> 'b -> constr_expr -> 'b
114
115 (** Used in correctness and interface; absence of var capture not guaranteed
116 in pattern-matching clauses and in binders of the form [x,y:T(x)] *)
117
118 val map_constr_expr_with_binders :
119 (Id.t -> 'a -> 'a) -> ('a -> constr_expr -> constr_expr) ->
120 'a -> constr_expr -> constr_expr
121
122 (** {6 Miscellaneous}*)
123
124 val replace_vars_constr_expr :
125 Id.t Id.Map.t -> constr_expr -> constr_expr
126
127 val free_vars_of_constr_expr : constr_expr -> Id.Set.t
128 val occur_var_constr_expr : Id.t -> constr_expr -> bool
129
130 (** Return all (non-qualified) names treating binders as names *)
131 val names_of_constr_expr : constr_expr -> Id.Set.t
132
133 val ntn_loc : ?loc:Loc.t -> constr_notation_substitution -> notation -> (int * int) list
134 val patntn_loc : ?loc:Loc.t -> cases_pattern_notation_substitution -> notation -> (int * int) list
135
136 val isCSort : constr_expr -> bool
137
138 (** For cases pattern parsing errors *)
139 val error_invalid_pattern_notation : ?loc:Loc.t -> unit -> 'a